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

Reply

VHDL - 1-element arrays are invalid in VHLD?

 
Thread Tools Search this Thread
Old 06-18-2005, 03:10 PM   #1
Default 1-element arrays are invalid in VHLD?


This code is accepted

type TLETTERS is array (0 to 1) of CHARACTER;
constant LETTERS: TLETTERS := ('a', 'b');

however the following is not

type TLETTERS is array (0 to 0) of CHARACTER;
constant LETTERS: TLETTERS := ('a');

IMO, this is called inconsistency (bad design).

BTW, is there a more compact (single line) way to declare a constant array
avoiding the type declaration? I guess the long preparations creating
templates (which are types in this case) are necessary for instantiating
multiple objects using this template. But I have only one array, so what is
the need to declare a special type for it? In C, we can instantiate an array
of any elements avoiding developement of special array classes for each
basic element. Am I missing something?




valentin tihomirov
  Reply With Quote
Old 06-18-2005, 05:05 PM   #2
Mike Treseler
 
Posts: n/a
Default Re: 1-element arrays are invalid in VHLD?
valentin tihomirov wrote:
> This code is accepted
> type TLETTERS is array (0 to 1) of CHARACTER;
> constant LETTERS: TLETTERS := ('a', 'b');
> however the following is not
> type TLETTERS is array (0 to 0) of CHARACTER;
> constant LETTERS: TLETTERS := ('a');
> IMO, this is called inconsistency (bad design).


The type isn't the problem.
The problem is ambiguity of ('a')

If ('a') is an array then parenthesis
are disallowed around character literals.
You can't have it both ways.

IMO this is an example of
incompleteness for the sake of a
logically consistent language.
This is a limit on any formal system.

For your example, this would also work:
constant LETTER: TLETTERS := (0 =>'a');

-- Mike Treseler


Mike Treseler
  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
xslt parsing xml data with '<' invalid character h_q Software 0 01-03-2008 10:00 PM
The View State is invalid for this page and might be corrupted parwejp Software 0 11-06-2007 09:54 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