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

Reply

VHDL - why does std_logic_arith suck?

 
Thread Tools Search this Thread
Old 09-07-2005, 01:30 PM   #1
Default why does std_logic_arith suck?


What are some specific problems with the std_logic_arith library? From
what I am reading in these forums, it is better to use numeric_std, why
exactly is it better? Any general answers on this issue would be
great.

Also, what I have been doing is simple arithmetic on std_logic_vectors
(using std_logic_arith library). Sometimes it works and sometimes it
doesnt. I understand that it is better to used signed or unsigned
types for arithmetic operations and I am in the process of changing my
code to do that, I am just trying to understand some of what I have
seen. For example, for std_logic_vector signals A and B (using
std_logic_arith), the following code seems to work in one part of my
code, but the exact same code doesnt work if I put it in another part
of the code:

IF (A - B > 400) Then
blah blah blah

It seemed like if B was an input port (an actual entity input), it
behaves differently than if B is a signal. Also seemed different if I
put this line of code in a different process (i.e. everything wasn't
concurrent like it is supposed to be). I dunno, anyone seen any
wierdness like this?



Toby
  Reply With Quote
Old 09-07-2005, 03:02 PM   #2
Ralf Hildebrandt
 
Posts: n/a
Default Re: why does std_logic_arith suck?
Toby wrote:

> What are some specific problems with the std_logic_arith library?


> Also, what I have been doing is simple arithmetic on std_logic_vectors

....

This is one of the problems: How do you specify if these vectors are threatened as signed
or unsigned data? (AFAIK it is done implicitely in this lirbary.)

For some arithmetic operations it does not matter, but for a comparison it does.
constant a : std_ulogic_vector:=16#ff#;
constant b : std_ulogic_vector:=16#01#;
Is a = 255 or a = -1 respectively is b greather than a or not?


Ralf


Ralf Hildebrandt
  Reply With Quote
Old 09-07-2005, 03:04 PM   #3
Mike Treseler
 
Posts: n/a
Default Re: why does std_logic_arith suck?
Toby wrote:
> What are some specific problems with the std_logic_arith library?


http://groups.google.com/groups?q=vh...th+numeric_std

> It seemed like if B was an input port (an actual entity input), it
> behaves differently than if B is a signal.


An input port identifier must appear
only on the right side of an assignment operator.

A variable or signal identifier may appear
on the left, right or both.
Consider getting a vhdl simulator.

-- Mike Treseler


Mike Treseler
  Reply With Quote
Old 09-07-2005, 04:23 PM   #4
john Doef
 
Posts: n/a
Default Re: why does std_logic_arith suck?

Ralf Hildebrandt a écrit :
> For some arithmetic operations it does not matter, but for a comparison it does.
> constant a : std_ulogic_vector:=16#ff#;
> constant b : std_ulogic_vector:=16#01#;
> Is a = 255 or a = -1 respectively is b greather than a or not?

Please, please,
this is not correct vhdl.

JD.



john Doef
  Reply With Quote
Old 09-07-2005, 05:43 PM   #5
Mike Treseler
 
Posts: n/a
Default Re: why does std_logic_arith suck?
john Doef wrote:

> Ralf Hildebrandt a écrit :
>>For some arithmetic operations it does not matter, but for a comparison it does.
>>constant a : std_ulogic_vector:=16#ff#;
>>constant b : std_ulogic_vector:=16#01#;
>>Is a = 255 or a = -1 respectively is b greather than a or not?


> Please, please,
> this is not correct vhdl.
> JD.


Indeed a typo on the x"ff" and x"01"
but Ralf's point to the OP is a good one.
Using a plain std_logic_vector as an integer is ambiguous.

-- 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
A DVD player that doesn't suck? Is it possible? Jim DVD Video 49 02-07-2005 07:49 AM
kill bill 1/2, regio 2, dvd cases suck big time ! Snowman DVD Video 0 10-17-2004 10:47 AM
Re: I AM FINISHED WITH DVD PLANET!!!!!!!! THEY SUCK!!!!!!!!!!!!!! ANY COMMENTS?????? Gerry DVD Video 0 07-02-2003 12:25 PM
Re: I AM FINISHED WITH DVD PLANET!!!!!!!! THEY SUCK!!!!!!!!!!!!!! ANY COMMENTS?????? Me, The Bear, up a tree on Hampstead Heath DVD Video 0 07-02-2003 11:18 AM
Re: I AM FINISHED WITH DVD PLANET!!!!!!!! THEY SUCK!!!!!!!!!!!!!! ANY COMMENTS?????? George DVD Video 0 07-02-2003 04:18 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