OpenCores
URL https://opencores.org/ocsvn/qaz_libs/qaz_libs/trunk

Subversion Repositories qaz_libs

[/] [qaz_libs/] [trunk/] [axi4_stream_lib/] [sim/] [tests/] [legacy/] [tb_axis_gear_box/] [tb_axis_gear_box_pkg.sv] - Rev 50

Compare with Previous | Blame | View Log

//////////////////////////////////////////////////////////////////////
////                                                              ////
//// Copyright (C) 2017 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_axis_gear_box_pkg;

  // --------------------------------------------------------------------
  //
  import uvm_pkg::*;
  `include "uvm_macros.svh"
  import axis_pkg::*;

  // --------------------------------------------------------------------
  //
  typedef struct
  {
    axis_config_t axis_cfg_in;
    axis_config_t axis_cfg_out;
  } dut_config_t;

  localparam dut_config_t dut_cfg =
    '{
      '{  N : 2 // data bus width in bytes.
      ,   I : 1 // TID width
      ,   D : 1 // TDEST width
      ,   U : 1 // TUSER width
      ,   USE_TSTRB : 0
      ,   USE_TKEEP : 0
      ,   USE_ROUTING : 0
      },
      '{  N : 2 // data bus width in bytes.
      ,   I : 1 // TID width
      ,   D : 1 // TDEST width
      ,   U : 1 // TUSER width
      ,   USE_TSTRB : 0
      ,   USE_TKEEP : 0
      ,   USE_ROUTING : 0
      }
    };

  // --------------------------------------------------------------------
  //
  class tb_dut_config #(dut_config_t dut_cfg);

    virtual tb_dut_if #(dut_cfg) dut_bus;

    // --------------------------------------------------------------------
    //
    function new(virtual tb_dut_if #(dut_cfg) dut_bus);
      this.dut_bus = dut_bus;
    endfunction : new

  // --------------------------------------------------------------------
  //
  endclass : tb_dut_config

  // --------------------------------------------------------------------
  //
  class tb_env extends uvm_env;
    `uvm_component_utils(tb_env);

    // --------------------------------------------------------------------
    //
    // coverage        coverage_h;
    // scoreboard      scoreboard_h;
    axis_agent #(dut_cfg.axis_cfg_in) agent_h;

    // --------------------------------------------------------------------
    //
    function new (string name, uvm_component parent);
      super.new(name,parent);
    endfunction : new

    // --------------------------------------------------------------------
    //
    function void build_phase(uvm_phase phase);
      tb_dut_config #(dut_cfg) cfg_h;
      if (!uvm_config_db#(tb_dut_config #(dut_cfg))::get(this, "", "tb_dut_config", cfg_h))
        `uvm_fatal(get_name(), "Couldn't get config object!")

      uvm_config_db
        #(
          virtual axis_if
            #(  .N(dut_cfg.axis_cfg_in.N)
            ,   .I(dut_cfg.axis_cfg_in.I)
            ,   .D(dut_cfg.axis_cfg_in.D)
            ,   .U(dut_cfg.axis_cfg_in.U)
            )
        )::set(this, "*agent_h", "axis_bus", cfg_h.dut_bus.axis_in);

        // // analysis
        // coverage_h    = coverage::type_id::create ("coverage_h",this);
        // scoreboard_h  = scoreboard::type_id::create("scoreboard",this);

        agent_h = axis_agent #(dut_cfg.axis_cfg_in)::type_id::create("agent_h", this);

    endfunction : build_phase

    // // --------------------------------------------------------------------
    // //
    // function void connect_phase(uvm_phase phase);

    // endfunction : connect_phase

// --------------------------------------------------------------------
//
endclass : tb_env

// --------------------------------------------------------------------
//
endpackage: tb_axis_gear_box_pkg





Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2020 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.