使用 MATLAB 代码进行硬件建模
用于 HDL 代码生成的 MATLAB® 设计和测试平台规范
您可以编写 MATLAB 代码来对状态机进行建模并实现计数器、RAM 等硬件元素,以生成 HDL 代码。在编写代码时,请遵循 for 循环最佳做法和规范以编写高效的 MATLAB 代码来生成 HDL 代码。
函数
hdl.RAM | Single, simple dual, dual, true dual, or simple tri-port RAM for memory read/write access |
hdl.BlackBox | Black box for including custom HDL code |
主题
用于 HDL 代码生成的模型
- Model a Counter for HDL and High-Level Synthesis Code Generation
To write MATLAB code that models hardware and is suitable for HDL and High-Level Synthesis (HLS) code generation, use this design pattern. - Model a State Machine for HDL and High-Level Synthesis Code Generation
The following design pattern shows MATLAB examples of Mealy and Moore state machines which are suitable for HDL and High-Level Synthesis (HLS) code generation. - Model State with Persistent Variables and System Objects
This example shows how to use persistent variables and System objects to model state and delays in a MATLAB® design for HDL code generation. - Generate Hardware Instances for Local Functions
The following example shows how to use local functions in MATLAB, so that each execution of a local function corresponds to a separate hardware module in the generated HDL code. - Implement RAM Using MATLAB Code
You can write MATLAB code that maps to RAM during HDL code generation by using: - Map Matrices to ROM
Map matrices to implement ROM in MATLAB and Simulink.
最佳做法与 MATLAB 测试平台
- Guidelines for Writing MATLAB Code to Generate Efficient HDL and HLS Code
Guidelines for writing efficient MATLAB code and design requirements for efficient HDL and High-Level Synthesis (HLS) code generation. - Bitwise Operations in MATLAB for HDL and HLS Code Generation
HDL Coder™ supports bit shift, bit rotate, bit slice operations that mimic HDL-specific operators without saturation and rounding logic. - For-Loop Best Practices for HDL Code Generation
Best practices when using for loops in your MATLAB code for HDL code generation. - MATLAB Test Bench Requirements and Best Practices for Code Generation
What is a MATLAB test bench, requirements and best practices for HDL and High-Level Synthesis (HLS) code generation. - Indexing Best Practices for HDL Code Generation
Best practices when performing indexing operations in your MATLAB algorithms for HDL code generation.