//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//// ////
|
//// ////
|
//// Copyright (C) 2017 Authors and OPENCORES.ORG ////
|
//// Copyright (C) 2017 Authors and OPENCORES.ORG ////
|
//// ////
|
//// ////
|
//// This source file may be used and distributed without ////
|
//// This source file may be used and distributed without ////
|
//// restriction provided that this copyright statement is not ////
|
//// restriction provided that this copyright statement is not ////
|
//// removed from the file and that any derivative work contains ////
|
//// removed from the file and that any derivative work contains ////
|
//// the original copyright notice and the associated disclaimer. ////
|
//// the original copyright notice and the associated disclaimer. ////
|
//// ////
|
//// ////
|
//// This source file is free software; you can redistribute it ////
|
//// This source file is free software; you can redistribute it ////
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
//// Public License as published by the Free Software Foundation; ////
|
//// Public License as published by the Free Software Foundation; ////
|
//// either version 2.1 of the License, or (at your option) any ////
|
//// either version 2.1 of the License, or (at your option) any ////
|
//// later version. ////
|
//// later version. ////
|
//// ////
|
//// ////
|
//// This source is distributed in the hope that it will be ////
|
//// This source is distributed in the hope that it will be ////
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
//// details. ////
|
//// details. ////
|
//// ////
|
//// ////
|
//// You should have received a copy of the GNU Lesser General ////
|
//// You should have received a copy of the GNU Lesser General ////
|
//// Public License along with this source; if not, download it ////
|
//// Public License along with this source; if not, download it ////
|
//// from http://www.opencores.org/lgpl.shtml ////
|
//// from http://www.opencores.org/lgpl.shtml ////
|
//// ////
|
//// ////
|
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
package riffa_agent_class_pkg;
|
package riffa_agent_class_pkg;
|
|
|
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
//
|
//
|
import riffa_bfm_class_pkg::*;
|
import riffa_bfm_class_pkg::*;
|
|
|
|
|
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
//
|
//
|
class riffa_agent_class #(N);
|
class riffa_agent_class #(N);
|
|
|
riffa_transaction_class #(N) tr_h;
|
riffa_transaction_class #(N) tr_h;
|
rp_tx_bfm_class #(N) tx_h;
|
rp_tx_bfm_class #(N) tx_h;
|
rp_rx_bfm_class #(N) rx_h;
|
rp_rx_bfm_class #(N) rx_h;
|
// mailbox #(riffa_transaction_class #(N)) tx_q, rx_q;
|
|
mailbox #(riffa_transaction_class #(N)) tx_q;
|
mailbox #(riffa_transaction_class #(N)) tx_q;
|
|
|
|
|
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
//
|
//
|
task queue_tx(riffa_transaction_class #(N) tr_h);
|
task queue_tx(riffa_transaction_class #(N) tr_h);
|
tx_h.put(tr_h);
|
tx_h.put(tr_h);
|
tx_q.put(tr_h);
|
tx_q.put(tr_h);
|
endtask: queue_tx
|
endtask: queue_tx
|
|
|
|
|
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
//
|
//
|
task queue_tx_constant(int len, int off, bit last, logic [(8*N)-1:0] value);
|
task queue_tx_constant(int len, int off, bit last, logic [(8*N)-1:0] value);
|
tr_h = new(len, off, last);
|
tr_h = new(len, off, last);
|
tr_h.constant(len, off, last, value);
|
tr_h.constant(len, off, last, value);
|
queue_tx(tr_h);
|
queue_tx(tr_h);
|
endtask: queue_tx_constant
|
endtask: queue_tx_constant
|
|
|
|
|
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
//
|
//
|
task queue_tx_counting(int len, int off, bit last);
|
task queue_tx_counting(int len, int off, bit last);
|
tr_h = new(len, off, last);
|
tr_h = new(len, off, last);
|
tr_h.counting(len, off, last);
|
tr_h.counting(len, off, last);
|
queue_tx(tr_h);
|
queue_tx(tr_h);
|
endtask: queue_tx_counting
|
endtask: queue_tx_counting
|
|
|
|
|
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
//
|
//
|
|
task queue_tx_hex(string str, int off, bit last);
|
|
tr_h = new(1, off, last);
|
|
tr_h.hex(str, off, last);
|
|
queue_tx(tr_h);
|
|
endtask: queue_tx_hex
|
|
|
|
|
|
// --------------------------------------------------------------------
|
|
//
|
task queue_tx_random(int len, int off, bit last);
|
task queue_tx_random(int len, int off, bit last);
|
tr_h = new(len, off, last);
|
tr_h = new(len, off, last);
|
tr_h.random(len, off, last);
|
tr_h.random(len, off, last);
|
queue_tx(tr_h);
|
queue_tx(tr_h);
|
endtask: queue_tx_random
|
endtask: queue_tx_random
|
|
|
|
|
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
//
|
//
|
task queue_rx(int len, int off, bit last);
|
task queue_rx(int len, int off, bit last);
|
tr_h = new(len, off, last);
|
tr_h = new(len, off, last);
|
rx_h.put(tr_h);
|
rx_h.put(tr_h);
|
// rx_q.put(tr_h);
|
|
endtask: queue_rx
|
endtask: queue_rx
|
|
|
|
|
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
//
|
//
|
task wait_for_tx;
|
task wait_for_tx;
|
@(tx_h.tx_done);
|
@(tx_h.tx_done);
|
endtask: wait_for_tx
|
endtask: wait_for_tx
|
|
|
|
|
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
//
|
//
|
task wait_for_rx;
|
task wait_for_rx;
|
@(rx_h.rx_done);
|
@(rx_h.rx_done);
|
endtask: wait_for_rx
|
endtask: wait_for_rx
|
|
|
|
|
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
//
|
//
|
function new(virtual riffa_chnl_if #(.N(N)) chnl_bus);
|
function new(virtual riffa_chnl_if #(.N(N)) chnl_bus);
|
tx_h = new(chnl_bus);
|
tx_h = new(chnl_bus);
|
rx_h = new(chnl_bus);
|
rx_h = new(chnl_bus);
|
this.tx_q = new;
|
this.tx_q = new;
|
// this.rx_q = new;
|
|
endfunction: new
|
endfunction: new
|
|
|
|
|
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
//
|
//
|
endclass: riffa_agent_class
|
endclass: riffa_agent_class
|
|
|
|
|
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
//
|
//
|
endpackage: riffa_agent_class_pkg
|
endpackage: riffa_agent_class_pkg
|
|
|
|
|
|
|
|
|
|
|
|
|