首页 > 其他分享 >Program Block-systemverilog

Program Block-systemverilog

时间:2022-10-04 18:45:16浏览次数:39  
标签:-------- transmission frame length Program systemverilog transmit display Block

systemverilog中的Program Block与module有些类似,但module是基于硬件思想,Program Block纯粹是为了仿真。如果不熟悉program,可以不用program.

The program block serves three basic purposes:

  • » It provides an entry point to the execution of testbenches.
  • » It creates a scope that encapsulates program-wide data.
  • » It provides a syntactic context that specifies scheduling in the Reactive region.

module test(...) int shared; // variable shared by programs p1 and p1
program p1; ...
endprogram
program p2;
...
endprogram // p1 and p2 are implicitly instantiated once in module testendmodule

Examp:
  1.   `timescale 1ns/1ps
  2.    
  3.   class frame_start;
  4.   rand byte length = 64'habcdabc101023acd123;
  5.   rand byte tag_frame_ma;
  6.   byte Num;//octal number
  7.   integer Tx_en;
  8.   task frame();
  9.   begin
  10.   if ((length/Num) || (length > tag_frame_ma))
  11.   $display ("\nReport the Tag frame error length = %d",length);
  12.   else
  13.   $display("\nReport Tag frame %d",length);
  14.   end
  15.   endtask
  16.   endclass
  17.    
  18.   program sim_top();
  19.   frame_start new_frame;
  20.   integer transmission_enable = 0;// Transmission of frame. Frame Tx include data encapulation and Media Access Management
  21.   task transmit(integer transmission_enable);
  22.   if (transmission_enable)
  23.   $display("\n@%g, Frame is ready to transmit",$time);
  24.   else
  25.   $display("\n@%g, Frame is not ready now to transmit",$time);
  26.   endtask
  27.   initial
  28.   begin
  29.   new_frame = new;
  30.   $display("*******--------*********--------********--------********");
  31.   #1 transmit(transmission_enable);
  32.   #1 transmission_enable = 1;
  33.   #1 transmit(transmission_enable);
  34.   #1 new_frame.frame();
  35.   #1 new_frame.randomize();
  36.   #1 $display("\n@%g, Transmit next frame now...", $time);
  37.   #1 $display("\n*******--------*********--------********--------********");
  38.   end
  39.   endprogram
output:
  1.   # *******--------*********--------********--------********
  2.   #
  3.   # @1, Frame is not ready now to transmit
  4.   #
  5.   # @3, Frame is ready to transmit
  6.   #
  7.   # Report the Tag frame error length = 35
  8.   #
  9.   # @6, Transmit next frame now...
  10.   #
  11.   # *******--------*********--------********--------********


标签:--------,transmission,frame,length,Program,systemverilog,transmit,display,Block
From: https://www.cnblogs.com/amxiang/p/16754199.html

相关文章

  • SV中program & module
    相同之处:1.和module相同,program也可以定义0个或多个输入、输出、双向端口。2.一个program块内部可以包含0个或多个initial块、generate块、specparam语句、连续赋值语句......
  • 程序块(Program Block)和时序区域(Timing Region)
    设计和测试平台都用module封装后,它们之间可能会出现竞争状态。这个问题的根源在于设计和测试平台的事件混合在同一个时间片内,我们希望存在一种方法可以在时间轴上分开这些......
  • systemverilog中的静态变量static和动态变量automatic
    本文参考:SystemVerilog静态变量和动态变量_行走的BUG永动机的博客-CSDN博客_systemverilog静态变量和动态变量systemverilog之Automatic-腾讯云开发者社区-腾讯云(ten......
  • Luogu P3469 [POI2008]BLO-Blockade(tarjan求割点)
    题目链接:https://www.luogu.com.cn/problem/P3469 [POI2008]BLO-Blockade题面翻译B城有$n$个城镇,$m$条双向道路。每条道路连结两个不同的城镇,没有重复的道路,所有......
  • 大数据必学Java基础(六十六):BlockingQueue常见子类
    文章目录​​BlockingQueue常见子类​​​​一、ArrayBlockingQueue​​​​1、添加元素​​​​2、获取元素​​​​3、源码​​​​4、其他的添加或者获取的方法都是依托......
  • Systemverilog之SVA(一)
     前言systemverilogassertion作为systemverilog引入的重要特性,在功能仿真及形式验证中有着重要的作用。相较于Verilog传统的checker,SVA作为声明性的语言,使用简单易于管......
  • SystemVerilog断言(一)
    摘要SystemVerilog断言(SVA)可以直接添加到RTL代码中,也可以通过bindfiles间接添加。实践表明,最好使用bindfiles添加大多数断言。这篇论文将解释为什么将断言直接添加到RTL......
  • systemverilog中的断言
    终于来到了断言了,嘿嘿。assertion分为两种,立刻和并行,立刻断言其实跟普通的$display没什么不同。重点在并行断言。(一)首先的概念是concurrentassertion的构成:sequence->pr......
  • 【Mysql】Host is blocked because of many connection errors;unblock with 'mysqlad
    错误原因:同一个ip在短时间内产生太多(超过mysql数据库max_connection_errors的最大值)中断的数据库连接而导致的阻塞;解决方式:连接mysql,刷新记录报错host的文件mysql>flushho......
  • IMC服务安装过程提示:尝试创建数据库失败请确认是否存在文件夹'C:\Program Files\imc
    问题如图:登录到iMC服务器桌面,在服务器管理器中点击配置-服务,找到MSSQLSERVER,右键属性,在登录选项卡中选择登录身份为“本地系统账号”,如下图所示: 重新启动服务器,重......