systemverilog-modelsim中執行命令,時間精度,include
阿新 • • 發佈:2019-01-22
在modelsim 10.2中能模擬執行systemverilog檔案,輸出結果是在transcript的命令列。 .do中命令為:vlog -sv file_path, examp: vlog -sv -quiet /ifn/mns/my_top.sv
推薦一個學習systemverilog非常好的網站,分章節講解詳細清晰,並附有大量例項程式碼,只是不知道國內能否登陸: http://www.systemverilog.in/classes.php
在questa10.2種,若使用`include 包含file,則需要指定檔案具體path,或者將檔案放到shell檔案相同path。如:要inlcude
class_define.sv,則新增具體path: `include “ifn/mns/d:/tb/class_define.sv”
systemverilog 支援fork join語句,其中的語句預設是並行執行,但其中begin end之間的語句是順序執行,即一個 begin end是一個執行緒,
Examp 1:
fork
statement1;
begin
statement2;
statement3;
end
join
例中表示有兩個執行緒,statement1與statement2、statement3並行執行,但是statement2與statement3屬於一個執行緒,順序執行。
Eg: Example Code Snippet using Interaction of begin…end and fork...join
initial begin $display (“@%0d: start fork … join example”, $time); #10 $display (“@%0d: start fork … join example”, $time); fork display (“@%0d: parallel start”, $time); #50 display (“@%0d: parallel after #50”, $time); #10 display (“@%0d: parallel after #10”, $time); begin #30 display (“@%0d: sequential after #30”, $time); #10 display (“@%0d: sequential after #10”, $time); end join display (“@%0d: after join”, $time); display (“@%0d: final after #80”, $time); end
Output:
@0: start fork … join example
@10: sequential after #10
@10: parallel start
@20: parallel after #10
@40: sequential after #30
@50: sequential after #10
@60: parallel after #50
@60: after join
@140: final after #80
對於delay, #1 means delay 1ns(具體時間由`timescale 1 ns / 1 ps確定,/前面的表示time unit,對應#時間;/後面的表示時間標尺精度), ##1 means delay 1 cycle.