我用Synplify做了个普通定点格式(第47位是符号位,46到29位是整数位,28到0位是小数位)转换成ieee754格式的模块,但是编译中出现了这样一条编译错误信息@E:
CL104 :
changeto754.v(62) | Couldn't find binding for variable index。。。我都束手无策了,index明明已经定义了,为什么编译会提示index未加约束这样的错误信息呢??求助啊!!!(下面是全部代码)[code]`define M 18
`define N 29
//????????????256
module changeto754(data754,datain,clk,rst_n);
output [31:0] data754;
input [`M+`N:0] datain;
input clk,rst_n;
reg [7:0] index;
//reg [7:0] j;
reg [`M+`N-1:0] data,men[`M+`N];
reg [7:0] E;
reg [22:0] F;
reg [2:0] state;
reg S;
parameter s0=0;
parameter s1=1;
parameter s2=2;
parameter s3=3;
assign data754[31]=S;
assign data75[30:23]=E;
assign data754[22:0]=F;
always@(posedge clk)
begin
if(rst_n==0)
begin
index<=`M+`N-1;
E<=8'd0;
F<=23'd0;
state<=s0;
S<=1'b0;
//for(j=8'd0;j<=(`M+`N);j=j+8'd1)
// men[j]={{(`M+`N-j){1'b0}},{j{1'b1}}};
end
else
begin
case(state)
s0:
begin
if(datain[`M+`N])
begin
data<=~datain[`M+`N-1:0]+1;
S<=1'b1;
end
//else S<=1'b0;
state<=s1;
end
s1:
begin
if(data[index]) //?????????1
begin
E<=8'd127+index-`N;
if(index==0) F<=23'd0;
else
begin
if(index>22) F<=data>>(index-23);//data cut
else //F[22:23-index]<=data[index-1:0];
begin
if(`M+`N>22) F<=(data|{{(`M+`N-index){1'b0}},{index{1'b1}}})<<(23-index);
else F<=({{(23-`M-`N){1'b0}},data}|{{(23-index){1'b0}},{index{1'b1}}})<<(23-index);
end
end
state<=s2;
end
else
begin
if(index==0) //???????1
begin
E<=8'd127;
F<=23'd0;
state<=s2;
end
else
begin
index<=index-1;
end
end
end
endcase
end
end
endmodule [/code]