Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
17255 Discussions

ModelSim "out of range" issue

Altera_Forum
Honored Contributor II
8,237 Views

I have the following code: 

 

Library IEEE; use IEEE.Std_Logic_1164.all; use IEEE.numeric_std.all; use IEEE.Math_real.all ; ... WIDTH_DQ : natural := 9 ; X : in integer range -(2 ** (WIDTH_DQ - 1)) to 2 ** (WIDTH_DQ - 1) - 1 := 0 ; Y : in integer range -(2 ** (WIDTH_DQ - 1)) to 2 ** (WIDTH_DQ - 1) - 1 := 0 ; ... signal lxn : integer range -(2 ** (WIDTH_DQ - 1)) to 2 ** (WIDTH_DQ - 1) - 1 := 0 ; ... lxn <= X - Y / (2 ** RANK) ;  

During RTL simulation at RANK = 2 in time X = 226 and Y = -113. I'd expect lxn to become 254 and well within range. But ModelSim tells: 

 

--- Quote Start ---  

# ** Fatal: (vsim-3421) Value 261 for lxn is out of range -256 to 255. 

# Time: 88 ns Iteration: 3 Process: /tp_cordic_vhd_tst/i1/genel(3)/regel/genpure/line__252 File: C:/qdesigns/bv5fpga/c-cam/bb/arithmetic/TP_cordic/cordicelement/cordicelement.vhd 

# Fatal error in Process line__252 at C:/qdesigns/bv5fpga/c-cam/bb/arithmetic/TP_cordic/cordicelement/cordicelement.vhd line 294 

 

--- Quote End ---  

 

It looks like ModelSim is taken the representation of -113 as 'unsigned' and added 1/4 of that giving a result of 261. 

 

Any clues?
0 Kudos
21 Replies
Altera_Forum
Honored Contributor II
534 Views

 

--- Quote Start ---  

You'll be telling us you write bus functional models next! 

--- Quote End ---  

 

 

You don't already? 

 

I can give you some nice examples in VHDL if you'd like to learn how to write them? :) 

 

Cheers, 

Dave
0 Kudos
Reply