How to improve VHDL

Why OSVVM?ForumsVHDLHow to improve VHDL

This topic has 3 voices, contains 3 replies, and was last updated by Avatar of Andy Jones Andy Jones 1159 days ago.

Viewing 4 posts - 1 through 4 (of 4 total)
Author Posts
Author Posts
March 28, 2012 at 20:27 #49
Avatar of Jerry Kaczynski
Jerry Kaczynski

Don’t like something in VHDL? Have new feature that you think should be added to VHDL?
Let us know: just reply to this post below or create new topic…

March 20, 2014 at 22:48 #772
Avatar of Amos Zaslavsky
Amos Zaslavsky

*Many people have been using for years the following three 

Packages in almost any code they write:

  

– classic package of Synopsys in old VHDL

library ieee ;

use ieee.std_logic_1164.all ;

use ieee.std_logic_unsigned.all ;

They make it possible to execute unsigned math operations on vectors

in a convenient way with out all the clumsy casting operations

or conversions needed when you use other vector-math packages.

In VHDL-200 finally the previous 3 packages have been replaced with 

the new standard packages, and the last package is more powerful 

(for example enable division operations and more…).

– same trio declarations with new package of IEEE in VHDL-2008

library ieee ;

use ieee.std_logic_1164.all ;

use ieee.numeric_std_unsigned.all ; — a new package !

This is very nice, but I can not find a replacement for the 

Following useful trio: 

– the signed trio

library ieee ;

use ieee.std_logic_1164.all ;

use ieee.std_logic_signed.all ;

Which enable signed math (for example when you want to

make a compare operation and may other applications).

March 20, 2014 at 22:56 #773
Avatar of Amos Zaslavsky
Amos Zaslavsky

Another request or wish would be to make this coding possible

y <= a or b and c ; 

– with the and operation done preceding the or operation and with no need for the flowing clumsy style y <= a or (b and c) ;

This is actually the case when you write math operations

m <= p + q * r ;

March 27, 2014 at 18:29 #783
Avatar of Andy Jones
Andy Jones

Amos,

1st issue: I have seen very few designs that use a signed numeric interpretation of every std_logic_vector in the design. Most designs that use signed interpretation also use unsigned interpretations, which would not be possible if such a package were used. If you need signed interpretations, it is best to use either integer subtypes or explicit signed data types to clearly define where signed interpretations and arithmetic are desired.

2nd issue: Unlike the mathematical operators that have a widely accepted operator precedence, boolean operators do not. Therefore explicitly defining the desired precedence of boolean operators using parentheses provides an unambiguous description of the desired result. When you wrote “a or b and c” I had no idea whether you meant “(a or b) and c” or “a or (b and c)”. 

Think less about how little you can type, and more about how clearly you can express the desired behavior. Those who will have to review, reuse or maintain your design will thank you for it.

Andy

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.