我是Verilog中的新手,我嘗試使用verilog實現單精度浮點加法 - 減法。我收到了一個我無法糾正的錯誤。誰能幫幫我嗎?verilog中的「生成」和「endgenerate」附近的語法錯誤
module addModule(Rs,Re,Rm,As,Ae,Am,Bs,Be,Bm);
//Declarations of ports
Rs,Re,Rm;
As,Bs;
input [7:0] Ae,Be;
input [22:0] Am,Bm;
reg [7:0] Re;
reg [22:0] Rm;
reg Rs;
//wire declarations.
wire [23:-1] C;
assign C[-1] = 0;
wire [23:1] sum;
//variable declaration.
genvar count;
always @(*)
begin
//Add two mantissas.
if ((As^Bs)==0)
begin
generate //getting error here "Syntax error near "generate"."
for(count=0;count<24;count=count+1)
begin
add add_1(.c_out(C[count]),.sum(sum[count]),.in1(tempAm[count]),.in2(tempBm[count]),.c_in(C[count-1]));
end
endgenerate //syntax error near "endgenerate"
end
else
begin
generate //Syntax error near "generate".
for(count=0;count<24;count=count+1)
begin
subtract sub_1(.c_out(C[count]),.dif(sum[count]),.in1(tempAm[count]),.in2(tempBm[count]),.c_in(C[count]));
end
endgenerate //Syntax error near "endgenerate".
end
end
endmodule
在此先感謝。 :)
實例(即'減去sub_1')不會進入'always'或'initial'塊 – Morgan