主要内容

引导式代码生成

使用“配置参数”对话框和 Simulink HDL 工作流顾问进行引导式代码生成

您可以通过用户界面使用 Simulink® 工具条中的 HDL 代码选项卡或“配置参数”对话框生成 Simulink 模型的 HDL 代码。在此对话框中,您可以指定各种 HDL 代码生成设置,包括基本文件夹、语言选择以及更高级优化参数。要了解如何从 HDL 代码选项卡生成 HDL 代码,请参阅从 Simulink 模型生成 HDL 代码

要将生成的代码部署到目标设备,请使用 Simulink HDL 工作流顾问。该顾问可运行端到端工作流,以检查 HDL 兼容性并将生成的代码部署到目标设备。HDL 工作流顾问在 Simulink Online™ 中不可用。

函数

hdladvisor显示 HDL 工作流顾问
hdlsetup设置用于 HDL 代码生成的模型配置参数
hdlsetuptoolpath设置系统环境以访问 FPGA 综合软件

模型设置

全部展开

要生成 HDL 的模块Select subsystem or model for HDL code generation
语言HDL code generation language
代码生成文件夹Folder for generated HDL code
还原模型默认值Reset model-level HDL settings to default values
运行兼容性检查器检查子系统与 HDL 代码生成的兼容性
生成为子系统或模型生成 HDL 代码
工作流Target workflow
工程文件夹Folder for workflow-specific files (自 R2023b 起)
目标平台Platform on which to deploy generated HDL code (自 R2023b 起)
综合工具Synthesis tool to target generated HDL code
系列Device chip family
设备Device name
Device package name
速度Device speed value
参考设计要与生成的 IP 核集成的参考设计 (自 R2023b 起)
参考设计工具版本Option to warn for reference design version mismatch (自 R2023b 起)
忽略工具版本不匹配Warning in instances of reference design tool version mismatch (自 R2023b 起)
参考设计参数Table of parameters available for default reference designs (自 R2023b 起)
目标频率Clock frequency for generated HDL design

常规

将流水线延迟映射到 RAMMap pipeline registers in generated HDL code to RAM
RAM 映射阈值Specify minimum RAM size for mapping to block RAMs
变换非零初始值延迟Implement Delay blocks to have zero initial value in generated HDL code
删除未使用的端口从设计中删除未使用的端口
基于使能的约束Enable multiple clock cycles for data to propagate between registers

流水线

允许设计延迟分布Allow distributed pipelining and delay absorption optimizations to move design delays
流水线分布优先级Priority for distributed pipelining and delay absorption optimizations
时钟频率流水线Insert pipeline registers at faster clock rate than data rate
允许 DUT 输出端口的时钟频率流水线Pass the outputs from DUT at clock rate
平衡时钟频率流水线 DUT 输出端口Synchronize DUT outputs while satisfying highest-latency requirements of outputs (自 R2022b 起)
分布式流水线Enable pipeline register distribution
使用综合估计执行分布式流水线Use synthesis timing estimates to guide pipeline register insertion (自 R2022a 起)
自适应流水线Insert adaptive pipeline registers
将查找表映射到 RAM 将查找表映射到块 RAM (自 R2021b 起)

资源复用

复用加法器Share adders with resource sharing optimization
加法器复用最小位宽Minimum bit width required to share adders with resource sharing optimization
复用乘法器Share multipliers with resource sharing optimization
乘法器复用最小位宽Minimum bit width required to share multipliers with resource sharing optimization
乘法器提升阈值Maximum bitwidth difference for promoting and sharing smaller multipliers
乘法器分割阈值Maximum input bit width for partitions
Multiply-Add 模块Share Multiply-Add blocks with resource sharing optimization
Multiply-Add 模块复用最小位宽Minimum bit width required to share Multiply-Add blocks with resource sharing optimization
原子子系统通过资源复用优化来复用 Atomic Subsystem 模块
MATLAB Function 模块Share MATLAB Function blocks with resource sharing optimization
浮点 IPShare floating-point IPs with resource sharing optimization

