What is the meaning of the following warning (raised by Quartus)?

Warning (10445): VHDL Subtype or Type Declaration warning at someFile.vhd(32): subtype or type has null range

The offending line of code is:

-- Drive unused low
q( N - 1 downto X ) <= ( others => '0' );  -- drive unused low

N and X are integer constants used successfully elsewhere in the code (without raising warnings). q is declared as q : out std_logic_vector( N - 1 downto 0 )

The same error is also raised for this line of code (in another file):

-- Upper nibble
q <= zero( N - 1 downto 8 ) & q0( 7 downto 4 ) & zero( 3 downto 0 );

N is an integer constant used successfully elsewhere in the code. q is declared as q : out std_logic_vector( N - 1 downto 0 ). q0 is declared as signal q0 : std_logic_vector( N - 1 downto 0 ). zero is declared as constant zero : std_logic_vector( N - 1 downto 0 ) := ( others => '0' )

It seems ( others => '0' ) is the common point for both, but I don't know how this relates to the null range warning.


The range: N - 1 downto X is evaluating to a range with 0 or negative size. Consider the range: 0 downto 4, it has a size that is less than 0 since the number before the downto is less than the number after it.

The problem here is using a range that has a size less than 1 makes it a null range which has some valid uses in vhdl. However, since this is potentially a range error Quartus gives the warning you are seeing here.

  • \$\begingroup\$ Thank you! The code was initially written for 16+ bits (N=16). Using it for 8 bits (N=8) caused the subtle error. N - 1 downto 8 became 7 downto 8 \$\endgroup\$ – Jet Blue Jun 1 '18 at 1:35
  • 1
    \$\begingroup\$ VHDL allows you to have NULL ranges and NULL slices. That's why it is a warning and no error. There are good use cases using NULL ranges. But in most cases it's an error in the calculation of slice boundaries. \$\endgroup\$ – Paebbels Jun 1 '18 at 5:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.