【发布时间】:2014-04-07 20:15:37
【问题描述】:
我正在尝试为乘法器的硬件实现编写一个 verilog 代码...但我遇到了某些错误 我的代码是
在这里,我采用 4 位输入和 4 位输出....然后将乘数的第一位与被乘数相乘...并将结果存储在 p...类似地,乘数的第二位与被乘数并存储在 q.. .进一步我在其中获取了一个 5 位寄存器和 sote 值....其余代码以此类推
module multiplier(a,b,c
);
input [3:0]a;
input [3:0]b;
output [7:0]c;
wire [3:0]p;
wire [3:0]q;
wire [3:0]r;
wire [3:0]s;
wire [4:0]t;
wire [5:0]u;
wire [6:0]v;
assign [3:0]p = {4{b[0]}} & [3:0]a ; ////////ERROR///////
assign [3:0]q = {4{b[1]}} & [3:0]a ;
assign [3:0]r = {4{b[2]}} & [3:0]a ;
assign [3:0]s = {4{b[3]}} & [3:0]a ;
assign [4:1]t = [3:0]q;
assign [5:2]u = [3:0]r;
assign [6:3]v = [3:0]s;
endmodule
ERROR:HDLCompilers:26 - "multiplier.v" line 34 unexpected token: '['
ERROR:HDLCompilers:26 - "multiplier.v" line 34 unexpected token: '['
ERROR:HDLCompilers:26 - "multiplier.v" line 34 expecting ';', found ':'
ERROR:HDLCompilers:26 - "multiplier.v" line 34 expecting 'endmodule', found '0'
【问题讨论】:
标签: verilog system-verilog hardware-programming