Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - Defined ranges

 
Thread Tools Search this Thread
Old 06-05-2008, 05:30 AM   #1
Default Defined ranges


I am using a subtype to define a range as used in a SLV declaration.

subtype INST_RNG is natural range 23 downto 0;
signal CTPCurCmd : std_logic_vector (INST_RNG);

But if I try to use the same subtype to define a sub-range in an
assignment, I get this error message.

# Error: COMP96_0263: IRIG_FPGA_TB.vhd : (504, 6: Type names are not
allowed as primaries.


Is this just a limitation of the tool I am using or is this a language
issue? Is there a better way to define ranges so the parts of an
array can be dealt with symbolically?

Rick


rickman
  Reply With Quote
Old 06-05-2008, 12:15 PM   #2
kennheinrich@sympatico.ca
 
Posts: n/a
Default Re: Defined ranges
On Jun 5, 12:30 am, rickman <gnu...@gmail.com> wrote:
> I am using a subtype to define a range as used in a SLV declaration.
>
> subtype INST_RNG is natural range 23 downto 0;
> signal CTPCurCmd : std_logic_vector (INST_RNG);
>
> But if I try to use the same subtype to define a sub-range in an
> assignment, I get this error message.
>
> # Error: COMP96_0263: IRIG_FPGA_TB.vhd : (504, 6: Type names are not
> allowed as primaries.
>
> Is this just a limitation of the tool I am using or is this a language
> issue? Is there a better way to define ranges so the parts of an
> array can be dealt with symbolically?
>
> Rick


Without an example of what you mean by "define a sub-range in an
assignment", I'm working in the dark. However, on first blush, this
sounds like a tool error: using a type mark as a discrete range in a
slice name (which I what I'm guessing you want), is allowed. In
particular, the LRM grammar says

slice_name uses a discrete_range
discerete_range can be a discrete_subtype_indication
a subtype_indication can be a type_mark, which is a simple identifier
denoting a type or subtype.

The message implies that the compiler isn't looking for the discrete
range interpretation, it's only trying to parse as an expression,
which has "primary" as one of the underlying constituents.

The Modelsim 6.0a compiler accepts the following without error: (note
that I made up an assignment)

library IEEE;
use IEEE.std_logic_1164.all;

entity test is
end test;

architecture test of test is
subtype INST_REG is natural range 0 to 23;
signal CTPCurCmd : std_logic_vector(INST_REG);
signal foo : std_logic_vector(INST_REG);
begin -- test
foo(INST_REG) <= CTPCurCmd(INST_REG);
end test;


Hope this helps,

- Kenn


kennheinrich@sympatico.ca
  Reply With Quote
Old 06-05-2008, 01:51 PM   #3
rickman
 
Posts: n/a
Default Re: Defined ranges
On Jun 5, 7:15 am, kennheinr...@sympatico.ca wrote:
> On Jun 5, 12:30 am, rickman <gnu...@gmail.com> wrote:
>
>
>
> > I am using a subtype to define a range as used in a SLV declaration.

>
> > subtype INST_RNG is natural range 23 downto 0;
> > signal CTPCurCmd : std_logic_vector (INST_RNG);

>
> > But if I try to use the same subtype to define a sub-range in an
> > assignment, I get this error message.

>
> > # Error: COMP96_0263: IRIG_FPGA_TB.vhd : (504, 6: Type names are not
> > allowed as primaries.

>
> > Is this just a limitation of the tool I am using or is this a language
> > issue? Is there a better way to define ranges so the parts of an
> > array can be dealt with symbolically?

>
> > Rick

>
> Without an example of what you mean by "define a sub-range in an
> assignment", I'm working in the dark. However, on first blush, this
> sounds like a tool error: using a type mark as a discrete range in a
> slice name (which I what I'm guessing you want), is allowed. In
> particular, the LRM grammar says
>
> slice_name uses a discrete_range
> discerete_range can be a discrete_subtype_indication
> a subtype_indication can be a type_mark, which is a simple identifier
> denoting a type or subtype.
>
> The message implies that the compiler isn't looking for the discrete
> range interpretation, it's only trying to parse as an expression,
> which has "primary" as one of the underlying constituents.
>
> The Modelsim 6.0a compiler accepts the following without error: (note
> that I made up an assignment)
>
> library IEEE;
> use IEEE.std_logic_1164.all;
>
> entity test is
> end test;
>
> architecture test of test is
> subtype INST_REG is natural range 0 to 23;
> signal CTPCurCmd : std_logic_vector(INST_REG);
> signal foo : std_logic_vector(INST_REG);
> begin -- test
> foo(INST_REG) <= CTPCurCmd(INST_REG);
> end test;
>
> Hope this helps,
>
> - Kenn


Opps... The error was staring me in the face and I didn't see it. I
got too wrapped up in the literal of the message and didn't really
understand it. The signal name I was using was of the type, not the
signal! Duh!

I guess I need to knock off work earlier... before my vision gets
blurry... :^)

Rick


rickman
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
creating user defined service in windows suresh_rtp Software 0 05-05-2009 08:34 AM
DHCP multiple ip ranges Maarten MCTS 4 05-27-2008 11:10 PM
scsi advice please? mikeplace Hardware 1 09-11-2006 11:15 AM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

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 42 43 44 45 46