Sep 27, 2006 #1 B 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
Sep 27, 2006 #2 A aji_vlsi Advanced Member level 2 Joined Sep 10, 2004 Messages 643 Helped 85 Reputation 170 Reaction score 12 Trophy points 1,298 Location Bangalore, India Activity points 4,944 Re: enumerated data type bansalr said: Is there any simple way to convert enumerated data type to std_log_vector in vhdl Click to expand... 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 bansalr said: Is there any simple way to convert enumerated data type to std_log_vector in vhdl Click to expand... 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
Sep 27, 2006 #3 B 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 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.
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.