【发布时间】:2021-07-31 00:48:39
【问题描述】:
我在运行我的测试平台时遇到了一个错误,因为每当我输入尝试使用 vvp 命令运行它时,我只会收到一条显示为“SantiJ1.v:1:syntax error”的消息。我查看了我的代码,似乎没有问题,至少从我所看到的来看。
这是模块:
`timescale 1ns/1ps
module HDLProject1(A, B, C, D, AB, BA, P1, P2, F);
input A, B, C, D;
output nA, nB, nD, AB, BA, P1, P2, F;
not notA(nA, A);
not notB(nB, B);
and Part1(AB, A, nB);
and Part2(BA, B, nA);
or Level1(P1, AB, BA);
not notD(nD, D);
or Level2(P2, C, nD);
and Finish(F, P1, P2);
endmodule
这是测试平台:
`timescale 1ns/1ps
module HDLProject_tb;
reg test_A, test_B, test_C, test_D;
wire test_AB, test_BA, test_P1, test_P2, test_F;
HDLProject1 dut(test_A, test_B, test_C, test_D, test_AB, test_BA, test_P1, test_P2, test_F);
initial
begin
test_A = 0;
test_B = 0;
test_C = 0;
test_D = 0;
#10
test_A = 0;
test_B = 0;
test_C = 0;
test_D = 1;
#10
test_A = 0;
test_B = 0;
test_C = 1;
test_D = 0;
#10
test_A = 0;
test_B = 0;
test_C = 1;
test_D = 1;
#10 test_A = 0;
test_B = 1;
test_C = 0;
test_D = 0;
#10
test_A = 0;
test_B = 1;
test_C = 0;
test_D = 1;
#10 test_A = 0;
test_B = 1;
test_C = 1;
test_D = 0;
#10
test_A = 0;
test_B = 1;
test_C = 1;
test_D = 1;
#10 test_A = 1;
test_B = 0;
test_C = 0;
test_D = 0;
#10
test_A = 1;
test_B = 0;
test_C = 0;
test_D = 1;
#10
test_A = 1;
test_B = 0;
test_C = 1;
test_D = 0;
#10
test_A = 1;
test_B = 0;
test_C = 1;
test_D = 1;
#10
test_A = 1;
test_B = 1;
test_C = 0;
test_D = 0;
#10
test_A = 1;
test_B = 1;
test_C = 0;
test_D = 1;
#10
test_A = 1;
test_B = 1;
test_C = 1;
test_D = 0;
#10
test_A = 1;
test_B = 1;
test_C = 1;
test_D = 1;
end
initial
begin
$monitor("time = %0d", $time, " A = %b B = %b C = %b D = %b Output_F = %b", test_A, test_B, test_C, test_D, test_F);
$dumpfile("SantiJ1.vcd");
$dumpvars();
end
endmodule
根据我从错误消息中收集到的信息,它仅指向第 1 行,但由于我是使用 HDL 的新手,因此我无法真正指出错误的可能原因。
【问题讨论】:
-
文件“SantiJ1.v”中是哪一个?你的 vpp 命令怎么样?从这两部分中,唯一的错误是您将 nA、nB 和 nD 列为输出,而它们不在模块的端口列表中。
-
同名的文件是第一个文件,但是我在模块或测试台上使用vvp时出现错误。
-
代码中没有语法错误。要么你的 vvp 命令有问题,要么你遗漏了一些东西。检查您的文件中是否有任何不可打印的符号,或者您是否使用了 utf 编码。我在 eda 操场上用几个编译器试了一下。没有语法问题。