Verilog 2012 PDF
Verilog 2012 PDF
Verilog 2012 PDF
Verilog
REF:
•Verilog Training Manual, CIC, July, 2008
•Reuse Methodology Manual – For System-ON-A-Chip Design, Third Edition 2002
•Logic Synthesis with Design Complier, CIC , July, 2008
Advanced Reliable 1
Systems (ARES) Lab.
11/21
課程主題: Synthesizable Verilog & Coding
學習目標
Synthesizable coding style in Verilog
Syntax check with nLint
LAB1簡介-撰寫simple 8-bit microprocessor之Verilog code
步驟一:RTL coding並使用nLint確定為可合成之code
步驟二:使用修正好的RTL netlist跑simulation,並觀察波型
Tape Out
Advanced Reliable Systems (ARES) Lab. 5
What is Synthesis
Synthesis = translation + optimization + mapping
if(high_bits == 2’b10)begin
residue = state_table[i];
end
else begin
residue = 16’h0000;
end Translate (HDL Compiler)
HDL Source
(RTL)
No Timing Info.
Optimize + Mapping
(HDL Compiler)
Generic Boolean
(GTECT)
Timing Info.
Also, the code coverage of your test benches should be verified (i.e. VN)
Coding style checking (i.e. n-Lint)
Good coding style will reduce most hazards while synthesis
Better optimization process results in better circuit performance
Easy debugging after synthesis
Constraints
The area and timing of your circuit are mainly determined by your
circuit architecture and coding style
There is always a trade-off between the circuit timing and area
In fact, a super tight timing constraint may be worked while synthesis,
but failed in the Place & Route (P&R) procedure
always @ (a or x_temp)begin
if (a) begin
x= x_temp+1’b1;
end
else begin
x= x_temp;
end
always @ (a or x_temp)begin
if (a) begin
x= x_temp+1’b1;
end
else begin
x= x_temp;
end
net/register
net
net/register net
input net output
inout
net
clk clk
Gated Clocks
Combination Feedback
D Q D Q
CBL
clk
Synchronous reset
always@(posedge clock)begin
if (rst) begin
…………….
end
…
end
Asynchronous reset
always@(posedge clock or negedge reset)
if (!rst) begin
………………
end
…
end
Advanced Reliable Systems (ARES) Lab. 20
Synthesizable Verilog
Not all kinds of Verilog constructs can be
synthesized
Only a subset of Verilog constructs can be
synthesized and the code containing only this
subset is synthesizable
Operators precedence
Concatenation ( { }, {{}} ) highest
Unary reduction ( !, ~, &, |, ^ )
2’s complement arithmetic ( +, -, *)
Logic shift ( >>, << )
Relational ( >, <, >=, <= )
Equality ( ==, != )
Binary bit-wise ( &, |, ^, ~^ )
Logical ( &&, || )
Conditional ( ?: ) lowest
always @ (a or x_temp)begin
if (a) begin
x= x_temp+1’b1;
end
else begin
x= x_temp;
end
a b c a b c
D Q D Q D Q
clk clk
Compile
c a d e
out
out
parameter size=8;
wire [3:0] a,b,c,d,e;
module fixed_multiplier(a,b,c);
input [8:0] a, b;
output [8:0] c;
reg [15:0] tmp;
reg [8:0] c;
assign tmp = a*b;
assign c = tmp(15,8);
endmodule
58
Verilog Simulator
module testfixture;
•Declare signals
•Instantiate modules
•Applying stimulus
•Monitor signals
endmodule
// testbench.v
module …();
…
initial begin
$fsdbDumpfile(“abcd.fsdb”);
$fsdbDumpvars;
End
…
endmodule