FPGA ——防止信号被优化(转载)

转载:https://blog.csdn.net/weixin_46062412/article/details/125299437

Quartus

对这种情况的处理是增加约束,共有2种情况:
     a, 需要保留的信号类型是 wire
        在定义的时候在后面增加/* synthesis keep */。
        例如:wire wire_name/*synthesis keep */;
        
     b,需要保留的信号类型是 reg
        跟reg相关的synthesis attribute,共有两种,分别是/*synthesis noprune*/和/*synthesis preserve*/,两者的差别如下:
        /*synthesis noprune*/ 避免 Quartus II 优化掉没output的reg。
        /*synthesis preserve*/避免 Quartus II 將reg优化为常数,或者合并重复的reg。
        
        定义的时候在后面增加相关的约束语句。
        例如:reg r_name/*synthesis noprune*/; 或者 reg r_name/*synthesis preserve */;
        將/*synthesis noprune*/等synthesis attribute 语句放在module后面,这样整个module的所有reg将不被优化,
        从而不用再一一寄存器指定。
 
        注意:以上所提到的使用语言为verilog。synthesis attribute必须写在结束分号前面, 写在分号后面只相当于注释:
        正确:reg r_name/* synthesis preserve */;
        错误:reg r_name;/* synthesis preserve */

Vivado

 方式1
在变量定义的时候添加语句:
 
(* keep = “true” *)
 
方式2
信号前面将keep hierarchy选择yes ,或者选择soft(在综合时保持层次),这样有利于你从模块中找到你想抓取的信号和信号名不被更改。
 
(* keep_hierarchy = “yes” *)module fre( a, b, c, d);
 
or
 
(* keep_hierarchy = “yes” *)fre fre_inst( a, b, c, d);
 
方式3
信号前面使用(* DONT_TOUCH= “{TRUE|FALSE}” *),可以防止信号在综合,以及布局布线的时候被优化掉。
 
(* dont_touch = “true” *) wire a;
posted @ 2022-11-17 11:09  AdriftCore  阅读(1078)  评论(0编辑  收藏  举报