Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

using use ieee.std_logic_signed.all; and numeric ??

Status
Not open for further replies.

Bustigo

Member level 2
Joined
May 7, 2011
Messages
53
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,588
which better when usign (+) addition in a code
 

TrickyDicky

Advanced Member level 5
Joined
Jun 7, 2010
Messages
7,096
Helped
2,079
Reputation
4,177
Reaction score
2,037
Trophy points
1,393
Activity points
39,461
you cannot do unsigned+ with std_logic_signed.
they are different.

std_logic_signed works on std_logic_vectors. It is NOT part of the VHDL standard. You cannot do unsigned arithmatic in the same file.
numeric_std works on signed and unsigned types. It is part of the VHDL standard. It makes for clearer code and you can do signed and unsigned in the same file.

So numeric_std always. Forget about using std_logic_signed ever again.
 

permute

Advanced Member level 3
Joined
Jul 16, 2010
Messages
923
Helped
295
Reputation
590
Reaction score
268
Trophy points
1,343
Activity points
8,543
You can just import numeric_std and std_logic_signed. Or better, just import "+" and "-" from std_logic_signed. (ieee.std_logic_signed."+")

std_logic_signed might not be part of the original VHDL standard, but it doesn't mean you can't use it. It is supported by xilinx, altera, mg, synopsys, etc... You have to really try to find a commercial tool that doesn't support it.

by just picking a few functions from the std_logic_arith/signed/unsigned you can end up with something that works with numeric_std and without having to re-write your own extensions to VHDL.

The only real issue is that std_logic_signed also allows "*", "<", and ">", which are different than the unsigned versions. Verilog users would expect these to treat everything as unsigned unless specified. By importing only "+" and "-" you end up with code that allows you to add/sub using std_logic_vectors in the common cases. For anything else, you would need to specify signed/unsigned. And the meaning shouldn't be unclear to anyone reading the code.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top