在vivado中使用attribute
之前最常用的一个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:
- Signals
- Architectures and components
- 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的更多相关文章
- 浅析C#中的Attribute(转)
最近用到了,所以静下心来找些资料看了一下,终于把这东西搞清楚了. 一.什么是Attribute 先看下面的三段代码: 1.自定义Attribute类:VersionAttribute [Attribu ...
- 关于C# 中的Attribute 特性
关于C# 中的Attribute 特性 作者: 钢钢 来源: 博客园 发布时间: 2011-01-09 23:30 阅读: 13921 次 推荐: 12 原文链接 [收藏] 摘要:纠结地说 ...
- C#中的Attribute
最近用到了,所以静下心来找些资料看了一下,终于把这东西搞清楚了. 一.什么是Attribute 先看下面的三段代码: 1.自定义Attribute类:VersionAttribute [Attribu ...
- C#中的Attribute和Java中的Annotation
在之前的博客中介绍过C#的Attribute(特性),简单的说,特性主要就是利用反射技术,在运行期获取关注类的相关标注信息,然后利用这些标注信息对关注的类进行处理,最近因为工作的原因,需要看一下Jav ...
- 设置ISE/vivado中默认文本编辑器为gvim
ise windows版,添加方式 ISE下点击菜单Edit -> Preferences -> Editor. 在Editor选项框里选择Custom,在Command line syn ...
- Tcl在Vivado中的使用
http://blog.chinaaet.com/detail/36014 Vivado是Xilinx最新的FPGA设计工具,支持7系列以后的FPGA及Zynq 7000的开发.与之前的ISE设计套件 ...
- 在Vivado中调用ModelSim生成FSM的状态转移图
如果我们已经书写了一段FSM代码,现在想倒过来把它转换成为状态转移图,方便我们直观地检查我们书写的状态对不对(在写论文什么的画图太麻烦的时候,有个自动生成的是多方便啊!),应该怎么弄呢?通过在Viva ...
- 关于VO中的Attribute的问题
对于新手来说,有些时候会遇到VO中的Attribute的各种问题; 总结如下:1,你页面上输入了值,但是点击保存之后值并不能存到数据库,这个是因为该字段在VO中不是基于EO的 2,你将一个VO中的E ...
- 从Unity中的Attribute到AOP(七)
本章我们将依然讲解Unity中的Attribute,继续命名空间在UnityEngine里的. PropertyAttribute,这个特性主要来控制变量或者类在Inspector里面的显示方式.和P ...
随机推荐
- ACM water
1000 纯属适应题 1003 做的时候花了很久,现在看好像也不难 1004 适应题,求下平均就行 1005 要读懂题就行 1007 逆序数,discuss方法 1046 全部暴搜一遍.. ...
- Smart_Script
target_type Name Value target_param1 target_param2 target_param3 target_x target_y target_z target_o ...
- 跟我学Windows Azure 二 使用SQL Azure创建数据库服务器,创建数据库,创建表
登陆Windows Azure门户 输入我们上一节课所注册的帐号及密码,点击登陆. 选择SQL 数据库,选择服务器 选择创建数据库服务器 设置访问数据库服务器的登陆帐号及密码 点击确定完成数据库服务器 ...
- MySql中常用的hint
对于经常使用Oracle的朋友可能知道,oracle的hint功能种类很多,对于优化sql语句提供了很多方法.同样,在MySQL里,也有类似的hint功能.下面介绍一些常用的. 强制索引 FORCE ...
- stl::map之const函数访问
如何在const成员数中访问stl::map呢?例如如下代码: string ConfigFileManager::MapQueryItem(const string& name) const ...
- winform里操作打开在panel里的form窗体,子窗体操作同级子窗体或者父窗体的方法
最近开始了一个winform项目,原先一直都是web项目.遇到个问题,就是在框架内,左侧和中间的main都是用panel来实现的form,就是把form窗体打开到panel里,实现左侧是导航,中间是操 ...
- webpack-vue搭建,部署到后端
1.安装npm(安装node自带npm),npm安装成功测试 2.安装cnpm,也可以装nvm-windows 步骤1,打开user/admin/.npmrc,输入,也可以用命令 步骤2,输入npm ...
- MySQL binlog的格式解析
我搜集到了一些资料,对理解代码比较有帮助. 在头文件中binlog_event.h中,有描述 class Log_event_header class Log_event_footer 参见[Myst ...
- 在 Web 项目中应用 Apache Shiro
Apache Shiro 是功能强大并且容易集成的开源权限框架,它能够完成认证.授权.加密.会话管理等功能.认证和授权为权限控制的核心,简单来说,"认证"就是证明你是谁? Web ...
- HelloWorld!
爪哇岛上程序猿,5载忙忙未等闲, 醉里挑灯秒登VPN解决Bug,梦里手撕产品战PM: 但行好事,莫问前程, 泰山崩于前,我依然沐浴更衣焚香沏茶: ...