URL
https://opencores.org/ocsvn/qaz_libs/qaz_libs/trunk
Subversion Repositories qaz_libs
[/] [qaz_libs/] [trunk/] [axi4_lib/] [sim/] [src/] [legacy/] [tb_axi4_to_axis_agent_class_pkg.sv] - Rev 50
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 tb_axi4_to_axis_agent_class_pkg;// --------------------------------------------------------------------//import axi4_memory_pkg::*;import axis_bfm_pkg::*;// --------------------------------------------------------------------//class tb_axi4_to_axis_agent_class #(N, A, I, D, U);axi4_memory_class #(A, N, I) m_h;axis_rx_bfm_class #(N, I, D, U) s_h;memory_tr_class #(A, N, I) m_tr_h, m_tr_clone_h;axis_tr_class #(N, I, D, U) s_tr_h;virtual axi4_if #(.A(A), .N(N), .I(I)) axi4_m;virtual axis_if #(.N(N), .I(I), .D(D), .U(U)) axis_out;mailbox #(memory_tr_class #(A, N, I)) q;// --------------------------------------------------------------------//task wait_for_sof;@(posedge axis_out.cb_s.tuser);$display("^^^ %16.t | %m", $time);endtask: wait_for_sof// --------------------------------------------------------------------//task random_transaction(int addr, int size);m_tr_h = new();m_tr_h.random(addr, size);m_tr_clone_h = m_tr_h.clone();q.put(m_tr_clone_h);m_h.load_words(addr, m_tr_h.data);endtask: random_transaction// --------------------------------------------------------------------//task automaticcompare;$display("^^^ %16.t | %m", $time);$display("^^^ %16.t | q.num = %d", $time, q.num);$display("^^^ %16.t | s_h.q.num = %d", $time, s_h.q.num);$display("^^^ %16.t | m_tr_h.data.size = %d", $time, m_tr_h.data.size);q.get(m_tr_h);for(int i = 0; i < m_tr_h.data.size; i += N)beginif(s_h.q.try_get(s_tr_h) == 0)begin$display("!!! %16.t | ERROR!!! try_get(s_tr_h) == 0", $time);break;endfor(int k = 0; k < N; k++)beginif(s_tr_h.tdata[k*8 +: 8] != m_tr_h.data[i + k])begin$display("!!! %16.t | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^", $time);$display("!!! %16.t | ERROR!!! mismatch | i = %d | k = %d", $time, i, k);$display("!!! %16.t | %x | %x |", $time, s_tr_h.tdata[k*8 +: 8], m_tr_h.data[i + k]);$stop;endendend$display("^^^ %16.t | %m | done!", $time);endtask: compare//--------------------------------------------------------------------//function new(virtual axi4_if #(.A(A), .N(N), .I(I)) axi4_m,virtual axis_if #(.N(N), .I(I), .D(D), .U(U)) axis_out);this.axi4_m = axi4_m;this.axis_out = axis_out;m_h = new(axi4_m);s_h = new(axis_out);q = new();endfunction: new// --------------------------------------------------------------------//endclass: tb_axi4_to_axis_agent_class// --------------------------------------------------------------------//endpackage: tb_axi4_to_axis_agent_class_pkg
