Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Enumeration of range type - vhdl

Status
Not open for further replies.

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)

 

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

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

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top