Line 53... |
Line 53... |
endfunction: get_data_size
|
endfunction: get_data_size
|
|
|
|
|
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
//
|
//
|
|
function void constant(int len, int off, bit last, logic [(8*N)-1:0] value);
|
|
this.data = new[get_data_size(len)];
|
|
this.len = len;
|
|
this.off = off;
|
|
this.last = last;
|
|
foreach(this.data[i])
|
|
this.data[i] = value;
|
|
endfunction: constant
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
//
|
|
function void counting(int len, int off, bit last);
|
|
this.data = new[get_data_size(len)];
|
|
this.len = len;
|
|
this.off = off;
|
|
this.last = last;
|
|
foreach(this.data[i])
|
|
this.data[i] = i;
|
|
endfunction: counting
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
//
|
function void random(int len, int off, bit last);
|
function void random(int len, int off, bit last);
|
this.data = new[get_data_size(len)];
|
this.data = new[get_data_size(len)];
|
assert(this.randomize() with
|
assert(this.randomize() with
|
{
|
{
|
this.len == len; // why not working?
|
this.len == len; // why not working?
|
Line 67... |
Line 91... |
this.off = off;
|
this.off = off;
|
this.last = last;
|
this.last = last;
|
endfunction: random
|
endfunction: random
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
//
|
|
function void compare(riffa_transaction_class #(N) to, int max_mismatches = 8);
|
|
int error_count = 0;
|
|
$display("!!! %16.t | %m", $time);
|
|
if(this.len != to.len)
|
|
$display("!!! %16.t | ERROR! len mismatch", $time);
|
|
|
|
if(this.off != to.off)
|
|
$display("!!! %16.t | ERROR! off mismatch", $time);
|
|
|
|
if(this.last != to.last)
|
|
$display("!!! %16.t | ERROR! last mismatch", $time);
|
|
|
|
foreach(this.data[i])
|
|
begin
|
|
if(error_count > max_mismatches)
|
|
break;
|
|
if(this.data[i] != to.data[i])
|
|
begin
|
|
$display("!!! %16.t | ERROR! | 0x%x | this != to | 0x%x != 0x%x", $time, i, this.data[i], to.data[i]);
|
|
error_count++;
|
|
end
|
|
end
|
|
endfunction: compare
|
|
|
|
|
// // --------------------------------------------------------------------
|
// // --------------------------------------------------------------------
|
// //
|
// //
|
// function void copy(ref riffa_transaction_class #(N) from);
|
// function void copy(ref riffa_transaction_class #(N) from);
|
// this.len = from.len;
|
// this.len = from.len;
|
// this.off = from.off;
|
// this.off = from.off;
|
Line 203... |
Line 254... |
fork
|
fork
|
@(chnl_bus.cb_rp_tx)
|
@(chnl_bus.cb_rp_tx)
|
chnl_bus.cb_rp_rx.tx_ack <= 0;
|
chnl_bus.cb_rp_rx.tx_ack <= 0;
|
join_none
|
join_none
|
|
|
|
// foreach(tr_h.data[i])
|
|
// @(chnl_bus.cb_rp_tx)
|
|
// if(~chnl_bus.cb_rp_rx.tx)
|
|
// break;
|
|
// else if(chnl_bus.cb_rp_rx.tx_data_valid)
|
|
// tr_h.data[i] <= chnl_bus.cb_rp_rx.tx_data;
|
|
|
foreach(tr_h.data[i])
|
foreach(tr_h.data[i])
|
@(chnl_bus.cb_rp_tx)
|
@(chnl_bus.cb_rp_tx iff chnl_bus.cb_rp_rx.tx_data_valid)
|
if(~chnl_bus.cb_rp_rx.tx)
|
|
break;
|
|
else if(chnl_bus.cb_rp_rx.tx_data_valid)
|
|
tr_h.data[i] <= chnl_bus.cb_rp_rx.tx_data;
|
tr_h.data[i] <= chnl_bus.cb_rp_rx.tx_data;
|
|
|
rx_q.put(tr_h);
|
rx_q.put(tr_h);
|
set_default();
|
set_default();
|
->rx_done;
|
->rx_done;
|