URL
https://opencores.org/ocsvn/qaz_libs/qaz_libs/trunk
Subversion Repositories qaz_libs
[/] [qaz_libs/] [trunk/] [axi4_lib/] [sim/] [src/] [legacy/] [axi4_bfm/] [axi4_simple_agent_pkg.sv] - Rev 45
Compare with Previous | Blame | View Log
////////////////////////////////////////////////////////////////////////// //////// Copyright (C) 2015 Authors and OPENCORES.ORG //////// //////// This source file may be used and distributed without //////// restriction provided that this copyright statement is not //////// removed from the file and that any derivative work contains //////// the original copyright notice and the associated disclaimer. //////// //////// This source file is free software; you can redistribute it //////// and/or modify it under the terms of the GNU Lesser General //////// Public License as published by the Free Software Foundation; //////// either version 2.1 of the License, or (at your option) any //////// later version. //////// //////// This source is distributed in the hope that it will be //////// useful, but WITHOUT ANY WARRANTY; without even the implied //////// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR //////// PURPOSE. See the GNU Lesser General Public License for more //////// details. //////// //////// You should have received a copy of the GNU Lesser General //////// Public License along with this source; if not, download it //////// from http://www.opencores.org/lgpl.shtml //////// //////////////////////////////////////////////////////////////////////////package axi4_simple_agent_pkg;// --------------------------------------------------------------------//import axi4_transaction_pkg::*;// --------------------------------------------------------------------//class axi4_simple_agent_class #(A = 32, N = 8, I = 1);axi4_transaction_class tr_h;virtual axi4_master_bfm_if #(.A(A), .N(N), .I(I)) axi4_m;virtual axi4_slave_bfm_if #(.A(A), .N(N), .I(I)) axi4_s;//--------------------------------------------------------------------function new(virtual axi4_master_bfm_if #(.A(A), .N(N), .I(I)) axi4_m,virtual axi4_slave_bfm_if #(.A(A), .N(N), .I(I)) axi4_s);this.axi4_m = axi4_m;this.axi4_s = axi4_s;endfunction: new// --------------------------------------------------------------------//taskbasic_read(input logic [(A-1):0] araddr,input logic [7:0] arlen,output logic [(8*N)-1:0] data[],output logic [1:0] rresp);this.tr_h = new;this.tr_h.basic_read(araddr, arlen);axi4_m.ar_h.put(tr_h);axi4_s.ar_h.put(tr_h);axi4_m.r_h.put(tr_h);@(axi4_m.r_h.done);data = tr_h.data_h.w;rresp = tr_h.resp;endtask: basic_read// --------------------------------------------------------------------//taskbasic_write(input logic [(A-1):0] awaddr,input logic [7:0] awlen,input logic [(8*N)-1:0] data[],output logic [1:0] bresp);this.tr_h = new;this.tr_h.basic_write(awaddr, awlen);foreach(this.tr_h.payload_h.w[i])this.tr_h.payload_h.w[i] = data[i];axi4_m.aw_h.put(tr_h);axi4_s.aw_h.put(tr_h);axi4_m.w_h.put(tr_h);axi4_s.w_h.put(tr_h);axi4_m.b_h.put(tr_h);@(axi4_s.b_h.done);bresp = tr_h.resp;endtask: basic_write// --------------------------------------------------------------------//taskbasic_random_write(input logic [(A-1):0] awaddr,input logic [7:0] awlen,output logic [1:0] bresp);this.tr_h = new;this.tr_h.basic_write(awaddr, awlen);axi4_m.aw_h.put(tr_h);axi4_s.aw_h.put(tr_h);axi4_m.w_h.put(tr_h);axi4_s.w_h.put(tr_h);axi4_m.b_h.put(tr_h);@(axi4_s.b_h.done);bresp = tr_h.resp;endtask: basic_random_write// --------------------------------------------------------------------//function voidinit;endfunction: init// --------------------------------------------------------------------//endclass: axi4_simple_agent_class// --------------------------------------------------------------------//endpackage: axi4_simple_agent_pkg
