Compiling fixedpt converted code into VHDL

조회 수: 7(최근 30일)
Anze Slosar
Anze Slosar 2023년 2월 22일
댓글: Anze Slosar 2023년 2월 22일
We have a matlab code that we compile into VHDL. We have a make file that did this programmatically using something like
codegen -float2fixed fixptcfg -config hdlcfg -args {...} function_name
Since we need more control over fixedpt conversion, we now first run the script made by
fixedPointConverter -tocode spectrometer -script fixpt_conversion
and then we directly compile the generated code with something like:
codegen -config hdlcfg -args {int16(0),int16(0)} spectrometer_fixpt
I have three questions:
  1. Is this the right way to do it?
  2. How does it deal with test_bench? The supplied test_bench of course calls spectrometer, not spectrometer_fixpt. Would it automatically adapt it? Or do I need to manually create a version of test bench that calls spectrometer_fixpt?
  3. How can I compile a subroutine inside spectrometer_fixpt? spectrometer calls function, I want to compile them individually, without having to rerun fixpt converson manually for each of them. Is that possible?


Kiran Kintali
Kiran Kintali 2023년 2월 22일
Generate HDL Code from MATLAB Code Using the Command Line Interface
This example shows how to use the HDL Coder™ command line interface to generate HDL code from MATLAB® code, including floating-point to fixed-point conversion and FPGA programming file generation.
  댓글 수: 1
Anze Slosar
Anze Slosar 2023년 2월 22일
Following that example is how we did it earlier. But that seemed to have very little options to finetune fixed point conversion.
But now I see that configuation options for
fiaccel -float2fixed
are exactly the same object as for codegen, so I can just use addTypeSpecification to set some fixed points manually. Which is what I was kinda looking for, thanks.

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by