4) Concurrent - Statement
4) Concurrent - Statement
Assignment Statements
Outline
1. Combinational versus sequential circuit
2. Simple signal assignment statement
3. Conditional signal assignment statement
4. Selected signal assignment statement
5. Conditional vs. selected signal assignment
COEN313 - 2
1. Combinational vs. sequential
circuit
• Combinational circuit:
– No internal state
– Output is a function of inputs only
– No latches/FFs or closed feedback loop
• Sequential circuit:
– With internal state
– Output is a function of inputs and internal
state
• Sequential circuit to be discussed later
COEN313 - 3
2. Simple signal
assignment statement
• Simple signal assignment is a special case of
conditional signal assignment
• Syntax:
signal_name <= projected_waveform;
• E.g.,
y <= a + b + 1 after 10 ns;
• Timing info ignored in synthesis
and delta-delay is used:
signal_name <= value_expression
COEN313 - 5
• E.g.,
status <= '1';
even <= (p1 and p2) or (p3 and p4);
arith_result <= a + b + c - 1;
• Implementation of last statement
COEN313 - 6
Signal assignment statement
with a closed feedback loop
• a signal appears in both sides of a concurrent
assignment statement
• E.g.,
q <= ((not q) and (not en)) or (d and en);
• Syntactically correct
• Form a closed feedback loop
• Should be avoided
COEN313 - 7
Event and Delta Cycle
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY delta_cycle IS
PORT ( a,b : IN STD_LOGIC;
output : OUT STD_LOGIC);
END ENTITY;
ARCHITECTURE example OF delta_cycle IS
SIGNAL int1,int2 : STD_LOGIC;
BEGIN
int1 <= NOT a;
int2 <= NOT b;
output <= (int1 xnor int2);
END example;
COEN313 - 8
Suppose that at time t=10 ns, a and b change from 0 to 1.
a b
Event list at t=10 ns Nil
0è1 0è1
int1 b
int1 <= NOT a; Nil
1è0 0è1
output b
output <= (int1 xnor int2); Nil
1è0 0è1
!
ns
10 b
e
tim Nil
on 0è1
pen
p
ha int2
y
ti vi t int2 <= NOT b; 1è0
Nil
ac
s
thi
l
Al output
Nil
output <= (int1 xnor int2); 0è1
Nil
COEN313 - 9
Simulation without delta cycle expansion
0 2 4 6 8 10 12 14 16 18 20
int1
int2
output
COEN313 - 10
Simulation with delta cycle expansion
10 10 12 14
6 8
a 10 + 1 delta cycle
10 + 4 delta cycle
b
int1
10 + 2 delta cycle
int2
10 + 5 delta cycle
output
10 + 6 delta cycle
10 + 3 delta cycle COEN313 - 11
3. Conditional signal
assignment statement
• Syntax
• Examples
• Conceptual implementation
• Detailed implementation examples
COEN313 - 14
Syntax
• Simplified syntax:
signal_name
<= value_expr_1 when boolean_expr_1 else
value_expr_2 when boolean_expr_2 else
value_expr_3 when boolean_expr_3 else
...
value_expr_n
COEN313 - 15
E.g., 4-to-1 mux
• Function table:
COEN313 - 16
COEN313 - 17
E.g., 2-to-22 binary decoder
• Function table:
COEN313 - 18
COEN313 - 19
E.g., 4-to-2 priority encoder
• Function table:
COEN313 - 20
COEN313 - 21
E.g., simple ALU
• Function table:
COEN313 - 22
COEN313 - 23
Conceptual implementation
• Syntax:
signal_name
<= value_expr_1 when boolean_expr_1 else
value_expr_2 when boolean_expr_2 else
value_expr_3 when boolean_expr_3 else
...
value_expr_n;
• Evaluation in ascending order
• Achieved by “priority-routing network”
• Top value expression has a “higher priority”
COEN313 - 24
2-to-1 “abstract” mux
COEN313 - 25
COEN313 - 26
COEN313 - 27
COEN313 - 28
Detailed implementation
examples
• 2-to-1 mux
COEN313 - 29
• E.g.,
Conceptual Detailed
implementation ? implementation ?
COEN313 - 30
• E.g.,
COEN313 - 31
• E.g.,
Conceptual Detailed
implementation ? implementation ?
COEN313 - 32
• E.g.,
COEN313 - 33
COEN313 - 34
• E.g.,
COEN313 - 35
4. Selected signal
assignment statement
• Syntax
• Examples
• Conceptual implementation
• Detailed implementation examples
COEN313 - 36
Syntax
• Simplified syntax:
with select_expression select
signal_name <=
value_expr_1 when choice_1,
value_expr_2 when choice_2,
value_expr_3 when choice_3,
...
value_expr_n when choice_n;
COEN313 - 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
COEN313 - 38
E.g., 4-to-1 mux
COEN313 - 39
• Can “11” be used to replace others?
COEN313 - 40
E.g., 2-to-22 binary decoder
COEN313 - 41
E.g., 4-to-2 priority encoder
COEN313 - 42
E.g., simple ALU
COEN313 - 43
E.g., Truth table
COEN313 - 44
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
COEN313 - 45
– select_expression is with a data type of 5
values: c0, c1, c2, c3, c4
COEN313 - 46
COEN313 - 47
Detailed implementation examples
• 4-to-1 mux
COEN313 - 48
• E.g.,
Conceptual
implementation ?
COEN313 - 49
• E.g.,
COEN313 - 50
3. Conditional vs.
selected signal
assignment
• Conversion between conditional vs.
selected signal assignment
• Comparison
COEN313 - 51
From selected
assignment to
conditional assignment
COEN313 - 52
From conditional assignment to
selected assignment
COEN313 - 53
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
COEN313 - 54
• Conditional signal assignment:
– good match for 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.,
COEN313 - 55
– May “over-specify” for a functional table based circuit.
– E.g., mux
COEN313 - 56