I want to convert matlab code to hdl code to dump it in FPGA. to convert this there are two files required i.e matlab file (with m extension) and test bench file (with tb.m extension) . I have only MATlab code what to do for testbench?
2 views (last 30 days)
Show older comments
Kairunnisha Musthafa
on 13 Mar 2015
Commented: Shubham Kapoor
on 13 Apr 2015
MATlab software 2014a, windows 8.1 operating system. MAtlab code for transmit diversity technique for wireless communication
0 Comments
Accepted Answer
Tim McBrayer
on 13 Mar 2015
The simple answer is that you need to write a testbench.
How do you know that your MATLAB code is correct in implementing your algorithm? A testbench, written in MATLAB. It supplies inputs to your design and reads the design's outputs. It can perform whatever sort of checking you wish to ensure that your design file is operating correctly. It can plot output data, calculate the results using a different method, or whatever you can imagine to ensure that your code is correct. It is vastly faster to validate that your MATLAB code is correct using MATLAB, than it is to run through the full toolchain and see if the FPGA behaves as desired.
Unless you have provided explicit integer or fixed-point data types for every variable in your design, the testbench also helps define what the data types are. MATLAB code is typically written using double data types for variables, which is not generally synthesizable to an FPGA. HDL Coder can use the ranges of the data supplied by your testbench to the design to determine what data type to make each variable in the model. Thus, it is doubly important to write a good testbench, as the testbench will indirectly determine the size of your datapath throughout your design.
2 Comments
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!