Kurt,
please find my code here…
class my_driver extends ovm_driver;
ovm_get_port #(my_transaction) get_port; // For communication with stimulus generator
virtual jtag_if m_dut_if; // For access to the DUT interface
`ovm_component_utils(my_driver)
bit shift_dr;
function new(string name, ovm_component parent);
super.new(name, parent);
ovm_report_message("", "Called my_driver::new");
endfunction: new
function void build;
super.build();
ovm_report_message("", "Called my_driver::build");
get_port = new("get_port", this);
endfunction : build
virtual task run;
sample_coverage();
ovm_report_message("", "Called my_driver::run");
forever
begin
my_transaction tx;
#10
get_port.get(tx);
ovm_report_message("",$psprintf("Driving state = %s, serial data = %b",
tx.TapState, tx.d_Tdi_reg));
// initial value
//m_dut_if.Tdi = 0;
shift_dr = 1; // 0
if(tx.TapState == 0) // enum equivalent of update_ireg is 0
begin
m_dut_if.Tms = 1;
m_dut_if.Tdi = 0;
// TAP goes to the Reset state, with the following
m_dut_if.Trst_n = 0;
@(posedge m_dut_if.Tclk);
m_dut_if.Trst_n = 1;
// TAP goes to the Idle state, with the following
m_dut_if.Tms = 0;
#300;
// TAP goes to the DR Scan state, with the following
@(posedge m_dut_if.Tclk);
m_dut_if.Tms = 1;
// TAP goes to the IR Scan state, with the following
@(posedge m_dut_if.Tclk);
m_dut_if.Tms = 1; // If 0, this goes to Capture DR
// TAP goes to the Capture IR state, with the following
@(posedge m_dut_if.Tclk);
m_dut_if.Tms = 0;
// TAP goes to the Shift IR state, with the following
@(posedge m_dut_if.Tclk);
m_dut_if.Tms = 0; // If 1, this goes to Exit1 IR
// Send the Serial in Data i.e., Tdi
for(int i = 0; i <= 10; i++)
begin
@(posedge m_dut_if.Tclk)
m_dut_if.Tdi = tx.d_Tdi_reg[i];
end
// TAP goes to the Exit1 IR state, with the following
//@(posedge m_dut_if.Tclk);
m_dut_if.Tms = 1;
// TAP goes to the Pause IR state, with the following
@(posedge m_dut_if.Tclk);
m_dut_if.Tms = 0;
#200;
// TAP goes to the Exit2 IR state, with the following
@(posedge m_dut_if.Tclk);
m_dut_if.Tms = 1;
// TAP goes to the Shift IR state, with the following
@(posedge m_dut_if.Tclk);
m_dut_if.Tms = 0;
// Send the Serial in Data i.e., Tdi
for(int i = 11; i <= 31; i++)
begin
@(posedge m_dut_if.Tclk)
m_dut_if.Tdi = tx.d_Tdi_reg[i];
end
// TAP goes to the Exit1 IR state, with the following
//@(posedge m_dut_if.Tclk);
m_dut_if.Tms = 1;
// TAP goes to the Update IR state, with the following
@(posedge m_dut_if.Tclk);
m_dut_if.Tms = 1;
// TAP goes back to the Idle state, with the following
@(posedge m_dut_if.Tclk);
m_dut_if.Tms = 0;
end
else if(tx.TapState == 1) // enum equivalent of update_dreg is 1
begin
m_dut_if.Tms = 1;
// TAP goes to the Reset state, with the following
m_dut_if.Trst_n = 0;
@(posedge m_dut_if.Tclk);
m_dut_if.Trst_n = 1;
// TAP goes to the Idle state, with the following
m_dut_if.Tms = 0;
#300;
// TAP goes to the DR Scan state, with the following
@(posedge m_dut_if.Tclk);
m_dut_if.Tms = 1;
// TAP goes to the Capture DR state, with the following
@(posedge m_dut_if.Tclk);
m_dut_if.Tms = 0;
// TAP goes to the Shift DR state, with the following
@(posedge m_dut_if.Tclk);
m_dut_if.Tms = 0; // If 1, this goes to Exit1 DR
// To trigger the scoreboard checking
shift_dr = 1;
// Send the Serial in Data i.e., Tdi
for(int i = 0; i <= 10; i++)
begin
@(posedge m_dut_if.Tclk)
m_dut_if.Tdi = tx.d_Tdi_reg[i];
end
// To trigger the scoreboard checking
shift_dr = 1; // 0;
// TAP goes to the Exit1 DR state, with the following
//@(posedge m_dut_if.Tclk);
m_dut_if.Tms = 1;
// TAP goes to the Pause DR state, with the following
@(posedge m_dut_if.Tclk);
m_dut_if.Tms = 0;
#200;
// TAP goes to the Exit2 DR state, with the following
@(posedge m_dut_if.Tclk);
m_dut_if.Tms = 1;
// TAP goes to the Shift DR state, with the following
@(posedge m_dut_if.Tclk);
m_dut_if.Tms = 0;
// To trigger the scoreboard checking
shift_dr = 1;
// Send the Serial in Data i.e., Tdi
for(int i = 11; i <= 31; i++)
begin
@(posedge m_dut_if.Tclk)
m_dut_if.Tdi = tx.d_Tdi_reg[i];
end
// To trigger the scoreboard checking
shift_dr = 1; // 0;
// TAP goes to the Exit1 DR state, with the following
//@(posedge m_dut_if.Tclk);
m_dut_if.Tms = 1;
// TAP goes to the Update DR state, with the following
@(posedge m_dut_if.Tclk);
m_dut_if.Tms = 1;
// TAP goes back to the Idle state, with the following
@(posedge m_dut_if.Tclk);
m_dut_if.Tms = 0;
end
end
endtask: run
virtual task sample_coverage();
endtask
endclass: my_driver
// Scoreboard/Checker
class my_scoreboard extends my_driver;
`ovm_component_utils(my_scoreboard)
function new(string name = “my_scoreboard”, ovm_component parent = null);
super.new(name, parent);
ovm_report_message(“”, “Called my_scoreboard::new”);
endfunction: new
virtual task sample_coverage(); // run;
ovm_report_message(“”, “Entered scoreboard checking”);
forever
begin
//@(posedge shift_dr);
@(posedge m_dut_if.Tclk);
ovm_report_message(“”,$psprintf(“### shift_dr = %b”, shift_dr, $time));
while(shift_dr == 1)
begin
@(posedge m_dut_if.Tclk);
ovm_report_message(“”,$psprintf(“### shift_dr = %b”, shift_dr));
end
end
endtask: sample_coverage // run
endclass: my_scoreboard