Silicon-Chip

 view release on metacpan or  search on metacpan

lib/Silicon/Chip.pm  view on Meta::CPAN

     );

    $positions[$i] = $p;  $positions{$p->output} = $p;                          # Index the gates
    $width += $w unless $s;                                                     # Io gates are tucked in in such way that they do not contribute to the width
    $height++    unless $g->io == gateOuterOutput;                              # Output gates do not contribute to the height of the mask
   }

  for my $i(keys @positions)                                                    # Position output pins along bottom of mask
   {my $p = $positions[$i];
    next unless $p->outPin;
    my ($D) = $p->inputs->@*;                                                   # An output gate only has one input so we can safe relocate it next to the single gate that produces that output
    my  $d  = $positions{$D};                                                   # Driving gate
    $p->x = $d->x - 1;                                                          # Reposition output gate
    $p->y = $d->y;
   }

  for my $p(@positions)                                                         # Connect gates loosely
   {my $g = $gates{$p->output};                                                 # Detail for this gate
    my @i = $p->inputs->@*;                                                     # Connections to each gate
    for my $i(keys @i)                                                          # Connections to each gate
     {my $D = $i[$i];                                                           # Driving gate name



( run in 1.380 second using v1.01-cache-2.11-cpan-71847e10f99 )