相关阅读
HDL Compilerhttps://blog.csdn.net/weixin_45791458/category_12893238.html?spm=1001.2014.3001.5482
综合指令(Synthesis Directives)是一些特殊注释,用于影响综合工具如何处理RTL代码,这些注释会被综合工具识别,但会被其他工具(如仿真器)忽略。关于综合指令相关概念的更多介绍,可以参考下面的博客。HDL Compiler:综合指令https://chenzhang.blog.csdn.net/article/details/148695750
translate_on/translate_off综合指令用于指定某些RTL代码只用于仿真,而不会被综合工具考虑,一般用于如下所示的不可综合代码。
对于verilog
- primitive定义
- time定义
- event定义
- triand、trior、tri1、tri0、trireg定义
- 对integer类型使用域选
- initial语句
- repeat语句
- 延迟控制(#)
- 事件控制(@event)
- forever语句
- fork语句
- force语句
- release语句
- deassign语句
- 精确相等===和精确不相等运算符!==
下面举例说明translate_on/translate_off指令的用法,该指令的语法如下所示。
// synopsys translate_off ***** // synopsys translate_on考虑例1所示的RTL代码,其中使用了initial语句进行了初始化。
// 例1 module dff_with_initial ( input clk, input d, output reg q ); initial q = 1'b0; always @(posedge clk) q <= d; endmodule读取设计时,HDL Compiler将产生以下的警告。
Warning: /home/zhangchen/Multiplier_Booth_STG_0/translate.v:7: The statements in initial blocks are ignored. (VER-281)使用translate_on/translate_off指令可以使HDL Compiler读取设计时忽略其中的RTL代码,如例2所示。
// 例2 module dff_with_initial ( input clk, input d, output reg q ); // synopsys translate_off initial q = 1'b0; // synopsys translate_on always @(posedge clk) q <= d; endmodule其实现在translate_on/translate_off指令即将被弃用,Synopsys推荐使用预定义宏SYNTHESIS和条件编译指令`ifdef、`ifndef、`else和`endif指定综合器需要忽略的RTL代码。
// 例3 module dff_with_initial ( input clk, input d, output reg q ); `ifndef SYNTHESIS initial q = 1'b0; `endif always @(posedge clk) q <= d; endmodule