Guest
#3793253
Hello to Everybody
Well im new in VHDL so maybe this is a really easy question for some
people in here i need to do a 2 bit Comparator in Behaviour
mi Design vhdl is like this:
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity comparator_2bit is
port(
A : in STD_LOGIC_VECTOR(1 downto 0);
B : in STD_LOGIC_VECTOR(1 downto 0);
Igual : out STD_LOGIC;
Mayor : out STD_LOGIC;
Menor : out STD_LOGIC
);
end comparator_2bit;
architecture comparator_2bit_arc of comparator_2bit is
begin
Igual <= '1' when (a=b) else //EQUALS
'0';
Mayor <= '1' when (a<b) else //GRETER
'0';
Menor <= '1' when (a>b) else //LOWER
'0';
end comparator_2bit_arc;
But my question is i don't know how to do the Testbench because i tried
doing something like this but when i try to compile i have a lot of
errors
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity comparator_2bit is
port (
A : in STD_LOGIC_VECTOR(1 downto 0);
B : in STD_LOGIC_VECTOR(1 downto 0);
Igual : out STD_LOGIC;
Mayor : out STD_LOGIC;
Menor : out STD_LOGIC
);
end comparator_2bit;
architecture Behavioral of comparator_2bit is
begin
process(a,b)
begin
A <= '1';
B <= '1';
wait for 1 ns;
assert(Igual='1') report "Fail 1/1" severity error;
-- Clear inputs
A <= '0';
B <= '0';
end process;
end Behavioral;
So please can you help me Im new in VHDL :/
