epfl-archive/cs208-ca/vhdl/logic_unit.vhd

20 lines
476 B
VHDL
Raw Permalink Normal View History

2022-04-07 18:43:21 +02:00
library ieee;
use ieee.std_logic_1164.all;
entity logic_unit is
port(
a : in std_logic_vector(31 downto 0);
b : in std_logic_vector(31 downto 0);
op : in std_logic_vector(1 downto 0);
r : out std_logic_vector(31 downto 0)
);
end logic_unit;
architecture synth of logic_unit is
begin
r <= a nor b when op = "00" else
a and b when op = "01" else
a or b when op = "10" else
a xnor b;
end synth;