主要内容

coder.hdl.literaltext

Define pragma using literal text

Since R2024b

Description

coder.hdl.literaltext(literalText) defines a pragma statement in your MATLAB® code, which appears at the same location in the generated HLS code.

This pragma does not affect MATLAB simulation behavior.

example

Examples

collapse all

In the MATLAB® function myFun, declare a pragma statement with literal text by using coder.hdl.literaltext. This pragma statement appears at the same location in the generated HLS code.

function out = myFun(in)
   out = zeros(10,10);
   a = in;
   b = in*8;
   for i = 1:10 
      for j = 1:10
         coder.hdl.literaltext("#pragma HLS loop_flatten");
         out(i,j) = a(i,j) + b(i,j);
      end
   end
end

Generate HLS code from the MATLAB® Command Window.

cfg = coder.config("hdl");
cfg.Workflow = "High Level Synthesis";
cfg.SynthesisTool = "Xilinx Vitis HLS";
codegen -config cfg myFun -args {zeros(10)} -report
### Begin MATLAB to HLS Code Generation...
### Working on DUT: myFun.
### Begin HLS Code Generation
### Generating Resource Utilization Report resource_report.html.
### Working on myFunClass.hpp as myFunClass.hpp.
### Working on myFun_wrapper.cpp as myFun_wrapper.cpp.
### Generating HLS Conformance Report myFun_hdl_conformance_report.html.
### HLS Conformance check complete with 0 errors, 0 warnings, and 0 messages.
### To rerun codegen evaluate the following commands...

---------------------
cgi    = load('C:\ExampleManager\user.Bdoc.8_10\hdlcoder-ex58282915\codegen\myFun\hdlsrc\codegen_info.mat');
inVals = cgi.CodeGenInfo.inVals;
cfg    = cgi.CodeGenInfo.codegenSettings;
codegen -config cfg -args inVals -report
---------------------

### Code generation successful: View report

Input Arguments

collapse all

Pragma statement specified as a string literal. This argument must be a valid pragma statement.

Example: "#pragma HLS loop_flatten"

Version History

Introduced in R2024b