blob: 9b82dd371f3601997ec25061ffe57088f1fc2a26 [file] [log] [blame]
// Copyright lowRISC contributors.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0
class i2c_host_driver extends i2c_driver;
`uvm_component_utils(i2c_host_driver)
// the base class provides the following handles for use:
// i2c_agent_cfg: cfg
`uvm_component_new
virtual task run_phase(uvm_phase phase);
// base class forks off reset_signals() and get_and_drive() tasks
super.run_phase(phase);
endtask
// reset signals
virtual task reset_signals();
endtask
// drive trans received from sequencer
virtual task get_and_drive();
forever begin
seq_item_port.get_next_item(req);
$cast(rsp, req.clone());
rsp.set_id_info(req);
`uvm_info(`gfn, $sformatf("rcvd item:\n%0s", req.sprint()), UVM_HIGH)
// TODO: do the driving part
// send rsp back to seq
`uvm_info(`gfn, "item sent", UVM_HIGH)
seq_item_port.item_done(rsp);
end
endtask
endclass