[ibis-macro] Definition of integer?

  • From: "Muranyi, Arpad" <Arpad_Muranyi@xxxxxxxxxx>
  • To: "IBIS-ATM" <ibis-macro@xxxxxxxxxxxxx>
  • Date: Tue, 9 Feb 2010 20:03:21 -0800

Hello everyone,

After our ATM teleconference I got curious about the definition
of the integer type in VHDL-AMS and ran a few tests to find out what
it will do.  I declared the following integer signals with initial
values assigned to them to see which of these will generate an
error:

  signal Test_1 : integer := 150;
  signal Test_2 : integer := 15e+1;
  signal Test_3 : integer := 1.5e+2;
  signal Test_4 : integer := 0.15e+3;
  signal Test_5 : integer := 150e-1;
  signal Test_6 : integer := 150e-2;
  signal Test_7 : integer := 150e-3;

Based on math, except for the last two lines, the above should all
resolve to an integer, and be accepted without error.  However, I
got the following error messages:

  signal Test_3 : integer := 1.5e+2;
  [Error] Type check error: expression is not of type
STD.STANDARD.INTEGER

  signal Test_4 : integer := 0.15e+3;
  [Error] Type check error: expression is not of type
STD.STANDARD.INTEGER

  signal Test_5 : integer := 150e-1;
  [Error] An integer expression cannot be raised to a negative power

  signal Test_6 : integer := 150e-2;
  [Error] An integer expression cannot be raised to a negative power

  signal Test_7 : integer := 150e-3;
  [Error] An integer expression cannot be raised to a negative power


Then I redid the same experiment in C++ with these lines:

  int Test_1 = 150;
  int Test_2 = 15e+1;
  int Test_3 = 1.5e+2;
  int Test_4 = 0.15e+3;
  int Test_5 = 150e-1;
  int Test_6 = 150e-2;
  int Test_7 = 150e-3;

Visual studio gave me these warnings on all but the first line:

IntTest.cpp(1033) : warning C4244: 'initializing' : conversion from
'double' to 'int', possible loss of data

It seems that this may be related to how the number is stored or
manipulated in the CPU more than what it evaluates to according
to math, but I am not sure what the determining factors or rules
are, especially since the compilers of these two languages gave
me different answers...

What shall be our definition for integer float in IBIS-AMI?  Part of
me says that we should try what C would do, since our AMI interface
is based on C, but then we also say that any language can be used
for writing AMI models as long as the DLL interface matches what we
defined in the specification.  What if different languages have
different definitions for integer/float?

Thanks,

Arpad
=====================================================================
---------------------------------------------------------------------
IBIS Macro website  :  http://www.eda.org/pub/ibis/macromodel_wip/
IBIS Macro reflector:  //www.freelists.org/list/ibis-macro
To unsubscribe send an email:
  To: ibis-macro-request@xxxxxxxxxxxxx
  Subject: unsubscribe

Other related posts: