網路資源
Asic-world: http://www.asic-world.com/verilog
Verilog system task: https://www.csee.umbc.edu/portal/help/VHDL/verilog/system.html
AsicGuru: http://www.asicguru.com/
System Verilog 資源
Asic-world: http://www.asic-world.com/systemverilog/index.html範例 Coding style
For Design
Combinational circuit - Mux
寫法1:wire mux_out; // a 1-bit mux output
wire [1:0] mux_sel; // 2-bit mux select
wire [3:0] mux_in; // 4-bit mux input
assign mux_out = mux_sel == 2'b00 ? mux_in[0]:
mux_sel == 2'b01 ? mux_in[1]:
mux_sel == 2'b10 ? mux_in[2]: mux_in[3];
寫法2:
reg mux_out; // a 1-bit mux output
wire [1:0] mux_sel; // 2-bit mux select
wire [3:0] mux_in; // 4-bit mux input
always @(*)
case(mux_sel)
2'b00: mux_out = mux_in[0];
2'b00: mux_out = mux_in[1];
2'b00: mux_out = mux_in[2];
2'b00: mux_out = mux_in[3];
default: mux_out = mux_in[0];
endcase
※寫combinational circuit,要用blocking assignment ( mux_out = mux_in[0] )
Sequential circuit - Flip Flop
reg ff; // 1-bit registerwire ff_next; // value that will be latched to ff at posedge CLK
always @( posedge CLK or negedge RESETn)
if(~RESETn)
ff <= 1'b0; // asynchronous reset to 0
else
ff <= ff_next;
※寫ff,要用non-blocking assignment ( ff <= ff_next )
For Verification
DUTVerilog
Verilog-Event
在寫Test bench時可使用 event 變數
event evt1; //宣告event變數
.觸發evt1: ->evt1;
.等待evt1: @(evt1) ...執行動作。
參考資料:
https://www.cnblogs.com/ZcsTech/p/3492988.html
System verilog
沒有留言:
張貼留言