HDL Coder: Block RAM utilization for MATLAB Function block

8 visualizaciones (últimos 30 días)
Fabig
Fabig el 3 de Abr. de 2017
Editada: Stefanie Schwarz el 21 de Mayo de 2024
Hello,
I am having trouble generating Block RAM from Simulink.
I followed this Block Ram Sobel example to create my own Block Ram using Matlab. This works fine using Matlab and the HDL Coder. I can see in the resource report that 2048x14-bit RAM : 1 has been selected as desired.
Now I included the same Matlab code (converted to fixed point) as a Matlab function block into a Simulink model. Using the HDL workflow advisor I can generate VHDL code. But in the resource report I can see that no RAM was used but instead 22425 1-Bit-Registers (1600 * 14 Bit):
In the example project they make sure to turn on "Map persistent array variables to RAM" in the Optimizations section of the Code generation. The closest I found in the HDL Workflow Advisor for Simulink was the "Map pipeline delays to RAM". Like shown here:
Why do I get Registers instead of Block RAM? There is obviously also no dual port RAM file that was created in the VHDL file directory. I added the matlab scripts to this post and this is how my Simulink model looks like (the HDL part only includes the simpleBlockRam_fixpt.m matlab function).
I am grateful for any hints. I also tried looking online first but without any luck. In case I missed something I am also happy about how somebody else solved this kind of problem.
Thanks!
  2 comentarios
Kiran Kintali
Kiran Kintali el 3 de Abr. de 2017
With the MapPersistentVarsToRAM implementation parameter, you can use RAM-based mapping for persistent arrays of a MATLAB Function block instead of mapping to registers.
Please make sure this option is turned-on on the MATLAB function block.
Fabig
Fabig el 3 de Abr. de 2017
Thank you. That was it. I was first not able to find this configuration menu! With that configuration it works and I also get the desired Block RAM. Thanks!

Iniciar sesión para comentar.

Respuesta aceptada

Fabig
Fabig el 3 de Abr. de 2017
In case anybody else reads this the solution was quite simple and is as follows: As Kiran Kintali posted it is important to set the MapPersistentVarsToRAM to ON.
Right Click on the model -> HDL-Code -> HDL-Block Properties
The Resource Report then showed for me: 2048x14-bit RAM : 1
Thanks for the help!

Más respuestas (0)

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by