jianhuachews
Member level 2

Hi guys.. I was writing a testbench but errors occurred when i compiled it. could anyone tell me wht's wrong? I know it might look pretty obvious but i just don't see it.
The errors while compiling the test bench goes
Signal "altb_i" is type std_logic; expecting type std_logic_vector.
Signal "agtb_i" is type std_logic; expecting type std_logic_vector.
Signal "a" is type std_logic_vector; expecting type std_logic.
Signal "b" is type std_logic_vector; expecting type std_logic.
TB code
program code
Thanks in adv!
The errors while compiling the test bench goes
Signal "altb_i" is type std_logic; expecting type std_logic_vector.
Signal "agtb_i" is type std_logic; expecting type std_logic_vector.
Signal "a" is type std_logic_vector; expecting type std_logic.
Signal "b" is type std_logic_vector; expecting type std_logic.
TB code
Code:
Library IEEE;
Use IEEE.std_logic_1164.all;
Entity lab4bTB is
end;
Architecture comparator of lab4bTB is
signal altb_i, agtb_i: std_logic:='0';
signal aeqb_i: std_logic:='1';
signal a,b: std_logic_vector(3 downto 0):="0000";
signal agtb_o,agtb_out, aeqb_o,aeqb_out, altb_o, altb_out : std_logic;
begin
UUT : entity work.lab4b port map(altb_i, agtb_i, aeqb_i, a, b, altb_out, agtb_out, aeqb_out);
tb : process
begin
wait for 50 ns;
aeqb_i <= '1'; a<="1110";
wait for 50 ns;
aeqb_i <= '1'; b<="1111";
wait for 50 ns;
aeqb_i<='0'; agtb_i <='1';
wait for 50 ns;
a<="1010"; b<="1111";
wait for 50 ns;
agtb_i <='0'; altb_i<='1';
wait for 50 ns;
a<="1111"; b<="1010";
end process tb;
aeqb_o<=aeqb_out;
agtb_o<=agtb_out;
altb_o<=altb_out;
end;
program code
Code:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity lab4b is port (
a,b: in std_logic_vector(3 downto 0):="0000";
altb_i: in std_logic:='0';
aeqb_i: in std_logic:='1';
agtb_i: in std_logic:='0';
aeqb_o, agtb_o, altb_o: out std_logic
);
end;
architecture comparator of lab4b is
begin
process (agtb_i, aeqb_i, altb_i, a, b)
begin
if (aeqb_i='1') then
if (a=b) then
aeqb_o <= '1';
agtb_o <= '0';
altb_o <= '0';
elsif (a>b) then
agtb_o <='1';
aeqb_o <='0';
altb_o <='0';
elsif (a<b) then
agtb_o <='0';
aeqb_o <='0';
altb_o <='1';
elsif (agtb_i='1' or (altb_i='1' and a > b)) then
agtb_o <='1';
aeqb_o <='0';
altb_o <='0';
elsif (altb_i='1' or (agtb_i='1' and a < b)) then
agtb_o <='0';
aeqb_o <='0';
altb_o <='1';
else
aeqb_o<='0';
agtb_o<='0';
altb_o<='0';
end if;
end if;
end process;
end;
Thanks in adv!