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/src
    from Rev 47 to Rev 48
    Reverse comparison

Rev 47 → Rev 48

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