UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Adventurer
Adventurer
385 Views
Registered: ‎06-04-2019

SysGen Gateway In Unexpected Overflow error

Hello All,

I am seeing a weird behavior with the gateway in block.

Below is an example,

I have a constant block with value 8589934591 which is a 33 bit max value.

gatewayinprob3.PNG

 

My gateway in have the same fixed point settings as the input,

gatewayinprob2.PNG

When I run the simulation, I see an overflow error. Why? It requires exactly 33 bits!

gatewayinprob4.PNG

Am I missing anything obvious.

Also I do not see this behavior for values which require 32 bits or less!

Any input is appreciated!

 

Thanks,
Bhavanithya Thiraviaraja
Tags (2)
8 Replies
374 Views
Registered: ‎07-23-2019

Re: Gateway In Unexpected Overflow error

 

I think that's a question for Mathworks, as the errors comes in Matlab simulation, right?

0 Kudos
Adventurer
Adventurer
369 Views
Registered: ‎06-04-2019

Re: Gateway In Unexpected Overflow error

Well, it includes both matlab constant block and also the xilinx dsp Gateway In. I don't know yet which of these is the reason for this  behavior!

Thanks,
Bhavanithya Thiraviaraja
0 Kudos
344 Views
Registered: ‎07-23-2019

Re: Gateway In Unexpected Overflow error

@bhavanithya 

Yes, that's true, these blocks come from Xilinx.

I'm afraid in this case they will just blame each other. It happens with Windows and software.

0 Kudos
Moderator
Moderator
245 Views
Registered: ‎08-16-2018

Re: Gateway In Unexpected Overflow error

We have reproduced the issue at our end. Currently, we are checking the source of error. 

 


/ 7\7     Meher Krishna Patel, PhD
\ \        Senior Product Application Engineer, Xilinx
/ /        
\_\/\7   It is not so much that you are within the cosmos as that the cosmos is within you...
0 Kudos
Moderator
Moderator
225 Views
Registered: ‎08-16-2018

Re: Gateway In Unexpected Overflow error

HI @bhavanithya @archangel-lightworks 

  1. SysGen Gateway-in block first converts its input data type to ‘double’ format then convert it into UFix_33_0 type. So irrespective of any Simulink type (e.g. uint32, double fixed), first it will be converted into ‘double’ as standard notation and then it will be processed to destination type specified in GateWay-In block.
  2. Matlab has little different behavior with regard to values of double and fixed point format as shown below. You can see that value for 2^33 is different for double and unsigned fixed format.
  3. Also, both 8589934591 and 8589934592 have the same values as "8589934591" for ufix33 format (this behaviour can not be seen in less than 32 bit). 

Screenshot_7.jpg

3. Issue: Now the values are converted from ufix to double in sysgen before sending to gateway in. And due to above conflict in the values, SysGen throws the simulation error due to 'flag as error' option. The difference in above figure is causing the overflow

 

Workaroud: Set the output data type to ‘double’and enter the input value as 8589934591 or 2^33-1 (not as 2^33).


/ 7\7     Meher Krishna Patel, PhD
\ \        Senior Product Application Engineer, Xilinx
/ /        
\_\/\7   It is not so much that you are within the cosmos as that the cosmos is within you...
Adventurer
Adventurer
209 Views
Registered: ‎06-04-2019

Re: Gateway In Unexpected Overflow error

Hi @meherp 

2^33 (8589934592) value requires 34 bits to represent it. That is the reason why it is saturtating it to the maximum number that can be represented by 33 bits which is 8589934591 (as seen from your screenshots) and this is the expected behavior.

gatewayinprob14.PNG

My problem is different,

I give 8589934591 as UFix33 (which is representable as proved in the above screenshot) to gateway In with 33 bits and gateway says it is an overflow. !!!

When given as double, of course it works but I want to know why it does not work for UFix constants. My input signal needs to be in UFix format for specific reasons.

There are multiple (specific) workarounds which we did for our design,

  1. As said, it can be given as double.
  2. Overflow type = wrap
  3. Arithmetic Type = "signed"

However no.3 may not work for other designs.

But I am only curious why exactly Simulink UFix33 Constant does not go with Xilinx UFix_33_0 gateway In!

 

 

Thanks,
Bhavanithya Thiraviaraja
0 Kudos
Moderator
Moderator
200 Views
Registered: ‎08-16-2018

Re: Gateway In Unexpected Overflow error

Actually, it is not saturating to max value. If you try '8589934593' for ufix33, then overflow error will be shown by Matlab as well; whereas the '8589934592' is converted to '8589934591'. 

 

During the conversion 'from fixed to double' by SysGen, the conversion of (2^33) 8589934591 value from “ufix33” into “double”, makes the value 8589934592 due to the floating-point conversion (precision) issue. This is the reason for overflow (i.e. overflow in simulation). In the other words, ufix33 has max value 8589934591, but during conversion it will appear as 8589934592 to gateway in port, therefore sysgen is throwning error on it. 

 

The 'wrap' option doesn't care about the simulation overflow, but you may see warnings if MATLAB and SysGen simulation does not match. 

 

 


/ 7\7     Meher Krishna Patel, PhD
\ \        Senior Product Application Engineer, Xilinx
/ /        
\_\/\7   It is not so much that you are within the cosmos as that the cosmos is within you...
0 Kudos
Adventurer
Adventurer
78 Views
Registered: ‎06-04-2019

Re: Gateway In Unexpected Overflow error

Hello Mr.Patel,

thank you for your reply.

Okay so if I understood right, you are saying 8589934591 is getting converted into 8589934592 due to some precision issue (fix to double). 8589934592 needs 34 bits and not 33 so there is an overflow.

But in the screenshot you uploaded ufix_33 8589934591 is not converted to 8589934592 and also the same when I tried in my simulink.

Also in matlab when I try to convert fixed to double I do not see this happening.

overflow_1.PNG

overflow_2.PNG

overflow_3.PNG

 

Additionally, I observed that all the numbers which requires 33 bits i.e from 4294967296 to 8589934591 had an overflow when fed to the 'gateway in' with 33 bit. How do I make sense of this with your explanation?

 

 

Thanks,
Bhavanithya Thiraviaraja
0 Kudos