Commit b0844b77 authored by Federico Vaga's avatar Federico Vaga

Merge remote-tracking branch 'ohwr/master'

parents 4e847792 9b36bddf
......@@ -57,6 +57,7 @@ typedef virtual IMockTurtleIRQ vIMockTurtleIRQ;
// The main class, to monitor and drive the complete MT
class MockTurtleDriver;
protected string name;
protected CWishboneAccessor acc;
protected uint64_t base;
protected uint32_t core_count;
......@@ -66,12 +67,23 @@ class MockTurtleDriver;
protected vIMockTurtleIRQ irq;
MDebug dbg;
function new ( CWishboneAccessor acc, uint64_t base, vIMockTurtleIRQ irq );
function new ( CWishboneAccessor acc, uint64_t base,
vIMockTurtleIRQ irq, string name = "" );
this.name = name;
this.acc = acc;
this.base = base;
this.irq = irq;
endfunction // new
task mdisplay ( string str );
string tmp;
if (this.name == "")
tmp = str;
else
tmp = $sformatf("[%s] %s", this.name, str);
$display (tmp);
endtask // mdisplay
task init ( wb_cycle_type_t mode = PIPELINED );
uint32_t slot_count;
wb_set_mode ( mode );
......@@ -79,10 +91,10 @@ class MockTurtleDriver;
rom = new ( acc, base + 'he000 );
rom.init();
core_count = rom.getCoreCount();
$display ("App ID: 0x%x", rom.getAppID);
$display ("Core count: %0d", core_count);
mdisplay ($sformatf("App ID: 0x%x", rom.getAppID));
mdisplay ($sformatf("Core count: %0d", core_count));
// Next init the MT CSR
csr = new ( acc, base + 'hc000, core_count );
csr = new ( acc, base + 'hc000, core_count, name );
csr.init();
// Debug interface
dbg = new (acc, csr);
......
......@@ -40,7 +40,7 @@
typedef uint32_t t_notify_queue[$];
class MTCPUControl;
protected string name;
protected CBusAccessor bus;
protected uint32_t base;
protected uint32_t core_count;
......@@ -48,12 +48,23 @@ class MTCPUControl;
t_notify_queue notify_queue[];
function new ( CBusAccessor bus, input uint32_t base, int core_count);
function new ( CBusAccessor bus, input uint32_t base,
int core_count, string name = "" );
this.name = name;
this.base = base;
this.bus = bus;
this.core_count = core_count;
endfunction // new
task mdisplay ( string str );
string tmp;
if (this.name == "")
tmp = str;
else
tmp = $sformatf("[%s] %s", this.name, str);
$display (tmp);
endtask // mdisplay
task writel ( uint32_t r, uint32_t v );
bus.write ( base + r, v );
endtask // _write
......@@ -156,7 +167,7 @@ class MTCPUControl;
if(rval == 0 || rval == 13 || rval == 10)
begin
$display("UART MSG from core %0d: %s", i, dbg_msg_queue[i]);
mdisplay ($sformatf("UART MSG from core %0d: %s", i, dbg_msg_queue[i]));
dbg_msg_queue[i] = "";
end
else
......
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