Verilog 內,使用如下語法,差異為何?
或用在何處?
/* synthesis preserve = 1 */
/* synthesis keep = 1 */
是否還有其他的 語法可用?
是否可介紹一下?
共5条
1/1 1 跳转至页
Verilog 內,使用如下語法,差異為何?
各厂商综合工具,对HDL综合时都定义了一些综合属性这些属性可指定a declaration,a module item,a statement, or a port connection 不同的综合方式。
语法为:
/* synthesis, <any_company_specific_attribute = value_or_optional_value */
下面就是Altera的几个常用的Synthesis attributes
Noprune
A Verilog HDL synthesis attribute that prevents the Quartus II software from removing a register that does not directly or indirectly feed a top-level output or bidir pin.
For example:
reg reg1 /* synthesis noprune */;
keep
A Verilog HDL synthesis attribute that directs Analysis & Synthesis to not minimize or remove a particular net when optimizing combinational logic.
For example:
wire keep_wire /* synthesis keep */;
preserve
A Verilog HDL synthesis attribute that directs Analysis & Synthesis to not minimize or remove a particular register when eliminating redundant registers or registers with constant drivers.
For example:
reg reg1 /* synthesis preserve */;
ram_init_file
A Verilog HDL synthesis attribute that specifies initial contents of an inferred memory.
For example:
reg [7:0] mem[0:255] /* synthesis ram_init_file = " my_init_file.mif" */;
ramstyle
A Verilog HDL synthesis attribute that specifies the type of TriMatrix Memory block to use when implementing an inferred RAM.
M512", "M4K", "M9K", "M144K", "MLAB", "M-RAM”
For example:
reg [0:7] my_ram[0:63] /* synthesis ramstyle = "M512" */;
translate_off or translate_on
Verilog HDL synthesis directives that direct Analysis & Synthesis to ignore portions of the design code that are specific to simulation and not relevant to logic synthesis.
For example:
parameter tpd = 2; // Generic delays
// synthesis translate_off
#tpd;
// synthesis translate_on
关于状态机有下面三个综合属性:
full_case
A Verilog HDL synthesis attribute that directs Analysis & Synthesis to treat unspecified state values in a Verilog Design File Case Statement as don't care values, and therefore to treat the Case Statement as "full". 仅用于Verilog ,与case 语句一起使用表明所有可能的状态都已经给出不需要其他逻辑保持信号的值. module full_case (a, sel, y);
input [3:0] a;
input [1:0] sel;
output y;
reg y;
always @(a or sel) case (sel) // synthesis full_case
2'b00: y="a"[0];
2'b01: y="a"[1];
2'b10: y="a"[2];
endcase
endmodule parallel_case
A Verilog HDL synthesis attribute that directs Analysis & Synthesis to implement parallel logic rather than a priority scheme for all case item expressions in a Verilog Design File Case Statement. 仅用于Verilog ,与case 语句一起使用强制生成一个并行的多路选择结构而不是一个优
先译码结构.
A Verilog HDL synthesis attribute that determines how the Quartus II software should encode the states of an inferred state machine.
强制重新状态机的状态编码方式.有default,one-hot,sequential,gray,johnson,compact,user几种编码方式 (* syn_encoding = "user" *) reg [1:0] state;
parameter init = 0, last = 3, next = 1, later = 2; always @ (state) begin
case (state)
init:
out = 2'b01;
next:
out = 2'b10;
later:
out = 2'b11;
last:
out = 2'b00;
endcase
end In the above example, the states will be encoded as follows: init = "00"
last = "11"
next = "01"
later = "10"
希望可以帮到你
A Verilog HDL synthesis attribute that directs Analysis & Synthesis to treat unspecified state values in a Verilog Design File Case Statement as don't care values, and therefore to treat the Case Statement as "full". 仅用于Verilog ,与case 语句一起使用表明所有可能的状态都已经给出不需要其他逻辑保持信号的值. module full_case (a, sel, y);
input [3:0] a;
input [1:0] sel;
output y;
reg y;
always @(a or sel) case (sel) // synthesis full_case
2'b00: y="a"[0];
2'b01: y="a"[1];
2'b10: y="a"[2];
endcase
endmodule parallel_case
A Verilog HDL synthesis attribute that directs Analysis & Synthesis to implement parallel logic rather than a priority scheme for all case item expressions in a Verilog Design File Case Statement. 仅用于Verilog ,与case 语句一起使用强制生成一个并行的多路选择结构而不是一个优
先译码结构.
module parallel_case (sel, a, b, c);
input [2:0] sel;
output a, b, c;
reg a, b, c;
always @(sel) begin
{a, b, c} = 3'b0;
casez (sel) // synthesis parallel_case
3'b1??: a = 1'b1;
3'b?1?: b = 1'b1;
3'b??1: c = 1'b1;
endcase
end
endmodule
A Verilog HDL synthesis attribute that determines how the Quartus II software should encode the states of an inferred state machine.
强制重新状态机的状态编码方式.有default,one-hot,sequential,gray,johnson,compact,user几种编码方式 (* syn_encoding = "user" *) reg [1:0] state;
parameter init = 0, last = 3, next = 1, later = 2; always @ (state) begin
case (state)
init:
out = 2'b01;
next:
out = 2'b10;
later:
out = 2'b11;
last:
out = 2'b00;
endcase
end In the above example, the states will be encoded as follows: init = "00"
last = "11"
next = "01"
later = "10"
希望可以帮到你
3楼
/* synthesis preserve = 1 */ 避免Reg被优化
/* synthesis keep = 1 */ 避免wire被优化
常见用法
Noprune A Verilog HDL synthesis attribute that prevents the Quartus II software from removing a register that does not directly or indirectly feed a top-level output or bidir pin. For example: reg reg1 /* synthesis noprune */; keep A Verilog HDL synthesis attribute that directs Analysis & Synthesis to not minimize or remove a particular net when optimizing combinational logic. For example: wire keep_wire /* synthesis keep */; preserve A Verilog HDL synthesis attribute that directs Analysis & Synthesis to not minimize or remove a particular register when eliminating redundant registers or registers with constant drivers. For example: reg reg1 /* synthesis preserve */; ram_init_file A Verilog HDL synthesis attribute that specifies initial contents of an inferred memory. For example: reg [7:0] mem[0:255] /* synthesis ram_init_file = " my_init_file.mif" */; ramstyle A Verilog HDL synthesis attribute that specifies the type of TriMatrix Memory block to use when implementing an inferred RAM. M512", "M4K", "M9K", "M144K", "MLAB", "M-RAM” For example: reg [0:7] my_ram[0:63] /* synthesis ramstyle = "M512" */; translate_off or translate_on Verilog HDL synthesis directives that direct Analysis & Synthesis to ignore portions of the design code that are specific to simulation and not relevant to logic synthesis. For example: parameter tpd = 2; // Generic delays // synthesis translate_off #tpd; // synthesis translate_on
/* synthesis keep = 1 */ 避免wire被优化
常见用法
Noprune A Verilog HDL synthesis attribute that prevents the Quartus II software from removing a register that does not directly or indirectly feed a top-level output or bidir pin. For example: reg reg1 /* synthesis noprune */; keep A Verilog HDL synthesis attribute that directs Analysis & Synthesis to not minimize or remove a particular net when optimizing combinational logic. For example: wire keep_wire /* synthesis keep */; preserve A Verilog HDL synthesis attribute that directs Analysis & Synthesis to not minimize or remove a particular register when eliminating redundant registers or registers with constant drivers. For example: reg reg1 /* synthesis preserve */; ram_init_file A Verilog HDL synthesis attribute that specifies initial contents of an inferred memory. For example: reg [7:0] mem[0:255] /* synthesis ram_init_file = " my_init_file.mif" */; ramstyle A Verilog HDL synthesis attribute that specifies the type of TriMatrix Memory block to use when implementing an inferred RAM. M512", "M4K", "M9K", "M144K", "MLAB", "M-RAM” For example: reg [0:7] my_ram[0:63] /* synthesis ramstyle = "M512" */; translate_off or translate_on Verilog HDL synthesis directives that direct Analysis & Synthesis to ignore portions of the design code that are specific to simulation and not relevant to logic synthesis. For example: parameter tpd = 2; // Generic delays // synthesis translate_off #tpd; // synthesis translate_on
5楼
ISE中可以这样用
/* synthesize syn_keep=1 */ is for wire
/* synthesize syn_preserve=1 */ is for register
Xilinx的XST支持Synplicity的约束,所以更好的方法是如上的两种,前缀"syn_"应该表示是Synplicity的约束。
还有更多的综合约束,可以参考Xilinx XST User Guide中的“XST-Suppoerted” Third Party Constraints部分。
www.xilinx.com/support/documentation/sw_manuals/xilinx12_1/xst.pdf
对细节感兴趣的话,官方文档还是最好的资料。
/* synthesize syn_keep=1 */ is for wire
/* synthesize syn_preserve=1 */ is for register
Xilinx的XST支持Synplicity的约束,所以更好的方法是如上的两种,前缀"syn_"应该表示是Synplicity的约束。
还有更多的综合约束,可以参考Xilinx XST User Guide中的“XST-Suppoerted” Third Party Constraints部分。
www.xilinx.com/support/documentation/sw_manuals/xilinx12_1/xst.pdf
对细节感兴趣的话,官方文档还是最好的资料。
共5条
1/1 1 跳转至页
回复
有奖活动 | |
---|---|
【有奖活动】分享技术经验,兑换京东卡 | |
话不多说,快进群! | |
请大声喊出:我要开发板! | |
【有奖活动】EEPW网站征稿正在进行时,欢迎踊跃投稿啦 | |
奖!发布技术笔记,技术评测贴换取您心仪的礼品 | |
打赏了!打赏了!打赏了! |
打赏帖 | |
---|---|
【换取逻辑分析仪】-基于ADI单片机MAX78000的简易MP3音乐播放器被打赏48分 | |
我想要一部加热台+树莓派PICO驱动AHT10被打赏38分 | |
【换取逻辑分析仪】-硬件SPI驱动OLED屏幕被打赏36分 | |
换逻辑分析仪+上下拉与多路选择器被打赏29分 | |
Let'sdo第3期任务合集被打赏50分 | |
换逻辑分析仪+Verilog三态门被打赏27分 | |
换逻辑分析仪+Verilog多输出门被打赏24分 | |
【分享评测,赢取加热台】使用8051单片机驱动WS2812被打赏40分 | |
【换取逻辑分析仪】rtthread添加RRH62000传感器驱动-基于野火启明6M5被打赏48分 | |
换逻辑分析仪+Verilog多输入门被打赏27分 |