Compiling fixedpt converted code into VHDL

3 次查看(过去 30 天)
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:
addpath('./codegen/spectrometer/fixpt')
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?

回答(1 个)

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