Guest
Iam encountering an error while simulating in xilinx but it is compiled and simulated in modelsim.In xilinx its showing an error like "Non-constant loop condition not supported for while".So please give some suggestions to remove the error...by the way am a starter to verilog and please do help me out from this error.....
module prenorm( clk,
num1,
num2,
ieeesigna,
ieeeexpa,
sum
);
integer i;
input clk;
input[31:0] num1;
input [31:0]num2;
output reg [0:0] ieeesigna;
output reg [7:0] ieeeexpa;
output reg [22:0] sum;
reg [0:0] ieeesign1;
reg [0:0] ieeesign2;
reg [22:0] ieeemant1;
reg [22:0] ieeemant2;
reg [7:0] ieeeexp1;
reg [7:0] ieeeexp2;
reg [7:0] expdif;
reg [0:0] count;
always @ ( num1 or num2)
begin
ieeesign1 = num1[31];
ieeeexp1 = num1[30:23];
ieeemant1 = num1[22:0];
ieeesign2 = num2[31];
ieeeexp2 = num2[30:23];
ieeemant2 = num2[22:0];
if (ieeeexp1<ieeeexp2)
expdif = ieeeexp2-ieeeexp1;
while (expdif)
begin
ieeemant1 = ieeemant1>>1;
ieeeexp1 = ieeeexp1+1;
expdif = expdif-1;
end
if (ieeeexp2<ieeeexp1)
expdif = ieeeexp1-ieeeexp2;
while (expdif)
begin
ieeemant2 = ieeemant2>>1;
ieeeexp2 = ieeeexp2+1;
expdif = expdif-1;
end
{count,sum} = ieeemant1+ieeemant2;
if (count==1)
begin
{count,sum} = {count,sum} >> 1;
ieeeexp2 = ieeeexp2+1;
end
ieeesigna = ieeesign1;
ieeeexpa =ieeeexp1;
end
endmodule
module prenorm( clk,
num1,
num2,
ieeesigna,
ieeeexpa,
sum
);
integer i;
input clk;
input[31:0] num1;
input [31:0]num2;
output reg [0:0] ieeesigna;
output reg [7:0] ieeeexpa;
output reg [22:0] sum;
reg [0:0] ieeesign1;
reg [0:0] ieeesign2;
reg [22:0] ieeemant1;
reg [22:0] ieeemant2;
reg [7:0] ieeeexp1;
reg [7:0] ieeeexp2;
reg [7:0] expdif;
reg [0:0] count;
always @ ( num1 or num2)
begin
ieeesign1 = num1[31];
ieeeexp1 = num1[30:23];
ieeemant1 = num1[22:0];
ieeesign2 = num2[31];
ieeeexp2 = num2[30:23];
ieeemant2 = num2[22:0];
if (ieeeexp1<ieeeexp2)
expdif = ieeeexp2-ieeeexp1;
while (expdif)
begin
ieeemant1 = ieeemant1>>1;
ieeeexp1 = ieeeexp1+1;
expdif = expdif-1;
end
if (ieeeexp2<ieeeexp1)
expdif = ieeeexp1-ieeeexp2;
while (expdif)
begin
ieeemant2 = ieeemant2>>1;
ieeeexp2 = ieeeexp2+1;
expdif = expdif-1;
end
{count,sum} = ieeemant1+ieeemant2;
if (count==1)
begin
{count,sum} = {count,sum} >> 1;
ieeeexp2 = ieeeexp2+1;
end
ieeesigna = ieeesign1;
ieeeexpa =ieeeexp1;
end
endmodule