Author: Ken Schumack (c) 2001-2004. All rights reserved. This module is free software. It may be used, redistributed and/or modified under the terms of the Perl Artistic License. (see http://www.perl.com/pub/a/language/misc/Artistic.html) I do ask that you please let me know if you find bugs or have idea for improvements. You can reach me at Schumack@cpan.org Have fun, Ken

NAME

CircuitLayout - circuit layout module

DESCRIPTION

This is CircuitLayout, a module for working with circuit layout items like boundaries, texts, rectangles, and srefs.

Send feedback/suggestions to Schumack@cpan.org

CircuitLayout::pitches

returns string of pitches given a ref to an array of CircuitLayout::Boundary items

CircuitLayout::Text::new

Usage:

## Coord object for CircuitLayout::Text origin coordinate... my $text = new CircuitLayout::Text(-origin=>$coord, -string=>$string); -or-

my @point = (0,0); ## anonymous array or array ref my $edge = new CircuitLayout::Edge(-origin=>\@point, -string=>"VDD");

CircuitLayout::Text::display

draws on a worldCanvas

CircuitLayout::Text::directionExtent

CircuitLayout::Text::printPrecision

returns precision (integer)

CircuitLayout::Text::string

CircuitLayout::Text::layer

CircuitLayout::Text::origin

returns origin as Coord object use -value to change and pass in Coord or x,y array

CircuitLayout::Coord::new

CircuitLayout::Coord::printPrecision

returns precision (integer)

CircuitLayout::Coord::coordSubtract

CircuitLayout::Coord::onGrid

CircuitLayout::Coord::resolution

CircuitLayout::Coord::x

CircuitLayout::Coord::y

CircuitLayout::Coord::scale

CircuitLayout::Coord::snapNum

CircuitLayout::Coord::printableCoords

returns string in "x1,y1" where x and y print precision is controlled by objects printPrecision

Note: returns just one coordinate but method name is plural none the less to be consistant with other methods.

CircuitLayout::Coord::equals

CircuitLayout::Edge::new

Usage:

## CircuitLayout::Coord object for Lower Left Coordinate... my $edge = new CircuitLayout::Edge(-startCoord=>$coord1, -endCoord=>$coord2); -or-

my @startPoint = (0,0); ## anonymous array or array ref my $edge = new CircuitLayout::Edge(-startCoord=>\@startPoint, -endCoord=>[2.3,4.5]);

CircuitLayout::Edge::coords

CircuitLayout::Edge::printPrecision

returns precision (integer)

CircuitLayout::Edge::isLeft

Usage:

my $isLeft = $edge -> isLeft(-coord=>$coord);

Synopsis:

CircuitLayout::Edge::direction

Usage:

my $edgeDirection = $edge -> direction;

Synopsis:

Returns one of 8 compass directions: 'N','NE','E','SE','S','SW','W','NW'

my $edge = new CircuitLayout::Edge(-startCoord=>[0,0],-endCoord=>[5,5]);

print $edge -> direction; ## prints 'NE';

CircuitLayout::Edge::is45multiple

Usage:

my $test = $edge -> is45multiple;

Synopsis:

Returns true or false ( 1 or 0 ) depending on whether edge is a 45 degree multiple

my $edge = new CircuitLayout::Edge(-startCoord=>[0,0],-endCoord=>[5,5]);

print $edge -> is45multiple; ## prints 1;

CircuitLayout::Edge::xIntersection

Returns x value where CircuitLayout::Edge actually crosses x axis or would cross if it was extended.

CircuitLayout::Edge::straddleTouchXray

Returns 0 or 1 depending on whether CircuitLayout::Edge straddles or touches horizontal X ray. Default X ray is X axis (y value==0)

$edge -> straddleTouchXray; -or- $edge -> straddleTouchXray(-yValue=>4.3);

CircuitLayout::Edge::printableCoords

Returns CircuitLayout::Edge as 'x1,y1;x2,y2' string.

print $edge -> printableCoords;

CircuitLayout::Edge::startCoord

Returns 1st edge coordinate as a Coord.

CircuitLayout::Edge::endCoord

Returns last edge coordinate as a Coord.

CircuitLayout::Coord::directionExtent CircuitLayout::Edge::directionExtent CircuitLayout::Boundary::directionExtent

Usage:

my $edgeExtent = $edge -> directionExtent;

Synopsis:

Returns position (real number) of edge in one of 4 magor compass directions: 'N','E','S','W'

my $edge = new CircuitLayout::Edge(-startCoord=>[0,0],-endCoord=>[0,5]);

print $edge -> directionExtent(-direction=>'N'); ## prints 5;

CircuitLayout::Edge::length CircuitLayout::Boundary::length

Usage:

my $edgeLength = $edge -> length;

Synopsis:

Returns length of edge

my $edge = new CircuitLayout::Edge(-startCoord=>[0,1],-endCoord=>[0,5]);

print $edge -> length(); ## prints 4;

CircuitLayout::Edge::lengthAtExtent CircuitLayout::Boundary::lengthAtExtent

Usage:

my $edgeExtentLength = $edge -> lengthAtExtent;

Synopsis:

Returns position (real number) of edge length at maximum point in one of 4 magor compass directions: 'N','E','S','W'

my $edge = new CircuitLayout::Edge(-startCoord=>[0,1],-endCoord=>[0,5]);

print $edge -> lengthAtExtent(-direction=>'N'); ## prints 4;

CircuitLayout::Edge::inside

Usage:

print 'inside == true' if ($edge -> inside(-coord => $coord);

Synopsis:

Returns 0 | 1 depending on whether coord is inside of edge

CircuitLayout::Path::new

Usage:

## CircuitLayout::Coord object for Lower Left Coordinate... my $path = new CircuitLayout::Path(

CircuitLayout::Path::display

draws on a worldCanvas

CircuitLayout::Rectangle::new

Usage:

## CircuitLayout::Coord object for Lower Left Coordinate... my $rect = new CircuitLayout::Rectangle(-llCoord=>$coord1, -urCoord=>$coord2); -or-

my @llPoint = (0,0); ## anonymous array or array ref my $rect = new CircuitLayout::Rectangle(-llCoord=>\@llPoint, -urCoord=>[2.3,4.5]);

CircuitLayout::Rectangle::center

CircuitLayout::Rectangle::edges

CircuitLayout::Rectangle::printPrecision

returns precision (integer)

CircuitLayout::Rectangle::printableCoords

returns string in "x1,y1;x2,y2" where x and y print precision is controlled by objects printPrecision

Note: x1,y1 is lower left

CircuitLayout::Rectangle::add

CircuitLayout::Rectangle::extent

CircuitLayout::Rectangle::inside

usage: my $rect = new CircuitLayout::Rectangle(...);

print "is (4,6) inside ? ... ",$rect -> inside(-coord=>[4,6]);

CircuitLayout::Rectangle::interiorTo

usage: my $rect = new CircuitLayout::Rectangle(...);

print "is (4,6) interiorTo ? ... ",$rect -> interiorTo(-coord=>[4,6]);

CircuitLayout::new - create new CircuitLayout::Boundary

usage:
my $boundary  = new CircuitLayout::Boundary(-xy=>\@xyArray)  -or-
my $boundary  = new CircuitLayout::Boundary(-coords=>\$coords) 

CircuitLayout::Boundary::display

draws on a worldCanvas

CircuitLayout::Boundary::printPrecision

returns precision (integer)

CircuitLayout::Boundary::isRectangle

CircuitLayout::Boundary::extent

CircuitLayout::Boundary::layer

CircuitLayout::Boundary::dataType

CircuitLayout::Boundary::property

CircuitLayout::Boundary::node

CircuitLayout::Boundary::net

CircuitLayout::Boundary::group

CircuitLayout::Boundary::nextCoord

CircuitLayout::Boundary::printableCoords

returns string in "x1,y1;x2,y2;x...." where x and y print precision is controlled by objects printPrecision

CircuitLayout::Boundary::nextEdge

CircuitLayout::Boundary::append

CircuitLayout::Boundary::numCoords

CircuitLayout::Boundary::xys

CircuitLayout::Boundary::coords

CircuitLayout::Boundary::edges

CircuitLayout::Boundary::boundaryOutline

returns self (already a Boundary)

CircuitLayout::Boundary::inside

usage: my @xys=(0,0, 10,0, 10,10, 0,10);

my $boundary = new CircuitLayout::Boundary(-xy=>\@xys);

print "is (4,6) inside ? ... ",$boundary -> inside(-coord=>[4,6]);

CircuitLayout::Boundary::inside

usage: my @xys=(0,0, 10,0, 10,10, 0,10);

my $boundary = new CircuitLayout::Boundary(-xy=>\@xys);

print "is (4,6) inside ? ... ",$boundary -> inside(-coord=>[4,6]);

CircuitLayout::Boundary::interiorTo

usage: my @xys=(0,0, 10,0, 10,10, 0,10);

my $boundary = new CircuitLayout::Boundary(-xy=>\@xys);

print "is (4,6) interiorTo ? ... ",$boundary -> interiorTo(-coord=>[4,6]);

CircuitLayout::Rectangle::ll

CircuitLayout::Rectangle::ur

CircuitLayout::Rectangle::layer

CircuitLayout::Rectangle::boundaryOutline

returns Boundary representation of 2 point rectangle

CircuitLayout::Rectangle::equals

CircuitLayout::new - create new CircuitLayout::Sref

usage:
my $sref  = new CircuitLayout::Sref(-xy=>\@xyArray)  -or-
my $sref  = new CircuitLayout::Sref(-coords=>\$coords) 

CircuitLayout::Sref::name

returns name as "string" use -value to change and pass in string

CircuitLayout::Sref::origin

returns origin as Coord object use -value to change and pass in Coord or x,y array

CircuitLayout::printPrecision

returns precision (integer)

CircuitLayout::Sref::printableCoords

returns string in "x1,y1" where x and y print precision is controlled by objects printPrecision

Note: returns origin (which is just one coordinate) but method name is plural none the less to be consistant with other methods.

CircuitLayout::version

CircuitLayout::revision

Examples

example using GDS2 to read in binary GDS2 stream file.

#!/usr/local/bin/perl -w
use strict;
$|++;
use lib '.';
use CircuitLayout;
use GDS2;
$\="\n";

my $streamFileName = $ARGV[0];
my $gds2File = new GDS2(-fileName => $streamFileName);
my $inBoundary=0;
my $layerNum;
my @layerIndexCnt;
my %boundaries;
while (my $record = $gds2File -> readGds2Record)
{
  $inBoundary=1 if($gds2File -> isBoundary);
  $inBoundary=0 if($gds2File -> isEndel);
  if ($inBoundary)
  {
    $layerNum = $gds2File -> returnLayer if($gds2File -> isLayer);
    if($gds2File -> isXy)
    {
      if (! defined $layerIndexCnt[$layerNum]) { $layerIndexCnt[$layerNum] = 0; }
      my $layerIndex = $layerIndexCnt[$layerNum];
      ## Use "my @xys" here to get unique memory location
      my @xys = $gds2File ->  returnXyAsArray(-withClosure=>0,-asInteger=>0);
      my $boundary = new CircuitLayout::Boundary(-xy=>\@xys,-layer=>$layerNum);
      $boundaries{$layerNum}{$layerIndex} = \$boundary;
      $layerIndexCnt[$layerNum]++;
    }
  }
}
my $boundary;
foreach my $layer (sort {$a <=> $b} keys %boundaries)
{
  foreach my $x (keys %{$boundaries{$layer}})
  {
    $boundary = ${$boundaries{$layer}{$x}};
    print $boundary -> layer,':',$boundary -> printableCoords;
  }
}
################################################################################

1 POD Error

The following errors were encountered while parsing the POD:

Around line 21:

=pod directives shouldn't be over one line long! Ignoring all 2 lines of content