【发布时间】:2018-01-31 18:37:25
【问题描述】:
我收到声明第二个模块的语法错误,我已在 cmets.xml 中指出。我正在使用在线 Verilog 模拟器,所以它不会告诉我什么样的错误。我真的很困惑,因为我遵循了与第一个模块相同的设置,并且我没有收到错误。它与重用变量有关吗?我尝试更改它们,但似乎不起作用。
module MagnitudeComparator4Bit(input [3:0] a, input [3:0] b, output eq, output lt, output gt);
assign eq = a==b;
assign lt = a < b;
assign gt = a > b;
endmodule
module 8bitMagCompare(input [7:0] a, input [7:0] b, output EQ, output LT, output GT); //SYNTAX ERROR
wire w1, w2, w3, w4;
MagnitudeComparator4Bit MagComp1(a[7:4], b[7:4], w1, LT, GT);
MagnitudeComparator4Bit MagComp2(a[3:0], b[3:0], w2, w3, w4);
assign EQ = w1 && w2;
endmodule
module MagCompareTB;
reg a, b;
wire EQ, LT, GT;
8bitMagCompare testcompare(a, b, EQ, LT, GT);
initial begin
$monitor("%d A=%a, B=%b, EQ=%b, LT=%b, GT=%b", $time, a, b, EQ, LT, GT);
#10 a = 00000000;
b = 00000000;
#10 a = 10000000;
b = 00000000;
#10 a = 00000000;
b = 10000000;
end
endmodule
【问题讨论】:
标签: module syntax-error verilog