我想设计一个增量寄存器,它总是增加输入并将其输出。我写这段代码,但它有错误:
# Error: VCP2858 test3.v : (51, 19): in is not a valid left-hand side of a procedural assignment.
module inc(in, out);
output reg [0:32] out ;
input [0:32] in ;
wire [0:32] in ;
always @(*)
begin
in <=( in + 1);//error
out<=in;
end
endmodule
答案 0 :(得分:2)
在Verilog中,不应为模块内声明为input
的信号赋值。您的代码可以简化为:
module inc(in, out);
output [0:32] out ;
input [0:32] in ;
assign out = in + 1;
endmodule