Velocity Reviews > VHDL > Integer Literals

# Integer Literals

Tricky
Guest
Posts: n/a

 03-28-2008
Is there a way of expressing integer literals in anything other than
decimal, without doing overly complicated type conversions?

KJ
Guest
Posts: n/a

 03-28-2008
On Mar 28, 11:42*am, Tricky <(E-Mail Removed)> wrote:
> Is there a way of expressing integer literals in anything other than
> decimal, without doing overly complicated type conversions?

Here are a few ways to express the number 16

16#10#
2#10000#

The number before the first # is the radix that you're using, the
numbers between the two ## is the number you're trying to represent.

KJ

Andy
Guest
Posts: n/a

 03-31-2008
On Mar 28, 11:02 am, KJ <(E-Mail Removed)> wrote:
> On Mar 28, 11:42 am, Tricky <(E-Mail Removed)> wrote:
>
> > Is there a way of expressing integer literals in anything other than
> > decimal, without doing overly complicated type conversions?

>
> Here are a few ways to express the number 16
>
> 16#10#
> 2#10000#
>
> The number before the first # is the radix that you're using, the
> numbers between the two ## is the number you're trying to represent.
>
> KJ

KJ is correct. I might add that the radix is always expressed in
decimal. It would be rather confusing (but simple to write!) to have
the radix expressed in the same base as the number (always "10")

Andy

Andy

Mark McDougall
Guest
Posts: n/a

 03-31-2008
Andy wrote:

> It would be rather confusing (but simple to write!) to have
> the radix expressed in the same base as the number (always "10")

Not to mention impossible to implement... think about it...

Regards,

--
Mark McDougall, Engineer
Virtual Logic Pty Ltd, <http://www.vl.com.au>
21-25 King St, Rockdale, 2216
Ph: +612-9599-3255 Fax: +612-9599-3266

Andy
Guest
Posts: n/a

 04-07-2008
On Mar 31, 6:37 pm, Mark McDougall <(E-Mail Removed)> wrote:
> Andy wrote:
> > It would be rather confusing (but simple to write!) to have
> > the radix expressed in the same base as the number (always "10")

>
> Not to mention impossible to implement... think about it...
>
> Regards,
>
> --
> Mark McDougall, Engineer
> Virtual Logic Pty Ltd, <http://www.vl.com.au>
> 21-25 King St, Rockdale, 2216
> Ph: +612-9599-3255 Fax: +612-9599-3266

That's what I meant by '(always "10")'

Not all things simple to write are easy (or even possible) to
implement.

Andy

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are Off Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Ivan Novick C++ 15 12-10-2006 09:24 PM bradeck@gmail.com C++ 5 10-19-2006 02:31 PM John Goche Java 8 01-17-2006 11:12 PM Bart Samwel C++ 14 04-22-2005 10:03 PM Purush Java 4 04-13-2005 08:40 PM