Digital Systems - 0: Pere Pal' A - Alexis L Opez
Digital Systems - 0: Pere Pal' A - Alexis L Opez
February 2015
Introduction
type std_ulogic is ( U , -- U n i n i t i a l i z e d
X , -- Forcing Unknown
0 , -- Forcing zero
1 , -- Forcing one
Z , -- High I m p e d a n c e
W , -- Weak Unknown
L , -- Weak zero
H , -- Weak one
- ); -- Don t care
I
library ieee ;
use ieee . std_log ic_1164 . all ;
library ieee ;
use ieee . std_log ic_1164 . all ;
entity and_gate is
port ( a , b : in std_logic ;
y
: out std_logic );
end and_gate ;
architecture logic_and of and_gate is
begin
y <= a and b ;
end ;
I
Identifiers
I
I
Testing
library ieee ;
use ieee . std_log ic_1164 . all ;
entity full_adder_tb is
end full_adder_tb ;
architecture behav of
full_adder_tb is
component my_adder
port (a ,
b,
c_in : in std_logic ;
s,
c_out : out std_logic );
end component ;
for dut : my_adder use
entity work . full_adder ;
signal t_a , t_b , t_c_in ,
t_s , t_c_out : std_logic ;
begin
dut : my_adder port map
(a
= > t_a ,
b
= > t_b ,
c_in = > t_c_in ,
s
= > t_s ,
c_out = > t_c_out );
process
begin
t_a
<= 0 ;
t_b
<= 0 ;
t_c_in <= 0 ;
wait for 1 sec ;
t_a
<= 0 ;
t_b
<= 1 ;
t_c_in <= 0 ;
wait for 1 sec ;
wait ;
end process ;
end behav ;
Testing/2
I
$ ghdl -a full_adder.vhd
$ ghdl -a full_adder_tb.vhd
$ ghdl -e full_adder_tb