Initial import of cumulus

This commit is contained in:
Jean-Paul Chaput 2010-07-12 15:31:29 +00:00
parent b84e0e47c4
commit c1ab67d1ac
4 changed files with 2608 additions and 0 deletions

67
cumulus/CMakeLists.txt Normal file
View File

@ -0,0 +1,67 @@
PROJECT(CUMULUS)
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.0)
IF(COMMAND CMAKE_POLICY)
CMAKE_POLICY(SET CMP0003 NEW)
ENDIF(COMMAND CMAKE_POLICY)
IF(APPLE)
EXECUTE_PROCESS(
COMMAND sw_vers -productVersion
OUTPUT_VARIABLE OSX_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
MESSAGE(STATUS "OSX_VERSION='${OSX_VERSION}'")
IF(${OSX_VERSION} MATCHES "^10\\.[012345]\\.?")
MESSAGE(STATUS "OSX < 10.6")
ELSE(${OSX_VERSION} MATCHES "^10\\.[012345]\\.?")
SET(CMAKE_OSX_ARCHITECTURES "i386;ppc") # for QT4.5 32bits on snow leopard
ENDIF(${OSX_VERSION} MATCHES "^10\\.[012345]\\.?")
ENDIF(APPLE)
SET(CMAKE_C_FLAGS_DEBUG "-g -Wall" CACHE STRING "Debug options." FORCE)
SET(CMAKE_CXX_FLAGS_DEBUG "-g -Wall" CACHE STRING "Debug options." FORCE)
#SET(CMAKE_LINKER_FLAGS_DEBUG "-pg" CACHE STRING "Debug options." FORCE)
#SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "-pg" CACHE STRING "Debug options." FORCE)
#SET(CMAKE_MODULE_LINKER_FLAGS_DEBUG "-pg" CACHE STRING "Debug options." FORCE)
#SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "-pg" CACHE STRING "Debug options." FORCE)
# This macro has to be included in all the tools CMakeLists.txt as it's
# the sole means of localizing other tools/projects.
MACRO(SETUP_PROJECT_PATHS project)
IF( NOT("$ENV{${project}_TOP}" STREQUAL "") )
MESSAGE("-- ${project}_TOP is set to $ENV{${project}_TOP}")
SET(PROJECT_MODULE_PATH "${DESTDIR}$ENV{${project}_TOP}/share/cmake/Modules/")
LIST(INSERT CMAKE_MODULE_PATH 0 "${PROJECT_MODULE_PATH}")
ENDIF( NOT("$ENV{${project}_TOP}" STREQUAL "") )
IF( NOT("$ENV{${project}_USER_TOP}" STREQUAL "") )
MESSAGE("-- ${project}_USER_TOP is set to $ENV{${project}_USER_TOP}")
SET(PROJECT_MODULE_PATH "${DESTDIR}$ENV{${project}_USER_TOP}/share/cmake/Modules/")
LIST(INSERT CMAKE_MODULE_PATH 0 "${PROJECT_MODULE_PATH}")
ENDIF( NOT("$ENV{${project}_USER_TOP}" STREQUAL "") )
LIST(REMOVE_DUPLICATES CMAKE_MODULE_PATH)
ENDMACRO(SETUP_PROJECT_PATHS project)
SETUP_PROJECT_PATHS(VLSISAPD)
SETUP_PROJECT_PATHS(CORIOLIS)
STRING(REGEX MATCH "^/usr" IS_USR "$ENV{CORIOLIS_TOP}")
STRING(REGEX MATCH "^/opt" IS_OPT "$ENV{CORIOLIS_TOP}")
IF(IS_USR OR IS_OPT)
MESSAGE("-- Using system-wide /etc.")
SET(SYS_CONF_DIR "/etc" CACHE STRING "System configuration directory (/etc)" FORCE)
ELSE(IS_USR OR IS_OPT)
MESSAGE("-- Using install tree /etc.")
SET(SYS_CONF_DIR "etc" CACHE STRING "System configuration directory (/etc)" FORCE)
ENDIF(IS_USR OR IS_OPT)
FIND_PACKAGE(PythonLibs REQUIRED)
FIND_PACKAGE(PythonSitePackages REQUIRED)
FIND_PACKAGE(VLSISAPD REQUIRED)
FIND_PACKAGE(HURRICANE REQUIRED)
FIND_PACKAGE(CORIOLIS REQUIRED)
SET_LIB_LINK_MODE()
ADD_SUBDIRECTORY(src)

View File

@ -0,0 +1,6 @@
set ( pysources ${CMAKE_CURRENT_SOURCE_DIR}/placeandroute.py
${CMAKE_CURRENT_SOURCE_DIR}/ref.py
)
install ( FILES ${pysources} DESTINATION ${PYTHON_SITE_PACKAGES}/cumulus )

2378
cumulus/src/placeandroute.py Normal file

File diff suppressed because it is too large Load Diff

157
cumulus/src/ref.py Normal file
View File

@ -0,0 +1,157 @@
from Hurricane import *
import Hurricane
import CRL
import re
###########
## GetXY ##
###########
def pyGetXY ( masterCell, pathname, refname ) :
'''This function returns the coordinates of a reference thanks to its name and the path of the instance it belongs to'''
## MasterCell ##
if pathname != "" :
myPath = Path ( masterCell, pathname )
tInst = myPath.getTailInstance()
masterCell = tInst.getMasterCell()
## Reference ##
myRef = None
for el in masterCell.getReferences():
if str(el.getName()) == refname :
myRef = el
break
# Error : if no reference found in mastercell
if myRef == None :
err = "\n[Stratus ERROR] GetRefXY : No reference found with name " + refname + " in masterCell " + str(masterCell.getName()) + ".\n"
raise err
## Occurrence of the Reference ##
myOccurrence = Occurrence ( myRef, myPath )
bb = myOccurrence.getBoundingBox()
return ( getValue(bb.getXCenter()), getValue(bb.getYCenter()) )
##############
## PlaceRef ##
##############
def pyPlaceRef ( cell, name, x, y ) :
'''This function creates a reference thanks to its coordinates'''
UpdateSession.open()
Reference ( cell
, name
, DbU_lambda ( x ), DbU_lambda ( y )
)
UpdateSession.close()
##################
## PlaceContact ##
##################
def pyPlaceContact ( net, layer, x, y, width, height ) :
'''This function creates a contact'''
UpdateSession.open()
Contact ( net, layer, DbU_lambda(x), DbU_lambda(y), DbU_lambda(width), DbU_lambda(height) )
UpdateSession.close()
##############
## PlacePin ##
##############
def pyPlacePin ( net, direct, placementStatus, layer, x, y, width, height ) :
'''This function creates a pin'''
size = 0
for loc in net.getPins():
size += 1
UpdateSession.open()
Pin ( net, str(net.getName()) + "." + str(size)
, direct
, placementStatus
, layer
, DbU_lambda(x), DbU_lambda(y)
, DbU_lambda(width), DbU_lambda(height)
)
if ( not net.IsSupply() ) :
CRL.createPartRing ( net.getCell(), net.getName() )
UpdateSession.close()
##################
## PlaceSegment ##
##################
def pyPlaceSegment ( net, layer, x1, y1, x2, y2, width ) :
'''This function creates a segment'''
UpdateSession.open()
if x1 == x2 : Vertical ( net, layer, DbU_lambda(x1), DbU_lambda(width), DbU_lambda(y1), DbU_lambda(y2) )
elif y1 == y2 : Horizontal ( net, layer, DbU_lambda(y1), DbU_lambda(width), DbU_lambda(x1), DbU_lambda(x2) )
UpdateSession.close()
###################
## CopyUpSegment ##
###################
def pyCopyUpSegment ( masterCell, pathname, netname, newnet ) :
'''This function copies the segment of an instance in the current cell'''
## MasterCell ##
if pathname != "" :
myPath = Path ( masterCell, pathname )
transformation = myPath.getTransformation()
tInst = myPath.getTailInstance()
masterCell = tInst.getMasterCell()
## Net ##
myNet = None
for el in masterCell.getNets():
if str(el.getName()) == netname :
myNet = el
break
# Error : if no net found in mastercell
if myNet == None :
err = "\n[Stratus ERROR] CopyUpSegment : No net found with name " + netname + " in masterCell " + str(masterCell.getName()) + ".\n"
raise err
mySegment = None
for mySegment in myNet.getSegments():
# Error : copy only of CALU segments
if str ( mySegment.getLayer().getName() ) not in ( "CALU1", "CALU2", "CALU3", "CALU4", "CALU5", "CALU6" ) :
err = "\n[Stratus ERROR] CopyUpSegment : The segments of net " + netname + " are not of type CALU.\n"
raise err
myLayer = mySegment.getLayer()
myWidth = mySegment.getWidth()
pointSource = mySegment.getSourcePosition()
pointTarget = mySegment.getTargetPosition()
transformation.ApplyOn ( pointSource )
transformation.ApplyOn ( pointTarget )
## Occurrence of the segment ##
myOccurrence = Occurrence ( mySegment, myPath )
if pointSource.getY() == pointTarget.getY() :
Horizontal ( newnet, myLayer, pointSource.getY(), myWidth, pointSource.getX(), pointTarget.getX() )
elif pointSource.getX() == pointTarget.getX() :
Vertical ( newnet, myLayer, pointSource.getX(), myWidth, pointSource.getY(), pointTarget.getY() )
# Error : if no segment found
if not mySegment:
err = "\n[Stratus ERROR] CopyUpSegment : No segment found with net " + netname + " in masterCell " + str(masterCell.getName()) + ".\n"
raise err