Apr 7, 2017 #1 W wtr Full Member level 5 Joined May 1, 2014 Messages 299 Helped 29 Reputation 58 Reaction score 25 Trophy points 1,308 Activity points 4,108 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)
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)
Apr 7, 2017 #2 T TrickyDicky Advanced Member level 7 Joined Jun 7, 2010 Messages 7,110 Helped 2,081 Reputation 4,181 Reaction score 2,048 Trophy points 1,393 Activity points 39,769 A range isn't a scalar, so cannot be stored. Using 'range is the best way to do it
Apr 20, 2017 #3 W wtr Full Member level 5 Joined May 1, 2014 Messages 299 Helped 29 Reputation 58 Reaction score 25 Trophy points 1,308 Activity points 4,108 If these are the limitations then I accept trickyDicky's answer as solved.