Line 17... |
Line 17... |
my $io_v="\tclk,\n\treset";
|
my $io_v="\tclk,\n\treset";
|
my $io_def_v="
|
my $io_def_v="
|
//IO
|
//IO
|
\tinput\tclk,reset;\n";
|
\tinput\tclk,reset;\n";
|
my $param_as_in_v;
|
my $param_as_in_v;
|
|
# generate top
|
|
my $top_io="\t\t.clk(clk) ,\n\t\t.reset(reset_ored_jtag)";
|
|
|
|
|
#generate socs_parameter
|
#generate socs_parameter
|
my $socs_param= gen_socs_param($mpsoc);
|
my $socs_param= gen_socs_param($mpsoc);
|
|
|
#generate noc_parameter
|
#generate noc_parameter
|
my ($noc_param,$pass_param)=gen_noc_param_v($mpsoc);
|
my ($noc_param,$pass_param)=gen_noc_param_v($mpsoc);
|
|
|
#generate the noc
|
#generate the noc
|
my $noc_v=gen_noc_v();
|
my $noc_v=gen_noc_v($pass_param);
|
|
|
#generate socs
|
#generate socs
|
my $socs_v=gen_socs_v($mpsoc,\$io_v,\$io_def_v);
|
my $socs_v=gen_socs_v($mpsoc,\$io_v,\$io_def_v,\$top_io);
|
|
|
#functions
|
#functions
|
my $functions=get_functions();
|
my $functions=get_functions();
|
|
|
my $mpsoc_v = (defined $param_as_in_v )? "module $mpsoc_name #(\n $param_as_in_v\n)(\n$io_v\n);\n": "module $mpsoc_name (\n$io_v\n);\n";
|
my $mpsoc_v = (defined $param_as_in_v )? "module $mpsoc_name #(\n $param_as_in_v\n)(\n$io_v\n);\n": "module $mpsoc_name (\n$io_v\n);\n";
|
Line 42... |
Line 45... |
add_text_to_string (\$mpsoc_v,$io_def_v);
|
add_text_to_string (\$mpsoc_v,$io_def_v);
|
add_text_to_string (\$mpsoc_v,$noc_v);
|
add_text_to_string (\$mpsoc_v,$noc_v);
|
add_text_to_string (\$mpsoc_v,$socs_v);
|
add_text_to_string (\$mpsoc_v,$socs_v);
|
add_text_to_string (\$mpsoc_v,"\nendmodule\n");
|
add_text_to_string (\$mpsoc_v,"\nendmodule\n");
|
|
|
|
my $top_v = (defined $param_as_in_v )? "module ${mpsoc_name}_top #(\n $param_as_in_v\n)(\n$io_v\n);\n": "module ${mpsoc_name}_top (\n $io_v\n);\n";
|
|
add_text_to_string (\$top_v,$socs_param);
|
|
add_text_to_string (\$top_v,$io_def_v);
|
|
add_text_to_string(\$top_v,"
|
|
// Allow software to remote reset/enable the cpu via jtag
|
|
|
|
wire jtag_cpu_en, jtag_system_reset;
|
|
|
|
jtag_system_en jtag_en (
|
|
.cpu_en(jtag_cpu_en),
|
|
.system_reset(jtag_system_reset)
|
|
|
|
);
|
|
|
|
wire reset_ored_jtag = reset | jtag_system_reset;
|
|
wire processors_en_anded_jtag = processors_en & jtag_cpu_en;
|
|
|
|
${mpsoc_name} the_${mpsoc_name} (
|
|
|
|
$top_io
|
|
|
|
|
|
);
|
|
|
|
endmodule
|
|
|
return $mpsoc_v;
|
|
|
");
|
|
|
|
#my $ins= gen_mpsoc_instance_v($mpsoc,$mpsoc_name,$param_pass_v);
|
|
|
|
#add_text_to_string(\$top_v,$local_param_v_all."\n".$io_full_v_all);
|
|
#add_text_to_string(\$top_v,$ins);
|
|
return ($mpsoc_v,$top_v);
|
}
|
}
|
|
|
sub get_functions{
|
sub get_functions{
|
my $p='
|
my $p='
|
//functions
|
//functions
|
Line 171... |
Line 206... |
|
|
|
|
|
|
|
|
sub gen_noc_v{
|
sub gen_noc_v{
|
|
my $pass_param = shift;
|
|
|
my $noc = read_file("../src_noc/noc.v");
|
my $noc = read_file("../src_noc/noc.v");
|
my @noc_param=$noc->get_modules_parameters_not_local_order('noc');
|
my @noc_param=$noc->get_modules_parameters_not_local_order('noc');
|
|
|
|
|
Line 204... |
Line 239... |
//NoC\n \tnoc #(\n";
|
//NoC\n \tnoc #(\n";
|
my $i=0;
|
my $i=0;
|
foreach my $p (@noc_param){
|
foreach my $p (@noc_param){
|
my $param=($i==0)? "\t\t.$p($p)":",\n\t\t.$p($p)";
|
my $param=($i==0)? "\t\t.$p($p)":",\n\t\t.$p($p)";
|
$i=1;
|
$i=1;
|
add_text_to_string(\$noc_v,$param);
|
#add_text_to_string(\$noc_v,$param);
|
}
|
}
|
add_text_to_string(\$noc_v,"\n\t)\n\tthe_noc\n\t(\n");
|
add_text_to_string(\$noc_v,"$pass_param\n\t)\n\tthe_noc\n\t(\n");
|
|
|
my @ports= $noc->get_module_ports_order('noc');
|
my @ports= $noc->get_module_ports_order('noc');
|
$i=0;
|
$i=0;
|
foreach my $p (@ports){
|
foreach my $p (@ports){
|
my $port;
|
my $port;
|
Line 291... |
Line 326... |
|
|
|
|
|
|
|
|
sub gen_socs_v{
|
sub gen_socs_v{
|
my ($mpsoc,$io_v_ref,$io_def_v)=@_;
|
my ($mpsoc,$io_v_ref,$io_def_v,$top_io_ref)=@_;
|
|
|
#generate loop
|
#generate loop
|
|
|
# my $socs_v='
|
# my $socs_v='
|
# genvar x,y;
|
# genvar x,y;
|
#
|
#
|
Line 344... |
Line 380... |
my $ny= $mpsoc->object_get_attribute('noc_param',"NY");
|
my $ny= $mpsoc->object_get_attribute('noc_param',"NY");
|
my $processors_en=0;
|
my $processors_en=0;
|
for (my $y=0;$y<$ny;$y++){
|
for (my $y=0;$y<$ny;$y++){
|
for (my $x=0; $x<$nx;$x++){
|
for (my $x=0; $x<$nx;$x++){
|
my $tile_num=($nx*$y)+ $x;
|
my $tile_num=($nx*$y)+ $x;
|
|
|
my ($soc_name,$n,$soc_num)=$mpsoc->mpsoc_get_tile_soc_name($tile_num);
|
my ($soc_name,$n,$soc_num)=$mpsoc->mpsoc_get_tile_soc_name($tile_num);
|
|
|
if(defined $soc_name) {
|
if(defined $soc_name) {
|
my ($soc_v,$en)= gen_soc_v($mpsoc,$soc_name,$tile_num,$x,$y,$soc_num,$io_v_ref,$io_def_v);
|
|
|
|
|
|
|
my ($soc_v,$en)= gen_soc_v($mpsoc,$soc_name,$tile_num,$x,$y,$soc_num,$io_v_ref,$io_def_v,$top_io_ref);
|
add_text_to_string(\$socs_v,$soc_v);
|
add_text_to_string(\$socs_v,$soc_v);
|
$processors_en|=$en;
|
$processors_en|=$en;
|
|
|
}else{
|
}else{
|
#this tile is not connected to any ip. the noc input ports will be connected to ground
|
#this tile is not connected to any ip. the noc input ports will be connected to ground
|
my $soc_v="\n\n // Tile:$tile_num (x=$x,y=$y) is not assigned to any ip\n";
|
my $soc_v="\n\n // Tile:$tile_num (x=$x,y=$y) is not assigned to any ip\n";
|
$soc_v="$soc_v
|
$soc_v="$soc_v
|
|
|
Line 369... |
Line 408... |
}}
|
}}
|
|
|
if($processors_en){
|
if($processors_en){
|
add_text_to_string($io_v_ref,",\n\tprocessors_en");
|
add_text_to_string($io_v_ref,",\n\tprocessors_en");
|
add_text_to_string($io_def_v,"\t input processors_en;");
|
add_text_to_string($io_def_v,"\t input processors_en;");
|
|
add_text_to_string($top_io_ref,",\n\t\t.processors_en(processors_en_anded_jtag)");
|
|
|
}
|
}
|
|
|
|
|
return $socs_v;
|
return $socs_v;
|
Line 384... |
Line 424... |
##############
|
##############
|
|
|
|
|
|
|
sub gen_soc_v{
|
sub gen_soc_v{
|
my ($mpsoc,$soc_name,$tile_num,$x,$y,$soc_num,$io_v_ref,$io_def_v)=@_;
|
my ($mpsoc,$soc_name,$tile_num,$x,$y,$soc_num,$io_v_ref,$io_def_v,$top_io_ref)=@_;
|
my $soc_v;
|
my $soc_v;
|
my $processor_en=0;
|
my $processor_en=0;
|
my $xw= log2($mpsoc->object_get_attribute('noc_param',"NX"));
|
my $xw= log2($mpsoc->object_get_attribute('noc_param',"NX"));
|
my $yw= log2($mpsoc->object_get_attribute('noc_param',"NY"));
|
my $yw= log2($mpsoc->object_get_attribute('noc_param',"NY"));
|
$soc_v="\n\n // Tile:$tile_num (x=$x,y=$y)\n \t$soc_name #(\n";
|
$soc_v="\n\n // Tile:$tile_num (x=$x,y=$y)\n \t$soc_name #(\n";
|
Line 423... |
Line 463... |
|
|
my $i=0;
|
my $i=0;
|
|
|
my $dir = Cwd::getcwd();
|
my $dir = Cwd::getcwd();
|
my $mpsoc_name=$mpsoc->object_get_attribute('mpsoc_name');
|
my $mpsoc_name=$mpsoc->object_get_attribute('mpsoc_name');
|
my $project_dir = abs_path("$dir/../../");
|
my $target_dir = "$ENV{'PRONOC_WORK'}/MPSOC/$mpsoc_name";
|
my $target_dir = "$project_dir/mpsoc_work/MPSOC/$mpsoc_name";
|
|
my $soc_file="$target_dir/src_verilog/tiles/$soc_name.v";
|
my $soc_file="$target_dir/src_verilog/tiles/$soc_name.v";
|
|
|
my $vdb =read_file($soc_file);
|
my $vdb =read_file($soc_file);
|
|
|
my %soc_localparam = $vdb->get_modules_parameters($soc_name);
|
my %soc_localparam = $vdb->get_modules_parameters($soc_name);
|
Line 508... |
Line 547... |
}
|
}
|
|
|
}
|
}
|
#io name
|
#io name
|
add_text_to_string($io_v_ref,",\n\t$io_port");
|
add_text_to_string($io_v_ref,",\n\t$io_port");
|
|
add_text_to_string($top_io_ref,",\n\t\t.$io_port($io_port)");
|
#io definition
|
#io definition
|
my $new_range = add_instantc_name_to_parameters(\%params,"${soc_name}_$soc_num",$range);
|
my $new_range = add_instantc_name_to_parameters(\%params,"${soc_name}_$soc_num",$range);
|
#my $new_range=$range;
|
#my $new_range=$range;
|
my $port_def=(length ($range)>1 )? "\t$type\t [ $new_range ] $io_port;\n": "\t$type\t\t\t$io_port;\n";
|
my $port_def=(length ($range)>1 )? "\t$type\t [ $new_range ] $io_port;\n": "\t$type\t\t\t$io_port;\n";
|
|
|