我在verilog文件中实例化模块时遇到错误。我正在这样实例化:
module lab3(input clk,set,reset,plus,minus,start,button,output reg [3:0]led,output reg [6:0]y);
wire [3:0] indicesgu[3:0];
reg [1:0] going;
reg alsogoing,yes;
if (going==1 && alsogoing)
begin
up_counter up_0 (
indicesgu ,
indices ,
alsogoing
);
end
endmodule
我的up_counter模块以:
开头module up_counter(input [3:0] indices_in [3:0],output [3:0]indices[3:0],output alsogoing);
reg [3:0]indices[3:0];
reg [2:0]current,setting;
endmodule
当我尝试在Xilinx中编译时,它会说意外的令牌up_counter。 提前谢谢。
答案 0 :(得分:2)
您的lab3
模块存在多个问题。
endmodule
。up_counter
内实例化if
。 Verilog不支持这样的条件实例。up_0
后面打开一个开头。答案 1 :(得分:1)
您的代码中存在(多个)语法错误。 其中之一是您需要在组件端口列表
周围使用方括号()up_counter up_0 (indicesgu ,
indices ,
alsogoing
);
查看Verilog syntax了解详情。
这至少会修复'意外令牌up_counter'错误。