博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
在vivado中使用attribute
阅读量:6003 次
发布时间:2019-06-20

本文共 3794 字,大约阅读时间需要 12 分钟。

  之前最常用的一个attribute就是mark_debug了,语法如下:(*mark_debug="ture"*)。

 

  今天又学到几个新的,原文在这里:http://china.xilinx.com/support/answers/54357.html

 

  一、PARALLEL_CASE (Verilog Only)

  Parallel case is valid only for Verilog designs. This attribute forces a case statement to be built as a parallel multiplexer. This also prevents the case statement from being transformed into a prioritized if-elsif cascade.

  This attribute can only be controlled through the Verilog RTL.

  Example:

(* parallel_case *)casex select   4'b1xxx: res = data1;   4'bx1xx: res = data2;   4'bxx1x: res = data3;   4'bxxx1: res = data4;endcase

  二、TRANSLATE_OFF/TRANSLATE_ON

  TRANSLATE_OFF and TRANSLATE_ON instructs the Synthesis tool to ignore blocks of code. This can be useful to ignore source code that is not relevant for Synthesis, such as simulation code. 

  These attributes are given within a comment in RTL code. The comment should start with one of the following keywords:

  • synthesis
  • synopsys
  • pragma

  TRANSLATE_OFF starts the section of code to be ignored, and TRANSLATE_ON ends the section to be ignored. These attributes cannot be nested.

  Be careful with the types of code that are included between the translate statements. 

  If it is code that affects the behavior of the design, a simulator could use that code, and create a simulation mismatch.

  Verilog Example

// synthesis translate_off...Code to be ignored...// synthesis translate_on

  VHDL Example

-- synthesis translate_off...Code to be ignored...-- synthesis translate_on

  三、USE_DSP48

  The use_dsp48 attributes allows a user to control how the Synthesis tool deals with arithmetic structures. 

  By default, mults, mult-add, mult-sub, and mult-accumulate type structures go into DSP48 blocks. Adders, subtractors, and accumulators can also go into these blocks, but by default are implemented with the fabric instead of using DSP48 blocks. 

  If this attribute is not specified, the default behavior is for Vivado Synthesis to determine the correct behavior. 

  This attribute overrides the default behavior and forces these structures into DSP48 blocks, and is placed in the RTL on signals, architectures and components, entities and modules, with the following priority:

  1. Signals
  2. Architectures and components
  3. Modules and entities

  Accepted values for this attribute are "yes" and "no."

Verilog Example

(* use_dsp48 = "yes" *) module test(clk, in1, in2, out1);

VHDL Example

attribute use_dsp48 : string;attribute use_dsp48 of P_reg : signal is "no";

 

重点说一下USE_DSP48,这句话可以放在模块的前面,也可以放在reg声明的前面,如下:

  一、放到模块前面

(*use_dsp48="yes"*)module COUNTER(    input           clk,    input           rst,    output  [7:0]   cnt);        reg [7:0]   cnt_tmp = 8'b0;        always @(posedge clk,posedge rst)        if(rst)            cnt_tmp <= 8'b0;        else            cnt_tmp <= cnt_tmp + 1'b1;                assign cnt = cnt_tmp;    endmodule

综合后的资源占用如下:

  

  二、放到寄存器声明前面

module COUNTER(    input           clk,    input           rst,    output  [7:0]   cnt);        (*use_dsp48="yes"*)reg [7:0]   cnt_tmp = 8'b0;        always @(posedge clk,posedge rst)        if(rst)            cnt_tmp <= 8'b0;        else            cnt_tmp <= cnt_tmp + 1'b1;                assign cnt = cnt_tmp;    endmodule

综合后的资源占用如下,可以看到跟放到模块前面的资源使用情况是一样的。但这只是针对计数器这么一个简单的模块,如果你的模块中还有其它更复杂的逻辑,那么建议使用第二种方法,只对某些特定的逻辑使用DSP单元。

  

  三、对比不使用DSP

// (*use_dsp48="yes"*) 默认加法不使用DSPmodule COUNTER(    input           clk,    input           rst,    output  [7:0]   cnt);        reg [7:0]   cnt_tmp = 8'b0;        always @(posedge clk,posedge rst)        if(rst)            cnt_tmp <= 8'b0;        else            cnt_tmp <= cnt_tmp + 1'b1;                assign cnt = cnt_tmp;    endmodule

综合后的资源占用:

  

posted on
2016-08-21 18:15 阅读(
...) 评论(
...)

转载于:https://www.cnblogs.com/christsong/p/5793213.html

你可能感兴趣的文章
希捷推出世界最大USB 3.0移动硬盘:5TB、1300元
查看>>
干掉口令:一张图片访问网站并解锁所有应用
查看>>
安防行业是AI应用最具应用空间的蓝海?
查看>>
多晶仍将主导市场?分析师:不尽然
查看>>
俄安全公司:iPhone自动向苹果服务器上传用户通话记录
查看>>
TCL免污式洗衣机:双方共赢的科技创新
查看>>
智能家居真的更安全吗?邻居可用Siri解锁你家的门锁
查看>>
新零售催生未来经济形态 线上线下全渠道融合达新高度
查看>>
测试VDI网络性能 保证终端用户体验
查看>>
嵌入式软件测试与一般软件测试之异同研究
查看>>
Cookie问题(烦了三天)
查看>>
华云数据重新定义企业级云平台服务
查看>>
大数据推动人工智能发展 AI+X将实现人工智能生活化
查看>>
IDC:IBM Bluemix 落地 中国PaaS市场竞争进入新阶段
查看>>
在线协作工具“一起写”获金山WPS战略投资
查看>>
专家解读工业物联网优势的商业模式
查看>>
清新区建成清远市首个农综改大数据平台
查看>>
sqlite3数据库归纳
查看>>
物联网普而不及 仍缺杀手级应用
查看>>
持续集成引擎 Hudson 和 Jenkins 的恩恩怨怨
查看>>