test.sv

来自「Open Verification Methodology」· SV 代码 · 共 80 行

SV
80
字号
// $Id: //dvt/vtech/dev/main/ovm/examples/basic_examples/do_test/test.sv#4 $//----------------------------------------------------------------------//   Copyright 2007-2008 Mentor Graphics Corporation//   Copyright 2007-2008 Cadence Design Systems, Inc.//   All Rights Reserved Worldwide////   Licensed under the Apache License, Version 2.0 (the//   "License"); you may not use this file except in//   compliance with the License.  You may obtain a copy of//   the License at////       http://www.apache.org/licenses/LICENSE-2.0////   Unless required by applicable law or agreed to in//   writing, software distributed under the License is//   distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR//   CONDITIONS OF ANY KIND, either express or implied.  See//   the License for the specific language governing//   permissions and limitations under the License.//----------------------------------------------------------------------package user_pkg;import ovm_pkg::*;//----------------------------------------------------------------------// Run two environments in parallel.  The two environments sync on// phases.//// Note: A::run has a 55ns delay and myenv::run has a 10ns delay.  The// test terminates after 10ns because the run() in the environment is// element that controls the test when using do_test.  When myenv::run// terminates then the entire test shuts down.//----------------------------------------------------------------------//----------------------------------------------------------------------// A//----------------------------------------------------------------------class A extends ovm_threaded_component;  function new(string name, ovm_component parent);    super.new(name, parent);  endfunction  task run;    $display("%0t: Hi from %s   top %0s", $time, get_full_name(),            m_env.get_full_name());    #55;    $display("%0t: Done from %s", $time, get_full_name());  endtaskendclass//----------------------------------------------------------------------// myenv//----------------------------------------------------------------------class myenv extends ovm_env;  A aa;  function new(string name, ovm_component parent=null);    super.new(name, parent);    aa = new("a", this);  endfunction  task run;    $display("%0t: Hi from %s", $time, get_full_name());    #10;    $display("%0t: Done from %s", $time, get_full_name());  endtaskendclassendpackage:user_pkg//----------------------------------------------------------------------// top//----------------------------------------------------------------------module top;  import user_pkg::*;  myenv env = new("env");  myenv env2 = new("env2");  initial env.do_test();  initial #5 env2.do_test();endmodule

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?