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,对于基本的数 ...
随机推荐
- Codeforces Round #396 (Div. 2) A
While Mahmoud and Ehab were practicing for IOI, they found a problem which name was Longest common s ...
- bzoj 4318 || 洛谷P1654 OSU!
https://www.lydsy.com/JudgeOnline/problem.php?id=4318 https://www.luogu.org/problemnew/show/P1654 看来 ...
- 关于JVM的一些东西
1.在JDK1.6(HotSpot虚拟机)及之前,运行时常量池(属于方法区的一部分)是永久代的,而在JDK1.7之后运行时常量池(里面用于存放编译期生成的各种字面量和符号引用,这部分内容将在类加载后进 ...
- python学习之模块:
每个.py文件就是一个以文件名作为区别的模块,模块化编程便于维护.其它模块要调用某个模块的变量和函数就要用import 模块,然后通过模块.函数.模块.变量来引用. 为防止模块间变量和函数乃至模块名的 ...
- Masonry UIScrollView autolayout 的一个奇特的问题
事情是这样的.... 我一个工程里 一直使用的 masonry 做autolayout,有个gesturerReconizer的bug,找了很久,发现很奇怪一个现象: 我的某个view 是这样的 |- ...
- Java微服务 进程间通信
目录 进程间通信 同步调用 异步调用 实现方式 进程间通信 同步调用 同步调用比较简单,一致性强,但是容易出调用问题,出现单点故障,因为之间相互依赖,比如RPC必须要依赖的模块上线可用,己方才能调用, ...
- sql server 日期 查询技巧
CONVERT(varchar(100), SendTime, 23) –-sql里的字段SendTime参数 selectdateName(weekday,getDate());--返回当前星期 s ...
- 【Linux】VirtualBox网络配置桥接模式
VirtualBox网络配置桥接模式 CentOS/RHEL (虚拟机)配置 # 基于桥接模式设置固定 ip cat >> /etc/sysconfig/network-scripts/i ...
- jQuery对表格的操作
1.表格变色 (1)普通的隔行变色 CSS代码: .even{background:#fff;} //偶数行样式 .even{background:#fff;} //奇数行样式 ①包括表头 $ ...
- Warning: skipping non-radio button in group
Question: 最近在开发中,设计了一个对话框来进行一系列的设定,其中有一组Radio Buttons(单选按钮),但在Debug下,发现对话的弹出有点延迟,经过分析,确定是因为在对话框弹出之 ...