如何修复 'unknown module type error'?
How do I fix 'unknown module type error'?
当我运行终端中的Verilog代码时,它说我的代码的第一行有错误。
num_7seg_B.v:2: syntax error
module num_7seg_B SEG_B(out, w, x, y, z);
output out;
input w, x, y, z;
wire y1;
wire z1;
wire y_out;
wire z_out;
not G1 (y1, y);
not G2 (z1. z);
and G3 (y_out, x, y1);
and G4 (z_out, x, y, z1);
or G5 (out, z_out, y_out, w);
endmodule
这里是测试基础代码:
module TOP;
wire w,x,y,z,out;
reg [3:0] num;
// instantiation of the module
num_7seg_B SEG_B(out,w,x,y,z);
// simulation ends at time 200
initial #200 $finish;
// num change from 0 to 15, incremented every 5 seconds
initial begin
num=0;
repeat (15)
#5 num=num+1;
end
// dump files
initial
begin
$dumpfile("h1_output.vcd");
$dumpvars;
end
// assignment of signals
assign w=num[3];
assign x=num[2];
assign y=num[1];
assign z=num[0];
endmodule
首先,模块名不能包含space.
您可以将模块名称定义为:
module num_7seg_B(out, w, x, y, z);
但是,使用 module num_7seg_B SEG_B(out, w, x, y, z);
不是一种选择,因为它有
space 在 num_7seg_B
和 SEG_B
之间。
如果您将模块名称更改为 module num_7seg_B(out, w, x, y, z);
,您将摆脱语法错误。
您仍然可以使用 SEG_B
作为您的实例名称。
当我运行终端中的Verilog代码时,它说我的代码的第一行有错误。
num_7seg_B.v:2: syntax error
module num_7seg_B SEG_B(out, w, x, y, z);
output out;
input w, x, y, z;
wire y1;
wire z1;
wire y_out;
wire z_out;
not G1 (y1, y);
not G2 (z1. z);
and G3 (y_out, x, y1);
and G4 (z_out, x, y, z1);
or G5 (out, z_out, y_out, w);
endmodule
这里是测试基础代码:
module TOP;
wire w,x,y,z,out;
reg [3:0] num;
// instantiation of the module
num_7seg_B SEG_B(out,w,x,y,z);
// simulation ends at time 200
initial #200 $finish;
// num change from 0 to 15, incremented every 5 seconds
initial begin
num=0;
repeat (15)
#5 num=num+1;
end
// dump files
initial
begin
$dumpfile("h1_output.vcd");
$dumpvars;
end
// assignment of signals
assign w=num[3];
assign x=num[2];
assign y=num[1];
assign z=num[0];
endmodule
首先,模块名不能包含space.
您可以将模块名称定义为:
module num_7seg_B(out, w, x, y, z);
但是,使用 module num_7seg_B SEG_B(out, w, x, y, z);
不是一种选择,因为它有
space 在 num_7seg_B
和 SEG_B
之间。
如果您将模块名称更改为 module num_7seg_B(out, w, x, y, z);
,您将摆脱语法错误。
您仍然可以使用 SEG_B
作为您的实例名称。