Tuesday, August 22, 2017

get pins, nets, ports - max fanout


proc make_hfn_timing_ideal {HFN_FANOUT_THRESHOLD} {
set all_nets [get_net -hier -top_net_of_hierarchical_group]
set total_high_fanout_nets 0
echo -n “Searching [sizeof_collection $all_nets] nets “

echo “looking for fanouts > $HFN_FANOUT_THRESHOLD”
foreach_in_collection the_net $all_nets {
set fanout [sizeof_collection \
[filter [get_pins -quiet -leaf -of_objects $the_net] “pin_direction!=out”]]
if {$fanout > $HFN_FANOUT_THRESHOLD} {
if {[regexp {\*Logic[01]\*} [get_attribute $the_net base_name]]} {
# this is a tie-off net, so no need to change it
continue
}

# find all the pins on the net
set all_pins [get_pins -leaf -of_objects $the_net]

# find all the pins driving the net
set driver_pins [filter [get_pins -quiet -leaf -of_objects $the_net] “pin_direction==out”]

# find all the ports driving the net
set driver_ports [filter \
[get_ports -quiet -of_objects $the_net] \
“port_direction==in”]

# report the drivers
foreach_in_collection the_pin $driver_pins {
echo -n “Setting Ideal Net on [get_object_name $the_net] with fanout $fanout”
echo “ driven by pin [get_attribute $the_pin full_name]”
set_ideal_network -no_propagate $driver_pins
}

foreach_in_collection the_port $driver_ports {
echo -n “Setting Ideal Net on [get_object_name $the_net] with fanout $fanout”
echo “ driven by port [get_attribute $the_port full_name]”
set_ideal_network -no_propagate $the_port
}

incr total_high_fanout_nets
}
}
  echo “Fixed $total_high_fanout_nets nets with fanouts > $HFN_FANOUT_THRESHOLD”
}

and now you can invoke this in your analysis scripts
# fix high-fanout nets
if {$FIX_HFN} {
make_hfn_timing_ideal $HFN_FANOUT_THRESHOLD
}
The HFN_FANOUT_THRESHOLD parameter defines the cutoff. This should agree with the
value used in the synthesis scripts to control which nets are idealized during synthesis.

Wednesday, July 21, 2010

sorting an array..

@ascending = sort {$a cmp $b} @a;

@descending = sort {$b cmp $a} @a;
(OR)
@descending = reverse @ascending;

appending & reversing arrrays

##Appending arrays
@c = (@a, @b);

##Reversing an array
@arr = reverse (@arr);

splice function

It is used to inseret the elements of one array into the middle of another array.

Computing Union, intersection, or Diffrences of unique lists...

@a = (1, 3, 6, 7, 8);
@b = (2, 3, 5, 7, 9);

@union = @isect = ( );
%union = %isect = ( );

foreach $e (@a) {
$union{$e} = 1;
}

foreach $e2 (@b) {
if ($union{$e2} ) {
$isect {$e2} = 1;
}
$union{$e2} = 1;
}

@union = keys %union;
@isect = keys %isect;

Finding elements in one array but not other...

@A = qw(a, b, c, d, e);
@B = qw(a, b, e);

@Aonly= ();
%seen = ();

foreach $ele (@B) {
%seen{$ele} = 1;
}

foreach $ele (@A) {
unless ($seen{$ele)) {
###push that element if not seen already.
push (@Aonly, $ele);
}
}

######2nd method##

@seen{@B} = ();

foreach $ele (@A) {
### push that element if it doesn't exist in @B or not seen in @B
push (@Aonly, $lele) unless exists $seen{$ele} ;
}

Extracting unique elements from a list...

@list = qw(a, b, c, d, a, e, b);

%seen = ( );
@uniq = ( );

foreach $item (@list) {
unless ( $seen{$item} ) {
#### we have not seen this item before
$seen{$item} = 1;
push(@uniq, $item);
}
}

##########faster method ####

foreach $item (@list) {
push (@uniq , $item) unless $seen{$item}++;
}

######simple method####
@uniq = sort -u @list;