ece545 lecture5 dataflow 6
DESCRIPTION
GOOD ONETRANSCRIPT
-
1
George Mason University
Data Flow Modeling of Combinational Logic
ECE 545 Lecture 5
2
Required reading
P. Chu, RTL Hardware Design using VHDL
Chapter 4, Concurrent Signal Assignment Statements of VHDL
3 ECE 448 FPGA and ASIC Design with VHDL
Dataflow VHDL Design Style
4
VHDL Design Styles
Components and interconnects
structural
VHDL Design Styles
dataflow
Concurrent statements
behavioral (sequential)
Registers State machines Instruction decoders
Sequential statements
Subset most suitable for synthesis
Testbenches
5
Synthesizable VHDL
Dataflow VHDL Design Style
VHDL code synthesizable
VHDL code synthesizable
Dataflow VHDL Design Style
6
Register Transfer Level (RTL) Design Description
Combinational Logic
Combinational Logic
Registers
Todays Topic
-
2
7
Data-Flow VHDL
concurrent signal assignment ()
conditional concurrent signal assignment (when-else)
selected concurrent signal assignment (with-select-when)
generate scheme for equations (for-generate)
Concurrent Statements
Data-flow VHDL
concurrent signal assignment () conditional concurrent signal assignment (when-else) selected concurrent signal assignment (with-select-when) generate scheme for equations (for-generate)
Major instructions
Concurrent statements
9
Data-flow VHDL: Example
x y
cin s
cout
10
Data-flow VHDL: Example (1)
LIBRARY ieee ; USE ieee.std_logic_1164.all ;
ENTITY fulladd IS PORT ( x : IN STD_LOGIC ;
y : IN STD_LOGIC ; cin : IN STD_LOGIC ;
s : OUT STD_LOGIC ; cout : OUT STD_LOGIC ) ; END fulladd ;
11
Data-flow VHDL: Example (2)
ARCHITECTURE dataflow OF fulladd IS BEGIN
s
-
3
13
Wanted: y = ab + cd Incorrect y
-
4
RTL Hardware Design Chapter 4 19
2-to-1 abstract mux sel has a data type of boolean If sel is true, the input from T port is connected
to output. If sel is false, the input from F port is connected
to output.
RTL Hardware Design Chapter 4 20
RTL Hardware Design Chapter 4 21 RTL Hardware Design Chapter 4 22
RTL Hardware Design Chapter 4 23
E.g.,
RTL Hardware Design Chapter 4 24
E.g.,
-
5
RTL Hardware Design Chapter 4 25 RTL Hardware Design Chapter 4 26
E.g.,
27
Signed and Unsigned Types
Behave exactly like STD_LOGIC_VECTOR plus, they determine whether a given vector should be treated as a signed or unsigned number. Require USE ieee.numeric_std.all;
28
Operators
Relational operators
Logic and relational operators precedence
= /= < >=
not = /= < >= and or nand nor xor xnor
Highest
Lowest
29
compare a = bc Incorrect when a = b and c else equivalent to when (a = b) and c else
Correct when a = (b and c) else
Priority of logic and relational operators
30
VHDL operators
-
6
31
Data-flow VHDL
concurrent signal assignment () conditional concurrent signal assignment (when-else) selected concurrent signal assignment (with-select-when) generate scheme for equations (for-generate)
Major instructions
Concurrent statements
32
Selected concurrent signal assignment
with choice_expression select target_signal
-
7
RTL Hardware Design Chapter 4 37
select_expression Discrete type or 1-D array With finite possible values
choice_i A value of the data type
Choices must be mutually exclusive all inclusive others can be used as last choice_i
RTL Hardware Design Chapter 4 38
E.g., 4-to-1 mux
RTL Hardware Design Chapter 4 39
Can 11 be used to replace others?
RTL Hardware Design Chapter 4 40
E.g., 2-to-22 binary decoder
RTL Hardware Design Chapter 4 41
E.g., 4-to-2 priority encoder
RTL Hardware Design Chapter 4 42
Can we use -?
-
8
RTL Hardware Design Chapter 4 43
E.g., simple ALU
RTL Hardware Design Chapter 4 44
E.g., Truth table
RTL Hardware Design Chapter 4 45
Conceptual implementation
Achieved by a multiplexing circuit
Abstract (k+1)-to-1 multiplexer sel is with a data type
of (k+1) values: c0, c1, c2, . . . , ck
RTL Hardware Design Chapter 4 46
select_expression is with a data type of 5 values: c0, c1, c2, c3, c4
RTL Hardware Design Chapter 4 47 RTL Hardware Design Chapter 4 48
E.g.,
-
9
RTL Hardware Design Chapter 4 49
3. Conditional vs. selected signal assignment
Conversion between conditional vs. selected signal assignment
Comparison
RTL Hardware Design Chapter 4 50
From selected assignment to conditional assignment
RTL Hardware Design Chapter 4 51
From conditional assignment to selected assignment
RTL Hardware Design Chapter 4 52
Comparison
Selected signal assignment: good match for a circuit described by a
functional table E.g., binary decoder, multiplexer Less effective when an input pattern is given a
preferential treatment
RTL Hardware Design Chapter 4 53
Conditional signal assignment: good match for a circuit a circuit that needs to
give preferential treatment for certain conditions or to prioritize the operations
E.g., priority encoder Can handle complicated conditions. e.g.,
RTL Hardware Design Chapter 4 54
May over-specify for a functional table based circuit.
E.g., mux
-
10
55
MLU Example
56
MLU Block Diagram
B
A
NEG_A
NEG_B
IN0 IN1 IN2 IN3
OUTPUT SEL1 SEL0
MUX_4_1
L0 L1
NEG_Y
Y Y1
A1
B1
MUX_0
MUX_1 MUX_2
MUX_3
0
1
0
1
0
1
57
MLU: Entity Declaration
LIBRARY ieee; USE ieee.std_logic_1164.all;
ENTITY mlu IS PORT( NEG_A : IN STD_LOGIC; NEG_B : IN STD_LOGIC; NEG_Y : IN STD_LOGIC; A : IN STD_LOGIC; B : IN STD_LOGIC; L1 : IN STD_LOGIC; L0 : IN STD_LOGIC; Y : OUT STD_LOGIC );
END mlu;
58
MLU: Architecture Declarative Section
ARCHITECTURE mlu_dataflow OF mlu IS
SIGNAL A1 : STD_LOGIC; SIGNAL B1 : STD_LOGIC; SIGNAL Y1 : STD_LOGIC; SIGNAL MUX_0 : STD_LOGIC; SIGNAL MUX_1 : STD_LOGIC; SIGNAL MUX_2 : STD_LOGIC; SIGNAL MUX_3 : STD_LOGIC; SIGNAL L: STD_LOGIC_VECTOR(1 DOWNTO 0);
59
MLU - Architecture Body BEGIN
A1
-
11
61 ECE 448 FPGA and ASIC Design with VHDL
Wires and Buses
62
Signals
SIGNAL a : STD_LOGIC;
SIGNAL b : STD_LOGIC_VECTOR(7 DOWNTO 0);
wire
a
bus
b
1
8
63
Merging wires and buses
SIGNAL a: STD_LOGIC_VECTOR(3 DOWNTO 0); SIGNAL b: STD_LOGIC_VECTOR(4 DOWNTO 0); SIGNAL c: STD_LOGIC; SIGNAL d: STD_LOGIC_VECTOR(9 DOWNTO 0);
d
-
12
67
Fixed Rotation in VHDL
A(3) A(2) A(1) A(0)
A(2) A(1) A(0) A(3)
A
-
13
73 ECE 448 FPGA and ASIC Design with VHDL
Multiplexers
74
2-to-1 Multiplexer
(a) Graphical symbol (b) Truth table
0
1
f s
w 0
w 1
f
s
w 0
w 1
0
1
75
VHDL code for a 2-to-1 Multiplexer
LIBRARY ieee ; USE ieee.std_logic_1164.all ;
ENTITY mux2to1 IS PORT ( w0, w1, s : IN STD_LOGIC ; f : OUT STD_LOGIC ) ;
END mux2to1 ;
ARCHITECTURE dataflow OF mux2to1 IS BEGIN
f
-
14
79
VHDL code for a 4-to-1 Multiplexer
LIBRARY ieee ; USE ieee.std_logic_1164.all ;
ENTITY mux4to1 IS PORT ( w0, w1, w2, w3 : IN STD_LOGIC ; s : IN STD_LOGIC_VECTOR(1 DOWNTO 0) ; f : OUT STD_LOGIC ) ;
END mux4to1 ;
ARCHITECTURE dataflow OF mux4to1 IS BEGIN
WITH s SELECT f
-
15
85
VHDL code for a Priority Encoder LIBRARY ieee ; USE ieee.std_logic_1164.all ;
ENTITY priority IS PORT ( w : IN STD_LOGIC_VECTOR(3 DOWNTO 0) ; y : OUT STD_LOGIC_VECTOR(1 DOWNTO 0) ; z : OUT STD_LOGIC ) ;
END priority ;
ARCHITECTURE dataflow OF priority IS BEGIN
y