verilog RTL 编程实践之五
How to build and test a module
1.test have: generate 、stimulus 、check 、respose
2.only one monitor can be active at any time
3.$finish VS $finish(2)
$finish(2) print about cpu / memory information
4.parameter defparam
defparam ===> redefine parameters (cross module)
modulename #(parameter1(parameter_value),….)(port_declaratoin); <==常见
5.tasks and functions are declared wihin modules
1. tasks may only be used in procedural blocks.
A task invocation or task enable as it is called in verilog , is a statememt by itself .
It may not be used as operands in an expression.
2.functions are used as operands in expressions
A function may be used in either a procedural block or
a continuous assignment,or indeed,any place where an expression may appear
6.if task statmemts inside can synthesys ====> task can synthesys
if task statmemts inside can not synthesys ====> task can not synthesys
task may have time or delay control
7.function not have time or delay control
if function statmemts inside can synthesys ====> function can synthesys
if function statmemts inside can not synthesy ====> function can not synthesys
8.system task
$display / $write /$strobe /$monitor
$write not add a newline character to the output string
$readmemb/$readmemh === store file into memory
$stop
$finish / $finish(2)
9.system function
$time <===返回64位数
$stime <===返回32位数
$random
…
conversion function:
$rtoi / $itor / $realtobits / $bitstoreal
10.XMR
verilog has a mechanism for globally referencing nets, registers,events,
tasks,and functions called the cross-module reference , or XMR.
11.Hierarchical Module
module A;
reg x; //1 <==A.x
…
task B;
reg x;//2 <==A.B.x
begin
…
begin : C
reg x; //3 <===A.B.C.x
..
end
end
endtask
initial
begin:D
reg x;//4 <===A.D.x
…
end
endmodule
12.verilog-2001 new features
(1).ANSI-style port lists
95style:一个signal 需要端口、方向、数据类型可能需要重复三次。
2K1style:把一个signal的端口、方向、数据类型全部放在一起申明。
(2).parameter
module module_name #(parameter_declaration)
(port_declaration);
(3)constant function
V2K1: log2
(4)comma separated sensitivity list
(5) combinational logic sensitivity list
推荐:
always@(a or b or sel)
不推荐:
always@(*)
(6)vector part select <==位宽选择
reg [63:0] vector1;
reg [0:63] vector2;
byte = vector1[31-:8];//vector1[31:24]
byte = vector1[24+:8];//vector1[31:24]
byte =vector2[31-:8];//vector2[24:31]
byte =vector2[24+:8];//vector2[24:31]
13.Multi-Demensional Array
in verilog-1995
only 1D arrays of reg / integer and time allowed
in verilog-2001
wire [31:0] array_1D[127:0];
real array_2D[127:0][127:0];
14.Array Bit and part select
in verilog-1995
reg [31:0] ram [0:255];
reg [7:0] high_byte;
reg [31:0] temp;
temp = ram[5];
high_byte=temp[31:24];
in verilog-2001
reg[31:0] ram[0:255];
reg[7:0] high_byte;
high_byte = ram[5][31:24];
15.power operator **
取2的10次方:1K=2**10
16.size and typed parameter <==95中,the width of a parameter must be 32bits
17.explicit in_line parameter pass
.parameter(parameter_value)
18.fixed local parameter
module multiplier(a,b,product);
parameter a_width = 8,b_width=8;
loaclparam product_width= a_width+b_width;
parameter :can be redifined by defparam or in_line parameter redefinition
localparam: cannot be refined(外面不可见)
19.generate <== use loops to generate any number of instances
generate
genvar i;
for(i=xx;i<=xx;i=i+1)
begin :indentifier
….
end
endgenerate
verilog RTL 编程实践之五的更多相关文章
- verilog RTL编程实践之四
1.verilog平时三个级别: 1.gate level: and or not xor 2.RTL level: reg comb seq 3.behavior:+ – * / 2.system ...
- 高性能javascript学习笔记系列(5) -快速响应的用户界面和编程实践
参考高性能javascript 理解浏览器UI线程 用于执行javascript和更新用户界面的进程通常被称为浏览器UI线程 UI线程的工作机制可以理解为一个简单的队列系统,队列中的任务按顺序执行 ...
- 高性能JavaScript 编程实践
前言 最近在翻<高性能JavaScript>这本书(2010年版 丁琛译),感觉可能是因为浏览器引擎的改进或是其他原因,书中有些原本能提高性能的代码在最新的浏览器中已经失效.但是有些章节的 ...
- Method Swizzling和AOP(面向切面编程)实践
Method Swizzling和AOP(面向切面编程)实践 参考: http://www.cocoachina.com/ios/20150120/10959.html 上一篇介绍了 Objectiv ...
- 编程实践中C语言的一些常见细节
对于C语言,不同的编译器采用了不同的实现,并且在不同平台上表现也不同.脱离具体环境探讨C的细节行为是没有意义的,以下是我所使用的环境,大部分内容都经过测试,且所有测试结果基于这个环境获得,为简化起见, ...
- 第二章 C语言编程实践
上章回顾 宏定义特点和注意细节 条件编译特点和主要用处 文件包含的路径查询规则 C语言扩展宏定义的用法 第二章 第二章 C语言编程实践 C语言编程实践 预习检查 异或的运算符是什么 宏定义最主要的特点 ...
- VS2010/MFC编程入门之五(MFC消息映射机制概述)
VS2010/MFC编程入门之五(MFC消息映射机制概述)-软件开发-鸡啄米 http://www.jizhuomi.com/software/147.html 上一讲鸡啄米为大家简单分析了MFC应用 ...
- 试读《JavaScript语言精髓与编程实践》
有幸看到iteye的活动,有幸读到<JavaScript语言精髓与编程实践_第2版>的试读版本,希望更有幸能完整的读到此书. 说来读这本书的冲动,来得很诡异,写一篇读后感,赢一本书,其实奖 ...
- Python GUI编程实践
看完了<python编程实践>对Python的基本语法有了一定的了解,加上认识到python在图形用户界面和数据库支持方面快捷,遂决定动手实践一番. 因为是刚接触Python,对于基本的数 ...
随机推荐
- SpringBoot | 遇坑总结 | JPA
1. Caused by: org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when ...
- PostgreSQL-2-用户权限管理
1.创建与删除用户 CREATE ROLE rolename; 方法1,创建角色 CREATE USER username; 方法2,创建用户 CREATE USER指令创建的用户默认是有登录权限的, ...
- CF #541div2 E
题目本质:忽略串的变化,只记载26个字母的相关变化. 解决方法: 在上一次与本次的转移过程中,情况并不多,主要取决于本次串的首尾字母,若不是本次的首尾字母,会被置1:如果是的话,分情况接一下并更新.另 ...
- 使用高性能Pipelines构建.NET通讯程序
.NET Standard支持一组新的API,System.Span, System.Memory,还有System.IO.Pipelines.这几个新的API极大了提升了.NET程序的效能,将来.N ...
- 使用nvmw解决windows下多版本node共存的问题
不支持4.x的nodejs,用nodist吧 不支持4.x的nodejs,用nodist吧 不支持4.x的nodejs,用nodist吧 ===========不要再看的分割线============ ...
- [在读]Secrets of the javascript Ninja
很棒的一本,可惜没有中文版.
- SourceGrid之Grid绑定数据
private void BindData() { //为绑定的按钮选线增加单击事件 SourceGrid.Cells.Controllers.CustomEvents clickEvent = ne ...
- AJPFX简述i=i+1与i+=1及x++的区别和效率
i=i+1与i+=1及x++的区别和效率 1.x=x+1,x+=1及x++的效率哪个最高?为什么? x=x+1最低,因为它的执行如下. (1)读取右x的地址: (2)x+1: (3)读取左x的地址: ...
- 常用的 JavaScript 简写方法
1.三元操作符 当想写 if...else 语句时,使用三元操作符来代替. const x = 20; let answer; if (x > 10) { answer = 'is gre ...
- 自定义可伸缩的imageView
直接上代码 /** * 自定义可伸缩的ImageView */ public class ZoomImageView extends ImageView { /** 画笔类 **/ private P ...