Jason
"When you look into the mirror, do you like what's looking at you? Now that you
see your true reflection, what on earth are you gonna do?" -- Boyd Tinsley of
Dave Matthews Band, song: "True Reflections"
Aldec let's you set-up stimulus without building a formal test bench, but
that is very limited, and I never found it of much use.
A test bench is just a model that does not have external ports and
instantiates the model(s) you are testing. At a minimum, you need to
generate a reset, a clock, and some form of test stimulus.
The clock and reset are straightforward:
architecture behave of test_bench is
...
signal clock : std_logic := '1' ;
signal reset : std_logic := '1' ;
...
begin
clock <= not( clock ) after ( CLOCK_PERIOD / 2 ) ns ; --fs, ps, ns,
us, ms etc
reset <= '0' after ( CLOCK_PERIOD / 2 ) ns ;
Here, reset asserts from 0, and negates the first time the clock falls.
In the most trivial test-benches, you just drive the DUT inputs and manually
observe the outputs. Self-checking test benches are much more thorough and
usually include transactor models that interact with the design, and a test
vector reader that reads vectors either from a constant array defined in the
test-bench, ( very fast ), or from a file, ( doesn't need recompilation of
the test bench for every test vector change ).
"VHDL" by Perry, and to a lesser extent "VHDL Primer" by Bhasker will
probably help you.
Regards,
"SQ 240" <sq...@aol.com> wrote in message
news:20020506173745...@mb-ba.aol.com...
here's a example test bench to test the working of a comparator. It
makez Z high if A > B, and 0 Otherwise.
-----
library IEEE;
use ieee.sparc0S5.all;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_signed.all;
--use IEEE.std_logic_unsigned.all;
entity TB_MULT is
generic(N:integer:=16;POW2_N:integer:=10);
end TB_MULT;
architecture LAB2_ARCH of TB_COMP is
--************************************************
-- between these comments, add your component def,
-- configuration specifications, and any signal
-- definitions for the component you are testing
component COMP is
generic(N : integer := 16);
port( A,B: in std_logic_vector(N-1 downto 0);
Z: out std_logic);
end component COMP;
for UUT: COMP use entity WORK.COMP(LAB2_ARCH);
--for UUT: B_MULT use entity WORK.B_MULT(SYN_BEHAVIORAL);
signal A_INT,B_INT : integer range -POW2_N to POW2_N-1;
signal A,B:std_logic_vector(N-1 downto 0);
signal COMPAB:std_logic;
--************************************************
begin
UUT: COMP generic map (N=>N) port map (A=>A,B=>B,Z=>COMPAB);
DRIVE:process
variable COMP_INT : std_logic;
begin
for i in POW2_N downto POW2_N-1 loop
for j in -POW2_N to POW2_N-1 loop
A_INT <= i;
B_INT <= j;
if (i < j) then
COMPAB_INT:=1;
else COMPAB_INT:=0;
end if;
wait for 5 ns;
if COMPAB /= COMPAB_INT then
assert (false) report "Error: answer wrong" severity
FAILURE;
end if;
wait for 1 ns;
end loop;
end loop;
wait for 10 ns;
assert (false) report "sim done" severity FAILURE;
end process DRIVE;
A <= conv_std_logic_vector(A_INT,N);
B <= conv_std_logic_vector(B_INT,N);
end BEHAVIORAL;
configuration TB_CONFIG of TB_COMP is
for LAB2_ARCH
end for;
end;
---
Try getting "VHDL primer - J.Bhasker"
Good luck,
-neeta
sq...@aol.com (SQ 240) wrote in message news:<20020506173745...@mb-ba.aol.com>...
Why not use google? http://www.i2.i-2000.com/~stefan/vcourse/html/
----------------------------------------------------------------------------
Ben Cohen Publisher, Trainer, Consultant (310) 721-4830
http://www.vhdlcohen.com/ vhdl...@aol.com
Author of following textbooks:
* Real Chip Design and Verification Using Verilog and VHDL, 2002 isbn
0-9705394-2-8
* Component Design by Example ", 2001 isbn 0-9705394-0-1
* VHDL Coding Styles and Methodologies, 2nd Edition, 1999 isbn
0-7923-8474-1
* VHDL Answers to Frequently Asked Questions, 2nd Edition, isbn
0-7923-8115
------------------------------------------------------------------------------
SQ 240 wrote:
--
--Ray Andraka, P.E.
President, the Andraka Consulting Group, Inc.
401/884-7930 Fax 401/884-7950
email r...@andraka.com
http://www.andraka.com
"They that give up essential liberty to obtain a little
temporary safety deserve neither liberty nor safety."
-Benjamin Franklin, 1759