├── hawkins ├── verif │ ├── vkits │ │ ├── global │ │ │ ├── vcs.flist │ │ │ ├── global_pkg.sv │ │ │ └── global_macros.sv │ │ ├── hawk │ │ │ ├── mentor.flist │ │ │ ├── vcs.flist │ │ │ ├── hawk_mem.sv │ │ │ ├── hawk_pkg.sv │ │ │ ├── hawk_phy_idle_seq.sv │ │ │ ├── hawk_intf.sv │ │ │ ├── hawk_types.sv │ │ │ ├── hawk_phy_train_seq.sv │ │ │ ├── hawk_os_item.sv │ │ │ ├── hawk_passive_drv.sv │ │ │ ├── hawk_phy_item.sv │ │ │ ├── hawk_os_seq_lib.sv │ │ │ ├── hawk_os_mem_seq.sv │ │ │ ├── hawk_mon.sv │ │ │ ├── hawk_drv.sv │ │ │ ├── hawk_os_sqr.sv │ │ │ └── hawk_trans_item.sv │ │ ├── uvm │ │ │ ├── 1_1d │ │ │ │ ├── uvm.flist │ │ │ │ └── src │ │ │ │ │ ├── seq │ │ │ │ │ ├── uvm_sequencer_base.svh │ │ │ │ │ ├── uvm_sequencer_analysis_fifo.svh │ │ │ │ │ ├── uvm_seq.svh │ │ │ │ │ └── uvm_push_sequencer.svh │ │ │ │ │ ├── uvm.sv │ │ │ │ │ ├── tlm2 │ │ │ │ │ ├── uvm_tlm2.svh │ │ │ │ │ ├── uvm_tlm2_defines.svh │ │ │ │ │ ├── uvm_tlm2_exports.svh │ │ │ │ │ └── uvm_tlm2_ports.svh │ │ │ │ │ ├── dpi │ │ │ │ │ ├── uvm_dpi.cc │ │ │ │ │ ├── uvm_dpi.svh │ │ │ │ │ ├── Makefile │ │ │ │ │ ├── uvm_svcmd_dpi.svh │ │ │ │ │ └── uvm_regex.svh │ │ │ │ │ ├── uvm_pkg.sv │ │ │ │ │ ├── tlm1 │ │ │ │ │ └── uvm_tlm.svh │ │ │ │ │ ├── comps │ │ │ │ │ ├── uvm_comps.svh │ │ │ │ │ ├── uvm_env.svh │ │ │ │ │ ├── uvm_monitor.svh │ │ │ │ │ ├── uvm_scoreboard.svh │ │ │ │ │ └── uvm_subscriber.svh │ │ │ │ │ ├── base │ │ │ │ │ └── uvm_version.svh │ │ │ │ │ ├── deprecated │ │ │ │ │ └── readme.important │ │ │ │ │ ├── macros │ │ │ │ │ ├── uvm_version_defines.svh │ │ │ │ │ ├── uvm_reg_defines.svh │ │ │ │ │ └── uvm_undefineall.svh │ │ │ │ │ └── uvm_macros.svh │ │ │ ├── 1_2 │ │ │ │ ├── vcs.flist │ │ │ │ └── src │ │ │ │ │ ├── uvm.sv │ │ │ │ │ ├── tlm2 │ │ │ │ │ ├── uvm_tlm2.svh │ │ │ │ │ ├── uvm_tlm2_defines.svh │ │ │ │ │ ├── uvm_tlm2_exports.svh │ │ │ │ │ └── uvm_tlm2_ports.svh │ │ │ │ │ ├── dpi │ │ │ │ │ ├── uvm_hdl.c │ │ │ │ │ ├── uvm_dpi.cc │ │ │ │ │ ├── uvm_dpi.svh │ │ │ │ │ ├── Makefile │ │ │ │ │ ├── uvm_common.c │ │ │ │ │ ├── uvm_dpi.h │ │ │ │ │ ├── uvm_svcmd_dpi.svh │ │ │ │ │ └── uvm_regex.svh │ │ │ │ │ ├── dap │ │ │ │ │ ├── uvm_dap.svh │ │ │ │ │ └── uvm_set_get_dap_base.svh │ │ │ │ │ ├── tlm1 │ │ │ │ │ └── uvm_tlm.svh │ │ │ │ │ ├── uvm_pkg.sv │ │ │ │ │ ├── comps │ │ │ │ │ ├── uvm_comps.svh │ │ │ │ │ ├── uvm_env.svh │ │ │ │ │ ├── uvm_monitor.svh │ │ │ │ │ ├── uvm_scoreboard.svh │ │ │ │ │ └── uvm_subscriber.svh │ │ │ │ │ ├── deprecated │ │ │ │ │ └── readme.important │ │ │ │ │ ├── seq │ │ │ │ │ ├── uvm_sequencer_analysis_fifo.svh │ │ │ │ │ ├── uvm_seq.svh │ │ │ │ │ └── uvm_push_sequencer.svh │ │ │ │ │ ├── base │ │ │ │ │ └── uvm_version.svh │ │ │ │ │ ├── macros │ │ │ │ │ ├── uvm_global_defines.svh │ │ │ │ │ ├── uvm_reg_defines.svh │ │ │ │ │ └── uvm_undefineall.svh │ │ │ │ │ └── uvm_macros.svh │ │ │ └── README │ │ └── cmn │ │ │ ├── vcs.flist │ │ │ ├── cmn_clk_intf.sv │ │ │ ├── cmn_report_server.sv │ │ │ ├── cmn_rst_intf.sv │ │ │ ├── cmn_pkg.sv │ │ │ ├── cmn_uid.sv │ │ │ ├── cmn_tb_top.sv │ │ │ ├── cmn_objection.sv │ │ │ ├── cmn_macros.sv │ │ │ └── cmn_clk_drv.sv │ └── hawk │ │ ├── mentor.flist │ │ ├── vcs.flist │ │ ├── tests │ │ ├── basic.sv │ │ ├── link_level.sv │ │ ├── trans_level.sv │ │ ├── nak.sv │ │ ├── bad_crc.sv │ │ └── passive.sv │ │ ├── hawk_tb_top.sv │ │ └── regression.py └── README.md ├── recipes ├── 1.intf_macros.sv ├── 7.heartbeat_macros.sv ├── 9.topology_printing.sv ├── 11.uid.sv ├── 21.reg_background_cfg.sv ├── 6.objection.sv ├── 2.clk_drv.sv ├── 21.reg_background_vseq.sv ├── 18.lib_vseq.sv └── 18.lib_vseq_cfg.sv ├── misc └── cmn_seq_macros.sv └── design_patterns ├── cfg.sv └── agent.sv /hawkins/verif/vkits/global/vcs.flist: -------------------------------------------------------------------------------- 1 | +incdir+root/verif/vkits/global 2 | root/verif/vkits/global/global_pkg.sv 3 | 4 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/hawk/mentor.flist: -------------------------------------------------------------------------------- 1 | +incdir+hawk/verif/vkits/hawk 2 | hawk/verif/vkits/hawk/hawk_intf.sv 3 | hawk/verif/vkits/hawk/hawk_pkg.sv 4 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/hawk/vcs.flist: -------------------------------------------------------------------------------- 1 | +incdir+root/verif/vkits/hawk 2 | root/verif/vkits/hawk/hawk_intf.sv 3 | root/verif/vkits/hawk/hawk_pkg.sv 4 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_1d/uvm.flist: -------------------------------------------------------------------------------- 1 | +incdir+project/verif/vkits/uvm/1_1d/src 2 | +define+PROJ_INCLUDES_UVM 3 | project/verif/vkits/uvm/1_1d/src/uvm_pkg.sv 4 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_2/vcs.flist: -------------------------------------------------------------------------------- 1 | root/verif/vkits/uvm/1_2/src/dpi/uvm_dpi.cc 2 | 3 | +incdir+root/verif/vkits/uvm/1_2/src 4 | root/verif/vkits/uvm/1_2/src/uvm_pkg.sv 5 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_1d/src/seq/uvm_sequencer_base.svh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/advanced-uvm/second_edition/HEAD/hawkins/verif/vkits/uvm/1_1d/src/seq/uvm_sequencer_base.svh -------------------------------------------------------------------------------- /hawkins/verif/hawk/mentor.flist: -------------------------------------------------------------------------------- 1 | +incdir+hawk/verif/hawk 2 | +incdir+hawk/verif/uvm_common 3 | +incdir+hawk/verif/hdl 4 | +incdir+hawk/verif/hawk/tests 5 | hawk/verif/hawk/hawk_tb_top.sv 6 | hawk/verif/hawk/tests/basic.sv 7 | hawk/verif/hawk/tests/base_test.sv 8 | hawk/verif/hawk/tests/nak.sv 9 | hawk/verif/hawk/tests/bad_crc.sv 10 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/cmn/vcs.flist: -------------------------------------------------------------------------------- 1 | -P /nfs/cacadtools/synopsys/verdi/J-2014.12-SP1/share/PLI/VCS/LINUX64/novas.tab /nfs/cacadtools/synopsys/verdi/J-2014.12-SP1/share/PLI/VCS/LINUX64/pli.a 2 | +incdir+root/verif/vkits/cmn 3 | root/verif/vkits/cmn/cmn_clk_intf.sv 4 | root/verif/vkits/cmn/cmn_rst_intf.sv 5 | root/verif/vkits/cmn/cmn_pkg.sv 6 | -------------------------------------------------------------------------------- /hawkins/verif/hawk/vcs.flist: -------------------------------------------------------------------------------- 1 | -timescale=1ns/1fs 2 | -unit_timescale=1ns/1fs 3 | -sverilog 4 | +libext+.v+.sv 5 | +vcsd 6 | -debug_pp 7 | +define+UVM_USE_RESOURCE_CONVERTER 8 | 9 | -f root/verif/vkits/uvm/1_2/vcs.flist 10 | -f root/verif/vkits/cmn/vcs.flist 11 | -f root/verif/vkits/global/vcs.flist 12 | -f root/verif/vkits/hawk/vcs.flist 13 | 14 | +incdir+root/verif/hawk 15 | +incdir+root/verif/uvm_common 16 | +incdir+root/verif/hdl 17 | +incdir+tests 18 | hawk_tb_top.sv 19 | tests/basic.sv 20 | tests/base_test.sv 21 | tests/nak.sv 22 | tests/bad_crc.sv 23 | tests/link_level.sv 24 | tests/trans_level.sv 25 | tests/passive.sv 26 | 27 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/cmn/cmn_clk_intf.sv: -------------------------------------------------------------------------------- 1 | 2 | // *********************************************************************** 3 | // File: cmn_clk_intf.sv 4 | // Author: bhunter 5 | /* About: Common Clock Interface 6 | Copyright (C) 2015-2016 Cavium, Inc. All rights reserved. 7 | *************************************************************************/ 8 | 9 | 10 | `ifndef __CMN_CLK_INTF_SV__ 11 | `define __CMN_CLK_INTF_SV__ 12 | 13 | // class: cmn_clk_intf 14 | // A simple interface holding the clock wire, and it's ideal clock 15 | interface cmn_clk_intf(); 16 | 17 | //---------------------------------------------------------------------------------------- 18 | // Group: Signals 19 | logic clk; 20 | 21 | endinterface : cmn_clk_intf 22 | 23 | `endif // __CMN_CLK_INTF_SV__ 24 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/global/global_pkg.sv: -------------------------------------------------------------------------------- 1 | // *********************************************************************** 2 | // File: global_pkg.sv 3 | // Author: bhunter 4 | /* About: Global Package 5 | Copyright (C) 2015-2016 Cavium, Inc. All rights reserved. 6 | *************************************************************************/ 7 | 8 | 9 | `include "uvm_macros.svh" 10 | `include "cmn_macros.sv" 11 | `include "global_macros.sv" 12 | 13 | package global_pkg; 14 | 15 | //-------------------------------------------------------------------------- 16 | // Group: Imports 17 | import uvm_pkg::*; 18 | 19 | //-------------------------------------------------------------------------- 20 | // Group: Includes 21 | `include "global_heartbeat_mon.sv" 22 | `include "global_watchdog.sv" 23 | `include "global_env.sv" 24 | 25 | endpackage : global_pkg 26 | 27 | 28 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/cmn/cmn_report_server.sv: -------------------------------------------------------------------------------- 1 | 2 | // *********************************************************************** 3 | // File: cmn_report_server.sv 4 | // Author: bhunter 5 | /* About: Basic test extends the base test and starts a training sequence 6 | on both the RX and TX agent. This is done here to show that 7 | numerous sequences can be started independently on a chaining 8 | sequencer. 9 | Copyright (C) 2015-2016 Cavium, Inc. All rights reserved. 10 | *************************************************************************/ 11 | 12 | `ifndef __CMN_REPORT_SERVER_SV__ 13 | `define __CMN_REPORT_SERVER_SV__ 14 | 15 | `ifdef UVM_MAJOR_VERSION_1_1 16 | `include "cmn_report_server_1_1.sv" 17 | `endif // UVM_MAJOR_VERSION_1_1 18 | 19 | `ifdef UVM_MAJOR_VERSION_1_2 20 | `include "cmn_report_server_1_2.sv" 21 | `endif // UVM_MAJOR_VERSION_1_2 22 | 23 | `endif // __CMN_REPORT_SERVER_SV__ 24 | -------------------------------------------------------------------------------- /recipes/1.intf_macros.sv: -------------------------------------------------------------------------------- 1 | // *********************************************************************** 2 | // File: 1.intf_macros.sv 3 | // Author: bhunter 4 | /* About: 5 | Copyright (C) 2015-2016 Cavium, Inc. All rights reserved. 6 | *************************************************************************/ 7 | 8 | `ifndef __1_INTF_MACROS_SV__ 9 | `define __1_INTF_MACROS_SV__ 10 | 11 | `define cmn_set_intf(TYPE, RSRC, NAME, INSTANCE) \ 12 | begin uvm_resource_db#(TYPE)::set(RSRC, NAME, INSTANCE); end 13 | 14 | `define cmn_get_intf(TYPE, RSRC, NAME, VARIABLE) \ 15 | begin \ 16 | if(!uvm_resource_db#(TYPE)::read_by_name(RSRC, NAME, VARIABLE)) \ 17 | `cmn_err(("%s.%s interface not found in resource database.", RSRC, NAME)); \ 18 | end 19 | 20 | `endif // __1_INTF_MACROS_SV__ 21 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/cmn/cmn_rst_intf.sv: -------------------------------------------------------------------------------- 1 | 2 | // *********************************************************************** 3 | // File: cmn_rst_intf.sv 4 | // Author: bhunter 5 | /* About: Common Reset Interface 6 | Copyright (C) 2015-2016 Cavium, Inc. All rights reserved. 7 | *************************************************************************/ 8 | 9 | 10 | `ifndef __CMN_RST_INTF_SV__ 11 | `define __CMN_RST_INTF_SV__ 12 | 13 | // class: cmn_rst_intf 14 | interface cmn_rst_intf(input logic clk); 15 | 16 | //---------------------------------------------------------------------------------------- 17 | // Group: Signals 18 | 19 | logic rst_n; 20 | 21 | //---------------------------------------------------------------------------------------- 22 | // Group: Clocking blocks 23 | clocking cb @(posedge clk); 24 | output rst_n; 25 | endclocking : cb 26 | 27 | endinterface : cmn_rst_intf 28 | 29 | `endif // __CMN_RST_INTF_SV__ 30 | -------------------------------------------------------------------------------- /recipes/7.heartbeat_macros.sv: -------------------------------------------------------------------------------- 1 | // *********************************************************************** 2 | // File: 7.heartbeat_macros.sv 3 | // Author: bhunter 4 | /* About: 5 | Copyright (C) 2015-2016 Cavium, Inc. All rights reserved. 6 | *************************************************************************/ 7 | 8 | `ifndef __7_HEARTBEAT_MACROS_SV__ 9 | `define __7_HEARTBEAT_MACROS_SV__ 10 | 11 | //////////////////////////////////////////// 12 | // macro: global_heartbeat 13 | // Called by registered monitors to indicate that the DUT is still alive 14 | `define global_heartbeat(str) begin global_env.heartbeat_mon.raise(this); end 15 | 16 | //////////////////////////////////////////// 17 | // macro: global_add_to_heartbeat_mon 18 | // Called by components to register themselves with the heartbeat monitor 19 | // t : A time field that indicates what the drain time is for this component 20 | `define global_add_to_heartbeat_mon(t) begin global_env.heartbeat_mon.register(this, t); end 21 | 22 | `endif // __7_HEARTBEAT_MACROS_SV__ 23 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_2/src/uvm.sv: -------------------------------------------------------------------------------- 1 | // 2 | //---------------------------------------------------------------------- 3 | // Copyright 2007-2011 Mentor Graphics Corporation 4 | // Copyright 2007-2010 Cadence Design Systems, Inc. 5 | // Copyright 2010-2011 Synopsys, Inc. 6 | // All Rights Reserved Worldwide 7 | // 8 | // Licensed under the Apache License, Version 2.0 (the 9 | // "License"); you may not use this file except in 10 | // compliance with the License. You may obtain a copy of 11 | // the License at 12 | // 13 | // http://www.apache.org/licenses/LICENSE-2.0 14 | // 15 | // Unless required by applicable law or agreed to in 16 | // writing, software distributed under the License is 17 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 18 | // CONDITIONS OF ANY KIND, either express or implied. See 19 | // the License for the specific language governing 20 | // permissions and limitations under the License. 21 | //---------------------------------------------------------------------- 22 | 23 | `include "uvm_pkg.sv" 24 | 25 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_1d/src/uvm.sv: -------------------------------------------------------------------------------- 1 | // 2 | //---------------------------------------------------------------------- 3 | // Copyright 2007-2011 Mentor Graphics Corporation 4 | // Copyright 2007-2010 Cadence Design Systems, Inc. 5 | // Copyright 2010-2011 Synopsys, Inc. 6 | // All Rights Reserved Worldwide 7 | // 8 | // Licensed under the Apache License, Version 2.0 (the 9 | // "License"); you may not use this file except in 10 | // compliance with the License. You may obtain a copy of 11 | // the License at 12 | // 13 | // http://www.apache.org/licenses/LICENSE-2.0 14 | // 15 | // Unless required by applicable law or agreed to in 16 | // writing, software distributed under the License is 17 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 18 | // CONDITIONS OF ANY KIND, either express or implied. See 19 | // the License for the specific language governing 20 | // permissions and limitations under the License. 21 | //---------------------------------------------------------------------- 22 | 23 | `include "uvm_pkg.sv" 24 | 25 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/cmn/cmn_pkg.sv: -------------------------------------------------------------------------------- 1 | 2 | // *********************************************************************** 3 | // File: cmn_pkg.sv 4 | // Author: bhunter 5 | /* About: Common package 6 | Copyright (C) 2015-2016 Cavium, Inc. All rights reserved. 7 | *************************************************************************/ 8 | 9 | `include "uvm_macros.svh" 10 | `include "cmn_macros.sv" 11 | 12 | // package: cmn_pkg 13 | package cmn_pkg; 14 | 15 | //---------------------------------------------------------------------------------------- 16 | // Imports 17 | import uvm_pkg::*; 18 | localparam UVM_COMPONENT = UVM_NOPACK | UVM_NOCOMPARE | UVM_NOCOPY; 19 | 20 | //---------------------------------------------------------------------------------------- 21 | // Includes 22 | 23 | `include "cmn_clk_drv.sv" 24 | `include "cmn_cseq.sv" 25 | `include "cmn_csqr.sv" 26 | `include "cmn_msgs.sv" 27 | `include "cmn_objection.sv" 28 | `include "cmn_rand_delays.sv" 29 | `include "cmn_report_server.sv" 30 | `include "cmn_rst_drv.sv" 31 | `include "cmn_uid.sv" 32 | 33 | endpackage : cmn_pkg 34 | 35 | -------------------------------------------------------------------------------- /hawkins/verif/hawk/tests/basic.sv: -------------------------------------------------------------------------------- 1 | 2 | // *********************************************************************** 3 | // File: basic.sv 4 | // Author: bhunter 5 | /* About: Basic test extends the base test and starts a training sequence 6 | on both the RX and TX agent. This is done here to show that 7 | numerous sequences can be started independently on a chaining 8 | sequencer. 9 | Copyright (C) 2015-2016 Cavium, Inc. All rights reserved. 10 | *************************************************************************/ 11 | 12 | `ifndef __BASIC_SV__ 13 | `define __BASIC_SV__ 14 | 15 | `include "base_test.sv" 16 | 17 | // class: basic_test_c 18 | class basic_test_c extends base_test_c; 19 | `uvm_component_utils_begin(basic_test_c) 20 | `uvm_component_utils_end 21 | 22 | //---------------------------------------------------------------------------------------- 23 | // Group: Methods 24 | function new(string name="", 25 | uvm_component parent=null); 26 | super.new(name, parent); 27 | endfunction : new 28 | endclass : basic_test_c 29 | 30 | `endif // __BASIC_SV__ 31 | 32 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/hawk/hawk_mem.sv: -------------------------------------------------------------------------------- 1 | 2 | // *********************************************************************** 3 | // File: hawk_mem.sv 4 | // Author: bhunter 5 | /* About: Contains the memory of an agent. 6 | Copyright (C) 2015-2016 Brian P. Hunter 7 | *************************************************************************/ 8 | 9 | `ifndef __HAWK_MEM_SV__ 10 | `define __HAWK_MEM_SV__ 11 | 12 | `include "hawk_types.sv" 13 | 14 | // class: mem 15 | // Just holds a memory. More advanced stuff if you need it. 16 | class mem_c extends uvm_component; 17 | `uvm_component_utils_begin(hawk_pkg::mem_c) 18 | `uvm_component_utils_end 19 | 20 | //---------------------------------------------------------------------------------------- 21 | // Group: Fields 22 | 23 | // var: memory 24 | // The actual memory values of this node. May be written to or read from. 25 | data_t memory[addr_t]; 26 | 27 | //---------------------------------------------------------------------------------------- 28 | // Group: Methods 29 | function new(string name="mem", 30 | uvm_component parent=null); 31 | super.new(name, parent); 32 | endfunction : new 33 | endclass : mem_c 34 | 35 | `endif // __HAWK_MEM_SV__ 36 | 37 | -------------------------------------------------------------------------------- /recipes/9.topology_printing.sv: -------------------------------------------------------------------------------- 1 | // *********************************************************************** 2 | // File: 9.topology_printing.sv 3 | // Author: bhunter 4 | /* About: 5 | Copyright (C) 2015-2016 Cavium, Inc. All rights reserved. 6 | *************************************************************************/ 7 | 8 | `ifndef __9_TOPOLOGY_PRINTING_SV__ 9 | `define __9_TOPOLOGY_PRINTING_SV__ 10 | 11 | //////////////////////////////////////////// 12 | // func: start_of_simulation_phase 13 | // Print the topology 14 | virtual function void start_of_simulation_phase(uvm_phase phase); 15 | int topo_depth; 16 | super.start_of_simulation_phase(phase); 17 | 18 | // print the topology only if TOPO is a plusarg 19 | if(!$value$plusargs("TOPO=%d", topo_depth)) 20 | return; 21 | else begin 22 | global_table_printer_c printer = new(); 23 | string topology; 24 | 25 | printer.knobs.depth = topo_depth; 26 | printer.knobs.indent = 3; 27 | 28 | topology = uvm_top.sprint(printer); 29 | `cmn_info(("Printing the topology at depth %0d:\n%s", depth, topology)) 30 | end 31 | endfunction : start_of_simulation_phase 32 | 33 | `endif // __9_TOPOLOGY_PRINTING_SV__ 34 | -------------------------------------------------------------------------------- /hawkins/verif/hawk/tests/link_level.sv: -------------------------------------------------------------------------------- 1 | 2 | // *********************************************************************** 3 | // File: link_level.sv 4 | // Author: bhunter 5 | /* About: Run without the PHY level enabled. 6 | Copyright (C) 2015-2016 Cavium, Inc. All rights reserved. 7 | *************************************************************************/ 8 | 9 | `ifndef __LINK_LEVEL_SV__ 10 | `define __LINK_LEVEL_SV__ 11 | 12 | `include "basic.sv" 13 | 14 | // class: link_level_test_c 15 | class link_level_test_c extends basic_test_c; 16 | `uvm_component_utils(link_level_test_c) 17 | 18 | //---------------------------------------------------------------------------------------- 19 | // Group: Methods 20 | function new(string name="link_level", 21 | uvm_component parent=null); 22 | super.new(name, parent); 23 | endfunction : new 24 | 25 | //////////////////////////////////////////// 26 | // func: build_phase 27 | // Do not enable the phy level stuff. 28 | virtual function void build_phase(uvm_phase phase); 29 | uvm_config_db#(int)::set(this, "hawk_env", "phy_enable", 0); 30 | super.build_phase(phase); 31 | endfunction : build_phase 32 | 33 | endclass : link_level_test_c 34 | 35 | `endif // __LINK_LEVEL_SV__ 36 | 37 | -------------------------------------------------------------------------------- /hawkins/verif/hawk/tests/trans_level.sv: -------------------------------------------------------------------------------- 1 | 2 | // *********************************************************************** 3 | // File: trans_level.sv 4 | // Author: bhunter 5 | /* About: Run test with neither the PHY nor the LINK level sequences populated. 6 | Copyright (C) 2015-2016 Cavium, Inc. All rights reserved. 7 | *************************************************************************/ 8 | 9 | `ifndef __TRANS_LEVEL_SV__ 10 | `define __TRANS_LEVEL_SV__ 11 | 12 | `include "basic.sv" 13 | 14 | // class: trans_level_test_c 15 | class trans_level_test_c extends basic_test_c; 16 | `uvm_component_utils(trans_level_test_c) 17 | 18 | //---------------------------------------------------------------------------------------- 19 | // Group: Methods 20 | function new(string name="trans_level", 21 | uvm_component parent=null); 22 | super.new(name, parent); 23 | endfunction : new 24 | 25 | //////////////////////////////////////////// 26 | // func: build_phase 27 | virtual function void build_phase(uvm_phase phase); 28 | super.build_phase(phase); 29 | uvm_config_db#(int)::set(this, "hawk_env", "link_enable", 0); 30 | endfunction : build_phase 31 | 32 | endclass : trans_level_test_c 33 | 34 | `endif // __TRANS_LEVEL_SV__ 35 | 36 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_1d/src/tlm2/uvm_tlm2.svh: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------- 2 | // Copyright 2010 Mentor Graphics Corporation 3 | // Copyright 2010 Synopsys, Inc. 4 | // All Rights Reserved Worldwide 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the 7 | // "License"); you may not use this file except in 8 | // compliance with the License. You may obtain a copy of 9 | // the License at 10 | // 11 | // http://www.apache.org/licenses/LICENSE-2.0 12 | // 13 | // Unless required by applicable law or agreed to in 14 | // writing, software distributed under the License is 15 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 16 | // CONDITIONS OF ANY KIND, either express or implied. See 17 | // the License for the specific language governing 18 | // permissions and limitations under the License. 19 | //---------------------------------------------------------------------- 20 | 21 | `include "tlm2/uvm_tlm2_defines.svh" 22 | `include "tlm2/uvm_tlm2_time.svh" 23 | `include "tlm2/uvm_tlm2_generic_payload.svh" 24 | `include "tlm2/uvm_tlm2_ifs.svh" 25 | `include "tlm2/uvm_tlm2_imps.svh" 26 | `include "tlm2/uvm_tlm2_ports.svh" 27 | `include "tlm2/uvm_tlm2_exports.svh" 28 | `include "tlm2/uvm_tlm2_sockets_base.svh" 29 | `include "tlm2/uvm_tlm2_sockets.svh" 30 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_2/src/tlm2/uvm_tlm2.svh: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------- 2 | // Copyright 2010 Mentor Graphics Corporation 3 | // Copyright 2010 Synopsys, Inc. 4 | // All Rights Reserved Worldwide 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the 7 | // "License"); you may not use this file except in 8 | // compliance with the License. You may obtain a copy of 9 | // the License at 10 | // 11 | // http://www.apache.org/licenses/LICENSE-2.0 12 | // 13 | // Unless required by applicable law or agreed to in 14 | // writing, software distributed under the License is 15 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 16 | // CONDITIONS OF ANY KIND, either express or implied. See 17 | // the License for the specific language governing 18 | // permissions and limitations under the License. 19 | //---------------------------------------------------------------------- 20 | 21 | `include "tlm2/uvm_tlm2_defines.svh" 22 | `include "tlm2/uvm_tlm2_time.svh" 23 | `include "tlm2/uvm_tlm2_generic_payload.svh" 24 | `include "tlm2/uvm_tlm2_ifs.svh" 25 | `include "tlm2/uvm_tlm2_imps.svh" 26 | `include "tlm2/uvm_tlm2_ports.svh" 27 | `include "tlm2/uvm_tlm2_exports.svh" 28 | `include "tlm2/uvm_tlm2_sockets_base.svh" 29 | `include "tlm2/uvm_tlm2_sockets.svh" 30 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_2/src/dpi/uvm_hdl.c: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------- 2 | // Copyright 2007-2013 Cadence Design Systems, Inc. 3 | // Copyright 2009-2010 Mentor Graphics Corporation 4 | // Copyright 2010-2011 Synopsys, Inc. 5 | // All Rights Reserved Worldwide 6 | // 7 | // Licensed under the Apache License, Version 2.0 (the 8 | // "License"); you may not use this file except in 9 | // compliance with the License. You may obtain a copy of 10 | // the License at 11 | // 12 | // http://www.apache.org/licenses/LICENSE-2.0 13 | // 14 | // Unless required by applicable law or agreed to in 15 | // writing, software distributed under the License is 16 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 17 | // CONDITIONS OF ANY KIND, either express or implied. See 18 | // the License for the specific language governing 19 | // permissions and limitations under the License. 20 | //---------------------------------------------------------------------- 21 | 22 | // hdl vendor backends are defined for VCS,QUESTA,INCA 23 | #if defined(VCS) || defined(VCSMX) 24 | #include "uvm_hdl_vcs.c" 25 | #else 26 | #ifdef QUESTA 27 | #include "uvm_hdl_questa.c" 28 | #else 29 | #if defined(INCA) || defined(NCSC) 30 | #include "uvm_hdl_inca.c" 31 | #else 32 | #error "hdl vendor backend is missing" 33 | #endif 34 | #endif 35 | #endif 36 | 37 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/global/global_macros.sv: -------------------------------------------------------------------------------- 1 | // *********************************************************************** 2 | // File: global_macros.sv 3 | // Author: bhunter 4 | /* About: Global Macros 5 | Copyright (C) 2015-2016 Cavium, Inc. All rights reserved. 6 | *************************************************************************/ 7 | 8 | `ifndef __GLOBAL_MACROS_SV__ 9 | `define __GLOBAL_MACROS_SV__ 10 | 11 | `include "uvm_macros.svh" 12 | 13 | //---------------------------------------------------------------------------------------- 14 | // Includes 15 | 16 | //---------------------------------------------------------------------------------------- 17 | // Group: Macros 18 | 19 | //////////////////////////////////////////// 20 | // macro: global_heartbeat 21 | // Called by registered monitors to indicate that the DUT is still alive 22 | `define global_heartbeat(str) begin global_pkg::env.heartbeat_mon.raise(this, str, `uvm_file, `uvm_line); end 23 | 24 | //////////////////////////////////////////// 25 | // macro: global_add_to_heartbeat_mon 26 | // Called by components to register themselves with the heartbeat monitor 27 | // t : A time field that indicates what the drain time is for this component 28 | `define global_add_to_heartbeat_mon(t) begin global_pkg::env.heartbeat_mon.register(this, t); end 29 | 30 | `endif // __GLOBAL_MACROS_SV__ 31 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_2/src/dap/uvm_dap.svh: -------------------------------------------------------------------------------- 1 | // 2 | //------------------------------------------------------------------------------ 3 | // Copyright 2007-2011 Mentor Graphics Corporation 4 | // Copyright 2007-2011 Cadence Design Systems, Inc. 5 | // Copyright 2010-2011 Synopsys, Inc. 6 | // Copyright 2013 NVIDIA Corporation 7 | // All Rights Reserved Worldwide 8 | // 9 | // Licensed under the Apache License, Version 2.0 (the 10 | // "License"); you may not use this file except in 11 | // compliance with the License. You may obtain a copy of 12 | // the License at 13 | // 14 | // http://www.apache.org/licenses/LICENSE-2.0 15 | // 16 | // Unless required by applicable law or agreed to in 17 | // writing, software distributed under the License is 18 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 19 | // CONDITIONS OF ANY KIND, either express or implied. See 20 | // the License for the specific language governing 21 | // permissions and limitations under the License. 22 | //------------------------------------------------------------------------------ 23 | 24 | `ifndef UVM_DAP_SVH 25 | `define UVM_DAP_SVH 26 | 27 | // Set/Get DAPS 28 | `include "dap/uvm_set_get_dap_base.svh" 29 | `include "dap/uvm_simple_lock_dap.svh" 30 | `include "dap/uvm_get_to_lock_dap.svh" 31 | `include "dap/uvm_set_before_get_dap.svh" 32 | 33 | `endif // UVM_DAP_SVH 34 | 35 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_1d/src/dpi/uvm_dpi.cc: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------- 2 | // Copyright 2010 Synopsys, Inc. 3 | // Copyright 2011 Mentor Graphics Corporation 4 | // All Rights Reserved Worldwide 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the 7 | // "License"); you may not use this file except in 8 | // compliance with the License. You may obtain a copy of 9 | // the License at 10 | // 11 | // http://www.apache.org/licenses/LICENSE-2.0 12 | // 13 | // Unless required by applicable law or agreed to in 14 | // writing, software distributed under the License is 15 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 16 | // CONDITIONS OF ANY KIND, either express or implied. See 17 | // the License for the specific language governing 18 | // permissions and limitations under the License. 19 | //---------------------------------------------------------------------- 20 | 21 | // 22 | // Top-level file that includes all of the C/C++ files required 23 | // by UVM 24 | // 25 | // The C code may be compiled by compiling this top file only, 26 | // or by compiling individual files then linking them together. 27 | // 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | #include 34 | #include "uvm_regex.cc" 35 | #include "uvm_hdl.c" 36 | #include "uvm_svcmd_dpi.c" 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_1d/src/uvm_pkg.sv: -------------------------------------------------------------------------------- 1 | // 2 | //---------------------------------------------------------------------- 3 | // Copyright 2007-2011 Mentor Graphics Corporation 4 | // Copyright 2007-2010 Cadence Design Systems, Inc. 5 | // Copyright 2010-2011 Synopsys, Inc. 6 | // All Rights Reserved Worldwide 7 | // 8 | // Licensed under the Apache License, Version 2.0 (the 9 | // "License"); you may not use this file except in 10 | // compliance with the License. You may obtain a copy of 11 | // the License at 12 | // 13 | // http://www.apache.org/licenses/LICENSE-2.0 14 | // 15 | // Unless required by applicable law or agreed to in 16 | // writing, software distributed under the License is 17 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 18 | // CONDITIONS OF ANY KIND, either express or implied. See 19 | // the License for the specific language governing 20 | // permissions and limitations under the License. 21 | //---------------------------------------------------------------------- 22 | `ifndef UVM_PKG_SV 23 | `define UVM_PKG_SV 24 | 25 | `include "uvm_macros.svh" 26 | 27 | package uvm_pkg; 28 | 29 | `include "dpi/uvm_dpi.svh" 30 | `include "base/uvm_base.svh" 31 | `include "tlm1/uvm_tlm.svh" 32 | `include "comps/uvm_comps.svh" 33 | `include "seq/uvm_seq.svh" 34 | `include "tlm2/uvm_tlm2.svh" 35 | `include "reg/uvm_reg_model.svh" 36 | 37 | endpackage 38 | 39 | `endif 40 | 41 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/hawk/hawk_pkg.sv: -------------------------------------------------------------------------------- 1 | // *********************************************************************** 2 | // File: hawk_pkg.sv 3 | // Author: bhunter 4 | /* About: hawk package 5 | Copyright (C) 2015-2016 Brian P. Hunter 6 | *************************************************************************/ 7 | 8 | `include "uvm_macros.svh" 9 | 10 | // package: hawk_pkg 11 | package hawk_pkg; 12 | 13 | //---------------------------------------------------------------------------------------- 14 | // Group: Imports 15 | import uvm_pkg::*; 16 | 17 | //---------------------------------------------------------------------------------------- 18 | // Group: Includes 19 | 20 | `include "hawk_agent.sv" 21 | `include "hawk_cfg.sv" 22 | `include "hawk_drv.sv" 23 | `include "hawk_env.sv" 24 | `include "hawk_link_cseq.sv" 25 | `include "hawk_link_item.sv" 26 | `include "hawk_mem.sv" 27 | `include "hawk_mon.sv" 28 | `include "hawk_os_mem_seq.sv" 29 | `include "hawk_os_seq_lib.sv" 30 | `include "hawk_os_sqr.sv" 31 | `include "hawk_passive_drv.sv" 32 | `include "hawk_passive_trans_cseq.sv" 33 | `include "hawk_phy_cseq.sv" 34 | `include "hawk_phy_idle_seq.sv" 35 | `include "hawk_phy_item.sv" 36 | `include "hawk_phy_train_seq.sv" 37 | `include "hawk_csqr_lib.sv" 38 | `include "hawk_trans_cseq.sv" 39 | `include "hawk_trans_item.sv" 40 | `include "hawk_types.sv" 41 | 42 | endpackage : hawk_pkg 43 | 44 | 45 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_2/src/dpi/uvm_dpi.cc: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------- 2 | // Copyright 2010 Synopsys, Inc. 3 | // Copyright 2011 Mentor Graphics Corporation 4 | // All Rights Reserved Worldwide 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the 7 | // "License"); you may not use this file except in 8 | // compliance with the License. You may obtain a copy of 9 | // the License at 10 | // 11 | // http://www.apache.org/licenses/LICENSE-2.0 12 | // 13 | // Unless required by applicable law or agreed to in 14 | // writing, software distributed under the License is 15 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 16 | // CONDITIONS OF ANY KIND, either express or implied. See 17 | // the License for the specific language governing 18 | // permissions and limitations under the License. 19 | //---------------------------------------------------------------------- 20 | 21 | // 22 | // Top-level file that includes all of the C/C++ files required 23 | // by UVM 24 | // 25 | // The C code may be compiled by compiling this top file only, 26 | // or by compiling individual files then linking them together. 27 | // 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | #include 34 | #include "uvm_dpi.h" 35 | #include "uvm_common.c" 36 | #include "uvm_regex.cc" 37 | #include "uvm_hdl.c" 38 | #include "uvm_svcmd_dpi.c" 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | 44 | -------------------------------------------------------------------------------- /hawkins/verif/hawk/tests/nak.sv: -------------------------------------------------------------------------------- 1 | 2 | // *********************************************************************** 3 | // File: nak.sv 4 | // Author: bhunter 5 | /* About: Enable NAKs. 6 | Copyright (C) 2015-2016 Cavium, Inc. All rights reserved. 7 | *************************************************************************/ 8 | 9 | `ifndef __NAK_SV__ 10 | `define __NAK_SV__ 11 | 12 | `include "basic.sv" 13 | 14 | // class: nak_test_c 15 | class nak_test_c extends basic_test_c; 16 | `uvm_component_utils_begin(nak_test_c) 17 | `uvm_component_utils_end 18 | 19 | //---------------------------------------------------------------------------------------- 20 | // Group: Constraints 21 | 22 | // constraint: nak_pct_cnstr 23 | // Permit nak to be 2-3% 24 | constraint nak_pct_cnstr { 25 | cfg.nak_pct inside {2, 3}; 26 | } 27 | 28 | //---------------------------------------------------------------------------------------- 29 | // Group: Methods 30 | function new(string name="nak", 31 | uvm_component parent=null); 32 | super.new(name, parent); 33 | endfunction : new 34 | 35 | //////////////////////////////////////////// 36 | // func: randomize_cfg 37 | // Disable the L2 NAK Constraint 38 | virtual function void randomize_cfg(); 39 | cfg.L2_nak_pct_cnstr.constraint_mode(0); 40 | super.randomize_cfg(); 41 | endfunction : randomize_cfg 42 | 43 | endclass : nak_test_c 44 | 45 | `endif // __NAK_SV__ 46 | 47 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/hawk/hawk_phy_idle_seq.sv: -------------------------------------------------------------------------------- 1 | 2 | // *********************************************************************** 3 | // File: hawk_phy_idle_seq.sv 4 | // Author: bhunter 5 | /* About: Sends in training sequences every 2 us. Uses grab/ungrab 6 | because these run at the highest priority and must be 7 | consecutive. 8 | Copyright (C) 2015-2016 Brian P. Hunter 9 | *************************************************************************/ 10 | 11 | `ifndef __HAWK_PHY_IDLE_SEQ_SV__ 12 | `define __HAWK_PHY_IDLE_SEQ_SV__ 13 | 14 | `include "hawk_types.sv" 15 | `include "hawk_phy_item.sv" 16 | 17 | class phy_idle_seq_c extends uvm_sequence #(phy_item_c, phy_item_c); 18 | `uvm_object_utils(hawk_pkg::phy_idle_seq_c) 19 | 20 | //---------------------------------------------------------------------------------------- 21 | // Group: Methods 22 | function new(string name="phy_train_seq"); 23 | super.new(name); 24 | endfunction : new 25 | 26 | //////////////////////////////////////////// 27 | // func: body 28 | virtual task body(); 29 | byte unsigned idle_cnt = 0; 30 | phy_item_c idle_item; 31 | 32 | forever begin 33 | `uvm_do_pri_with(idle_item, IDLE_PRI, { 34 | valid == 0; 35 | data == idle_cnt; 36 | }) 37 | idle_cnt = (idle_cnt == 'hF0)? 0 : idle_cnt + 1; 38 | end 39 | endtask : body 40 | endclass : phy_idle_seq_c 41 | 42 | `endif // __HAWK_PHY_IDLE_SEQ_SV__ 43 | 44 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_1d/src/dpi/uvm_dpi.svh: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------- 2 | // Copyright 2010 Synopsys, Inc. 3 | // Copyright 2011 Mentor Graphics Corporation 4 | // All Rights Reserved Worldwide 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the 7 | // "License"); you may not use this file except in 8 | // compliance with the License. You may obtain a copy of 9 | // the License at 10 | // 11 | // http://www.apache.org/licenses/LICENSE-2.0 12 | // 13 | // Unless required by applicable law or agreed to in 14 | // writing, software distributed under the License is 15 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 16 | // CONDITIONS OF ANY KIND, either express or implied. See 17 | // the License for the specific language governing 18 | // permissions and limitations under the License. 19 | //---------------------------------------------------------------------- 20 | 21 | `ifndef UVM_DPI_SVH 22 | `define UVM_DPI_SVH 23 | 24 | // 25 | // Top-level file for DPI subroutines used by UVM. 26 | // 27 | // Tool-specific distribution overlays may be required. 28 | // 29 | // To use UVM without any tool-specific overlay, use +defin+UVM_NO_DPI 30 | // 31 | 32 | `ifdef UVM_NO_DPI 33 | `define UVM_HDL_NO_DPI 34 | `define UVM_REGEX_NO_DPI 35 | `define UVM_CMDLINE_NO_DPI 36 | `endif 37 | 38 | `include "dpi/uvm_hdl.svh" 39 | `include "dpi/uvm_svcmd_dpi.svh" 40 | `include "dpi/uvm_regex.svh" 41 | 42 | `endif // UVM_DPI_SVH 43 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_2/src/dpi/uvm_dpi.svh: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------- 2 | // Copyright 2010 Synopsys, Inc. 3 | // Copyright 2011 Mentor Graphics Corporation 4 | // All Rights Reserved Worldwide 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the 7 | // "License"); you may not use this file except in 8 | // compliance with the License. You may obtain a copy of 9 | // the License at 10 | // 11 | // http://www.apache.org/licenses/LICENSE-2.0 12 | // 13 | // Unless required by applicable law or agreed to in 14 | // writing, software distributed under the License is 15 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 16 | // CONDITIONS OF ANY KIND, either express or implied. See 17 | // the License for the specific language governing 18 | // permissions and limitations under the License. 19 | //---------------------------------------------------------------------- 20 | 21 | `ifndef UVM_DPI_SVH 22 | `define UVM_DPI_SVH 23 | 24 | // 25 | // Top-level file for DPI subroutines used by UVM. 26 | // 27 | // Tool-specific distribution overlays may be required. 28 | // 29 | // To use UVM without any tool-specific overlay, use +defin+UVM_NO_DPI 30 | // 31 | 32 | `ifdef UVM_NO_DPI 33 | `define UVM_HDL_NO_DPI 34 | `define UVM_REGEX_NO_DPI 35 | `define UVM_CMDLINE_NO_DPI 36 | `endif 37 | 38 | `include "dpi/uvm_hdl.svh" 39 | `include "dpi/uvm_svcmd_dpi.svh" 40 | `include "dpi/uvm_regex.svh" 41 | 42 | `endif // UVM_DPI_SVH 43 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_1d/src/tlm1/uvm_tlm.svh: -------------------------------------------------------------------------------- 1 | // 2 | //---------------------------------------------------------------------- 3 | // Copyright 2007-2011 Mentor Graphics Corporation 4 | // Copyright 2007-2010 Cadence Design Systems, Inc. 5 | // Copyright 2010 Synopsys, Inc. 6 | // All Rights Reserved Worldwide 7 | // 8 | // Licensed under the Apache License, Version 2.0 (the 9 | // "License"); you may not use this file except in 10 | // compliance with the License. You may obtain a copy of 11 | // the License at 12 | // 13 | // http://www.apache.org/licenses/LICENSE-2.0 14 | // 15 | // Unless required by applicable law or agreed to in 16 | // writing, software distributed under the License is 17 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 18 | // CONDITIONS OF ANY KIND, either express or implied. See 19 | // the License for the specific language governing 20 | // permissions and limitations under the License. 21 | //---------------------------------------------------------------------- 22 | 23 | `include "tlm1/uvm_tlm_ifs.svh" 24 | `include "tlm1/uvm_sqr_ifs.svh" 25 | `include "base/uvm_port_base.svh" 26 | 27 | `include "tlm1/uvm_tlm_imps.svh" 28 | 29 | `include "tlm1/uvm_imps.svh" 30 | `include "tlm1/uvm_ports.svh" 31 | `include "tlm1/uvm_exports.svh" 32 | `include "tlm1/uvm_analysis_port.svh" 33 | 34 | `include "tlm1/uvm_tlm_fifo_base.svh" 35 | `include "tlm1/uvm_tlm_fifos.svh" 36 | `include "tlm1/uvm_tlm_req_rsp.svh" 37 | 38 | `include "tlm1/uvm_sqr_connections.svh" 39 | 40 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_2/src/tlm1/uvm_tlm.svh: -------------------------------------------------------------------------------- 1 | // 2 | //---------------------------------------------------------------------- 3 | // Copyright 2007-2011 Mentor Graphics Corporation 4 | // Copyright 2007-2010 Cadence Design Systems, Inc. 5 | // Copyright 2010 Synopsys, Inc. 6 | // All Rights Reserved Worldwide 7 | // 8 | // Licensed under the Apache License, Version 2.0 (the 9 | // "License"); you may not use this file except in 10 | // compliance with the License. You may obtain a copy of 11 | // the License at 12 | // 13 | // http://www.apache.org/licenses/LICENSE-2.0 14 | // 15 | // Unless required by applicable law or agreed to in 16 | // writing, software distributed under the License is 17 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 18 | // CONDITIONS OF ANY KIND, either express or implied. See 19 | // the License for the specific language governing 20 | // permissions and limitations under the License. 21 | //---------------------------------------------------------------------- 22 | 23 | `include "tlm1/uvm_tlm_ifs.svh" 24 | `include "tlm1/uvm_sqr_ifs.svh" 25 | `include "base/uvm_port_base.svh" 26 | 27 | `include "tlm1/uvm_tlm_imps.svh" 28 | 29 | `include "tlm1/uvm_imps.svh" 30 | `include "tlm1/uvm_ports.svh" 31 | `include "tlm1/uvm_exports.svh" 32 | `include "tlm1/uvm_analysis_port.svh" 33 | 34 | `include "tlm1/uvm_tlm_fifo_base.svh" 35 | `include "tlm1/uvm_tlm_fifos.svh" 36 | `include "tlm1/uvm_tlm_req_rsp.svh" 37 | 38 | `include "tlm1/uvm_sqr_connections.svh" 39 | 40 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_2/src/uvm_pkg.sv: -------------------------------------------------------------------------------- 1 | // 2 | //---------------------------------------------------------------------- 3 | // Copyright 2007-2011 Mentor Graphics Corporation 4 | // Copyright 2007-2010 Cadence Design Systems, Inc. 5 | // Copyright 2010-2011 Synopsys, Inc. 6 | // Copyright 2013 NVIDIA, Corporation 7 | // All Rights Reserved Worldwide 8 | // 9 | // Licensed under the Apache License, Version 2.0 (the 10 | // "License"); you may not use this file except in 11 | // compliance with the License. You may obtain a copy of 12 | // the License at 13 | // 14 | // http://www.apache.org/licenses/LICENSE-2.0 15 | // 16 | // Unless required by applicable law or agreed to in 17 | // writing, software distributed under the License is 18 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 19 | // CONDITIONS OF ANY KIND, either express or implied. See 20 | // the License for the specific language governing 21 | // permissions and limitations under the License. 22 | //---------------------------------------------------------------------- 23 | `ifndef UVM_PKG_SV 24 | `define UVM_PKG_SV 25 | 26 | `include "uvm_macros.svh" 27 | 28 | package uvm_pkg; 29 | 30 | `include "dpi/uvm_dpi.svh" 31 | `include "base/uvm_base.svh" 32 | `include "dap/uvm_dap.svh" 33 | `include "tlm1/uvm_tlm.svh" 34 | `include "comps/uvm_comps.svh" 35 | `include "seq/uvm_seq.svh" 36 | `include "tlm2/uvm_tlm2.svh" 37 | `include "reg/uvm_reg_model.svh" 38 | 39 | endpackage 40 | 41 | `endif 42 | 43 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/hawk/hawk_intf.sv: -------------------------------------------------------------------------------- 1 | 2 | // *********************************************************************** 3 | // File: hawk_intf.sv 4 | // Author: bhunter 5 | /* About: A single HAWK interface. There should be one for RX and one for TX. 6 | Copyright (C) 2015-2016 Brian P. Hunter 7 | *************************************************************************/ 8 | 9 | `ifndef __HAWK_INTF_SV__ 10 | `define __HAWK_INTF_SV__ 11 | 12 | // class: hawk_intf 13 | interface hawk_intf(input logic clk, input logic rst_n); 14 | import uvm_pkg::*; 15 | 16 | //---------------------------------------------------------------------------------------- 17 | // Group: Signals 18 | 19 | // var: data 20 | // The byte-wide data signal 21 | logic [7:0] data; 22 | 23 | // var: valid 24 | // Valid wire 25 | logic valid; 26 | 27 | //---------------------------------------------------------------------------------------- 28 | // Group: Clocking blocks 29 | clocking drv_cb @(posedge clk); 30 | output data; 31 | output valid; 32 | input rst_n; 33 | endclocking : drv_cb 34 | 35 | clocking mon_cb @(posedge clk); 36 | input data; 37 | input valid; 38 | input rst_n; 39 | endclocking : mon_cb 40 | 41 | //---------------------------------------------------------------------------------------- 42 | // Group: Modports 43 | modport drv_mp(clocking drv_cb); 44 | modport mon_mp(clocking mon_cb); 45 | endinterface : hawk_intf 46 | 47 | `endif // __HAWK_INTF_SV__ 48 | 49 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/hawk/hawk_types.sv: -------------------------------------------------------------------------------- 1 | 2 | // *********************************************************************** 3 | // File: hawk_types.sv 4 | // Author: bhunter 5 | /* About: Contains enumerated types, etc. 6 | Copyright (C) 2015-2016 Brian P. Hunter 7 | *************************************************************************/ 8 | 9 | `ifndef __HAWK_TYPES_SV__ 10 | `define __HAWK_TYPES_SV__ 11 | 12 | `uvm_analysis_imp_decl(_inb_item) 13 | 14 | // type: addr_t 15 | // 64-bit addresses 16 | typedef bit[63:0] addr_t; 17 | 18 | // type: data_t 19 | // 64-bit data 20 | typedef bit[63:0] data_t; 21 | 22 | // type: tag_t 23 | // 4-bit tags 24 | typedef bit[3:0] tag_t; 25 | 26 | // enum: phy_char_e 27 | // PHY Characters 28 | typedef enum bit[8:0] { 29 | IDLE = 9'b000, // actual data between 00 and F0 stolen from link_id 30 | EOP = 9'h0FA, // end of packet 31 | ACK = 9'h0FC, // packet acknowledgement 32 | NAK = 9'h0FE, // packet not acknowledged 33 | TRAIN = 9'h0FF, // training sequence 34 | PKT = 9'h100 // holds packet data 35 | } phy_char_e; 36 | 37 | // enum: trans_cmd_e 38 | // transaction commands 39 | typedef enum bit[3:0] { 40 | RD = 4'h1, 41 | WR = 4'h2, 42 | RESP = 4'h4 43 | } trans_cmd_e; 44 | 45 | // enum: priority_e 46 | // Priorities for sending traffic 47 | typedef enum int { 48 | IDLE_PRI = 100, 49 | PKT_PRI = 200, 50 | REPLAY_PRI = 400, 51 | ACK_NAK_PRI = 500, 52 | TRAIN_PRI = 1000 53 | } priority_e; 54 | 55 | `endif // __HAWK_TYPES_SV__ 56 | 57 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/hawk/hawk_phy_train_seq.sv: -------------------------------------------------------------------------------- 1 | 2 | // *********************************************************************** 3 | // File: hawk_phy_train_seq.sv 4 | // Author: bhunter 5 | /* About: Sends in training sequences every 2 us. Uses grab/ungrab 6 | because these run at the highest priority and must be 7 | consecutive. 8 | Copyright (C) 2015-2016 Brian P. Hunter 9 | *************************************************************************/ 10 | 11 | `ifndef __HAWK_PHY_TRAIN_SEQ_SV__ 12 | `define __HAWK_PHY_TRAIN_SEQ_SV__ 13 | 14 | `include "hawk_types.sv" 15 | `include "hawk_phy_item.sv" 16 | 17 | class phy_train_seq_c extends uvm_sequence #(phy_item_c, phy_item_c); 18 | `uvm_object_utils(hawk_pkg::phy_train_seq_c) 19 | 20 | //---------------------------------------------------------------------------------------- 21 | // Group: Methods 22 | function new(string name="phy_train_seq"); 23 | super.new(name); 24 | endfunction : new 25 | 26 | //////////////////////////////////////////// 27 | // func: body 28 | virtual task body(); 29 | phy_item_c train_item; 30 | 31 | forever begin 32 | #(2us); 33 | `cmn_info(("Sending Training Sequence")) 34 | repeat(4) begin 35 | `uvm_do_pri_with(train_item, TRAIN_PRI, { 36 | valid == 0; 37 | data == TRAIN; 38 | }) 39 | end 40 | end 41 | endtask : body 42 | endclass : phy_train_seq_c 43 | 44 | `endif // __HAWK_PHY_TRAIN_SEQ_SV__ 45 | 46 | -------------------------------------------------------------------------------- /hawkins/verif/hawk/tests/bad_crc.sv: -------------------------------------------------------------------------------- 1 | 2 | // *********************************************************************** 3 | // File: bad_crc.sv 4 | // Author: bhunter 5 | /* About: Enable Bad CRC generation. 6 | Copyright (C) 2015-2016 Cavium, Inc. All rights reserved. 7 | *************************************************************************/ 8 | 9 | `ifndef __BAD_CRC_SV__ 10 | `define __BAD_CRC_SV__ 11 | 12 | `include "basic.sv" 13 | 14 | // class: bad_crc_test_c 15 | class bad_crc_test_c extends basic_test_c; 16 | `uvm_component_utils_begin(bad_crc_test_c) 17 | `uvm_component_utils_end 18 | 19 | //---------------------------------------------------------------------------------------- 20 | // Group: Constraints 21 | 22 | // constraint: bad_crc_pct_cnstr 23 | // Allow bad CRC's at a 5% rate 24 | constraint bad_crc_pct_cnstr { 25 | cfg.bad_crc_pct == 5; 26 | } 27 | 28 | //---------------------------------------------------------------------------------------- 29 | // Group: Methods 30 | function new(string name="bad_crc", 31 | uvm_component parent=null); 32 | super.new(name, parent); 33 | endfunction : new 34 | 35 | //////////////////////////////////////////// 36 | // func: randomize_cfg 37 | // Disable the L2_bad_crc_pct constraint 38 | virtual function void randomize_cfg(); 39 | cfg.L2_bad_crc_pct_cnstr.constraint_mode(0); 40 | super.randomize_cfg(); 41 | endfunction : randomize_cfg 42 | 43 | endclass : bad_crc_test_c 44 | 45 | `endif // __BAD_CRC_SV__ 46 | 47 | -------------------------------------------------------------------------------- /recipes/11.uid.sv: -------------------------------------------------------------------------------- 1 | // *********************************************************************** 2 | // File: 11.uid.sv 3 | // Author: bhunter 4 | /* About: 5 | Copyright (C) 2015-2016 Cavium, Inc. All rights reserved. 6 | *************************************************************************/ 7 | 8 | `ifndef __11_UID_SV__ 9 | `define __11_UID_SV__ 10 | 11 | class uid_c extends uvm_object; 12 | `uvm_object_utils(cmn_pkg::uid_c) 13 | //---------------------------------------------------------------------------------------- 14 | // Group: Fields 15 | // var: next_id_num 16 | // The next number for the given identifier 17 | static int unsigned next_id_num[string]; 18 | 19 | // var: my_id 20 | // The UID for this instance 21 | int unsigned my_id; 22 | 23 | //---------------------------------------------------------------------------------------- 24 | // Group: Methods 25 | // func: new 26 | // Create a unique ID and assign its ID 27 | function new(string name="uid"); 28 | super.new(name); 29 | if(next_id_num.exists(name)) 30 | next_id_num[name] += 1; 31 | else 32 | next_id_num[name] = 0; 33 | my_id = next_id_num[name]; 34 | endfunction : new 35 | 36 | //////////////////////////////////////////// 37 | // func: convert2string 38 | // Return this unique ID as a string 39 | virtual function string convert2string(); 40 | convert2string = $sformatf("%s:%05d", get_name(), my_id); 41 | endfunction : convert2string 42 | endclass : uid_c 43 | 44 | `endif // __11_UID_SV__ 45 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_1d/src/comps/uvm_comps.svh: -------------------------------------------------------------------------------- 1 | // 2 | //------------------------------------------------------------------------------ 3 | // Copyright 2007-2011 Mentor Graphics Corporation 4 | // Copyright 2007-2010 Cadence Design Systems, Inc. 5 | // Copyright 2010 Synopsys, Inc. 6 | // All Rights Reserved Worldwide 7 | // 8 | // Licensed under the Apache License, Version 2.0 (the 9 | // "License"); you may not use this file except in 10 | // compliance with the License. You may obtain a copy of 11 | // the License at 12 | // 13 | // http://www.apache.org/licenses/LICENSE-2.0 14 | // 15 | // Unless required by applicable law or agreed to in 16 | // writing, software distributed under the License is 17 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 18 | // CONDITIONS OF ANY KIND, either express or implied. See 19 | // the License for the specific language governing 20 | // permissions and limitations under the License. 21 | //------------------------------------------------------------------------------ 22 | 23 | `include "comps/uvm_pair.svh" 24 | `include "comps/uvm_policies.svh" 25 | `include "comps/uvm_in_order_comparator.svh" 26 | `include "comps/uvm_algorithmic_comparator.svh" 27 | `include "comps/uvm_random_stimulus.svh" 28 | `include "comps/uvm_subscriber.svh" 29 | 30 | `include "comps/uvm_monitor.svh" 31 | `include "comps/uvm_driver.svh" 32 | `include "comps/uvm_push_driver.svh" 33 | `include "comps/uvm_scoreboard.svh" 34 | `include "comps/uvm_agent.svh" 35 | `include "comps/uvm_env.svh" 36 | `include "comps/uvm_test.svh" 37 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_2/src/comps/uvm_comps.svh: -------------------------------------------------------------------------------- 1 | // 2 | //------------------------------------------------------------------------------ 3 | // Copyright 2007-2011 Mentor Graphics Corporation 4 | // Copyright 2007-2010 Cadence Design Systems, Inc. 5 | // Copyright 2010 Synopsys, Inc. 6 | // All Rights Reserved Worldwide 7 | // 8 | // Licensed under the Apache License, Version 2.0 (the 9 | // "License"); you may not use this file except in 10 | // compliance with the License. You may obtain a copy of 11 | // the License at 12 | // 13 | // http://www.apache.org/licenses/LICENSE-2.0 14 | // 15 | // Unless required by applicable law or agreed to in 16 | // writing, software distributed under the License is 17 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 18 | // CONDITIONS OF ANY KIND, either express or implied. See 19 | // the License for the specific language governing 20 | // permissions and limitations under the License. 21 | //------------------------------------------------------------------------------ 22 | 23 | `include "comps/uvm_pair.svh" 24 | `include "comps/uvm_policies.svh" 25 | `include "comps/uvm_in_order_comparator.svh" 26 | `include "comps/uvm_algorithmic_comparator.svh" 27 | `include "comps/uvm_random_stimulus.svh" 28 | `include "comps/uvm_subscriber.svh" 29 | 30 | `include "comps/uvm_monitor.svh" 31 | `include "comps/uvm_driver.svh" 32 | `include "comps/uvm_push_driver.svh" 33 | `include "comps/uvm_scoreboard.svh" 34 | `include "comps/uvm_agent.svh" 35 | `include "comps/uvm_env.svh" 36 | `include "comps/uvm_test.svh" 37 | -------------------------------------------------------------------------------- /misc/cmn_seq_macros.sv: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////// 2 | // macro: `cmn_seq_raise 3 | // Handy macro to ensure that all sequences raise the phase's objection if they are the default phase. 4 | `ifdef UVM_MAJOR_VERSION_1_1 5 | `define cmn_seq_raise \ 6 | begin \ 7 | if(starting_phase) \ 8 | starting_phase.raise_objection(this); \ 9 | end 10 | `endif 11 | 12 | `ifdef UVM_MAJOR_VERSION_1_2 13 | `define cmn_seq_raise \ 14 | begin \ 15 | if(get_starting_phase()) \ 16 | get_starting_phase().raise_objection(this); \ 17 | end 18 | `endif 19 | 20 | //////////////////////////////////////////// 21 | // macro: `cmn_seq_drop 22 | // Handy macro to ensure that all sequences drop the phase's objection if they are the default phase. 23 | `ifdef UVM_MAJOR_VERSION_1_1 24 | `define cmn_seq_drop \ 25 | begin \ 26 | if(starting_phase) \ 27 | starting_phase.drop_objection(this); \ 28 | end 29 | `endif 30 | 31 | `ifdef UVM_MAJOR_VERSION_1_2 32 | `define cmn_seq_drop \ 33 | begin \ 34 | if(get_starting_phase()) \ 35 | get_starting_phase().drop_objection(this); \ 36 | end 37 | `endif 38 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_1d/src/base/uvm_version.svh: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------- 2 | // Copyright 2007-2010 Mentor Graphics Corporation 3 | // Copyright 2007-2011 Cadence Design Systems, Inc. 4 | // Copyright 2010-2011 Synopsys, Inc. 5 | // All Rights Reserved Worldwide 6 | // 7 | // Licensed under the Apache License, Version 2.0 (the 8 | // "License"); you may not use this file except in 9 | // compliance with the License. You may obtain a copy of 10 | // the License at 11 | // 12 | // http://www.apache.org/licenses/LICENSE-2.0 13 | // 14 | // Unless required by applicable law or agreed to in 15 | // writing, software distributed under the License is 16 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 17 | // CONDITIONS OF ANY KIND, either express or implied. See 18 | // the License for the specific language governing 19 | // permissions and limitations under the License. 20 | //---------------------------------------------------------------------- 21 | 22 | `ifndef UVM_VERSION_SVH 23 | `define UVM_VERSION_SVH 24 | 25 | parameter string uvm_mgc_copyright = "(C) 2007-2013 Mentor Graphics Corporation"; 26 | parameter string uvm_cdn_copyright = "(C) 2007-2013 Cadence Design Systems, Inc."; 27 | parameter string uvm_snps_copyright = "(C) 2006-2013 Synopsys, Inc."; 28 | parameter string uvm_cy_copyright = "(C) 2011-2013 Cypress Semiconductor Corp."; 29 | parameter string uvm_revision = `UVM_VERSION_STRING; 30 | 31 | function string uvm_revision_string(); 32 | return uvm_revision; 33 | endfunction 34 | 35 | `endif // UVM_VERSION_SVH 36 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_1d/src/deprecated/readme.important: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------- 2 | // Copyright 2011 Mentor Graphics Corporation 3 | // Copyright 2011 Cadence Design Systems, Inc. 4 | // Copyright 2011 Synopsys, Inc. 5 | // All Rights Reserved Worldwide 6 | // 7 | // Licensed under the Apache License, Version 2.0 (the 8 | // "License"); you may not use this file except in 9 | // compliance with the License. You may obtain a copy of 10 | // the License at 11 | // 12 | // http://www.apache.org/licenses/LICENSE-2.0 13 | // 14 | // Unless required by applicable law or agreed to in 15 | // writing, software distributed under the License is 16 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 17 | // CONDITIONS OF ANY KIND, either express or implied. See 18 | // the License for the specific language governing 19 | // permissions and limitations under the License. 20 | //---------------------------------------------------------------------- 21 | 22 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 23 | PLEASE NOTE: 24 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 25 | 26 | Files and Types, Classes, Functions etc within this directory are considered as 27 | 28 | - an internal implementation detail 29 | - they shall NOT be used in USER code 30 | - they might be changed without any further notice in future versions of UVM 31 | - they might be removed in future versions of UVM 32 | - the functionality is completely undocumented 33 | - not part of the UVM standard 34 | 35 | 36 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_2/src/deprecated/readme.important: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------- 2 | // Copyright 2011 Mentor Graphics Corporation 3 | // Copyright 2011 Cadence Design Systems, Inc. 4 | // Copyright 2011 Synopsys, Inc. 5 | // All Rights Reserved Worldwide 6 | // 7 | // Licensed under the Apache License, Version 2.0 (the 8 | // "License"); you may not use this file except in 9 | // compliance with the License. You may obtain a copy of 10 | // the License at 11 | // 12 | // http://www.apache.org/licenses/LICENSE-2.0 13 | // 14 | // Unless required by applicable law or agreed to in 15 | // writing, software distributed under the License is 16 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 17 | // CONDITIONS OF ANY KIND, either express or implied. See 18 | // the License for the specific language governing 19 | // permissions and limitations under the License. 20 | //---------------------------------------------------------------------- 21 | 22 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 23 | PLEASE NOTE: 24 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 25 | 26 | Files and Types, Classes, Functions etc within this directory are considered as 27 | 28 | - an internal implementation detail 29 | - they shall NOT be used in USER code 30 | - they might be changed without any further notice in future versions of UVM 31 | - they might be removed in future versions of UVM 32 | - the functionality is completely undocumented 33 | - not part of the UVM standard 34 | 35 | 36 | -------------------------------------------------------------------------------- /recipes/21.reg_background_cfg.sv: -------------------------------------------------------------------------------- 1 | // *********************************************************************** 2 | // File: 21.reg_background_cfg.sv 3 | // Author: bhunter 4 | /* About: 5 | Copyright (C) 2015-2016 Brian P. Hunter 6 | *************************************************************************/ 7 | 8 | `ifndef __21_REG_BACKGROUND_CFG_SV__ 9 | `define __21_REG_BACKGROUND_CFG_SV__ 10 | 11 | `include "cmn_rand_delay.sv" 12 | 13 | // class: reg_background_cfg_c 14 | class reg_background_cfg_c extends uvm_object; 15 | `uvm_object_utils_begin(cmn_pkg::reg_background_cfg_c) 16 | `uvm_field_queue_string(exclude_regs, UVM_DEFAULT) 17 | `uvm_field_object(rand_delays, UVM_DEFAULT) 18 | `uvm_object_utils_end 19 | 20 | //---------------------------------------------------------------------------------------- 21 | // Group: Fields 22 | 23 | // var: exclude_regs 24 | // Registers that must be excluded 25 | string exclude_regs[$]; 26 | 27 | // var: exclude_types 28 | // A queue of register TYPE names that should also be excluded 29 | string exclude_types[$]; 30 | 31 | // var: rand_delays 32 | // A random delay object 33 | rand rand_delays_c rand_delays; 34 | 35 | //---------------------------------------------------------------------------------------- 36 | // Group: Methods 37 | function new(string name="reg_background_cfg"); 38 | super.new(name); 39 | // create the rand_delays object 40 | rand_delays = cmn_pkg::rand_delays_c::type_id::create("rand_delays"); 41 | endfunction : new 42 | endclass : reg_background_cfg_c 43 | 44 | `endif // __21_REG_BACKGROUND_CFG_SV__ 45 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_1d/src/seq/uvm_sequencer_analysis_fifo.svh: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------- 2 | // Copyright 2007-2011 Mentor Graphics Corporation 3 | // Copyright 2007-2010 Cadence Design Systems, Inc. 4 | // Copyright 2010 Synopsys, Inc. 5 | // All Rights Reserved Worldwide 6 | // 7 | // Licensed under the Apache License, Version 2.0 (the 8 | // "License"); you may not use this file except in 9 | // compliance with the License. You may obtain a copy of 10 | // the License at 11 | // 12 | // http://www.apache.org/licenses/LICENSE-2.0 13 | // 14 | // Unless required by applicable law or agreed to in 15 | // writing, software distributed under the License is 16 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 17 | // CONDITIONS OF ANY KIND, either express or implied. See 18 | // the License for the specific language governing 19 | // permissions and limitations under the License. 20 | //---------------------------------------------------------------------- 21 | 22 | 23 | class uvm_sequencer_analysis_fifo #(type RSP = uvm_sequence_item) extends uvm_tlm_fifo #(RSP); 24 | 25 | uvm_analysis_imp #(RSP, uvm_sequencer_analysis_fifo #(RSP)) analysis_export; 26 | uvm_sequencer_base sequencer_ptr; 27 | 28 | function new (string name, uvm_component parent = null); 29 | super.new(name, parent, 0); 30 | analysis_export = new ("analysis_export", this); 31 | endfunction 32 | 33 | function void write(input RSP t); 34 | if (sequencer_ptr == null) 35 | uvm_report_fatal ("SEQRNULL", "The sequencer pointer is null when attempting a write", UVM_NONE); 36 | sequencer_ptr.analysis_write(t); 37 | endfunction // void 38 | endclass 39 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_2/src/seq/uvm_sequencer_analysis_fifo.svh: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------- 2 | // Copyright 2007-2011 Mentor Graphics Corporation 3 | // Copyright 2007-2010 Cadence Design Systems, Inc. 4 | // Copyright 2010 Synopsys, Inc. 5 | // All Rights Reserved Worldwide 6 | // 7 | // Licensed under the Apache License, Version 2.0 (the 8 | // "License"); you may not use this file except in 9 | // compliance with the License. You may obtain a copy of 10 | // the License at 11 | // 12 | // http://www.apache.org/licenses/LICENSE-2.0 13 | // 14 | // Unless required by applicable law or agreed to in 15 | // writing, software distributed under the License is 16 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 17 | // CONDITIONS OF ANY KIND, either express or implied. See 18 | // the License for the specific language governing 19 | // permissions and limitations under the License. 20 | //---------------------------------------------------------------------- 21 | 22 | 23 | class uvm_sequencer_analysis_fifo #(type RSP = uvm_sequence_item) extends uvm_tlm_fifo #(RSP); 24 | 25 | uvm_analysis_imp #(RSP, uvm_sequencer_analysis_fifo #(RSP)) analysis_export; 26 | uvm_sequencer_base sequencer_ptr; 27 | 28 | function new (string name, uvm_component parent = null); 29 | super.new(name, parent, 0); 30 | analysis_export = new ("analysis_export", this); 31 | endfunction 32 | 33 | function void write(input RSP t); 34 | if (sequencer_ptr == null) 35 | uvm_report_fatal ("SEQRNULL", "The sequencer pointer is null when attempting a write", UVM_NONE); 36 | sequencer_ptr.analysis_write(t); 37 | endfunction // void 38 | endclass 39 | -------------------------------------------------------------------------------- /hawkins/README.md: -------------------------------------------------------------------------------- 1 | Layering Protocols With Chained Sequencers 2 | ========================================== 3 | 4 | This repository exists to provide working code that demonstrates the concept of chained sequencers, as presented in the textbook Advanced UVM (2nd edition) and in the SNUG 2016 Silicon Valley paper entitled "Layering Protocols With Chained Sequencers." 5 | 6 | This repository also demonstrates the coding guidelines presented within Advanced UVM and many of the other techniques described in that book. 7 | 8 | Because additional changes were made while authoring the SNUG 2016 paper, the current version of this code differs substantially from Chapter 5 of Advanced UVM, 1st edition. For this I deeply apologize. However, people who have already purchased the textbook should be aware that your purchase through Amazon also provides you with FREE access to the Kindle e-book version. The ebook version will be updated to reflect the numerous changes presented in the second edition. 9 | 10 | If you have not yet purchased Advanced UVM, what are you waiting for?!? 11 | 12 | Textbook + ebook: http://tinyurl.com/AdvancedUVM 13 | Kindle ebook: http://tinyurl.com/AdvancedUVM-ebook 14 | 15 | 16 | Scripts 17 | ======= 18 | 19 | The following scripts are rudimentary python scripts to launch the different tests in the verif/hawk directory. They very likely will need minor tweaks to work within your environment. 20 | 21 | verif/hawk/runme.py - Used to compile and launch a single test. 22 | verif/hawk/regression.py - Runs all tests. 23 | 24 | Questions? 25 | ========== 26 | 27 | Any and all questions can be emailed to the following address. I will do my best to answer them as soon as I can. 28 | 29 | advanced (dot) uvm (at) gmail (dot) com -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_2/src/base/uvm_version.svh: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------- 2 | // Copyright 2007-2010 Mentor Graphics Corporation 3 | // Copyright 2007-2011 Cadence Design Systems, Inc. 4 | // Copyright 2010-2011 Synopsys, Inc. 5 | // Copyright 2013-2014 NVIDIA Corporation 6 | // All Rights Reserved Worldwide 7 | // 8 | // Licensed under the Apache License, Version 2.0 (the 9 | // "License"); you may not use this file except in 10 | // compliance with the License. You may obtain a copy of 11 | // the License at 12 | // 13 | // http://www.apache.org/licenses/LICENSE-2.0 14 | // 15 | // Unless required by applicable law or agreed to in 16 | // writing, software distributed under the License is 17 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 18 | // CONDITIONS OF ANY KIND, either express or implied. See 19 | // the License for the specific language governing 20 | // permissions and limitations under the License. 21 | //---------------------------------------------------------------------- 22 | 23 | `ifndef UVM_VERSION_SVH 24 | `define UVM_VERSION_SVH 25 | 26 | parameter string uvm_mgc_copyright = "(C) 2007-2014 Mentor Graphics Corporation"; 27 | parameter string uvm_cdn_copyright = "(C) 2007-2014 Cadence Design Systems, Inc."; 28 | parameter string uvm_snps_copyright = "(C) 2006-2014 Synopsys, Inc."; 29 | parameter string uvm_cy_copyright = "(C) 2011-2013 Cypress Semiconductor Corp."; 30 | parameter string uvm_nv_copyright = "(C) 2013-2014 NVIDIA Corporation"; 31 | parameter string uvm_revision = `UVM_VERSION_STRING; 32 | 33 | function string uvm_revision_string(); 34 | return uvm_revision; 35 | endfunction 36 | 37 | `endif // UVM_VERSION_SVH 38 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_1d/src/dpi/Makefile: -------------------------------------------------------------------------------- 1 | #-*- mode: makefile;-*- 2 | # ****************************************************************************** 3 | # * CAVIUM NETWORKS CONFIDENTIAL * 4 | # * * 5 | # * PROPRIETARY NOTE * 6 | # * * 7 | # * This software contains information confidential and proprietary * 8 | # * to Cavium Networks. It shall not be reproduced in whole or in * 9 | # * part, or transferred to other documents, or disclosed to third * 10 | # * parties, or used for any purpose other than that for which it was * 11 | # * obtained, without the prior written consent of Cavium Networks. * 12 | # * (c) 2010, Cavium Networks. All rights reserved. * 13 | # * * 14 | # ****************************************************************************** 15 | # * File : Makefile 16 | # * Author : jschroeder 17 | # * Description : 18 | # * 19 | # ****************************************************************************** 20 | 21 | ifndef DVTOOLS_DIR 22 | export DVTOOLS_DIR := $(shell find_dvtools) 23 | endif 24 | 25 | 26 | EMPTY:= 27 | SP :=$(EMPTY) $(EMPTY) 28 | 29 | ROOT_DIR = $(shell project_dir --project) 30 | 31 | override LIB_DIR = ../../../../../lib 32 | 33 | #point to a directory where it won't find anything 34 | override SRC_DIRS=../.. 35 | 36 | #only build this one file which includes all the other files 37 | override CC_FILES=uvm_dpi.cc 38 | 39 | include $(DVTOOLS_DIR)/lib/Makefile.vkit 40 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_2/src/dpi/Makefile: -------------------------------------------------------------------------------- 1 | #-*- mode: makefile;-*- 2 | # ****************************************************************************** 3 | # * CAVIUM NETWORKS CONFIDENTIAL * 4 | # * * 5 | # * PROPRIETARY NOTE * 6 | # * * 7 | # * This software contains information confidential and proprietary * 8 | # * to Cavium Networks. It shall not be reproduced in whole or in * 9 | # * part, or transferred to other documents, or disclosed to third * 10 | # * parties, or used for any purpose other than that for which it was * 11 | # * obtained, without the prior written consent of Cavium Networks. * 12 | # * (c) 2010, Cavium Networks. All rights reserved. * 13 | # * * 14 | # ****************************************************************************** 15 | # * File : Makefile 16 | # * Author : jschroeder 17 | # * Description : 18 | # * 19 | # ****************************************************************************** 20 | 21 | ifndef DVTOOLS_DIR 22 | export DVTOOLS_DIR := $(shell find_dvtools) 23 | endif 24 | 25 | 26 | EMPTY:= 27 | SP :=$(EMPTY) $(EMPTY) 28 | 29 | ROOT_DIR = $(shell project_dir --project) 30 | 31 | override LIB_DIR = ../../../../../lib 32 | 33 | #point to a directory where it won't find anything 34 | override SRC_DIRS=../.. 35 | 36 | #only build this one file which includes all the other files 37 | override CC_FILES=uvm_dpi.cc 38 | 39 | include $(DVTOOLS_DIR)/lib/Makefile.vkit 40 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/README: -------------------------------------------------------------------------------- 1 | 213686 uvm: have the reg map print its full name on an error, so we know where to debug. 2 | 3 | 195649 fix for 1_1d for uvm_reg::XatomicX function see http://osqa.caveonetworks.com/questions/523/uvm_reg-xatomicx-function-is-broken-in-uvm-11d-and-probably-12 4 | 5 | 190105 1_2 with Cavium changes from r146137 (1_1d) 6 | 7 | 152780 Synopsys' sparse register model 8 | 9 | 125777 Fixed endif comment to make Eclipse/DVT happy 10 | 11 | 125424 1_1c has changes that correlate with those in 1_1b @124394. 12 | 13 | 125203 A clean uvm 1_1c src. 14 | 15 | Since we are aparently not capable of keeping this area in a relatively clean 16 | svn state, this readme file will serve as a log of which commits actually 17 | provide content change. 18 | 19 | Hopefully this will be useful when we migrate to the next version of UVM so 20 | that it is easy to apply all the necessary patches. 21 | 22 | 124394 Temporary fix to stop putting NO_REG_HW_RESET_TEST entries into the 23 | resource db per uvm_reg_field 24 | 25 | 124095 Fixed potential issue in uvm_re_match which isn't in 1_1c, we probably 26 | won't hit it as the code only comes into play when not using DPI for 27 | regexp matching 28 | 29 | 123683 Performance tune the reg's change, don't make local variables unless 30 | needed for an error printout 31 | 32 | 123574 Reapply John's prior fixes at 117393 and 117477 that were missed 33 | 34 | 123300 Added full_name to TLM port "too few connections" error 35 | 36 | 121460 Remove all direct calls to area_utils from the o78 tree 37 | 38 | 121370 Change dpi to svn ignore obj directory, and add Makefile previously 39 | added ... 40 | 41 | 121316 This is a summary commit of all the changes we have made to the uvm 42 | source ... 43 | 44 | 121313 This is a clean uvm 1_1b src and uvm.flist 45 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_2/src/dpi/uvm_common.c: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------- 2 | // Copyright 2010 Synopsys, Inc. 3 | // Copyright 2011 Mentor Graphics Corporation 4 | // Copyright 2013 NVIDIA Corporation 5 | // All Rights Reserved Worldwide 6 | // 7 | // Licensed under the Apache License, Version 2.0 (the 8 | // "License"); you may not use this file except in 9 | // compliance with the License. You may obtain a copy of 10 | // the License at 11 | // 12 | // http://www.apache.org/licenses/LICENSE-2.0 13 | // 14 | // Unless required by applicable law or agreed to in 15 | // writing, software distributed under the License is 16 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 17 | // CONDITIONS OF ANY KIND, either express or implied. See 18 | // the License for the specific language governing 19 | // permissions and limitations under the License. 20 | //---------------------------------------------------------------------- 21 | 22 | // Implementation of common methods for DPI 23 | 24 | extern void m__uvm_report_dpi(int,const char*,const char*,int,const char*, int); 25 | 26 | #if defined(INCA) || defined(NCSC) 27 | const static char* uvm_package_scope_name = "uvm_pkg::"; 28 | #else 29 | const static char* uvm_package_scope_name = "uvm_pkg"; 30 | #endif 31 | 32 | void m_uvm_report_dpi( int severity, 33 | char* id, 34 | char* message, 35 | int verbosity, 36 | char* file, 37 | int linenum) { 38 | svScope old_scope = svSetScope(svGetScopeFromName(uvm_package_scope_name)); 39 | m__uvm_report_dpi(severity, id, message, verbosity, file, linenum); 40 | svSetScope(old_scope); 41 | } 42 | 43 | 44 | int int_str_max ( int radix_bits ) { 45 | int val = INT_MAX; 46 | int ret = 1; 47 | while ((val = (val /radix_bits))) 48 | ret++; 49 | return ret; 50 | } 51 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_1d/src/seq/uvm_seq.svh: -------------------------------------------------------------------------------- 1 | // 2 | //------------------------------------------------------------------------------ 3 | // Copyright 2007-2011 Mentor Graphics Corporation 4 | // Copyright 2007-2010 Cadence Design Systems, Inc. 5 | // Copyright 2010 Synopsys, Inc. 6 | // All Rights Reserved Worldwide 7 | // 8 | // Licensed under the Apache License, Version 2.0 (the 9 | // "License"); you may not use this file except in 10 | // compliance with the License. You may obtain a copy of 11 | // the License at 12 | // 13 | // http://www.apache.org/licenses/LICENSE-2.0 14 | // 15 | // Unless required by applicable law or agreed to in 16 | // writing, software distributed under the License is 17 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 18 | // CONDITIONS OF ANY KIND, either express or implied. See 19 | // the License for the specific language governing 20 | // permissions and limitations under the License. 21 | //------------------------------------------------------------------------------ 22 | 23 | `include "seq/uvm_sequence_item.svh" 24 | `include "seq/uvm_sequencer_base.svh" 25 | `include "seq/uvm_sequencer_analysis_fifo.svh" 26 | `include "seq/uvm_sequencer_param_base.svh" 27 | `include "seq/uvm_sequencer.svh" 28 | `include "seq/uvm_push_sequencer.svh" 29 | `include "seq/uvm_sequence_base.svh" 30 | `include "seq/uvm_sequence.svh" 31 | `include "seq/uvm_sequence_library.svh" 32 | 33 | 34 | `include "seq/uvm_sequence_builtin.svh" 35 | 36 | typedef uvm_sequence #(uvm_sequence_item, uvm_sequence_item) uvm_default_sequence_type; 37 | typedef uvm_sequencer #(uvm_sequence_item, uvm_sequence_item) uvm_default_sequencer_type; 38 | typedef uvm_driver #(uvm_sequence_item, uvm_sequence_item) uvm_default_driver_type; 39 | typedef uvm_sequencer_param_base #(uvm_sequence_item, uvm_sequence_item) uvm_default_sequencer_param_type; 40 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_2/src/seq/uvm_seq.svh: -------------------------------------------------------------------------------- 1 | // 2 | //------------------------------------------------------------------------------ 3 | // Copyright 2007-2011 Mentor Graphics Corporation 4 | // Copyright 2007-2010 Cadence Design Systems, Inc. 5 | // Copyright 2010 Synopsys, Inc. 6 | // All Rights Reserved Worldwide 7 | // 8 | // Licensed under the Apache License, Version 2.0 (the 9 | // "License"); you may not use this file except in 10 | // compliance with the License. You may obtain a copy of 11 | // the License at 12 | // 13 | // http://www.apache.org/licenses/LICENSE-2.0 14 | // 15 | // Unless required by applicable law or agreed to in 16 | // writing, software distributed under the License is 17 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 18 | // CONDITIONS OF ANY KIND, either express or implied. See 19 | // the License for the specific language governing 20 | // permissions and limitations under the License. 21 | //------------------------------------------------------------------------------ 22 | 23 | `include "seq/uvm_sequence_item.svh" 24 | `include "seq/uvm_sequencer_base.svh" 25 | `include "seq/uvm_sequencer_analysis_fifo.svh" 26 | `include "seq/uvm_sequencer_param_base.svh" 27 | `include "seq/uvm_sequencer.svh" 28 | `include "seq/uvm_push_sequencer.svh" 29 | `include "seq/uvm_sequence_base.svh" 30 | `include "seq/uvm_sequence.svh" 31 | `include "seq/uvm_sequence_library.svh" 32 | 33 | 34 | `include "seq/uvm_sequence_builtin.svh" 35 | 36 | typedef uvm_sequence #(uvm_sequence_item, uvm_sequence_item) uvm_default_sequence_type; 37 | typedef uvm_sequencer #(uvm_sequence_item, uvm_sequence_item) uvm_default_sequencer_type; 38 | typedef uvm_driver #(uvm_sequence_item, uvm_sequence_item) uvm_default_driver_type; 39 | typedef uvm_sequencer_param_base #(uvm_sequence_item, uvm_sequence_item) uvm_default_sequencer_param_type; 40 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_1d/src/tlm2/uvm_tlm2_defines.svh: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------- 2 | // Copyright 2010 Mentor Graphics Corporation 3 | // Copyright 2010 Synopsys, Inc. 4 | // All Rights Reserved Worldwide 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the 7 | // "License"); you may not use this file except in 8 | // compliance with the License. You may obtain a copy of 9 | // the License at 10 | // 11 | // http://www.apache.org/licenses/LICENSE-2.0 12 | // 13 | // Unless required by applicable law or agreed to in 14 | // writing, software distributed under the License is 15 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 16 | // CONDITIONS OF ANY KIND, either express or implied. See 17 | // the License for the specific language governing 18 | // permissions and limitations under the License. 19 | //---------------------------------------------------------------------- 20 | 21 | //---------------------------------------------------------------------- 22 | // Title: Interface Masks 23 | // 24 | // Each of the following macros is a mask that identifies which 25 | // interfaces a particular port requires or export provides. The 26 | // interfaces are identified by bit position and can be or'ed together 27 | // for combination ports/exports. The mask is used to do run-time 28 | // interface type checking of port/export connections. 29 | //---------------------------------------------------------------------- 30 | 31 | // MACRO: `UVM_TLM_NB_FW_MASK 32 | // 33 | // Define Non blocking Forward mask onehot assignment = 'b001 34 | `define UVM_TLM_NB_FW_MASK (1<<0) 35 | 36 | // MACRO: `UVM_TLM_NB_BW_MASK 37 | // 38 | // Define Non blocking backward mask onehot assignment = 'b010 39 | `define UVM_TLM_NB_BW_MASK (1<<1) 40 | 41 | // MACRO: `UVM_TLM_B_MASK 42 | // 43 | // Define blocking mask onehot assignment = 'b100 44 | `define UVM_TLM_B_MASK (1<<2) 45 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_2/src/tlm2/uvm_tlm2_defines.svh: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------- 2 | // Copyright 2010 Mentor Graphics Corporation 3 | // Copyright 2010 Synopsys, Inc. 4 | // All Rights Reserved Worldwide 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the 7 | // "License"); you may not use this file except in 8 | // compliance with the License. You may obtain a copy of 9 | // the License at 10 | // 11 | // http://www.apache.org/licenses/LICENSE-2.0 12 | // 13 | // Unless required by applicable law or agreed to in 14 | // writing, software distributed under the License is 15 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 16 | // CONDITIONS OF ANY KIND, either express or implied. See 17 | // the License for the specific language governing 18 | // permissions and limitations under the License. 19 | //---------------------------------------------------------------------- 20 | 21 | //---------------------------------------------------------------------- 22 | // Title: Interface Masks 23 | // 24 | // Each of the following macros is a mask that identifies which 25 | // interfaces a particular port requires or export provides. The 26 | // interfaces are identified by bit position and can be OR'ed together 27 | // for combination ports/exports. The mask is used to do run-time 28 | // interface type checking of port/export connections. 29 | //---------------------------------------------------------------------- 30 | 31 | // MACRO: `UVM_TLM_NB_FW_MASK 32 | // 33 | // Define Non blocking Forward mask onehot assignment = 'b001 34 | `define UVM_TLM_NB_FW_MASK (1<<0) 35 | 36 | // MACRO: `UVM_TLM_NB_BW_MASK 37 | // 38 | // Define Non blocking backward mask onehot assignment = 'b010 39 | `define UVM_TLM_NB_BW_MASK (1<<1) 40 | 41 | // MACRO: `UVM_TLM_B_MASK 42 | // 43 | // Define blocking mask onehot assignment = 'b100 44 | `define UVM_TLM_B_MASK (1<<2) 45 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_1d/src/macros/uvm_version_defines.svh: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------- 2 | // Copyright 2007-2010 Mentor Graphics Corporation 3 | // Copyright 2007-2010 Cadence Design Systems, Inc. 4 | // Copyright 2010-2011 Synopsys, Inc. 5 | // All Rights Reserved Worldwide 6 | // 7 | // Licensed under the Apache License, Version 2.0 (the 8 | // "License"); you may not use this file except in 9 | // compliance with the License. You may obtain a copy of 10 | // the License at 11 | // 12 | // http://www.apache.org/licenses/LICENSE-2.0 13 | // 14 | // Unless required by applicable law or agreed to in 15 | // writing, software distributed under the License is 16 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 17 | // CONDITIONS OF ANY KIND, either express or implied. See 18 | // the License for the specific language governing 19 | // permissions and limitations under the License. 20 | //---------------------------------------------------------------------- 21 | 22 | `ifndef UVM_VERSION_DEFINES_SVH 23 | `define UVM_VERSION_DEFINES_SVH 24 | 25 | // Version numbers to be used in creating version strings for printing 26 | // or programmatic tesing against version numbers 27 | `define UVM_NAME UVM 28 | `define UVM_MAJOR_REV 1 29 | `define UVM_MINOR_REV 1 30 | `define UVM_FIX_REV d 31 | 32 | 33 | // Whole version identifiers that can be used in `ifdefs and `ifndefs 34 | // to do conditional compilation 35 | `define UVM_VERSION_1_1 36 | `define UVM_MAJOR_VERSION_1_1 37 | `define UVM_FIX_VERSION_1_1_d 38 | `define UVM_MAJOR_REV_1 39 | `define UVM_MINOR_REV_1 40 | `define UVM_FIX_REV_d 41 | 42 | // When there is a FIX_REV, print as "M.mf" 43 | // When there is NO FIX_REV, print as "M.m". 44 | // Fix rev kind of string: 45 | `define UVM_VERSION_STRING `"`UVM_NAME``-```UVM_MAJOR_REV``.```UVM_MINOR_REV`UVM_FIX_REV`" 46 | // No fix rev kind of string: 47 | //`define UVM_VERSION_STRING `"`UVM_NAME``-```UVM_MAJOR_REV``.```UVM_MINOR_REV```" 48 | 49 | `endif // UVM_VERSION_DEFINES_SVH 50 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/hawk/hawk_os_item.sv: -------------------------------------------------------------------------------- 1 | 2 | // *********************************************************************** 3 | // File: hawk_os_item.sv 4 | // Author: bhunter 5 | /* About: The Operating System level items that go into the transaction level 6 | These describe either a read or a write. They are intentionally 7 | generic. 8 | Copyright (C) 2015-2016 Brian P. Hunter 9 | *************************************************************************/ 10 | 11 | `ifndef __HAWK_OS_ITEM_SV__ 12 | `define __HAWK_OS_ITEM_SV__ 13 | 14 | // class: os_item_c 15 | class os_item_c extends uvm_sequence_item; 16 | `uvm_object_utils_begin(hawk_pkg::os_item_c) 17 | `uvm_field_enum(trans_cmd_e, cmd, UVM_DEFAULT) 18 | `uvm_field_int(addr, UVM_DEFAULT | UVM_HEX) 19 | `uvm_field_int(data, UVM_DEFAULT | UVM_HEX) 20 | `uvm_object_utils_end 21 | 22 | //---------------------------------------------------------------------------------------- 23 | // Group: Fields 24 | 25 | // var: uid 26 | // Unique ID 27 | cmn_pkg::uid_c uid; 28 | 29 | // var: cmd 30 | // The command is either a read, write, or response 31 | rand trans_cmd_e cmd; 32 | 33 | // var: addr 34 | // The 64-bit address 35 | rand addr_t addr; 36 | 37 | // var: data 38 | // 64-bit data 39 | rand data_t data; 40 | 41 | //---------------------------------------------------------------------------------------- 42 | // Group: Methods 43 | function new(string name="os"); 44 | super.new(name); 45 | uid = new("OS"); 46 | endfunction : new 47 | 48 | //////////////////////////////////////////// 49 | // func: convert2string 50 | // Single-line printing 51 | virtual function string convert2string(); 52 | convert2string = $sformatf("%s %s ADDR:%016X", uid.convert2string(), cmd.name(), addr); 53 | if(cmd inside {WR, RESP}) 54 | convert2string = {convert2string, $sformatf(" DATA:%016X", data)}; 55 | endfunction : convert2string 56 | 57 | endclass : os_item_c 58 | 59 | `endif // __HAWK_OS_ITEM_SV__ 60 | 61 | 62 | -------------------------------------------------------------------------------- /hawkins/verif/hawk/hawk_tb_top.sv: -------------------------------------------------------------------------------- 1 | 2 | // *********************************************************************** 3 | // File: hawk_tb_top.sv 4 | // Author: bhunter 5 | /* About: Hawkins interface testbench. 6 | Copyright (C) 2015-2016 Cavium, Inc. All rights reserved. 7 | *************************************************************************/ 8 | 9 | import uvm_pkg::*; 10 | 11 | // package: tb_top 12 | // Top-level hawk testbench 13 | module tb_top; 14 | //---------------------------------------------------------------------------------------- 15 | // Group: Interfaces 16 | 17 | // obj: tb_clk_i 18 | // Testbench clock interface 19 | cmn_clk_intf tb_clk_i(); 20 | wire tb_clk = tb_clk_i.clk; 21 | 22 | // obj: tb_rst_i 23 | // Testbench reset interface 24 | cmn_rst_intf tb_rst_i(.clk(tb_clk)); 25 | wire tb_rst_n = tb_rst_i.rst_n; 26 | 27 | // obj: hawk_tx_i 28 | // The hawk_intf instance. 29 | hawk_intf hawk_tx_i(.clk(tb_clk), 30 | .rst_n(tb_rst_n)); 31 | // obj: hawk_rx_i 32 | // The hawk_intf instance. 33 | hawk_intf hawk_rx_i(.clk(tb_clk), 34 | .rst_n(tb_rst_n)); 35 | 36 | //---------------------------------------------------------------------------------------- 37 | // Group: Procedural Blocks 38 | 39 | //////////////////////////////////////////// 40 | // func: pre_run_test 41 | // Set interface names before run_test is called 42 | function void pre_run_test(); 43 | `cmn_set_intf(virtual cmn_clk_intf, "cmn_pkg::clk_intf", "tb_clk_vi", tb_clk_i) 44 | `cmn_set_intf(virtual cmn_rst_intf, "cmn_pkg::rst_intf", "tb_rst_vi", tb_rst_i) 45 | `cmn_set_intf(virtual hawk_intf.drv_mp, "hawk_pkg::hawk_intf", "hawk_tx_vi", hawk_tx_i) 46 | `cmn_set_intf(virtual hawk_intf.mon_mp, "hawk_pkg::hawk_intf", "hawk_tx_vi", hawk_tx_i) 47 | `cmn_set_intf(virtual hawk_intf.drv_mp, "hawk_pkg::hawk_intf", "hawk_rx_vi", hawk_rx_i) 48 | `cmn_set_intf(virtual hawk_intf.mon_mp, "hawk_pkg::hawk_intf", "hawk_rx_vi", hawk_rx_i) 49 | endfunction : pre_run_test 50 | 51 | `include "cmn_tb_top.sv" 52 | endmodule : tb_top 53 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_1d/src/macros/uvm_reg_defines.svh: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------- 2 | // Copyright 2010 Synopsys, Inc. 3 | // Copyright 2010 Mentor Graphics Corporation 4 | // All Rights Reserved Worldwide 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the 7 | // "License"); you may not use this file except in 8 | // compliance with the License. You may obtain a copy of 9 | // the License at 10 | // 11 | // http://www.apache.org/licenses/LICENSE-2.0 12 | // 13 | // Unless required by applicable law or agreed to in 14 | // writing, software distributed under the License is 15 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 16 | // CONDITIONS OF ANY KIND, either express or implied. See 17 | // the License for the specific language governing 18 | // permissions and limitations under the License. 19 | //---------------------------------------------------------------------- 20 | 21 | //------------------------ 22 | // Group: Register Defines 23 | //------------------------ 24 | 25 | // Macro: `UVM_REG_ADDR_WIDTH 26 | // 27 | // Maximum address width in bits 28 | // 29 | // Default value is 64. Used to define the type. 30 | // 31 | `ifndef UVM_REG_ADDR_WIDTH 32 | `define UVM_REG_ADDR_WIDTH 64 33 | `endif 34 | 35 | 36 | // Macro: `UVM_REG_DATA_WIDTH 37 | // 38 | // Maximum data width in bits 39 | // 40 | // Default value is 64. Used to define the type. 41 | // 42 | `ifndef UVM_REG_DATA_WIDTH 43 | `define UVM_REG_DATA_WIDTH 64 44 | `endif 45 | 46 | 47 | // Macro: `UVM_REG_BYTENABLE_WIDTH 48 | // 49 | // Maximum number of byte enable bits 50 | // 51 | // Default value is one per byte in <`UVM_REG_DATA_WIDTH>. 52 | // Used to define the type. 53 | // 54 | `ifndef UVM_REG_BYTENABLE_WIDTH 55 | `define UVM_REG_BYTENABLE_WIDTH ((`UVM_REG_DATA_WIDTH-1)/8+1) 56 | `endif 57 | 58 | 59 | // Macro: `UVM_REG_CVR_WIDTH 60 | // 61 | // Maximum number of bits in a coverage model set. 62 | // 63 | // Default value is 32. 64 | // 65 | `ifndef UVM_REG_CVR_WIDTH 66 | `define UVM_REG_CVR_WIDTH 32 67 | `endif 68 | 69 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_2/src/macros/uvm_global_defines.svh: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright 2014 Synopsys, Inc. 3 | // All Rights Reserved Worldwide 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in 7 | // compliance with the License. You may obtain a copy of 8 | // the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in 13 | // writing, software distributed under the License is 14 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 15 | // CONDITIONS OF ANY KIND, either express or implied. See 16 | // the License for the specific language governing 17 | // permissions and limitations under the License. 18 | //------------------------------------------------------------------------------ 19 | `ifndef UVM_GLOBAL_DEFINES_SVH 20 | `define UVM_GLOBAL_DEFINES_SVH 21 | 22 | // 23 | // Title: Global Macros 24 | //------------------------ 25 | // Group: Global object Macro definitions can be used in multiple locations 26 | //------------------------ 27 | // 28 | // MACRO: `UVM_MAX_STREAMBITS 29 | // 30 | // Defines the maximum bit vector size for integral types. 31 | // Used to set uvm_bitstream_t 32 | 33 | `ifndef UVM_MAX_STREAMBITS 34 | `define UVM_MAX_STREAMBITS 4096 35 | `endif 36 | 37 | 38 | // MACRO: `UVM_PACKER_MAX_BYTES 39 | // 40 | // Defines the maximum bytes to allocate for packing an object using 41 | // the . Default is <`UVM_MAX_STREAMBITS>, in ~bytes~. 42 | 43 | `ifndef UVM_PACKER_MAX_BYTES 44 | `define UVM_PACKER_MAX_BYTES `UVM_MAX_STREAMBITS 45 | `endif 46 | 47 | //------------------------ 48 | // Group: Global Time Macro definitions that can be used in multiple locations 49 | //------------------------ 50 | 51 | // MACRO: `UVM_DEFAULT_TIMEOUT 52 | // 53 | // The default timeout for simulation, if not overridden by 54 | // or 55 | // 56 | 57 | `define UVM_DEFAULT_TIMEOUT 9200s 58 | 59 | `endif // `ifndef UVM_GLOBAL_DEFINES_SVH 60 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_2/src/macros/uvm_reg_defines.svh: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------- 2 | // Copyright 2010 Synopsys, Inc. 3 | // Copyright 2010 Mentor Graphics Corporation 4 | // All Rights Reserved Worldwide 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the 7 | // "License"); you may not use this file except in 8 | // compliance with the License. You may obtain a copy of 9 | // the License at 10 | // 11 | // http://www.apache.org/licenses/LICENSE-2.0 12 | // 13 | // Unless required by applicable law or agreed to in 14 | // writing, software distributed under the License is 15 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 16 | // CONDITIONS OF ANY KIND, either express or implied. See 17 | // the License for the specific language governing 18 | // permissions and limitations under the License. 19 | //---------------------------------------------------------------------- 20 | 21 | //------------------------ 22 | // File: Register Defines 23 | //------------------------ 24 | 25 | // Macro: `UVM_REG_ADDR_WIDTH 26 | // 27 | // Maximum address width in bits 28 | // 29 | // Default value is 64. Used to define the type. 30 | // 31 | `ifndef UVM_REG_ADDR_WIDTH 32 | `define UVM_REG_ADDR_WIDTH 64 33 | `endif 34 | 35 | 36 | // Macro: `UVM_REG_DATA_WIDTH 37 | // 38 | // Maximum data width in bits 39 | // 40 | // Default value is 64. Used to define the type. 41 | // 42 | `ifndef UVM_REG_DATA_WIDTH 43 | `define UVM_REG_DATA_WIDTH 64 44 | `endif 45 | 46 | 47 | // Macro: `UVM_REG_BYTENABLE_WIDTH 48 | // 49 | // Maximum number of byte enable bits 50 | // 51 | // Default value is one per byte in <`UVM_REG_DATA_WIDTH>. 52 | // Used to define the type. 53 | // 54 | `ifndef UVM_REG_BYTENABLE_WIDTH 55 | `define UVM_REG_BYTENABLE_WIDTH ((`UVM_REG_DATA_WIDTH-1)/8+1) 56 | `endif 57 | 58 | 59 | // Macro: `UVM_REG_CVR_WIDTH 60 | // 61 | // Maximum number of bits in a coverage model set. 62 | // 63 | // Default value is 32. 64 | // 65 | `ifndef UVM_REG_CVR_WIDTH 66 | `define UVM_REG_CVR_WIDTH 32 67 | `endif 68 | 69 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_1d/src/comps/uvm_env.svh: -------------------------------------------------------------------------------- 1 | // 2 | //------------------------------------------------------------------------------ 3 | // Copyright 2007-2011 Mentor Graphics Corporation 4 | // Copyright 2007-2010 Cadence Design Systems, Inc. 5 | // Copyright 2010 Synopsys, Inc. 6 | // All Rights Reserved Worldwide 7 | // 8 | // Licensed under the Apache License, Version 2.0 (the 9 | // "License"); you may not use this file except in 10 | // compliance with the License. You may obtain a copy of 11 | // the License at 12 | // 13 | // http://www.apache.org/licenses/LICENSE-2.0 14 | // 15 | // Unless required by applicable law or agreed to in 16 | // writing, software distributed under the License is 17 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 18 | // CONDITIONS OF ANY KIND, either express or implied. See 19 | // the License for the specific language governing 20 | // permissions and limitations under the License. 21 | //------------------------------------------------------------------------------ 22 | 23 | //------------------------------------------------------------------------------ 24 | // 25 | // CLASS: uvm_env 26 | // 27 | // The base class for hierarchical containers of other components that 28 | // together comprise a complete environment. The environment may 29 | // initially consist of the entire testbench. Later, it can be reused as 30 | // a sub-environment in even larger system-level environments. 31 | //------------------------------------------------------------------------------ 32 | 33 | virtual class uvm_env extends uvm_component; 34 | 35 | // Function: new 36 | // 37 | // Creates and initializes an instance of this class using the normal 38 | // constructor arguments for : ~name~ is the name of the 39 | // instance, and ~parent~ is the handle to the hierarchical parent, if any. 40 | 41 | function new (string name="env", uvm_component parent=null); 42 | super.new(name,parent); 43 | endfunction 44 | 45 | const static string type_name = "uvm_env"; 46 | 47 | virtual function string get_type_name (); 48 | return type_name; 49 | endfunction 50 | 51 | endclass 52 | 53 | 54 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_1d/src/dpi/uvm_svcmd_dpi.svh: -------------------------------------------------------------------------------- 1 | // 2 | //------------------------------------------------------------------------------ 3 | // Copyright 2011 Mentor Graphics Corporation 4 | // Copyright 2011 Cadence Design Systems, Inc. 5 | // Copyright 2011 Synopsys, Inc. 6 | // All Rights Reserved Worldwide 7 | // 8 | // Licensed under the Apache License, Version 2.0 (the 9 | // "License"); you may not use this file except in 10 | // compliance with the License. You may obtain a copy of 11 | // the License at 12 | // 13 | // http://www.apache.org/licenses/LICENSE-2.0 14 | // 15 | // Unless required by applicable law or agreed to in 16 | // writing, software distributed under the License is 17 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 18 | // CONDITIONS OF ANY KIND, either express or implied. See 19 | // the License for the specific language governing 20 | // permissions and limitations under the License. 21 | //------------------------------------------------------------------------------ 22 | 23 | // Import DPI functions used by the interface to generate the 24 | // lists. 25 | 26 | `ifndef UVM_CMDLINE_NO_DPI 27 | import "DPI-C" function string uvm_dpi_get_next_arg_c (); 28 | import "DPI-C" function string uvm_dpi_get_tool_name_c (); 29 | import "DPI-C" function string uvm_dpi_get_tool_version_c (); 30 | 31 | function string uvm_dpi_get_next_arg(); 32 | return uvm_dpi_get_next_arg_c(); 33 | endfunction 34 | 35 | function string uvm_dpi_get_tool_name(); 36 | return uvm_dpi_get_tool_name_c(); 37 | endfunction 38 | 39 | function string uvm_dpi_get_tool_version(); 40 | return uvm_dpi_get_tool_version_c(); 41 | endfunction 42 | 43 | import "DPI-C" function chandle uvm_dpi_regcomp(string regex); 44 | import "DPI-C" function int uvm_dpi_regexec(chandle preg, string str); 45 | import "DPI-C" function void uvm_dpi_regfree(chandle preg); 46 | 47 | `else 48 | function string uvm_dpi_get_next_arg(); 49 | return ""; 50 | endfunction 51 | 52 | function string uvm_dpi_get_tool_name(); 53 | return "?"; 54 | endfunction 55 | 56 | function string uvm_dpi_get_tool_version(); 57 | return "?"; 58 | endfunction 59 | 60 | `endif 61 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_2/src/comps/uvm_env.svh: -------------------------------------------------------------------------------- 1 | // 2 | //------------------------------------------------------------------------------ 3 | // Copyright 2007-2011 Mentor Graphics Corporation 4 | // Copyright 2007-2010 Cadence Design Systems, Inc. 5 | // Copyright 2010 Synopsys, Inc. 6 | // All Rights Reserved Worldwide 7 | // 8 | // Licensed under the Apache License, Version 2.0 (the 9 | // "License"); you may not use this file except in 10 | // compliance with the License. You may obtain a copy of 11 | // the License at 12 | // 13 | // http://www.apache.org/licenses/LICENSE-2.0 14 | // 15 | // Unless required by applicable law or agreed to in 16 | // writing, software distributed under the License is 17 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 18 | // CONDITIONS OF ANY KIND, either express or implied. See 19 | // the License for the specific language governing 20 | // permissions and limitations under the License. 21 | //------------------------------------------------------------------------------ 22 | 23 | //------------------------------------------------------------------------------ 24 | // 25 | // CLASS: uvm_env 26 | // 27 | // The base class for hierarchical containers of other components that 28 | // together comprise a complete environment. The environment may 29 | // initially consist of the entire testbench. Later, it can be reused as 30 | // a sub-environment in even larger system-level environments. 31 | //------------------------------------------------------------------------------ 32 | 33 | virtual class uvm_env extends uvm_component; 34 | 35 | // Function: new 36 | // 37 | // Creates and initializes an instance of this class using the normal 38 | // constructor arguments for : ~name~ is the name of the 39 | // instance, and ~parent~ is the handle to the hierarchical parent, if any. 40 | 41 | function new (string name="env", uvm_component parent=null); 42 | super.new(name,parent); 43 | endfunction 44 | 45 | const static string type_name = "uvm_env"; 46 | 47 | virtual function string get_type_name (); 48 | return type_name; 49 | endfunction 50 | 51 | endclass 52 | 53 | 54 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_1d/src/comps/uvm_monitor.svh: -------------------------------------------------------------------------------- 1 | // 2 | //----------------------------------------------------------------------------- 3 | // Copyright 2007-2011 Mentor Graphics Corporation 4 | // Copyright 2007-2010 Cadence Design Systems, Inc. 5 | // Copyright 2010 Synopsys, Inc. 6 | // All Rights Reserved Worldwide 7 | // 8 | // Licensed under the Apache License, Version 2.0 (the 9 | // "License"); you may not use this file except in 10 | // compliance with the License. You may obtain a copy of 11 | // the License at 12 | // 13 | // http://www.apache.org/licenses/LICENSE-2.0 14 | // 15 | // Unless required by applicable law or agreed to in 16 | // writing, software distributed under the License is 17 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 18 | // CONDITIONS OF ANY KIND, either express or implied. See 19 | // the License for the specific language governing 20 | // permissions and limitations under the License. 21 | //----------------------------------------------------------------------------- 22 | 23 | //----------------------------------------------------------------------------- 24 | // CLASS: uvm_monitor 25 | // 26 | // This class should be used as the base class for user-defined monitors. 27 | // 28 | // Deriving from uvm_monitor allows you to distinguish monitors from generic 29 | // component types inheriting from uvm_component. Such monitors will 30 | // automatically inherit features that may be added to uvm_monitor in the future. 31 | // 32 | //----------------------------------------------------------------------------- 33 | 34 | virtual class uvm_monitor extends uvm_component; 35 | 36 | // Function: new 37 | // 38 | // Creates and initializes an instance of this class using the normal 39 | // constructor arguments for : ~name~ is the name of the 40 | // instance, and ~parent~ is the handle to the hierarchical parent, if any. 41 | 42 | function new (string name, uvm_component parent); 43 | super.new(name, parent); 44 | endfunction 45 | 46 | const static string type_name = "uvm_monitor"; 47 | 48 | virtual function string get_type_name (); 49 | return type_name; 50 | endfunction 51 | 52 | endclass 53 | 54 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_2/src/comps/uvm_monitor.svh: -------------------------------------------------------------------------------- 1 | // 2 | //----------------------------------------------------------------------------- 3 | // Copyright 2007-2011 Mentor Graphics Corporation 4 | // Copyright 2007-2010 Cadence Design Systems, Inc. 5 | // Copyright 2010 Synopsys, Inc. 6 | // All Rights Reserved Worldwide 7 | // 8 | // Licensed under the Apache License, Version 2.0 (the 9 | // "License"); you may not use this file except in 10 | // compliance with the License. You may obtain a copy of 11 | // the License at 12 | // 13 | // http://www.apache.org/licenses/LICENSE-2.0 14 | // 15 | // Unless required by applicable law or agreed to in 16 | // writing, software distributed under the License is 17 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 18 | // CONDITIONS OF ANY KIND, either express or implied. See 19 | // the License for the specific language governing 20 | // permissions and limitations under the License. 21 | //----------------------------------------------------------------------------- 22 | 23 | //----------------------------------------------------------------------------- 24 | // CLASS: uvm_monitor 25 | // 26 | // This class should be used as the base class for user-defined monitors. 27 | // 28 | // Deriving from uvm_monitor allows you to distinguish monitors from generic 29 | // component types inheriting from uvm_component. Such monitors will 30 | // automatically inherit features that may be added to uvm_monitor in the future. 31 | // 32 | //----------------------------------------------------------------------------- 33 | 34 | virtual class uvm_monitor extends uvm_component; 35 | 36 | // Function: new 37 | // 38 | // Creates and initializes an instance of this class using the normal 39 | // constructor arguments for : ~name~ is the name of the 40 | // instance, and ~parent~ is the handle to the hierarchical parent, if any. 41 | 42 | function new (string name, uvm_component parent); 43 | super.new(name, parent); 44 | endfunction 45 | 46 | const static string type_name = "uvm_monitor"; 47 | 48 | virtual function string get_type_name (); 49 | return type_name; 50 | endfunction 51 | 52 | endclass 53 | 54 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/cmn/cmn_uid.sv: -------------------------------------------------------------------------------- 1 | // *********************************************************************** 2 | // File: cmn_uid.sv 3 | // Author: bhunter 4 | /* About: Unique Identifiers 5 | Copyright (C) 2015-2016 Cavium, Inc. All rights reserved. 6 | *************************************************************************/ 7 | 8 | `ifndef __CMN_UID_SV__ 9 | `define __CMN_UID_SV__ 10 | 11 | // class: uid_c 12 | class uid_c extends uvm_object; 13 | `uvm_object_utils(cmn_pkg::uid_c) 14 | 15 | //---------------------------------------------------------------------------------------- 16 | // Group: Fields 17 | // var: next_id_num 18 | // The next number for the given identifier 19 | static int unsigned next_id_num[string]; 20 | 21 | // var: prefix 22 | // The identifying string 23 | string prefix; 24 | 25 | // var: my_id 26 | // The UID for this instance 27 | int unsigned my_id; 28 | 29 | // var: parent 30 | // When set, this UID is a sub-id 31 | uid_c parent; 32 | 33 | //---------------------------------------------------------------------------------------- 34 | // Group: Methods 35 | // func: new 36 | // Create a unique ID and assign its ID 37 | function new(string name="uid"); 38 | super.new(name); 39 | prefix = name; 40 | if(next_id_num.exists(prefix)) 41 | next_id_num[prefix] += 1; 42 | else 43 | next_id_num[prefix] = 0; 44 | my_id = next_id_num[prefix]; 45 | endfunction : new 46 | 47 | //////////////////////////////////////////// 48 | // func: new_subid 49 | // Used as a sub-identifier of another unique id 50 | virtual function uid_c new_subid(string _prefix=""); 51 | string new_name = $sformatf("%s.%s", convert2string(), _prefix); 52 | new_subid = new(new_name); 53 | new_subid.parent = this; 54 | return new_subid; 55 | endfunction : new_subid 56 | 57 | //////////////////////////////////////////// 58 | // func: convert2string 59 | // Return this unique ID as a string 60 | virtual function string convert2string(); 61 | return ($sformatf("%s:%06d", prefix, my_id)); 62 | endfunction : convert2string 63 | endclass : uid_c 64 | 65 | `endif // __CMN_UID_SV__ 66 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/hawk/hawk_passive_drv.sv: -------------------------------------------------------------------------------- 1 | // *********************************************************************** 2 | // File: hawk_drv.sv 3 | // Author: bhunter 4 | /* About: Hawk Passive Driver 5 | Copyright (C) 2015-2016 Brian P. Hunter 6 | *************************************************************************/ 7 | 8 | `ifndef __HAWK_PASSIVE_DRV_SV__ 9 | `define __HAWK_PASSIVE_DRV_SV__ 10 | 11 | `include "hawk_drv.sv" 12 | 13 | // class: passive_drv_c 14 | class passive_drv_c extends drv_c; 15 | `uvm_component_utils(hawk_pkg::passive_drv_c) 16 | 17 | //---------------------------------------------------------------------------------------- 18 | // Group: Methods 19 | function new(string name="drv", 20 | uvm_component parent=null); 21 | super.new(name, parent); 22 | endfunction : new 23 | 24 | //////////////////////////////////////////// 25 | // func: run_phase 26 | virtual task run_phase(uvm_phase phase); 27 | forever begin 28 | // wait first for reset to go high 29 | @(posedge vi.drv_cb.rst_n); 30 | 31 | // put interface in "reset" 32 | // vi.drv_cb.valid <= 1'b0; 33 | // vi.drv_cb.data <= 'h0; 34 | 35 | fork 36 | driver(); 37 | join_none 38 | 39 | @(negedge vi.drv_cb.rst_n); 40 | disable fork; 41 | end 42 | endtask : run_phase 43 | 44 | //////////////////////////////////////////// 45 | // func: driver 46 | // Drive stuff 47 | virtual task driver(); 48 | // ensure that we start on a clock edge 49 | @(vi.drv_cb); 50 | 51 | forever begin 52 | seq_item_port.try_next_item(req); 53 | if(!req) begin 54 | // vi.drv_cb.valid <= 1'b0; 55 | // vi.drv_cb.data <= 'h0; 56 | seq_item_port.get_next_item(req); 57 | @(vi.drv_cb); 58 | end 59 | 60 | `cmn_dbg(300, ("Driving %s", req.convert2string())) 61 | // vi.drv_cb.valid <= req.valid; 62 | // vi.drv_cb.data <= req.data; 63 | seq_item_port.item_done(); 64 | @(vi.drv_cb); 65 | end 66 | endtask : driver 67 | endclass : passive_drv_c 68 | 69 | `endif // __HAWK_PASSIVE_DRV_SV__ 70 | 71 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_2/src/dpi/uvm_dpi.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------- 2 | // Copyright 2010 Synopsys, Inc. 3 | // Copyright 2011 Mentor Graphics Corporation 4 | // Copyright 2013 NVIDIA Corporation 5 | // All Rights Reserved Worldwide 6 | // 7 | // Licensed under the Apache License, Version 2.0 (the 8 | // "License"); you may not use this file except in 9 | // compliance with the License. You may obtain a copy of 10 | // the License at 11 | // 12 | // http://www.apache.org/licenses/LICENSE-2.0 13 | // 14 | // Unless required by applicable law or agreed to in 15 | // writing, software distributed under the License is 16 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 17 | // CONDITIONS OF ANY KIND, either express or implied. See 18 | // the License for the specific language governing 19 | // permissions and limitations under the License. 20 | //---------------------------------------------------------------------- 21 | 22 | // 23 | // Top level header filke that wraps all requirements which 24 | // are common to the various C/C++ files in UVM. 25 | // 26 | 27 | #ifndef UVM_DPI__H 28 | #define UVM_DPI__H 29 | 30 | #include 31 | #include "vpi_user.h" 32 | #include "veriuser.h" 33 | #include "svdpi.h" 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | // The following consts and method call are for 41 | // internal usage by the UVM DPI implementation, 42 | // and are not intended for public use. 43 | static const int M_UVM_INFO = 0; 44 | static const int M_UVM_WARNING = 1; 45 | static const int M_UVM_ERROR = 2; 46 | static const int M_UVM_FATAL = 3; 47 | 48 | static const int M_UVM_NONE = 0; 49 | static const int M_UVM_LOW = 100; 50 | static const int M_UVM_MEDIUM = 200; 51 | static const int M_UVM_HIGH = 300; 52 | static const int M_UVM_FULL = 400; 53 | static const int M_UVM_DEBUG = 500; 54 | 55 | void m_uvm_report_dpi(int severity, 56 | char* id, 57 | char* message, 58 | int verbosity, 59 | char* file, 60 | int linenum); 61 | 62 | int int_str_max( int ); 63 | 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/cmn/cmn_tb_top.sv: -------------------------------------------------------------------------------- 1 | 2 | // *********************************************************************** 3 | // File: cmn_tb_top.sv 4 | // Author: bhunter 5 | /* About: `include this file into your tb_top 6 | Copyright (C) 2015-2016 Brian P. Hunter 7 | *************************************************************************/ 8 | 9 | initial begin : fsdb_setup 10 | if($test$plusargs("fsdb_trace")) begin 11 | string fsdb_outfile = "sim.fsdb"; 12 | int fsdb_depth=0; 13 | $value$plusargs("fsdb_outfile=%s", fsdb_outfile); 14 | $value$plusargs("fsdb_depth=%d", fsdb_depth); 15 | $fsdbDumpvars(fsdb_depth, $root.tb_top, "+all", $sformatf("+fsdbfile+%s", fsdb_outfile)); 16 | end 17 | end : fsdb_setup 18 | 19 | ///////////////////////////////////////////////////////////////////////////// 20 | // 1. replace the UVM report server with our cavium one. 21 | // and set the timeformat 22 | // 2. call pre_run_test(). testbenches MUST override this with any functionality 23 | // that should occur before run_test. 24 | // 3. call run_test. 25 | ///////////////////////////////////////////////////////////////////////////// 26 | initial begin : start_uvm 27 | cmn_pkg::report_server_c report_server; 28 | 29 | // all "%t" shall print out in ns format with 9 digits and 3 decimal places 30 | $timeformat(-9,3,"ns",13); 31 | 32 | report_server = cmn_pkg::report_server_c::type_id::create(); 33 | uvm_pkg::uvm_report_server::set_server(report_server); 34 | 35 | // testbenches must create this zero-time function 36 | pre_run_test(); 37 | run_test(); 38 | end : start_uvm 39 | 40 | //////////////////////////////////////////// 41 | // Needed for UVM 1.1c 42 | // turn these warnings off: UVM/FLD/SET/BSY 43 | //////////////////////////////////////////// 44 | initial begin 45 | #(1ps); 46 | uvm_root::get().set_report_severity_id_action_hier(UVM_WARNING, "UVM/FLD/SET/BSY", UVM_NO_ACTION); 47 | uvm_root::get().set_report_severity_id_action_hier(UVM_WARNING, "Connection Warning", UVM_NO_ACTION); 48 | uvm_root::get().set_report_severity_id_action_hier(UVM_ERROR, "SEQREQZMB", UVM_NO_ACTION); 49 | end 50 | 51 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_1d/src/comps/uvm_scoreboard.svh: -------------------------------------------------------------------------------- 1 | // 2 | //----------------------------------------------------------------------------- 3 | // Copyright 2007-2011 Mentor Graphics Corporation 4 | // Copyright 2007-2010 Cadence Design Systems, Inc. 5 | // Copyright 2010 Synopsys, Inc. 6 | // All Rights Reserved Worldwide 7 | // 8 | // Licensed under the Apache License, Version 2.0 (the 9 | // "License"); you may not use this file except in 10 | // compliance with the License. You may obtain a copy of 11 | // the License at 12 | // 13 | // http://www.apache.org/licenses/LICENSE-2.0 14 | // 15 | // Unless required by applicable law or agreed to in 16 | // writing, software distributed under the License is 17 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 18 | // CONDITIONS OF ANY KIND, either express or implied. See 19 | // the License for the specific language governing 20 | // permissions and limitations under the License. 21 | //----------------------------------------------------------------------------- 22 | 23 | //------------------------------------------------------------------------------ 24 | // 25 | // CLASS: uvm_scoreboard 26 | // 27 | // The uvm_scoreboard virtual class should be used as the base class for 28 | // user-defined scoreboards. 29 | // 30 | // Deriving from uvm_scoreboard will allow you to distinguish scoreboards from 31 | // other component types inheriting directly from uvm_component. Such 32 | // scoreboards will automatically inherit and benefit from features that may be 33 | // added to uvm_scoreboard in the future. 34 | //------------------------------------------------------------------------------ 35 | 36 | virtual class uvm_scoreboard extends uvm_component; 37 | 38 | // Function: new 39 | // 40 | // Creates and initializes an instance of this class using the normal 41 | // constructor arguments for : ~name~ is the name of the 42 | // instance, and ~parent~ is the handle to the hierarchical parent, if any. 43 | 44 | function new (string name, uvm_component parent); 45 | super.new(name, parent); 46 | endfunction 47 | 48 | const static string type_name = "uvm_scoreboard"; 49 | 50 | virtual function string get_type_name (); 51 | return type_name; 52 | endfunction 53 | 54 | endclass 55 | 56 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_2/src/comps/uvm_scoreboard.svh: -------------------------------------------------------------------------------- 1 | // 2 | //----------------------------------------------------------------------------- 3 | // Copyright 2007-2011 Mentor Graphics Corporation 4 | // Copyright 2007-2010 Cadence Design Systems, Inc. 5 | // Copyright 2010 Synopsys, Inc. 6 | // All Rights Reserved Worldwide 7 | // 8 | // Licensed under the Apache License, Version 2.0 (the 9 | // "License"); you may not use this file except in 10 | // compliance with the License. You may obtain a copy of 11 | // the License at 12 | // 13 | // http://www.apache.org/licenses/LICENSE-2.0 14 | // 15 | // Unless required by applicable law or agreed to in 16 | // writing, software distributed under the License is 17 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 18 | // CONDITIONS OF ANY KIND, either express or implied. See 19 | // the License for the specific language governing 20 | // permissions and limitations under the License. 21 | //----------------------------------------------------------------------------- 22 | 23 | //------------------------------------------------------------------------------ 24 | // 25 | // CLASS: uvm_scoreboard 26 | // 27 | // The uvm_scoreboard virtual class should be used as the base class for 28 | // user-defined scoreboards. 29 | // 30 | // Deriving from uvm_scoreboard will allow you to distinguish scoreboards from 31 | // other component types inheriting directly from uvm_component. Such 32 | // scoreboards will automatically inherit and benefit from features that may be 33 | // added to uvm_scoreboard in the future. 34 | //------------------------------------------------------------------------------ 35 | 36 | virtual class uvm_scoreboard extends uvm_component; 37 | 38 | // Function: new 39 | // 40 | // Creates and initializes an instance of this class using the normal 41 | // constructor arguments for : ~name~ is the name of the 42 | // instance, and ~parent~ is the handle to the hierarchical parent, if any. 43 | 44 | function new (string name, uvm_component parent); 45 | super.new(name, parent); 46 | endfunction 47 | 48 | const static string type_name = "uvm_scoreboard"; 49 | 50 | virtual function string get_type_name (); 51 | return type_name; 52 | endfunction 53 | 54 | endclass 55 | 56 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/cmn/cmn_objection.sv: -------------------------------------------------------------------------------- 1 | // *********************************************************************** 2 | // File: cmn_objection.sv 3 | // Author: bhunter 4 | /* About: 5 | Copyright (C) 2015-2016 Cavium, Inc. All rights reserved. 6 | *************************************************************************/ 7 | 8 | // class: objection_c 9 | // A simpler objection class that removes hierarchy-related things. 10 | class objection_c extends uvm_object; 11 | `uvm_object_utils_begin(objection_c) 12 | `uvm_field_int(count, UVM_DEFAULT | UVM_DEC) 13 | `uvm_field_int(last_raised_time, UVM_DEFAULT) 14 | `uvm_field_int(last_dropped_time, UVM_DEFAULT) 15 | `uvm_object_utils_end 16 | 17 | //---------------------------------------------------------------------------------------- 18 | // Group: Fields 19 | 20 | // var: count 21 | // The current objection count, goes up when raised and down when dropped 22 | local int unsigned count; 23 | 24 | // var: last_raised_time 25 | // The last time this objection was raised 26 | time last_raised_time; 27 | 28 | // var: last_dropped_time 29 | // The last time this objection was dropped 30 | time last_dropped_time; 31 | 32 | //---------------------------------------------------------------------------------------- 33 | // Group: Methods 34 | function new(string name="objection"); 35 | super.new(name); 36 | endfunction : new 37 | 38 | //////////////////////////////////////////// 39 | // func: get_count 40 | function int unsigned get_count(); 41 | return count; 42 | endfunction : get_count 43 | 44 | //////////////////////////////////////////// 45 | // func: raise 46 | function void raise(int unsigned _count = 1); 47 | count += _count; 48 | last_raised_time = $realtime(); 49 | endfunction : raise 50 | 51 | //////////////////////////////////////////// 52 | // func: drop 53 | function void drop(int unsigned _count = 1); 54 | count -= _count; 55 | last_dropped_time = $realtime(); 56 | endfunction : drop 57 | 58 | //////////////////////////////////////////// 59 | // func: clear 60 | function void clear(); 61 | count = 0; 62 | last_dropped_time = $realtime(); 63 | endfunction : clear 64 | endclass : objection_c 65 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/hawk/hawk_phy_item.sv: -------------------------------------------------------------------------------- 1 | 2 | // *********************************************************************** 3 | // File: hawk_phy_item.sv 4 | // Author: bhunter 5 | /* About: Delivered directly to the driver from the PHY chaining sequence 6 | Copyright (C) 2015-2016 Brian P. Hunter 7 | *************************************************************************/ 8 | 9 | `ifndef __HAWK_PHY_ITEM_SV__ 10 | `define __HAWK_PHY_ITEM_SV__ 11 | 12 | `include "hawk_types.sv" 13 | 14 | // class: phy_item_c 15 | class phy_item_c extends uvm_sequence_item; 16 | `uvm_object_utils_begin(hawk_pkg::phy_item_c) 17 | `uvm_field_int(valid, UVM_DEFAULT) 18 | `uvm_field_int(data, UVM_DEFAULT | UVM_HEX) 19 | `uvm_object_utils_end 20 | 21 | //---------------------------------------------------------------------------------------- 22 | // Group: Fields 23 | 24 | // var: uid 25 | // Unique Identifier 26 | cmn_pkg::uid_c uid; 27 | 28 | // var: valid 29 | // Valid signal 30 | rand bit valid; 31 | 32 | // var: data 33 | // Data signal 34 | rand byte unsigned data; 35 | 36 | //---------------------------------------------------------------------------------------- 37 | // Group: Methods 38 | function new(string name="phy"); 39 | super.new(name); 40 | uid = new("PHY"); 41 | endfunction : new 42 | 43 | //////////////////////////////////////////// 44 | // func: convert2string 45 | // Single-line printing 46 | virtual function string convert2string(); 47 | convert2string = uid.convert2string(); 48 | if(valid) 49 | convert2string = $sformatf("%s PKT D:%02X", convert2string, data); 50 | else if(data inside {ACK, NAK, TRAIN, EOP}) begin 51 | phy_char_e pchar = phy_char_e'(data); 52 | convert2string = {convert2string, " ", pchar.name()}; 53 | end else 54 | convert2string = $sformatf("IDLE:%02X", data); 55 | endfunction : convert2string 56 | 57 | //////////////////////////////////////////// 58 | // func: is_idle_or_train 59 | // Returns 1 if this is either an IDLE or a training 60 | virtual function bit is_idle_or_train(); 61 | return(valid == 0 && !(data inside {ACK, NAK, EOP})); 62 | endfunction : is_idle_or_train 63 | endclass : phy_item_c 64 | 65 | `endif // __HAWK_PHY_ITEM_SV__ 66 | 67 | 68 | -------------------------------------------------------------------------------- /hawkins/verif/hawk/regression.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2.7 2 | 3 | "A very rudimentary regression program" 4 | 5 | from __future__ import print_function 6 | import subprocess 7 | import os 8 | import sys 9 | import runme 10 | 11 | ######################################################################################## 12 | def get_tests(): 13 | tests = os.listdir('tests') 14 | tests = [os.path.basename(it) for it in tests] 15 | tests = [os.path.splitext(it)[0] for it in tests] 16 | tests = [it for it in tests if it != 'base_test'] 17 | return tests 18 | 19 | ######################################################################################## 20 | def check(test_name): 21 | import time 22 | 23 | filename = os.path.join('sim', test_name, 'logfile') 24 | # wait for logfile to exist 25 | if os.path.exists(filename) == False: 26 | print("FAILED...couldn't find {}".format(filename)) 27 | return 28 | with open(filename) as logfile: 29 | num_issues = 0 30 | start_looking = False 31 | for line in logfile: 32 | if not start_looking and line.strip() == '--- UVM Report Summary ---': 33 | start_looking = True 34 | if not start_looking: 35 | continue 36 | if line.startswith('UVM_WARNING') or line.startswith('UVM_ERROR') or line.startswith('UVM_FATAL'): 37 | num_issues += int(line.split()[2]) 38 | if num_issues: 39 | print("FAILED with {} issues.".format(num_issues)) 40 | else: 41 | print("PASSED") 42 | 43 | ######################################################################################## 44 | if __name__ == '__main__': 45 | from multiprocessing import Process 46 | from shutil import rmtree 47 | 48 | # remove simulation directory 49 | rmtree('sim', ignore_errors=True) 50 | 51 | devnull = open(os.devnull, 'w') 52 | runme.STDOUT = devnull 53 | 54 | # get all tests 55 | tests = get_tests() 56 | 57 | for idx, test in enumerate(tests): 58 | test_args = 'TEST={}'.format(test) 59 | if idx: 60 | test_args += ' COMPILE=0' 61 | print("Running: {}".format(test_args), end='...') 62 | p = Process(target=runme.main, kwargs={'argv': test_args}) 63 | p.start() 64 | p.join() 65 | passed = check(test) 66 | 67 | -------------------------------------------------------------------------------- /recipes/6.objection.sv: -------------------------------------------------------------------------------- 1 | // *********************************************************************** 2 | // File: 6.objection.sv 3 | // Author: bhunter 4 | /* About: 5 | Copyright (C) 2015-2016 Cavium, Inc. All rights reserved. 6 | *************************************************************************/ 7 | 8 | `ifndef __6_OBJECTION_SV__ 9 | `define __6_OBJECTION_SV__ 10 | 11 | // class: objection_c 12 | // A simpler objection class that removes hierarchy-related things. 13 | class objection_c extends uvm_object; 14 | `uvm_object_utils_begin(objection_c) 15 | `uvm_field_int(count, UVM_DEFAULT | UVM_DEC) 16 | `uvm_field_int(last_raised_time, UVM_DEFAULT) 17 | `uvm_field_int(last_dropped_time, UVM_DEFAULT) 18 | `uvm_object_utils_end 19 | 20 | //---------------------------------------------------------------------------------------- 21 | // Group: Fields 22 | 23 | // var: count 24 | // The current objection count, goes up when raised and down when dropped 25 | local int unsigned count; 26 | 27 | // var: last_raised_time 28 | // The last time this objection was raised 29 | time last_raised_time; 30 | 31 | // var: last_dropped_time 32 | // The last time this objection was dropped 33 | time last_dropped_time; 34 | 35 | //---------------------------------------------------------------------------------------- 36 | // Group: Methods 37 | function new(string name="objection"); 38 | super.new(name); 39 | endfunction : new 40 | 41 | //////////////////////////////////////////// 42 | // func: get_count 43 | function int unsigned get_count(); 44 | return count; 45 | endfunction : get_count 46 | 47 | //////////////////////////////////////////// 48 | // func: raise 49 | function void raise(int unsigned _count = 1); 50 | count += _count; 51 | last_raised_time = $realtime(); 52 | endfunction : raise 53 | 54 | //////////////////////////////////////////// 55 | // func: drop 56 | function void drop(int unsigned _count = 1); 57 | count -= _count; 58 | last_dropped_time = $realtime(); 59 | endfunction : drop 60 | 61 | //////////////////////////////////////////// 62 | // func: clear 63 | function void clear(); 64 | count = 0; 65 | last_dropped_time = $realtime(); 66 | endfunction : clear 67 | endclass : objection_c 68 | 69 | `endif // __6_OBJECTION_SV__ 70 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_2/src/dpi/uvm_svcmd_dpi.svh: -------------------------------------------------------------------------------- 1 | // 2 | //------------------------------------------------------------------------------ 3 | // Copyright 2011 Mentor Graphics Corporation 4 | // Copyright 2011 Cadence Design Systems, Inc. 5 | // Copyright 2011 Synopsys, Inc. 6 | // All Rights Reserved Worldwide 7 | // 8 | // Licensed under the Apache License, Version 2.0 (the 9 | // "License"); you may not use this file except in 10 | // compliance with the License. You may obtain a copy of 11 | // the License at 12 | // 13 | // http://www.apache.org/licenses/LICENSE-2.0 14 | // 15 | // Unless required by applicable law or agreed to in 16 | // writing, software distributed under the License is 17 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 18 | // CONDITIONS OF ANY KIND, either express or implied. See 19 | // the License for the specific language governing 20 | // permissions and limitations under the License. 21 | //------------------------------------------------------------------------------ 22 | 23 | // Import DPI functions used by the interface to generate the 24 | // lists. 25 | 26 | `ifndef UVM_CMDLINE_NO_DPI 27 | import "DPI-C" function string uvm_dpi_get_next_arg_c (int init); 28 | import "DPI-C" function string uvm_dpi_get_tool_name_c (); 29 | import "DPI-C" function string uvm_dpi_get_tool_version_c (); 30 | 31 | function string uvm_dpi_get_next_arg(int init=0); 32 | return uvm_dpi_get_next_arg_c(init); 33 | endfunction 34 | 35 | function string uvm_dpi_get_tool_name(); 36 | return uvm_dpi_get_tool_name_c(); 37 | endfunction 38 | 39 | function string uvm_dpi_get_tool_version(); 40 | return uvm_dpi_get_tool_version_c(); 41 | endfunction 42 | 43 | import "DPI-C" function chandle uvm_dpi_regcomp(string regex); 44 | import "DPI-C" function int uvm_dpi_regexec(chandle preg, string str); 45 | import "DPI-C" function void uvm_dpi_regfree(chandle preg); 46 | 47 | `else 48 | function string uvm_dpi_get_next_arg(int init=0); 49 | return ""; 50 | endfunction 51 | 52 | function string uvm_dpi_get_tool_name(); 53 | return "?"; 54 | endfunction 55 | 56 | function string uvm_dpi_get_tool_version(); 57 | return "?"; 58 | endfunction 59 | 60 | 61 | function chandle uvm_dpi_regcomp(string regex); return null; endfunction 62 | function int uvm_dpi_regexec(chandle preg, string str); return 0; endfunction 63 | function void uvm_dpi_regfree(chandle preg); endfunction 64 | 65 | `endif 66 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_1d/src/uvm_macros.svh: -------------------------------------------------------------------------------- 1 | // 2 | //---------------------------------------------------------------------- 3 | // Copyright 2007-2011 Mentor Graphics Corporation 4 | // Copyright 2007-2011 Cadence Design Systems, Inc. 5 | // Copyright 2010-2011 Synopsys, Inc. 6 | // All Rights Reserved Worldwide 7 | // 8 | // Licensed under the Apache License, Version 2.0 (the 9 | // "License"); you may not use this file except in 10 | // compliance with the License. You may obtain a copy of 11 | // the License at 12 | // 13 | // http://www.apache.org/licenses/LICENSE-2.0 14 | // 15 | // Unless required by applicable law or agreed to in 16 | // writing, software distributed under the License is 17 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 18 | // CONDITIONS OF ANY KIND, either express or implied. See 19 | // the License for the specific language governing 20 | // permissions and limitations under the License. 21 | //---------------------------------------------------------------------- 22 | 23 | `ifndef UVM_MACROS_SVH 24 | `define UVM_MACROS_SVH 25 | 26 | // 27 | // Any vendor specific defines go here. 28 | // 29 | 30 | `ifdef MODEL_TECH 31 | `ifndef QUESTA 32 | `define QUESTA 33 | `endif 34 | `endif 35 | 36 | `ifndef QUESTA 37 | `define uvm_typename(X) $typename(X) 38 | `else 39 | `define uvm_typename(X) $typename(X,39) 40 | `endif 41 | 42 | `ifdef VCS 43 | `ifndef UVM_DISABLE_RESOURCE_CONVERTER 44 | //UVM_USE_RESOURCE_CONVERTER enables UVM-1.1d to print resources output to match uvm-1.1c. VCS2012.09-SP1 or later does not need resource_converter object, disbale by using +define+UVM_DISABLE_RESOURCE_CONVERTER 45 | `define UVM_USE_RESOURCE_CONVERTER 46 | `endif 47 | `endif 48 | 49 | `ifdef INCA 50 | `define UVM_USE_PROCESS_CONTAINER 51 | `endif 52 | 53 | // 54 | // Deprecation Control Macros 55 | // 56 | `ifdef UVM_NO_DEPRECATED 57 | `define UVM_OBJECT_MUST_HAVE_CONSTRUCTOR 58 | `endif 59 | 60 | `define uvm_delay(TIME) #(TIME); 61 | 62 | 63 | `include "macros/uvm_version_defines.svh" 64 | `include "macros/uvm_message_defines.svh" 65 | `include "macros/uvm_phase_defines.svh" 66 | `include "macros/uvm_object_defines.svh" 67 | `include "macros/uvm_printer_defines.svh" 68 | `include "macros/uvm_tlm_defines.svh" 69 | `include "macros/uvm_sequence_defines.svh" 70 | `include "macros/uvm_callback_defines.svh" 71 | `include "macros/uvm_reg_defines.svh" 72 | `include "macros/uvm_deprecated_defines.svh" 73 | 74 | `endif 75 | -------------------------------------------------------------------------------- /design_patterns/cfg.sv: -------------------------------------------------------------------------------- 1 | // *********************************************************************** 2 | // File: cfg.sv 3 | // Author: bhunter 4 | /* About: 5 | Copyright (C) 2015-2016 Cavium, Inc. All rights reserved. 6 | *************************************************************************/ 7 | 8 | `ifndef __CFG_SV__ 9 | `define __CFG_SV__ 10 | 11 | // class: cfg_c 12 | class cfg_c extends uvm_object; 13 | `uvm_object_utils_begin(foo_pkg::cfg_c) 14 | `uvm_field_int(coverage_enable, UVM_ALL_ON) 15 | `uvm_field_object(reg_block, UVM_REFERENCE) 16 | `uvm_field_object(child_cfg, UVM_ALL_ON) 17 | `uvm_object_utils_end 18 | 19 | //---------------------------------------------------------------------------------------- 20 | // Group: Fields 21 | // var: coverage_enable 22 | // Is functional coverage collection enabled? 23 | bit coverage_enable; 24 | 25 | // var: reg_block 26 | // Register block for this environment 27 | rand reg_block_c reg_block; 28 | 29 | // var: child_cfg 30 | // A lower-level CFG class 31 | child_cfg_c child_cfg; 32 | 33 | //---------------------------------------------------------------------------------------- 34 | // Group: Constraints 35 | 36 | //---------------------------------------------------------------------------------------- 37 | // Group: Methods 38 | // Create the child_cfg class, and provide to it the full path name of this class. 39 | // Determine coverage enable by reading from the resource database. This must be done 40 | // in order to new the covergroup in the new function, which is a SystemVerilog requirement. 41 | function new(string name="cfg"); 42 | super.new(name); 43 | child_cfg = new({name, ".child_cfg"}); 44 | uvm_resource_db#(int)::read_by_name("uvm_root", "coverage_enable", coverage_enable, this); 45 | if(coverage_enable) 46 | cg = new(); 47 | endfunction : new 48 | 49 | //////////////////////////////////////////// 50 | // func: sample_cg 51 | // Sample covergroups when called 52 | virtual function void sample_cg(); 53 | if(cg) 54 | cg.sample(); 55 | child_cfg.sample_cg(); 56 | endfunction : sample_cg 57 | 58 | //---------------------------------------------------------------------------------------- 59 | // Group: Functional Coverage 60 | // All functional covergroups go here 61 | covergroup cg; 62 | endgroup : cg 63 | endclass : cfg_c 64 | 65 | `endif // __CFG_SV__ 66 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/cmn/cmn_macros.sv: -------------------------------------------------------------------------------- 1 | 2 | // *********************************************************************** 3 | // File: cmn_macros.sv 4 | // Author: bhunter 5 | /* About: Common Macros 6 | Copyright (C) 2015-2016 Cavium, Inc. All rights reserved. 7 | *************************************************************************/ 8 | 9 | `ifndef __CMN_MACROS_SV__ 10 | `define __CMN_MACROS_SV__ 11 | 12 | `include "uvm_macros.svh" 13 | 14 | //---------------------------------------------------------------------------------------- 15 | // Includes 16 | `include "cmn_msgs.sv" 17 | 18 | //////////////////////////////////////////// 19 | // macro: `cmn_seq_raise 20 | // Handy macro to ensure that all sequences raise the phase's objection if they are the default phase. 21 | `ifdef UVM_MAJOR_VERSION_1_1 22 | `define cmn_seq_raise \ 23 | begin \ 24 | if(starting_phase) \ 25 | starting_phase.raise_objection(this); \ 26 | end 27 | `endif // UVM_MAJOR_VERSION_1_1 28 | `ifdef UVM_MAJOR_VERSION_1_2 29 | `define cmn_seq_raise \ 30 | begin \ 31 | if(get_starting_phase()) \ 32 | get_starting_phase().raise_objection(this); \ 33 | end 34 | `endif // UVM_MAJOR_VERSION_1_2 35 | 36 | //////////////////////////////////////////// 37 | // macro: `cmn_seq_drop 38 | // Handy macro to ensure that all sequences drop the phase's objection if they are the default phase. 39 | `ifdef UVM_MAJOR_VERSION_1_1 40 | `define cmn_seq_drop \ 41 | begin \ 42 | if(starting_phase) \ 43 | starting_phase.drop_objection(this); \ 44 | end 45 | `endif // UVM_MAJOR_VERSION_1_1 46 | `ifdef UVM_MAJOR_VERSION_1_2 47 | `define cmn_seq_drop \ 48 | begin \ 49 | if(get_starting_phase()) \ 50 | get_starting_phase().drop_objection(this); \ 51 | end 52 | `endif // UVM_MAJOR_VERSION_1_2 53 | 54 | //////////////////////////////////////////// 55 | // macro: `cmn_set_intf 56 | `define cmn_set_intf(TYPE, RSRC, NAME, INSTANCE) \ 57 | begin \ 58 | uvm_resource_db#(TYPE)::set(RSRC, NAME, INSTANCE); \ 59 | end 60 | 61 | //////////////////////////////////////////// 62 | // macro: `cmn_get_intf 63 | `define cmn_get_intf(TYPE, RSRC, NAME, VARIABLE) \ 64 | begin \ 65 | if(!uvm_resource_db#(TYPE)::read_by_name(RSRC, NAME, VARIABLE)) \ 66 | `cmn_err(("%s.%s interface not found in resource database.", RSRC, NAME)); \ 67 | end 68 | 69 | `endif // __CMN_MACROS_SV__ -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_2/src/tlm2/uvm_tlm2_exports.svh: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------- 2 | // Copyright 2010 Mentor Graphics Corporation 3 | // Copyright 2010 Synopsys, Inc. 4 | // All Rights Reserved Worldwide 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the 7 | // "License"); you may not use this file except in 8 | // compliance with the License. You may obtain a copy of 9 | // the License at 10 | // 11 | // http://www.apache.org/licenses/LICENSE-2.0 12 | // 13 | // Unless required by applicable law or agreed to in 14 | // writing, software distributed under the License is 15 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 16 | // CONDITIONS OF ANY KIND, either express or implied. See 17 | // the License for the specific language governing 18 | // permissions and limitations under the License. 19 | //---------------------------------------------------------------------- 20 | 21 | //---------------------------------------------------------------------- 22 | // Title: TLM2 Export Classes 23 | // 24 | // This section defines the export classes for connecting TLM2 25 | // interfaces. 26 | //---------------------------------------------------------------------- 27 | 28 | 29 | // Class: uvm_tlm_b_transport_export 30 | // 31 | // Blocking transport export class. 32 | 33 | class uvm_tlm_b_transport_export #(type T=uvm_tlm_generic_payload) 34 | extends uvm_port_base #(uvm_tlm_if #(T)); 35 | `UVM_EXPORT_COMMON(`UVM_TLM_B_MASK, "uvm_tlm_b_transport_export") 36 | `UVM_TLM_B_TRANSPORT_IMP(this.m_if, T, t, delay) 37 | endclass 38 | 39 | 40 | 41 | // Class: uvm_tlm_nb_transport_fw_export 42 | // 43 | // Non-blocking forward transport export class 44 | 45 | class uvm_tlm_nb_transport_fw_export #(type T=uvm_tlm_generic_payload, 46 | type P=uvm_tlm_phase_e) 47 | extends uvm_port_base #(uvm_tlm_if #(T,P)); 48 | `UVM_EXPORT_COMMON(`UVM_TLM_NB_FW_MASK, "uvm_tlm_nb_transport_fw_export") 49 | `UVM_TLM_NB_TRANSPORT_FW_IMP(this.m_if, T, P, t, p, delay) 50 | endclass 51 | 52 | 53 | 54 | // Class: uvm_tlm_nb_transport_bw_export 55 | // 56 | // Non-blocking backward transport export class 57 | 58 | class uvm_tlm_nb_transport_bw_export #(type T=uvm_tlm_generic_payload, 59 | type P=uvm_tlm_phase_e) 60 | extends uvm_port_base #(uvm_tlm_if #(T,P)); 61 | // Function: new 62 | `UVM_EXPORT_COMMON(`UVM_TLM_NB_BW_MASK, "uvm_tlm_nb_transport_bw_export") 63 | `UVM_TLM_NB_TRANSPORT_BW_IMP(this.m_if, T, P, t, p, delay) 64 | endclass 65 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_1d/src/tlm2/uvm_tlm2_exports.svh: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------- 2 | // Copyright 2010 Mentor Graphics Corporation 3 | // Copyright 2010 Synopsys, Inc. 4 | // All Rights Reserved Worldwide 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the 7 | // "License"); you may not use this file except in 8 | // compliance with the License. You may obtain a copy of 9 | // the License at 10 | // 11 | // http://www.apache.org/licenses/LICENSE-2.0 12 | // 13 | // Unless required by applicable law or agreed to in 14 | // writing, software distributed under the License is 15 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 16 | // CONDITIONS OF ANY KIND, either express or implied. See 17 | // the License for the specific language governing 18 | // permissions and limitations under the License. 19 | //---------------------------------------------------------------------- 20 | 21 | //---------------------------------------------------------------------- 22 | // Title: TLM2 Export Classes 23 | // 24 | // This section defines the export classes for connecting TLM2 25 | // interfaces. 26 | //---------------------------------------------------------------------- 27 | 28 | 29 | // Class: uvm_tlm_b_transport_export 30 | // 31 | // Blocking transport export class. 32 | 33 | class uvm_tlm_b_transport_export #(type T=uvm_tlm_generic_payload) 34 | extends uvm_port_base #(uvm_tlm_if #(T)); 35 | `UVM_EXPORT_COMMON(`UVM_TLM_B_MASK, "uvm_tlm_b_transport_export") 36 | `UVM_TLM_B_TRANSPORT_IMP(this.m_if, T, t, delay) 37 | endclass 38 | 39 | 40 | 41 | // Class: uvm_tlm_nb_transport_fw_export 42 | // 43 | // Non-blocking forward transport export class 44 | 45 | class uvm_tlm_nb_transport_fw_export #(type T=uvm_tlm_generic_payload, 46 | type P=uvm_tlm_phase_e) 47 | extends uvm_port_base #(uvm_tlm_if #(T,P)); 48 | `UVM_EXPORT_COMMON(`UVM_TLM_NB_FW_MASK, "uvm_tlm_nb_transport_fw_export") 49 | `UVM_TLM_NB_TRANSPORT_FW_IMP(this.m_if, T, P, t, p, delay) 50 | endclass 51 | 52 | 53 | 54 | // Class: uvm_tlm_nb_transport_bw_export 55 | // 56 | // Non-blocking backward transport export class 57 | 58 | class uvm_tlm_nb_transport_bw_export #(type T=uvm_tlm_generic_payload, 59 | type P=uvm_tlm_phase_e) 60 | extends uvm_port_base #(uvm_tlm_if #(T,P)); 61 | // Function: new 62 | `UVM_EXPORT_COMMON(`UVM_TLM_NB_BW_MASK, "uvm_tlm_nb_transport_bw_export") 63 | `UVM_TLM_NB_TRANSPORT_BW_IMP(this.m_if, T, P, t, p, delay) 64 | endclass 65 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/hawk/hawk_os_seq_lib.sv: -------------------------------------------------------------------------------- 1 | 2 | // *********************************************************************** 3 | // File: hawk_os_seq_lib.sv 4 | // Author: bhunter 5 | /* About: Operating-System Testing Sequence. 6 | This sequence runs during the main phase. It picks 50 random 7 | addresses, writes to them, and then performs 100 random reads, 8 | expecting each to match the expected results that were written 9 | before. 10 | Copyright (C) 2015-2016 Brian P. Hunter 11 | *************************************************************************/ 12 | 13 | `ifndef __HAWK_OS_SEQ_LIB_SV__ 14 | `define __HAWK_OS_SEQ_LIB_SV__ 15 | 16 | // class: os_main_seq_c 17 | class os_main_seq_c extends uvm_sequence#(os_item_c); 18 | `uvm_object_utils(hawk_pkg::os_main_seq_c) 19 | 20 | //---------------------------------------------------------------------------------------- 21 | // Group: Fields 22 | 23 | // var: addresses 24 | // 50 addresses to read and write to 25 | rand addr_t addresses[50]; 26 | 27 | // var: exp_results 28 | // The results expected upon reading 29 | data_t exp_results[addr_t]; 30 | 31 | //---------------------------------------------------------------------------------------- 32 | // Group: Methods 33 | function new(string name="os_seq"); 34 | super.new(name); 35 | endfunction : new 36 | 37 | //////////////////////////////////////////// 38 | // func: body 39 | virtual task body(); 40 | os_item_c item; 41 | int rd_idx; 42 | `cmn_seq_raise 43 | 44 | `cmn_info(("Sending in writes...")) 45 | 46 | // prime the addresses 47 | foreach(addresses[idx]) begin 48 | `uvm_do_with(item, { 49 | cmd == WR; 50 | addr == addresses[idx]; 51 | }) 52 | exp_results[item.addr] = item.data; 53 | end 54 | 55 | `cmn_info(("Sending in 100 reads...")) 56 | repeat(100) begin 57 | rd_idx = $urandom_range(0, 49); 58 | `uvm_do_with(item, { 59 | cmd == RD; 60 | addr == addresses[rd_idx]; 61 | }) 62 | get_response(rsp); 63 | `cmn_dbg(100, ("Received response from ADDR: %016X, DATA: %016X", addresses[rd_idx], rsp.data)) 64 | if(exp_results[addresses[rd_idx]] != rsp.data) 65 | `cmn_err(("Expected a value of %016X", exp_results[addresses[rd_idx]])) 66 | end 67 | 68 | `cmn_info(("All traffic completed.")) 69 | `cmn_seq_drop 70 | endtask : body 71 | endclass : os_main_seq_c 72 | 73 | `endif // __HAWK_OS_SEQ_LIB_SV__ 74 | 75 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_1d/src/dpi/uvm_regex.svh: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------- 2 | // Copyright 2010-2011 Mentor Graphics Corporation 3 | // All Rights Reserved Worldwide 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in 7 | // compliance with the License. You may obtain a copy of 8 | // the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in 13 | // writing, software distributed under the License is 14 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 15 | // CONDITIONS OF ANY KIND, either express or implied. See 16 | // the License for the specific language governing 17 | // permissions and limitations under the License. 18 | //---------------------------------------------------------------------- 19 | 20 | 21 | 22 | `ifndef UVM_REGEX_NO_DPI 23 | import "DPI-C" function int uvm_re_match(string re, string str); 24 | import "DPI-C" function void uvm_dump_re_cache(); 25 | import "DPI-C" function string uvm_glob_to_re(string glob); 26 | 27 | `else 28 | 29 | // The Verilog only version does not match regular expressions, 30 | // it only does glob style matching. 31 | function int uvm_re_match(string re, string str); 32 | int e, es, s, ss; 33 | string tmp; 34 | e = 0; s = 0; 35 | es = 0; ss = 0; 36 | 37 | if(re.len() == 0) 38 | return 0; 39 | 40 | // The ^ used to be used to remove the implicit wildcard, but now we don't 41 | // use implicit wildcard so this character is just stripped. 42 | if(re[0] == "^") 43 | re = re.substr(1, re.len()-1); 44 | 45 | //This loop is only needed when the first character of the re may not 46 | //be a *. 47 | while (s != str.len() && re.getc(e) != "*") begin 48 | if ((re.getc(e) != str.getc(s)) && (re.getc(e) != "?")) 49 | return 1; 50 | e++; s++; 51 | end 52 | 53 | while (s != str.len()) begin 54 | if (re.getc(e) == "*") begin 55 | e++; 56 | if (e == re.len()) begin 57 | return 0; 58 | end 59 | es = e; 60 | ss = s+1; 61 | end 62 | else if (re.getc(e) == str.getc(s) || re.getc(e) == "?") begin 63 | e++; 64 | s++; 65 | end 66 | else begin 67 | e = es; 68 | s = ss++; 69 | end 70 | end 71 | while (e < re.len() && re.getc(e) == "*") 72 | e++; 73 | if(e == re.len()) begin 74 | return 0; 75 | end 76 | else begin 77 | return 1; 78 | end 79 | endfunction 80 | 81 | function void uvm_dump_re_cache(); 82 | endfunction 83 | 84 | function string uvm_glob_to_re(string glob); 85 | return glob; 86 | endfunction 87 | 88 | `endif 89 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_2/src/dpi/uvm_regex.svh: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------- 2 | // Copyright 2010-2011 Mentor Graphics Corporation 3 | // All Rights Reserved Worldwide 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in 7 | // compliance with the License. You may obtain a copy of 8 | // the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in 13 | // writing, software distributed under the License is 14 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 15 | // CONDITIONS OF ANY KIND, either express or implied. See 16 | // the License for the specific language governing 17 | // permissions and limitations under the License. 18 | //---------------------------------------------------------------------- 19 | 20 | 21 | 22 | `ifndef UVM_REGEX_NO_DPI 23 | import "DPI-C" context function int uvm_re_match(string re, string str); 24 | import "DPI-C" context function void uvm_dump_re_cache(); 25 | import "DPI-C" context function string uvm_glob_to_re(string glob); 26 | 27 | `else 28 | 29 | // The Verilog only version does not match regular expressions, 30 | // it only does glob style matching. 31 | function int uvm_re_match(string re, string str); 32 | int e, es, s, ss; 33 | string tmp; 34 | e = 0; s = 0; 35 | es = 0; ss = 0; 36 | 37 | if(re.len() == 0) 38 | return 0; 39 | 40 | // The ^ used to be used to remove the implicit wildcard, but now we don't 41 | // use implicit wildcard so this character is just stripped. 42 | if(re[0] == "^") 43 | re = re.substr(1, re.len()-1); 44 | 45 | //This loop is only needed when the first character of the re may not 46 | //be a *. 47 | while (s != str.len() && re.getc(e) != "*") begin 48 | if ((re.getc(e) != str.getc(s)) && (re.getc(e) != "?")) 49 | return 1; 50 | e++; s++; 51 | end 52 | 53 | while (s != str.len()) begin 54 | if (re.getc(e) == "*") begin 55 | e++; 56 | if (e == re.len()) begin 57 | return 0; 58 | end 59 | es = e; 60 | ss = s+1; 61 | end 62 | else if (re.getc(e) == str.getc(s) || re.getc(e) == "?") begin 63 | e++; 64 | s++; 65 | end 66 | else begin 67 | e = es; 68 | s = ss++; 69 | end 70 | end 71 | while (e < re.len() && re.getc(e) == "*") 72 | e++; 73 | if(e == re.len()) begin 74 | return 0; 75 | end 76 | else begin 77 | return 1; 78 | end 79 | endfunction 80 | 81 | function void uvm_dump_re_cache(); 82 | endfunction 83 | 84 | function string uvm_glob_to_re(string glob); 85 | return glob; 86 | endfunction 87 | 88 | `endif 89 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_2/src/comps/uvm_subscriber.svh: -------------------------------------------------------------------------------- 1 | // 2 | //------------------------------------------------------------------------------ 3 | // Copyright 2007-2011 Mentor Graphics Corporation 4 | // Copyright 2007-2010 Cadence Design Systems, Inc. 5 | // Copyright 2010 Synopsys, Inc. 6 | // All Rights Reserved Worldwide 7 | // 8 | // Licensed under the Apache License, Version 2.0 (the 9 | // "License"); you may not use this file except in 10 | // compliance with the License. You may obtain a copy of 11 | // the License at 12 | // 13 | // http://www.apache.org/licenses/LICENSE-2.0 14 | // 15 | // Unless required by applicable law or agreed to in 16 | // writing, software distributed under the License is 17 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 18 | // CONDITIONS OF ANY KIND, either express or implied. See 19 | // the License for the specific language governing 20 | // permissions and limitations under the License. 21 | //------------------------------------------------------------------------------ 22 | 23 | //------------------------------------------------------------------------------ 24 | // 25 | // CLASS: uvm_subscriber 26 | // 27 | // This class provides an analysis export for receiving transactions from a 28 | // connected analysis export. Making such a connection "subscribes" this 29 | // component to any transactions emitted by the connected analysis port. 30 | // 31 | // Subtypes of this class must define the write method to process the incoming 32 | // transactions. This class is particularly useful when designing a coverage 33 | // collector that attaches to a monitor. 34 | //------------------------------------------------------------------------------ 35 | 36 | virtual class uvm_subscriber #(type T=int) extends uvm_component; 37 | 38 | typedef uvm_subscriber #(T) this_type; 39 | 40 | // Port: analysis_export 41 | // 42 | // This export provides access to the write method, which derived subscribers 43 | // must implement. 44 | 45 | uvm_analysis_imp #(T, this_type) analysis_export; 46 | 47 | // Function: new 48 | // 49 | // Creates and initializes an instance of this class using the normal 50 | // constructor arguments for : ~name~ is the name of the 51 | // instance, and ~parent~ is the handle to the hierarchical parent, if any. 52 | 53 | function new (string name, uvm_component parent); 54 | super.new(name, parent); 55 | analysis_export = new("analysis_imp", this); 56 | endfunction 57 | 58 | // Function: write 59 | // 60 | // A pure virtual method that must be defined in each subclass. Access 61 | // to this method by outside components should be done via the 62 | // analysis_export. 63 | 64 | pure virtual function void write(T t); 65 | 66 | endclass 67 | 68 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_1d/src/comps/uvm_subscriber.svh: -------------------------------------------------------------------------------- 1 | // 2 | //------------------------------------------------------------------------------ 3 | // Copyright 2007-2011 Mentor Graphics Corporation 4 | // Copyright 2007-2010 Cadence Design Systems, Inc. 5 | // Copyright 2010 Synopsys, Inc. 6 | // All Rights Reserved Worldwide 7 | // 8 | // Licensed under the Apache License, Version 2.0 (the 9 | // "License"); you may not use this file except in 10 | // compliance with the License. You may obtain a copy of 11 | // the License at 12 | // 13 | // http://www.apache.org/licenses/LICENSE-2.0 14 | // 15 | // Unless required by applicable law or agreed to in 16 | // writing, software distributed under the License is 17 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 18 | // CONDITIONS OF ANY KIND, either express or implied. See 19 | // the License for the specific language governing 20 | // permissions and limitations under the License. 21 | //------------------------------------------------------------------------------ 22 | 23 | //------------------------------------------------------------------------------ 24 | // 25 | // CLASS: uvm_subscriber 26 | // 27 | // This class provides an analysis export for receiving transactions from a 28 | // connected analysis export. Making such a connection "subscribes" this 29 | // component to any transactions emitted by the connected analysis port. 30 | // 31 | // Subtypes of this class must define the write method to process the incoming 32 | // transactions. This class is particularly useful when designing a coverage 33 | // collector that attaches to a monitor. 34 | //------------------------------------------------------------------------------ 35 | 36 | virtual class uvm_subscriber #(type T=int) extends uvm_component; 37 | 38 | typedef uvm_subscriber #(T) this_type; 39 | 40 | // Port: analysis_export 41 | // 42 | // This export provides access to the write method, which derived subscribers 43 | // must implement. 44 | 45 | uvm_analysis_imp #(T, this_type) analysis_export; 46 | 47 | // Function: new 48 | // 49 | // Creates and initializes an instance of this class using the normal 50 | // constructor arguments for : ~name~ is the name of the 51 | // instance, and ~parent~ is the handle to the hierarchical parent, if any. 52 | 53 | function new (string name, uvm_component parent); 54 | super.new(name, parent); 55 | analysis_export = new("analysis_imp", this); 56 | endfunction 57 | 58 | // Function: write 59 | // 60 | // A pure virtual method that must be defined in each subclass. Access 61 | // to this method by outside components should be done via the 62 | // analysis_export. 63 | 64 | pure virtual function void write(T t); 65 | 66 | endclass 67 | 68 | -------------------------------------------------------------------------------- /hawkins/verif/hawk/tests/passive.sv: -------------------------------------------------------------------------------- 1 | 2 | // *********************************************************************** 3 | // File: passive.sv 4 | // Author: bhunter 5 | /* About: Adds a passive agent to the environment. 6 | Copyright (C) 2015-2016 Cavium, Inc. All rights reserved. 7 | *************************************************************************/ 8 | 9 | `ifndef __PASSIVE_SV__ 10 | `define __PASSIVE_SV__ 11 | 12 | `include "basic.sv" 13 | 14 | // class: passive_test_c 15 | class passive_test_c extends basic_test_c; 16 | `uvm_component_utils(passive_test_c) 17 | 18 | //---------------------------------------------------------------------------------------- 19 | // Group: Fields 20 | 21 | // var: passive_hawk_env 22 | // Passively watches the same hawk interface 23 | hawk_pkg::env_c passive_hawk_env; 24 | 25 | //---------------------------------------------------------------------------------------- 26 | // Group: Methods 27 | function new(string name="passive", 28 | uvm_component parent=null); 29 | super.new(name, parent); 30 | endfunction : new 31 | 32 | //////////////////////////////////////////// 33 | // func: build_phase 34 | // Do not enable the phy level stuff. 35 | virtual function void build_phase(uvm_phase phase); 36 | super.build_phase(phase); 37 | 38 | // create a passive environment 39 | passive_hawk_env = hawk_pkg::env_c::type_id::create("passive_hawk_env", this); 40 | uvm_config_db#(uvm_object)::set(this, "passive_hawk_env", "cfg", cfg); 41 | 42 | // set the interfaces 43 | uvm_config_db#(string)::set(this, "passive_hawk_env.tx_agent.*", "intf_name", "hawk_tx_vi"); 44 | uvm_config_db#(string)::set(this, "passive_hawk_env.rx_agent.*", "intf_name", "hawk_rx_vi"); 45 | 46 | // use these chaining sequences 47 | uvm_config_db#(uvm_object_wrapper)::set(this, "passive_hawk_env.*_agent.phy_csqr.run_phase", "default_sequence", hawk_pkg::phy_cseq_c::type_id::get()); 48 | uvm_config_db#(uvm_object_wrapper)::set(this, "passive_hawk_env.*_agent.link_csqr.run_phase", "default_sequence", hawk_pkg::link_cseq_c::type_id::get()); 49 | uvm_config_db#(uvm_object_wrapper)::set(this, "passive_hawk_env.*_agent.trans_csqr.run_phase", "default_sequence", hawk_pkg::passive_trans_cseq_c::type_id::get()); 50 | 51 | // the passive environment will only use the passive version of the driver 52 | set_inst_override_by_type("passive_hawk_env.rx_agent.drv", hawk_pkg::drv_c::get_type(), hawk_pkg::passive_drv_c::get_type()); 53 | set_inst_override_by_type("passive_hawk_env.tx_agent.drv", hawk_pkg::drv_c::get_type(), hawk_pkg::passive_drv_c::get_type()); 54 | endfunction : build_phase 55 | 56 | endclass : passive_test_c 57 | 58 | `endif // __PASSIVE_SV__ 59 | 60 | -------------------------------------------------------------------------------- /design_patterns/agent.sv: -------------------------------------------------------------------------------- 1 | // *********************************************************************** 2 | // File: agent.sv 3 | // Author: bhunter 4 | /* About: 5 | Copyright (C) 2015-2016 Cavium, Inc. All rights reserved. 6 | *************************************************************************/ 7 | 8 | `ifndef __AGENT_SV__ 9 | `define __AGENT_SV__ 10 | 11 | // class: agent_c 12 | class agent_c extends uvm_agent; 13 | `uvm_component_utils_begin(my_pkg::agent_c) 14 | `uvm_field_enum(uvm_active_passive_enum, is_active, UVM_COMPONENT) 15 | `uvm_component_utils_end 16 | 17 | //---------------------------------------------------------------------------------------- 18 | // Group: Configuration Fields 19 | 20 | //---------------------------------------------------------------------------------------- 21 | // Group: TLM Ports 22 | 23 | // var: item_port 24 | // All monitored items go out here 25 | uvm_analysis_port#(item_c) item_port; 26 | 27 | //---------------------------------------------------------------------------------------- 28 | // Group: Fields 29 | 30 | // vars: drv, mon, sqr 31 | // Driver, monitor, and sequencer 32 | drv_c drv; 33 | mon_c mon; 34 | sqr_c sqr; 35 | 36 | //---------------------------------------------------------------------------------------- 37 | // Group: Methods 38 | function new(string name="agent", 39 | uvm_component parent=null); 40 | super.new(name, parent); 41 | endfunction : new 42 | 43 | //////////////////////////////////////////// 44 | // func: build_phase 45 | virtual function void build_phase(uvm_phase phase); 46 | super.build_phase(phase); 47 | 48 | mon = mon_c::type_id::create("mon", this); 49 | 50 | if(is_active) begin 51 | drv = drv_c::type_id::create("drv", this); 52 | sqr = sqr_c::type_id::create("sqr", this); 53 | end 54 | 55 | item_port = new("item_port", this); 56 | endfunction : build_phase 57 | 58 | //////////////////////////////////////////// 59 | // func: connect_phase 60 | virtual function void connect_phase(uvm_phase phase); 61 | super.connect_phase(phase); 62 | if(is_active) begin 63 | drv.seq_item_port.connect(sqr.seq_item_export); 64 | drv.downstream_port.connect(mon.upstream_imp); 65 | end 66 | 67 | // connect monitor’s item port to the agent’s 68 | mon.item_port.connect(item_port); 69 | endfunction : connect_phase 70 | 71 | //////////////////////////////////////////// 72 | // func: pre_reset_phase 73 | virtual task pre_reset_phase(uvm_phase phase); 74 | super.pre_reset_phase(phase); 75 | if(is_active) begin 76 | sqr.stop_sequences(); 77 | ->drv.reset_driver; 78 | end 79 | endtask: pre_reset_phase 80 | endclass : agent_c 81 | 82 | `endif // __AGENT_SV__ 83 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_2/src/uvm_macros.svh: -------------------------------------------------------------------------------- 1 | // 2 | //---------------------------------------------------------------------- 3 | // Copyright 2007-2011 Mentor Graphics Corporation 4 | // Copyright 2007-2011 Cadence Design Systems, Inc. 5 | // Copyright 2010-2011 Synopsys, Inc. 6 | // All Rights Reserved Worldwide 7 | // 8 | // Licensed under the Apache License, Version 2.0 (the 9 | // "License"); you may not use this file except in 10 | // compliance with the License. You may obtain a copy of 11 | // the License at 12 | // 13 | // http://www.apache.org/licenses/LICENSE-2.0 14 | // 15 | // Unless required by applicable law or agreed to in 16 | // writing, software distributed under the License is 17 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 18 | // CONDITIONS OF ANY KIND, either express or implied. See 19 | // the License for the specific language governing 20 | // permissions and limitations under the License. 21 | //---------------------------------------------------------------------- 22 | 23 | `ifndef UVM_MACROS_SVH 24 | `define UVM_MACROS_SVH 25 | 26 | // 27 | // Any vendor specific defines go here. 28 | // 29 | 30 | `ifdef MODEL_TECH 31 | `ifndef QUESTA 32 | `define QUESTA 33 | `endif 34 | `endif 35 | 36 | `ifndef UVM_USE_STRING_QUEUE_STREAMING_PACK 37 | `define UVM_STRING_QUEUE_STREAMING_PACK(q) uvm_pkg::m_uvm_string_queue_join(q) 38 | `endif 39 | 40 | `ifndef QUESTA 41 | `define uvm_typename(X) $typename(X) 42 | `else 43 | `define uvm_typename(X) $typename(X,39) 44 | `endif 45 | 46 | `ifdef VCS 47 | // `ifndef UVM_DISABLE_RESOURCE_CONVERTER 48 | 49 | //UVM_USE_RESOURCE_CONVERTER enables UVM-1.1d to print resources output to match uvm-1.1c. VCS2014.03 or later does not need resource_converter object. 50 | // As per agreement in Committee at time of UVM-1.1d, from UVM-1.2 onwards the default is to disable resource converter and allow simulators to deal with %p natively. If a user wishes to enable resource converter then they need to compile using +define+UVM_USE_RESOURCE_CONVERTER. The resource converter was never officially sanctioned by Accellera and is placed in the deprecated directory which may be removed in future version. 51 | // `define UVM_USE_RESOURCE_CONVERTER 52 | 53 | // `endif 54 | `endif 55 | 56 | `ifdef INCA 57 | `define UVM_USE_PROCESS_CONTAINER 58 | `endif 59 | 60 | // 61 | // Deprecation Control Macros 62 | // 63 | `ifdef UVM_NO_DEPRECATED 64 | `endif 65 | 66 | `define uvm_delay(TIME) #(TIME); 67 | 68 | 69 | `include "macros/uvm_version_defines.svh" 70 | `include "macros/uvm_global_defines.svh" 71 | `include "macros/uvm_message_defines.svh" 72 | `include "macros/uvm_phase_defines.svh" 73 | `include "macros/uvm_object_defines.svh" 74 | `include "macros/uvm_printer_defines.svh" 75 | `include "macros/uvm_tlm_defines.svh" 76 | `include "macros/uvm_sequence_defines.svh" 77 | `include "macros/uvm_callback_defines.svh" 78 | `include "macros/uvm_reg_defines.svh" 79 | `include "macros/uvm_deprecated_defines.svh" 80 | 81 | `endif 82 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/hawk/hawk_os_mem_seq.sv: -------------------------------------------------------------------------------- 1 | 2 | // *********************************************************************** 3 | // File: hawk_os_mem_seq.sv 4 | // Author: bhunter 5 | /* About: Handles all memory reads, writes, and responses. 6 | Copyright (C) 2015-2016 Brian P. Hunter 7 | *************************************************************************/ 8 | 9 | `ifndef __HAWK_OS_MEM_SEQ_SV__ 10 | `define __HAWK_OS_MEM_SEQ_SV__ 11 | 12 | `include "hawk_os_item.sv" 13 | `include "hawk_mem.sv" 14 | 15 | typedef class os_sqr_c; 16 | 17 | class os_mem_seq_c extends uvm_sequence #(os_item_c, os_item_c); 18 | `uvm_object_utils_begin(hawk_pkg::os_mem_seq_c) 19 | `uvm_object_utils_end 20 | `uvm_declare_p_sequencer(os_sqr_c) 21 | 22 | //---------------------------------------------------------------------------------------- 23 | // Group: Fields 24 | 25 | // var: mem 26 | // The memory instance 27 | mem_c mem; 28 | 29 | //---------------------------------------------------------------------------------------- 30 | // Group: Methods 31 | 32 | function new(string name="os_mem_seq"); 33 | super.new(name); 34 | endfunction : new 35 | 36 | //////////////////////////////////////////// 37 | // func: body 38 | virtual task body(); 39 | os_item_c rcvd_os_item; 40 | mem = p_sequencer.mem; 41 | 42 | forever begin 43 | p_sequencer.rcvd_os_item_fifo.get(rcvd_os_item); 44 | `cmn_dbg(200, ("RX: %s", rcvd_os_item.convert2string())) 45 | 46 | case(rcvd_os_item.cmd) 47 | WR : begin 48 | mem.memory[rcvd_os_item.addr] = rcvd_os_item.data; 49 | `cmn_dbg(200, ("Wrote [%08X] = %016X", rcvd_os_item.addr, rcvd_os_item.data)) 50 | end 51 | RD : send_read_response(rcvd_os_item); 52 | endcase 53 | end 54 | endtask : body 55 | 56 | //////////////////////////////////////////// 57 | // func: send_read_response 58 | // Given a read request, fetch the memory data and send a response item 59 | // that contains the correct data 60 | // return zeroes and emit a warning when reading from an uninitialized memory location 61 | virtual task send_read_response(os_item_c _read_request); 62 | os_item_c response_item; 63 | data_t rsp_data; 64 | 65 | if(!mem.memory.exists(_read_request.addr)) begin 66 | mem.memory[_read_request.addr] = 0; 67 | `cmn_warn(("Reading from uninitialized mem.memory location [%016X]", _read_request.addr)) 68 | end 69 | 70 | rsp_data = mem.memory[_read_request.addr]; 71 | 72 | `uvm_do_with(response_item, { 73 | cmd == RESP; 74 | addr == _read_request.addr; // this helps the transaction layer use the right tag 75 | data == rsp_data; 76 | }) 77 | 78 | `cmn_dbg(200, ("Responding: %s", response_item.convert2string())) 79 | endtask : send_read_response 80 | endclass : os_mem_seq_c 81 | 82 | `endif // __HAWK_OS_MEM_SEQ_SV__ 83 | 84 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/hawk/hawk_mon.sv: -------------------------------------------------------------------------------- 1 | 2 | // *********************************************************************** 3 | // File: hawk_mon.sv 4 | // Author: bhunter 5 | /* About: Monitors the interface for physical items 6 | Copyright (C) 2015-2016 Brian P. Hunter 7 | *************************************************************************/ 8 | 9 | `ifndef __HAWK_MON_SV__ 10 | `define __HAWK_MON_SV__ 11 | 12 | `include "hawk_phy_item.sv" 13 | `include "hawk_types.sv" 14 | 15 | // class: mon_c 16 | class mon_c extends uvm_monitor; 17 | `uvm_component_utils_begin(hawk_pkg::mon_c) 18 | `uvm_field_string(intf_name, UVM_DEFAULT) 19 | `uvm_component_utils_end 20 | 21 | //---------------------------------------------------------------------------------------- 22 | // Group: Configuration Fields 23 | 24 | // var: intf_name 25 | // Tie me to my interface 26 | string intf_name = ""; 27 | 28 | //---------------------------------------------------------------------------------------- 29 | // Group: TLM Ports 30 | 31 | // var: phy_item_port 32 | // All monitored PHY items go out here 33 | uvm_analysis_port#(phy_item_c) phy_item_port; 34 | 35 | //---------------------------------------------------------------------------------------- 36 | // Group: Fields 37 | 38 | // var: vi 39 | // Virtual Interface 40 | virtual hawk_intf.mon_mp vi; 41 | 42 | //---------------------------------------------------------------------------------------- 43 | // Group: Methods 44 | function new(string name="[name]", 45 | uvm_component parent=null); 46 | super.new(name, parent); 47 | endfunction : new 48 | 49 | //////////////////////////////////////////// 50 | // func: build_phase 51 | virtual function void build_phase(uvm_phase phase); 52 | super.build_phase(phase); 53 | `cmn_get_intf(virtual hawk_intf.mon_mp, "hawk_pkg::hawk_intf", intf_name, vi) 54 | phy_item_port = new("phy_item_port", this); 55 | endfunction : build_phase 56 | 57 | //////////////////////////////////////////// 58 | // func: run_phase 59 | virtual task run_phase(uvm_phase phase); 60 | forever begin 61 | @(posedge vi.mon_cb.rst_n); 62 | 63 | fork 64 | monitor(); 65 | join_none 66 | 67 | @(negedge vi.mon_cb.rst_n); 68 | disable fork; 69 | end 70 | endtask : run_phase 71 | 72 | //////////////////////////////////////////// 73 | // func: monitor 74 | // Watch the bus, transmit everything that is seen 75 | virtual task monitor(); 76 | phy_item_c item; 77 | forever begin 78 | @(vi.mon_cb); 79 | item = phy_item_c::type_id::create("item"); 80 | item.valid = vi.mon_cb.valid; 81 | item.data = vi.mon_cb.data; 82 | `cmn_dbg(300, ("MON: %s", item.convert2string())) 83 | phy_item_port.write(item); 84 | end 85 | endtask : monitor 86 | endclass : mon_c 87 | 88 | `endif // __HAWK_MON_SV__ 89 | 90 | -------------------------------------------------------------------------------- /recipes/2.clk_drv.sv: -------------------------------------------------------------------------------- 1 | // *********************************************************************** 2 | // File: 2.clk_drv.sv 3 | // Author: bhunter 4 | /* About: 5 | Copyright (C) 2015-2016 Cavium, Inc. All rights reserved. 6 | *************************************************************************/ 7 | 8 | `ifndef __2_CLK_DRV_SV__ 9 | `define __2_CLK_DRV_SV__ 10 | 11 | class clk_drv_c extends uvm_driver; 12 | `uvm_component_utils_begin(cmn_pkg::clk_drv_c) 13 | `uvm_field_string(intf_name, UVM_COMPONENT) 14 | `uvm_field_int(init_delay_ps, UVM_COMPONENT | UVM_DEC) 15 | `uvm_field_int(init_value, UVM_COMPONENT | UVM_DEC) 16 | `uvm_field_int(period_ps, UVM_COMPONENT | UVM_DEC) 17 | `uvm_component_utils_end 18 | 19 | //---------------------------------------------------------------------------------------- 20 | // Group: Configuration Fields 21 | 22 | // var: intf_name 23 | // Name in the resource database under which the interface is stored. The scope 24 | // under which it is stored is "cmn_pkg::clk_intf". 25 | string intf_name = ""; 26 | 27 | // var: period_ps 28 | // Period in ps. Ensure that default does not cause an infinite loop. 29 | int period_ps = 2000; 30 | 31 | // var: init_delay_ps 32 | // Initial delay in ps 33 | int init_delay_ps; 34 | 35 | // var: init_value 36 | // The starting value of the clock signal 37 | bit init_value; 38 | 39 | //---------------------------------------------------------------------------------------- 40 | // Group: Fields 41 | // interface to clock 42 | virtual cmn_clk_intf clk_vi; 43 | 44 | //---------------------------------------------------------------------------------------- 45 | // Group: Methods 46 | function new(string name="clk_drv", 47 | uvm_component parent=null); 48 | super.new(name, parent); 49 | endfunction : new 50 | 51 | //////////////////////////////////////////// 52 | // func: build_phase 53 | // Fetch the virtual interface 54 | virtual function void build_phase(uvm_phase phase); 55 | super.build_phase(phase); 56 | `cmn_get_intf(virtual cmn_clk_intf, "cmn_pkg::clk_intf", intf_name, clk_vi) 57 | endfunction : build_phase 58 | 59 | //////////////////////////////////////////// 60 | // func: run_phase 61 | // Produce the clock 62 | virtual task run_phase(uvm_phase phase); 63 | // Do some sanity checking of config items. 64 | if(init_delay_ps < 0) 65 | `cmn_fatal(("Clock init_delay_ps is less than zero!")) 66 | 67 | 68 | // this would cause an infinite loop 69 | if(period_ps == 0) 70 | `cmn_fatal(("Clock generator period is zero.")) 71 | 72 | // Time-zero setup 73 | clk_vi.clk = init_value; 74 | #(init_delay_ps*1ps); 75 | clk_vi.clk = ~init_value; 76 | 77 | forever 78 | #(period_ps * 1ps) clk_vi.clk = ~clk_vi.clk; 79 | endtask : run_phase 80 | endclass : clk_drv_c 81 | 82 | `endif // __2_CLK_DRV_SV__ 83 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/cmn/cmn_clk_drv.sv: -------------------------------------------------------------------------------- 1 | // *********************************************************************** 2 | // File: cmn_clk_drv.sv 3 | // Author: bhunter 4 | /* About: 5 | Copyright (C) 2015-2016 Cavium, Inc. All rights reserved. 6 | *************************************************************************/ 7 | 8 | `ifndef __CMN_CLK_DRV_SV__ 9 | `define __CMN_CLK_DRV_SV__ 10 | 11 | class clk_drv_c extends uvm_driver; 12 | `uvm_component_utils_begin(cmn_pkg::clk_drv_c) 13 | `uvm_field_string(intf_name, UVM_COMPONENT) 14 | `uvm_field_int(init_delay_ps, UVM_COMPONENT | UVM_DEC) 15 | `uvm_field_int(init_value, UVM_COMPONENT | UVM_DEC) 16 | `uvm_field_int(period_ps, UVM_COMPONENT | UVM_DEC) 17 | `uvm_component_utils_end 18 | 19 | //---------------------------------------------------------------------------------------- 20 | // Group: Configuration Fields 21 | 22 | // var: intf_name 23 | // Name in the resource database under which the interface is stored. The scope 24 | // under which it is stored is "cmn_pkg::clk_intf". 25 | string intf_name = ""; 26 | 27 | // var: period_ps 28 | // Period in ps. Ensure that default does not cause an infinite loop. 29 | int period_ps = 2000; 30 | 31 | // var: init_delay_ps 32 | // Initial delay in ps 33 | int init_delay_ps; 34 | 35 | // var: init_value 36 | // The starting value of the clock signal 37 | bit init_value; 38 | 39 | //---------------------------------------------------------------------------------------- 40 | // Group: Fields 41 | // interface to clock 42 | virtual cmn_clk_intf clk_vi; 43 | 44 | //---------------------------------------------------------------------------------------- 45 | // Group: Methods 46 | function new(string name="clk_drv", 47 | uvm_component parent=null); 48 | super.new(name, parent); 49 | endfunction : new 50 | 51 | //////////////////////////////////////////// 52 | // func: build_phase 53 | // Fetch the virtual interface 54 | virtual function void build_phase(uvm_phase phase); 55 | super.build_phase(phase); 56 | `cmn_get_intf(virtual cmn_clk_intf, "cmn_pkg::clk_intf", intf_name, clk_vi) 57 | endfunction : build_phase 58 | 59 | //////////////////////////////////////////// 60 | // func: run_phase 61 | // Produce the clock 62 | virtual task run_phase(uvm_phase phase); 63 | // Do some sanity checking of config items. 64 | if(init_delay_ps < 0) 65 | `cmn_fatal(("Clock init_delay_ps is less than zero!")) 66 | 67 | // this would cause an infinite loop 68 | if(period_ps == 0) 69 | `cmn_fatal(("Clock generator period is zero.")) 70 | 71 | // Time-zero setup 72 | clk_vi.clk = init_value; 73 | #(init_delay_ps*1ps); 74 | clk_vi.clk = ~init_value; 75 | 76 | forever 77 | #(period_ps * 1ps) clk_vi.clk = ~clk_vi.clk; 78 | endtask : run_phase 79 | endclass : clk_drv_c 80 | 81 | `endif // __CMN_CLK_DRV_SV__ 82 | 83 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/hawk/hawk_drv.sv: -------------------------------------------------------------------------------- 1 | // *********************************************************************** 2 | // File: hawk_drv.sv 3 | // Author: bhunter 4 | /* About: Hawk Driver 5 | Copyright (C) 2015-2016 Brian P. Hunter 6 | *************************************************************************/ 7 | 8 | `ifndef __HAWK_DRV_SV__ 9 | `define __HAWK_DRV_SV__ 10 | 11 | `include "hawk_phy_item.sv" 12 | `include "hawk_types.sv" 13 | 14 | // class: drv_c 15 | class drv_c extends uvm_driver#(phy_item_c); 16 | `uvm_component_utils_begin(hawk_pkg::drv_c) 17 | `uvm_field_string(intf_name, UVM_DEFAULT) 18 | `uvm_component_utils_end 19 | 20 | //---------------------------------------------------------------------------------------- 21 | // Group: Configuration Fields 22 | 23 | // var: intf_name 24 | // Name of virtual interface handle 25 | string intf_name = ""; 26 | 27 | //---------------------------------------------------------------------------------------- 28 | // Group: Fields 29 | 30 | // var: vi 31 | // The interface 32 | virtual hawk_intf.drv_mp vi; 33 | 34 | //---------------------------------------------------------------------------------------- 35 | // Group: Methods 36 | function new(string name="drv", 37 | uvm_component parent=null); 38 | super.new(name, parent); 39 | endfunction : new 40 | 41 | //////////////////////////////////////////// 42 | // func: build_phase 43 | virtual function void build_phase(uvm_phase phase); 44 | super.build_phase(phase); 45 | `cmn_get_intf(virtual hawk_intf.drv_mp, "hawk_pkg::hawk_intf", intf_name, vi) 46 | endfunction : build_phase 47 | 48 | //////////////////////////////////////////// 49 | // func: run_phase 50 | virtual task run_phase(uvm_phase phase); 51 | forever begin 52 | // wait first for reset to go high 53 | @(posedge vi.drv_cb.rst_n); 54 | 55 | // put interface in "reset" 56 | vi.drv_cb.valid <= 1'b0; 57 | vi.drv_cb.data <= 'h0; 58 | 59 | fork 60 | driver(); 61 | join_none 62 | 63 | @(negedge vi.drv_cb.rst_n); 64 | disable fork; 65 | end 66 | endtask : run_phase 67 | 68 | //////////////////////////////////////////// 69 | // func: driver 70 | // Drive stuff 71 | virtual task driver(); 72 | // ensure that we start on a clock edge 73 | @(vi.drv_cb); 74 | 75 | forever begin 76 | seq_item_port.try_next_item(req); 77 | if(!req) begin 78 | vi.drv_cb.valid <= 1'b0; 79 | vi.drv_cb.data <= 'h0; 80 | seq_item_port.get_next_item(req); 81 | @(vi.drv_cb); 82 | end 83 | 84 | `cmn_dbg(300, ("Driving %s", req.convert2string())) 85 | vi.drv_cb.valid <= req.valid; 86 | vi.drv_cb.data <= req.data; 87 | seq_item_port.item_done(); 88 | @(vi.drv_cb); 89 | end 90 | endtask : driver 91 | endclass : drv_c 92 | 93 | `endif // __HAWK_DRV_SV__ 94 | 95 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_2/src/tlm2/uvm_tlm2_ports.svh: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------- 2 | // Copyright 2010 Mentor Graphics Corporation 3 | // Copyright 2010 Synopsys, Inc. 4 | // All Rights Reserved Worldwide 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the 7 | // "License"); you may not use this file except in 8 | // compliance with the License. You may obtain a copy of 9 | // the License at 10 | // 11 | // http://www.apache.org/licenses/LICENSE-2.0 12 | // 13 | // Unless required by applicable law or agreed to in 14 | // writing, software distributed under the License is 15 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 16 | // CONDITIONS OF ANY KIND, either express or implied. See 17 | // the License for the specific language governing 18 | // permissions and limitations under the License. 19 | //---------------------------------------------------------------------- 20 | 21 | //---------------------------------------------------------------------- 22 | // Title: TLM2 ports 23 | // 24 | // The following defines TLM2 port classes. 25 | // 26 | //---------------------------------------------------------------------- 27 | 28 | // class: uvm_tlm_b_transport_port 29 | // 30 | // Class providing the blocking transport port. 31 | // The port can be bound to one export. 32 | // There is no backward path for the blocking transport. 33 | 34 | class uvm_tlm_b_transport_port #(type T=uvm_tlm_generic_payload) 35 | extends uvm_port_base #(uvm_tlm_if #(T)); 36 | `UVM_PORT_COMMON(`UVM_TLM_B_MASK, "uvm_tlm_b_transport_port") 37 | `UVM_TLM_B_TRANSPORT_IMP(this.m_if, T, t, delay) 38 | endclass 39 | 40 | 41 | // class: uvm_tlm_nb_transport_fw_port 42 | // 43 | // Class providing the non-blocking backward transport port. 44 | // Transactions received from the producer, on the forward path, are 45 | // sent back to the producer on the backward path using this 46 | // non-blocking transport port. 47 | // The port can be bound to one export. 48 | // 49 | 50 | class uvm_tlm_nb_transport_fw_port #(type T=uvm_tlm_generic_payload, 51 | type P=uvm_tlm_phase_e) 52 | extends uvm_port_base #(uvm_tlm_if #(T,P)); 53 | `UVM_PORT_COMMON(`UVM_TLM_NB_FW_MASK, "uvm_tlm_nb_transport_fw_port") 54 | `UVM_TLM_NB_TRANSPORT_FW_IMP(this.m_if, T, P, t, p, delay) 55 | endclass 56 | 57 | // class: uvm_tlm_nb_transport_bw_port 58 | // 59 | // Class providing the non-blocking backward transport port. 60 | // Transactions received from the producer, on the forward path, are 61 | // sent back to the producer on the backward path using this 62 | // non-blocking transport port 63 | // The port can be bound to one export. 64 | // 65 | 66 | class uvm_tlm_nb_transport_bw_port #(type T=uvm_tlm_generic_payload, 67 | type P=uvm_tlm_phase_e) 68 | extends uvm_port_base #(uvm_tlm_if #(T,P)); 69 | 70 | // Function: new 71 | `UVM_PORT_COMMON(`UVM_TLM_NB_BW_MASK, "uvm_tlm_nb_transport_bw_port") 72 | `UVM_TLM_NB_TRANSPORT_BW_IMP(this.m_if, T, P, t, p, delay) 73 | endclass 74 | 75 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_1d/src/tlm2/uvm_tlm2_ports.svh: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------- 2 | // Copyright 2010 Mentor Graphics Corporation 3 | // Copyright 2010 Synopsys, Inc. 4 | // All Rights Reserved Worldwide 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the 7 | // "License"); you may not use this file except in 8 | // compliance with the License. You may obtain a copy of 9 | // the License at 10 | // 11 | // http://www.apache.org/licenses/LICENSE-2.0 12 | // 13 | // Unless required by applicable law or agreed to in 14 | // writing, software distributed under the License is 15 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 16 | // CONDITIONS OF ANY KIND, either express or implied. See 17 | // the License for the specific language governing 18 | // permissions and limitations under the License. 19 | //---------------------------------------------------------------------- 20 | 21 | //---------------------------------------------------------------------- 22 | // Title: TLM2 ports 23 | // 24 | // The following defines TLM2 port classes. 25 | // 26 | //---------------------------------------------------------------------- 27 | 28 | // class: uvm_tlm_b_transport_port 29 | // 30 | // Class providing the blocking transport port, 31 | // The port can be bound to one export. 32 | // There is no backward path for the blocking transport. 33 | 34 | class uvm_tlm_b_transport_port #(type T=uvm_tlm_generic_payload) 35 | extends uvm_port_base #(uvm_tlm_if #(T)); 36 | `UVM_PORT_COMMON(`UVM_TLM_B_MASK, "uvm_tlm_b_transport_port") 37 | `UVM_TLM_B_TRANSPORT_IMP(this.m_if, T, t, delay) 38 | endclass 39 | 40 | 41 | // class: uvm_tlm_nb_transport_fw_port 42 | // 43 | // Class providing the non-blocking backward transport port. 44 | // Transactions received from the producer, on the forward path, are 45 | // sent back to the producer on the backward path using this 46 | // non-blocking transport port. 47 | // The port can be bound to one export. 48 | // 49 | 50 | class uvm_tlm_nb_transport_fw_port #(type T=uvm_tlm_generic_payload, 51 | type P=uvm_tlm_phase_e) 52 | extends uvm_port_base #(uvm_tlm_if #(T,P)); 53 | `UVM_PORT_COMMON(`UVM_TLM_NB_FW_MASK, "uvm_tlm_nb_transport_fw_port") 54 | `UVM_TLM_NB_TRANSPORT_FW_IMP(this.m_if, T, P, t, p, delay) 55 | endclass 56 | 57 | // class: uvm_tlm_nb_transport_bw_port 58 | // 59 | // Class providing the non-blocking backward transport port. 60 | // Transactions received from the producer, on the forward path, are 61 | // sent back to the producer on the backward path using this 62 | // non-blocking transport port 63 | // The port can be bound to one export. 64 | // 65 | 66 | class uvm_tlm_nb_transport_bw_port #(type T=uvm_tlm_generic_payload, 67 | type P=uvm_tlm_phase_e) 68 | extends uvm_port_base #(uvm_tlm_if #(T,P)); 69 | 70 | // Function: new 71 | `UVM_PORT_COMMON(`UVM_TLM_NB_BW_MASK, "uvm_tlm_nb_transport_bw_port") 72 | `UVM_TLM_NB_TRANSPORT_BW_IMP(this.m_if, T, P, t, p, delay) 73 | endclass 74 | 75 | -------------------------------------------------------------------------------- /recipes/21.reg_background_vseq.sv: -------------------------------------------------------------------------------- 1 | // *********************************************************************** 2 | // File: 21.reg_background_vseq.sv 3 | // Author: bhunter 4 | /* About: 5 | Copyright (C) 2015-2016 Brian P. Hunter 6 | *************************************************************************/ 7 | 8 | `ifndef __21_REG_BACKGROUND_VSEQ_SV__ 9 | `define __21_REG_BACKGROUND_VSEQ_SV__ 10 | 11 | `include "cmn_reg_background_cfg.sv" 12 | 13 | // class: reg_background_vseq_c 14 | class reg_background_vseq_c extends uvm_sequence; 15 | `uvm_object_utils_begin(cmn_pkg::reg_background_vseq_c) 16 | `uvm_object_utils_end 17 | 18 | //---------------------------------------------------------------------------------------- 19 | // Group: Fields 20 | 21 | // var: reg_block 22 | // A UVM register block containing the CSRs to read from 23 | uvm_reg_block reg_block; 24 | 25 | // var: cfg 26 | // The cfg policy class for background register reads 27 | reg_background_cfg_c cfg; 28 | 29 | //---------------------------------------------------------------------------------------- 30 | // Group: Methods 31 | function new(string name="reg_background_vseq"); 32 | super.new(name); 33 | endfunction : new 34 | 35 | //////////////////////////////////////////// 36 | // func: get_regs 37 | // Use the cfg.exclusion lists to return a queue of all registers 38 | virtual function void get_regs(output uvm_reg _regs[$]); 39 | uvm_reg all_regs[$]; 40 | reg_block.get_registers(all_regs); 41 | _regs = all_regs.find(it) with ( 42 | !(it.get_name() inside cfg.exclude_regs) && 43 | !(it.get_type_name() inside cfg.exclude_types) 44 | ); 45 | `cmn_info(("There are %0d registers to read from:", _regs.size())) 46 | endfunction : get_regs 47 | 48 | //////////////////////////////////////////// 49 | // func: body 50 | virtual task body(); 51 | uvm_reg regs[$]; 52 | uvm_reg reg_to_read; 53 | uvm_status_e status; 54 | uvm_phase main_phase = uvm_main_phase::get(); 55 | int unsigned rand_idx; 56 | 57 | assert(reg_block) else 58 | `cmn_fatal(("There is no reg_block")) 59 | assert(cfg) else 60 | `cmn_fatal(("There is no cfg")) 61 | 62 | get_regs(regs); 63 | 64 | // emit a warning if all registers were excluded 65 | if(regs.size() == 0) begin 66 | `cmn_warn(("All registers were excluded.")) 67 | return; 68 | end 69 | 70 | forever begin 71 | // wait a random delay 72 | cfg.rand_delays.wait_delay(); 73 | 74 | // get a random register from the queue and read it 75 | rand_idx = $urandom_range(regs.size()-1); 76 | reg_to_read = regs[rand_idx]; 77 | `cmn_dbg(200, ("Background reading from %s", reg_to_read.get_name())) 78 | main_phase.raise_objection(this, "Reading CSR"); 79 | reg_to_read.mirror(status); 80 | main_phase.drop_objection(this, "Done Reading CSR"); 81 | end 82 | endtask : body 83 | endclass : reg_background_vseq_c 84 | 85 | `endif // __21_REG_BACKGROUND_VSEQ_SV__ 86 | -------------------------------------------------------------------------------- /recipes/18.lib_vseq.sv: -------------------------------------------------------------------------------- 1 | // *********************************************************************** 2 | // File: 18.lib_vseq.sv 3 | // Author: bhunter 4 | /* About: 5 | Copyright (C) 2015-2016 Brian P. Hunter 6 | *************************************************************************/ 7 | 8 | `ifndef __18_LIB_VSEQ_SV__ 9 | `define __18_LIB_VSEQ_SV__ 10 | 11 | // class: lib_vseq_c 12 | class lib_vseq_c extends uvm_sequence; 13 | `uvm_object_utils(cmn_pkg::lib_vseq_c) 14 | 15 | //---------------------------------------------------------------------------------------- 16 | // Group: Fields 17 | 18 | // var: cfg 19 | // The cfg class for an exer_vseq 20 | lib_vseq_cfg_c cfg; 21 | 22 | // var: curr_cnt 23 | // The number of vseqs currently outstanding 24 | int unsigned curr_cnt; 25 | 26 | //---------------------------------------------------------------------------------------- 27 | // Group: Methods 28 | function new(string name="lib_vseq"); 29 | super.new(name); 30 | endfunction : new 31 | 32 | //////////////////////////////////////////// 33 | // func: body 34 | virtual task body(); 35 | string type_name; 36 | 37 | `cmn_seq_raise 38 | `cmn_info(("Launching %0d vseqs.", cfg.vseqs_to_send)) 39 | 40 | for(int num_sent = 0; num_sent < cfg.vseqs_to_send; num_sent++) begin 41 | automatic uvm_sequence vseq; 42 | 43 | // wait until the number outstanding is less than the maximum that are outstanding 44 | if(curr_cnt >= cfg.max_outstanding) begin 45 | `cmn_info(("Blocking until at least 1 sequence completes.")) 46 | wait(curr_cnt < cfg.max_outstanding); 47 | end 48 | 49 | // get the sequence type to send by getting the name of its type 50 | type_name = cfg.get_next_vseq(); 51 | 52 | // create the sequence based on the string. 53 | if(!$cast(vseq, uvm_factory::get().create_object_by_name(type_name, 54 | get_full_name(), type_name))) 55 | `cmn_fatal(("Unable to create a sequence of type %s", type_name)) 56 | 57 | // Set the sequence’s sequencer to be the one this sequence is operating on 58 | vseq.set_item_context(this, m_sequencer); 59 | 60 | // Randomize 61 | assert(vseq.randomize()) else begin 62 | `cmn_err(("Randomization of %s failed.", type_name)) 63 | continue; 64 | end 65 | 66 | `cmn_info(("Launching a sequence of type %s", type_name)) 67 | 68 | // The fork..join_none is what allows this code to send multiple sequences at once 69 | curr_cnt++; 70 | fork 71 | begin 72 | `uvm_send(vseq) 73 | curr_cnt--; 74 | end 75 | join_none 76 | end 77 | 78 | // ensure that all sequences complete before exiting. 79 | wait(curr_cnt == 0); 80 | `cmn_info(("Exerciser complete after %0d sequences.", cfg.vseqs_to_send)) 81 | 82 | // drop objection 83 | `cmn_seq_drop 84 | endtask : body 85 | endclass : lib_vseq_c 86 | 87 | `endif // __18_LIB_VSEQ_SV__ 88 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_1d/src/seq/uvm_push_sequencer.svh: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright 2007-2011 Mentor Graphics Corporation 3 | // Copyright 2007-2011 Cadence Design Systems, Inc. 4 | // Copyright 2010 Synopsys, Inc. 5 | // All Rights Reserved Worldwide 6 | // 7 | // Licensed under the Apache License, Version 2.0 (the 8 | // "License"); you may not use this file except in 9 | // compliance with the License. You may obtain a copy of 10 | // the License at 11 | // 12 | // http://www.apache.org/licenses/LICENSE-2.0 13 | // 14 | // Unless required by applicable law or agreed to in 15 | // writing, software distributed under the License is 16 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 17 | // CONDITIONS OF ANY KIND, either express or implied. See 18 | // the License for the specific language governing 19 | // permissions and limitations under the License. 20 | //------------------------------------------------------------------------------ 21 | 22 | 23 | //------------------------------------------------------------------------------ 24 | // 25 | // CLASS: uvm_push_sequencer #(REQ,RSP) 26 | // 27 | //------------------------------------------------------------------------------ 28 | 29 | class uvm_push_sequencer #(type REQ=uvm_sequence_item, RSP=REQ) 30 | extends uvm_sequencer_param_base #(REQ, RSP); 31 | 32 | typedef uvm_push_sequencer #( REQ , RSP) this_type; 33 | 34 | // Port: req_port 35 | // 36 | // The push sequencer requires access to a blocking put interface. 37 | // A continuous stream of sequence items are sent out this port, based on 38 | // the list of available sequences loaded into this sequencer. 39 | // 40 | uvm_blocking_put_port #(REQ) req_port; 41 | 42 | 43 | // Function: new 44 | // 45 | // Standard component constructor that creates an instance of this class 46 | // using the given ~name~ and ~parent~, if any. 47 | // 48 | function new (string name, uvm_component parent=null); 49 | super.new(name, parent); 50 | req_port = new ("req_port", this); 51 | endfunction 52 | 53 | 54 | // Task: run_phase 55 | // 56 | // The push sequencer continuously selects from its list of available 57 | // sequences and sends the next item from the selected sequence out its 58 | // using req_port.put(item). Typically, the req_port would be 59 | // connected to the req_export on an instance of an 60 | // , which would be responsible for 61 | // executing the item. 62 | // 63 | task run_phase(uvm_phase phase); 64 | REQ t; 65 | int selected_sequence; 66 | 67 | fork 68 | super.run_phase(phase); 69 | forever 70 | begin 71 | m_select_sequence(); 72 | m_req_fifo.get(t); 73 | req_port.put(t); 74 | m_wait_for_item_sequence_id = t.get_sequence_id(); 75 | m_wait_for_item_transaction_id = t.get_transaction_id(); 76 | end 77 | join 78 | endtask 79 | 80 | protected virtual function int m_find_number_driver_connections(); 81 | return req_port.size(); 82 | endfunction 83 | 84 | endclass 85 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_2/src/seq/uvm_push_sequencer.svh: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // Copyright 2007-2011 Mentor Graphics Corporation 3 | // Copyright 2007-2011 Cadence Design Systems, Inc. 4 | // Copyright 2010 Synopsys, Inc. 5 | // All Rights Reserved Worldwide 6 | // 7 | // Licensed under the Apache License, Version 2.0 (the 8 | // "License"); you may not use this file except in 9 | // compliance with the License. You may obtain a copy of 10 | // the License at 11 | // 12 | // http://www.apache.org/licenses/LICENSE-2.0 13 | // 14 | // Unless required by applicable law or agreed to in 15 | // writing, software distributed under the License is 16 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 17 | // CONDITIONS OF ANY KIND, either express or implied. See 18 | // the License for the specific language governing 19 | // permissions and limitations under the License. 20 | //------------------------------------------------------------------------------ 21 | 22 | 23 | //------------------------------------------------------------------------------ 24 | // 25 | // CLASS: uvm_push_sequencer #(REQ,RSP) 26 | // 27 | //------------------------------------------------------------------------------ 28 | 29 | class uvm_push_sequencer #(type REQ=uvm_sequence_item, RSP=REQ) 30 | extends uvm_sequencer_param_base #(REQ, RSP); 31 | 32 | typedef uvm_push_sequencer #( REQ , RSP) this_type; 33 | 34 | // Port: req_port 35 | // 36 | // The push sequencer requires access to a blocking put interface. 37 | // A continuous stream of sequence items are sent out this port, based on 38 | // the list of available sequences loaded into this sequencer. 39 | // 40 | uvm_blocking_put_port #(REQ) req_port; 41 | 42 | 43 | // Function: new 44 | // 45 | // Standard component constructor that creates an instance of this class 46 | // using the given ~name~ and ~parent~, if any. 47 | // 48 | function new (string name, uvm_component parent=null); 49 | super.new(name, parent); 50 | req_port = new ("req_port", this); 51 | endfunction 52 | 53 | 54 | // Task: run_phase 55 | // 56 | // The push sequencer continuously selects from its list of available 57 | // sequences and sends the next item from the selected sequence out its 58 | // using req_port.put(item). Typically, the req_port would be 59 | // connected to the req_export on an instance of a 60 | // , which would be responsible for 61 | // executing the item. 62 | // 63 | task run_phase(uvm_phase phase); 64 | REQ t; 65 | int selected_sequence; 66 | 67 | fork 68 | super.run_phase(phase); 69 | forever 70 | begin 71 | m_select_sequence(); 72 | m_req_fifo.get(t); 73 | req_port.put(t); 74 | m_wait_for_item_sequence_id = t.get_sequence_id(); 75 | m_wait_for_item_transaction_id = t.get_transaction_id(); 76 | end 77 | join 78 | endtask 79 | 80 | protected virtual function int m_find_number_driver_connections(); 81 | return req_port.size(); 82 | endfunction 83 | 84 | endclass 85 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/hawk/hawk_os_sqr.sv: -------------------------------------------------------------------------------- 1 | 2 | // *********************************************************************** 3 | // File: hawk_os_sqr.sv 4 | // Author: bhunter 5 | /* About: The operating system sequencer. 6 | Copyright (C) 2015-2016 Brian P. Hunter 7 | *************************************************************************/ 8 | 9 | `ifndef __HAWK_OS_SQR_SV__ 10 | `define __HAWK_OS_SQR_SV__ 11 | 12 | `include "hawk_mem.sv" 13 | 14 | typedef class os_mem_seq_c; 15 | 16 | //**************************************************************************************** 17 | // class: os_sqr_c 18 | // A sequencer that operates at the OS level. Holds a handle to the memory so that the os_mem_seq 19 | // can perform reads, writes, and generate responses 20 | class os_sqr_c extends uvm_sequencer#(os_item_c, os_item_c); 21 | `uvm_component_utils_begin(hawk_pkg::os_sqr_c) 22 | `uvm_field_object(mem, UVM_REFERENCE) 23 | `uvm_component_utils_end 24 | 25 | //---------------------------------------------------------------------------------------- 26 | // Group: Configuration Fields 27 | 28 | // var: mem 29 | // A handle to the memory component 30 | mem_c mem; 31 | 32 | //---------------------------------------------------------------------------------------- 33 | // Group: TLM Ports 34 | 35 | // var: rcvd_os_item_export 36 | // Receives all OS-level items from the other agent. 37 | uvm_analysis_export #(os_item_c) rcvd_os_item_export; 38 | 39 | //---------------------------------------------------------------------------------------- 40 | // Group: Fields 41 | 42 | // var: rcvd_os_item_fifo 43 | // Gets the OS items and holds them for the os_mem sequence 44 | uvm_tlm_analysis_fifo#(os_item_c) rcvd_os_item_fifo; 45 | 46 | //---------------------------------------------------------------------------------------- 47 | // Group: Methods 48 | function new(string name="os_vsqr", 49 | uvm_component parent=null); 50 | super.new(name, parent); 51 | endfunction : new 52 | 53 | //////////////////////////////////////////// 54 | // func: build_phase 55 | // Ensure that the memory component was populated 56 | virtual function void build_phase(uvm_phase phase); 57 | super.build_phase(phase); 58 | assert(mem) else 59 | `cmn_fatal(("Eek! There is no mem")) 60 | // build export and fifo 61 | rcvd_os_item_export = new("rcvd_os_item_export", this); 62 | rcvd_os_item_fifo = new("rcvd_os_item_fifo", this); 63 | endfunction : build_phase 64 | 65 | //////////////////////////////////////////// 66 | // func: connect_phase 67 | // Connext rcvd_os_item_export to fifo 68 | virtual function void connect_phase(uvm_phase phase); 69 | super.connect_phase(phase); 70 | rcvd_os_item_export.connect(rcvd_os_item_fifo.analysis_export); 71 | endfunction : connect_phase 72 | 73 | //////////////////////////////////////////// 74 | // func: run_phase 75 | // Launch the memory handler sequence 76 | virtual task run_phase(uvm_phase phase); 77 | os_mem_seq_c os_mem_seq = os_mem_seq_c::type_id::create("os_mem_seq"); 78 | os_mem_seq.start(this); 79 | endtask : run_phase 80 | endclass : os_sqr_c 81 | 82 | `endif // __HAWK_OS_SQR_SV__ 83 | 84 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_1d/src/macros/uvm_undefineall.svh: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------- 2 | // Copyright 2007-2010 Mentor Graphics Corporation 3 | // Copyright 2007-2010 Cadence Design Systems, Inc. 4 | // Copyright 2010 Synopsys, Inc. 5 | // All Rights Reserved Worldwide 6 | // 7 | // Licensed under the Apache License, Version 2.0 (the 8 | // "License"); you may not use this file except in 9 | // compliance with the License. You may obtain a copy of 10 | // the License at 11 | // 12 | // http://www.apache.org/licenses/LICENSE-2.0 13 | // 14 | // Unless required by applicable law or agreed to in 15 | // writing, software distributed under the License is 16 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 17 | // CONDITIONS OF ANY KIND, either express or implied. See 18 | // the License for the specific language governing 19 | // permissions and limitations under the License. 20 | //---------------------------------------------------------------------- 21 | // This file undefs all macros that are defined by the UVM library. This can 22 | // be used to load uvm into multiple scopes using a single compilation. 23 | 24 | `undef UVM_BLOCKING_GET_IMP 25 | `undef UVM_BLOCKING_GET_IMP_SFX 26 | `undef UVM_BLOCKING_GET_PEEK_IMP 27 | `undef UVM_BLOCKING_PEEK_IMP 28 | `undef UVM_BLOCKING_PEEK_IMP_SFX 29 | `undef UVM_BLOCKING_PUT_IMP 30 | `undef UVM_BLOCKING_PUT_IMP_SFX 31 | `undef UVM_BLOCKING_TRANSPORT_IMP 32 | `undef UVM_BLOCKING_TRANSPORT_IMP_SFX 33 | `undef DODEEPCOPY 34 | `undef DOREFERENCECOPY 35 | `undef DOSHALLOWCOPY 36 | `undef UVM_FUNCTION_ERROR 37 | `undef UVM_GET_IMP 38 | `undef UVM_GET_PEEK_IMP 39 | `undef M_RESIZE_QUEUE_COPY 40 | `undef M_RESIZE_QUEUE_NOCOPY 41 | `undef M_RESIZE_QUEUE_OBJECT_COPY 42 | `undef M_RESIZE_QUEUE_OBJECT_NOCOPY 43 | `undef m_uvm_record_any_object 44 | `undef m_uvm_record_array_int 45 | `undef m_uvm_record_array_object 46 | `undef m_uvm_record_array_string 47 | `undef m_uvm_record_int 48 | `undef m_uvm_record_object 49 | `undef m_uvm_record_qda_enum 50 | `undef m_uvm_record_string 51 | `undef UVM_NONBLOCKING_GET_IMP 52 | `undef UVM_NONBLOCKING_GET_IMP_SFX 53 | `undef UVM_NONBLOCKING_GET_PEEK_IMP 54 | `undef UVM_NONBLOCKING_PEEK_IMP 55 | `undef UVM_NONBLOCKING_PEEK_IMP_SFX 56 | `undef UVM_NONBLOCKING_PUT_IMP 57 | `undef UVM_NONBLOCKING_PUT_IMP_SFX 58 | `undef UVM_NONBLOCKING_TRANSPORT_IMP 59 | `undef UVM_NONBLOCKING_TRANSPORT_IMP_SFX 60 | `undef UVM_PEEK_IMP 61 | `undef print_enum_field 62 | `undef print_integral_field 63 | `undef _protected 64 | `undef UVM_PUT_IMP 65 | `undef UVM_SEQ_ITEM_FUNCTION_ERROR 66 | `undef UVM_SEQ_ITEM_GET_MASK 67 | `undef UVM_SEQ_ITEM_GET_NEXT_ITEM_MASK 68 | `undef UVM_SEQ_ITEM_HAS_DO_AVAILABLE_MASK 69 | `undef UVM_SEQ_ITEM_ITEM_DONE_MASK 70 | `undef UVM_SEQ_ITEM_PEEK_MASK 71 | `undef UVM_SEQ_ITEM_PULL_IMP 72 | `undef UVM_SEQ_ITEM_PULL_MASK 73 | `undef UVM_SEQ_ITEM_PUSH_MASK 74 | `undef UVM_SEQ_ITEM_PUT_MASK 75 | `undef UVM_SEQ_ITEM_PUT_RESPONSE_MASK 76 | `undef UVM_SEQ_ITEM_TASK_ERROR 77 | `undef UVM_SEQ_ITEM_TRY_NEXT_ITEM_MASK 78 | `undef UVM_SEQ_ITEM_UNI_PULL_MASK 79 | `undef UVM_SEQ_ITEM_WAIT_FOR_SEQUENCES_MASK 80 | `undef UVM_TASK_ERROR 81 | `undef UVM_TRANSPORT_IMP 82 | `undef _UVM_CB_MSG_NO_CBS 83 | `undef _UVM_CB_MSG_NOT_REG 84 | `undef _UVM_CB_MSG_NULL_CB 85 | `undef _UVM_CB_MSG_NULL_OBJ 86 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_2/src/macros/uvm_undefineall.svh: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------- 2 | // Copyright 2007-2010 Mentor Graphics Corporation 3 | // Copyright 2007-2010 Cadence Design Systems, Inc. 4 | // Copyright 2010 Synopsys, Inc. 5 | // All Rights Reserved Worldwide 6 | // 7 | // Licensed under the Apache License, Version 2.0 (the 8 | // "License"); you may not use this file except in 9 | // compliance with the License. You may obtain a copy of 10 | // the License at 11 | // 12 | // http://www.apache.org/licenses/LICENSE-2.0 13 | // 14 | // Unless required by applicable law or agreed to in 15 | // writing, software distributed under the License is 16 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 17 | // CONDITIONS OF ANY KIND, either express or implied. See 18 | // the License for the specific language governing 19 | // permissions and limitations under the License. 20 | //---------------------------------------------------------------------- 21 | // This file undefs all macros that are defined by the UVM library. This can 22 | // be used to load uvm into multiple scopes using a single compilation. 23 | 24 | `undef UVM_BLOCKING_GET_IMP 25 | `undef UVM_BLOCKING_GET_IMP_SFX 26 | `undef UVM_BLOCKING_GET_PEEK_IMP 27 | `undef UVM_BLOCKING_PEEK_IMP 28 | `undef UVM_BLOCKING_PEEK_IMP_SFX 29 | `undef UVM_BLOCKING_PUT_IMP 30 | `undef UVM_BLOCKING_PUT_IMP_SFX 31 | `undef UVM_BLOCKING_TRANSPORT_IMP 32 | `undef UVM_BLOCKING_TRANSPORT_IMP_SFX 33 | `undef DODEEPCOPY 34 | `undef DOREFERENCECOPY 35 | `undef DOSHALLOWCOPY 36 | `undef UVM_FUNCTION_ERROR 37 | `undef UVM_GET_IMP 38 | `undef UVM_GET_PEEK_IMP 39 | `undef M_RESIZE_QUEUE_COPY 40 | `undef M_RESIZE_QUEUE_NOCOPY 41 | `undef M_RESIZE_QUEUE_OBJECT_COPY 42 | `undef M_RESIZE_QUEUE_OBJECT_NOCOPY 43 | `undef m_uvm_record_any_object 44 | `undef m_uvm_record_array_int 45 | `undef m_uvm_record_array_object 46 | `undef m_uvm_record_array_string 47 | `undef m_uvm_record_int 48 | `undef m_uvm_record_object 49 | `undef m_uvm_record_qda_enum 50 | `undef m_uvm_record_string 51 | `undef UVM_NONBLOCKING_GET_IMP 52 | `undef UVM_NONBLOCKING_GET_IMP_SFX 53 | `undef UVM_NONBLOCKING_GET_PEEK_IMP 54 | `undef UVM_NONBLOCKING_PEEK_IMP 55 | `undef UVM_NONBLOCKING_PEEK_IMP_SFX 56 | `undef UVM_NONBLOCKING_PUT_IMP 57 | `undef UVM_NONBLOCKING_PUT_IMP_SFX 58 | `undef UVM_NONBLOCKING_TRANSPORT_IMP 59 | `undef UVM_NONBLOCKING_TRANSPORT_IMP_SFX 60 | `undef UVM_PEEK_IMP 61 | `undef print_enum_field 62 | `undef print_integral_field 63 | `undef _protected 64 | `undef UVM_PUT_IMP 65 | `undef UVM_SEQ_ITEM_FUNCTION_ERROR 66 | `undef UVM_SEQ_ITEM_GET_MASK 67 | `undef UVM_SEQ_ITEM_GET_NEXT_ITEM_MASK 68 | `undef UVM_SEQ_ITEM_HAS_DO_AVAILABLE_MASK 69 | `undef UVM_SEQ_ITEM_ITEM_DONE_MASK 70 | `undef UVM_SEQ_ITEM_PEEK_MASK 71 | `undef UVM_SEQ_ITEM_PULL_IMP 72 | `undef UVM_SEQ_ITEM_PULL_MASK 73 | `undef UVM_SEQ_ITEM_PUSH_MASK 74 | `undef UVM_SEQ_ITEM_PUT_MASK 75 | `undef UVM_SEQ_ITEM_PUT_RESPONSE_MASK 76 | `undef UVM_SEQ_ITEM_TASK_ERROR 77 | `undef UVM_SEQ_ITEM_TRY_NEXT_ITEM_MASK 78 | `undef UVM_SEQ_ITEM_UNI_PULL_MASK 79 | `undef UVM_SEQ_ITEM_WAIT_FOR_SEQUENCES_MASK 80 | `undef UVM_TASK_ERROR 81 | `undef UVM_TRANSPORT_IMP 82 | `undef _UVM_CB_MSG_NO_CBS 83 | `undef _UVM_CB_MSG_NOT_REG 84 | `undef _UVM_CB_MSG_NULL_CB 85 | `undef _UVM_CB_MSG_NULL_OBJ 86 | -------------------------------------------------------------------------------- /recipes/18.lib_vseq_cfg.sv: -------------------------------------------------------------------------------- 1 | // *********************************************************************** 2 | // File: 18.lib_vseq_cfg.sv 3 | // Author: bhunter 4 | /* About: 5 | Copyright (C) 2015-2016 Brian P. Hunter 6 | *************************************************************************/ 7 | 8 | `ifndef __18_LIB_VSEQ_CFG_SV__ 9 | `define __18_LIB_VSEQ_CFG_SV__ 10 | 11 | // class: lib_vseq_cfg_c 12 | class lib_vseq_cfg_c extends uvm_object; 13 | `uvm_object_utils_begin(cmn_pkg::lib_vseq_cfg_c) 14 | `uvm_field_int(vseqs_to_send, UVM_DEFAULT | UVM_DEC) 15 | `uvm_field_int(max_outstanding, UVM_DEFAULT | UVM_DEC) 16 | `uvm_object_utils_end 17 | //---------------------------------------------------------------------------------------- 18 | // Group: Fields 19 | 20 | // var: vseqs_to_send 21 | // The number of virtual sequences that will be sent 22 | rand int unsigned vseqs_to_send; 23 | 24 | // var: max_outstanding 25 | // The number of virtual sequences outstanding at a time 26 | int unsigned max_outstanding = 5; 27 | 28 | //---------------------------------------------------------------------------------------- 29 | // Group: Constraints 30 | 31 | // constraint: vseqs_to_send_L0_cnstr 32 | // Keep less than 1000 33 | constraint vseqs_to_send_L0_cnstr { 34 | vseqs_to_send inside {[1:1000]}; 35 | } 36 | 37 | // constraint: vseqs_to_send_L1_cnstr 38 | // Keep less than 10 (for testbenches just getting started) 39 | constraint vseqs_to_send_L1_cnstr { 40 | vseqs_to_send inside {[1:10]}; 41 | } 42 | 43 | //---------------------------------------------------------------------------------------- 44 | // Group: Local Fields 45 | 46 | // var: dist_chooser 47 | // A distribution chooser (see Recipe 10.14) 48 | cmn_pkg::dist_chooser_c#(string) dist_chooser; 49 | 50 | //---------------------------------------------------------------------------------------- 51 | // Group: Methods 52 | function new(string name="exer_vseq_cfg"); 53 | super.new(name); 54 | dist_chooser = cmn_pkg::dist_chooser_c#(string)::type_id::create("dist_chooser"); 55 | endfunction : new 56 | 57 | //////////////////////////////////////////// 58 | // func: post_randomize 59 | // Ensure that sequences have been added 60 | function void post_randomize(); 61 | assert(dist_chooser.is_configured()) else 62 | `cmn_fatal(("No virtual sequences were added to this policy class.")) 63 | endfunction : post_randomize 64 | 65 | //////////////////////////////////////////// 66 | // func: add_vseq 67 | // Add a sequence to the library, with a given distribution weight 68 | virtual function void add_vseq(string _vseq_name, 69 | int unsigned _weight); 70 | if(_weight) begin 71 | dist_chooser.add_item(_weight, _vseq_name); 72 | dist_chooser.configure(); 73 | end 74 | endfunction : add_vseq 75 | 76 | //////////////////////////////////////////// 77 | // func: get_next_vseq 78 | // Returns the string of the next sequence to send 79 | virtual function string get_next_vseq(); 80 | return(dist_chooser.get_next()); 81 | endfunction : get_next_vseq 82 | endclass : lib_vseq_cfg_c 83 | 84 | `endif // __18_LIB_VSEQ_CFG_SV__ 85 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/hawk/hawk_trans_item.sv: -------------------------------------------------------------------------------- 1 | 2 | // *********************************************************************** 3 | // File: hawk_trans_item.sv 4 | // Author: bhunter 5 | /* About: Transaction-Level Items 6 | Copyright (C) 2015-2016 Brian P. Hunter 7 | *************************************************************************/ 8 | 9 | `ifndef __HAWK_TRANS_ITEM_SV__ 10 | `define __HAWK_TRANS_ITEM_SV__ 11 | 12 | `include "hawk_types.sv" 13 | 14 | // class: trans_item_c 15 | // A transical level item 16 | class trans_item_c extends uvm_sequence_item; 17 | `uvm_object_utils_begin(hawk_pkg::trans_item_c) 18 | `uvm_field_int(tag, UVM_DEFAULT | UVM_HEX) 19 | `uvm_field_enum(trans_cmd_e, cmd,UVM_DEFAULT) 20 | `uvm_field_int(addr, UVM_DEFAULT | UVM_HEX | UVM_NOPACK) 21 | `uvm_field_int(data, UVM_DEFAULT | UVM_HEX | UVM_NOPACK) 22 | `uvm_object_utils_end 23 | 24 | //---------------------------------------------------------------------------------------- 25 | // Group: Fields 26 | 27 | // var: uid 28 | // Unique ID 29 | cmn_pkg::uid_c uid; 30 | 31 | // var: tag 32 | // transaction tag number 33 | rand tag_t tag; 34 | 35 | // var: cmd 36 | // The transical command 37 | rand trans_cmd_e cmd; 38 | 39 | // constraint: tag_cnstr 40 | // When sending a write, tag must be zero 41 | constraint tag_cnstr { 42 | cmd == WR -> tag == 0; 43 | } 44 | 45 | // var: addr 46 | // The 64-bit address 47 | rand addr_t addr; 48 | 49 | // var: data 50 | // The 64-bit data 51 | rand data_t data; 52 | 53 | //---------------------------------------------------------------------------------------- 54 | // Group: Methods 55 | function new(string name="trans_item"); 56 | super.new(name); 57 | uid = new("TRN"); 58 | endfunction : new 59 | 60 | //////////////////////////////////////////// 61 | // func: convert2string 62 | // Single-line printing 63 | virtual function string convert2string(); 64 | convert2string = {uid.convert2string(), " ", cmd.name()}; 65 | case(cmd) 66 | RD : convert2string = $sformatf("%s TAG:%01x ADDR:%016X", convert2string, tag, addr); 67 | WR : convert2string = $sformatf("%s ADDR:%016X DATA:%016X", convert2string, addr, data); 68 | RESP : convert2string = $sformatf("%s TAG:%01x DATA:%016X", convert2string, tag, data); 69 | endcase 70 | endfunction : convert2string 71 | 72 | //////////////////////////////////////////// 73 | // func: do_pack 74 | // Conditionally pack the address and/or data 75 | virtual function void do_pack(uvm_packer packer); 76 | super.do_pack(packer); 77 | if(cmd inside {RD, WR}) 78 | `uvm_pack_int(addr) 79 | if(cmd inside {WR, RESP}) 80 | `uvm_pack_int(data) 81 | endfunction : do_pack 82 | 83 | //////////////////////////////////////////// 84 | // func: do_unpack 85 | // Unpack a stream into this 86 | virtual function void do_unpack(uvm_packer packer); 87 | super.do_unpack(packer); 88 | if(cmd inside {RD, WR}) 89 | `uvm_unpack_int(addr) 90 | if(cmd inside {WR, RESP}) 91 | `uvm_unpack_int(data) 92 | endfunction : do_unpack 93 | 94 | endclass : trans_item_c 95 | 96 | `endif // __HAWK_TRANS_ITEM_SV__ 97 | 98 | 99 | -------------------------------------------------------------------------------- /hawkins/verif/vkits/uvm/1_2/src/dap/uvm_set_get_dap_base.svh: -------------------------------------------------------------------------------- 1 | // 2 | //------------------------------------------------------------------------------ 3 | // Copyright 2007-2011 Mentor Graphics Corporation 4 | // Copyright 2007-2011 Cadence Design Systems, Inc. 5 | // Copyright 2010-2011 Synopsys, Inc. 6 | // Copyright 2013 NVIDIA Corporation 7 | // All Rights Reserved Worldwide 8 | // 9 | // Licensed under the Apache License, Version 2.0 (the 10 | // "License"); you may not use this file except in 11 | // compliance with the License. You may obtain a copy of 12 | // the License at 13 | // 14 | // http://www.apache.org/licenses/LICENSE-2.0 15 | // 16 | // Unless required by applicable law or agreed to in 17 | // writing, software distributed under the License is 18 | // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 19 | // CONDITIONS OF ANY KIND, either express or implied. See 20 | // the License for the specific language governing 21 | // permissions and limitations under the License. 22 | //------------------------------------------------------------------------------ 23 | 24 | // Class: uvm_set_get_dap_base 25 | // Provides the 'set' and 'get' interface for Data Access Policies (DAPs) 26 | // 27 | // The 'Set/Get' base class simply provides a common interface for 28 | // the various DAPs to implement. This provides a mechanism for 29 | // consistent implementations of similar DAPs. 30 | // 31 | 32 | virtual class uvm_set_get_dap_base#(type T=int) extends uvm_object; 33 | 34 | // Used for self references 35 | typedef uvm_set_get_dap_base#(T) this_type; 36 | 37 | // Function: new 38 | // Constructor 39 | function new(string name="unnamed-uvm_set_get_dap_base#(T)"); 40 | super.new(name); 41 | endfunction : new 42 | 43 | // Group: Set/Get Interface 44 | // 45 | // All implementations of the ~uvm_set_get_dap_base~ class must 46 | // provide an implementation of the four basic "Set and Get" 47 | // accessors. 48 | // 49 | 50 | // Function: set 51 | // Sets the value contained within the resource. 52 | // 53 | // Depending on the DAP policies, an error may be reported if 54 | // it is illegal to 'set' the value at this time. 55 | pure virtual function void set(T value); 56 | 57 | // Function: try_set 58 | // Attempts to set the value contained within the resource. 59 | // 60 | // If the DAP policies forbid setting at this time, then 61 | // the method will return 0, however no errors will be 62 | // reported. Otherwise, the method will return 1, and 63 | // will be treated like a standard call. 64 | pure virtual function bit try_set(T value); 65 | 66 | // Function: get 67 | // Retrieves the value contained within the resource. 68 | // 69 | // Depending on the DAP policies, an error may be reported 70 | // if it is illegal to 'get' the value at this time. 71 | pure virtual function T get(); 72 | 73 | // Function: try_get 74 | // Attempts to retrieve the value contained within the resource. 75 | // 76 | // If the DAP policies forbid retrieving at this time, then 77 | // the method will return 0, however no errors will be 78 | // reported. Otherwise, the method will return 1, and will 79 | // be treated like a standard call. 80 | pure virtual function bit try_get(output T value); 81 | 82 | endclass : uvm_set_get_dap_base 83 | 84 | --------------------------------------------------------------------------------