![]() |
|
|
|||||||
![]() |
VHDL - Data conversion: complex, real, std_logic_vector... |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
Hello, I´m new in this forum and first of all hello and thanks other
members. I have to implement a VHDL program which uses complex numbers and I use math_complex library which have a function called cmplx whitch can convert a real number in a complex one. The problem is that I need to use an std_logic_vector input, and I can´t convert this input in real. Can anyone help me? Thanks for all! eneko |
|
|
|
|
#2 |
|
Posts: n/a
|
You can cast integer to real something like:
real_v := real(to_integer(unsigned(std_c))); See the details below. -- Mike Treseler --__________________________________ library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; use ieee.math_real.all; entity std2real is end std2real; architecture sim of std2real is begin -- Tue Oct 19 10:11:39 2004 Mike Treseler what : process is constant std_c : std_logic_vector := x"81"; variable real_v : real; begin real_v := real(to_integer(unsigned(std_c))); assert real_v = real(16#81#) report "conversion error"; wait; end process what; end sim; mike_treseler |
|
|
|
#3 |
|
Posts: n/a
|
Thanks a lot mike, I`m very pleased.
eneko |
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Wonderful data input with web reporting tool | freezea | Software | 0 | 09-09-2009 05:30 AM |
| Address Bus and External Data Bus Confusion | LoXodonte | A+ Certification | 1 | 04-18-2006 10:09 PM |
| New Releases: Troy, Ultimate Matrix & status changes: Updated complete downloadable R1 DVD DB & info lists | Doug MacLean | DVD Video | 1 | 08-31-2004 01:02 PM |
| Re: Backing up data to reinstall or replace a Operating system? | Barry Watzman | A+ Certification | 0 | 08-21-2003 06:59 PM |
| Re: 7. The truth about our creator. .7 | john smith | DVD Video | 2 | 07-25-2003 03:54 AM |