Vhdl Simili, how to change a signal's value?

Joined
Apr 10, 2008
Messages
1
Reaction score
0
Hi,
i'm new to vhdl and i'm using vhdl simili 3.1. I'm trying a simple testbench for a comparator. How can i change the value of a signal during simulation using the program's interface ?
i tried typing in the console : force a 111 '@50', but i got an error.
a is supposed to be a an input signal.

this is the testbench code:
---------------------------------------------------------------------
-- Test Bench for 2-bit Comparator (ESD figure 2.5)
-- by Weijun Zhang, 04/2001
--
-- nine cases are tested here
---------------------------------------------------------------------

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;

entity Comparator_TB is -- entity declaration
end Comparator_TB;

---------------------------------------------------------------------

architecture TB of Comparator_TB is

component Comparator
port( A: in std_logic_vector(1 downto 0);
B: in std_logic_vector(1 downto 0);
less: out std_logic;
equal: out std_logic;
greater: out std_logic
);
end component;

signal A, B: std_logic_vector(1 downto 0):="00";
signal less, equal, greater: std_logic;

begin

Unit: Comparator port map (A, B, less, equal, greater);

process

variable err_cnt: integer :=0;

begin

-- Case 1 (using the loop statement)
A <= "11";
B <= "00";
for i in 0 to 2 loop
wait for 10 ns;
assert (greater='1') report "Comparison Error detected!"
severity error;
if (greater/='1') then
err_cnt:=err_cnt+1;
end if;
B <= B + '1';
end loop;

-- Case 2 (using the loop statement)
A <= "00";
B <= "01";
for i in 0 to 2 loop
wait for 10 ns;
assert (less='1') report "Comparison Error detected!"
severity error;
if (less/='1') then
err_cnt:=err_cnt+1;
end if;
B <= B + '1';
end loop;

-- Case 3
A <= "01";
B <= "01";
wait for 10 ns;
assert (equal='1') report "Comparison Error detected!"
severity error;
if (equal/='1') then
err_cnt:=err_cnt+1;
end if;

-- summary of all the tests
if (err_cnt=0) then
assert false
report "Testbench of Adder completed successfully!"
severity note;
else
assert true
report "Something wrong, try again"
severity error;
end if;

wait;

end process;

end TB;

-------------------------------------------------------------------
configuration CFG_TB of Comparator_TB is
for TB
end for;
end CFG_TB;
--------------------------------------------------------------------

Thank you for your help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,967
Messages
2,570,148
Members
46,694
Latest member
LetaCadwal

Latest Threads

Top