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 编程实践之五的更多相关文章

  1. verilog RTL编程实践之四

    1.verilog平时三个级别: 1.gate level: and or not xor 2.RTL level: reg comb seq 3.behavior:+ – * / 2.system ...

  2. 高性能javascript学习笔记系列(5) -快速响应的用户界面和编程实践

    参考高性能javascript 理解浏览器UI线程  用于执行javascript和更新用户界面的进程通常被称为浏览器UI线程  UI线程的工作机制可以理解为一个简单的队列系统,队列中的任务按顺序执行 ...

  3. 高性能JavaScript 编程实践

    前言 最近在翻<高性能JavaScript>这本书(2010年版 丁琛译),感觉可能是因为浏览器引擎的改进或是其他原因,书中有些原本能提高性能的代码在最新的浏览器中已经失效.但是有些章节的 ...

  4. Method Swizzling和AOP(面向切面编程)实践

    Method Swizzling和AOP(面向切面编程)实践 参考: http://www.cocoachina.com/ios/20150120/10959.html 上一篇介绍了 Objectiv ...

  5. 编程实践中C语言的一些常见细节

    对于C语言,不同的编译器采用了不同的实现,并且在不同平台上表现也不同.脱离具体环境探讨C的细节行为是没有意义的,以下是我所使用的环境,大部分内容都经过测试,且所有测试结果基于这个环境获得,为简化起见, ...

  6. 第二章 C语言编程实践

    上章回顾 宏定义特点和注意细节 条件编译特点和主要用处 文件包含的路径查询规则 C语言扩展宏定义的用法 第二章 第二章 C语言编程实践 C语言编程实践 预习检查 异或的运算符是什么 宏定义最主要的特点 ...

  7. VS2010/MFC编程入门之五(MFC消息映射机制概述)

    VS2010/MFC编程入门之五(MFC消息映射机制概述)-软件开发-鸡啄米 http://www.jizhuomi.com/software/147.html 上一讲鸡啄米为大家简单分析了MFC应用 ...

  8. 试读《JavaScript语言精髓与编程实践》

    有幸看到iteye的活动,有幸读到<JavaScript语言精髓与编程实践_第2版>的试读版本,希望更有幸能完整的读到此书. 说来读这本书的冲动,来得很诡异,写一篇读后感,赢一本书,其实奖 ...

  9. Python GUI编程实践

    看完了<python编程实践>对Python的基本语法有了一定的了解,加上认识到python在图形用户界面和数据库支持方面快捷,遂决定动手实践一番. 因为是刚接触Python,对于基本的数 ...

随机推荐

  1. 数据库 | 远程连接centos7上数据库

    用root身份进入远程服务器控制台: 进入Mysql命令: # mysql -uroot -p 或者在本地上连接到远程主机上的MySQL: 假设远程主机的IP为:10.0.0.1,用户名为root,密 ...

  2. Centos 7 在Hyper-v中安装完成后,提示密码错误

    如果提示密码错误,可能是由于密码首字母采用了大些,而caps lock似乎不能识别,因此,在需要输入大写字母的时候,按住shift即可.

  3. js操作表格

    js 操作table: insertRow(),deleteRow(),insertCell(),deleteCell()方法 表格有几行: var trCnt = table.rows.length ...

  4. jmeter压力测试中遇到的问题汇总

    1.线程数大于1的时候,计数器配置没有勾选reset counter选项,导致测试结果出错 正常结果: 实际结果:index大于count数量时出错,病区及床号直接显示在count的基础上开始加1了 ...

  5. 在ASP.NET中,后台代码向页面写HTML代码

    Literal lt = new Literal();lt.Text = "<a href=\"http://www.czbin.cn\">czbin的博客& ...

  6. python部分 + 数据库 + 网络编程

    PS:附上我的博客地址,答案中略的部分我的博客都有,直接原标题搜索即可.https://www.cnblogs.com/Roc-Atlantis/ 第一部分 Python基础篇(80题) 为什么学习P ...

  7. mysql实现计数器

    本文转自:https://blog.csdn.net/stevendbaguo/article/details/70889449 如果是在非常高的并发之下,还是建议用内存数据库redis去实现计数的功 ...

  8. PeopleSoft FSCM Production Support 案例分析之一重大紧急事故发生时的应对策略

    案例背景: 今天一大早用户打电话来讲昨天上传的银行的forex payment return file好像没有被处理到,我一听就觉得纳闷,因为昨天晚上operator也没有给我打电话啊(如果有job ...

  9. 超简单!一步创建自己的wifi热点~

    还在用某某卫士.某某管家创建wifi热点,甚至被忽悠专门买一个随身wifi吗?现在答案明确了:你完全用不着它们了.因为有更简单的方法. 只需要两个bat文件.一个用来启动wifi热点,另一个用来关闭w ...

  10. Azure 项目构建 – 构建稳定的直播和点播教学系统

    本课程主要介绍了如何在 Azure 平台上快速构建和部署基于 Azure 虚拟机的点播和直播教学系统, 实践讲解如何使用 Azure 门户创建虚拟机,配置视频服务,连接 CDN 加速 等. 具体包括项 ...