systemverilog:task

1.task declaration

个人喜欢ANSI C格式的声明:

task mytask(output int x,input logic y);

......

endtask

注意端口列表的方向和数据结构,容易犯错,最好每个逐一显示声明。

2.static and automatic tasks(这个极易出错)

2.1 所有定义在module  、 interface 、 program、 package中的task

默认是静态task,其task中变量是静态变量,所有调用该task的程序都可以

共享该变量。(由此可见默认大部分都是static task.不知道单独建立的task lib的 .v文件是不是static的)

2.2automatic storage task in the following

2.2.1 显示声明为automatic

task automatic task_name(port list);

....

endtask

2.2.2 隐示声明,但定义task在module、program、package、interface中。 这个 systemverilog 上没看懂,貌似跟前面的2.1冲突了。

2.3 automatic task  intems 不可以 hierarchical reference 但 automatic tasks 可以穿层调用。

2.4

A task may be enabled more than once concurrently. All variables of an automatic task shall be replicated on
each concurrent task invocation to store state specific to that invocation. All variables of a static task shall be
static in that there shall be a single variable corresponding to each declared local variable in a module
instance, regardless of the number of concurrent activations of the task. However, static tasks in different
instances of a module shall have separate storage from each other.
Variables declared in static tasks, including input, output, and inout type arguments, shall retain their
values between invocations. They shall be initialized to the default initialization value as described in 6.8.
Variables declared in automatic tasks, including output type arguments, shall be initialized to the default
initialization value whenever execution enters their scope. input and inout type arguments shall be
initialized to the values passed from the expressions corresponding to these arguments listed in the task-
enabling statements.
Because variables declared in automatic tasks are deallocated at the end of the task invocation, they shall not
be used in certain constructs that might refer to them after that point:
—They shall not be assigned values using nonblocking assignments or procedural continuous
assignments.
—They shall not be referenced by procedural continuous assignments or procedural force statements.
—They shall not be referenced in intra-assignment event controls of nonblocking assignments.
—They shall not be traced with system tasks such as $monitor and $dumpvars.

时间: 2024-08-04 22:14:08

systemverilog:task的相关文章

systemverilog.vim

" Vim syntax file " Language: SystemVerilog " Maintainer: Stephen Hobbs <[email protected]> " Last Update: Wed Jun 14 15:56:00 BST 2006 " Built on verilog.vim from vim63 " For version 5.x: Clear all syntax items "

第二章:systemverilog声明的位置

1.package 定义及从package中导入定义(***) verilog中,对于变量.线网.task.function的声明必须在module和endmodule之间.如果task被多个module引用呢? verilog用include解决,systemverilog借用VHDL的package解决. @1: package可以包含的可综合的结构有: 1.parameter和localparam常量定义 2.const变量定义 3.typedef 用户自定义类型 4.全自动task和fu

systemverilog之OOP

what is oop terminology an example class default methods for classes static attibute assigment and copying inheritance polymorphism why oop? 1.    helps in creating and maintaining large testbench: You can creat complex data types and tie them togeth

第三章:systemverilog文本值和数据类型

1.增强的文本值 2.改进的`define文本替换 3.时间值 4.新的变量类型 5.有符号和无符号类型 6.静态和动态变量(***) 7.类型转换 8.常数 增强的文本值(文本赋值增强) 主要是:位扩展更加方便 verilog : data = 64'hFFFF_FFFF; data = 'bz; data  = 'bx; systemverilog: data = '1;//无论data的size更改与否 data = 'z; data = 'x;//可以不用写明进制(d/b/h/o) `d

Systemverilog的一个牛人总结【转】

Systemverilog 数据类型 l       合并数组和非合并数组 1)合并数组: 存储方式是连续的,中间没有闲置空间. 例如,32bit的寄存器,可以看成是4个8bit的数据,或者也可以看成是1个32bit的数据. 表示方法: 数组大小和位,必须在变量名前指定,数组大小必须是[msb:lsb] Bit[3:0] [7:0] bytes   : 2)二维数组和合并数组识别: 合并数组:  bit [3:0] [7:0] arrys;   大小在变量名前面放得,且降序 二维数组:  int

systemverilog的高亮显示

1. 在_vimrc文件末尾添加: syntax on "确定vim打开语法高亮 filetype on "打开文件类型检测 filetype plugin on "为特定的文件类型允许插件文件的载入 filetype indent on "为特定的文件类型载入缩进文件 2. 修改Vim\vim73下的filetype.vim文件,在末尾加入: au BufRead,BufNewFile *.sv,*.sva set filetype=systemverilog 3

SystemVerilog搭建测试平台---第一章:验证导论(续)

本想第一章就将导论一起写完,但是总觉得对一些重要的概念还是想以小篇幅的形式突出重点写出来,所以接下来的这篇文章就是对上篇文章的延续. 1.6 随机化对象 以一个初入验证领域的人来讲,所谓的随机化就是数据字段,这种激励最容易创建---只需要调用$random()函数即可.但是这种随机数据在找漏洞方面的回报是很小的.使用这种随机数据找到的漏洞一般都是在数据路径上,很可能还都是比特级的错误.其实我们更加需要找到一些控制逻辑上的漏洞.比如下面几种类型: 设备和环境配置 很多测试只使用了仅仅经过复位的设计

vivado对task和function的可综合支持

手册UG901,对vivado可综合的语句支持进行了描述,HDL包括:verilog-2001,system-verilog,VHDL: verilog-2001扩展了对task和function的支持. ug901手册中,章节7对支持的语法进行详细描述. 1 Filename: functions_1.v 2 // 3 // An example of a function in Verilog 4 // 5 // File: functions_1.v 6 // 7 module funct

SystemVerilog基本语法总结(下)

2018年IC设计企业笔试题解析-(验证方向) 1.请简述:定宽数组,动态数组,关联数组,队列四种数据类型的各自特点.解析:(1)定宽数组:其宽度在声明的时候就指定了,故其宽度在编译时就确定了.(2)动态数组:可以在仿真时分配空间或者调整宽度,这样在仿真中就可以使用最小的存储量.在声明时,其下标为空[ ],使用new[ ]操作符来分配空间.(3)关联数组:SystemVerilog提供关联数组来保存稀疏矩阵的元素.一般用在对非常大的空间进行寻址,当对一个非常大的地址空间进行寻址时,SystemV