Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Electronic Equipment > VHDL > Re: Signed, Uns...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 22 of 49 Topic 6057 of 6417
Post > Topic >>

Re: Signed, Unsigned syntax issues. Please help, I'm stumped

by "KJ" <kkjennings@[EMAIL PROTECTED] > Jun 12, 2008 at 09:41 PM

"Jim Lewis" <jim@[EMAIL PROTECTED]
> wrote in message 
news:fOidnaO0J_eR88zVnZ2dnUVZ_tninZ2d@[EMAIL PROTECTED]
> rickman
>> Here is an example.
>>
>> CTPBitCnt is an unsigned.
>>
>> What I mean...
>>   CTPBitCnt <= 1;
>>
>> What I have to write...
>>   CTPBitCnt <= to_unsigned(1, CTPBitCnt'length);
>>

>
> Jonathan just submitted a language feature request WRT to overloading
> assignment, however, the standard is already at the balloting point so
> it will not make the 2008 revision.
>
> What has been added is a decimal notation for bit string literals
> and a sizing indication.
>
> signal CTPBitCnt : unsigned (14 downto 0) ; -- 15 bits
> . . .
> -- Representing 1 as a 15 bit object in either hex or decimal
>
> CTPBitCnt <= 15D"1" ;   -- Decimal notation
> CTPBitCnt <= 15X"1" ;   -- Hex notation
>

The type of syntax only a mother could love.  Let's compare the approaches
A: CTPBitCnt <= 1;
B: CTPBitCnt <= to_unsigned(1, CTPBitCnt'length);
C: CTPBitCnt <= to_unsigned(1);
D: set(CTPBitCnt, "<=", 1)
E: CTPBitCnt <= CTPBitCnt'lengthD"1" ;  or CTPBitCnt <=
CTPBitCnt'lengthX"1" 
??
F: CTPBitCnt <= 8D"1" ;  or CTPBitCnt <= 8X"1"

'A' is illegal, but represents what is intended.  Violates strong type 
checking which is a 'good' thing about VHDL (in my opinion).

'B' has been valid since VHDL'93 but is overly wordy and prone to error if

you inadvertnatly take the 'length of something other than the left side
of 
the statement.  Has an issue that you would need separately names
procedures 
if the thing being assigned to is a signal or a variable.  Jim, is there 
anything on the table about being able to overload procedures when 
parameters differ by class so that a single name could be used?  If not, 
maybe I'll submit it for consideration.

'C' is illegal, but represents what is intended and conforms nicely with
the 
strong type checking of VHDL.  Requires acceptance of overloading of the 
"<=" and ":=" operators as Jonathon has proposed.

'D' is valid VHDL where 'set' is a procedure that implements the syntax of

'B'.  No chance for the possible user error mentioned above for 'B'.  The 
second parameter "<=" is not used in the procedure it is there simply to
aid 
the user of the procedure.

'E' may be valid VHDL'2008 (not sure if the bit width specification needs
to 
be a hard coded can be replaced with something that will be maintainable
if 
'CTPBitCnt' is subject to size changes ....ummm, kind of at a loss to say 
anything that I like about that syntax.
'F' is valid VHDL'2008 but again can't say what there may be to like about

it from the perspective of someone looking at the code or writing it.

If I were to rank them by personal preference the ordering would be
1.  C (clear and consise)
2.  D (kinda kludgy but does the trick)
3.  B (it's legal after all)
4. A (I'd almost rather have less strong type checking then 'E' or 'F').
5. E or F....the designer's intent has been completely lost.....to me

> BTW, these are also in Accellera standard VHDL-2006-rev3.0, so
> if your vendors were looking out for your interests, they would
> have already should implemented these.
>
> Make sure to submit these as bug/enhancement requests.  This is
im****tant
> as this is what lets them know the VHDL community wants the new
features.
>

I'll wait for one I like to see first.

Kevin Jennings
 




 49 Posts in Topic:
Signed, Unsigned syntax issues. Please help, I'm stumped
nitrogenocide@[EMAIL PROT  2008-05-31 11:58:04 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
Mike Treseler <mtresel  2008-05-31 12:41:27 
Re: Signed, Unsigned syntax issues. --typo
Mike Treseler <mtresel  2008-05-31 12:43:10 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
"KJ" <kkjenn  2008-05-31 15:41:06 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
Jonathan Bromley <jona  2008-05-31 20:43:17 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
"KJ" <kkjenn  2008-05-31 19:53:08 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
Andy Peters <google@[E  2008-06-02 15:04:56 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
rickman <gnuarm@[EMAIL  2008-06-09 11:06:36 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
Mike Treseler <mike_tr  2008-06-09 11:28:44 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
Andy <jonesandy@[EMAIL  2008-06-09 12:42:54 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
rickman <gnuarm@[EMAIL  2008-06-09 16:55:47 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
Jim Lewis <jim@[EMAIL   2008-06-09 17:14:34 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
Mike Treseler <mike_tr  2008-06-09 17:26:13 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
Andy <jonesandy@[EMAIL  2008-06-10 14:59:39 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
rickman <gnuarm@[EMAIL  2008-06-11 08:52:56 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
Mike Treseler <mike_tr  2008-06-11 11:14:07 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
Brian Drummond <brian_  2008-06-12 14:02:55 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
Brian Drummond <brian_  2008-06-16 11:43:24 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
Jonathan Bromley <jona  2008-06-16 12:45:30 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
Brian Drummond <brian_  2008-06-17 12:18:49 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
Jim Lewis <jim@[EMAIL   2008-06-12 11:42:18 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
"KJ" <kkjenn  2008-06-12 21:41:42 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
Jim Lewis <jim@[EMAIL   2008-06-15 10:38:11 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
"KJ" <kkjenn  2008-06-15 20:25:41 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
Jim Lewis <jim@[EMAIL   2008-06-16 09:22:19 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
KJ <kkjennings@[EMAIL   2008-06-16 07:35:46 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
KJ <kkjennings@[EMAIL   2008-06-11 09:17:20 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
KJ <kkjennings@[EMAIL   2008-06-11 11:41:59 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
rickman <gnuarm@[EMAIL  2008-06-12 00:11:48 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
Mike Treseler <mike_tr  2008-06-12 09:51:58 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
KJ <kkjennings@[EMAIL   2008-06-12 04:58:01 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
rickman <gnuarm@[EMAIL  2008-06-12 21:02:00 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
Mike Treseler <mike_tr  2008-06-13 10:31:24 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
rickman <gnuarm@[EMAIL  2008-06-12 21:10:12 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
KJ <kkjennings@[EMAIL   2008-06-13 05:24:59 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
Jim Lewis <jim@[EMAIL   2008-06-15 10:06:35 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
rickman <gnuarm@[EMAIL  2008-06-13 17:05:12 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
rickman <gnuarm@[EMAIL  2008-06-13 17:25:08 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
"KJ" <kkjenn  2008-06-13 22:35:18 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
rickman <gnuarm@[EMAIL  2008-06-13 20:58:54 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
"MikeWhy" <b  2008-06-14 02:30:44 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
Jonathan Bromley <jona  2008-06-14 11:27:40 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
Jim Lewis <jim@[EMAIL   2008-06-15 10:32:43 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
Jonathan Bromley <jona  2008-06-15 21:25:43 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
"KJ" <kkjenn  2008-06-15 20:43:25 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
"KJ" <kkjenn  2008-06-14 12:52:42 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
"KJ" <kkjenn  2008-06-14 12:47:00 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
Andy <jonesandy@[EMAIL  2008-06-16 06:08:33 
Re: Signed, Unsigned syntax issues. Please help, I'm stumped
KJ <kkjennings@[EMAIL   2008-06-16 07:16:43 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Dec 1 8:20:05 CST 2008.