帧到采样的转换

启用帧到采样的转换Enable frame-to-sample conversion (自 R2022b 起)
每周期采样数Maximum size of streams for frame-to-sample conversion (自 R2022b 起)
输入 FIFO 大小Register size of generated input FIFOs around streaming matrix partitions (自 R2022b 起)
输出 FIFO 大小Register size of generated output FIFOs around streaming matrix partitions (自 R2022b 起)
输入处理顺序Processing order to use for frame inputs (自 R2023a 起)
启用外部存储的延迟大小阈值(KB)Maximum delay size for external memory (自 R2023a 起)
使用浮点Use native floating-point library (自 R2023a 起)
延迟策略Specify latency strategy to use for floating-point values
处理非正规数Specify whether to handle denormal numbers
尾数乘法策略Specify how to implement mantissa multiplication operation
供应商特定浮点库Select vendor-specific floating-point library (自 R2023a 起)

全局设置

复位类型Reset logic to use for registers in HDL code
复位生效电平Active level of reset input signal
时钟输入端口Name for clock input port
时钟使能输入端口 Name for clock enable input port
复位输入端口Name for reset input port
时钟输入Generate single or multiple clock inputs
将 Simulink 速率视为实际硬件速率Set oversampling value based on model rates and target frequency values (自 R2023b 起)
时钟沿活动时钟沿
过采样因子Oversampling value

常规

Verilog 文件扩展名File name extension for generated Verilog files
VHDL 文件扩展名File name extension for generated VHDL files
SystemVerilog 文件扩展名File name extension for generated SystemVerilog files (自 R2023b 起)
包后缀Text to append to model or subsystem name
实体冲突后缀Text to use to resolve duplicate module names
分割实体文件后缀Text to append to name of generated model file
保留字后缀Text to append to value names, postfix values, or labels
分割架构文件后缀Text to append to name of generated architecture file
钟控过程后缀Text to append to HDL clock process names
分割实体和架构Write architecture code to multiple VHDL files
复数实部后缀Text to append to real part of complex signal names
VHDL 架构名称DUT 的架构名称
复数虚部后缀追加到复信号名称虚部的文本
模块名称前缀Text to prefix to module or entity name in generated HDL code
使能前缀Base name for internal clock enables and other flow control signals
时序控制器后缀Text to append to timing controller name
流水线后缀Text to append to names of input or output pipeline registers
VHDL 库名称Target library name for generated VHDL code
将为模型引用生成的 VHDL 或 SystemVerilog 代码置于单一库中Generate VHDL or SystemVerilog code in separate libraries
模块生成标签要追加到 HDL GENERATE 语句的文本
输出生成标签要追加到 VHDL GENERATE 语句中的赋值块的文本
实例生成标签追加到实例节标签的文本
向量前缀要添加到向量名称的文本前缀
实例前缀要添加到组件实例名称的文本前缀
实例后缀要追加到组件实例名称的文本
映射文件后缀Text to append to generated mapping file

端口

输入数据类型HDL data type for input ports of model
输出数据类型HDL data type for output ports of model
时钟使能输出端口生成的时钟使能输出端口的名称
尽量减少时钟使能Omit clock enable logic in generated code
尽量减少全局复位Omit reset logic in generated code
使用触发信号作为时钟Use trigger input signal as clock in generated code
生成可调参数的 HDL DUT 输入端口Create DUT input ports for tunable parameters (自 R2021b 起)
平衡生成的 DUT 输入端口的延迟Insert matching delays on generated DUT inport port paths (自 R2022b 起)
生成测试点的 HDL DUT 输出端口Create DUT output ports for test point signals
平衡生成的 DUT 输出端口的延迟Insert matching delays on generated DUT output port paths (自 R2022b 起)
端口标量化Flatten vector ports into structure of scalar ports
FPGA 部署的最大 I/O 引脚数目标 FPGA 的最大 I/O 引脚数 (自 R2022a 起)
检查 DUT 引脚数是否超出 I/O 阈值Option to generate error or warning when DUT pin count exceeds maximum number of I/O pins (自 R2023a 起)

