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 do data translation between Matlab and xilinx ISE simulator

Status
Not open for further replies.

Anuja Diggikar

Junior Member level 1
Junior Member level 1
Joined
Oct 21, 2010
Messages
15
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,395
Hello all,
I want to read .wav file from matlab into ISE simulator.My problem is matlab works with floating point and ISE with fixed point . to do data translation between Matlab and xilinx ISE simulator, I have written testbench for reading file (.txt) which contains matlab data and result of simulation i stored in again second text file that i read in matlab for analysis of result . pl. tell me how to convert floating point(double)values of .wav file into fixed point(binary string) so as to store it in text file and again how to convert fixed point(binary string) into floating point(double)values for matlab analysis. I need solution very argently.
thank u. in advance.
anuja
 

It's slow, but you can use the Matlab floating point toolbox. Created a fixed point container and specify the bit-width and fraction length

a = fi(<float_value>, 1, <bit_width>, <fraction_length>);

The 1 denotes a signed fixed-point number.

"a" now contains your floating point number as a fixed-point. Of course, depending on your bit_width and fraction_length, you may lose some resolution. Now use "a.bin" which returns the binary string of the fixed-point container.

At that point, just write "a.bin" out to your file.

Converting from binary to float is a little more complicated. If someone has a more direct method, please let me know.

a = mvl2dec(<binary_string>);

mvl2dec converts a multi-valued logic string to a decimal value. "a" now contains a decimal representation of your number. Now since it is in fixed-point representation, divide a by 2^<fraction_length>. This will return your float. So you could do it in one shot with

a = mvl2dec(<binary_string>) / 2^<fraction_length>;
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top