Clear Filters
Clear Filters

Can't generate Simulink model from Simulink function block

1 view (last 30 days)
I was using HDL code generation , for making a generated model for my Simulink model containing a Matlab function block, but in the generated model , there is the same function block , is there a way it can be converted to a Simulink block version?.

Accepted Answer

Shubh Pareek
Shubh Pareek on 29 Jun 2023
From what I understood you can't see the Simulink version of your Function Block ,
Try this method ,right click on your function block and on HDL Code properties set architechture as MATLAB datapath and then try to make the generated model .
I hope this helps with your query .
  2 Comments
Kiran Kintali
Kiran Kintali on 29 Jun 2023
Select HDL Block Properties on MATLAB Function Block and choose MATLAB Datapath architecture. If the MATLAB code is data path compliant it can be expanded to Simulink blocks in the generated model. During code generation the the contents of the MATLAB Code are optimized with the rest of the Simulink blocks. For example you do resource sharing of multipliers within MATLAB Block with Multiply blocks in Simulink.

Sign in to comment.

More Answers (1)

Kiran Kintali
Kiran Kintali on 29 Jun 2023
You can convert a subset of MATLAB code into Simulink blocks in the generated model when in DataPath optimization mode.
Why Use MATLAB Datapath Architecture?
HDL code generation for a MATLAB Function block supports two HDL architectures: MATLAB Function and MATLAB Datapath. Specify the HDL Architecture in the HDL Block Properties dialog box of the MATLAB Function block.
Use the MATLAB Datapath architecture to:
  • Model complex fixed-point and floating-point MATLAB algorithms inside MATLAB Function blocks and interface this algorithm with other Simulink blocks in your model.
  • Improve area and timing of your design significantly by optimizing the algorithm inside the MATLAB Function block and across the MATLAB Function block boundary with other Simulink blocks in your model.
The MATLAB Datapath architecture is the default setting for MATLAB Function blocks with floating-point types. By enabling this architecture for fixed-point operations, you can use various optimizations that include:
  • Hierarchy flattening
  • Resource sharing and streaming
  • Clock-rate pipelining
  • Adaptive pipelining
  • Distributed pipelining
  • Critical path estimation

Categories

Find more on Simulink Functions in Help Center and File Exchange

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!