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.

How to convert enumerated data type to std_log_vector in VHDL?

Status
Not open for further replies.

bansalr

Full Member level 3
Joined
Dec 22, 2005
Messages
152
Helped
20
Reputation
40
Reaction score
5
Trophy points
1,298
Activity points
2,165
Is there any simple way to convert enumerated data type to std_log_vector in vhdl
 

Re: enumerated data type

bansalr said:
Is there any simple way to convert enumerated data type to std_log_vector in vhdl

Yes, VHDL has POS attribute that returns an integer value of enum.

Code:
   my_int <= my_enum_type'pos(my_enum);

If you need direct SLV, then

Code:
  my_slv <= std_logic_vector(to_unsigned(my_enum_type'pos(my_enum), 8);

HTH
Ajeetha, CVC
www.noveldv.com
 

Re: enumerated data type

type state is (a,b,c,d,e,f);
signal cur_state :state;

I want to convert the state to std_logic_vector.
POS will return the individual position of the type.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top