edit SideBar

Main / Matlab

MATLAB allows writing two kinds of program files −

Scripts − script files are program files with .m extension. In these files, you write series of commands, which you want to execute together. Scripts do not accept inputs and do not return any outputs. They operate on data in the workspace.

Functions − functions files are also program files with .m extension. Functions can accept inputs and return outputs. Internal variables are local to the function.

HDL Coder

MATLAB functions, Simulink models, and Stateflow charts can be used to generate synthesizable VHDL/Verilog. Simulink has a built-in sense of time and provides an environment to allow description of how the algorithm will work on a stream of data. It has a library of 250+ blocks that are compatible with HDL generation.

MATLAB design is the "golden reference", the hardware micro-architecture is described in Simulink, converted to fixed point in Simulink, and then optimized and turned into HDL code. Each step done in Simulink can be tested/visualized/verified using MATLAB.

An example of a hardware-friendly implementation of an algorithm is to compute over a sliding window of the signal data instead of the entire frame.


Adding input/output pipelining can help make clock rate increases possible. Converting from floating to fixed point simplifies hardware, but keep in mind that this conversion does introduce quantization errors due to scaling and saturation. These are expected in the tradeoff between efficiency and accuracy.

Page last modified on May 25, 2022, at 04:01 PM