Continue to Site

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.

VHDL compilation error "Identifier "unsigned" is not directly visible"

Status
Not open for further replies.

engr_joni_ee

Advanced Member level 3
Joined
Nov 3, 2018
Messages
740
Helped
2
Reputation
4
Reaction score
4
Trophy points
18
Activity points
6,151
VHDL compilation error "Identifier "unsigned" is not directly visible"

Hi,

I get an error (Identifier "unsigned" is not directly visible) while converting std_logic_vector to integer.

The signal and variable definition.

Code:
signal s_temp : std_logic_vector (7 downto 0); 
variable i_temp : integer;

The libraries

Code:
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;

Conversion
Code:
i_temp := to_integer(unsigned(s_temp));
 

Re: VHDL compilation error "Identifier "unsigned" is not directly visible"

std_logic_arith and numeric_std both define an unsigned type. So the compiler doesnt know which to use and hence uses neither (and you get the error).
The simple answer is to delete std_logic_arith as it is a non-standard VHDL library (std_logic_unsigned is also non-standard). std_logic_arith really should be a dead package.

the long answer is to be explicit about which one you mean:

Code:
i_temp := to_integer(ieee.numeric_std.unsigned(s_temp));

but who wants to do all that extra typing! Just delete std_logic_arith and forget the package ever existed.
Anyone using std_logic_arith is 25 years behind the times (numeric_std was released in 1993!)
std_logic_unsigned does have uses (although non-standard) but can be replaced by using numeric_std_unsigned (released 10 years ago!)
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top