Commit 0a8ba479 authored by Stefan Tauner's avatar Stefan Tauner
Browse files

netlist: check the index of pins of cells in _get_net_connections()

Bonus: some cleanups and comments
parent deeadc79
...@@ -1037,6 +1037,7 @@ sub _get_net_connections { ...@@ -1037,6 +1037,7 @@ sub _get_net_connections {
# find nets driven by this module's input ports or driving its outputs # find nets driven by this module's input ports or driving its outputs
foreach my $port ($mod->ports) { foreach my $port ($mod->ports) {
# NB: we do not check any index because there can't be multiple ports with the same name
if (defined $port->net && ($port->net->name eq $net_name)) { if (defined $port->net && ($port->net->name eq $net_name)) {
$logger->debug(" port: \"" . $mod->name . HIERSEP . $port->name . "\""); $logger->debug(" port: \"" . $mod->name . HIERSEP . $port->name . "\"");
...@@ -1070,7 +1071,7 @@ sub _get_net_connections { ...@@ -1070,7 +1071,7 @@ sub _get_net_connections {
foreach my $cell ($mod->cells) { foreach my $cell ($mod->cells) {
foreach my $pin ($cell->pins) { foreach my $pin ($cell->pins) {
foreach my $netname (@{$pin->netnames}) { foreach my $netname (@{$pin->netnames}) {
if ($netname->{'netname'} eq $net_name) { if ($netname->{'netname'} eq $net_name && (_offset_of_bit_in_range($bit, $netname->{'msb'}, $netname->{'lsb'}) != -1)) {
my $dir = (!defined($pin->port)) ? "unknown" : ($pin->port->direction eq 'in') ? "in" : "out"; my $dir = (!defined($pin->port)) ? "unknown" : ($pin->port->direction eq 'in') ? "in" : "out";
$logger->debug(" pin (" . $dir . ") \"" . $pin->cell->name . HIERSEP . $pin->name . "\""); $logger->debug(" pin (" . $dir . ") \"" . $pin->cell->name . HIERSEP . $pin->name . "\"");
# The pin might be the driver but we can't be sure without a preselection. # The pin might be the driver but we can't be sure without a preselection.
...@@ -1133,14 +1134,11 @@ sub export { ...@@ -1133,14 +1134,11 @@ sub export {
return undef; return undef;
} }
## @method private _offset_of_bit_in_netdescr($bit, $net_descr)
# sub _offset_of_bit_in_netdescr {
# my ($self, $bit, $net_descr) = @_;
# return _offset_of_bit_in_range($bit, $net_descr->{'msb'}, $net_descr->{'lsb'});
# }
## @method private _offset_of_bit_in_netrange($bit, $net) ## @method private _offset_of_bit_in_netrange($bit, $net)
# @brief Tests if a bit is contained in the range of a net # @brief Tests if a bit is contained in the range of a net
#
# @returns 0 if any parameter is undefined
# @returns -1 if the bit is not contained, or its offset within the range
sub _offset_of_bit_in_netrange { sub _offset_of_bit_in_netrange {
my ($bit, $net) = @_; my ($bit, $net) = @_;
...@@ -1150,7 +1148,7 @@ sub _offset_of_bit_in_netrange { ...@@ -1150,7 +1148,7 @@ sub _offset_of_bit_in_netrange {
## @method private _offset_of_bit_in_range($bit, $range_msb, $range_lsb) ## @method private _offset_of_bit_in_range($bit, $range_msb, $range_lsb)
# @brief Tests if bit is contained in the given range # @brief Tests if bit is contained in the given range
# #
# @returnes 0 if any parameter is undefined # @returns 0 if any parameter is undefined
# @returns -1 if the bit is not contained, or its offset within the range # @returns -1 if the bit is not contained, or its offset within the range
sub _offset_of_bit_in_range { sub _offset_of_bit_in_range {
my ($bit, $range_msb, $range_lsb) = @_; my ($bit, $range_msb, $range_lsb) = @_;
......
Supports Markdown
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