Beruflich Dokumente
Kultur Dokumente
LECTURE 4
MAY 2012
Topics Covered
Process
Process statement
Signal and variable assignment
Common sequential statements in process
If – else
Case
Loop, for, while
Synthesis of combinational logic
Processes
design entities
Process signal
boundary
process
Process Statement
end Version1;
Processes Terminology
Process Concurrency
Between processes, they are concurrent to each other.
A S T F
B
process (A, B, S, T)
begin
S <= A nand B after 2 ns; -- synthesizer ignores delays
“after 2 ns”
T <= not S; -- small delay > 0
F <= T after 1 ns;
end process;
Signal Assignments
2 ns
S
This may be true for other
timing simulator with
T different annotation
1 ns
F
Variables
A (V)
B
(V) F
C
process (A, B, C)
variable V: Std_logic;
begin
Every time this process is
invoked, the two V’s use
V := A nand B;
different memory segments. V := V nor C;
F <= not V;
end process;
Signal vs Variable
if S1 = '0' then
Highest V := A;
priority else
V := B;
end if;
F <= V;
end process;
If Implementation
S2
S3
S1
‘0’ (V)
A ‘0’ (V)
MUX F
MUX ‘1’
B ‘1’
S3 S2
S1
D ‘0’
MUX ‘0’
C ‘1’ MUX ‘0’
B ‘1’ MUX F
A ‘1’
process (G, D)
begin
if G = '1' then
Q <= D;
end if;
end process;
D (D’.G)’
Q
D.G
G
Case Statements
case Sel is
when "00" =>
F <= A;
when "01" =>
F <= B;
when "10" =>
F <= C;
when "11" =>
F <= D;
end case;
Sel
A
B
C F
D
Case Statement Options
A <= '0';
B <= '1'
case Address is
Label1: loop
...
exit; -- jump out of loop
...
exit Label1; -- jump out of loop
...
next Label1; -- jump to top of loop
...
end loop Label1;
Wait For
Three rules
Sensitivity list
Complete assignment
Feedback
Synthesis of Combinational Logic
Register-to-Register transfer
Parallelism
Concurrency:
multiple events or signal assignment at same moment.
Example:
Select <= 0 when s0 = ‘0’ and s1 = ‘0’ else
1 when s0 = ‘1’ and s1 = ‘0’ else
2 when s0 = ‘0’ and s1 = ‘1’ else
3;
Concurrent Assignment
LIBRARY IEEE;
USE IEEE.std_logic_1164.ALL;
ENTITY or3 IS
PORT (a, b, c : IN std_logic;
D : OUT std_logic);
END or3;
Implementation is
Technology library dependant
Technology library contains models for gate level cells.
Speed constraint dependant
Maximum delay allowed can determine the logic level allowed in
the design.
Clock speed also asserts constraint on setup and hold time.
Keyword: after
Example:
x <= a after 0.5 ns when select = 0;
Keyword: transport
Example:
X <= transport a after 1 ns;
Inverse Multiplexer
Barrel Shifter
s2 = xi yi ci
c = ci (xi yi)
c2 = c1 + ci (xi yi)
= xi yi + ci (xi yi) + ci
(xi yi)
2nd stage half = xi yi + ci xi + ci yi
1st stage half adder
adder
s1 = xi yi
c1 = xi yi
Interpretation of 4 bit signed integers
2 places
for ‘0’ Squeeze in extra one number
Number
in
sequence
, but still 2
places for
‘0’.
The signed numbers wheel
Goal achieved: 4
binary bit with 16
combination can
represent 16
Advancing distinct numbers.
clockwise
for addition
The signed numbers wheel
Goal achieved: 4
binary bit with 16
combination can
represent 16
Advancing distinct numbers.
counter-
clockwise for
subtraction
Adder Subtractor
Ripple Carry Adder
Carry-Lookahead Adder
Fundamentals of Carry-Lookahead Adder
cnext_layer = ci
pnext_layer = pi+1 pi
Kogg-Stone Adder
Brent-Kung Adder
http://www.cs.cmu.edu/afs/cs/academic/class/15828-s98/lectures/0121/sld012.htm
References