├── LICENSE ├── ahb_master_agent ├── ahb_master_agent.sv ├── ahb_master_agent_config.sv ├── ahb_master_driver.sv ├── ahb_master_monitor.sv ├── ahb_master_sequencer.sv ├── ahb_master_transaction.sv └── sequences │ ├── ahb_master_base_sequence.sv │ ├── ahb_master_idle_sequence.sv │ ├── ahb_master_incr_sequence.sv │ ├── ahb_master_single_sequence.sv │ ├── ahb_master_undeflen_sequence.sv │ ├── ahb_master_wrap_sequence.sv │ └── readme.md ├── ahb_reset_agent ├── ahb_reset_agent.sv ├── ahb_reset_agent_config.sv ├── ahb_reset_driver.sv ├── ahb_reset_sequencer.sv └── sequences │ ├── ahb_reset_sequence.sv │ ├── ahb_reset_slave_sequence.sv │ ├── ahb_set_sequence.sv │ └── readme.md ├── ahb_slave_agent ├── ahb_slave_agent.sv ├── ahb_slave_agent_config.sv ├── ahb_slave_driver.sv ├── ahb_slave_monitor.sv ├── ahb_slave_sequencer.sv ├── ahb_slave_transaction.sv └── sequences │ ├── ahb_slave_base_sequence.sv │ ├── ahb_slave_error_sequence.sv │ ├── ahb_slave_okay_sequence.sv │ └── readme.md ├── ahb_vseq.sv ├── env ├── ahb_coverage.sv ├── ahb_env.sv ├── ahb_env_config.sv └── vsequences │ ├── ahb_base_vseq.sv │ └── readme.md ├── readme.md ├── rtl ├── ahb_if.sv └── readme.md ├── test ├── ahb_base_test.sv ├── defines.svh ├── init_vseq_from_test.sv └── readme.md ├── test_lib.svh └── top.sv /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 7 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /ahb_master_agent/ahb_master_agent.sv: -------------------------------------------------------------------------------- 1 | class ahb_master_agent extends uvm_agent; 2 | `uvm_component_utils(ahb_master_agent); 3 | 4 | uvm_analysis_port #(ahb_master_transaction) agent_ap; 5 | 6 | ahb_master_driver ahb_master_drv; 7 | ahb_master_monitor ahb_master_mon; 8 | ahb_master_sequencer ahb_master_sqr; 9 | 10 | ahb_master_agent_config cfg_h; 11 | 12 | extern function new(string name="ahb_master_agent",uvm_component parent=null); 13 | extern function void build_phase(uvm_phase phase); 14 | extern function void connect_phase(uvm_phase phase); 15 | extern function void end_of_elaboration_phase(uvm_phase phase); 16 | 17 | endclass : ahb_master_agent 18 | 19 | function ahb_master_agent::new(string name="ahb_master_agent",uvm_component parent=null); 20 | super.new(name,parent); 21 | agent_ap = new("agent_ap",this); 22 | endfunction : new 23 | 24 | function void ahb_master_agent::build_phase(uvm_phase phase); 25 | super.build_phase(phase); 26 | if(!uvm_config_db #(ahb_master_agent_config)::get(this,"ahb_master_agent","ahb_master_agent_config",cfg_h)) 27 | `uvm_fatal("AHB_MASTER_AGENT",{"unable to retrieve configuration for : ",get_full_name(),".cfg"}); 28 | 29 | if(cfg_h.is_active == UVM_ACTIVE) 30 | begin 31 | ahb_master_drv = ahb_master_driver::type_id::create("ahb_master_drv",this); 32 | ahb_master_sqr = ahb_master_sequencer::type_id::create("ahb_master_sqr",this); 33 | end 34 | ahb_master_mon = ahb_master_monitor::type_id::create("ahb_master_mon",this); 35 | endfunction : build_phase 36 | 37 | function void ahb_master_agent::connect_phase(uvm_phase phase); 38 | ahb_master_drv.seq_item_port.connect(ahb_master_sqr.seq_item_export); 39 | ahb_master_mon.monitor_ap.connect(agent_ap); 40 | endfunction : connect_phase 41 | 42 | function void ahb_master_agent::end_of_elaboration_phase(uvm_phase phase); 43 | `uvm_info("AHB_MASTER_AGENT",{get_full_name()," created...."},UVM_NONE); 44 | endfunction : end_of_elaboration_phase 45 | -------------------------------------------------------------------------------- /ahb_master_agent/ahb_master_agent_config.sv: -------------------------------------------------------------------------------- 1 | class ahb_master_agent_config extends uvm_object; 2 | `uvm_object_utils(ahb_master_agent_config); 3 | 4 | virtual ahb_if ahb_vif; 5 | 6 | uvm_active_passive_enum is_active; 7 | 8 | extern function new(string name="ahb_master_agent_config"); 9 | 10 | endclass : ahb_master_agent_config 11 | 12 | function ahb_master_agent_config::new(string name="ahb_master_agent_config"); 13 | super.new(name); 14 | endfunction : new -------------------------------------------------------------------------------- /ahb_master_agent/ahb_master_driver.sv: -------------------------------------------------------------------------------- 1 | class ahb_master_driver extends uvm_driver #(ahb_master_transaction); 2 | `uvm_component_utils(ahb_master_driver); 3 | 4 | ahb_master_agent_config master_config_h; 5 | virtual ahb_if.master_drv ahb_vif; 6 | 7 | extern function new(string name="ahb_master_driver",uvm_component parent=null); 8 | extern function void build_phase(uvm_phase phase); 9 | extern function void connect_phase(uvm_phase phase); 10 | extern function void end_of_elaboration_phase(uvm_phase phase); 11 | extern task run_phase(uvm_phase phase); 12 | extern task drive(); 13 | 14 | endclass : ahb_master_driver 15 | 16 | function ahb_master_driver::new(string name="ahb_master_driver",uvm_component parent=null); 17 | super.new(name,parent); 18 | endfunction : new 19 | 20 | function void ahb_master_driver::build_phase(uvm_phase phase); 21 | super.build_phase(phase); 22 | if(!uvm_config_db #(ahb_master_agent_config)::get(this,"","ahb_master_agent_config",master_config_h)) 23 | `uvm_fatal("AHB_MASTER_DRIVER/NOCOFIG",{"Configuration must be set for : " ,get_full_name(),".master_config_h"}); 24 | endfunction : build_phase 25 | 26 | function void ahb_master_driver::connect_phase(uvm_phase phase); 27 | ahb_vif = master_config_h.ahb_vif; 28 | endfunction : connect_phase 29 | 30 | function void ahb_master_driver::end_of_elaboration_phase(uvm_phase phase); 31 | `uvm_info("AHB_MASTER_DRIVER",{get_full_name()," Created.."},UVM_MEDIUM); 32 | endfunction : end_of_elaboration_phase 33 | 34 | task ahb_master_driver::run_phase(uvm_phase phase); 35 | //phase.raise_objection(this,"starting driver"); 36 | forever 37 | begin 38 | seq_item_port.get_next_item(req); 39 | drive(); 40 | seq_item_port.item_done(); 41 | end 42 | //phase.raise_objection(this,"ending driver"); 43 | endtask : run_phase 44 | 45 | task ahb_master_driver::drive(); 46 | int j; 47 | do 48 | @(ahb_vif.mst_drv_cb); 49 | while(!ahb_vif.HRESETn); 50 | void'(req.add_busy_cycles()); 51 | ahb_vif.mst_drv_cb.HWRITE <= req.HWRITE; 52 | ahb_vif.mst_drv_cb.HSIZE <= req.HSIZE; 53 | ahb_vif.mst_drv_cb.HBURST <= req.HBURST; 54 | foreach(req.HTRANS[i]) 55 | begin 56 | ahb_vif.mst_drv_cb.HTRANS <= req.HTRANS[i]; 57 | if(req.HTRANS[i] != BUSY) 58 | begin 59 | ahb_vif.mst_drv_cb.HADDR <= req.HADDR[j]; 60 | ahb_vif.mst_drv_cb.HWDATA <= req.HWDATA[j]; 61 | j++; 62 | end 63 | else 64 | begin 65 | ahb_vif.mst_drv_cb.HADDR <= req.HADDR[j]; 66 | ahb_vif.mst_drv_cb.HWDATA <= req.HWDATA[j]; 67 | end 68 | do 69 | @(ahb_vif.mst_drv_cb); 70 | while(!ahb_vif.mst_drv_cb.HREADY); 71 | end 72 | endtask : drive 73 | -------------------------------------------------------------------------------- /ahb_master_agent/ahb_master_monitor.sv: -------------------------------------------------------------------------------- 1 | class ahb_master_monitor extends uvm_monitor; 2 | `uvm_component_utils(ahb_master_monitor); 3 | 4 | ahb_master_transaction req; 5 | 6 | virtual ahb_if.master_mon ahb_vif; 7 | ahb_master_agent_config cfg; 8 | 9 | uvm_analysis_port #(ahb_master_transaction) monitor_ap; 10 | 11 | extern function new(string name="ahb_master_monitor",uvm_component parent=null); 12 | extern function void build_phase(uvm_phase phase); 13 | extern function void connect_phase(uvm_phase phase); 14 | extern function void end_of_elaboration_phase(uvm_phase phase); 15 | extern task run_phase(uvm_phase phase); 16 | extern function ahb_master_transaction create_transaction(); 17 | extern task monitor(); 18 | 19 | endclass : ahb_master_monitor 20 | 21 | function ahb_master_monitor::new(string name="ahb_master_monitor",uvm_component parent=null); 22 | super.new(name,parent); 23 | monitor_ap = new("monitor_ap",this); 24 | endfunction : new 25 | 26 | function void ahb_master_monitor::build_phase(uvm_phase phase); 27 | super.build_phase(phase); 28 | if(!uvm_config_db #(ahb_master_agent_config)::get(this,"","ahb_master_agent_config",cfg)) 29 | `uvm_fatal("AHB_MASTER_MONITOR/NOCONFIG",{"configuration must be set for : ",get_full_name(),".cfg"}); 30 | endfunction : build_phase 31 | 32 | function void ahb_master_monitor::connect_phase(uvm_phase phase); 33 | ahb_vif = cfg.ahb_vif; 34 | endfunction : connect_phase 35 | 36 | function void ahb_master_monitor::end_of_elaboration_phase(uvm_phase phase); 37 | `uvm_info("AHB_MASTER_MONITOR",{get_full_name()," created..."},UVM_MEDIUM); 38 | endfunction : end_of_elaboration_phase 39 | 40 | task ahb_master_monitor::run_phase(uvm_phase phase); 41 | //phase.raise_objection(this,"starting master monitor"); 42 | forever 43 | begin 44 | do 45 | @(ahb_vif.mst_mon_cb); 46 | while(!ahb_vif.HRESETn); 47 | //`uvm_info("AHB_MASTER_MONITOR","RESET deasserted .. ",UVM_MEDIUM); 48 | //`uvm_info("AHB_MASTER_MONITOR","Master monitoring...",UVM_MEDIUM); 49 | monitor(); 50 | end 51 | //phase.drop_objection(this,"ending master monitor"); 52 | endtask : run_phase 53 | 54 | function ahb_master_transaction ahb_master_monitor::create_transaction(); 55 | ahb_master_transaction req = ahb_master_transaction::type_id::create("req"); 56 | req.HADDR = new[1]; 57 | req.HTRANS = new[1]; 58 | req.HWDATA = new[1]; 59 | return req; 60 | endfunction : create_transaction 61 | 62 | task ahb_master_monitor::monitor(); 63 | req = create_transaction(); 64 | @(ahb_vif.mst_mon_cb); 65 | if(ahb_vif.mst_mon_cb.HTRANS == IDLE) 66 | begin 67 | `uvm_info("AHB_MASTER_MONITOR","IDLE transaction detected",UVM_MEDIUM); 68 | req.HADDR[0] = ahb_vif.mst_mon_cb.HADDR; 69 | $cast(req.HTRANS[0],ahb_vif.mst_mon_cb.HTRANS); 70 | $cast(req.HBURST,ahb_vif.mst_mon_cb.HBURST); 71 | $cast(req.HWRITE,ahb_vif.mst_mon_cb.HWRITE); 72 | $cast(req.HSIZE,ahb_vif.mst_mon_cb.HSIZE); 73 | monitor_ap.write(req); 74 | //return; 75 | end 76 | if(ahb_vif.mst_mon_cb.HTRANS == BUSY) 77 | begin 78 | `uvm_info("AHB_MASTER_MONITOR","BUSY Transaction detected",UVM_MEDIUM); 79 | req.HADDR[0] = ahb_vif.mst_mon_cb.HADDR; 80 | $cast(req.HTRANS[0],ahb_vif.mst_mon_cb.HTRANS); 81 | $cast(req.HBURST,ahb_vif.mst_mon_cb.HBURST); 82 | $cast(req.HWRITE,ahb_vif.mst_mon_cb.HWRITE); 83 | $cast(req.HSIZE,ahb_vif.mst_mon_cb.HSIZE); 84 | monitor_ap.write(req); 85 | @(ahb_vif.mst_mon_cb); 86 | if(ahb_vif.mst_mon_cb.HTRANS == IDLE) 87 | begin 88 | `uvm_info("AHB_MASTER_MONITOR","IDLE Transaction detected",UVM_MEDIUM); 89 | req.HADDR[0] = ahb_vif.mst_mon_cb.HADDR; 90 | $cast(req.HTRANS[0],ahb_vif.mst_mon_cb.HTRANS); 91 | $cast(req.HBURST,ahb_vif.mst_mon_cb.HBURST); 92 | $cast(req.HWRITE,ahb_vif.mst_mon_cb.HWRITE); 93 | $cast(req.HSIZE,ahb_vif.mst_mon_cb.HSIZE); 94 | monitor_ap.write(req); 95 | //return; 96 | end 97 | end 98 | if(ahb_vif.mst_mon_cb.HTRANS == SEQ || ahb_vif.mst_mon_cb.HTRANS == NONSEQ) 99 | begin 100 | `uvm_info("AHB_MASTER_MONITOR","Transaction detected",UVM_MEDIUM); 101 | req.HADDR[0] = ahb_vif.mst_mon_cb.HADDR; 102 | $cast(req.HTRANS[0],ahb_vif.mst_mon_cb.HTRANS); 103 | $cast(req.HBURST,ahb_vif.mst_mon_cb.HBURST); 104 | $cast(req.HWRITE,ahb_vif.mst_mon_cb.HWRITE); 105 | $cast(req.HSIZE,ahb_vif.mst_mon_cb.HSIZE); 106 | req.HWDATA[0] = ahb_vif.mst_mon_cb.HWDATA; 107 | //req.print(); 108 | monitor_ap.write(req); 109 | //return; 110 | end 111 | endtask : monitor -------------------------------------------------------------------------------- /ahb_master_agent/ahb_master_sequencer.sv: -------------------------------------------------------------------------------- 1 | class ahb_master_sequencer extends uvm_sequencer #(ahb_master_transaction); 2 | `uvm_component_utils(ahb_master_sequencer); 3 | 4 | extern function new(string name="ahb_master_sequencer",uvm_component parent=null); 5 | 6 | endclass : ahb_master_sequencer 7 | 8 | function ahb_master_sequencer::new(string name="ahb_master_sequencer",uvm_component parent=null); 9 | super.new(name,parent); 10 | endfunction : new 11 | -------------------------------------------------------------------------------- /ahb_master_agent/ahb_master_transaction.sv: -------------------------------------------------------------------------------- 1 | class ahb_master_transaction extends uvm_sequence_item; 2 | 3 | bit HRESETn; 4 | rand bit [31:0] HADDR []; 5 | rand burst_t HBURST; 6 | //bit HMASTLOCK; 7 | //bit [3:0] HPROT; 8 | rand size_t HSIZE; 9 | rand transfer_t HTRANS []; 10 | rand bit [31:0] HWDATA []; 11 | rand rw_t HWRITE; 12 | bit [31:0] HRDATA []; 13 | bit HREADY; 14 | response_t HRESP; 15 | rand int busy_cycles; 16 | rand bit busy_bits[]; 17 | 18 | `uvm_object_utils_begin(ahb_master_transaction) 19 | `uvm_field_int(HRESETn, UVM_ALL_ON) 20 | `uvm_field_array_int(HADDR, UVM_ALL_ON) 21 | `uvm_field_enum(burst_t,HBURST, UVM_ALL_ON) 22 | //`uvm_field_int(HMASTLOCK, UVM_ALL_ON) 23 | //`uvm_field_int(HPROT, UVM_ALL_ON) 24 | `uvm_field_enum(size_t,HSIZE, UVM_ALL_ON) 25 | `uvm_field_array_enum(transfer_t,HTRANS, UVM_ALL_ON) 26 | `uvm_field_array_int(HWDATA, UVM_ALL_ON) 27 | `uvm_field_enum(rw_t,HWRITE, UVM_ALL_ON) 28 | `uvm_field_array_int(HRDATA, UVM_ALL_ON) 29 | `uvm_field_int(HREADY, UVM_ALL_ON) 30 | `uvm_field_enum(response_t,HRESP, UVM_ALL_ON) 31 | `uvm_object_utils_end 32 | 33 | 34 | constraint busy_bit_vals{ 35 | busy_bits.size == 2 * busy_cycles; 36 | foreach(busy_bits[i]) 37 | busy_bits[i] dist { 1 := 1, 0 := 1}; 38 | } 39 | 40 | constraint busy_cycle_count{ 41 | busy_cycles == HADDR.size; 42 | } 43 | 44 | constraint addr_size{ 45 | HADDR.size > 0; 46 | if(HBURST == SINGLE) HADDR.size == 1; 47 | if(HBURST == INCR) HADDR.size < (1024 / (2 ** HSIZE)); 48 | if(HBURST == INCR4 || HBURST == WRAP4) HADDR.size == 4; 49 | if(HBURST == INCR8 || HBURST == WRAP8) HADDR.size == 8; 50 | if(HBURST == INCR16 || HBURST == WRAP16) HADDR.size == 16; 51 | } 52 | 53 | constraint addr_1kb_boundary{ 54 | } 55 | 56 | constraint wdata{ 57 | HWDATA.size == HADDR.size; 58 | } 59 | 60 | constraint trans_size{ 61 | HTRANS.size == HADDR.size + busy_cycles; 62 | } 63 | 64 | 65 | 66 | constraint first_trans_type{ // single transfers can be IDLE or NONSEQ 67 | if(HBURST == SINGLE){ 68 | HTRANS[0] inside { IDLE, NONSEQ }; 69 | } 70 | else HTRANS[0] == NONSEQ; // indicates single transfer or first transfer of a burst 71 | } 72 | 73 | constraint incr_trans_type{ 74 | if(HBURST != SINGLE) 75 | foreach(HTRANS[i]) 76 | if(i == 0) 77 | HTRANS[i] == NONSEQ; 78 | else 79 | HTRANS[i] == SEQ; 80 | 81 | } 82 | 83 | 84 | constraint trans_val{ //transfter size set by HSIZE must be less than or equal to width of data bus 85 | HSIZE <= WORDx2; 86 | } 87 | 88 | constraint addr_boundary{ //all transfers in a burst must be aligned to the address boundary equal to the size of transfers 89 | if(HSIZE == HALFWORD) 90 | foreach(HADDR[i]) 91 | HADDR[i][0] == 0; 92 | 93 | if(HSIZE == WORD) 94 | foreach(HADDR[i]) 95 | HADDR[i][1:0] == 0; 96 | 97 | if(HSIZE == WORDx2) 98 | foreach(HADDR[i]) 99 | HADDR[i][2:0] == 0; 100 | 101 | if(HSIZE == WORDx4) 102 | foreach(HADDR[i]) 103 | HADDR[i][3:0] == 0; 104 | 105 | if(HSIZE == WORDx8) 106 | foreach(HADDR[i]) 107 | HADDR[i][4:0] == 0; 108 | 109 | if(HSIZE == WORDx16) 110 | foreach(HADDR[i]) 111 | HADDR[i][5:0] == 0; 112 | 113 | if(HSIZE == WORDx32) 114 | foreach(HADDR[i]) 115 | HADDR[i][6:0] == 0; 116 | } 117 | 118 | 119 | constraint addr_vals{ 120 | if(HBURST == INCR || HBURST == INCR4 || HBURST == INCR8 || HBURST == INCR16) 121 | foreach(HADDR[i]) 122 | if(i > 0) 123 | HADDR[i] == HADDR[i-1] + 2**HSIZE; 124 | } 125 | 126 | constraint addr_4beat_wrap{ 127 | if(HBURST == WRAP4){ 128 | if(HSIZE == BYTE) 129 | foreach(HADDR[i]) 130 | if(i > 0){ 131 | HADDR[i][1:0] == HADDR[i-1][1:0] + 1; 132 | HADDR[i][31:2] == HADDR[i-1][31:2]; 133 | } 134 | 135 | if(HSIZE == HALFWORD) 136 | foreach(HADDR[i]) 137 | if(i > 0){ 138 | HADDR[i][2:1] == HADDR[i-1][2:1] + 1; 139 | HADDR[i][31:3] == HADDR[i-1][31:3]; 140 | } 141 | 142 | if(HSIZE == WORD) 143 | foreach(HADDR[i]) 144 | if(i > 0){ 145 | HADDR[i][3:2] == HADDR[i-1][3:2] + 1; 146 | HADDR[i][31:4] == HADDR[i-1][31:4]; 147 | } 148 | } 149 | } 150 | 151 | constraint addr_8beat_wrap{ 152 | if(HBURST == WRAP8){ 153 | if(HSIZE == BYTE) 154 | foreach(HADDR[i]) 155 | if(i > 0){ 156 | HADDR[i][2:0] == HADDR[i-1][2:0] + 1; 157 | HADDR[i][31:3] == HADDR[i-1][31:3]; 158 | } 159 | 160 | if(HSIZE == HALFWORD) 161 | foreach(HADDR[i]) 162 | if(i > 0){ 163 | HADDR[i][3:1] == HADDR[i-1][3:1] + 1; 164 | HADDR[i][31:4] == HADDR[i-1][31:4]; 165 | } 166 | 167 | if(HSIZE == WORD) 168 | foreach(HADDR[i]) 169 | if(i > 0){ 170 | HADDR[i][4:2] == HADDR[i-1][4:2] + 1; 171 | HADDR[i][31:5] == HADDR[i][31:5]; 172 | } 173 | 174 | } 175 | 176 | } 177 | 178 | constraint addr_16beat_wrap{ 179 | if(HBURST == WRAP16){ 180 | if(HSIZE == BYTE) 181 | foreach(HADDR[i]) 182 | if(i > 0){ 183 | HADDR[i][3:0] == HADDR[i-1][3:0] + 1; 184 | HADDR[i][31:4] == HADDR[i-1][31:4]; 185 | } 186 | 187 | if(HSIZE == HALFWORD) 188 | foreach(HADDR[i]) 189 | if(i > 0){ 190 | HADDR[i][4:1] == HADDR[i-1][4:1] + 1; 191 | HADDR[i][31:5] == HADDR[i-1][31:5]; 192 | } 193 | 194 | if(HSIZE == WORD) 195 | foreach(HADDR[i]) 196 | if(i > 0){ 197 | HADDR[i][5:2] == HADDR[i-1][5:2] + 1; 198 | HADDR[i][31:6] == HADDR[i-1][31:6]; 199 | } 200 | } 201 | 202 | } 203 | 204 | 205 | extern function new(string name="ahb_master_transaction"); 206 | extern function void add_busy_cycles(); 207 | 208 | endclass : ahb_master_transaction 209 | 210 | function ahb_master_transaction::new(string name="ahb_master_transaction"); 211 | super.new(name); 212 | endfunction : new 213 | 214 | 215 | function void ahb_master_transaction::add_busy_cycles(); 216 | if(HADDR.size > 1) 217 | foreach(busy_bits[i]) 218 | if(i != 0 && busy_bits[i] == 1) 219 | HTRANS[i] = BUSY; 220 | else HTRANS[1] = BUSY; 221 | 222 | 223 | endfunction : add_busy_cycles 224 | 225 | 226 | 227 | -------------------------------------------------------------------------------- /ahb_master_agent/sequences/ahb_master_base_sequence.sv: -------------------------------------------------------------------------------- 1 | class ahb_master_base_sequence extends uvm_sequence #(ahb_master_transaction); 2 | `uvm_object_utils(ahb_master_base_sequence); 3 | 4 | extern function new(string name="ahb_master_base_sequence"); 5 | 6 | endclass : ahb_master_base_sequence 7 | 8 | function ahb_master_base_sequence::new(string name="ahb_master_base_sequence"); 9 | super.new(name); 10 | endfunction : new 11 | -------------------------------------------------------------------------------- /ahb_master_agent/sequences/ahb_master_idle_sequence.sv: -------------------------------------------------------------------------------- 1 | class ahb_master_idle_sequence extends ahb_master_base_sequence; 2 | `uvm_object_utils(ahb_master_idle_sequence); 3 | 4 | extern function new(string name="ahb_master_idle_sequence"); 5 | extern task body(); 6 | 7 | endclass : ahb_master_idle_sequence 8 | 9 | function ahb_master_idle_sequence::new(string name="ahb_master_idle_sequence"); 10 | super.new(name); 11 | endfunction : new 12 | 13 | task ahb_master_idle_sequence::body(); 14 | repeat(`COUNT) 15 | begin 16 | req = ahb_master_transaction::type_id::create("req"); 17 | start_item(req); 18 | assert(req.randomize() with {req.HBURST == SINGLE;req.HTRANS[0] == IDLE;}); 19 | req.HRESETn = 1; 20 | finish_item(req); 21 | end 22 | endtask : body -------------------------------------------------------------------------------- /ahb_master_agent/sequences/ahb_master_incr_sequence.sv: -------------------------------------------------------------------------------- 1 | class ahb_master_incr_sequence extends ahb_master_base_sequence; 2 | `uvm_object_utils(ahb_master_incr_sequence); 3 | 4 | extern function new(string name="ahb_master_incr_sequence"); 5 | extern task body(); 6 | 7 | endclass : ahb_master_incr_sequence 8 | 9 | function ahb_master_incr_sequence::new(string name="ahb_master_incr_sequence"); 10 | super.new(name); 11 | endfunction : new 12 | 13 | task ahb_master_incr_sequence::body(); 14 | repeat(`COUNT) 15 | begin 16 | req = ahb_master_transaction::type_id::create("req"); 17 | start_item(req); 18 | assert(req.randomize() with {req.HBURST == INCR4 || req.HBURST == INCR8 || req.HBURST == INCR16;}); 19 | req.HRESETn = 1; 20 | //req.print(); 21 | finish_item(req); 22 | end 23 | endtask : body -------------------------------------------------------------------------------- /ahb_master_agent/sequences/ahb_master_single_sequence.sv: -------------------------------------------------------------------------------- 1 | class ahb_master_single_sequence extends ahb_master_base_sequence; 2 | `uvm_object_utils(ahb_master_single_sequence); 3 | 4 | extern function new(string name="ahb_master_single_sequence"); 5 | extern task body(); 6 | 7 | endclass : ahb_master_single_sequence 8 | 9 | function ahb_master_single_sequence::new(string name="ahb_master_single_sequence"); 10 | super.new(name); 11 | endfunction : new 12 | 13 | task ahb_master_single_sequence::body(); 14 | repeat(`COUNT) 15 | begin 16 | req = ahb_master_transaction::type_id::create("req"); 17 | start_item(req); 18 | assert(req.randomize() with {req.HBURST == SINGLE;}); 19 | req.HRESETn = 1; 20 | finish_item(req); 21 | end 22 | endtask : body -------------------------------------------------------------------------------- /ahb_master_agent/sequences/ahb_master_undeflen_sequence.sv: -------------------------------------------------------------------------------- 1 | class ahb_master_undeflen_sequence extends ahb_master_base_sequence; 2 | `uvm_object_utils(ahb_master_undeflen_sequence); 3 | 4 | extern function new(string name="ahb_master_undeflen_sequence"); 5 | extern task body(); 6 | 7 | endclass : ahb_master_undeflen_sequence 8 | 9 | function ahb_master_undeflen_sequence::new(string name="ahb_master_undeflen_sequence"); 10 | super.new(name); 11 | endfunction : new 12 | 13 | task ahb_master_undeflen_sequence::body(); 14 | repeat(`COUNT) 15 | begin 16 | req = ahb_master_transaction::type_id::create("req"); 17 | start_item(req); 18 | assert(req.randomize() with {req.HBURST == INCR;req.HADDR.size() < 20;}); 19 | req.HRESETn = 1; 20 | finish_item(req); 21 | end 22 | endtask : body 23 | -------------------------------------------------------------------------------- /ahb_master_agent/sequences/ahb_master_wrap_sequence.sv: -------------------------------------------------------------------------------- 1 | class ahb_master_wrap_sequence extends ahb_master_base_sequence; 2 | `uvm_object_utils(ahb_master_wrap_sequence); 3 | 4 | extern function new(string name="ahb_master_wrap_sequence"); 5 | extern task body(); 6 | 7 | endclass : ahb_master_wrap_sequence 8 | 9 | function ahb_master_wrap_sequence::new(string name="ahb_master_wrap_sequence"); 10 | super.new(name); 11 | endfunction : new 12 | 13 | task ahb_master_wrap_sequence::body(); 14 | repeat(`COUNT) 15 | begin 16 | req = ahb_master_transaction::type_id::create("req"); 17 | start_item(req); 18 | assert(req.randomize() with {req.HBURST == WRAP4 || req.HBURST == WRAP8 || req.HBURST == WRAP16;}); 19 | req.HRESETn = 1; 20 | finish_item(req); 21 | end 22 | endtask : body -------------------------------------------------------------------------------- /ahb_master_agent/sequences/readme.md: -------------------------------------------------------------------------------- 1 | master sequences 2 | -------------------------------------------------------------------------------- /ahb_reset_agent/ahb_reset_agent.sv: -------------------------------------------------------------------------------- 1 | class ahb_reset_agent extends uvm_agent; 2 | `uvm_component_utils(ahb_reset_agent); 3 | 4 | virtual ahb_if ahb_vif; 5 | //uvm_analysis_port #(ahb_master_transaction) agent_ap; 6 | 7 | ahb_reset_agent_config config_h; 8 | 9 | ahb_reset_driver ahb_reset_drv; 10 | ahb_reset_sequencer ahb_reset_sqr; 11 | 12 | extern function new(string name="ahb_reset_agent",uvm_component parent=null); 13 | extern function void build_phase(uvm_phase phase); 14 | extern function void connect_phase(uvm_phase phase); 15 | extern function void end_of_elaboration_phase(uvm_phase phase); 16 | 17 | endclass : ahb_reset_agent 18 | 19 | function ahb_reset_agent::new(string name="ahb_reset_agent",uvm_component parent=null); 20 | super.new(name,parent); 21 | endfunction : new 22 | 23 | function void ahb_reset_agent::build_phase(uvm_phase phase); 24 | if(!uvm_config_db #(ahb_reset_agent_config)::get(this,"","ahb_reset_agent_config",config_h)) 25 | `uvm_fatal("AHB_RESET_AGENT/NOCONFIG",{"configuration not set for : ",get_full_name(),".cfg"}); 26 | 27 | ahb_reset_drv = ahb_reset_driver::type_id::create("ahb_reset_drv",this); 28 | ahb_reset_sqr = ahb_reset_sequencer::type_id::create("ahb_reset_sqr",this); 29 | 30 | endfunction : build_phase 31 | 32 | function void ahb_reset_agent::connect_phase(uvm_phase phase); 33 | ahb_reset_drv.seq_item_port.connect(ahb_reset_sqr.seq_item_export); 34 | endfunction : connect_phase 35 | 36 | function void ahb_reset_agent::end_of_elaboration_phase(uvm_phase phase); 37 | `uvm_info("AHB_RESET_AGENT",{get_full_name()," created..."},UVM_MEDIUM); 38 | endfunction : end_of_elaboration_phase 39 | -------------------------------------------------------------------------------- /ahb_reset_agent/ahb_reset_agent_config.sv: -------------------------------------------------------------------------------- 1 | class ahb_reset_agent_config extends uvm_object; 2 | `uvm_object_utils(ahb_reset_agent_config); 3 | 4 | virtual ahb_if ahb_vif; 5 | 6 | extern function new(string name="ahb_reset_agent_config"); 7 | 8 | endclass : ahb_reset_agent_config 9 | 10 | function ahb_reset_agent_config::new(string name="ahb_reset_agent_config"); 11 | super.new(name); 12 | endfunction : new 13 | -------------------------------------------------------------------------------- /ahb_reset_agent/ahb_reset_driver.sv: -------------------------------------------------------------------------------- 1 | class ahb_reset_driver extends uvm_driver #(ahb_master_transaction); 2 | `uvm_component_utils(ahb_reset_driver); 3 | 4 | ahb_reset_agent_config config_h; 5 | virtual ahb_if ahb_vif; 6 | 7 | extern function new(string name="ahb_reset_driver",uvm_component parent=null); 8 | extern function void build_phase(uvm_phase phase); 9 | extern function void connect_phase(uvm_phase phase); 10 | extern function void end_of_elaboration_phase(uvm_phase phase); 11 | extern task run_phase(uvm_phase phase); 12 | extern task reset(); 13 | 14 | endclass : ahb_reset_driver 15 | 16 | function ahb_reset_driver::new(string name="ahb_reset_driver",uvm_component parent=null); 17 | super.new(name,parent); 18 | endfunction : new 19 | 20 | function void ahb_reset_driver::build_phase(uvm_phase phase); 21 | if(!uvm_config_db #(ahb_reset_agent_config)::get(this,"","ahb_reset_agent_config",config_h)) 22 | `uvm_fatal("AHB_RESET_AGENT/NOCONFIG",{"configuration not set for :",get_full_name(),".cfg"}); 23 | endfunction : build_phase 24 | 25 | function void ahb_reset_driver::connect_phase(uvm_phase phase); 26 | ahb_vif = config_h.ahb_vif; 27 | endfunction : connect_phase 28 | 29 | function void ahb_reset_driver::end_of_elaboration_phase(uvm_phase phase); 30 | `uvm_info("AHB_RESET_DRIVER",{get_full_name()," created.."},UVM_MEDIUM); 31 | endfunction : end_of_elaboration_phase 32 | 33 | task ahb_reset_driver::run_phase(uvm_phase phase); 34 | //phase.raise_objection(this,"starting reset driver"); 35 | forever 36 | begin 37 | seq_item_port.get_next_item(req); 38 | reset(); 39 | seq_item_port.item_done(); 40 | end 41 | //phase.drop_objection(this,"ending reset driver"); 42 | endtask : run_phase 43 | 44 | task ahb_reset_driver::reset(); 45 | @(ahb_vif.reset_drv_cb); 46 | ahb_vif.HRESETn <= req.HRESETn; 47 | ahb_vif.reset_drv_cb.HADDR <= '0; 48 | ahb_vif.reset_drv_cb.HSIZE <= '1; 49 | ahb_vif.reset_drv_cb.HBURST <= IDLE; 50 | ahb_vif.reset_drv_cb.HWRITE <= req.HWRITE; 51 | ahb_vif.reset_drv_cb.HTRANS <= req.HTRANS[0]; 52 | ahb_vif.reset_drv_cb.HWDATA <= '0; 53 | endtask : reset -------------------------------------------------------------------------------- /ahb_reset_agent/ahb_reset_sequencer.sv: -------------------------------------------------------------------------------- 1 | class ahb_reset_sequencer extends uvm_sequencer #(ahb_master_transaction); 2 | `uvm_component_utils(ahb_reset_sequencer); 3 | 4 | extern function new(string name="ahb_reset_sequencer",uvm_component parent=null); 5 | 6 | endclass : ahb_reset_sequencer 7 | 8 | function ahb_reset_sequencer::new(string name="ahb_reset_sequencer",uvm_component parent=null); 9 | super.new(name,parent); 10 | endfunction : new 11 | 12 | -------------------------------------------------------------------------------- /ahb_reset_agent/sequences/ahb_reset_sequence.sv: -------------------------------------------------------------------------------- 1 | class ahb_reset_sequence extends uvm_sequence #(ahb_master_transaction); 2 | `uvm_object_utils(ahb_reset_sequence); 3 | 4 | extern function new(string name="ahb_reset_sequence"); 5 | extern task body(); 6 | 7 | endclass : ahb_reset_sequence 8 | 9 | function ahb_reset_sequence::new(string name="ahb_reset_sequence"); 10 | super.new(name); 11 | endfunction : new 12 | 13 | task ahb_reset_sequence::body(); 14 | repeat(`COUNT) 15 | begin 16 | req = ahb_master_transaction::type_id::create("req"); 17 | start_item(req); 18 | assert(req.randomize() with {req.HBURST == SINGLE;}); 19 | `uvm_info("AHB_RESET_AGENT","Asserting reset..",UVM_MEDIUM); 20 | req.HRESETn = 0; 21 | finish_item(req); 22 | end 23 | endtask : body 24 | -------------------------------------------------------------------------------- /ahb_reset_agent/sequences/ahb_reset_slave_sequence.sv: -------------------------------------------------------------------------------- 1 | class ahb_reset_slave_sequence extends uvm_sequence #(ahb_slave_transaction); 2 | `uvm_object_utils(ahb_reset_slave_sequence); 3 | 4 | extern function new(string name="ahb_reset_slave_sequence"); 5 | extern task body(); 6 | 7 | endclass : ahb_reset_slave_sequence 8 | 9 | function ahb_reset_slave_sequence::new(string name="ahb_reset_slave_sequence"); 10 | super.new(name); 11 | endfunction : new 12 | 13 | task ahb_reset_slave_sequence::body(); 14 | repeat(`COUNT) 15 | begin 16 | req = ahb_slave_transaction::type_id::create("req"); 17 | start_item(req); 18 | `uvm_info("AHB_RESET_SLAVE_SEQUENCE","Reset asserted, Slave Ready",UVM_MEDIUM); 19 | assert(req.randomize() with {req.HREADYOUT == 1;}); 20 | finish_item(req); 21 | end 22 | endtask : body -------------------------------------------------------------------------------- /ahb_reset_agent/sequences/ahb_set_sequence.sv: -------------------------------------------------------------------------------- 1 | class ahb_set_sequence extends uvm_sequence #(ahb_master_transaction); 2 | `uvm_object_utils(ahb_set_sequence); 3 | 4 | extern function new(string name="ahb_set_sequence"); 5 | extern task body(); 6 | 7 | 8 | endclass : ahb_set_sequence 9 | 10 | function ahb_set_sequence::new(string name="ahb_set_sequence"); 11 | super.new(name); 12 | endfunction : new 13 | 14 | task ahb_set_sequence::body(); 15 | repeat(`COUNT) 16 | begin 17 | req = ahb_master_transaction::type_id::create("req"); 18 | start_item(req); 19 | assert(req.randomize() with {req.HBURST == SINGLE;}); 20 | req.HRESETn = 1; 21 | finish_item(req); 22 | end 23 | endtask : body 24 | -------------------------------------------------------------------------------- /ahb_reset_agent/sequences/readme.md: -------------------------------------------------------------------------------- 1 | reset sequences 2 | -------------------------------------------------------------------------------- /ahb_slave_agent/ahb_slave_agent.sv: -------------------------------------------------------------------------------- 1 | class ahb_slave_agent extends uvm_agent; 2 | `uvm_component_utils(ahb_slave_agent); 3 | 4 | ahb_slave_agent_config config_h; 5 | 6 | ahb_slave_driver ahb_slave_drv; 7 | ahb_slave_monitor ahb_slave_mon; 8 | ahb_slave_sequencer ahb_slave_sqr; 9 | 10 | uvm_analysis_port #(ahb_slave_transaction) agent_ap; 11 | 12 | 13 | extern function new(string name="ahb_slave_agent",uvm_component parent=null); 14 | extern function void build_phase(uvm_phase phase); 15 | extern function void connect_phase(uvm_phase phase); 16 | extern function void end_of_elaboration_phase(uvm_phase phase); 17 | 18 | endclass : ahb_slave_agent 19 | 20 | 21 | function ahb_slave_agent::new(string name="ahb_slave_agent",uvm_component parent=null); 22 | super.new(name,parent); 23 | agent_ap = new("agent_ap",this); 24 | endfunction 25 | 26 | function void ahb_slave_agent::build_phase(uvm_phase phase); 27 | super.build_phase(phase); 28 | if(!uvm_config_db #(ahb_slave_agent_config)::get(this,"","ahb_slave_agent_config",config_h)) 29 | `uvm_fatal("AHB_SLAVE_AGENT/NOCONFIG",{"configuration is not set for :",get_full_name(),".cfg"}); 30 | 31 | ahb_slave_mon = ahb_slave_monitor::type_id::create("ahb_slave_mon",this); 32 | 33 | if(config_h.is_active == UVM_ACTIVE) 34 | begin 35 | ahb_slave_drv = ahb_slave_driver::type_id::create("abh_slave_drv",this); 36 | ahb_slave_sqr = ahb_slave_sequencer::type_id::create("ahb_slave_sqr",this); 37 | end 38 | endfunction : build_phase 39 | 40 | function void ahb_slave_agent::connect_phase(uvm_phase phase); 41 | ahb_slave_mon.monitor_ap.connect(agent_ap); 42 | ahb_slave_drv.seq_item_port.connect(ahb_slave_sqr.seq_item_export); 43 | endfunction : connect_phase 44 | 45 | function void ahb_slave_agent::end_of_elaboration_phase(uvm_phase phase); 46 | `uvm_info("AHB_SLAVE_AGENT",{get_full_name()," created.."},UVM_NONE); 47 | endfunction : end_of_elaboration_phase 48 | -------------------------------------------------------------------------------- /ahb_slave_agent/ahb_slave_agent_config.sv: -------------------------------------------------------------------------------- 1 | class ahb_slave_agent_config extends uvm_object; 2 | `uvm_object_utils(ahb_slave_agent_config); 3 | 4 | uvm_active_passive_enum is_active; 5 | 6 | virtual ahb_if ahb_vif; 7 | 8 | extern function new(string name="ahb_slave_agent_config"); 9 | 10 | endclass : ahb_slave_agent_config 11 | 12 | function ahb_slave_agent_config::new(string name="ahb_slave_agent_config"); 13 | super.new(name); 14 | endfunction : new -------------------------------------------------------------------------------- /ahb_slave_agent/ahb_slave_driver.sv: -------------------------------------------------------------------------------- 1 | class ahb_slave_driver extends uvm_driver #(ahb_slave_transaction); 2 | `uvm_component_utils(ahb_slave_driver); 3 | 4 | ahb_slave_agent_config config_h; 5 | virtual ahb_if ahb_vif; 6 | 7 | extern function new(string name="ahb_slave_driver",uvm_component parent=null); 8 | extern function void build_phase(uvm_phase phase); 9 | extern function void connect_phase(uvm_phase phase); 10 | extern function void end_of_elaboration_phase(uvm_phase phase); 11 | extern task run_phase(uvm_phase phase); 12 | extern task drive(); 13 | 14 | endclass : ahb_slave_driver 15 | 16 | 17 | function ahb_slave_driver::new(string name="ahb_slave_driver",uvm_component parent=null); 18 | super.new(name,parent); 19 | endfunction : new 20 | 21 | function void ahb_slave_driver::build_phase(uvm_phase phase); 22 | super.build_phase(phase); 23 | if(!uvm_config_db #(ahb_slave_agent_config)::get(this,"","ahb_slave_agent_config",config_h)) 24 | `uvm_fatal("AHB_SLAVE_DRIVER/NOCONFIG",{"configuration must be set for ",get_full_name(),".cfg"}); 25 | endfunction : build_phase 26 | 27 | function void ahb_slave_driver::connect_phase(uvm_phase phase); 28 | ahb_vif = config_h.ahb_vif; 29 | endfunction : connect_phase 30 | 31 | function void ahb_slave_driver::end_of_elaboration_phase(uvm_phase phase); 32 | `uvm_info("AHB_SLAVE_DRIVER",{get_full_name()," created..."},UVM_MEDIUM); 33 | endfunction : end_of_elaboration_phase 34 | 35 | task ahb_slave_driver::run_phase(uvm_phase phase); 36 | //phase.raise_objection(this,"starting slave driver"); 37 | seq_item_port.get_next_item(req); 38 | drive(); 39 | seq_item_port.item_done(); 40 | //phase.drop_objection(this,"ending slave driver"); 41 | endtask : run_phase 42 | 43 | task ahb_slave_driver::drive(); 44 | while(!ahb_vif.HRESETn) 45 | begin 46 | @(ahb_vif.slv_drv_cb); 47 | ahb_vif.slv_drv_cb.HREADY <= '1; 48 | end 49 | foreach(req.ready[i]) 50 | begin 51 | //req.print(); 52 | @(ahb_vif.slv_drv_cb); 53 | ahb_vif.slv_drv_cb.HREADY <= req.ready[i]; 54 | if(req.ready[i]) 55 | if(!ahb_vif.slv_drv_cb.HWRITE) 56 | begin 57 | ahb_vif.slv_drv_cb.HRESP <= req.HRESP; 58 | if(req.HRESP == OKAY) 59 | ahb_vif.slv_drv_cb.HRDATA <= req.HRDATA; 60 | if(req.HRESP == ERROR) 61 | ahb_vif.slv_drv_cb.HRDATA <= '0; 62 | end 63 | else 64 | begin 65 | ahb_vif.slv_drv_cb.HRESP <= OKAY; 66 | ahb_vif.slv_drv_cb.HRDATA <= '0; 67 | end 68 | end 69 | 70 | endtask : drive 71 | -------------------------------------------------------------------------------- /ahb_slave_agent/ahb_slave_monitor.sv: -------------------------------------------------------------------------------- 1 | class ahb_slave_monitor extends uvm_monitor; 2 | `uvm_component_utils(ahb_slave_monitor); 3 | 4 | ahb_slave_agent_config config_h; 5 | virtual ahb_if ahb_vif; 6 | 7 | uvm_analysis_port #(ahb_slave_transaction) monitor_ap; 8 | 9 | extern function new(string name="ahb_slave_monitor",uvm_component parent=null); 10 | extern function void build_phase(uvm_phase phase); 11 | extern function void connect_phase(uvm_phase phase); 12 | extern function void end_of_elaboration_phase(uvm_phase phase); 13 | extern task run_phase(uvm_phase phase); 14 | extern task monitor(); 15 | 16 | endclass : ahb_slave_monitor 17 | 18 | function ahb_slave_monitor::new(string name="ahb_slave_monitor",uvm_component parent=null); 19 | super.new(name,parent); 20 | monitor_ap = new("monitor_ap",this); 21 | endfunction : new 22 | 23 | function void ahb_slave_monitor::build_phase(uvm_phase phase); 24 | super.build_phase(phase); 25 | if(!uvm_config_db #(ahb_slave_agent_config)::get(this,"","ahb_slave_agent_config",config_h)) 26 | `uvm_fatal("AHB_SLAVE_MONITOR/NOCONFIG",{"configuration not set for ",get_full_name(),".cfg"}); 27 | endfunction : build_phase 28 | 29 | function void ahb_slave_monitor::connect_phase(uvm_phase phase); 30 | ahb_vif = config_h.ahb_vif; 31 | endfunction : connect_phase 32 | 33 | function void ahb_slave_monitor::end_of_elaboration_phase(uvm_phase phase); 34 | `uvm_info("AHB_SLAVE_MONITOR",{get_full_name()," created..."},UVM_MEDIUM); 35 | endfunction : end_of_elaboration_phase 36 | 37 | task ahb_slave_monitor::run_phase(uvm_phase phase); 38 | phase.raise_objection(this,"starting slave monitor"); 39 | 40 | 41 | phase.drop_objection(this,"ending slave monitor"); 42 | endtask : run_phase 43 | 44 | task ahb_slave_monitor::monitor(); 45 | 46 | endtask : monitor -------------------------------------------------------------------------------- /ahb_slave_agent/ahb_slave_sequencer.sv: -------------------------------------------------------------------------------- 1 | class ahb_slave_sequencer extends uvm_sequencer #(ahb_slave_transaction); 2 | `uvm_component_utils(ahb_slave_sequencer); 3 | 4 | extern function new(string name="ahb_slave_sequencer",uvm_component parent=null); 5 | 6 | endclass : ahb_slave_sequencer 7 | 8 | function ahb_slave_sequencer::new(string name="ahb_slave_sequencer",uvm_component parent=null); 9 | super.new(name,parent); 10 | endfunction : new 11 | -------------------------------------------------------------------------------- /ahb_slave_agent/ahb_slave_transaction.sv: -------------------------------------------------------------------------------- 1 | class ahb_slave_transaction extends uvm_sequence_item; 2 | 3 | logic HRESETn; 4 | logic [31:0] HADDR; 5 | burst_t HBURST; 6 | //bit HMASTLOCK; 7 | //bit [3:0] HPROT; 8 | size_t HSIZE; 9 | transfer_t HTRANS; 10 | bit [31:0] HWDATA ; 11 | rw_t HWRITE; 12 | rand bit [31:0] HRDATA; 13 | bit HREADYOUT; 14 | rand response_t HRESP; 15 | 16 | rand bit ready[]; 17 | 18 | 19 | `uvm_object_utils_begin(ahb_slave_transaction) 20 | `uvm_field_int(HRESETn, UVM_ALL_ON) 21 | `uvm_field_int(HADDR, UVM_ALL_ON) 22 | `uvm_field_enum(burst_t,HBURST, UVM_ALL_ON) 23 | //`uvm_field_int(HMASTLOCK, UVM_ALL_ON) 24 | //`uvm_field_int(HPROT, UVM_ALL_ON) 25 | `uvm_field_enum(size_t,HSIZE, UVM_ALL_ON) 26 | `uvm_field_enum(transfer_t,HTRANS, UVM_ALL_ON) 27 | `uvm_field_int(HWDATA, UVM_ALL_ON) 28 | `uvm_field_enum(rw_t,HWRITE, UVM_ALL_ON) 29 | `uvm_field_int(HRDATA, UVM_ALL_ON) 30 | `uvm_field_int(HREADYOUT, UVM_ALL_ON) 31 | `uvm_field_enum(response_t,HRESP, UVM_ALL_ON) 32 | `uvm_object_utils_end 33 | 34 | constraint ready_cycle{ 35 | ready.size inside {[10:20]}; 36 | foreach(ready[i]) 37 | ready[i] dist { 0 := 2, 1 := 5}; 38 | } 39 | 40 | extern function new(string name="ahb_slave_transaction"); 41 | 42 | endclass : ahb_slave_transaction 43 | 44 | function ahb_slave_transaction::new(string name="ahb_slave_transaction"); 45 | super.new(name); 46 | endfunction : new 47 | -------------------------------------------------------------------------------- /ahb_slave_agent/sequences/ahb_slave_base_sequence.sv: -------------------------------------------------------------------------------- 1 | class ahb_slave_base_sequence extends uvm_sequence #(ahb_slave_transaction); 2 | `uvm_object_utils(ahb_slave_base_sequence); 3 | 4 | extern function new(string name="ahb_slave_base_sequence"); 5 | 6 | 7 | endclass : ahb_slave_base_sequence 8 | 9 | function ahb_slave_base_sequence::new(string name="ahb_slave_base_sequence"); 10 | super.new(name); 11 | endfunction : new 12 | 13 | 14 | -------------------------------------------------------------------------------- /ahb_slave_agent/sequences/ahb_slave_error_sequence.sv: -------------------------------------------------------------------------------- 1 | class ahb_slave_error_sequence extends ahb_slave_base_sequence; 2 | `uvm_object_utils(ahb_slave_error_sequence); 3 | 4 | extern function new(string name="ahb_slave_error_sequence"); 5 | extern task body(); 6 | 7 | endclass : ahb_slave_error_sequence 8 | 9 | function ahb_slave_error_sequence::new(string name="ahb_slave_error_sequence"); 10 | super.new(name); 11 | endfunction : new 12 | 13 | task ahb_slave_error_sequence::body(); 14 | repeat(`COUNT) 15 | begin 16 | req = ahb_slave_transaction::type_id::create("req"); 17 | start_item(req); 18 | assert(req.randomize() with {req.HRESP == ERROR;}); 19 | req.HRESETn = 1; 20 | finish_item(req); 21 | end 22 | endtask : body -------------------------------------------------------------------------------- /ahb_slave_agent/sequences/ahb_slave_okay_sequence.sv: -------------------------------------------------------------------------------- 1 | class ahb_slave_okay_sequence extends ahb_slave_base_sequence; 2 | `uvm_object_utils(ahb_slave_okay_sequence); 3 | 4 | extern function new(string name="ahb_slave_okay_sequence"); 5 | extern task body(); 6 | 7 | endclass : ahb_slave_okay_sequence 8 | 9 | function ahb_slave_okay_sequence::new(string name="ahb_slave_okay_sequence"); 10 | super.new(name); 11 | endfunction : new 12 | 13 | task ahb_slave_okay_sequence::body(); 14 | repeat(`COUNT) 15 | begin 16 | req = ahb_slave_transaction::type_id::create("req"); 17 | start_item(req); 18 | assert(req.randomize() with { req.HRESP == OKAY;}); 19 | req.HRESETn = 1; 20 | finish_item(req); 21 | end 22 | endtask : body -------------------------------------------------------------------------------- /ahb_slave_agent/sequences/readme.md: -------------------------------------------------------------------------------- 1 | slave sequences 2 | -------------------------------------------------------------------------------- /ahb_vseq.sv: -------------------------------------------------------------------------------- 1 | class ahb_vseq extends ahb_base_vseq; 2 | `uvm_object_utils(ahb_vseq); 3 | 4 | extern function new(string name="ahb_vseq"); 5 | extern task body(); 6 | 7 | endclass : ahb_vseq 8 | 9 | function ahb_vseq::new(string name="ahb_vseq"); 10 | super.new(name); 11 | endfunction : new 12 | 13 | task ahb_vseq::body(); 14 | 15 | ahb_master_idle_seq = ahb_master_idle_sequence::type_id::create("ahb_master_idle_seq"); 16 | ahb_master_single_seq = ahb_master_single_sequence::type_id::create("ahb_master_single_sequence"); 17 | ahb_master_incr_seq = ahb_master_incr_sequence::type_id::create("ahb_master_incr_seq"); 18 | ahb_master_undeflen_seq = ahb_master_undeflen_sequence::type_id::create("ahb_master_undeflen_seq"); 19 | ahb_master_wrap_seq = ahb_master_wrap_sequence::type_id::create("ahb_master_wrap_seq"); 20 | 21 | ahb_slave_error_seq = ahb_slave_error_sequence::type_id::create("ahb_slave_error_seq"); 22 | ahb_slave_okay_seq = ahb_slave_okay_sequence::type_id::create("ahb_slave_okay_seq"); 23 | 24 | ahb_reset_seq = ahb_reset_sequence::type_id::create("ahb_reset_seq"); 25 | ahb_set_seq = ahb_set_sequence::type_id::create("ahb_set_seq"); 26 | ahb_reset_slave_seq = ahb_reset_slave_sequence::type_id::create("ahb_reset_slave_seq"); 27 | 28 | /*fork 29 | ahb_reset_seq.start(ahb_reset_sqr); 30 | ahb_reset_slave_seq.start(ahb_slave_sqr); 31 | join 32 | 33 | fork 34 | ahb_set_seq.start(ahb_reset_sqr); 35 | ahb_slave_okay_seq.start(ahb_slave_sqr); 36 | join 37 | 38 | fork 39 | ahb_master_idle_seq.start(ahb_master_sqr); 40 | ahb_slave_error_seq.start(ahb_slave_sqr); 41 | ahb_slave_okay_seq.start(ahb_slave_sqr); 42 | join 43 | 44 | fork 45 | ahb_master_single_seq.start(ahb_master_sqr); 46 | ahb_slave_error_seq.start(ahb_slave_sqr); 47 | ahb_slave_okay_seq.start(ahb_slave_sqr); 48 | join 49 | 50 | fork 51 | ahb_master_idle_seq.start(ahb_master_sqr); 52 | ahb_slave_okay_seq.start(ahb_slave_sqr); 53 | join 54 | 55 | fork 56 | ahb_master_incr_seq.start(ahb_master_sqr); 57 | ahb_slave_error_seq.start(ahb_slave_sqr); 58 | ahb_slave_okay_seq.start(ahb_slave_sqr); 59 | join 60 | 61 | fork 62 | ahb_master_idle_seq.start(ahb_master_sqr); 63 | ahb_slave_okay_seq.start(ahb_slave_sqr); 64 | join 65 | 66 | 67 | fork 68 | ahb_master_wrap_seq.start(ahb_master_sqr); 69 | ahb_slave_error_seq.start(ahb_slave_sqr); 70 | ahb_slave_okay_seq.start(ahb_slave_sqr); 71 | join 72 | 73 | fork 74 | ahb_master_idle_seq.start(ahb_master_sqr); 75 | ahb_slave_okay_seq.start(ahb_slave_sqr); 76 | join 77 | 78 | fork 79 | ahb_master_undeflen_seq.start(ahb_master_sqr); 80 | ahb_slave_error_seq.start(ahb_slave_sqr); 81 | ahb_slave_okay_seq.start(ahb_slave_sqr); 82 | join 83 | */ 84 | fork 85 | begin 86 | ahb_master_incr_seq.start(ahb_master_sqr); 87 | ahb_master_wrap_seq.start(ahb_master_sqr); 88 | ahb_master_single_seq.start(ahb_master_sqr); 89 | ahb_master_idle_seq.start(ahb_master_sqr); 90 | ahb_master_undeflen_seq.start(ahb_master_sqr); 91 | end 92 | begin 93 | ahb_slave_error_seq.start(ahb_slave_sqr); 94 | ahb_slave_okay_seq.start(ahb_slave_sqr); 95 | end 96 | join 97 | 98 | endtask : body -------------------------------------------------------------------------------- /env/ahb_coverage.sv: -------------------------------------------------------------------------------- 1 | class ahb_coverage extends uvm_subscriber #(ahb_master_transaction); 2 | `uvm_component_utils(ahb_coverage); 3 | 4 | ahb_master_transaction tx; 5 | 6 | covergroup ahb_cg; 7 | ahb_addr_cp : coverpoint tx.HADDR[0]; 8 | ahb_rw_cp : coverpoint tx.HWRITE; 9 | ahb_size_cp : coverpoint tx.HSIZE {bins size_bins = { BYTE, HALFWORD, WORD, WORDx2 }; } 10 | ahb_burst_cp : coverpoint tx.HBURST; 11 | ahb_wdata_cp : coverpoint tx.HWDATA[0]; 12 | ahb_trans_cp : coverpoint tx.HTRANS[0]; 13 | endgroup : ahb_cg 14 | 15 | 16 | extern function new(string name="ahb_coverage",uvm_component parent=null); 17 | extern function void end_of_elaboration_phase(uvm_phase phase); 18 | extern function void write(ahb_master_transaction t); 19 | 20 | endclass : ahb_coverage 21 | 22 | 23 | function ahb_coverage::new(string name="ahb_coverage",uvm_component parent=null); 24 | super.new(name,parent); 25 | ahb_cg = new(); 26 | endfunction : new 27 | 28 | function void ahb_coverage::end_of_elaboration_phase(uvm_phase phase); 29 | `uvm_info("AHB_COVERAGE",{get_full_name()," created.. "},UVM_MEDIUM); 30 | endfunction : end_of_elaboration_phase 31 | 32 | function void ahb_coverage::write(ahb_master_transaction t); 33 | tx = t; 34 | ahb_cg.sample(); 35 | endfunction : write -------------------------------------------------------------------------------- /env/ahb_env.sv: -------------------------------------------------------------------------------- 1 | class ahb_env extends uvm_env; 2 | `uvm_component_utils(ahb_env); 3 | 4 | ahb_env_config env_config_h; 5 | 6 | ahb_master_agent_config master_cfg_h; 7 | ahb_slave_agent_config slave_cfg_h; 8 | ahb_reset_agent_config reset_cfg_h; 9 | 10 | ahb_master_agent master_agent_h; 11 | ahb_slave_agent slave_agent_h; 12 | ahb_reset_agent reset_agent_h; 13 | 14 | bit has_coverage; 15 | 16 | ahb_coverage cov_h; 17 | 18 | extern function new(string name="ahb_env",uvm_component parent=null); 19 | extern function void build_phase(uvm_phase phase); 20 | extern function void connect_phase(uvm_phase phase); 21 | extern function void end_of_elaboration_phase(uvm_phase phase); 22 | 23 | endclass : ahb_env 24 | 25 | function ahb_env::new(string name="ahb_env",uvm_component parent=null); 26 | super.new(name,parent); 27 | endfunction : new 28 | 29 | function void ahb_env::build_phase(uvm_phase phase); 30 | super.build_phase(phase); 31 | if(!uvm_config_db #(ahb_env_config)::get(this,"","ahb_env_config",env_config_h)) 32 | `uvm_fatal("AHB_ENV/NOCONFIG",{"Configuation not set for : ",get_full_name(),".cfg"}); 33 | 34 | has_coverage = env_config_h.has_coverage; 35 | 36 | master_cfg_h = ahb_master_agent_config::type_id::create("master_cfg_h"); 37 | slave_cfg_h = ahb_slave_agent_config::type_id::create("slave_cfg_h"); 38 | reset_cfg_h = ahb_reset_agent_config::type_id::create("reset_cfg_h"); 39 | 40 | master_cfg_h.ahb_vif = env_config_h.ahb_vif; 41 | slave_cfg_h.ahb_vif = env_config_h.ahb_vif; 42 | reset_cfg_h.ahb_vif = env_config_h.ahb_vif; 43 | 44 | master_cfg_h.is_active = UVM_ACTIVE; 45 | slave_cfg_h.is_active = UVM_ACTIVE; 46 | 47 | uvm_config_db #(ahb_master_agent_config)::set(this,"*master*","ahb_master_agent_config",master_cfg_h); 48 | uvm_config_db #(ahb_slave_agent_config)::set(this,"*slave*","ahb_slave_agent_config",slave_cfg_h); 49 | uvm_config_db #(ahb_reset_agent_config)::set(this,"*reset*","ahb_reset_agent_config",reset_cfg_h); 50 | 51 | master_agent_h = ahb_master_agent::type_id::create("master_agent_h",this); 52 | slave_agent_h = ahb_slave_agent::type_id::create("slave_agent_h",this); 53 | reset_agent_h = ahb_reset_agent::type_id::create("reset_agent_h",this); 54 | 55 | if(has_coverage) 56 | cov_h = ahb_coverage::type_id::create("cov_h",this); 57 | 58 | endfunction : build_phase 59 | 60 | function void ahb_env::connect_phase(uvm_phase phase); 61 | if(has_coverage) 62 | begin 63 | master_agent_h.agent_ap.connect(cov_h.analysis_export); 64 | //slave_agent_h.agent_ap.connect(cov_h.analysis_export); 65 | end 66 | 67 | endfunction : connect_phase 68 | 69 | function void ahb_env::end_of_elaboration_phase(uvm_phase phase); 70 | `uvm_info("AHB_ENV",{get_full_name()," created..."},UVM_MEDIUM); 71 | endfunction : end_of_elaboration_phase 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /env/ahb_env_config.sv: -------------------------------------------------------------------------------- 1 | class ahb_env_config extends uvm_object; 2 | `uvm_object_utils(ahb_env_config); 3 | 4 | bit has_coverage; 5 | 6 | ahb_master_agent_config master_cfg; 7 | ahb_slave_agent_config slave_cfg; 8 | 9 | virtual ahb_if ahb_vif; 10 | 11 | extern function new(string name="ahb_env_config"); 12 | 13 | endclass : ahb_env_config 14 | 15 | function ahb_env_config::new(string name="ahb_env_config"); 16 | super.new(name); 17 | endfunction : new 18 | 19 | -------------------------------------------------------------------------------- /env/vsequences/ahb_base_vseq.sv: -------------------------------------------------------------------------------- 1 | class ahb_base_vseq extends uvm_sequence #(uvm_sequence_item); 2 | `uvm_object_utils(ahb_base_vseq); 3 | 4 | ahb_master_sequencer ahb_master_sqr; 5 | ahb_slave_sequencer ahb_slave_sqr; 6 | ahb_reset_sequencer ahb_reset_sqr; 7 | 8 | ahb_master_idle_sequence ahb_master_idle_seq; 9 | ahb_master_single_sequence ahb_master_single_seq; 10 | ahb_master_incr_sequence ahb_master_incr_seq; 11 | ahb_master_undeflen_sequence ahb_master_undeflen_seq; 12 | ahb_master_wrap_sequence ahb_master_wrap_seq; 13 | 14 | ahb_slave_error_sequence ahb_slave_error_seq; 15 | ahb_slave_okay_sequence ahb_slave_okay_seq; 16 | 17 | ahb_reset_sequence ahb_reset_seq; 18 | ahb_set_sequence ahb_set_seq; 19 | ahb_reset_slave_sequence ahb_reset_slave_seq; 20 | 21 | extern function new(string name="ahb_base_vseq"); 22 | 23 | endclass : ahb_base_vseq 24 | 25 | function ahb_base_vseq::new(string name="ahb_base_vseq"); 26 | super.new(name); 27 | endfunction : new -------------------------------------------------------------------------------- /env/vsequences/readme.md: -------------------------------------------------------------------------------- 1 | vsequences 2 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # AMBA 3 AHB UVM Testbench 2 | * The uvm verification environment was written for learning purposes. 3 | 4 | -------------------------------------------------------------------------------- /rtl/ahb_if.sv: -------------------------------------------------------------------------------- 1 | interface ahb_if(input bit HCLK); 2 | logic HRESETn; 3 | logic HREADY; 4 | logic HWRITE; 5 | logic [1:0] HRESP; 6 | logic [1:0] HTRANS; 7 | logic [2:0] HBURST; 8 | logic [2:0] HSIZE; 9 | logic [31:0] HADDR; 10 | logic [31:0] HWDATA; 11 | logic [31:0] HRDATA; 12 | 13 | clocking mst_drv_cb @(posedge HCLK); 14 | default input #1 output #0; 15 | input HRESP, HREADY, HRDATA; 16 | output HTRANS, HBURST, HSIZE, HADDR, HWDATA, HWRITE; 17 | endclocking 18 | 19 | clocking mst_mon_cb @(posedge HCLK); 20 | default input #1 output #0; 21 | input HREADY, HRESP, HTRANS, HBURST, HSIZE, HADDR, HWDATA, HRDATA, HWRITE; 22 | endclocking 23 | 24 | clocking slv_drv_cb @(posedge HCLK); 25 | default input #1 output #0; 26 | input HTRANS, HBURST, HSIZE, HADDR, HWDATA, HWRITE; 27 | output HRESP, HREADY; 28 | output negedge HRDATA; 29 | endclocking 30 | 31 | clocking slv_mon_cb @(posedge HCLK); 32 | default input #1 output #0; 33 | input HREADY, HRESP, HTRANS, HBURST, HSIZE, HADDR, HWDATA, HRDATA, HWRITE; 34 | endclocking 35 | 36 | clocking reset_drv_cb @(posedge HCLK); 37 | default input #1 output #0; 38 | input HRESP, HREADY, HRDATA; 39 | output HTRANS, HBURST, HSIZE, HADDR, HWDATA, HWRITE; 40 | endclocking 41 | 42 | modport master_drv (clocking mst_drv_cb, input HRESETn); 43 | modport master_mon (clocking mst_mon_cb, input HRESETn); 44 | modport slave_drv (clocking slv_drv_cb, input HRESETn); 45 | modport slave_mon (clocking slv_mon_cb, input HRESETn); 46 | modport reset_drv (clocking reset_drv_cb, output HRESETn); 47 | 48 | 49 | endinterface : ahb_if 50 | -------------------------------------------------------------------------------- /rtl/readme.md: -------------------------------------------------------------------------------- 1 | rtl 2 | -------------------------------------------------------------------------------- /test/ahb_base_test.sv: -------------------------------------------------------------------------------- 1 | class ahb_base_test extends uvm_test; 2 | `uvm_component_utils(ahb_base_test); 3 | 4 | ahb_env env_h; 5 | 6 | bit has_coverage; 7 | 8 | ahb_env_config env_config_h; 9 | 10 | extern function new(string name="ahb_base_test",uvm_component parent=null); 11 | extern function void build_phase(uvm_phase phase); 12 | extern function void end_of_elaboration_phase(uvm_phase phase); 13 | extern function void init_vseq(ahb_base_vseq vseq); 14 | 15 | endclass : ahb_base_test 16 | 17 | function ahb_base_test::new(string name="ahb_base_test",uvm_component parent=null); 18 | super.new(name,parent); 19 | endfunction 20 | 21 | function void ahb_base_test::build_phase(uvm_phase phase); 22 | env_config_h = ahb_env_config::type_id::create("env_config_h"); 23 | 24 | if(!uvm_config_db #(virtual ahb_if)::get(this,"","ahb_vif",env_config_h.ahb_vif)) 25 | `uvm_fatal("AHB_BASE_TEST/NOVIF",{"virtual interface must be set for : ",get_full_name(),".vif"}); 26 | 27 | has_coverage = 1; 28 | env_config_h.has_coverage = has_coverage; 29 | 30 | uvm_config_db #(ahb_env_config)::set(this,"*","ahb_env_config",env_config_h); 31 | 32 | env_h = ahb_env::type_id::create("env_h",this); 33 | endfunction : build_phase 34 | 35 | function void ahb_base_test::end_of_elaboration_phase(uvm_phase phase); 36 | `uvm_info("AHB_BASE_TEST",{get_full_name()," created.."},UVM_MEDIUM); 37 | endfunction : end_of_elaboration_phase 38 | 39 | function void ahb_base_test::init_vseq(ahb_base_vseq vseq); 40 | vseq.ahb_master_sqr = env_h.master_agent_h.ahb_master_sqr; 41 | vseq.ahb_slave_sqr = env_h.slave_agent_h.ahb_slave_sqr; 42 | vseq.ahb_reset_sqr = env_h.reset_agent_h.ahb_reset_sqr; 43 | endfunction : init_vseq -------------------------------------------------------------------------------- /test/defines.svh: -------------------------------------------------------------------------------- 1 | `define COUNT 7 2 | 3 | typedef enum bit [1:0] {IDLE, BUSY, NONSEQ, SEQ} transfer_t; 4 | typedef enum bit {READ,WRITE} rw_t; 5 | typedef enum bit [2:0] {SINGLE, INCR, WRAP4, INCR4, WRAP8, INCR8, WRAP16, INCR16} burst_t; 6 | typedef enum bit [2:0] {BYTE, HALFWORD, WORD, WORDx2, WORDx4, WORDx8, WORDx16, WORDx32} size_t; 7 | typedef enum bit [1:0] {OKAY, ERROR, RETRY, SPLIT} response_t; 8 | -------------------------------------------------------------------------------- /test/init_vseq_from_test.sv: -------------------------------------------------------------------------------- 1 | class init_vseq_from_test extends ahb_base_test; 2 | `uvm_component_utils(init_vseq_from_test); 3 | 4 | extern function new(string name="init_vseq_from_test",uvm_component parent=null); 5 | extern task run_phase(uvm_phase phase); 6 | 7 | endclass : init_vseq_from_test 8 | 9 | function init_vseq_from_test::new(string name="init_vseq_from_test",uvm_component parent=null); 10 | super.new(name,parent); 11 | endfunction : new 12 | 13 | task init_vseq_from_test::run_phase(uvm_phase phase); 14 | ahb_vseq vseq = ahb_vseq::type_id::create("ahb_vseq"); 15 | phase.raise_objection(this,"starting virtual sequence"); 16 | `uvm_info("AHB_VSEQ","Starting the test",UVM_MEDIUM); 17 | uvm_top.print_topology(); 18 | init_vseq(vseq); 19 | vseq.start(null); 20 | 21 | #5000; 22 | phase.drop_objection(this,"ending virtual sequence"); 23 | 24 | `uvm_info("AHB_VSEQ","Ending the test",UVM_MEDIUM); 25 | endtask : run_phase -------------------------------------------------------------------------------- /test/readme.md: -------------------------------------------------------------------------------- 1 | test files 2 | -------------------------------------------------------------------------------- /test_lib.svh: -------------------------------------------------------------------------------- 1 | import uvm_pkg::*; 2 | `include "uvm_macros.svh" 3 | 4 | //defines 5 | `include "test/defines.svh" 6 | 7 | //rtl 8 | `include "rtl/ahb_if.sv" 9 | 10 | //ahb_master_agent 11 | `include "ahb_master_agent/ahb_master_agent_config.sv" 12 | `include "ahb_master_agent/ahb_master_transaction.sv" 13 | `include "ahb_master_agent/sequences/ahb_master_base_sequence.sv" 14 | `include "ahb_master_agent/sequences/ahb_master_idle_sequence.sv" 15 | `include "ahb_master_agent/sequences/ahb_master_incr_sequence.sv" 16 | `include "ahb_master_agent/sequences/ahb_master_single_sequence.sv" 17 | `include "ahb_master_agent/sequences/ahb_master_undeflen_sequence.sv" 18 | `include "ahb_master_agent/sequences/ahb_master_wrap_sequence.sv" 19 | `include "ahb_master_agent/ahb_master_driver.sv" 20 | `include "ahb_master_agent/ahb_master_monitor.sv" 21 | `include "ahb_master_agent/ahb_master_sequencer.sv" 22 | `include "ahb_master_agent/ahb_master_agent.sv" 23 | 24 | //ahb_slave_agent 25 | `include "ahb_slave_agent/ahb_slave_agent_config.sv" 26 | `include "ahb_slave_agent/ahb_slave_transaction.sv" 27 | `include "ahb_slave_agent/sequences/ahb_slave_base_sequence.sv" 28 | `include "ahb_slave_agent/sequences/ahb_slave_error_sequence.sv" 29 | `include "ahb_slave_agent/sequences/ahb_slave_okay_sequence.sv" 30 | `include "ahb_slave_agent/ahb_slave_driver.sv" 31 | `include "ahb_slave_agent/ahb_slave_monitor.sv" 32 | `include "ahb_slave_agent/ahb_slave_sequencer.sv" 33 | `include "ahb_slave_agent/ahb_slave_agent.sv" 34 | 35 | //ahb_reset_agent 36 | `include "ahb_reset_agent/ahb_reset_agent_config.sv" 37 | `include "ahb_reset_agent/sequences/ahb_reset_sequence.sv" 38 | `include "ahb_reset_agent/sequences/ahb_reset_slave_sequence.sv" 39 | `include "ahb_reset_agent/sequences/ahb_set_sequence.sv" 40 | `include "ahb_reset_agent/ahb_reset_driver.sv" 41 | `include "ahb_reset_agent/ahb_reset_sequencer.sv" 42 | `include "ahb_reset_agent/ahb_reset_agent.sv" 43 | 44 | //ahb_env 45 | `include "env/ahb_env_config.sv" 46 | `include "env/vsequences/ahb_base_vseq.sv" 47 | `include "env/ahb_coverage.sv" 48 | `include "env/ahb_env.sv" 49 | 50 | //vseq 51 | `include "ahb_vseq.sv" 52 | 53 | //test 54 | `include "test/ahb_base_test.sv" 55 | `include "test/init_vseq_from_test.sv" 56 | 57 | //top 58 | `include "top.sv" -------------------------------------------------------------------------------- /top.sv: -------------------------------------------------------------------------------- 1 | module top; 2 | bit clk; 3 | 4 | initial 5 | forever 6 | #10 clk = ~clk; 7 | 8 | ahb_if ahb_intf(clk); 9 | 10 | initial 11 | begin 12 | uvm_config_db #(virtual ahb_if)::set(null,"uvm_test_top","ahb_vif",ahb_intf); 13 | 14 | run_test("init_vseq_from_test"); 15 | 16 | end 17 | 18 | endmodule : top --------------------------------------------------------------------------------