Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Intel Community
- FPGAs and Programmable Solutions
- Programmable Devices
- Basic VHDL arithmetic not working on std_logic_vectors in Altera (vs Xilinx)

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Highlighted
##

EPrec

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

07-11-2019
06:02 PM

269 Views

Basic VHDL arithmetic not working on std_logic_vectors in Altera (vs Xilinx)

I am porting code that works on a Xilinx FPGA to an Altera FPGA. In my code, I use basic arithmetic operations on std_logic_vectors. As an example, I define the following libraries in my VHDL file:

library IEEE;

use IEEE.STD_LOGIC_1164.ALL;

use IEEE.STD_LOGIC_ARITH.ALL;

use IEEE.STD_LOGIC_UNSIGNED.ALL;

use IEEE.NUMERIC_STD.ALL;

Then if I define a signal:

signal my_signal : std_logic_vector(4 downto 0);

And then have a statement:

my_signal <= my_signal - 1;

On the FPGA, this statement seems to be impacting only bit 0 of my_signal instead of the entire vector. I've tried to rewrite the statement as:

my_signal <= std_logic_vector(unsigned(my_signal) - 1);

but that is throwing off errors when I try to build the project.

In Xilinx FPGA, the above statement works just fine, counting down the std_logic_vector (and turning over to 0b11111 when I subtract 1 from 0b00000). Why is this not working on the Intel/Altera FPGA?

0 Replies

For more complete information about compiler optimizations, see our Optimization Notice.