lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 1 | // Copyright lowRISC contributors. |
| 2 | // Licensed under the Apache License, Version 2.0, see LICENSE for details. |
| 3 | // SPDX-License-Identifier: Apache-2.0 |
| 4 | |
Steve Nelson | 9af3bcc | 2020-09-14 19:09:23 -0700 | [diff] [blame] | 5 | class ${name}_driver extends dv_base_driver #(.ITEM_T(${name}_item), |
| 6 | .CFG_T (${name}_agent_cfg)); |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 7 | `uvm_component_utils(${name}_driver) |
| 8 | |
| 9 | // the base class provides the following handles for use: |
| 10 | // ${name}_agent_cfg: cfg |
| 11 | |
| 12 | `uvm_component_new |
| 13 | |
| 14 | virtual task run_phase(uvm_phase phase); |
| 15 | // base class forks off reset_signals() and get_and_drive() tasks |
| 16 | super.run_phase(phase); |
| 17 | endtask |
| 18 | |
| 19 | // reset signals |
| 20 | virtual task reset_signals(); |
| 21 | endtask |
| 22 | |
| 23 | // drive trans received from sequencer |
| 24 | virtual task get_and_drive(); |
| 25 | forever begin |
| 26 | seq_item_port.get_next_item(req); |
| 27 | $cast(rsp, req.clone()); |
| 28 | rsp.set_id_info(req); |
| 29 | `uvm_info(`gfn, $sformatf("rcvd item:\n%0s", req.sprint()), UVM_HIGH) |
| 30 | // TODO: do the driving part |
| 31 | // |
| 32 | // send rsp back to seq |
| 33 | `uvm_info(`gfn, "item sent", UVM_HIGH) |
| 34 | seq_item_port.item_done(rsp); |
| 35 | end |
| 36 | endtask |
| 37 | |
| 38 | endclass |