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. Linux 批量杀进程的命令

    使用awk批量杀进程的命令: ps -ef | grep firefox | grep -v grep | awk '{print "kill -9 "$2}'|sh #列出了当前 ...

  2. js js弹出框、对话框、提示框、弹窗总结

    js弹出框.对话框.提示框.弹窗总结 一.JS的三种最常见的对话框 //====================== JS最常用三种弹出对话框 ======================== //弹 ...

  3. deepin15.2无线网无法使用

    原文链接:https://bbs.deepin.org/forum.php?mod=viewthread&tid=40276&highlight=%E6%97%A0%E7%BA%BF% ...

  4. 盒子模型--IE与标准

    从上图可以看到标准 W3C 盒子模型的范围包括 margin.border.padding.content,并且 content 部分不包含其他部分. 从上图可以看到 IE 盒子模型的范围也包括 ma ...

  5. Jquery AJAX使用踩坑小记

    在使用jquery ajax时,如果其参数是一个json对象,将此参数使用$('#dd').data(param)绑定到一个元素上, 在使用$('#dd').bind('click',function ...

  6. FusionCharts3.2.1 参数的详细说明和功能特性

    功能特性animation                    是否动画显示数据,默认为1(True)showNames                 是否显示横向坐标轴(x轴)标签名称rotat ...

  7. 华硕笔记本刷BIOS

    笔记本硬件升级后想使用微软的Windows xp mode,之后发现笔记本BIOS中没有虚拟化选项,想通过升级BIOS的方法来解决,结果失败. 升级后出现关机后无法关闭电源指示灯以及风扇的问题,之后只 ...

  8. windows的cmd和git bash的常用命令

    windows下使用git bash,使用的事linux下的命令,整理常用命令如下: windows下的命令 linux下的命令 命令的含义 cd e:\xx cd /e/xx 切换到xx目录 cd ...

  9. mongodb-3.2.8 单机复制集安装

    规划: replSet 复制集名称: rs1 MongoDB数据库安装安装路径为:/usr/local/mongodb/ 复制集成员IP与端口: 节点1: localhost:28010   (默认的 ...

  10. (二)mybaits之ORM模型

    前言:为什么还没有进入到mybatis的学习呢?因为mybatis框架的核心思想就是ORM模型,所以好好了解一下ORM模型是有必要哒. ORM模型   ORM(Object Relational Ma ...