EE-721: Lec2
EE-721: Lec2
SBP
EE, IITB
architecture a1 of nand_gate is
begin
z <= a NAND b;
end a1;
Simulate and validate
library IEEE;
use IEEE.std_logic_1164.all; the unit under test
use ieee.numeric_std.all ; that is an instance of
testbench a nand_gate design entity
entity nand_gate_test is
end nand_gate_test ; No ports on a testbench
architecture t1 of nand_gate_test is
component nand_gate
PORT( a : IN STD_LOGIC; b : IN STD_LOGIC;
z : OUT STD_LOGIC);
end component;
signal a,b,z : std_logic ; more apt names sig_a, sig_b, sig_z
begin
uut : nand_gate port map ( a => a , b => b , z => z );
-- ...... stimulus code to be added .....
end t1 ;
arbitrary function
generator
oscilloscope
Most of these ideas to be discussed in later lectures ..
just making you aware that verification needs many
begin
facilities from vhdl
uut : nand_gate port map ( a => a , b => b , z => z );
test_pr : process
variable ab : std_logic_vector( 1 downto 0 ) ;
variable abz : std_logic_vector( 2 downto 0 ) ;
begin from numeric_std package
for i in 0 to 3 loop
ab := std_logic_vector( to_unsigned(i,2) ) ;
(a,b) <= ab ; convert integer to
wait for 11 ns ; 2 bit unsigned
abz := std_logic_vector’((a,b,z)) ;
report "input / outputs are " &
integer’image( to_integer( unsigned( abz ) ) )
severity Note ;
end loop ;
wait ;
end process ;
end t1 ;
prompt> ghdl -a --workdir=work nand_gate_with_test.vhd
prompt> ghdl -e --workdir=work nand_gate_test
prompt> ghdl -r --workdir=work nand_gate_test
--stop-time=200ns --vcd=wave.vcd
prompt> gtkwave wave.vcd
RUN
i=0 i=1 i=2 i=3
Figure: Caption
Design units
use work.simple.address;
-- work is the name of working library where
-- the package is compiled
variable pc: address;
-- direct visibility
If all of the declared names in a package are to be used in this way,
you can indicate it through special suffix all , for example:
use work.simple.all ;
variable pc: address;
variable ram: mem;
Standard packages There are two predefined packages provided
with VHDL:
standard package including various data and type definitions (e.g.
bit vector, string, ..)
textio package including basic read/write procedures (e.g. read,
readline, write, writeline, ..)
explicitely specified library
32
patience !!!
proper details about "type" in
later lectures …
shall address any confusion
caused by this hurried discussion in later lectures properly