Line 376... |
Line 376... |
$table->attach ($box,$col, $col+1, $row, $row+1,'shrink','shrink',2,2);$row++;
|
$table->attach ($box,$col, $col+1, $row, $row+1,'shrink','shrink',2,2);$row++;
|
|
|
|
|
|
|
my @info = (
|
my @info = (
|
{ label=>'Routers per Row', param_name=>'NX', type=>"Spin-button", default_val=>2, content=>"2,64,1", info=>undef, param_parent=>'noc_param', ref_delay=>1,placement=>'vertical'},
|
{ label=>'Routers per Row', param_name=>'T1', type=>"Spin-button", default_val=>2, content=>"2,64,1", info=>undef, param_parent=>'noc_param', ref_delay=>1,placement=>'vertical'},
|
{ label=>"Routers per Column", param_name=>"NY", type=>"Spin-button", default_val=>2, content=>"1,64,1", info=>undef, param_parent=>'noc_param',ref_delay=>1, placement=>'vertical'},
|
{ label=>"Routers per Column", param_name=>"T2", type=>"Spin-button", default_val=>2, content=>"1,64,1", info=>undef, param_parent=>'noc_param',ref_delay=>1, placement=>'vertical'},
|
{ label=>"Mapping Algorithm", param_name=>"Map_Algrm", type=>"Combo-box", default_val=>'Random', content=>"Nmap,Random,Reverse-NMAP,Direct", info=>undef, param_parent=>'map_param',ref_delay=>undef,placement=>'horizental'},
|
{ label=>"Mapping Algorithm", param_name=>"Map_Algrm", type=>"Combo-box", default_val=>'Random', content=>"Nmap,Random,Reverse-NMAP,Direct", info=>undef, param_parent=>'map_param',ref_delay=>undef,placement=>'horizental'},
|
|
|
);
|
);
|
|
|
|
|
Line 413... |
Line 413... |
$auto->signal_connect ( 'clicked'=> sub{
|
$auto->signal_connect ( 'clicked'=> sub{
|
my @tasks = $self->get_all_tasks();
|
my @tasks = $self->get_all_tasks();
|
my $task_num= scalar @tasks;
|
my $task_num= scalar @tasks;
|
return if($task_num ==0);
|
return if($task_num ==0);
|
my ($nx,$ny) =network_dim_cal($task_num);
|
my ($nx,$ny) =network_dim_cal($task_num);
|
$self->object_add_attribute('noc_param','NX',$nx);
|
$self->object_add_attribute('noc_param','T1',$nx);
|
$self->object_add_attribute('noc_param','NY',$ny);
|
$self->object_add_attribute('noc_param','T2',$ny);
|
set_gui_status($self,"ref",1);
|
set_gui_status($self,"ref",1);
|
});
|
});
|
|
|
$clean->signal_connect ( 'clicked'=> sub{
|
$clean->signal_connect ( 'clicked'=> sub{
|
remove_mapping($self);
|
remove_mapping($self);
|
Line 608... |
Line 608... |
$table-> attach (gen_label_in_left($p), $col, $col+1, $row, $row+1,'shrink','shrink',2,2); $col++;
|
$table-> attach (gen_label_in_left($p), $col, $col+1, $row, $row+1,'shrink','shrink',2,2); $col++;
|
}
|
}
|
$col=0;
|
$col=0;
|
$row++;
|
$row++;
|
|
|
# { label=>'Routers per Row', param_name=>'NX', type=>"Spin-button", default_val=>2, content=>"2,64,1", info=>undef, param_parent=>'noc_param', ref_delay=>undef},
|
# { label=>'Routers per Row', param_name=>'T1', type=>"Spin-button", default_val=>2, content=>"2,64,1", info=>undef, param_parent=>'noc_param', ref_delay=>undef},
|
|
|
my $nx=$self->object_get_attribute('noc_param','NX');
|
my $nx=$self->object_get_attribute('noc_param','T1');
|
my $ny=$self->object_get_attribute('noc_param','NY');
|
my $ny=$self->object_get_attribute('noc_param','T2');
|
|
|
|
|
|
|
my @tiles=get_tiles_name($self);
|
my @tiles=get_tiles_name($self);
|
|
|
Line 870... |
Line 870... |
|
|
if ( "ok" eq $dialog->run ) {
|
if ( "ok" eq $dialog->run ) {
|
$file = $dialog->get_filename;
|
$file = $dialog->get_filename;
|
my ($name,$path,$suffix) = fileparse("$file",qr"\..[^.]*$");
|
my ($name,$path,$suffix) = fileparse("$file",qr"\..[^.]*$");
|
if($suffix eq '.TRC'){
|
if($suffix eq '.TRC'){
|
my $pp= eval { do $file };
|
my ($pp,$r,$err) = regen_object($file);
|
if ($@ || !defined $pp){
|
if ($r){
|
message_dialog("**Error reading $file file: $@\n");
|
message_dialog("**Error reading $file file: $err\n");
|
$dialog->destroy;
|
$dialog->destroy;
|
return;
|
return;
|
}
|
}
|
|
|
clone_obj($self,$pp);
|
clone_obj($self,$pp);
|
Line 949... |
Line 949... |
return $file;
|
return $file;
|
}
|
}
|
|
|
sub get_tile_id{
|
sub get_tile_id{
|
my ($self,$task)=@_;
|
my ($self,$task)=@_;
|
my $nx=$self->object_get_attribute('noc_param','NX');
|
my $nx=$self->object_get_attribute('noc_param','T1');
|
my $tile=$self->object_get_attribute("MAP_TILE",$task);
|
my $tile=$self->object_get_attribute("MAP_TILE",$task);
|
my ($x, $y) = $tile =~ /(\d+)/g;
|
my ($x, $y) = $tile =~ /(\d+)/g;
|
$y=0 if(!defined $y);
|
$y=0 if(!defined $y);
|
my $IP_NUM = ($y * $nx) + $x;
|
my $IP_NUM = ($y * $nx) + $x;
|
return $IP_NUM;
|
return $IP_NUM;
|
Line 1147... |
Line 1147... |
sub random_map{
|
sub random_map{
|
my $self=shift;
|
my $self=shift;
|
|
|
|
|
|
|
my $nx=$self->object_get_attribute('noc_param','NX');
|
my $nx=$self->object_get_attribute('noc_param','T1');
|
my $ny=$self->object_get_attribute('noc_param','NY');
|
my $ny=$self->object_get_attribute('noc_param','T2');
|
my $nc= $nx * $ny;
|
my $nc= $nx * $ny;
|
|
|
|
|
|
|
my @tasks=get_nlock_tasks($self);
|
my @tasks=get_nlock_tasks($self);
|
Line 1180... |
Line 1180... |
}
|
}
|
|
|
sub direct_map {
|
sub direct_map {
|
my $self=shift;
|
my $self=shift;
|
|
|
my $nx=$self->object_get_attribute('noc_param','NX');
|
my $nx=$self->object_get_attribute('noc_param','T1');
|
my $ny=$self->object_get_attribute('noc_param','NY');
|
my $ny=$self->object_get_attribute('noc_param','T2');
|
my $nc= $nx * $ny;
|
my $nc= $nx * $ny;
|
my @tasks=get_nlock_tasks($self);
|
my @tasks=get_nlock_tasks($self);
|
my @tiles=get_nlock_tiles($self);
|
my @tiles=get_nlock_tiles($self);
|
$self->remove_nlock_mapping() ;
|
$self->remove_nlock_mapping() ;
|
|
|
Line 1247... |
Line 1247... |
|
|
|
|
sub get_tiles_name{
|
sub get_tiles_name{
|
my $self=shift;
|
my $self=shift;
|
my @tiles;
|
my @tiles;
|
my $nx=$self->object_get_attribute('noc_param','NX');
|
my $nx=$self->object_get_attribute('noc_param','T1');
|
my $ny=$self->object_get_attribute('noc_param','NY');
|
my $ny=$self->object_get_attribute('noc_param','T2');
|
if(defined $ny){
|
if(defined $ny){
|
if($ny == 1){
|
if($ny == 1){
|
for(my $x=0; $x<$nx; $x++){
|
for(my $x=0; $x<$nx; $x++){
|
push(@tiles,"tile($x)");
|
push(@tiles,"tile($x)");
|
}
|
}
|
|
|
}
|
}
|
else{
|
else{
|
for(my $y=0; $y<$ny; $y++){my $nx=$self->object_get_attribute('noc_param','NX');
|
for(my $y=0; $y<$ny; $y++){my $nx=$self->object_get_attribute('noc_param','T1');
|
my $ny=$self->object_get_attribute('noc_param','NY');
|
my $ny=$self->object_get_attribute('noc_param','T2');
|
for(my $x=0; $x<$nx; $x++){
|
for(my $x=0; $x<$nx; $x++){
|
push(@tiles,"tile(${x}_$y)");
|
push(@tiles,"tile(${x}_$y)");
|
}
|
}
|
}
|
}
|
|
|
Line 1272... |
Line 1272... |
}
|
}
|
|
|
sub get_tile_name{
|
sub get_tile_name{
|
my ($self,$x,$y)=@_;
|
my ($self,$x,$y)=@_;
|
|
|
my $nx=$self->object_get_attribute('noc_param','NX');
|
my $nx=$self->object_get_attribute('noc_param','T1');
|
my $ny=$self->object_get_attribute('noc_param','NY');
|
my $ny=$self->object_get_attribute('noc_param','T2');
|
if(defined $ny){
|
if(defined $ny){
|
return "tile($x)" if($ny == 1);
|
return "tile($x)" if($ny == 1);
|
}
|
}
|
return "tile(${x}_$y)";
|
return "tile(${x}_$y)";
|
}
|
}
|
Line 1339... |
Line 1339... |
}
|
}
|
|
|
|
|
sub find_max_neighbor_tile{
|
sub find_max_neighbor_tile{
|
my $self=shift;
|
my $self=shift;
|
my $nx=$self->object_get_attribute('noc_param','NX');
|
my $nx=$self->object_get_attribute('noc_param','T1');
|
my $ny=$self->object_get_attribute('noc_param','NY');
|
my $ny=$self->object_get_attribute('noc_param','T2');
|
my $x_mid = floor($nx/2);
|
my $x_mid = floor($nx/2);
|
my $y_mid = floor($ny/2);
|
my $y_mid = floor($ny/2);
|
#my $centered_tile= get_tile_name($self,$x_mid ,$y_mid);
|
#my $centered_tile= get_tile_name($self,$x_mid ,$y_mid);
|
#Select the tile located in center as the max-neighbor if its not locked for any other task
|
#Select the tile located in center as the max-neighbor if its not locked for any other task
|
#therwise select the tile with the min manhatan distance to center tile
|
#therwise select the tile with the min manhatan distance to center tile
|
Line 1365... |
Line 1365... |
}
|
}
|
|
|
|
|
sub find_min_neighbor_tile {
|
sub find_min_neighbor_tile {
|
my $self=shift;
|
my $self=shift;
|
my $nx=$self->object_get_attribute('noc_param','NX');
|
my $nx=$self->object_get_attribute('noc_param','T1');
|
my $ny=$self->object_get_attribute('noc_param','NY');
|
my $ny=$self->object_get_attribute('noc_param','T2');
|
my $x_mid = 0;
|
my $x_mid = 0;
|
my $y_mid = 0;
|
my $y_mid = 0;
|
#my $centered_tile= get_tile_name($self,$x_mid ,$y_mid);
|
#my $centered_tile= get_tile_name($self,$x_mid ,$y_mid);
|
#Select the tile located in center as the max-neighbor if its not locked for any other task
|
#Select the tile located in center as the max-neighbor if its not locked for any other task
|
#therwise select the tile with the min manhatan distance to center tile
|
#therwise select the tile with the min manhatan distance to center tile
|
Line 1395... |
Line 1395... |
sub nmap_algorithm{
|
sub nmap_algorithm{
|
|
|
my $self=shift;
|
my $self=shift;
|
|
|
|
|
my $nx=$self->object_get_attribute('noc_param','NX');
|
my $nx=$self->object_get_attribute('noc_param','T1');
|
my $ny=$self->object_get_attribute('noc_param','NY');
|
my $ny=$self->object_get_attribute('noc_param','T2');
|
my $nc= $nx * $ny;
|
my $nc= $nx * $ny;
|
|
|
my @tasks=get_all_tasks($self);
|
my @tasks=get_all_tasks($self);
|
my @tiles= get_tiles_name($self);
|
my @tiles= get_tiles_name($self);
|
|
|
Line 1566... |
Line 1566... |
sub worst_map_algorithm{
|
sub worst_map_algorithm{
|
|
|
my $self=shift;
|
my $self=shift;
|
|
|
|
|
my $nx=$self->object_get_attribute('noc_param','NX');
|
my $nx=$self->object_get_attribute('noc_param','T1');
|
my $ny=$self->object_get_attribute('noc_param','NY');
|
my $ny=$self->object_get_attribute('noc_param','T2');
|
my $nc= $nx * $ny;
|
my $nc= $nx * $ny;
|
|
|
my @tasks=get_all_tasks($self);
|
my @tasks=get_all_tasks($self);
|
my @tiles= get_tiles_name($self);
|
my @tiles= get_tiles_name($self);
|
|
|