VHDL
VHDL
(CS 570)
Jeremy R. Johnson
Wed. Nov. 8, 2000
• Behavioral models
• Structural models
• Discrete event simulation
– signals
– events
– waveforms
– concurrency
• Entity
• Port
• Architecture
– implementation of an entity
– support for both behavioral and structural models
• Signal
– std_ulogic (from IEEE 1164 library)
– input/output signals
– internal signals inside an architecture
– assignment
– delays
• Vectors of signals (bus)
entity half_adder is
port(a,b : in std_ulogic;
sum,carry : out std_ulogic);
end half_adder;
a
sum
b
carry
entity mux is
port(I0, I1, I2, I3 : in std_ulogic;
Sel : in std_ulogic_vector (1 downto 0);
Z : out std_ulogic);
end mux;
I0
I1
Z
I2
I3
Sel
entity ALU32 is
port(a,b : in std_ulogic_vector (31 downto 0);
Op : in std_ulogic_vector (2 downto 0);
result : in std_ulogic_vector (31 downto 0);
zero : out std_ulogic;
Op
CarryOut : out std_ulogic;
overflow : out std_ulogic); a
Zero
end ALU32;
Result
Overflow
b
CarryOut
begin
X1 : xor_2 port map(x => a, y => b, c =>sum);
A1 : and_2 port map(x => a, y => b, c => carry);
end structural;
s x0 x1 + s x0 x1 + s x0 x1 + s x0 x1 1 1 0 0
1 1 1 1
s x0 x1 + s x0 x1 + s x0 x1 + s x0 x1
= s x0 x1 + s x0 x1 + s x1 x0 + s x1 x0 (commutative law)
= s x0 1 + s x1 1 (inverse law)
= s x0 + s x1 (identity law)
• Verify that the boolean function corresponding to this expression
as the same truth table as the original function.
A
• and gate B
A
• or gate B
• inverter (not) A
x0
x1
x0
x1
d1
d2
d3
s1 s0
Apr. 3, 2000 Systems Architecture I 19