Commit 05563a9f authored by Dimitris Lampridis's avatar Dimitris Lampridis

update mockturtle to latest development version

parent 815da0cd
Subproject commit add8319c68770cd2dac9c10842aad8487aeb1717
Subproject commit b2260e1d00566b02c7355ea6b373de3770dc47d7
Subproject commit 5c7e906ceb6b15f53830061c9087cce0befef13a
Subproject commit 193f15dbf7516fa1e0163156bbf41168c1f3044a
......@@ -32,7 +32,6 @@
`include "mock_turtle_driver.svh"
class WrtdDrv;
uint32_t ready;
protected string name;
protected byte unsigned enable_logging;
protected MockTurtleDriver mt;
......@@ -64,7 +63,7 @@ class WrtdDrv;
$display (tmp);
endtask // mdisplay
task init ( );
task init ( time update_delay = 1us );
int i, j;
uint32_t val, cpu_ready;
......@@ -75,9 +74,7 @@ class WrtdDrv;
uint32_t data[];
this.ready = 0;
mt.init ( );
mt.init ( update_delay );
this.nbr_cpus = mt.rom.getCoreCount ( );
......@@ -96,83 +93,74 @@ class WrtdDrv;
mt.reset_core ( i, 0 );
end
fork
begin
for ( i = 0; i < this.nbr_cpus; i++ )
begin
// wait for ready notification from firmware
cpu_ready = 0;
while ( cpu_ready == 0 )
begin
val = 0;
if ( mt.pending_cpu_notifications ( i ) != 0 )
begin
mt.get_single_cpu_notification ( i, val );
if ( val == TRTL_CPU_NOTIFY_MAIN )
cpu_ready = 1;
end
# 1us;
end
// retrieve address of root
msg_get_config ( i, data );
this.roots[i].addr = data[0];
// retrieve root
msg_readw ( i, this.roots[i].addr, `WRTD_ROOT_WORD_SIZE, data );
this.roots[i].fw_name = new();
this.roots[i].fw_name.data_unpack(data[1:4]);
this.roots[i].fw_id = data[5];
this.roots[i].capabilities = ( data[6] & 'hff000000 ) >> 24;
this.roots[i].nbr_rules = ( data[6] & 'h00ff0000 ) >> 16;
this.roots[i].nbr_alarms = ( data[6] & 'h0000ff00 ) >> 8;
this.roots[i].nbr_devs = ( data[6] & 'h000000ff ) >> 0;
for ( j = 0; j < 4; j++)
begin
this.roots[i].nbr_channels[j] = ( data[9] >> j*8 ) & 'hff;
this.roots[i].channel_dir[j] = ( data[10] >> j*8 ) & 'hff;
end
this.roots[i].rules_addr = data[11];
this.roots[i].alarms_addr = data[12];
// init free rule slots
this.free_rule_slots[i] = this.roots[i].nbr_rules;
// turn on all logging if enabled
if ( this.enable_logging )
msg_writew ( i, this.roots[i].addr + 32, 1, { data[8] | 32'hff } );
mdisplay( $sformatf("CPU %0d: WRTD app '%s', id '0x%x'", i,
this.roots[i].fw_name.get(),
this.roots[i].fw_id) );
end
// initialise rules
this.rules = new ( this.name );
for ( i = 0; i < this.nbr_cpus; i++ )
for ( j = 0; j < this.roots[i].nbr_rules; j++ )
begin
new_rule = new ( this.name );
this.rules.collection.push_back ( new_rule );
end
// initialise alarms
this.alarms = new ( this.name );
for ( i = 0; i < this.nbr_cpus; i++ )
for ( j = 0; j < this.roots[i].nbr_alarms; j++ )
begin
new_alarm = new ( this.name );
this.alarms.collection.push_back ( new_alarm );
end
for ( i = 0; i < this.nbr_cpus; i++ )
begin
// wait for ready notification from firmware
cpu_ready = 0;
while ( cpu_ready == 0 )
begin
val = 0;
if ( mt.pending_cpu_notifications ( i ) != 0 )
begin
mt.get_single_cpu_notification ( i, val );
if ( val == TRTL_CPU_NOTIFY_MAIN )
cpu_ready = 1;
end
# 1us;
end
// retrieve address of root
msg_get_config ( i, data );
this.roots[i].addr = data[0];
// retrieve root
msg_readw ( i, this.roots[i].addr, `WRTD_ROOT_WORD_SIZE, data );
this.roots[i].fw_name = new();
this.roots[i].fw_name.data_unpack(data[1:4]);
this.roots[i].fw_id = data[5];
this.roots[i].capabilities = ( data[6] & 'hff000000 ) >> 24;
this.roots[i].nbr_rules = ( data[6] & 'h00ff0000 ) >> 16;
this.roots[i].nbr_alarms = ( data[6] & 'h0000ff00 ) >> 8;
this.roots[i].nbr_devs = ( data[6] & 'h000000ff ) >> 0;
for ( j = 0; j < 4; j++)
begin
this.roots[i].nbr_channels[j] = ( data[9] >> j*8 ) & 'hff;
this.roots[i].channel_dir[j] = ( data[10] >> j*8 ) & 'hff;
end
this.roots[i].rules_addr = data[11];
this.roots[i].alarms_addr = data[12];
// init free rule slots
this.free_rule_slots[i] = this.roots[i].nbr_rules;
// turn on all logging if enabled
if ( this.enable_logging )
msg_writew ( i, this.roots[i].addr + 32, 1, { data[8] | 32'hff } );
mdisplay( $sformatf("CPU %0d: WRTD app '%s', id '0x%x'", i,
this.roots[i].fw_name.get(),
this.roots[i].fw_id) );
end
end
// initialise rules
this.rules = new ( this.name );
for ( i = 0; i < this.nbr_cpus; i++ )
for ( j = 0; j < this.roots[i].nbr_rules; j++ )
begin
new_rule = new ( this.name );
this.rules.collection.push_back ( new_rule );
end
begin
while ( i != this.nbr_cpus )
begin
mt.update ( );
# 1us;
end
end
join
// initialise alarms
this.alarms = new ( this.name );
for ( i = 0; i < this.nbr_cpus; i++ )
for ( j = 0; j < this.roots[i].nbr_alarms; j++ )
begin
new_alarm = new ( this.name );
this.alarms.collection.push_back ( new_alarm );
end
this.ready = 1;
fork
forever begin
_update();
#(update_delay);
end
join_none
endtask // init
......@@ -544,11 +532,10 @@ class WrtdDrv;
end
endtask // check_logs
task update ( );
mt.update ( );
task _update ( );
if ( this.enable_logging )
check_logs ( );
endtask // update
endtask // _update
endclass // WrtdDrv
......
......@@ -233,16 +233,6 @@ module main;
end
initial begin
forever begin
if ( ( devA != null ) && ( devA.ready ) )
devA.update();
if ( ( devB != null ) && ( devB.ready ) )
devB.update();
#1us;
end
end
initial begin
$display();
$display("Start of simulation");
......
......@@ -114,12 +114,4 @@ module main;
end
initial begin
forever begin
if ( ( dev != null ) && ( dev.ready ) )
dev.update ();
#1us;
end
end
endmodule // main
......@@ -468,7 +468,6 @@ static void wrtd_log_discard(struct wrtd_rule *rule,
static void wrtd_init_tx(void)
{
static const struct trtl_ep_eth_address addr = {
.type = TRTL_EP_FRAME_UDP,
.dst_mac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
.dst_ip = 0xE000179F, /* multicast on 224.0.23.159 */
.src_ip = 0xC0A85A11,
......@@ -692,7 +691,6 @@ static void wrtd_route_in(struct wrtd_event *ev)
static void wrtd_init_rx(void)
{
static const struct trtl_ep_eth_address addr = {
.type = TRTL_EP_FRAME_UDP,
.dst_mac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
.dst_ip = 0xE000179F, /* multicast on 224.0.23.159 */
.dst_port = WRTD_UDP_PORT,
......
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