|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
再quartus中编译完全成功,但是再modelsim中编译却出错:Error: D:/1Myproject/Counter4/RTL/Counter4.v(41): Undefined variable: WIDTH.
** Error: D:/1Myproject/Counter4/RTL/Counter4.v(50): 'WIDTH' already declared in this scope.
** Error: D:/1Myproject/Counter4/RTL/Counter4.v(30): Identifier must be declared with a port mode: dout.
我定义了width的,modelsim中的编译和quartus中编译有什么不同点啊,谢谢
源代码如下
module Counter4(
//input
sys_clk,
sys_rst_n,
ena,
//output
dout,
cout
);
//input ports
input sys_clk; //system clock;
input sys_rst_n; //system reset, low is active;
input ena; //
//output ports
output [WIDTH-1:0] dout;
output cout;
//reg define
reg [WIDTH-1:0] counter;
//wire define
//parameter define
parameter WIDTH = 4;
/*******************************************************************************************************
** Main Program
**
********************************************************************************************************/
always @(posedge sys_clk or negedge sys_rst_n) begin
if (sys_rst_n ==1'b0) begin
counter <= 1'b0;
end
else if (ena == 1'b1) begin
counter <= counter + 1'b1;
end
end
assign cout = &counter;
assign dout = counter;
endmodule
//end of RTL code |
|