Chapter 2-2 Verilog
Chapter 2-2 Verilog
Chapter 2-2 Verilog
Combinational
logic_inputs(t) logic_outputs(t)
Logic
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.
Styles for Synthesizable Combinational Logic
Synthesizable combinational can have following
styles
Example:
module or_nand_3 (enable, x1, x2, x3, x4, y);
input enable, x1, x2, x3, x4;
output y;
reg y;
always @ (enable or x1 or x2 or x3 or x4)
if (enable)
y = !((x1 | x2) & (x3 | x4));
else
y = 1; // operand is a constant.
endmodule
Example:
module or_nand_4 (enable, x1, x2, x3, x4, y);
input enable, x1, x2, x3, x4;
output y;
assign y = or_nand(enable, x1, x2, x3, x4);
function or_nand;
input enable, x1, x2, x3, x4;
begin
or_nand = ~(enable & (x1 | x2) & (x3 | x4));
end
endfunction
endmodule
Synthesis of Combinational Logic – Tasks
Example:
module or_nand_5 (enable, x1, x2, x3, x4, y);
input enable, x1, x2, x3, x4;
output y;
reg y;
always @ (enable or x1 or x2 or x3 or x4)
or_nand (enable, x1, x2, x3c, x4);
task or_nand;
input enable, x1, x2, x3, x4;
output y;
begin
y = !(enable & (x1 | x2) & (x3 | x4));
end
endtask
endmodule
Construct to Avoid for Combinational Synthesis
Edge-dependent event control
Multiple event controls within the same behavior
Named events
Feedback loops
Procedural-continuous assignment containing event or delay
control
fork ... join blocks
wait statements
External disable statements
Procedural loops with timing
Data dependent loops
Tasks with timing controls
Sequential UDPs
Synthesis of Multiplexors
Conditional Operator
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
Verilog Up/Down Counter (cont.)