小编abd*_*dul的帖子

verilog中的加法器

我正在Verilog设计一个加法器.它将有两个大小为N和两个输出的输入.第一个输出的大小为2N,第二个的大小为K.

这是我到目前为止:

module adder(
  out,
  CCR,
  inA,
  inB
);
parameter N=8,CCR_size=8;
parameter M=2*N;
input  [N-1:0]        inA,inB;
output [M-1:0]        out;
output [CCR_size-1:0] CCR;
reg    [N:0]          temp;
always @(inA or inB)
  begin
    temp      = inA+inB;
    CCR[0]    = temp[N];
    out[N-1:0]= temp[N-1:0];
    out[M-1:N]= 'b0;
  end
endmodule
Run Code Online (Sandbox Code Playgroud)

从评论中移出: 但是这没有编译.我有错误

CCR[0],out[N-1:0] and out[M-1:N]

# Error: VCP2858 adder.v : (16, 20): CCR[0] is not a valid left-hand side of a procedural assignment.
# Error: VCP2858 adder.v : (17, 28): out[N-1:0] is not a valid left-hand side of …
Run Code Online (Sandbox Code Playgroud)

verilog

1
推荐指数
1
解决办法
3714
查看次数

标签 统计

verilog ×1