+ Post New Thread
Results 1 to 3 of 3
  1. #1
    Full Member level 3
    Points: 1,362, Level: 8

    Join Date
    May 2014
    Posts
    154
    Helped
    17 / 17
    Points
    1,362
    Level
    8

    Enumeration of range type - vhdl

    Hello all


    ~See the following.

    I enumerate a range using val'range. Is it possible to just have a range in a record?
    Code VHDL - [expand]
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    
    type t_CTRL_INDEX is record
      DATA_TYPE_slv    : std_logic_vector(7 downto 2);
      FRAME_TYPE       : integer;
      DIRECTION        : integer;
    end record;
    constant c_CTRL_INDEX : t_CTRL_INDEX := (
      DATA_TYPE_slv    => (others => '0'),
     FRAME_TYPE       => 1,
      DIRECTION        => 0
    );
    type t_CTRL_FRAME is record
      CMD              : std_logic;
      DATA             : std_logic;
      VBN2PIU          : std_logic;
      PIU2VBN          : std_logic;
      CMD_FRM          : std_logic_vector(7 downto 2);
      STATUS           : std_logic_vector(7 downto 2);
      LIDAR            : std_logic_vector(7 downto 2);
      VBN              : std_logic_vector(7 downto 2);
      VIS              : std_logic_vector(7 downto 2);
      NET              : std_logic_vector(7 downto 2);
      HAR              : std_logic_vector(7 downto 2);
    end record;
    constant c_CTRL : t_CTRL_FRAME := (
      CMD              => '0',
      DATA             => '1',
      VBN2PIU          => '1',
      PIU2VBN          => '0',
      CMD_FRM          => 6X"00", -- 2008 vhdl -- pre2008 - "xx" & X"0";
      STATUS           => 6X"20", -- 2008 vhdl -- pre2008 - "xx" & X"0";
      LIDAR            => 6X"10", -- 2008 vhdl -- pre2008 - "xx" & X"0";
      VIS              => 6X"30", -- 2008 vhdl -- pre2008 - "xx" & X"0";
      VBN              => 6X"08", -- 2008 vhdl -- pre2008 - "xx" & X"8";
      NET              => 6X"28", -- 2008 vhdl -- pre2008 - "xx" & X"8";
      HAR              => 6X"18"  -- 2008 vhdl -- pre2008 - "xx" & X"8";
    );
    --* Example of usage
    --*     Case BYTE_RX(c_CTRL_INDEX.DATA_TYPE_slv'range) is 
    --*       when c_CTRL.CMD_FRM =>
     
    --* case byte_rx(c_CTRL_INDEX.DIRECTION)

    •   Alt7th April 2017, 18:13

      advertising

        
       

  2. #2
    Advanced Member level 5
    Points: 33,920, Level: 44
    Achievements:
    7 years registered

    Join Date
    Jun 2010
    Posts
    6,209
    Helped
    1816 / 1816
    Points
    33,920
    Level
    44

    Re: Enumeration of range type - vhdl

    A range isn't a scalar, so cannot be stored. Using 'range is the best way to do it



    •   Alt7th April 2017, 23:49

      advertising

        
       

  3. #3
    Full Member level 3
    Points: 1,362, Level: 8

    Join Date
    May 2014
    Posts
    154
    Helped
    17 / 17
    Points
    1,362
    Level
    8

    Re: Enumeration of range type - vhdl

    If these are the limitations then I accept trickyDicky's answer as solved.



--[[ ]]--