1、弹窗:Are you sure want to finish?
原因:test bench文件里面有下列语句: $finish ;(表示时间到达1000ns就停止仿真)
initial begin
forever begin
#100;
//$display("---gyc---%d", $time);
if ($time >= 1000) begin
$finish ;
end
end
end
注意:选择否,才能保持仿真软件打开看波形,选择是会关闭软件。
2、does not have a timeunit/timeprecision specification in effect, but other modules do
解决:test bench加上设计文件的引用
`include"../../xxx.v"
3、near “@”: syntax error,unexpected ‘@’, expectiong ‘;’
分号忘记加了,找到提示的行加上分号
4、Illegal output or inout port connection for "port ‘cnt’ "
(1)设计代码定义如下,cnt是output类型
因为test bench里用下列形式,才报错
module test;
reg rstn;
reg clk;
reg [3:0] cnt; //报错
wire cout;
改为下列形式,才正确
module test;
reg rstn;
reg clk;
wire [3:0] cnt; //正确
wire cout;
原因:
端口类型有 3 种: 输入(input),输出(output)和双向端口(inout)。
input、inout 类型不能声明为 reg 数据类型,因为 reg 类型是用于保存数值的,而输入端口只能反映与其相连的外部信号的变化,不能保存这些信号的值。
output 可以声明为 wire 或 reg 数据类型。
端口隐式的声明为 wire 型变量,即当端口具有 wire 属性时,不用再次声明端口类型为 wire 型。当端口有 reg 属性时,则 reg 声明不可省略。
设计代码中并没有声明为reg类型,所以test bench中使用reg是会报错的)
5、BEGIN - END required around task/function statements
解决:test bench的task处理中加上begin和end
task sig_input ;
input [3:0] a ;
input [3:0] b ;
output [3:0] ao ;
output [3:0] bo ;
begin //添加begin
@(posedge clk) ;
ao = a ;
bo = b ;
end //添加end
endtask ; // sig_input
6、(vlog-LRM-2401) Extra semicolon found. This is permitted in SystemVerilog, but not permitted in Verilog.
endtask后面多了个分号
解决:test bench去掉endtask后分号就行