编码风格

通过聚合体表示常量值Represent constants by using aggregates
内联 MATLAB Function 模块代码为 MATLAB Function 模块内联 HDL 代码
初始化所有 RAM 块Generate initial signal value for RAM blocks
RAM 架构指定带或不带时钟使能的 RAM 架构
无复位寄存器初始化Specify how to initialize registers that do no reset
尽量减少中间信号在生成代码中尽量减少中间信号
展开 For-Generate 循环Unroll and omit FOR and GENERATE loops from generated HDL code
从封装子系统生成参数化 HDL 代码Generate reusable HDL code for subsystems
枚举类型编码方案Specify encoding scheme to use for enumeration types
对寄存器使用 "rising_edge/falling_edge" 样式使用 rising_edgefalling_edge 检测生成代码中的时钟跳变
代码重用Specify whether to generate a reusable file for subsystems (自 R2022a 起)
内联 VHDL 配置生成的 VHDL 代码是否包含内联配置
串联类型安全零Whether to use type-safe syntax for concatenated zeros in generated VHDL code
生成经过混淆处理的 HDL 代码Whether to generate obfuscated HDL code
在生成的 HDL 代码中保留总线结构体Generate code with VHDL record or SystemVerilog structure types (自 R2022b 起)
标量化端口命名的索引Specify starting index for names of scalarized vector ports (自 R2022a 起)
优化时序控制器在时序控制器代码中为每个速率生成一个计数器
时序控制器架构Specify architecture of generated timing controller
使用 Verilog 或 SystemVerilog 的 `timescale 指令Use compiler directives in generated Verilog or SystemVerilog code
Verilog 或 SystemVerilog 的 timescale 设定指定在生成的 VerilogSystemVerilog 代码中使用的时间刻度

编码标准

HDL 编码标准Select coding standard guidelines
在编码标准报告中显示通过规则Include passing rules in coding standard report
检查重复名称Check for duplicate names in design
检查设计名称中是否有 HDL 关键字Check for HDL keywords in design names
检查模块、实例和实体名称长度Whether to check module, instance, and entity name length
检查信号、端口和参数名称长度Whether to check signal, port, and parameter name length
检查时钟使能信号Whether to check for clock enable signals in generated code
检测复位信号的使用Whether to check for reset signals in generated code
检测异步复位信号的使用Whether to check for asynchronous reset signals in generated code
尽量减少变量的使用Whether to minimize use of variables
检查设置 RAM 初始值的初始语句Whether to check for initial statements that set RAM initial values
检查 process 中的条件语句Whether to check for length of conditional statements
检查多个级联控制区域中相同变量的赋值Whether to check if there are assignments to same variable in multiple cascaded control regions (自 R2021b 起)
检查 if-else 语句链长度Whether to check if-else statement chain length
检查 if-else 语句嵌套深度Whether to check if-else statement nesting depth
检查乘法器宽度Whether to check multiplier bit width
检查非整数常量Whether to check for non-integer constants
检查换行长度Whether to check line lengths in the generated HDL code

注释

启用注释是否启用注释
头部注释Comment lines in header of generated HDL and test bench files
在头部包括时间/日期戳Include time and date information in generated HDL file header
在模块注释中包含需求Include requirements as comments in code or code generation reports
自定义文件头部注释Custom comment in header of generated HDL code
自定义文件尾部注释Custom comment in footer of generated HDL code

模型生成

生成的模型Generate model that shows latency and numeric differences between model and HDL code
验证模型Generate validation model
验证模型的后缀Suffix to append to validation model name
生成的模型的前缀Prefix to append to generated model name
布局样式Layout style of generated HDL model (自 R2021b 起)
自动信号布线在生成的模型中自动进行信号布线
模块间水平缩放生成模型的水平缩放
模块间垂直缩放生成模型的垂直缩放

高级

检查黑盒接口中是否存在名称冲突Generate warning or error when black box interfaces have name conflicts
生成 HDL 代码Enable code generation for model or subsystem
通过生成仅仿真索引检查来抑制越界访问错误Generate logic that prevents array indices from going out of bounds (自 R2022a 起)
生成可追溯性报告Generate report with hyperlinks from code to model and model to code
可追溯性样式Type of traceability to generate in code generation report
生成模型 Web 视图Include Web view in code generation report
生成资源利用率报告Generate resource utilization section in code generation report
生成优化报告Generate optimization sections in code generation report
生成高级时序关键路径报告Insert highlighting script that maps estimated critical path in code generation report
自定义时序数据库目录Path to custom timing files (自 R2021b 起)
仿真工具Simulator to use to run generated test benches
HDL 代码覆盖率Enable HDL code coverage flags in generated simulator scripts
HDL 测试平台Enable HDL test bench generation
联合仿真模型Generate cosimulation model
SystemVerilog DPI 测试平台Enable SystemVerilog DPI test bench generation
测试平台名称后缀Suffix to append to test bench name
强制时钟Whether test bench forces clock input signals
时钟高电平时间(ns)Period during which test bench drives clock input signals high
时钟低电平时间(ns)Period during which test bench drives clock input signals low
保持时间(ns)Hold time for input signals and forced reset input signals
强制时钟使能Whether test bench forces clock enable input signals
时钟使能延迟(以时钟周期为单位)Elapsed time between deassertion of reset and assertion of clock enable
强制复位Whether test bench forces reset input signals
复位长度(以时钟周期为单位)Length of time during which reset is asserted
保持采样之间的输入数据Hold data values for subrate signals for number of base-rate clock cycles in subrate sample period
初始化测试平台输入Specify initial value driven on test bench inputs before data is asserted to DUT
多文件测试平台Divide generated test bench into helper functions, data, and HDL test bench code files
测试平台数据文件名后缀Suffix to append to test bench data file name when generating multi-file test bench
测试平台参考后缀Suffix to append to names of reference signals generated in test bench code
使用文件 I/O 读取/写入测试平台数据Create data files for reading and writing test bench input and output data
忽略输出数据检查(采样数)Number of samples during which output data checking is suppressed
浮点容差检查依据Check for errors in floating-point library based on relative or ULP errors
容差值Floating-point tolerance value
仿真库路径Path of compiled Altera or Xilinx simulation libraries

EDA 工具脚本

生成 EDA 脚本启用第三方电子设计自动化脚本文件的生成

编译脚本参数

编译文件后缀追加到 DUT 或测试平台名称的后缀,用于编译脚本文件名
编译初始化用于编写编译脚本的 Init 节的格式名称
编译 VHDL 的命令Format name to use to write Cmd section of compilation script for VHDL
编译 Verilog 或 SystemVerilog 的命令Format name to use to write Cmd section of compilation script for Verilog or SystemVerilog
编译终止Format name to use to write termination section of compilation script

仿真脚本参数

仿真文件后缀追加到 DUT 或测试平台名称的后缀
仿真初始化用于编写仿真脚本初始化节的格式名称
仿真命令用于编写仿真命令的格式名称
仿真波形查看命令Waveform viewing command to write to simulation script
仿真终止用于编写仿真脚本终止节的格式名称
仿真器标志应用于生成的编译脚本的仿真器标志
选择综合工具Specify synthesis tool for which to generate synthesis scripts
综合文件后缀Postfix to append to file name
综合初始化Format name to use to write initialization section of synthesis script
综合命令Format name to use to write synthesis command
综合终止用于编写综合脚本终止节的格式名称
要添加到综合工程的附加文件Additional HDL or constraint files

Lint 脚本参数

选择 HDL lint 工具Specify HDL lint tool for which to generate lint scripts
Lint 初始化Format name to use to write initialization section of HDL lint script
Lint 命令Format name to use to write command for HDL lint script
Lint 终止Format to use to write termination section of HDL lint script

主题

使用 HDL 工作流顾问

使用“模型配置参数”对话框

模型配置参数