jasmine123
Newbie level 5
The algorithm:
The code i have written is as:
ERROR:HDLCompilers:277 - "monto_arithmetic.v" line 36 Illegal condition expression in generate
if statement
Can somebody point the mistake?
Code:
Z=0;
for (i=0;i<n;i++){
{Z=Z+j[i]k;}
if (Z%2=1)
{ Z=Z+M;
Z=Z/2;
}
else
{Z=Z/2;}}
if (Z>M) {Z=Z-M;}
The code i have written is as:
Code:
module monto_arithmetic(j,k,n,y);
input [7:0] j,k,n;
output reg [7:0] y ;
wire [7:0] p [0:7];
wire [7:0] r [0:8];
wire [7:0] l [0:8];
wire o [0:7];
wire g [0:7];
wire [7:0] f;
assign r[0]=8'b0;
genvar i;
generate for (i=0;i<8;i=i+1) begin:block1
conditional_bit c0 (j[i],k,p[i]);
adder_8bit_reversible t0 (p[i],r[i],1'b0,r[i+1],o[i]);
assign f=r[i+1];
if (f%2==1'b1) begin:block2
adder_8bit_reversible t1 (r[i+1],n,1'b0,l[i],g[i]);
assign l[i]=l[i]>>1;
assign r[i]=l[i];
end
else begin
assign l[i]=l[i]>>1;
assign r[i]=l[i];
end
end
endgenerate
assign y[7:0]=r[8];
always @*
begin
if (y>n)
assign y=y-n;
end
endmodule
ERROR:HDLCompilers:277 - "monto_arithmetic.v" line 36 Illegal condition expression in generate
if statement
Can somebody point the mistake?