#!/bin/csh -f # set MB = "MOSAICO:" # Mosaico Banner. Printed at any echo in this file #set VERSION = "2.07 01 December 1989" # New PGcurrent. #set VERSION = "2.08, 13 September 1990" # added -nomizer option (PBC) #set VERSION = "2.09, 26 November 1990" # New mosaicoRC #set VERSION = "2.10, 07 December 1990" # Fixed bug with runMizer option. #set VERSION = "2.11, March 91" # cds -> mosaicoGR #set VERSION = "2.12 March 91" # Eliminated -exp #set VERSION = "2.13 April 91" # Moved mosaicoRC at the end. #set VERSION = "2.14 April 91" # Eliminated octgc. #set VERSION = "2.15 August 91" # Fixed message about cprep set VERSION = "2.16 September 91" # Eliminated chipstats echo $MB "************************************************" echo $MB "* MOSAICO : version $VERSION *" echo $MB "************************************************" set arguments = ( $argv ) if ( $#argv ) echo $MB "ARGS:" $arguments umask 000 if ($?OCTTOOLS) then set octtools = $OCTTOOLS else set octtools = $OCTTOOLS endif set CADBIN = "" set useZshaped = 1 set compactEachChannel = 0 # 1 if each channel is to be compacted set minEachChan = 0 # Via minimize each channel set runMizer = 1 # Run mizer on full chip set routeonlyflag = 0 # Do only detailed routing set noatlasflag = 0 # Skip channel definition set useSparcsRules = 0 # set skipSparcs = 0 # Do final compaction set usemercury = 0 # 1 if you want to use mercury set noLindo = 0 # Do we have LINDO available for mercury to use. set routerName = YACR # Default router set RTSTUFF = RTstuff # Directory to collect all routing data set SEQUENCEFILE = mosaicoDemoRpc.seq set outputViewName = unnamed set outputNameSpec = 0 set cleanflag = 0 set fullusage = 0 # Give complete usage message set cleanonlyflag = 0 set minNumArg = 1 set showTime = 0 # 1 if you want to display time between each tool call set toolCount = 1 # count the tools called set autoprint = 0 # set PRINTER = "lps" # Default PostScript printer set OCT2PSFLAGS = "-B -f bb -s 0.8" set LOCK = ".mosaicolock" # set spiderInteractive = 0 # 1 if user wants to interact with detailed router spider. # Options to use VEM and mosaicoMonitor to see what is going on. set VEM = vem set RPC_MONITOR = ${CADBIN}rpc/mosaicoMonitor set monitorOn = 0 # Flag to run mosaicoMonitor while ($#argv) switch ($1) case -help: set fullusage = 1 goto argUsage breaksw case -r: set routeonlyflag = 1 set noatlasflag = 1 breaksw case -Z: set useZshaped = 0 breaksw case -m: set usemercury = 1 breaksw case -lindo: set noLindo = 1 breaksw case -a: set noatlasflag = 1 breaksw case -s: set skipSparcs = 1 breaksw case -S: set useSparcsRules = 1 breaksw case -I: set spiderInteractive = 1 breaksw case -R: set routerName = $2 shift breaksw case -o: set outputViewName = $2 set outputNameSpec = 1 shift breaksw case -c: set cleanflag = 1 breaksw case -M: set monitorOn = 1 breaksw case -T: set showTime = 1 breaksw case -C: set cleanonlyflag = 1 set cleanflag = 1 set minNumArg = 1 breaksw case -compact: set compactEachChannel = 1 breaksw case -minimize: set minEachChan = 1 breaksw case -nomizer: set runMizer = 0 breaksw case -print: set autoprint = 1 breaksw default: set option = `echo $1 | sed 's/^-/this is an option/'` if ( $#option > 1 ) then echo $MB "unknown option" $1 else break endif endsw shift end if ($#argv < $minNumArg) then argUsage: echo $MB " mosaico [options] chip:view" if ($fullusage) then echo $MB " -a Skip channel definition, start from global routing" echo $MB " -r Detailed routing only, skip global routing" echo $MB " -s Skip final compaction (only if you know what you are doing)" echo $MB " -m Use mercury for global routing" echo $MB " -lindo" echo $MB " Do not use LINDO with mercury" echo $MB " -R " echo $MB " Specify an alternate detailed router" echo $MB " The default is YACR and MIGHTY is the only alternative" echo $MB " -o " echo $MB " Name the output view (cell is ignored)" echo $MB " -o " echo $MB " Alternate way to name the output view" echo $MB " -c Clean up all temporary files upon successful execution" echo $MB " -C Just clean temporary files created by mosaico" echo $MB " -T Show time spent by mosaico" echo $MB " -I Interactive channel routing" echo $MB " -M Start the RPC monitor" echo $MB " -Z Do NOT use Z-shaped channels" echo $MB " -S Use sparcs.mosaico.rules (i.e. worry about layer PLACE)" echo $MB " -compact" echo $MB " Compact each channel. Default is to compact only" echo $MB " at the end of all routing and via minimization" echo $MB " -minimize" echo $MB " Call via minimizer on each channel before compacting it" echo $MB " -nomizer" echo $MB " Skip the via minimization on the whole chip. Useful" echo $MB " for very large chips." echo $MB " -print" echo $MB " Automatically print statistics and final plot" echo $MB " on a PostScript printer ($PRINTER)" else echo $MB " -help Print full usage message" endif exit 8 endif set chip = `echo $1 | sed 's/\:/ /'` if ($#chip != 2) then goto argUsage endif set chipName = $chip[1] set baseViewName = $chip[2] if (-e $LOCK) then echo $MB echo $MB "Mosaico already running in this directory" echo -n $MB ; cat $LOCK echo $MB echo $MB "Remove file $LOCK to override protection" echo $MB exit 0 else onintr interrupted echo -n " Mosaico started by" $user "on " > $LOCK date >> $LOCK endif set placedViewName = ${baseViewName} set cdViewName = ${baseViewName}.cd set cdGRViewName = ${baseViewName}.cd_after_gr set hierViewName = ${baseViewName}.hier # Hierarchy of channels set flatViewName = ${baseViewName}.flat set viaminViewName = ${baseViewName}.mizer set spacedViewName = ${baseViewName}.spaced set mercuryViewName = ${baseViewName} # Temporary (to be fixed ) # Find out the output view name # Cell is ignored for the time being if ($outputNameSpec == 0) then set outputViewName = ${spacedViewName} else set outputCellView = `echo $outputViewName | sed 's/\:/ /'` if ($#outputCellView == 2) then set outputViewName = $outputCellView[2] endif endif set reservedViews = "$placedViewName $cdViewName $cdGRViewName \ $hierViewName $flatViewName $viaminViewName " foreach x ($reservedViews $baseViewName) if ($outputViewName == $x) then echo $MB "Illegal output view name" echo $MB "These views ($reservedViews) are reserved for routing" echo $MB "Try a different name" goto errorexit endif end set statFileName = $chipName.$outputViewName.stats set rcFileName = ${chipName}_mosaicoRC.out # Determine the technology # At the same time add the MOSAICO_DEMO_CWD property to the facet set technology = `octprop -v TECHNOLOGY -p MOSAICO_DEMO_CWD="$cwd" ${chipName}:${baseViewName}` set technology = `eval echo $technology` set techDir = $octtools/tech/${technology} if (${technology} == "") then echo $MB "No TECHNOLOGY property in" ${chipName}:${baseViewName} echo $MB "Are you sure the facet exists ?" goto errorexit endif echo $MB "Running on ${chipName}:$baseViewName (in `pwd`)" if (! $cleanonlyflag) then echo $MB "Output will be" ${chipName}:${outputViewName} echo $MB "Technology is:" $technology echo $MB "Technology directory is:" $techDir endif # Now this is done with just one invocation to octprop. See above. # octprop -p MOSAICO_DEMO_CWD="`pwd`" ${chipName}:${baseViewName} if ($cleanonlyflag) then goto cleanexit endif if ( $monitorOn ) then echo $MB "Starting the RPC monitor" $VEM -G 500x150+0+0 -F ${chipName}:${placedViewName} -G 500x500+0+154 -R $RPC_MONITOR & endif if ($routeonlyflag) then goto startroute else if ($noatlasflag) then goto afteratlas endif endif # # ============================ Start main body of mosaico routing ============= # if ($usemercury) then set MERCURY_OUT_FILE = mercury.out.tmp if ($showTime) echo $MB `time` echo $MB ">>>>>> ${toolCount} ${toolCount} ${toolCount} ${toolCount} <<<<<"; @ toolCount++ echo $MB "Starting ChanDef/GlbRt/PlacRef step ( mercury ) ..." set mercuryMaxTries = 5 set count = 0 while ( 1 ) @ count++ if ( $noLindo ) then set mercuryFlags = "-p 0 -M 1" else set mercuryFlags = "-p 1 -f" endif set mercuryFlags = "$mercuryFlags -o :${cdViewName} -O :${cdGRViewName}" mercury $mercuryFlags ${chipName}:${mercuryViewName} > $MERCURY_OUT_FILE set mer_status = $status if ( $mer_status == 5 ) then tail -10 $MERCURY_OUT_FILE echo $MB "Software LINDO not available." echo $MB "You can also rerun mosaico with the -lindo option" echo $MB "to avoid this problem." goto errorexit else if ( $mer_status == 8 ) then echo $MB "Mercury failed. No feasible solution found." echo $MB "Trying placement refinement" set newPlacViewName = $mercuryViewName.mercury mercury -p 2 -r -f -o ${chipName}:${newPlacViewName} \ ${chipName}:${mercuryViewName} >> $MERCURY_OUT_FILE set mercuryViewName = $newPlacViewName else break endif if ( $count >= $mercuryMaxTries) then echo $MB "Mercury cannot find a feasible solution after $count tries" echo $MB "You should try to allow more expansion of the chip (e.g. 1.2)" goto errorexit endif end else # Don not use mercury ### Remove $SEQUENCEFILE if it exists if (-e $SEQUENCEFILE ) then \rm -f $SEQUENCEFILE endif if ($showTime) echo $MB `time` echo $MB ">>>>>> ${toolCount} ${toolCount} ${toolCount} ${toolCount} <<<<<"; @ toolCount++ echo $MB "Starting channel definition step (atlas) ..." if ($useZshaped) then set atlasFlag = "-z" else set atlasFlag = "" endif ${CADBIN}atlas $atlasFlag -i -o ${cdViewName} $chipName\:${placedViewName} set atlasStatus = $status if ($atlasStatus != 0) then if ($atlasStatus == 1) then echo $MB 'ERROR Cannot handle "L" and/or "Z" shaped channels yet' echo $MB "Please get rid of these nasty channels" goto errorexit else if ($atlasStatus == 2) then echo $MB "Overlapping instances - fix them up buddy\!" goto errorexit else echo $MB "ERROR atlas screwed up." goto errorexit endif endif endif # # Prepare the property for mosaicoDemo to work correctly # echo ${chipName}:${baseViewName} > $SEQUENCEFILE set numberOfChannels = `octprop -v "atlasNumberOfChannels" ${chipName}:${cdViewName}` echo $MB "This chip has $numberOfChannels channels" @ chCount = 0 while ( $chCount < $numberOfChannels ) echo ${RTSTUFF}/${chipName}.ch${chCount}:symbolic >> $SEQUENCEFILE @ chCount++ end cat >> $SEQUENCEFILE << ++ ${chipName}:${flatViewName} ${chipName}:${viaminViewName} ${chipName}:${outputViewName} ++ afteratlas: # # New option -r for mosaicoGR, automatic call to timberwolf # Also immediately transform Fabio's definition of pTerm/subnet attachements to Mitch's if ($showTime) echo $MB `time` echo $MB ">>>>>> ${toolCount} ${toolCount} ${toolCount} ${toolCount} <<<<<"; @ toolCount++ echo $MB "Global routing (mosaicoGR -> TimberWolfMC -> mosaicoGR)" ${CADBIN}mosaicoGR ${chipName}:${cdViewName} -r -ov ${cdGRViewName} if ($status != 0) then echo $MB "Global routing failed" goto errorexit endif \rm -f TW${chipName}.* # remove TW.files endif # mercury/atlas-mosaicoGR if # # PGcurrent is now being called by mosaicoGR # power ground routing # #if ($showTime) echo $MB `time` #echo $MB ">>>>>> ${toolCount} ${toolCount} ${toolCount} ${toolCount} <<<<<"; @ toolCount++ #echo $MB "Starting power and ground current calculations (PGcurrent)..." #${CADBIN}PGcurrent ${chipName}:${cdGRViewName} #if ($status != 0) then # echo $MB "Power and ground routing failed" # goto errorexit #endif # # Entry point to mosaico if you want to run only routing # startroute: \rm -f summary >& /dev/null if (!(-d ${RTSTUFF})) then mkdir ${RTSTUFF} endif # if ($showTime) echo $MB `time` echo $MB ">>>>>> ${toolCount} ${toolCount} ${toolCount} ${toolCount} <<<<<"; @ toolCount++ echo $MB "Starting routing step (mosaicoDR) ..." if ( $spiderInteractive ) then echo $MB "Starting detailed routing in interactive mode" setenv SPIDER_INTERACTIVE TRUE else echo $MB "Starting detailed routing in automatic mode" setenv SPIDER_INTERACTIVE FALSE endif set cprepoptions = "-d -o ${hierViewName} -r $routerName -R $RTSTUFF" if ( $compactEachChannel ) then set cprepoptions = "-C $cprepoptions " if ( $minEachChan ) then set cprepoptions = "-m $cprepoptions " endif endif ${CADBIN}mosaicoDR $cprepoptions ${chipName}:${cdGRViewName} set cprepStatus = $status if ($cprepStatus != 0) then if ($cprepStatus == 1 ) then echo $MB "mosaicoDR had problems with spider" goto errorexit else if ($cprepStatus == 96) then echo $MB "Cells were generated that have disconnected PLACE layer geoms" echo $MB "Look at the error message from mosaicoDR" goto errorexit else echo $MB "Unknown return code ($cprepStatus) from mosaicoDR" goto errorexit endif endif cp $chipName/$baseViewName/interface\; $chipName/${hierViewName} # # mv msg.router ${RTSTUFF} if (-e summary) then mv summary ${RTSTUFF} endif # # In the step 1 of flattening we go back to the hierarchy as in # the view after the global routing, that is the pads remain merged # if ($showTime) echo $MB `time` echo $MB ">>>>>> ${toolCount} ${toolCount} ${toolCount} ${toolCount} <<<<<"; @ toolCount++ echo $MB "Flattening step 1 (octflatten) ..." ${CADBIN}octflatten -r ${chipName}:$cdGRViewName -o ${chipName}:${flatViewName} ${chipName}:${hierViewName} if ($status != 0) then echo $MB "Flattener (step 1) failed" goto errorexit endif if ($autoprint) then echo $MB "Sending current statistics to the printer $PRINTER" ${CADBIN}chipstats ${chipName}:${flatViewName} >& $statFileName echo $MB $VERSION >> $statFileName echo $MB $arguments >> $statFileName lpr -P$PRINTER -p $statFileName endif # if ($showTime) echo $MB `time` if ($runMizer) then echo $MB ">>>>>> ${toolCount} ${toolCount} ${toolCount} ${toolCount} <<<<<"; @ toolCount++ echo $MB "Via minimization (mizer) ..." ${CADBIN}mizer -o ${chipName}:${viaminViewName} ${chipName}:$flatViewName if ($status != 0) then echo $MB "Via minimization failed" goto errorexit endif endif if (! $runMizer) mv ${chipName}/${flatViewName} ${chipName}:/${viaminViewName} # # In the step 2 of flattening we go back to the original hierarchy # if ($showTime) echo $MB `time` echo $MB ">>>>>> ${toolCount} ${toolCount} ${toolCount} ${toolCount} <<<<<"; @ toolCount++ echo $MB "Flattening step 2 (octflatten) ..." ${CADBIN}octflatten -r ${chipName}:$baseViewName ${chipName}:${viaminViewName} if ($status != 0) then echo $MB "Flattener (step 2) failed" goto errorexit endif # if ($showTime) echo $MB `time` echo $MB ">>>>>> ${toolCount} ${toolCount} ${toolCount} ${toolCount} <<<<<"; @ toolCount++ echo $MB "Adding constraints for the compactor" #${CADBIN}padplace -f -S ${chipName}:$viaminViewName ${CADBIN}padplace -f ${chipName}:$viaminViewName if ($status != 0) then echo $MB "padplace failed" goto errorexit endif if ($autoprint) then echo $MB "Sending current statistics to the printer $PRINTER" ${CADBIN}chipstats ${chipName}:${viaminViewName} >& $statFileName echo $MB $VERSION >> $statFileName echo $MB $arguments >> $statFileName lpr -P$PRINTER -p $statFileName endif if ( ! $skipSparcs ) then # # Compaction: try compacting horizontally first. If that fails, # try vertical compaction first. # if ($showTime) echo $MB `time` echo $MB ">>>>>> ${toolCount} ${toolCount} ${toolCount} ${toolCount} <<<<<"; @ toolCount++ echo $MB "Starting global compactor (sparcs) ..." limit cputime 60:00 set sparcs_options = "-t -w NWEL -w PWEL" if ( $useSparcsRules ) then set sparcs_options = "$sparcs_options -r sparcs.mosaico.rules" else set sparcs_options = "$sparcs_options -w PLACE" endif ${CADBIN}sparcs $sparcs_options \ -o ${chipName}:$outputViewName \ ${chipName}:$viaminViewName set sparcsStatus = $status if ($sparcsStatus != 0) then echo $MB "Sparcs attempt failed: returned code $sparcsStatus" echo $MB "Retrying compacting in the vertical direction first" ${CADBIN}sparcs -v $sparcs_options \ -o ${chipName}:$outputViewName \ ${chipName}:$viaminViewName set sparcsStatus = $status endif if ($sparcsStatus != 0) then echo $MB "Sparcs failed: returned code $sparcsStatus" goto errorexit endif endif ### skipSparcs if ($skipSparcs) then echo $MB "Renaming output, since sparcs was skipped" mv ${chipName}/${viaminViewName} ${chipName}/${outputViewName} endif # if ($autoprint) then ${CADBIN}chipstats ${chipName}:${outputViewName} |& tee $statFileName # Complete the statistics file with some more useful info. # Put some space first echo $MB $VERSION >> $statFileName echo $MB $arguments >> $statFileName echo $MB "Sending current statistics to the printer $PRINTER" lpr -P$PRINTER -p $statFileName echo $MB "Plotting result ..." oct2ps $OCT2PSFLAGS ${chipName}:${outputViewName} | lpr -P$PRINTER endif # if ($showTime) echo $MB `time` echo $MB ">>>>>> ${toolCount} ${toolCount} ${toolCount} ${toolCount} <<<<<"; @ toolCount++ echo $MB "Run vulcan" ${CADBIN}vulcan ${chipName}:${outputViewName} if ($status != 0) then echo $MB "vulcan failed" goto errorexit endif if ($showTime) echo $MB `time` echo $MB ">>>>>> ${toolCount} ${toolCount} ${toolCount} ${toolCount} <<<<<"; @ toolCount++ echo $MB "Double checking connectivity (mosaicoRC) ..." ${CADBIN}mosaicoRC -m 20 -c $baseViewName ${chipName}:$outputViewName set RCstatus = $status if ( $RCstatus == -1 ) then echo $MB "mosaicoRC failed" goto errorexit else if ( $RCstatus == 1 ) then echo $MB "mosaicoRC found some errors: here they are:" cat $rcFileName endif if ($autoprint) then if ( -e $rcFileName ) then echo $MB "Sending Errors to printer $PRINTER" echo $MB $VERSION >> $rcFileName echo $MB $arguments >> $rcFileName lpr -P$PRINTER -p $rcFileName endif endif # # Exit mosaico cleanexit: if ($cleanflag) then echo $MB "Cleaning up temporary files created by mosaico" \rm -rf ${RTSTUFF} >& /dev/null \rm -rf ${chipName}.ioleft ${chipName}.ioright >& /dev/null \rm -rf ${chipName}.iobottom ${chipName}.iotop >& /dev/null \rm -rf $chipName/$cdViewName $chipName/$cdGRViewName $chipName/$hierViewName >& /dev/null \rm -rf $chipName/$flatViewName $chipName/$viaminViewName >& /dev/null \rm -rf $chipName/${viaminViewName}.mizer.tmp >& /dev/null \rm -f $rcFileName $SEQUENCEFILE msg.router summary >& /dev/null \rm -f PUPPYdata??? >& /dev/null endif \rm -f $LOCK if ($cleanonlyflag) then echo $MB "Cleaning completed" exit 0 else echo $MB echo $MB "Successfully completed" echo $MB "The routed cell is" ${chipName}:${outputViewName} echo $MB "Final statistics are in $statFileName" echo $MB exit 0 endif errorexit: \rm -f $LOCK echo $MB echo $MB "ERROR ERROR ERROR ERROR." echo $MB echo $MB "If you need help send mail to mosaico@eros.Berkeley.EDU" echo $MB exit -1 interrupted: \rm -f $LOCK echo $MB "Interrupted" echo $MB "Exiting" exit -1