Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VHDL std_logic_vector conversion to signed and unsigned with numeric_std

I have some doubts about the use of the conversions from std_logic_vector to signed/unsigned. I always use the conversion signed(...), unsigned(...), but when I try to use the conversions defined in the library numeric_std (to_signed, to unsigned), it doesn't work. Can someone explain to me why this happens? And why the conversion unsigned() and signed() works?

like image 280
Gabriel Lozano Avatar asked Jan 14 '23 10:01

Gabriel Lozano


1 Answers

Because the std_logic_vector and signed/unsigned types are closely related, you can use the typecast way to convert. So signed(a_std_logic_vector) and unsigned(a_std_logic_vector) are okay. However, the functions to convert are also defined in the standard.

Take a look at the VHDL FAQ. This is an old website from the days that newsgroups were still hot, but it still has plenty of good information about VHDL.

like image 105
vermaete Avatar answered Apr 30 '23 15:04

vermaete