#
# Create a bus of wires. Bus seperation may be
# segmented by a comma seperated spacing specification.
# Add the bus proc to the menu list var
lappend tlgProcList bus
proc bus {
inCell cellId {ptList 2:0}
{ Layer metal1:string }
{ Width 1:double }
{ Pitch 1:string }
{ Number 1:integer }
{ Side left:string }
} {
global tcl_precision
if { [info exists tcl_precision] != 0 } { set save $tcl_precision } \
else { set save 2 }
set tcl_precision 17
if { $Side == "right" } { set sign -1 } \
else { set sign 1 }
set pitchList [split $Pitch ,]
set numPitches [llength $pitchList]
for { set pt 1 } { $pt < [llength $ptList] } { incr pt } {
set last_pt [expr $pt - 1]
if { $pt > $numPitches } { set pitch [lindex $pitchList end ] } \
else { set pitch [lindex $pitchList $last_pt ] }
set x1 [lindex [lindex $ptList $last_pt ] 0]
set y1 [lindex [lindex $ptList $last_pt ] 1]
set x2 [lindex [lindex $ptList $pt ] 0]
set y2 [lindex [lindex $ptList $pt ] 1]
if { [expr abs($x2 - $x1)] > [expr abs($y2 - $y1)] } {
if { $x2 > $x1 } { set direction right } \
else { set direction left }
for { set i 0 } { $i < $Number } { incr i } {
set delta [expr $i * $pitch * $sign]
if { $direction == "left" } { set y [expr $y1 + $delta] } \
elseif { $direction == "right" } { set y [expr $y1 - $delta] }
if { $last_pt == 0 } {
set previous_dir $direction
lappend points($i) [list $x1 $y]
}
lappend points($i) [list $x2 $y]
if { $direction != $previous_dir } {
set prev_x [lindex [lindex $points($i) $last_pt] 0]
set points($i) [lreplace $points($i) $last_pt $last_pt [list $prev_x $y]]
}
}
} else {
if { $y2 > $y1 } { set direction up } \
else { set direction down }
for { set i 0 } { $i < $Number } { incr i } {
set delta [expr $i * $pitch * $sign]
if { $direction == "up" } { set x [expr $x1 + $delta] } \
elseif { $direction == "down" } { set x [expr $x1 - $delta] }
if { $last_pt == 0 } {
set previous_dir $direction
lappend points($i) [list $x $y1 ]
}
lappend points($i) [list $x $y2]
if { $direction != $previous_dir } {
set prev_y [lindex [lindex $points($i) $last_pt] 1]
set points($i) [lreplace $points($i) $last_pt $last_pt [list $x $prev_y]]
}
}
}
set previous_dir $direction
}
for { set i 0 } { $i < $Number } { incr i } {
edbCreatePath $cellId $Layer 0 flush $Width 0 $points($i)
}
set tcl_precision $save
}
|