Introduction To VHDL: Krzysztof Kuchcinski
Introduction To VHDL: Krzysztof Kuchcinski
Krzysztof Kuchcinski
[email protected]
Outline
1 Basic Aspects
2 An Example
VHDL History
Basic Constructs
An Example
Example
A four bit parity generator
V EVEN
entity PARITY is
port(V:in BIT_VECTOR(3 downto 0);
EVEN:out BIT);
end PARITY;
A Model of Behavior
Process Process
P1 P2
signal
(directed data
pathway)
entity declaration
declarations
architecture declaration
declarations
port
architecture declaration
declarations
architecture declaration
port
declarations
process
port
process port
process
In1
Out1
Out1<= In1
xor In2
In2
end Behavior2;
A Model of Time
Start Simulation
End Simulation
Transaction
value
time
Transactions queue
entity declaration
declarations
architecture declaration
port declarations
component
port
component
port
port
component
V(0)
T1
V(1)
EVEN
T3
V(2)
T2
V(3)
Example (cont’d)
use WORK.all;
architecture PARITY_STRUCTURAL of PARITY is
component XOR_GATE
port(X,Y: in BIT; Z: out BIT);
end component;
component INV
generic(DEL: TIME);
port(X: in BIT; Z: out BIT);
end component;
begin
XOR1: XOR_GATE port map (V(0), V(1), T1);
XOR2: XOR_GATE port map (V(2), V(3), T2);
XOR3: XOR_GATE port map (T1, T2, T3);
INV1: INV
generic map (0.5 ns)
port map (T3, EVEN);
end PARITY_STRUCTURAL;
entity BENCH is
end BENCH;
use WORK.all;
architecture ARCH_BENCH of BENCH is
component PARITY
port(V: in BIT_VECTOR (3 downto 0); EVEN: out BIT);
end component;
for PARITY_GENERATOR:PARITY use
entity PARITY(PARITY_STRUCTURAL);
signal VECTOR: BIT_VECTOR (3 downto 0);
signal E: bit;
begin
VECTOR <= ‘0010’,
‘0000’ after 3 ns,
‘1001’ after 5.8 ns,
. . .
‘0111’ after 44.5 ns,
‘1101’ after 50 ns;
PARITY_GENERATOR:PARITY port map(VECTOR, E);
end ARCH_BENCH;
Model of Structure
Stage1 Stage2
In1 Out1 <= Internal1
In1 and In2
Out1<= Out1
not(In1 or In2)
In2
Out2 <=
not(In1) and
not(In2) Internal2
component Stage1
port (I1, I2: Bit; O1, O2: out Bit);
end component;
component Stage2
port (I1, I2: Bit; O1: out Bit);
end component;
begin
U0: Stage1 port map (In1, In2,Internal1,Internal2);
U1: Stage2 port map (I1=>Internal1, I2=>Internal2, O1=>Out);
end structure;
Mixed Descriptions
entity declaration
declarations
architecture declaration
port declarations
process
component
port
component
port
process
port
component
entity declaration
declarations
architecture declaration
port declarations
component
process
port
block
declarations
component
port
block
declarations port
process
component
Sensitivity clause
Condition clause
Time-out clause
Signal assignment
A signal assignment only affects the projected output waveform, by
placing one or more transactions into the driver corresponding to the
signal and possibly by deleting other transactions.
Signal Assignment
Process P4
. . . . .
X:=S1+S2+S3;
Current
5 S1 150 S2 f(10,1) S3 signal values
ction
n fun
lutio
Reso
5 10ns
100 35ns 1 20ns
0 100ns 10 15ns 0 40ns
10 110ns 150 20ns 0 50ns 0 60ns
55 130ns 88 100ns
Dr_S1 P1 Dr_S3 P3
Dr_S2P2 Dr_S3 P2
. . . . . . . . . .
. . . . .
S1 <= ... S2 <= ...
S3 <= ...
. . . . . . . . . .
. . . . .
S1 <= ... S3 <= ...
X
S
Z
Y
entity DELTA_DELAY_EXAMPLE is
port(X, Y:in BIT; Z: out BIT);
end DELTA_DELAY_EXAMPLE;
Delta Delay
QB <= R nand Q; R
QB
Q <= S nand QB;
S Q
QB
5 10 15 20
Transport Delay
0 100 15 10
100 ns 120 ns 135 ns 140 ns
0 100 15 25
100 ns 120 ns 135 ns 138 ns
X
10 20 30 50 70 75 85 90
X Z
Z <= transport X after 15 ns
Z
25 35 45 65 85 90 100 105
t=0 ns
Inertial Delay
0 1 15
1st assignment:
100 ns 120 ns 135 ns
0 8 2 5 10
2nd assignment:
100 ns 140 ns 160 ns 180 ns 200 ns
0 5 5
3rd assignment:
100 ns 180 ns 190 ns
X
10 20 30 50 70 75 85 90
X Z
Z <= inertial X after 15 ns
Z
45 65