Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

Conversion for different packages

Status
Not open for further replies.

Binome

Full Member level 3
Joined
Nov 16, 2009
Messages
152
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,298
Location
Lyon, France
Activity points
2,405
Hi,
I'm using : R<= unsigned(ext(A, N)) + unsigned(ext(B,N));
with ieee.std_logic_arith library.A, B, and R are std_logic_vector.
Now I know it's not a recommended library I want to use numeric_std. ext() is not known so I have to use another function. I'm trying to use to_unsigned like that:
R<= std_logic_vector(to_unsigned(unsigned(A), N) + to_unsigned(unsigned(B),N));
But Modelsim can't compile, the error is "No feasible entries for subprogram "TO_UNSIGNED"."
Can someone tell me why?
 

lucbra

Advanced Member level 2
Joined
Oct 30, 2003
Messages
514
Helped
73
Reputation
146
Reaction score
63
Trophy points
1,308
Location
Belgium
Activity points
3,251
I assume you have declared to use the library numeric_std?

use ieee.numeric_std.all;
 

TrickyDicky

Advanced Member level 5
Joined
Jun 7, 2010
Messages
7,046
Helped
2,070
Reputation
4,157
Reaction score
2,023
Trophy points
1,393
Activity points
38,834
converting A and B to unsigned is fine, but there is no to_unsigned function for an unsigned type, thats only for integers. You're after the resize function:

R < std_logic_vector(resize(unsigned(A), N) + resize(unsigned(B), N));
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top