之前最常用的一个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
'b1xxx: res = data1;
'bx1xx: res = data2;
'bxx1x: res = data3;
'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 [:] cnt
); reg [:] cnt_tmp = 'b0; always @(posedge clk,posedge rst)
if(rst)
cnt_tmp <= 'b0;
else
cnt_tmp <= cnt_tmp + 'b1; assign cnt = cnt_tmp; endmodule

综合后的资源占用如下:

  

  二、放到寄存器声明前面

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

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

  

  三、对比不使用DSP

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

综合后的资源占用:

  

在vivado中使用attribute的更多相关文章

  1. 浅析C#中的Attribute(转)

    最近用到了,所以静下心来找些资料看了一下,终于把这东西搞清楚了. 一.什么是Attribute 先看下面的三段代码: 1.自定义Attribute类:VersionAttribute [Attribu ...

  2. 关于C# 中的Attribute 特性

    关于C# 中的Attribute 特性 作者: 钢钢  来源: 博客园  发布时间: 2011-01-09 23:30  阅读: 13921 次  推荐: 12   原文链接 [收藏] 摘要:纠结地说 ...

  3. C#中的Attribute

    最近用到了,所以静下心来找些资料看了一下,终于把这东西搞清楚了. 一.什么是Attribute 先看下面的三段代码: 1.自定义Attribute类:VersionAttribute [Attribu ...

  4. C#中的Attribute和Java中的Annotation

    在之前的博客中介绍过C#的Attribute(特性),简单的说,特性主要就是利用反射技术,在运行期获取关注类的相关标注信息,然后利用这些标注信息对关注的类进行处理,最近因为工作的原因,需要看一下Jav ...

  5. 设置ISE/vivado中默认文本编辑器为gvim

    ise windows版,添加方式 ISE下点击菜单Edit -> Preferences -> Editor. 在Editor选项框里选择Custom,在Command line syn ...

  6. Tcl在Vivado中的使用

    http://blog.chinaaet.com/detail/36014 Vivado是Xilinx最新的FPGA设计工具,支持7系列以后的FPGA及Zynq 7000的开发.与之前的ISE设计套件 ...

  7. 在Vivado中调用ModelSim生成FSM的状态转移图

    如果我们已经书写了一段FSM代码,现在想倒过来把它转换成为状态转移图,方便我们直观地检查我们书写的状态对不对(在写论文什么的画图太麻烦的时候,有个自动生成的是多方便啊!),应该怎么弄呢?通过在Viva ...

  8. 关于VO中的Attribute的问题

    对于新手来说,有些时候会遇到VO中的Attribute的各种问题; 总结如下:1,你页面上输入了值,但是点击保存之后值并不能存到数据库,这个是因为该字段在VO中不是基于EO的  2,你将一个VO中的E ...

  9. 从Unity中的Attribute到AOP(七)

    本章我们将依然讲解Unity中的Attribute,继续命名空间在UnityEngine里的. PropertyAttribute,这个特性主要来控制变量或者类在Inspector里面的显示方式.和P ...

随机推荐

  1. Python底层socket库

    Python底层socket库将Unix关于网络通信的系统调用对象化处理,是底层函数的高级封装,socket()函数返回一个套接字,它的方法实现了各种套接字系统调用.read与write与Python ...

  2. CentOS以及Oracle数据库发展历史及各版本新功能介绍, 便于构造环境时有个对应关系

    CentOS版本历史 版本 CentOS版本号有两个部分,一个主要版本和一个次要版本,主要和次要版本号分别对应于RHEL的主要版本与更新包,CentOS采取从RHEL的源代码包来构建.例如CentOS ...

  3. Linux 随机生成随机数

    #!/bin/bash echo $(($RANDOM % 39)) 表示生成0-39的随机数 并且不为0和39

  4. HTML CSS

    HTML CSS css是英文Cascading Style Sheets的缩写,称为层叠样式表,用于对页面进行美化.存在方式有三种:元素内联.页面嵌入和外部引入,比较三种方式的优缺点.语法:styl ...

  5. highchart 中数据千分位显示为空格而不是逗号的解决方案

    thousandsSep: String   一千的分隔符 在highcharts.js 中找到  thousandsSep位置,把"" 改为  ","

  6. Hibernate之二级缓存

                                                            Hibernate之二级缓存 一.简介 Gaving King曾经对别人说,hibern ...

  7. 重载Python FTP_TLS 实现Implicit FTP Over TLS方式下载文件

    对于Python2.7来说,内置的FTP_TLS类并不支持Implicit FTP Over TLS加密方式的FTP Server操作,为支持Implicit FTP Over TLS加密方式,必须重 ...

  8. C#.Net Mvc运营监控,计算方法/接口/action/页面执行时间

    1.建立一个TimingActionFilter过滤器 public class TimingActionFilter : ActionFilterAttribute { public overrid ...

  9. 转 makefile

    转自http://blog.chinaunix.net/uid-21411227-id-1826747.html gcc是gnu旗舰产品,目前基本上就是和unix捆绑在一起分发的.这个东西功能强大,但 ...

  10. Delphi 查找标题已知的窗口句柄,遍历窗口控件句柄(转)

    用我的方法来控制其他程序窗体上的窗口控件,必须先了解什么是 回调函数.我的理解是这样的: 回 调函数写出来不是自己的程序去调用的,反而是让其他的东西去调用,比如windows操作系统,比如其他的程序等 ...