VERILOG: Synthesis - Combinational Logic Combination Logic Function Can Be Expressed As
VERILOG: Synthesis - Combinational Logic Combination Logic Function Can Be Expressed As
VERILOG: Synthesis - Combinational Logic Combination Logic Function Can Be Expressed As
Combinational
Logic
logic_outputs(t)
Rules
Avoid technology dependent modeling; i.e.
implement functionality, not timing.
The combinational logic must not have feedback.
Specify the output of a combinational behavior for all
possible cases of its inputs.
Logic that is not combinational will be synthesized as
sequential.
Synthesis of Multiplexors
Conditional Operator
module mux_4bits(y, a, b, c, d, sel);
input [3:0] a, b, c, d;
a[3:0]
input [1:0] sel;
b[3:0]
output [3:0] y;
c[3:0]
assign y =
d[3:0]
(sel == 0) ? a :
(sel == 1) ? b :
(sel == 2) ? c :
(sel == 3) ? d : 4'bx;
endmodule
y[3:0]
sel[1:0]
a[3:0]
b[3:0]
y[3:0]
c[3:0]
d[3:0]
sel[1:0]
a[3:0]
b[3:0]
y[3:0]
c[3:0]
d[3:0]
sel[1:0]
Unwanted Latches
Unintentional latches generally result from
incomplete case statement or conditional branch
Example: case statement
always @ (sel_a or sel_b or data_a or data_b)
case ({sel_a, sel_b})
2'b10: y_out = data_a;
2'b01: y_out = data_b;
endcase
Priority Logic
When the branching of a conditional (if) is not mutually
exclusive, or when the branches of a case statement are not
mutually exclusive, the synthesis tool will create a priority
structure.
Example:
module mux_4pri (y, a, b, c, d, sel_a, sel_b, sel_c);
input a, b, c, d, sel_a, sel_b, sel_c;
output y;
reg y;
always @ (sel_a or sel_b or sel_c or a or b or c or d)
begin
if (sel_a == 1) y = a; else
if (sel_b == 0) y = b; else
if (sel_c == 1) y = c; else
y = d;
end
endmodule
Synthesis Result
Functional Specs.
Load counter with Data_in when load = 1
Counter counts when counter_on = 1
counts-up when count_up = 1
Counts-down when count_up = 0