4
\$\begingroup\$

I want to move data from a "Bit_vector" to "Std_logic_Vector". For that, I want to convert Bit_Vector into Std_Logic_Vector. Please help me for the same.

\$\endgroup\$
4
  • \$\begingroup\$ Is Electrical Engineering the right place to ask simple type conversion questions, which could be answered by a beginners text book or e-book on VHDL? \$\endgroup\$
    – Paebbels
    Jan 20, 2015 at 7:33
  • \$\begingroup\$ I tried text book, then Google. then only I tried here. May be for you it will be simple. But for me its big. May be my IQ is below average. @Paebbels \$\endgroup\$ Jan 20, 2015 at 16:20
  • \$\begingroup\$ Every basic VHDL book should cover the topic of type conversions. Thats no question of programing skills or 'IQ'. \$\endgroup\$
    – Paebbels
    Jan 20, 2015 at 20:13
  • 1
    \$\begingroup\$ The Supplemental Material download contains the source for all the standard packages. In package std_logic_1164 you'll find the declaration function To_StdLogicVector (b : BIT_VECTOR) return STD_LOGIC_VECTOR;. Searching these package sources make a great authoritative alternative to a second hand answer when trying to learn how things work. Interogative google searches (how to convert bit_vector to std_logic_vector in vhdl) usually point you to an answer, likely where Sarrk found it in this case. \$\endgroup\$
    – user8352
    Jan 20, 2015 at 21:37

1 Answer 1

9
\$\begingroup\$

Try Srinivasan Venkataramanan's solution

Use IEEE.STD_LOGIC_1164 package's function To_StdLogicVector to do this:

FUNCTION To_StdLogicVector ( b : BIT_VECTOR ) RETURN std_logic_vector;

\$\endgroup\$
2
  • 1
    \$\begingroup\$ I tried its working... To make it simple S<=to_stdlogicvector(b); \$\endgroup\$ Jan 20, 2015 at 5:58
  • \$\begingroup\$ It's not so much Srini's solution as it is knowledge of the package std_logic_1164. See the Supplemental Material download for IEEE Std 1076-2008. The package sources can be searched and you can learn how things work in VHDL from them. \$\endgroup\$
    – user8352
    Jan 20, 2015 at 21:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.