博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
verilog RTL 编程实践之五
阅读量:4914 次
发布时间:2019-06-11

本文共 3340 字,大约阅读时间需要 11 分钟。

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

            推荐:

                  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

转载于:https://www.cnblogs.com/chip/p/3970734.html

你可能感兴趣的文章
C# 字符串替换第一次或者最后一次出现的匹配项
查看>>
Linux终端查看端口号command
查看>>
《攻城Online》开发前期:UML设计架构
查看>>
HBase简介及集群安装
查看>>
springboot部署到tomcat
查看>>
jquery-ajax之4:无刷新 select 数据源及事件绑定(2)
查看>>
(六)Hive的高级操作
查看>>
java并发阻塞队列
查看>>
poj 2449 Remmarguts' Date 求第k短路 Astar算法
查看>>
lightoj1063【求割点】
查看>>
C#是怎么获取窗口标题的
查看>>
LeetCode 24 Swap Nodes in Pairs
查看>>
JavaScript Boolean(布尔) 对象
查看>>
IIS下的SSL证书配置
查看>>
Dynamics CRM Form表单中通过javascript抓取触发change事件字段的属性名
查看>>
Activiti的后台数据库表详解
查看>>
java 映射处理类方法和属性(get set)
查看>>
Auto Completion ComboBox for WTL
查看>>
javascript 拷贝文本
查看>>
html之a标签
查看>>