【SystemVerilog】Fine-grain process control

A process is a built-in class that allows one process to access and control another process once it has started.
Users can declare variables of type process and safely pass them through tasks or incorporate them into other

objects. The prototype for the process class is as follows:

 

class process;

 

typedef enum { FINISHED, RUNNING, WAITING, SUSPENDED, KILLED } state;

 

static function process self();
function state status();
function void kill();
task await();
function void suspend();
function void resume();
function void srandom( int seed );
function string get_randstate();

function void set_randstate( string state );

 

endclass

 

Objects of type process are created internally when processes are spawned. Users cannot create objects of
type process;
attempts to call new shall not create a new process and shall instead result in an error. The

process class cannot be extended. Attempts to extend it shall result in a compilation error. Objects of type

process are unique; they become available for reuse once the underlying process terminates and all

references to the object are discarded.

 

The self() function returns a handle to the current process, that is, a handle to the process making the call.

The status() function returns the process status, as defined by the state enumeration:

 

FINISHED means the process terminated normally.
RUNNING means the process is currently running (not in a blocking statement).
WAITING means the process is waiting in a blocking statement.
SUSPENDED means the process is stopped awaiting a resume.

KILLED means the process was forcibly killed (via kill or disable).

 

The kill() function terminates the given process and all its subprocesses, that is, processes spawned using
fork statements by the process being killed. If the process to be terminated is not blocked waiting on some
other condition, such as an event, wait expression, or a delay, then the process shall be terminated at some

unspecified time in the current time step.

 

The await() task allows one process to wait for the completion of another process. It shall be an error to

call this task on the current process, i.e., a process cannot wait for its own completion.

 

The suspend() function allows a process to suspend either its own execution or that of another process. If
the process to be suspended is not blocked waiting on some other condition, such as an event, wait
expression, or a delay, then the process shall be suspended at some unspecified time in the current time step.

Calling this method more than once, on the same (suspended) process, has no effect.

 

The resume() function restarts a previously suspended process. Calling resume on a process that was

suspended while blocked on another condition shall resensitize the process to the event expression or to wait
for the wait condition to become true or for the delay to expire. If the wait condition is now true or the
original delay has transpired, the process is scheduled onto the Active or Reactive region to continue its
execution in the current time step. Calling resume on a process that suspends itself causes the process to

continue to execute at the statement following the call to suspend.

 

initial procedure, always procedure, or fork block from one of those procedures.
The following example starts an arbitrary number of processes, as specified by the task argument N. Next,
the task waits for the last process to start executing and then waits for the first process to terminate. At that

point, the parent process forcibly terminates all forked processes that have not yet completed.

 

 

task automatic do_n_way( int N );

 

 

process job[] = new [N];

 

foreach (job[j])

   fork

      automatic int k = j;

      begin 

          job[k] = process::self(); 

          ... ;

      end

   join_none

 

foreach (job[j]) // wait for all processes to start

    wait( job[j] != null );

job[1].await(); // wait for first process to finish

foreach (job[j]) begin

    if ( job[j].status != process::FINISHED )

        job[j].kill();

end

endtask

### 回答1: SystemVerilog讲座-PDF教程是一本关于Verilog和SystemVerilog语言的详细介绍和使用手册。该教程适合想要学习Verilog和SystemVerilog语言的初学者和工程师。 该教程覆盖了Verilog和SystemVerilog语言的基础知识,包括数据类型和运算符、模块和端口、决策和循环语句、函数和任务、时序建模、测试和调试等。此外,该教程还介绍了使用SystemVerilog进行OVM/UVM验证和设计模式。 该教程包含了大量的示例程序和练习题,帮助读者深入理解Verilog和SystemVerilog语言的使用和应用。通过学习该教程,读者可以掌握系统级设计和验证流程,并在工作中使用SystemVerilog语言进行设计和验证。 值得注意的是,学习Verilog和SystemVerilog语言需要具备一定的数字电路设计和计算机编程基础。因此,初学者可以先学习电路设计和计算机编程基础,再进一步学习Verilog和SystemVerilog语言。 ### 回答2: SystemVerilog是基于Verilog的扩展语言,它是一种高级硬件描述语言,具有强大的设计与验证功能。SystemVerilog极大地拓展了Verilog的能力,增强了硬件设计的复杂性,使得对于SystemVerilog熟练掌握的工程师来说,能够更快速、更有效地完成硬件的设计与验证工作。 针对学习SystemVerilog的人们,提供了一些SystemVerilog讲座和PDF教程,这些资源非常有用。讲座中的专家们详细介绍了SystemVerilog的特性和用法,通过讲解实例,让学习者深入了解SystemVerilog的基本结构、体系架构、语法等方方面面。而PDF教程则提供了更加系统化、深入的学习材料,非常适合有一定编程基础的学习者使用。 在SystemVerilog讲座和PDF教程的学习中,学习者需要逐步掌握SystemVerilog的语言规则和特性。首先要掌握数据类型、运算符、模块定义、分层设计、控制流等基本概念。通过这些基础的学习和实践,可以逐渐提升自己的编程技能和系统设计能力。 总之,SystemVerilog讲座和PDF教程是学习SystemVerilog的重要资源,对于想要深入了解硬件设计与验证的工程师和学生而言,这些资源将是非常有用的学习资料,也有利于其提升自己的技能和能力,为将来的工作或学习做好准备。 ### 回答3: SystemVerilog讲座-PDF教程是一种与计算机领域相关的教学材料,旨在向学生和专业人士介绍SystemVerilog的基本概念和用法。SystemVerilog是一种现代的硬件描述语言,它在硬件设计领域和系统级开发中得到了广泛应用。 SystemVerilog讲座-PDF教程的内容丰富多样,包括SystemVerilog的基本语法和数据类型、控制流语句、模块化设计、仿真和调试等方面的内容。通过这些学习材料的使用,学生可以掌握SystemVerilog的核心概念,不仅能够编写规范的硬件描述代码,同时也能够使用SystemVerilog实现复杂的硬件系统。 SystemVerilog讲座-PDF教程还提供了大量的实例和案例,帮助学生更好地理解SystemVerilog的各种应用场景。此外,在教程中还提供了大量的练习题,帮助学生巩固自己的学习成果。 总之,SystemVerilog讲座-PDF教程是一种非常实用的教学资源,它为学生和专业人士提供了非常有价值的SystemVerilog学习资料,帮助大家快速掌握这种重要的硬件描述语言。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值