Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Allowing integer overflow in VHDL

Status
Not open for further replies.

vvanders

Newbie level 4
Joined
May 24, 2009
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,325
vhdl overflow

I'm in the process of converting a design from verilog to VHDL, one of the parts of my design contains a circular buffer that was just using a counter that would rollover back to 0 when it overflowed in verilog.

Is there any easy way to do this in VHDL? I'm using a integer type, "read_cnt : integer DEPTH-1 to 0" for my variable but the simulator throws a index out of bounds when I run it and the value goes path DEPTH-1.
 

vhdl integer

I dont knw abt integer...
Instead of integer use std_logic_vector. this mwy helpful for u..
 

vhdl integer overflow

vvanders said:
Is there any easy way to do this in VHDL? I'm using a integer type, "read_cnt : integer DEPTH-1 to 0" for my variable but the simulator throws a index out of bounds when I run it and the value goes path DEPTH-1.

Code:
signal read_cnt : integer range 0 to DEPTH-1:=0;
...
if(read_cnt = DEPTH-1) then
   read_cnt <= 0;
else
   read_cnt <= read_cnt + 1;
end if;
 

overflow in vhdl

I was hoping I wouldn't have to do that and VHDL would have a much more C like handling of integers, ah well.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top