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

Subversion Repositories qaz_libs

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /qaz_libs/trunk/BFM
    from Rev 48 to Rev 47
    Reverse comparison

Rev 48 → Rev 47

/src/SPI/spi_driver.svh
42,17 → 42,16
//--------------------------------------------------------------------
virtual task run_phase(uvm_phase phase);
spi_sequence_item item;
int index;
int index = 0;
 
set_default();
 
forever
begin
index = 0;
seq_item_port.get_next_item(item);
 
vif.ss_n <= 0;
vif.mosi <= item.mosi_data[index];
vif.mosi <= item.mo_data[index];
#(vif.period / 2);
 
fork
68,10 → 67,10
repeat(item.data_width)
begin
@(vif.cb_rise);
item.miso_data[index] = vif.miso;
item.mi_data[index] = vif.miso;
index++;
@(vif.cb_fall);
vif.mosi <= item.mosi_data[index];
vif.mosi <= item.mo_data[index];
end
 
#(vif.period / 2);
/src/SPI/spi_sequence_item.svh
33,10 → 33,8
rand int data_width; // data size in bits
 
// --------------------------------------------------------------------
logic miso_data[]; // data from slave to master
logic mosi_data[]; // data from master to slave
bit read;
bit write;
logic mi_data[]; // data from slave to master
logic mo_data[]; // data from master to slave
 
// --------------------------------------------------------------------
function new(string name = "");
44,16 → 42,13
endfunction : new
 
// --------------------------------------------------------------------
function void init(bit read, bit write, int data_width);
this.read = read;
this.write = write;
function void init(int data_width = 16 * 16);
this.data_width = data_width;
this.miso_data = new[data_width];
this.mosi_data = new[data_width];
 
if(write)
foreach(this.mosi_data[i])
mosi_data[i] = 0;
this.mi_data = new[data_width];
this.mo_data = new[data_width];
foreach(this.mo_data[i])
mo_data[i] = 0;
endfunction : init
 
// // --------------------------------------------------------------------
89,43 → 84,28
// count = item.count;
// endfunction : do_copy
 
// --------------------------------------------------------------------
function string convert2string();
string s0, s1, s2, s3;
byte data[];
// // --------------------------------------------------------------------
// function string convert2string();
// string s0, s1, s2, s3;
// s0 = $sformatf( "| %m | wr | rd | full | empty |\n");
// s1 = $sformatf( "| %m | %1h | %1h | %1h | %1h |\n"
// , (command == FIFO_WR) || (command == FIFO_BOTH)
// , (command == FIFO_RD) || (command == FIFO_BOTH)
// , wr_full
// , rd_empty
// );
// s2 = $sformatf("| %m | wr_data: %h\n" , wr_data);
// s3 = $sformatf("| %m | rd_data: %h\n" , rd_data);
 
s0 = $sformatf( "\n| %m | rd | wr | data width |\n");
s1 = $sformatf( "| %m | %1h | %1h | %d |\n"
, read
, write
, data_width
);
s0 = {s0, s1};
// if(command == FIFO_NULL)
// return {s1, s0};
// else if(command == FIFO_BOTH)
// return {s3, s2, s1, s0};
// else if(command == FIFO_WR)
// return {s2, s1, s0};
// else if(command == FIFO_RD)
// return {s3, s1, s0};
// endfunction : convert2string
 
if(read)
begin
data = {>>{miso_data}};
 
foreach(data[i])
s2 = {s2, $sformatf("%2h|", data[i])};
 
s2 = $sformatf("| %m | miso_data: |%s\n" , s2);
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

powered by: WebSVN 2.1.0

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