Getting a runtime error_0067 Value -1 out of range (0 to 7). Buf_ptr is set as a natural number but still goes negative because it is not overflowing back to 7. This can easily be fixed with an if statement but is there a setting in ActiveHdl that I need to enable to allow naturals to overflow?
.....
signal buf_ptr : natural range 0 to 7
....
....
....
dma_wrt_Data(7 downto 0) <= incoming_data(buf_ptr);
bytes_available <= bytes_available - 1;
buf buf_ptr <= buf_ptr - 1;
packet_byte_count <= packet_byte_count -1;
rcv_pkt_bct <= rcv_pkt_bct - 1;
Scoured the web to see if anyone else had this problem, couldn't find any :(
Ranges do not do this. Mod does:
Like @Tricky said, the purpose of a range is to allow checking of the bounds during an assignment.
Ada has modular types that may do this. These might be something interesting to have in VHDL, but someone would have to want to work on that aspect of the language. A starting point for this type of activity is: https://gitlab.com/IEEE-P1076/VHDL-Issues/-/issues