Jan Hrabovsky
Jan Hrabovsky

Reputation: 3

VHDL multiplexing and two outputs

I need your help. I have a VHDL with nested condition and I would like to redraw it into a schematic. I think I should use one 2bit mux and 4bit mux. Is there anyone who can help me please? I tried google it but I didn't find anything that can help me.

process (a,b,c,d) begin
    y <= '0';
    z <= b;
    if d='1' then
        y <= b;
        if a = '0' then
            y <= c;
        end if;
        z <= '1';
    else
        y <= '1';
        z <= d;
    end if;
end process;

a,b,c,d are std_logic in

z, y are std_logic out

Upvotes: 0

Views: 516

Answers (1)

Ali Redha
Ali Redha

Reputation: 335

This a code for a 4-bit mux you can easily modify to make 2 bit

LIBRARY ieee;
USE ieee.std_logic_1164.ALL;

 ENTITY mux_4_1 IS
PORT (
    a : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
    s : IN STD_LOGIC_VECTOR(1 DOWNTO 0);
    b : OUT STD_LOGIC);
  END ENTITY;

   ARCHITECTURE behavioural OF mux_4_1 IS
   BEGIN
PROCESS (a, s)
BEGIN

    IF s = "00" THEN
        b <= a(0);
    ELSIF s = "01" THEN
        b <= a(1);
    ELSIF s = "10" THEN
        b <= a(2);
    ELSE
        b <= a(3);
    END IF;
END PROCESS;
END ARCHITECTURE;

Upvotes: 1

Related Questions