Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions PerlLibs/Genesis2/Manager.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1326,8 +1326,8 @@ sub create_product_lists {
#print { $product_fh } "+incdir+".$self->{SynthDir}." +incdir+".$self->{VerifDir}."\n";
#print { $synth_product_fh } "+incdir+".$self->{SynthDir}."\n";

# Get a list of all instances in REVERSED DFS order
my @rev_dfs_list = $self->{TopObj}->get_all_insts();
# Get the product list instances, obtained by a DFS traversal.
my @rev_dfs_list = $self->{TopObj}->get_prod_list_insts($self->{SynthTop});

# Process the list into synth and verif single appearance file list
my %seen = ();
Expand Down
81 changes: 81 additions & 0 deletions PerlLibs/Genesis2/UniqueModule.pm
Original file line number Diff line number Diff line change
Expand Up @@ -973,6 +973,87 @@ sub _get_all_insts {
push(@$results, $self);
}

## get_prod_list_insts
## Get list of instances for use by Manager::create_product_list.
## This returns the first synth instance and first verif instance for each
## module file name. The list is built via a DFS traversal.
##
## Requires the SynthTop path to identify whether an instance is verif or synth.
sub get_prod_list_insts {
my $self = shift;
my $synth_top = shift;

# Product list
my @results;

# Track the file names of the synth and verif instances that are added to
# the list
my %synth_files;
my %verif_files;

$self->_get_prod_list_insts(\@results, \%synth_files, \%verif_files, 1000, "", $synth_top);
return @results;
}

## _get_prod_list_insts
## Internal function used to constrtuct the product list returned by
## get_prod_list_insts.
##
## Passes refernces to the array / hashes to avoid unnecessary copying.
sub _get_prod_list_insts {
my $self = shift;
my $results = shift;
my $synth_files = shift;
my $verif_files = shift;
my $depth = shift;
my $path = shift;
my $synth_top = shift;

if (defined $synth_top) {
$path .= "." if defined $self->{Parent};
$path .= $self->get_instance_name();
}

my $path_len = length($path);
my $synth_top_len = defined($synth_top) ? length($synth_top) : 0;

# An instance is a synthesis instance if it is at or below synth_top.
my $is_synth = defined($synth_top)
&& ($path eq $synth_top || (substr($path, 0, $synth_top_len + 1) eq $synth_top . "."));

# An instance is on the synthesis path if it is a synthesis instance or if
# synth_top is below it.
my $on_synth_path =
defined($synth_top) && ($is_synth || ($path . "." eq substr($synth_top, 0, $path_len + 1)));

my $file = $self->get_out_file_name();

# Check if we've already added an instance with this file name to the synth/verif list as appropariate.
if ( ($is_synth && exists $synth_files->{$file})
|| (!$is_synth && exists $verif_files->{$file} && !$on_synth_path))
{
return;
}

# First time seeing this file for synth/verif
if ($is_synth) {
$synth_files->{$file} = 1;
} else {
$verif_files->{$file} = 1;
}

# Recurse into the child nodes
if ($depth > 0) {
foreach my $inst_name (@{$self->{SubInstanceList}}) {
my $subinst = $self->get_subinst($inst_name);
$subinst->_get_prod_list_insts($results, $synth_files, $verif_files, $depth - 1, $path,
$synth_top);
}
}

push(@$results, $self);
}

## get_instance_path
## API method that returns a complete path to the instance object given
## Usage: my $inst_path = $inst_obj->get_instance_path();
Expand Down
Loading