Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers

Modelsim error

Altera_Forum
Honored Contributor II
3,382 Views

Hii i am using Modelsim student edition for the simulation of my edge detection code. 

I am getting the following error.... 

 

** Error: fixed_pkg Unbounded number passed, was a literal used?** 

 

can any one please suggest what is the meaning of this error??? 

Thanx and regards!!
0 Kudos
13 Replies
Altera_Forum
Honored Contributor II
2,536 Views

Why would you think anyone will know what's wrong when you didn't include any code?

0 Kudos
Altera_Forum
Honored Contributor II
2,536 Views

Very little information to go on: 

What version of modelsim? 

what version of fixed_pkg? 

post some code?
0 Kudos
Altera_Forum
Honored Contributor II
2,536 Views

 

--- Quote Start ---  

Very little information to go on: 

What version of modelsim? 

what version of fixed_pkg? 

post some code? 

--- Quote End ---  

 

 

Sorry for less information...I am using model sim 10.4a PE student version.And fixed_package is of $Revision: 1.11 $ version. 

Actually my code is of 877 lines so its not possible to paste the complete code.Also I am having two more modules with it. It is showing error in the following process .. 

 

angle1: process (clk) 

variable index2 :integer:=0; 

variable index3 :integer:=0; 

variable count1 :integer:=0; 

VARIABLE row_cnt_m: INTEGER:=0;--row count 

VARIABLE col_cnt_m: INTEGER:=0;--coloumn count 

VARIABLE col_tr_m: BOOLEAN:=FALSE;--end of coloumn  

begin 

IF(clk'EVENT AND clk='1') THEN 

 

 

 

 

mod_d <= unsigned(to_ufixed(resize((abs(dx)+abs(dy)),7,0))); --Resize the result to 8 bits 

buffm(index2)<=(mod_d); 

index2 := index2+1; 

col_cnt_m := col_cnt_m +1; 

count1 := count1+1; 

--at end of one row 

IF (count1=256) THEN 

row_cnt_m:=row_cnt_m+1; 

IF (col_tr_m=FALSE) THEN 

col_res_m<=col_cnt_m; 

col_tr_m:=TRUE; 

END IF; 

count1 := 0; 

col_cnt_m :=0; 

END IF; 

--at end of one frame 

IF (index2=65535) THEN 

row_res_m<=row_cnt_m; 

row_cnt_m:=0; 

col_cnt_m:=0; 

index2:=0; 

count1 := 0; 

END IF;  

 

IF (row_cnt_m=3) THEN 

prv_load_m<='1'; 

cur_load_m<='1'; 

nex_load_m<='1'; 

END IF; 

IF (dx /= "000000000000000" ) THEN 

IF (dy /= "000000000000000" ) THEN  

div <= resize((dy /dx),8,-3); 

END IF; 

END IF; 

if ((num1 < div AND div < num2)or( num5 < div AND div < num1) ) then 

data <= my_lut(4); 

elsif (num2 < div AND div < num4 ) then 

data <= my_lut(1); 

elsif ((num4 < div AND div < num8) OR (num7< div AND div < num6) ) then 

data <= my_lut(2); 

elsif (num6 < div and div < num5) then 

data <= my_lut(3); 

end if; 

bufang(index3) <= data; 

index3 := index3 +1; 

if (index3 =65535) then 

index3 := 0; 

end if; 

END IF; 

end process angle1; 

 

I am taking a 256 * 256 image.And this is the part for angle calculation in canny edge detector.my_lut is a lookup table having values 0 ,45,90 and 135 in degree.and variable num is different variable range in sfixed formate.
0 Kudos
Altera_Forum
Honored Contributor II
2,536 Views

Without all of the signal descriptions, we wont be able to give a full answer. 

Please attach the full code to your post (dont paste it).
0 Kudos
Altera_Forum
Honored Contributor II
2,536 Views

 

--- Quote Start ---  

Without all of the signal descriptions, we wont be able to give a full answer. 

Please attach the full code to your post (dont paste it). 

--- Quote End ---  

 

 

Please find attachments ,this is the main code file.If you need any other file then please tell me.
0 Kudos
Altera_Forum
Honored Contributor II
2,536 Views

 

--- Quote Start ---  

Please find attachments ,this is the main code file.If you need any other file then please tell me. 

--- Quote End ---  

 

 

 

This is the same code with some correction in it.please help me with it.
0 Kudos
Altera_Forum
Honored Contributor II
2,536 Views

dx and dy are declared as sfixed(), but you're trying to convert it to ufixed. There is no to_ufixed function from sfixed because such a thing would not make much sense. If you really insist on using ufixed, you need to type cast it yourself via: 

 

mod_d <= to_unsigned(ufixed(resize((abs(dx)+abs(dy)),7,0))); --Resize the result to 8 bits 

 

But given dx and dy are signed - im guessing things are going to start to go wrong..
0 Kudos
Altera_Forum
Honored Contributor II
2,536 Views

Thank you so much for your reply.I tried the line suggested by you .It is showing the following error. 

 

 

no feasible entries for subprogram "to_unsigned". 

 

So I changed the mod _d to (9 downto 0). 

 

mod_d <= unsigned(to_ufixed(resize((abs(dx)+abs(dy)),9,0))); 

 

This is giving correct mod and division values with respect to different dx and dy values. 

Now the error is same.if I am changinf the simulation setting to (Simulation-Run time option-message severity-error),it is showing following error. 

 

# ** error: fixed_pkg unbounded number passed, was a literal used? 

# time: 783 us iteration: 0 process: /camera/uut/angle1 file: c:/users/embedded/desktop/new/fixed_pkg.vhdl 

# break in subprogram mine at c:/users/embedded/desktop/new/fixed_pkg.vhdl line 2061. 

 

So is it mean thet error is in process angle1.As i read in some sites that this error caused if we use negative indexing,which I have not used through out the code.Please help me with this .I am not getting what to do.I am attaching the new file with some modifications in it.
0 Kudos
Altera_Forum
Honored Contributor II
2,536 Views

As I have said before, you have dx and dy declared as sfixed, but then casting to a unsigned - why?

0 Kudos
Altera_Forum
Honored Contributor II
2,536 Views

 

--- Quote Start ---  

As I have said before, you have dx and dy declared as sfixed, but then casting to a unsigned - why? 

--- Quote End ---  

 

Thank you for replying.. Sorry now I get it. Even if i will change it to sfixed it will be same as I am taking abs value of it. So no need to convert it in unsigned. I did the changes but the error is same as above.Can you suggest any thing.I am attaching updated file with it.
0 Kudos
Altera_Forum
Honored Contributor II
2,536 Views

Without your testbench - there is not much I can do as it compiles just fine. I assume your error is runtime? 

Debugging is really something you should be doing.
0 Kudos
Altera_Forum
Honored Contributor II
2,536 Views

 

--- Quote Start ---  

Without your testbench - there is not much I can do as it compiles just fine. I assume your error is runtime? 

Debugging is really something you should be doing. 

--- Quote End ---  

 

 

I am trying to debug it from one week.Can you give me outline how to debug a code.And what is this run time error.I am using an small image of size 64 *64.How to deal with run time error.
0 Kudos
Altera_Forum
Honored Contributor II
2,536 Views

Run time error is an error that occurs during runtime - ie. during simulation. I do not get a problem compiling your code, but I cannot run your code as I do not have the testbench you are using to simulate it.

0 Kudos
Reply