Line 20... |
Line 20... |
my $category =$soc->soc_get_category($id);
|
my $category =$soc->soc_get_category($id);
|
my $inst =$soc->soc_get_instance_name($id);
|
my $inst =$soc->soc_get_instance_name($id);
|
my @plugs= $soc->soc_get_all_plugs_of_an_instance($id);
|
my @plugs= $soc->soc_get_all_plugs_of_an_instance($id);
|
my %params= $soc->soc_get_module_param($id);
|
my %params= $soc->soc_get_module_param($id);
|
#add two extra variable the instance name and base addresses
|
#add two extra variable the instance name and base addresses
|
|
my $core_id= $soc->object_add_attribute('global_param','CORE_ID');
|
|
$params{CORE_ID}=(defined $core_id)? $core_id: 0;
|
$params{IP}=$inst;
|
$params{IP}=$inst;
|
$params{CORE}=$id;
|
$params{CORE}=$id;
|
foreach my $plug (@plugs){
|
foreach my $plug (@plugs){
|
my @nums=$soc->soc_list_plug_nums($id,$plug);
|
my @nums=$soc->soc_list_plug_nums($id,$plug);
|
foreach my $num (@nums){
|
foreach my $num (@nums){
|
Line 61... |
Line 63... |
|
|
|
|
|
|
sub generate_header_file{
|
sub generate_header_file{
|
my ($soc,$project_dir,$target_dir,$dir)= @_;
|
my ($soc,$project_dir,$target_dir,$dir)= @_;
|
my $soc_name=$soc->soc_get_soc_name();
|
my $soc_name=$soc->object_get_attribute('soc_name');
|
$soc_name = uc($soc_name);
|
$soc_name = uc($soc_name);
|
if(!defined $soc_name){$soc_name='soc'};
|
if(!defined $soc_name){$soc_name='soc'};
|
|
|
my @instances=$soc->soc_get_all_instances();
|
my @instances=$soc->soc_get_all_instances();
|
my $system_h="#ifndef $soc_name\_SYSTEM_H\n\t#define $soc_name\_SYSTEM_H\n";
|
my $system_h="#ifndef $soc_name\_SYSTEM_H\n\t#define $soc_name\_SYSTEM_H\n";
|
Line 80... |
Line 82... |
my $module_name =$soc->soc_get_module_name($id);
|
my $module_name =$soc->soc_get_module_name($id);
|
my $category =$soc->soc_get_category($id);
|
my $category =$soc->soc_get_category($id);
|
my $inst =$soc->soc_get_instance_name($id);
|
my $inst =$soc->soc_get_instance_name($id);
|
|
|
add_text_to_string(\$system_h,"\n \n /* $inst */ \n");
|
add_text_to_string(\$system_h,"\n \n /* $inst */ \n");
|
$inst=uc($inst);
|
#$inst=uc($inst);
|
# print base address
|
# print base address
|
my @plugs= $soc->soc_get_all_plugs_of_an_instance($id);
|
my @plugs= $soc->soc_get_all_plugs_of_an_instance($id);
|
|
|
|
|
my %params= %{get_instance_global_variable($soc,$id)};
|
my %params= %{get_instance_global_variable($soc,$id)};
|
Line 126... |
Line 128... |
$content=replace_golb_var($content,\%params);
|
$content=replace_golb_var($content,\%params);
|
|
|
|
|
if(defined $rename){
|
if(defined $rename){
|
|
|
open(FILE, ">lib/verilog/$rename") || die "Can not open: $!";
|
open(FILE, ">lib/verilog/tmp") || die "Can not open: $!";
|
print FILE $content;
|
print FILE $content;
|
close(FILE) || die "Error closing file: $!";
|
close(FILE) || die "Error closing file: $!";
|
move ("$dir/lib/verilog/$rename","$target_dir/sw/");
|
move ("$dir/lib/verilog/tmp","$target_dir/sw/$rename");
|
|
|
|
|
}
|
}
|
}
|
}
|
}
|
}
|
|
|
|
|
}
|
}
|
|
|
add_text_to_string(\$system_h,"#endif\n");
|
add_text_to_string(\$system_h,"#endif\n");
|
my $name=$soc->soc_get_soc_name();
|
my $name=$soc->object_get_attribute('soc_name');
|
open(FILE, ">lib/verilog/$name.h") || die "Can not open: $!";
|
open(FILE, ">lib/verilog/$name.h") || die "Can not open: $!";
|
print FILE $system_h;
|
print FILE $system_h;
|
close(FILE) || die "Error closing file: $!";
|
close(FILE) || die "Error closing file: $!";
|
move ("$dir/lib/verilog/$name.h","$target_dir/sw/");
|
move ("$dir/lib/verilog/$name.h","$target_dir/sw/");
|
|
|