为仿真和综合定义不同的参数值 [英] Defining different parameter value for simulation and synthesis

查看:34
本文介绍了为仿真和综合定义不同的参数值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 systemVerilog 并且我有一个包含我的一些模块参数值的包(例如 parameter SPI_RATE = 2_000_000;).有什么方法可以为模拟设置一个值,为合成设置一个不同的值?(我正在使用 ModelSim).例如,我想要类似的东西:

I'm using systemVerilog and I have a package that holds some of my modules parameter values (for example parameter SPI_RATE = 2_000_000;). Is there any way I can set one value for simulation and a different one for synthesis? (I'm using ModelSim). For example I would like something like:

if(IN_SIM) begin
parameter SPI_RATE = 2_000_000;
end
else begin
parameter SPI_RATE = 1_000_000;
end

谢谢!

推荐答案

是的,这是可能的.SystemVerilog 支持条件编译器指令,例如`ifdef`ifndef`else`elsif`endif.请注意,这些指令使用的是重音符(ASCII 0x60)而不是普通的撇号(ASCII 0x27).

Yes, that's possible. SystemVerilog supports conditional compiler directives such as `ifdef, `ifndef, `else, `elsif, and `endif. Note that those directives are using a grave accent (ASCII 0x60) and not a normal apostrophe (ASCII 0x27).

此外,大多数综合工具都支持宏标识符SYNTHESIS.因此,您可以执行以下操作:

Furthermore, most synthesis tools support the macro identifier SYNTHESIS. So, you could do the following:

`ifdef SYNTHESIS
  parameter SPI_RATE = 1_000_000;
`else
  parameter SPI_RATE = 2_000_000;    
`endif 

这篇关于为仿真和综合定义不同的参数值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