MODELSIM想显示值
module sqrt (idin, dout, clk);
input [7:0] idin;
output [7:0] dout;
input clk;
wire [7:0] idin;
wire [7:0] dout;
ddr ddr_sqrt (
.clock(clk),
.data(idin),
.result(dout)
);
$display ("dout = ", dout);
endmodule
$display ("dout = %d\n", dout);
谢了啊楼上的。可是还是有错整个程序就套用了一个altera Mega Wizard的一个核而已,想显示一下输出值,
还是报错,我查了也没少什么啊。
Error (10170): Verilog HDL syntax error at sqrt.v(18) near text "$display"; expecting "endmodule"
module sqrt (idin, dout, clk);
input [7:0] idin;
output [7:0] dout;
input clk;
wire [7:0] idin;
wire [7:0] dout;
ddr ddr_sqrt (
.clock(clk),
.data(idin),
.result(dout)
);
$display ("dout = %d\n", dout);
endmodule
先把报的什么错误说出来嘛
Error (10170): Verilog HDL syntax error at sqrt.v(18) near text "$display"; expecting "endmodule"
就是说这个错,找不出来错哪里。
绝对不缺 “endmodule”
问题是$display出现在它不该出现的地方。
在tb中写$display$display也是有触发条件的啊
尝试在$display前面写always @ (posedge clk)
谢谢了啊,的确是缺少个触发条件。加上就没事了。
写上%d,%h或者别的
学习了,多谢
用$monitor()就不用加触发条件,她会在值发生变化时自动触发
display加触发条件,记住了,嘿嘿,谢谢啦
晕了。
$display应该出现在块儿中,或者是always @(xxxx) begin .... end
或者是initial begin .... end等等。怎么能直接写在那里,这最基本得verilog语法居然一大帮人念念有词的乱给建议。
