Commit 66676ef2 authored by Maciej Lipinski's avatar Maciej Lipinski Committed by Tomasz Wlostowski

sim[sink/slave]: added permanent stall

Signed-off-by: Tomasz Wlostowski's avatarTomasz Włostowski <tomasz.wlostowski@cern.ch>
parent 191c3bd6
......@@ -388,6 +388,8 @@ virtual class EthPacketSink;
static int _null = 0;
pure virtual function int poll();
pure virtual function int permanent_stall_enable();
pure virtual function int permanent_stall_disable();
pure virtual task recv(ref EthPacket pkt, ref int result = _null);
endclass // EthPacketSink
......
......@@ -63,8 +63,11 @@ interface IWishboneSlave
real stall_prob;
} settings;
int permanent_stall = 0;
function automatic int _poll(); return poll(); endfunction
function automatic int _permanent_stall_enable(); return permanent_stall_enable(); endfunction
function automatic int _permanent_stall_disable(); return permanent_stall_disable(); endfunction
task automatic _get(ref wb_cycle_t xfer); get(xfer); endtask
class CIWBSlaveAccessor extends CWishboneAccessor;
......@@ -72,7 +75,15 @@ interface IWishboneSlave
function automatic int poll();
return _poll();
endfunction
function automatic int permanent_stall_enable();
return _permanent_stall_enable();
endfunction
function automatic int permanent_stall_disable();
return _permanent_stall_disable();
endfunction
task get(ref wb_cycle_t xfer);
_get(xfer);
endtask
......@@ -88,7 +99,18 @@ interface IWishboneSlave
tmp = new;
return tmp;
endfunction // get_accessor
function automatic int permanent_stall_enable();
permanent_stall = 1;
$display("permanent stall ON");
return permanent_stall;
endfunction
function automatic int permanent_stall_disable();
permanent_stall = 0;
$display("permanent stall OFF");
return permanent_stall;
endfunction
function automatic int poll();
return c_queue.size() != 0;
......@@ -152,7 +174,10 @@ interface IWishboneSlave
task pipelined_fsm();
if(settings.gen_random_stalls)
// ML
if(permanent_stall)
stall <= 1;
else if(settings.gen_random_stalls)
gen_random_stalls();
else
stall <= 0;
......
......@@ -21,6 +21,16 @@ virtual class CWishboneAccessor extends CBusAccessor;
virtual function automatic int poll();
return 0;
endfunction // poll
// ML stuff [slave only]
virtual function automatic int permanent_stall_enable();
$display("CWisboneAccessor: permanent_stall: ON");
endfunction;
// ML stuff [slave only]
virtual function automatic int permanent_stall_disable();
$display("CWisboneAccessor: permanent_stall: OFF");
endfunction;
// [slave only] adds a simulation event (e.g. a forced STALL, RETRY, ERROR)
// evt = event type (STALL, ERROR, RETRY)
......
......@@ -21,6 +21,13 @@ class WBPacketSink extends EthPacketSink;
return m_acc.poll();
endfunction // poll
function int permanent_stall_enable();
return m_acc.permanent_stall_enable();
endfunction
function int permanent_stall_disable();
return m_acc.permanent_stall_disable();
endfunction
protected task decode_status(uint64_t stat, ref EthPacket pkt);
if(stat & 'h2)
pkt.error = 1'b1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment