Clear Filters
Clear Filters

Implementing Variable Delay Length in Simulink Model for HDL Code Generation

8 views (last 30 days)
Hello,
I am currently working with a Simulink model for generating HDL code in Matlab 2021b, and I've incorporated a "Delay" block in my design. By default, the "Delay length" is set via the "Dialog" option. However, I am interested in adjusting the delay dynamically during runtime using an "Input port" as the source for "Delay length."
Upon attempting this setup, I encountered an error in the HDL Workflow Advisor, stating: "The delay length for the Delay block must be specified via Dialog."
I am reaching out to inquire if there is a workaround or an alternative method to implement a variable "Delay length" within the "Delay" block that is compatible with HDL coder. Your insights and suggestions on this matter would be greatly appreciated.
Thank you in advance.

Answers (1)

Tom Richter
Tom Richter on 25 Oct 2023
Starting in R2022a, you can generate HDL code for the Variable Integer Delay block. You can now generate code for Delay block that has Delay length set through the Input port. You can set the delay length by specifying the constant value at the 'd' Input port of Delay block.
In R2023b you can now generate HDL code for the Variable Integer Delay block when you specify the data input port as a vector. You can generate HDL code for a Delay block when you set the Delay length parameter to Input port and specify the d input port as a vector.
You can use these data types for the Delay blocks with vector input:
  • Signed and unsigned integers
  • Fixed-point types
  • Floating-point types
  • Enumerated types
  • Complex types
The Variable Integer Delay block does not support bus and matrix inputs for HDL code generation.

Community Treasure Hunt

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

Start Hunting!