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. Location replace() 方法

    replace() 方法可用一个新文档取代当前文档. <!DOCTYPE html> <html> <head> <meta charset="ut ...

  2. 洛谷1072(gcd的运用)

    已知正整数a0,a1,b0,b1,设某未知正整数x满足: 1. x 和 a0 的最大公约数是 a1​: 2. x 和 b0​ 的最小公倍数是b1. Hankson 的“逆问题”就是求出满足条件的正整数 ...

  3. MFC中的模态对话框与非模态对话框

    模态对话框创建: MyDialog mydlg; mydlg.DoModal() 当前只能运行此模态对话框,且停止主窗口的运行,直到模态对话框退出,才允许主窗口运行. 模态对话框的关闭顺序: OnCl ...

  4. oracle GROUP BY rollup

    1.ROW_NUMBER() OVER函数的基本用法用法 http://www.cnblogs.com/fxgachiever/archive/2010/09/15/1826792.html 2.De ...

  5. gulp-htmlone的BUG弃坑

    之前用项目用gulp-htmlone做最后的js和css内联打包出现各种问题 这次居然遇到打包后的css斜杠变反斜杠的问题 如下:/src/common/images/i_banner.jpg会被改成 ...

  6. JSP新闻发布系统

    1.主页面 1.1登录 1.2    分页 2.注销 3.代码如下 package cn.news.dao.impl; import java.sql.SQLException; import org ...

  7. Spring Boot运行原理

    概述 本文主要写了下Spring Boot运行原理,还有一个小例子. Spring4.x提供了基于条件来配置Bean的能力,而Spring Boot的实现也是基于这一原理的. Spring Boot关 ...

  8. _CrtDumpMemoryLeaks()的作用 检测内存泄漏

    _CrtDumpMemoryLeaks()的作用 2007-03-22 10:11 CrtDumpMemoryLeaks()就是显示当前的内存泄漏.      注意是“当前”,    也就是说当它执行 ...

  9. cacti添加被监控机全过程

    在被监控端上的操作: 1.在被监控机器上root目录下建立文件 test.sh chmod 777 test.sh cat test #!/bin/bash echo $RANDOM 2.在snmpd ...

  10. COGS 1710. [POJ2406]字符串的幂

    ★☆   输入文件:powerstrings.in   输出文件:powerstrings.out   简单对比时间限制:3 s   内存限制:256 MB [题目描述] 对于给定的两个字符串a,b, ...