宁安找小姐小妹包夜上门服务 ... https://blog.eetop.cn/116762 [收藏] [复制] [分享] [RSS] 【微信:99093588】宁安找小姐上门服务【微信:99093588】宁安找小姐保健按摩服务【微信:99093588】《宁安小姐服务电话》【微信:99093588】《宁安 ...

空间首页 动态 记录 日志 相册 主题 分享 留言板 个人资料

日志

SV中program

已有 910 次阅读| 2013-3-12 11:25 |个人分类:验证SV/OVM/UVM

Program Systemverilog引入的一种类似module的结构,它与module的区别如下:

program只能用于testbench,是不可综合的

program可以在module中,但是module不能在program中,也就是program只能在叶节点

program不可以包含always语句,只能用forever代替

A program can call a task or function in modules or other programs. But a module can not call a task or function in a program

 

 

However, the biggest difference between a program and a module is the way they handle variable assignments in procedural blocks.

 

 

Systemverilog把整个环境执行顺序分成Active->Observed->Reactive->Postponed,在同一个time slot里(同一时刻)然后按照这个顺序执行:DUT-Assertions-Testbench

 

 

 

 

而我在http://www.project-veripage.com/program_blocks_3.php看到的是它多加了一个区域叫做Non-BLocking的区域,这个区域就是Programnon-blocking assignments(应该就是赋值给interface并传递给DUT的)

  • The blocking assignments of all modules are executed in the Active region. DUT
  • The non-blocking assignments within a program are executed in the Non-blocking assignment (NBA) region.
  • The events generated by the blocking assignments within a program block are all executed in one part of the execution, known as the Reactive region. Testbench

 

 

 

 

然后我仿真了《systemverilog for verification》中第四章的例子:

module memory(input  logic start,write,

            input logic [7:0] addr,data);

 

logic [7:0] mem[256];

always@(posedge start)

if(write)

mem[addr]<=data;

 

endmodule

 

 

module test(output logic start,write,  //这里可以换成是program

            output logic [7:0] addr,data);

           

        initial begin

        start = 0;

        write = 0;

        #10;

        addr = 8'h42;

        data = 8'h5a;

        start = 1;

        write = 1; 

       

        #2;

        end

       

 endmodule

 

 

 

 module top();

 

   logic start,write;

   logic [7:0] addr,data;

  

   memory  memory(.*);

   test    test(.*);

  

  

endmodule

 

 

结果无论test我是用program还是modulememory ‘h42地址处都写进去了’h5A NC仿真器也是这样

 

 

 

 

 

 


点赞

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 注册

  • 关注TA
  • 加好友
  • 联系TA
  • 0

    周排名
  • 0

    月排名
  • 0

    总排名
  • 0

    关注
  • 1

    粉丝
  • 3

    好友
  • 0

    获赞
  • 6

    评论
  • 470

    访问数
关闭

站长推荐 上一条 /1 下一条

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-4-27 17:02 , Processed in 0.018046 second(s), 7 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
返回顶部