verilog 语法问题
时间:10-02
整理:3721RD
点击:
想用一些寄存器,实现外部输入的信号的乘法和加法,刚开始就遇到了困难。主要是不清楚阻塞赋值和非阻塞赋值的差别。本来是外部输入信号赋给rra和rrb两个寄存器,但是为了仿真我就在程序里直接赋值了
rra=32'h3f800000;//1
rrb=32'h40000000;//2
rA={ rra[31], rra[30:23], 1'b1, rra[22:0]};
rB= { rrb[31], rrb[30:23], 1'b1, rrb[22:0]};
BDiff = rB[31:24] - 8'd127; // + (~8'd127 + 1)
rExp = rA[31:24] + BDiff; // A.Exp + B.Exp
Temp = rA[23:0] * rB[23:0];
这么写,报错Signal is assigned but never used. This unconnected signal will be trimmed during the optimization process.
敢问怎么样才算是使用了变量呢?
rra=32'h3f800000;//1
rrb=32'h40000000;//2
rA={ rra[31], rra[30:23], 1'b1, rra[22:0]};
rB= { rrb[31], rrb[30:23], 1'b1, rrb[22:0]};
BDiff = rB[31:24] - 8'd127; // + (~8'd127 + 1)
rExp = rA[31:24] + BDiff; // A.Exp + B.Exp
Temp = rA[23:0] * rB[23:0];
这么写,报错Signal is assigned but never used. This unconnected signal will be trimmed during the optimization process.
敢问怎么样才算是使用了变量呢?
饿
wire类型赋值,前面加上assign