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

Subversion Repositories qaz_libs

[/] [qaz_libs/] [trunk/] [BFM/] [src/] [SPI/] [spi_sequence_item.svh] - Diff between revs 47 and 48

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 47 Rev 48
Line 31... Line 31...
 
 
  // --------------------------------------------------------------------
  // --------------------------------------------------------------------
  rand int data_width; // data size in bits
  rand int data_width; // data size in bits
 
 
  // --------------------------------------------------------------------
  // --------------------------------------------------------------------
  logic mi_data[]; // data from slave to master
  logic miso_data[]; // data from slave to master
  logic mo_data[]; // data from master to slave
  logic mosi_data[]; // data from master to slave
 
  bit read;
 
  bit write;
 
 
  // --------------------------------------------------------------------
  // --------------------------------------------------------------------
  function new(string name = "");
  function new(string name = "");
    super.new(name);
    super.new(name);
  endfunction : new
  endfunction : new
 
 
  // --------------------------------------------------------------------
  // --------------------------------------------------------------------
  function void init(int data_width = 16 * 16);
  function void init(bit read, bit write, int data_width);
 
    this.read = read;
 
    this.write = write;
    this.data_width = data_width;
    this.data_width = data_width;
    this.mi_data = new[data_width];
    this.miso_data = new[data_width];
    this.mo_data = new[data_width];
    this.mosi_data = new[data_width];
 
 
    foreach(this.mo_data[i])
    if(write)
      mo_data[i] = 0;
      foreach(this.mosi_data[i])
 
        mosi_data[i] = 0;
  endfunction : init
  endfunction : init
 
 
  // // --------------------------------------------------------------------
  // // --------------------------------------------------------------------
  // function bit do_compare(uvm_object rhs, uvm_comparer comparer);
  // function bit do_compare(uvm_object rhs, uvm_comparer comparer);
    // spi_sequence_item tested;
    // spi_sequence_item tested;
Line 82... Line 87...
    // wr_data   = item.wr_data;
    // wr_data   = item.wr_data;
    // rd_data   = item.rd_data;
    // rd_data   = item.rd_data;
    // count     = item.count;
    // count     = item.count;
  // endfunction : do_copy
  // endfunction : do_copy
 
 
  // // --------------------------------------------------------------------
  // --------------------------------------------------------------------
  // function string convert2string();
  function string convert2string();
    // string s0, s1, s2, s3;
    string s0, s1, s2, s3;
    // s0 = $sformatf( "| %m | wr | rd | full | empty |\n");
    byte data[];
    // s1 = $sformatf( "| %m | %1h  | %1h  | %1h    | %1h     |\n"
 
                  // , (command == FIFO_WR) || (command == FIFO_BOTH)
    s0 = $sformatf( "\n| %m | rd | wr | data width |\n");
                  // , (command == FIFO_RD) || (command == FIFO_BOTH)
    s1 = $sformatf( "| %m | %1h  | %1h  | %d |\n"
                  // , wr_full
                  , read
                  // , rd_empty
                  , write
                  // );
                  , data_width
    // s2 = $sformatf("| %m | wr_data: %h\n" , wr_data);
                  );
    // s3 = $sformatf("| %m | rd_data: %h\n" , rd_data);
    s0 = {s0, s1};
 
 
    // if(command == FIFO_NULL)
    if(read)
      // return {s1, s0};
    begin
    // else if(command == FIFO_BOTH)
      data = {>>{miso_data}};
      // return {s3, s2, s1, s0};
 
    // else if(command == FIFO_WR)
      foreach(data[i])
      // return {s2, s1, s0};
        s2 = {s2, $sformatf("%2h|", data[i])};
    // else if(command == FIFO_RD)
 
      // return {s3, s1, s0};
      s2 = $sformatf("| %m | miso_data: |%s\n" , s2);
  // endfunction : convert2string
      s0 = {s0, s2};
 
    end
 
 
 
    if(write)
 
    begin
 
      data = {>>{mosi_data}};
 
 
 
      foreach(data[i])
 
        s3 = {s3, $sformatf("%2h|", data[i])};
 
 
 
      s3 = $sformatf("| %m | mosi_data: |%s\n" , s3);
 
      s0 = {s0, s3};
 
    end
 
 
 
    return s0;
 
  endfunction : convert2string
 
 
// --------------------------------------------------------------------
// --------------------------------------------------------------------
endclass : spi_sequence_item
endclass : spi_sequence_item

powered by: WebSVN 2.1.0

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