# VHDL - Subtype or type has null range

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.
• 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 – Jet Blue Jun 1 '18 at 1:35