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

Subversion Repositories qaz_libs

[/] [qaz_libs/] [trunk/] [PCIe/] [sim/] [src/] [RIFFA/] [s_riffa_rp_tx_api.svh] - Rev 50

Compare with Previous | Blame | View Log

// --------------------------------------------------------------------
class s_riffa_rp_tx_api extends uvm_sequence #(riffa_sequence_item);
  `uvm_object_utils(s_riffa_rp_tx_api)

  // --------------------------------------------------------------------
  riffa_sequence_item item;
  int dwidth;
  // mailbox #(riffa_sequence_item) q;

  // --------------------------------------------------------------------
  uvm_sequencer_base o_seqr;
  uvm_sequence_base o_parent;

  function void init(uvm_sequencer_base o_seqr, uvm_sequence_base o_parent, int dwidth);
    this.o_seqr   = o_seqr;
    this.o_parent = o_parent;
    this.dwidth   = dwidth;
  endfunction : init

  // --------------------------------------------------------------------
  task counting(bit [31:0] len, bit [30:0] off, bit last=1);
    item = riffa_sequence_item::type_id::create("riffa_sequence_item");
    item.tr = RIFFA_RX_PAYLOAD;
    item.init(dwidth, len, off, last);

    foreach(item.data[i])
      item.data[i] = i + 1;

    this.start(o_seqr, o_parent);
  endtask

  // --------------------------------------------------------------------
  task binary_file
    ( string file_name
    , bit [31:0] len
    , bit [30:0] off
    , bit last=1);

    integer fd;
    integer code;
    item = riffa_sequence_item::type_id::create("riffa_sequence_item");
    item.tr = RIFFA_RX_PAYLOAD;
    item.init(dwidth, len, off, last);

    fd = $fopen(file_name, "rb");
    code = $fread(item.data, fd);
    $display("##### code = %x #####", code);
    $fclose(fd);

    this.start(o_seqr, o_parent);
  endtask

  // --------------------------------------------------------------------
  task body();
    start_item(item);
    finish_item(item);
  endtask

  // --------------------------------------------------------------------
  function new(string name = "s_riffa_rp_tx_api");
    super.new(name);
    // q = new;
  endfunction

// --------------------------------------------------------------------
endclass

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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