Skip to content

[Feature Request] Warning on null ranges #364

Open
@JHertz5

Description

@JHertz5

I would like to request a feature. I was recently helping a junior engineer to debug a mysterious error that he was struggling with. After searching high and low, we discovered that they had used to instead of downto when defining a range, resulting in a null range, which was only caused a cryptic error message from the simulation tool several layers down in the hierarchy.

I understand that use of null ranges is valid VHDL and I understand if you don't want to create warnings on valid code, but I think that it would helpful to have a warning shown in cases like this, perhaps one that can be suppressed by the user (or even, is suppressed by default and can be un-suppressed by the user) for people who want to use null ranges?

Specifically, I would like to see warnings on X to Y and Y downto X, where X < Y in both cases, e.g.

library IEEE;
use IEEE.std_logic_1164.all;

package test is

  subtype null_range_to     is integer range 1 to 0;
  subtype null_range_downto is integer range 0 downto 1;

  subtype slv_null_range_to     is std_logic_vector(1 to 0);
  subtype slv_null_range_downto is std_logic_vector(0 downto 1);

end package test;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions