diff --git a/Makefile b/Makefile index 5f491ea1..92fbcec1 100644 --- a/Makefile +++ b/Makefile @@ -55,8 +55,8 @@ check_dir: install: check_dir - @./bootstrap/ccb.py $(DEVTOOLSET_OPTION) --project=coriolis --make="$(SMP_FLAGS) install" - @./bootstrap/ccb.py $(DEVTOOLSET_OPTION) --project=coriolis --make="-j1 install" --doc + @./bootstrap/ccb.py $(DEVTOOLSET_OPTION) --project=support --project=coriolis --make="$(SMP_FLAGS) install" + @./bootstrap/ccb.py $(DEVTOOLSET_OPTION) --project=support --project=coriolis --make="-j1 install" --doc @echo ""; \ echo "============================================================================"; \ echo "Coriolis has been successfully built"; \ diff --git a/README.rst b/README.rst index 91cef49b..861e003e 100644 --- a/README.rst +++ b/README.rst @@ -47,13 +47,17 @@ To build Coriolis, ensure the following prerequisites are met: * bison & flex. * Qt 4 or 5. * libxml2. +* RapidJSON * A C++11 compliant compiler. The build system relies on a fixed directory tree from the root of the user currently building it. Thus first step is to get a clone of the repository in the right place. Proceed as follow: :: - ego@home:~$ mkdir -p ~/coriolis-2.x/src + ego@home:~$ mkdir -p ~/coriolis-2.x/src/support + ego@home:~$ cd ~/coriolis-2.x/src/support + ego@home:~$ git clone http://github.com/miloyip/rapidjson + ego@home:~$ git checkout ec322005072076ef53984462fb4a1075c27c7dfd ego@home:~$ cd ~/coriolis-2.x/src ego@home:src$ git clone https://www-soc.lip6.fr/git/coriolis.git ego@home:src$ cd coriolis diff --git a/bootstrap/build.conf b/bootstrap/build.conf index 8447c0e8..b29b7b1e 100644 --- a/bootstrap/build.conf +++ b/bootstrap/build.conf @@ -6,7 +6,12 @@ projectdir = 'coriolis-2.x' projects = [ - { 'name' : "coriolis" + { 'name' : "support" + , 'tools' : [ "rapidjson" + ] + , 'repository': 'No_repository_for_support' + } + , { 'name' : "coriolis" , 'tools' : [ "bootstrap" , "vlsisapd" , "hurricane" @@ -38,6 +43,7 @@ projects = [ , "graph" , "pharos" , "isis" + , "horus" #, "schematic" , "solver" , "autoDTR" diff --git a/bootstrap/builder/AboutWidget.py b/bootstrap/builder/AboutWidget.py index eb7428cd..9113665a 100644 --- a/bootstrap/builder/AboutWidget.py +++ b/bootstrap/builder/AboutWidget.py @@ -2,7 +2,7 @@ # -*- mode:Python -*- # # This file is part of the Coriolis Software. -# Copyright (c) UPMC/LIP6 2012-2015, All Rights Reserved +# Copyright (c) UPMC/LIP6 2012-2016, All Rights Reserved # # +-----------------------------------------------------------------+ # | C O R I O L I S | @@ -54,7 +54,7 @@ class AboutWidget ( QWidget ): subTitle.setFont( QFont('Courier',10,QFont.Bold) ) authors = QLabel( 'Coriolis CAD System 1.0 . . . . . . . . ccb 1.0\n' - 'Copyright (c) 2008-2015 . . . . . . . . . . UPMC\n' + 'Copyright (c) 2008-2016 . . . . . . . . . . UPMC\n' 'Authors . . . . . . . . . . . . . Damien Dupuis\n' ' . . . . . . . . . . . . Jean-Paul Chaput\n' 'E-Mail . . . . . . . . Jean-Paul.Chaput@lip6.fr' diff --git a/bootstrap/builder/Builder.py b/bootstrap/builder/Builder.py index fc8031c9..e9eb302e 100644 --- a/bootstrap/builder/Builder.py +++ b/bootstrap/builder/Builder.py @@ -1,7 +1,7 @@ # -*- mode:Python -*- # # This file is part of the Coriolis Software. -# Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +# Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved # # +-----------------------------------------------------------------+ # | C O R I O L I S | @@ -150,8 +150,9 @@ class Builder: def _build ( self, tool ): - toolSourceDir = os.path.join ( self.sourceDir, tool.getToolDir() ) - toolBuildDir = os.path.join ( self.buildDir , tool.name ) + toolSourceDir = os.path.join ( self.sourceDir, tool.getToolDir() ) + toolBuildDir = os.path.join ( self.buildDir , tool.name ) + cmakeInstallDir = os.path.join ( self.installDir, "share", "cmake", "Modules" ) # Supplied directly in the CMakeLists.txt. #cmakeModules = os.path.join ( self.installDir, "share", "cmake", "Modules" ) @@ -170,8 +171,10 @@ class Builder: if self._qt5: command += [ "-D", "WITH_QT5:STRING=TRUE" ] if self._openmp: command += [ "-D", "WITH_OPENMP:STRING=TRUE" ] - command += [ "-D", "CMAKE_BUILD_TYPE:STRING=%s" % self.buildMode - , "-D", "BUILD_SHARED_LIBS:STRING=%s" % self.enableShared + command += [ "-D", "CMAKE_BUILD_TYPE:STRING=%s" % self.buildMode + , "-D", "BUILD_SHARED_LIBS:STRING=%s" % self.enableShared + , "-D", "CMAKE_INSTALL_PREFIX:STRING=%s" % self.installDir + , "-D", "CMAKE_INSTALL_DIR:STRING=%s" % cmakeInstallDir #, "-D", "CMAKE_MODULE_PATH:STRING=%s" % cmakeModules , toolSourceDir ] @@ -191,6 +194,7 @@ class Builder: , "-D", "CHECK_DETERMINISM:STRING=%s" % self._checkDeterminism , "-D", "CMAKE_VERBOSE_MAKEFILE:STRING=%s" % self._verboseMakefile , "-D", "CMAKE_INSTALL_PREFIX:STRING=%s" % self.installDir + , "-D", "CMAKE_INSTALL_DIR:STRING=%s" % cmakeInstallDir ] if self.libSuffix: command += [ "-D", "LIB_SUFFIX:STRING=%s" % self.libSuffix ] diff --git a/bootstrap/builder/BuilderGui.py b/bootstrap/builder/BuilderGui.py index ec750562..77ab6f39 100644 --- a/bootstrap/builder/BuilderGui.py +++ b/bootstrap/builder/BuilderGui.py @@ -2,7 +2,7 @@ # -*- mode:Python -*- # # This file is part of the Coriolis Software. -# Copyright (c) UPMC/LIP6 2012-2015, All Rights Reserved +# Copyright (c) UPMC/LIP6 2012-2016, All Rights Reserved # # +-----------------------------------------------------------------+ # | C O R I O L I S | diff --git a/bootstrap/builder/CompileWidget.py b/bootstrap/builder/CompileWidget.py index cb527a1d..c911e2dc 100644 --- a/bootstrap/builder/CompileWidget.py +++ b/bootstrap/builder/CompileWidget.py @@ -2,7 +2,7 @@ # -*- mode:Python -*- # # This file is part of the Coriolis Software. -# Copyright (c) UPMC/LIP6 2012-2015, All Rights Reserved +# Copyright (c) UPMC/LIP6 2012-2016, All Rights Reserved # # +-----------------------------------------------------------------+ # | C O R I O L I S | diff --git a/bootstrap/builder/Configuration.py b/bootstrap/builder/Configuration.py index ca574de7..19a8c498 100644 --- a/bootstrap/builder/Configuration.py +++ b/bootstrap/builder/Configuration.py @@ -2,7 +2,7 @@ # -*- mode:Python -*- # # This file is part of the Coriolis Software. -# Copyright (c) UPMC 2008-2015, All Rights Reserved +# Copyright (c) UPMC 2008-2016, All Rights Reserved # # +-----------------------------------------------------------------+ # | C O R I O L I S | @@ -146,6 +146,8 @@ class Configuration ( object ): self._osCygwinW7 = re.compile (".*CYGWIN_NT-6\.1.*i686.*") self._osCygwinW8_64 = re.compile (".*CYGWIN_NT-6\.[2-3].*x86_64.*") self._osCygwinW8 = re.compile (".*CYGWIN_NT-6\.[2-3].*i686.*") + self._osCygwinW10_64 = re.compile (".*CYGWIN_NT-10\.[0-3].*x86_64.*") + self._osCygwinW10 = re.compile (".*CYGWIN_NT-10\.[0-3].*i686.*") uname = subprocess.Popen ( ["uname", "-srm"], stdout=subprocess.PIPE ) lines = uname.stdout.readlines() @@ -186,6 +188,10 @@ class Configuration ( object ): self._osType = "Cygwin.W8_64" self._libSuffix = "64" elif self._osCygwinW8.match(lines[0]): self._osType = "Cygwin.W8" + elif self._osCygwinW10_64.match(lines[0]): + self._osType = "Cygwin.W10_64" + self._libSuffix = "64" + elif self._osCygwinW10.match(lines[0]): self._osType = "Cygwin.W10" else: uname = subprocess.Popen ( ["uname", "-sr"], stdout=subprocess.PIPE ) self._osType = uname.stdout.readlines()[0][:-1] diff --git a/bootstrap/builder/ConfigureWidget.py b/bootstrap/builder/ConfigureWidget.py index 20cdea86..fa7b0cb5 100644 --- a/bootstrap/builder/ConfigureWidget.py +++ b/bootstrap/builder/ConfigureWidget.py @@ -2,7 +2,7 @@ # -*- mode:Python -*- # # This file is part of the Coriolis Software. -# Copyright (c) UPMC/LIP6 2012-2015, All Rights Reserved +# Copyright (c) UPMC/LIP6 2012-2016, All Rights Reserved # # +-----------------------------------------------------------------+ # | C O R I O L I S | diff --git a/bootstrap/builder/Highlighter.py b/bootstrap/builder/Highlighter.py index 0bc6e11f..ba07b9d5 100644 --- a/bootstrap/builder/Highlighter.py +++ b/bootstrap/builder/Highlighter.py @@ -2,7 +2,7 @@ # -*- mode:Python -*- # # This file is part of the Coriolis Software. -# Copyright (c) UPMC/LIP6 2012-2015, All Rights Reserved +# Copyright (c) UPMC/LIP6 2012-2016, All Rights Reserved # # +-----------------------------------------------------------------+ # | C O R I O L I S | diff --git a/bootstrap/builder/OptionsWidget.py b/bootstrap/builder/OptionsWidget.py index 4105aba4..bbfb0a51 100644 --- a/bootstrap/builder/OptionsWidget.py +++ b/bootstrap/builder/OptionsWidget.py @@ -2,7 +2,7 @@ # -*- mode:Python -*- # # This file is part of the Coriolis Software. -# Copyright (c) UPMC/LIP6 2012-2015, All Rights Reserved +# Copyright (c) UPMC/LIP6 2012-2016, All Rights Reserved # # +-----------------------------------------------------------------+ # | C O R I O L I S | diff --git a/bootstrap/builder/Project.py b/bootstrap/builder/Project.py index 0f1cc05b..572f2969 100644 --- a/bootstrap/builder/Project.py +++ b/bootstrap/builder/Project.py @@ -2,7 +2,7 @@ # -*- mode:Python -*- # # This file is part of the Coriolis Software. -# Copyright (c) UPMC/LIP6 2012-2015, All Rights Reserved +# Copyright (c) UPMC/LIP6 2012-2016, All Rights Reserved # # +-----------------------------------------------------------------+ # | C O R I O L I S | diff --git a/bootstrap/builder/ProjectWidgets.py b/bootstrap/builder/ProjectWidgets.py index 9fea7e0a..b9c15716 100644 --- a/bootstrap/builder/ProjectWidgets.py +++ b/bootstrap/builder/ProjectWidgets.py @@ -2,7 +2,7 @@ # -*- mode:Python -*- # # This file is part of the Coriolis Software. -# Copyright (c) UPMC/LIP6 2012-2015, All Rights Reserved +# Copyright (c) UPMC/LIP6 2012-2016, All Rights Reserved # # +-----------------------------------------------------------------+ # | C O R I O L I S | diff --git a/bootstrap/builder/__init__.py b/bootstrap/builder/__init__.py index 7ff72f35..7771e534 100644 --- a/bootstrap/builder/__init__.py +++ b/bootstrap/builder/__init__.py @@ -2,7 +2,7 @@ # -*- mode:Python -*- # # This file is part of the Coriolis Software. -# Copyright (c) UPMC/LIP6 2012-2015, All Rights Reserved +# Copyright (c) UPMC/LIP6 2012-2016, All Rights Reserved # # +-----------------------------------------------------------------+ # | C O R I O L I S | diff --git a/bootstrap/ccb.py b/bootstrap/ccb.py index e209cb77..0f582fb1 100755 --- a/bootstrap/ccb.py +++ b/bootstrap/ccb.py @@ -3,7 +3,7 @@ # -*- mode:Python -*- # # This file is part of the Coriolis Software. -# Copyright (c) UPMC 2008-2015, All Rights Reserved +# Copyright (c) UPMC 2008-2016, All Rights Reserved # # +-----------------------------------------------------------------+ # | C O R I O L I S | @@ -80,6 +80,8 @@ def guessOs (): osCygwinW7 = re.compile (".*CYGWIN_NT-6\.1.*i686.*") osCygwinW8_64 = re.compile (".*CYGWIN_NT-6\.[2-3].*x86_64.*") osCygwinW8 = re.compile (".*CYGWIN_NT-6\.[2-3].*i686.*") + osCygwinW10_64 = re.compile (".*CYGWIN_NT-10\.[0-3].*x86_64.*") + osCygwinW10 = re.compile (".*CYGWIN_NT-10\.[0-3].*i686.*") uname = subprocess.Popen ( ["uname", "-srm"], stdout=subprocess.PIPE ) lines = uname.stdout.readlines() @@ -127,6 +129,11 @@ def guessOs (): libDir = "lib64" elif osCygwinW8.match(lines[0]): osType = "Cygwin.W8" + elif osCygwinW10_64.match(lines[0]): + osType = "Cygwin.W10_64" + libDir = "lib64" + elif osCygwinW10.match(lines[0]): + osType = "Cygwin.W10" else: uname = subprocess.Popen ( ["uname", "-sr"], stdout=subprocess.PIPE ) osType = uname.stdout.readlines()[0][:-1] diff --git a/bootstrap/cmake_modules/FindBootstrap.cmake b/bootstrap/cmake_modules/FindBootstrap.cmake index 322c6e77..b76b67fc 100644 --- a/bootstrap/cmake_modules/FindBootstrap.cmake +++ b/bootstrap/cmake_modules/FindBootstrap.cmake @@ -78,14 +78,16 @@ #set(DEBUG_FLAGS "-g -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC") set(DEBUG_FLAGS "-g") if(CYGWIN) - set(CXX_STANDARD "gnu++0x") + set(ADDTIONAL_FLAGS "-D_GLIBCXX_USE_C99") + set(CXX_STANDARD "gnu++11") else() + set(ADDTIONAL_FLAGS "") set(CXX_STANDARD "c++11") endif() - set(CMAKE_C_FLAGS_DEBUG "-std=${CXX_STANDARD} -Wall ${DEBUG_FLAGS}" CACHE STRING "C Compiler Debug options." FORCE) - set(CMAKE_C_FLAGS_RELEASE "-std=${CXX_STANDARD} -Wall -O2 -DNDEBUG" CACHE STRING "C Compiler Release options." FORCE) - set(CMAKE_CXX_FLAGS_DEBUG "-std=${CXX_STANDARD} -Wall ${DEBUG_FLAGS}" CACHE STRING "C++ Compiler Debug options." FORCE) - set(CMAKE_CXX_FLAGS_RELEASE "-std=${CXX_STANDARD} -Wall -O2 -DNDEBUG" CACHE STRING "C++ Compiler Release options." FORCE) + set(CMAKE_C_FLAGS_DEBUG "-std=${CXX_STANDARD} -Wall ${ADDTIONAL_FLAGS} ${DEBUG_FLAGS}" CACHE STRING "C Compiler Debug options." FORCE) + set(CMAKE_C_FLAGS_RELEASE "-std=${CXX_STANDARD} -Wall -O2 ${ADDTIONAL_FLAGS} -DNDEBUG" CACHE STRING "C Compiler Release options." FORCE) + set(CMAKE_CXX_FLAGS_DEBUG "-std=${CXX_STANDARD} -Wall ${ADDTIONAL_FLAGS} ${DEBUG_FLAGS}" CACHE STRING "C++ Compiler Debug options." FORCE) + set(CMAKE_CXX_FLAGS_RELEASE "-std=${CXX_STANDARD} -Wall -O2 ${ADDTIONAL_FLAGS} -DNDEBUG" CACHE STRING "C++ Compiler Release options." FORCE) # diff --git a/bootstrap/coriolisEnv.py b/bootstrap/coriolisEnv.py index db1b5041..b6ba9261 100755 --- a/bootstrap/coriolisEnv.py +++ b/bootstrap/coriolisEnv.py @@ -52,6 +52,8 @@ def guessOs (): osCygwinW7 = re.compile (".*CYGWIN_NT-6\.1.*i686.*") osCygwinW8_64 = re.compile (".*CYGWIN_NT-6\.[2-3].*x86_64.*") osCygwinW8 = re.compile (".*CYGWIN_NT-6\.[2-3].*i686.*") + osCygwinW10_64 = re.compile (".*CYGWIN_NT-10\.[0-3].*x86_64.*") + osCygwinW10 = re.compile (".*CYGWIN_NT-10\.[0-3].*i686.*") uname = subprocess.Popen ( ["uname", "-srm"], stdout=subprocess.PIPE ) lines = uname.stdout.readlines() @@ -108,6 +110,11 @@ def guessOs (): libDir = "lib64" elif osCygwinW8.match(lines[0]): osType = "Cygwin.W8" + elif osCygwinW10_64.match(lines[0]): + osType = "Cygwin.W10_64" + libDir = "lib64" + elif osCygwinW10.match(lines[0]): + osType = "Cygwin.W10" else: uname = subprocess.Popen ( ["uname", "-sr"], stdout=subprocess.PIPE ) osType = uname.stdout.readlines()[0][:-1] @@ -165,16 +172,18 @@ if __name__ == "__main__": 'PATH="%(PATH)s";' \ 'BOOTSTRAP_TOP="%(BOOTSTRAP_TOP)s";' \ 'CORIOLIS_TOP="%(CORIOLIS_TOP)s";' \ - 'STRATUS_MAPPING_NAME="%(SYSCONF_DIR)s/stratus2sxlib.xml";' \ 'export PATH BOOTSTRAP_TOP CORIOLIS_TOP STRATUS_MAPPING_NAME;' +# 'STRATUS_MAPPING_NAME="%(SYSCONF_DIR)s/stratus2sxlib.xml";' \ + shellScriptCsh = \ 'echo "%(MESSAGE)s";' \ 'echo "Switching to Coriolis 2.x (%(buildDir)s)";' \ 'setenv PATH "%(PATH)s";' \ 'setenv BOOTSTRAP_TOP "%(BOOTSTRAP_TOP)s";' \ - 'setenv CORIOLIS_TOP "%(CORIOLIS_TOP)s";' \ - 'setenv STRATUS_MAPPING_NAME "%(SYSCONF_DIR)s/stratus2sxlib.xml";' + 'setenv CORIOLIS_TOP "%(CORIOLIS_TOP)s";' + +# 'setenv STRATUS_MAPPING_NAME "%(SYSCONF_DIR)s/stratus2sxlib.xml";' \ buildDir = buildType + "." + linkType scriptDir = os.path.dirname ( os.path.abspath(__file__) ) diff --git a/bootstrap/socInstaller.py b/bootstrap/socInstaller.py index 2396a39b..6149ce25 100755 --- a/bootstrap/socInstaller.py +++ b/bootstrap/socInstaller.py @@ -3,7 +3,7 @@ # -*- mode:Python -*- # # This file is part of the Coriolis Software. -# Copyright (c) UPMC 2015-2015, All Rights Reserved +# Copyright (c) UPMC 2015-2016, All Rights Reserved # # +-----------------------------------------------------------------+ # | C O R I O L I S | @@ -155,8 +155,8 @@ class Command ( object ): class GitRepository ( object ): @staticmethod - def getLocalRepository ( gitRepository ): - localRepo = gitRepository.split( '/' )[-1] + def getLocalRepository ( url ): + localRepo = url.split( '/' )[-1] if localRepo.endswith('.git'): localRepo = localRepo[:-4] return localRepo @@ -197,8 +197,8 @@ class GitRepository ( object ): class Configuration ( object ): PrimaryNames = \ - [ 'sender' , 'receiver' - , 'coriolisRepo', 'chamsRepo' , 'benchsRepo' + [ 'sender' , 'receivers' + , 'coriolisRepo', 'chamsRepo' , 'benchsRepo', 'supportRepos' , 'homeDir' , 'masterHost' , 'debugArg' , 'nightlyMode' , 'rmSource' , 'rmBuild', 'doGit', 'doBuild', 'doBenchs', 'doSendReport' @@ -210,7 +210,8 @@ class Configuration ( object ): def __init__ ( self ): self._sender = 'Jean-Paul.Chaput@soc.lip6.fr' - self._receiver = 'Jean-Paul.Chaput@lip6.fr' + self._receivers = [ 'Jean-Paul.Chaput@lip6.fr', 'Eric.Lao@lip6.fr' ] + self._supportRepos = [ 'http://github.com/miloyip/rapidjson' ] self._coriolisRepo = 'https://www-soc.lip6.fr/git/coriolis.git' self._chamsRepo = 'file:///users/outil/chams/chams.git' self._benchsRepo = 'https://www-soc.lip6.fr/git/alliance-check-toolkit.git' @@ -321,16 +322,17 @@ class Report ( object ): def __init__ ( self, conf ): self.conf = conf - date = time.strftime( "%A %d %B %Y" ) - stateText = 'FAILED' - modeText = 'SoC installation' + commaspace = ', ' + date = time.strftime( "%A %d %B %Y" ) + stateText = 'FAILED' + modeText = 'SoC installation' if self.conf.success: stateText = 'SUCCESS' if self.conf.nightlyMode: modeText = 'Nightly build' self.message = MIMEMultipart() self.message['Subject'] = '[%s] Coriolis & Chams %s %s' % (stateText,modeText,date) self.message['From' ] = self.conf.sender - self.message['To' ] = self.conf.receiver + self.message['To' ] = commaspace.join( self.conf.receivers ) self.attachements = [] self.mainText = '\n' @@ -372,9 +374,9 @@ class Report ( object ): for attachement in self.attachements: self.message.attach( attachement ) - print "Sending mail report to <%s>" % self.conf.receiver + print "Sending mail report to <%s>" % self.conf.receivers session = smtplib.SMTP( 'localhost' ) - session.sendmail( self.conf.sender, self.conf.receiver, self.message.as_string() ) + session.sendmail( self.conf.sender, self.conf.receivers, self.message.as_string() ) session.quit() return @@ -408,11 +410,20 @@ try: if options.rmSource or options.rmAll: conf.rmSource = True if options.rmBuild or options.rmAll: conf.rmBuild = True + gitSupports = [] + for supportRepo in conf.supportRepos: + gitSupports.append( GitRepository( supportRepo, conf.srcDir+'/support' ) ) gitCoriolis = GitRepository( conf.coriolisRepo, conf.srcDir ) gitChams = GitRepository( conf.chamsRepo , conf.srcDir ) gitBenchs = GitRepository( conf.benchsRepo , conf.srcDir ) if conf.doGit: + for gitSupport in gitSupports: + if conf.rmSource: gitSupport.removeLocalRepo() + gitSupport.clone() + #if gitSupport.url.endswith('rapidjson'): + # gitSupport.checkout( 'a1c4f32' ) + if conf.rmSource: gitCoriolis.removeLocalRepo() gitCoriolis.clone () gitCoriolis.checkout( 'devel' ) @@ -440,7 +451,7 @@ try: if conf.doBuild: conf.openLog( 'build' ) if conf.doBenchs: conf.openLog( 'benchs' ) - buildCommand = '%s --root=%s --project=coriolis --project=chams --make="-j%%d install" %%s' \ + buildCommand = '%s --root=%s --project=support --project=coriolis --project=chams --make="-j%%d install" %%s' \ % (ccbBin,conf.rootDir) benchsCommand = 'cd %s/benchs && ./bin/go.sh clean && ./bin/go.sh lvx' \ % (gitBenchs.localRepoDir) diff --git a/crlcore/doc/crlcore/footer.html b/crlcore/doc/crlcore/footer.html index 1daff68c..a42b1c3f 100644 --- a/crlcore/doc/crlcore/footer.html +++ b/crlcore/doc/crlcore/footer.html @@ -9,7 +9,7 @@ - +
Coriolis Core (CRL)Copyright © 2008-2015 UPMC All rights reservedCopyright © 2008-2016 UPMC All rights reserved
diff --git a/crlcore/etc/hcmos9gp/technology.conf b/crlcore/etc/130/hcmos9gp/technology.conf similarity index 100% rename from crlcore/etc/hcmos9gp/technology.conf rename to crlcore/etc/130/hcmos9gp/technology.conf diff --git a/crlcore/etc/scn6m_deep_09/technology.conf b/crlcore/etc/180/scn6m_deep_09/technology.conf similarity index 100% rename from crlcore/etc/scn6m_deep_09/technology.conf rename to crlcore/etc/180/scn6m_deep_09/technology.conf diff --git a/crlcore/etc/CMakeLists.txt b/crlcore/etc/CMakeLists.txt index 6128eefc..bf6b0ab6 100644 --- a/crlcore/etc/CMakeLists.txt +++ b/crlcore/etc/CMakeLists.txt @@ -1,11 +1,10 @@ install ( FILES techno.conf DESTINATION ${SYS_CONF_DIR}/coriolis2 ) install ( DIRECTORY common DESTINATION ${SYS_CONF_DIR}/coriolis2 ) - install ( DIRECTORY ispd05 DESTINATION ${SYS_CONF_DIR}/coriolis2 ) install ( DIRECTORY cmos DESTINATION ${SYS_CONF_DIR}/coriolis2 ) + install ( DIRECTORY ispd05 DESTINATION ${SYS_CONF_DIR}/coriolis2 ) install ( DIRECTORY vsc200 DESTINATION ${SYS_CONF_DIR}/coriolis2 ) install ( DIRECTORY scmos_deep_018 DESTINATION ${SYS_CONF_DIR}/coriolis2 ) - install ( DIRECTORY scn6m_deep_09 DESTINATION ${SYS_CONF_DIR}/coriolis2 ) - install ( DIRECTORY hcmos9gp DESTINATION ${SYS_CONF_DIR}/coriolis2 ) - install ( DIRECTORY cmos065 DESTINATION ${SYS_CONF_DIR}/coriolis2 ) + install ( DIRECTORY 180 DESTINATION ${SYS_CONF_DIR}/coriolis2 ) + install ( DIRECTORY 130 DESTINATION ${SYS_CONF_DIR}/coriolis2 ) diff --git a/crlcore/etc/c35b4/technology.conf b/crlcore/etc/c35b4/technology.conf deleted file mode 100644 index 785291a9..00000000 --- a/crlcore/etc/c35b4/technology.conf +++ /dev/null @@ -1,28 +0,0 @@ -# -*- Mode:Python; explicit-buffer-name: "technology.conf" -*- -# -# AMS 0.35 microns. - -from Hurricane import DbU - - -technoConfig = { 'name' : 'c35b4' - , 'gridValue' : 0.025 - , 'gridUnit' : DbU.UnitPowerMicro - , 'gridsPerLambda': 24 - } - -gdsLayersTable = \ - ( ("nWell" , "NTUB" , 5) - , ("nImplant", "NPLUS" , 23) - , ("pImplant", "PPLUS" , 24) - , ("active" , "DIFF" , 10) - , ("poly" , "POLY1" , 20) - , ("cut0" , "CONT" , 34) - , ("metal1" , "MET1" , 35) - , ("cut1" , "VIA1" , 36) - , ("metal2" , "MET2" , 37) - , ("cut2" , "VIA2" , 38) - , ("metal3" , "MET3" , 39) - , ("cut3" , "VIA3" , 41) - , ("metal4" , "MET4" , 42) - ) diff --git a/crlcore/etc/cmos/alliance.conf b/crlcore/etc/cmos/alliance.conf index 05c99819..5e937d65 100644 --- a/crlcore/etc/cmos/alliance.conf +++ b/crlcore/etc/cmos/alliance.conf @@ -11,6 +11,7 @@ cellsTop = allianceTop+'/cells/' allianceConfig = \ ( ( 'CATALOG' , 'CATAL') , ( 'WORKING_LIBRARY' , '.') +# , ( 'SYSTEM_LIBRARY' , ( (cellsTop+'ramlib' , AddMode.Append), ) ) , ( 'SYSTEM_LIBRARY' , ( (cellsTop+'sxlib' , AddMode.Append) , (cellsTop+'dp_sxlib', AddMode.Append) , (cellsTop+'ramlib' , AddMode.Append) diff --git a/crlcore/etc/cmos/kite.conf b/crlcore/etc/cmos/kite.conf index 62866f63..7868c088 100644 --- a/crlcore/etc/cmos/kite.conf +++ b/crlcore/etc/cmos/kite.conf @@ -25,18 +25,18 @@ parametersTable = \ # Format of routingGaugesTable (dictionary): # A list of entry of the form: -# ( METAL_NAME, (Direction, Type, depth, density, offset, pitch, wire_width, via_width) ) +# ( METAL_NAME, (Direction, Type, depth, density, offset, pitch, wire_width, via_width, obs_dw) ) routingGaugesTable = {} routingGaugesTable['sxlib'] = \ - ( ( 'METAL1', ( Gauge.Vertical , Gauge.PinOnly, 0, 0.0, 0, 5, 2, 1 ) ) - , ( 'METAL2', ( Gauge.Horizontal, Gauge.Default, 1, 7.0, 0, 5, 2, 1 ) ) - , ( 'METAL3', ( Gauge.Vertical , Gauge.Default, 2, 0.0, 0, 5, 2, 1 ) ) - , ( 'METAL4', ( Gauge.Horizontal, Gauge.Default, 3, 0.0, 0, 5, 2, 1 ) ) - , ( 'METAL5', ( Gauge.Vertical , Gauge.Default, 4, 0.0, 0, 5, 2, 1 ) ) - #, ( 'METAL6', ( Gauge.Horizontal, Gauge.Default, 5, 0.0, 0, 5, 2, 1 ) ) - #, ( 'METAL7', ( Gauge.Vertical , Gauge.Default, 6, 0.0, 0, 5, 2, 1 ) ) + ( ( 'METAL1', ( Gauge.Vertical , Gauge.PinOnly, 0, 0.0, 0, 5, 2, 1, 4 ) ) + , ( 'METAL2', ( Gauge.Horizontal, Gauge.Default, 1, 7.0, 0, 5, 2, 1, 4 ) ) + , ( 'METAL3', ( Gauge.Vertical , Gauge.Default, 2, 0.0, 0, 5, 2, 1, 4 ) ) + , ( 'METAL4', ( Gauge.Horizontal, Gauge.Default, 3, 0.0, 0, 5, 2, 1, 4 ) ) + , ( 'METAL5', ( Gauge.Vertical , Gauge.Default, 4, 0.0, 0, 5, 2, 1, 4 ) ) + #, ( 'METAL6', ( Gauge.Horizontal, Gauge.Default, 5, 0.0, 0, 5, 2, 1, 4 ) ) + #, ( 'METAL7', ( Gauge.Vertical , Gauge.Default, 6, 0.0, 0, 5, 2, 1, 4 ) ) ) diff --git a/crlcore/etc/cmos/stratus1.conf b/crlcore/etc/cmos/stratus1.conf index 8b434647..b4e6e23a 100644 --- a/crlcore/etc/cmos/stratus1.conf +++ b/crlcore/etc/cmos/stratus1.conf @@ -5,9 +5,7 @@ import helpers # Status1 parameters. parametersTable = \ - ( ("stratus1.mappingName", TypeString, helpers.sysConfDir+"/stratus2sxlib.xml", - { 'flags':Cfg.Parameter.Flags.NeedRestart|Cfg.Parameter.Flags.MustExist } ) - , ("stratus1.format" , TypeString, "vst") + ( ("stratus1.format" , TypeString, "vst") , ("stratus1.simulator" , TypeString, "asimut") ,) diff --git a/crlcore/etc/cmos065/technology.conf b/crlcore/etc/cmos065/technology.conf deleted file mode 100644 index 7d39a62e..00000000 --- a/crlcore/etc/cmos065/technology.conf +++ /dev/null @@ -1,30 +0,0 @@ -# -*- Mode:Python; explicit-buffer-name: "technology.conf" -*- - -from Hurricane import DbU - - -technoConfig = { 'name' : 'cmos065' - , 'gridValue' : 0.005 - , 'gridUnit' : DbU.UnitPowerMicro - , 'gridsPerLambda': 24 - } - -gdsLayersTable = \ - ( ("nWell" , "NWELL" , 3) - , ("nImplant", "NPLUS" , 26) - , ("pImplant", "PPLUS" , 25) - , ("active" , "ACTIVE" , 6) - , ("poly" , "POLY" , 17) - , ("cut0" , "C0" , 30) - , ("metal1" , "M1" , 31) - , ("cut1" , "VIA1X" , 51) - , ("metal2" , "M2X" , 32) - , ("cut2" , "VIA2X" , 52) - , ("metal3" , "M3X" , 33) - , ("cut3" , "VIA3X" , 53) - , ("metal4" , "M4X" , 34) - , ("cut4" , "VIA4X" , 54) - , ("metal5" , "M5X" , 35) - , ("cut5" , "VIA5X" , 55) - , ("metal6" , "M6X" , 36) - ) diff --git a/crlcore/etc/common/display.conf b/crlcore/etc/common/display.conf index d77430a1..2fba8d12 100644 --- a/crlcore/etc/common/display.conf +++ b/crlcore/etc/common/display.conf @@ -8,7 +8,7 @@ else: poly2Color = 'Orange' -defaultStyle = 'Printer.Coriolis' +defaultStyle = 'Alliance.Classic [black]' stylesTable = \ ( ( (Style , 'Alliance.Coriolis [black]', 'Alliance Coriolis Look - black background') @@ -84,6 +84,7 @@ stylesTable = \ , (Drawing, 'gmetalh' , { 'color':'128,255,200', 'pattern':'light_antihash0.8', 'border':1 }) , (Drawing, 'gmetalv' , { 'color':'200,200,255', 'pattern':'light_antihash1.8', 'border':1 }) , (Drawing, 'gcut' , { 'color':'255,255,190', 'border':1 }) + , (Drawing, 'gcell' , { 'color':'255,255,190', 'pattern':'0000000000000000', 'border':4 }) ) # ---------------------------------------------------------------------- @@ -142,15 +143,16 @@ stylesTable = \ # Routing Layers. , (Group , 'Routing Layers') - #, (Drawing, 'metal1', { 'color':'Blue' , 'pattern':'light_antislash0.8', 'border':1, 'threshold':0.80*scale }) - , (Drawing, 'metal1', { 'color':'Blue' , 'pattern':'slash.8' , 'border':1, 'threshold':0.80*scale }) - , (Drawing, 'metal2', { 'color':'Aqua' , 'pattern':'poids4.8' , 'border':1, 'threshold':0.02*scale }) - , (Drawing, 'metal3', { 'color':'LightPink', 'pattern':'poids4.8' , 'border':1, 'threshold':0.02*scale }) - , (Drawing, 'metal4', { 'color':'Green' , 'pattern':'poids4.8' , 'border':1, 'threshold':0.02*scale }) - , (Drawing, 'metal5', { 'color':'Yellow' , 'pattern':'poids4.8' , 'border':1, 'threshold':0.02*scale }) - , (Drawing, 'metal6', { 'color':'Violet' , 'pattern':'poids4.8' , 'border':1, 'threshold':0.02*scale }) - , (Drawing, 'metal7', { 'color':'Red' , 'pattern':'poids4.8' , 'border':1, 'threshold':0.02*scale }) - , (Drawing, 'metal8', { 'color':'Blue' , 'pattern':'poids4.8' , 'border':1, 'threshold':0.02*scale }) + #, (Drawing, 'metal1', { 'color':'Blue' , 'pattern':'light_antislash0.8', 'border':1, 'threshold':0.80*scale }) + , (Drawing, 'metal1', { 'color':'Blue' , 'pattern':'slash.8' , 'border':1, 'threshold':0.80*scale }) + , (Drawing, 'metal2', { 'color':'Aqua' , 'pattern':'poids4.8' , 'border':1, 'threshold':0.02*scale }) + , (Drawing, 'metcap', { 'color':'DarkTurquoise', 'pattern':'poids2.8' , 'border':2, 'threshold':0.02*scale }) + , (Drawing, 'metal3', { 'color':'LightPink' , 'pattern':'poids4.8' , 'border':1, 'threshold':0.02*scale }) + , (Drawing, 'metal4', { 'color':'Green' , 'pattern':'poids4.8' , 'border':1, 'threshold':0.02*scale }) + , (Drawing, 'metal5', { 'color':'Yellow' , 'pattern':'poids4.8' , 'border':1, 'threshold':0.02*scale }) + , (Drawing, 'metal6', { 'color':'Violet' , 'pattern':'poids4.8' , 'border':1, 'threshold':0.02*scale }) + , (Drawing, 'metal7', { 'color':'Red' , 'pattern':'poids4.8' , 'border':1, 'threshold':0.02*scale }) + , (Drawing, 'metal8', { 'color':'Blue' , 'pattern':'poids4.8' , 'border':1, 'threshold':0.02*scale }) # Cuts (VIA holes). , (Group , 'Cuts (VIA holes)') @@ -172,14 +174,14 @@ stylesTable = \ # Blockages. , (Group , 'Blockages') - , (Drawing, 'blockage1', { 'color':'Blue' , 'pattern':'light_antislash0.8', 'threshold':0.80*scale, 'border':2 }) - , (Drawing, 'blockage2', { 'color':'Aqua' , 'pattern':'poids4.8' , 'threshold':0.80*scale, 'border':2 }) - , (Drawing, 'blockage3', { 'color':'LightPink', 'pattern':'poids4.8' , 'threshold':0.80*scale, 'border':2 }) - , (Drawing, 'blockage4', { 'color':'Green' , 'pattern':'poids4.8' , 'threshold':0.80*scale, 'border':2 }) - , (Drawing, 'blockage5', { 'color':'Yellow' , 'pattern':'poids4.8' , 'threshold':0.80*scale, 'border':2 }) - , (Drawing, 'blockage6', { 'color':'Violet' , 'pattern':'poids4.8' , 'threshold':0.80*scale, 'border':2 }) - , (Drawing, 'blockage7', { 'color':'Red' , 'pattern':'poids4.8' , 'threshold':0.80*scale, 'border':2 }) - , (Drawing, 'blockage8', { 'color':'Blue' , 'pattern':'poids4.8' , 'threshold':0.80*scale, 'border':2 }) + , (Drawing, 'blockage1', { 'color':'Blue' , 'pattern':'light_antislash0.8', 'threshold':0.80*scale, 'border':4 }) + , (Drawing, 'blockage2', { 'color':'Aqua' , 'pattern':'poids4.8' , 'threshold':0.80*scale, 'border':4 }) + , (Drawing, 'blockage3', { 'color':'LightPink', 'pattern':'poids4.8' , 'threshold':0.80*scale, 'border':4 }) + , (Drawing, 'blockage4', { 'color':'Green' , 'pattern':'poids4.8' , 'threshold':0.80*scale, 'border':4 }) + , (Drawing, 'blockage5', { 'color':'Yellow' , 'pattern':'poids4.8' , 'threshold':0.80*scale, 'border':4 }) + , (Drawing, 'blockage6', { 'color':'Violet' , 'pattern':'poids4.8' , 'threshold':0.80*scale, 'border':4 }) + , (Drawing, 'blockage7', { 'color':'Red' , 'pattern':'poids4.8' , 'threshold':0.80*scale, 'border':4 }) + , (Drawing, 'blockage8', { 'color':'Blue' , 'pattern':'poids4.8' , 'threshold':0.80*scale, 'border':4 }) # Knick & Kite. , (Group , 'Knick & Kite') @@ -188,6 +190,7 @@ stylesTable = \ , (Drawing, 'gmetalh' , { 'color':'128,255,200', 'pattern':'antislash2.32' , 'border':1 }) , (Drawing, 'gmetalv' , { 'color':'200,200,255', 'pattern':'light_antihash1.8', 'border':1 }) , (Drawing, 'gcut' , { 'color':'255,255,190', 'border':1 }) + , (Drawing, 'gcell' , { 'color':'255,255,190', 'pattern':'0000000000000000', 'border':4 }) ) # ---------------------------------------------------------------------- @@ -320,12 +323,13 @@ stylesTable = \ # Group: Routing Layers. , (Group , 'Routing Layers') - , (Drawing, 'metal1', { 'color':'Blue' , 'pattern':'slash.32' , 'border':1, 'threshold':0.02*scale }) - , (Drawing, 'metal2', { 'color':'Aqua' , 'pattern':'antislash2.32', 'border':1, 'threshold':0.02*scale }) - , (Drawing, 'metal3', { 'color':'LightPink', 'pattern':'antislash3.32', 'border':1, 'threshold':0.02*scale }) - , (Drawing, 'metal4', { 'color':'Green' , 'pattern':'antislash4.32', 'border':1, 'threshold':0.02*scale }) - , (Drawing, 'metal5', { 'color':'Yellow' , 'pattern':'antislash5.32', 'border':1, 'threshold':0.02*scale }) - , (Drawing, 'metal6', { 'color':'Violet' , 'pattern':'antislash2.32', 'border':1, 'threshold':0.02*scale }) + , (Drawing, 'metal1', { 'color':'Blue' , 'pattern':'slash.32' , 'border':1, 'threshold':0.02*scale }) + , (Drawing, 'metal2', { 'color':'Aqua' , 'pattern':'antislash2.32', 'border':1, 'threshold':0.02*scale }) + , (Drawing, 'metcap', { 'color':'DarkTurquoise', 'pattern':'poids2.32' , 'border':2, 'threshold':0.02*scale }) + , (Drawing, 'metal3', { 'color':'LightPink' , 'pattern':'antislash3.32', 'border':1, 'threshold':0.02*scale }) + , (Drawing, 'metal4', { 'color':'Green' , 'pattern':'antislash4.32', 'border':1, 'threshold':0.02*scale }) + , (Drawing, 'metal5', { 'color':'Yellow' , 'pattern':'antislash5.32', 'border':1, 'threshold':0.02*scale }) + , (Drawing, 'metal6', { 'color':'Violet' , 'pattern':'antislash2.32', 'border':1, 'threshold':0.02*scale }) # Group: Cuts (VIA holes) , (Group , 'Cuts (VIA holes)') @@ -359,5 +363,6 @@ stylesTable = \ , (Drawing, 'gmetalh' , { 'color':'128,255,200', 'pattern':'light_antihash0.8' , 'border':1 }) , (Drawing, 'gmetalv' , { 'color':'200,200,255', 'pattern':'light_antihash1.8' , 'border':1 }) , (Drawing, 'gcut' , { 'color':'255,255,190', 'border':1 }) + , (Drawing, 'gcell' , { 'color':'255,255,190', 'pattern':'0000000000000000', 'border':4 }) ) ) diff --git a/crlcore/etc/common/misc.conf b/crlcore/etc/common/misc.conf index 921da0ba..cea63434 100644 --- a/crlcore/etc/common/misc.conf +++ b/crlcore/etc/common/misc.conf @@ -7,7 +7,8 @@ parametersTable = \ , ('misc.logMode' , TypeBool, False) , ('misc.verboseLevel1', TypeBool, True ) , ('misc.verboseLevel2', TypeBool, False) - , ('misc.traceLevel' , TypeInt , 1000, {'min':0} ) + , ('misc.minTraceLevel', TypeInt , 0, {'min':0} ) + , ('misc.maxTraceLevel', TypeInt , 0, {'min':0} ) , ("viewer.printer.mode", TypeEnumerate ,1 , { 'values':( ("Cell Mode" , 1) @@ -58,7 +59,8 @@ layoutTable = \ , (TypeOption, 'misc.verboseLevel2' , 'Very Verbose' , 0) , (TypeOption, 'misc.info' , 'Show Info' , 0) , (TypeOption, 'misc.logMode' , 'Output is a TTY' , 0) - , (TypeOption, 'misc.traceLevel' , 'Trace Level' , 1) + , (TypeOption, 'misc.minTraceLevel' , 'Min. Trace Level' , 1) + , (TypeOption, 'misc.maxTraceLevel' , 'Max. Trace Level' , 1) , (TypeTitle , 'Print/Snapshot Parameters') , (TypeOption, 'viewer.printer.mode' , 'Printer/Snapshot Mode', 1) , (TypeOption, 'viewer.printer.paper', 'Paper Size' , 0) diff --git a/crlcore/etc/common/patterns.conf b/crlcore/etc/common/patterns.conf index ffb8f7b6..5a789783 100644 --- a/crlcore/etc/common/patterns.conf +++ b/crlcore/etc/common/patterns.conf @@ -1,7 +1,16 @@ # -*- Mode:Python; explicit-buffer-name: "patterns.conf" -*- -patternsTable = ( { 'name':'slash.8' , 'bits':[ ' X X' +patternsTable = ( { 'name':'crux.8' , 'bits':[ ' ' + , ' X ' + , ' X ' + , ' XXXXX ' + , ' X ' + , ' X ' + , ' ' + , ' ' ] } + + , { 'name':'slash.8' , 'bits':[ ' X X' , ' X X ' , ' X X ' , 'X X ' diff --git a/crlcore/etc/common/technology.conf b/crlcore/etc/common/technology.conf index 7814e731..42c7349d 100644 --- a/crlcore/etc/common/technology.conf +++ b/crlcore/etc/common/technology.conf @@ -40,6 +40,7 @@ realLayersTable = \ , ('metal1' , BasicLayer.Material.metal ) # WARNING: order *is* meaningful. , ('cut1' , BasicLayer.Material.cut ) , ('metal2' , BasicLayer.Material.metal ) + , ('metcap' , BasicLayer.Material.other ) , ('cut2' , BasicLayer.Material.cut ) , ('metal3' , BasicLayer.Material.metal ) , ('cut3' , BasicLayer.Material.cut ) @@ -96,6 +97,8 @@ symbolicLayersTable = \ , ('POLY2' , TypeRegular , ('poly2' ,)) , ('METAL1' , TypeRegular , ('metal1' ,)) , ('METAL2' , TypeRegular , ('metal2' ,)) + , ('metcapdum' , TypeRegular , ('metcap' ,)) + , ('metbot' , TypeRegular , ('metal2' ,)) , ('METAL3' , TypeRegular , ('metal3' ,)) , ('METAL4' , TypeRegular , ('metal4' ,)) , ('METAL5' , TypeRegular , ('metal5' ,)) @@ -109,6 +112,7 @@ symbolicLayersTable = \ , ('CONT_POLY' , TypeVia , ( 'poly' , 'cut0', 'metal1')) , ('VIA12' , TypeVia , ( 'metal1', 'cut1', 'metal2')) , ('VIA23' , TypeVia , ( 'metal2', 'cut2', 'metal3')) + , ('VIA23cap' , TypeVia , ( 'metcap', 'cut2', 'metal3')) , ('VIA34' , TypeVia , ( 'metal3', 'cut3', 'metal4')) , ('VIA45' , TypeVia , ( 'metal4', 'cut4', 'metal5')) , ('VIA56' , TypeVia , ( 'metal5', 'cut5', 'metal6')) @@ -126,7 +130,7 @@ symbolicLayersTable = \ ) -# Format of : +# Format of : # This is a simple list of Real & Symbolic layers. workingLayersTable = \ @@ -135,5 +139,5 @@ workingLayersTable = \ , 'METAL1' , 'METAL2' , 'METAL3' , 'METAL4' , 'METAL5' , 'METAL6' , 'METAL7' , 'METAL8' , 'BLOCKAGE1', 'BLOCKAGE2', 'BLOCKAGE3', 'BLOCKAGE4', 'BLOCKAGE5', 'BLOCKAGE6', 'BLOCKAGE7', 'BLOCKAGE8' , 'VIA12' , 'VIA23' , 'VIA34' , 'VIA45' , 'VIA56' - , 'gcut', 'gmetalh', 'gmetalv', 'gcontact' + , 'gcut' , 'gmetalh' , 'gmetalv' , 'gcontact' ] diff --git a/crlcore/etc/ispd05/kite.conf b/crlcore/etc/ispd05/kite.conf index e230a7de..fc0815b0 100644 --- a/crlcore/etc/ispd05/kite.conf +++ b/crlcore/etc/ispd05/kite.conf @@ -25,18 +25,18 @@ parametersTable = \ # Format of routingGaugesTable (dictionary): # A list of entry of the form: -# ( METAL_NAME, (Direction, Type, depth, density, offset, pitch, wire_width, via_width) ) +# ( METAL_NAME, (Direction, Type, depth, density, offset, pitch, wire_width, via_width, obs_dw) ) routingGaugesTable = {} routingGaugesTable['sxlib'] = \ - ( ( 'METAL1', ( Gauge.Vertical , Gauge.PinOnly, 0, 0.0, 0, 5, 2, 1 ) ) - , ( 'METAL2', ( Gauge.Horizontal, Gauge.Default, 1, 7.0, 0, 5, 2, 1 ) ) - , ( 'METAL3', ( Gauge.Vertical , Gauge.Default, 2, 0.0, 0, 5, 2, 1 ) ) - , ( 'METAL4', ( Gauge.Horizontal, Gauge.Default, 3, 0.0, 0, 5, 2, 1 ) ) - , ( 'METAL5', ( Gauge.Vertical , Gauge.Default, 4, 0.0, 0, 5, 2, 1 ) ) - #, ( 'METAL6', ( Gauge.Horizontal, Gauge.Default, 5, 0.0, 0, 5, 2, 1 ) ) - #, ( 'METAL7', ( Gauge.Vertical , Gauge.Default, 6, 0.0, 0, 5, 2, 1 ) ) + ( ( 'METAL1', ( Gauge.Vertical , Gauge.PinOnly, 0, 0.0, 0, 5, 2, 1, 4 ) ) + , ( 'METAL2', ( Gauge.Horizontal, Gauge.Default, 1, 7.0, 0, 5, 2, 1, 4 ) ) + , ( 'METAL3', ( Gauge.Vertical , Gauge.Default, 2, 0.0, 0, 5, 2, 1, 4 ) ) + , ( 'METAL4', ( Gauge.Horizontal, Gauge.Default, 3, 0.0, 0, 5, 2, 1, 4 ) ) + , ( 'METAL5', ( Gauge.Vertical , Gauge.Default, 4, 0.0, 0, 5, 2, 1, 4 ) ) + #, ( 'METAL6', ( Gauge.Horizontal, Gauge.Default, 5, 0.0, 0, 5, 2, 1, 4 ) ) + #, ( 'METAL7', ( Gauge.Vertical , Gauge.Default, 6, 0.0, 0, 5, 2, 1, 4 ) ) ) diff --git a/crlcore/etc/ispd05/stratus1.conf b/crlcore/etc/ispd05/stratus1.conf index 8b434647..b4e6e23a 100644 --- a/crlcore/etc/ispd05/stratus1.conf +++ b/crlcore/etc/ispd05/stratus1.conf @@ -5,9 +5,7 @@ import helpers # Status1 parameters. parametersTable = \ - ( ("stratus1.mappingName", TypeString, helpers.sysConfDir+"/stratus2sxlib.xml", - { 'flags':Cfg.Parameter.Flags.NeedRestart|Cfg.Parameter.Flags.MustExist } ) - , ("stratus1.format" , TypeString, "vst") + ( ("stratus1.format" , TypeString, "vst") , ("stratus1.simulator" , TypeString, "asimut") ,) diff --git a/crlcore/etc/scmos_deep_018/alliance.conf b/crlcore/etc/scmos_deep_018/alliance.conf index c8076079..32c1b9a8 100644 --- a/crlcore/etc/scmos_deep_018/alliance.conf +++ b/crlcore/etc/scmos_deep_018/alliance.conf @@ -11,7 +11,7 @@ cellsTop = allianceTop+'/cells' allianceConfig = \ ( ( 'CATALOG' , 'CATAL') , ( 'WORKING_LIBRARY' , '.') - , ( 'SYSTEM_LIBRARY' , ( (cellsTop+'/msxlib' , Environment.Append) + , ( 'SYSTEM_LIBRARY' , ( (cellsTop+'/nsxlib' , Environment.Append) , (cellsTop+'/mpxlib' , Environment.Append)) ) , ( 'SCALE_X' , 100) , ( 'IN_LO' , 'vst') diff --git a/crlcore/etc/scmos_deep_018/kite.conf b/crlcore/etc/scmos_deep_018/kite.conf index bcf416b7..30300c3c 100644 --- a/crlcore/etc/scmos_deep_018/kite.conf +++ b/crlcore/etc/scmos_deep_018/kite.conf @@ -25,17 +25,17 @@ parametersTable = \ # Format of routingGaugesTable (dictionary): # A list of entry of the form: -# ( METAL_NAME, (Direction, Type, depth, density, offset, pitch, wire_width, via_width) ) +# ( METAL_NAME, (Direction, Type, depth, density, offset, pitch, wire_width, via_width, obs_dw) ) routingGaugesTable = {} routingGaugesTable['msxlib'] = \ - ( ( 'METAL1' , ( Gauge.Vertical , Gauge.PinOnly, 0, 0.0, 0, 10, 2, 2 ) ) - , ( 'METAL2' , ( Gauge.Horizontal, Gauge.Default, 1, 0.0, 0, 10, 3, 2 ) ) - , ( 'METAL3' , ( Gauge.Vertical , Gauge.Default, 2, 0.0, 0, 10, 3, 2 ) ) - , ( 'METAL4' , ( Gauge.Horizontal, Gauge.Default, 3, 0.0, 0, 10, 3, 2 ) ) - , ( 'METAL5' , ( Gauge.Vertical , Gauge.Default, 4, 0.0, 0, 10, 3, 2 ) ) - #, ( 'METAL6' , ( Gauge.Horizontal, Gauge.Default, 5, 0.0, 0, 10, 5, 2 ) ) + ( ( 'METAL1' , ( Gauge.Vertical , Gauge.PinOnly, 0, 0.0, 0, 10, 2, 2, 7 ) ) + , ( 'METAL2' , ( Gauge.Horizontal, Gauge.Default, 1, 0.0, 0, 10, 3, 2, 8 ) ) + , ( 'METAL3' , ( Gauge.Vertical , Gauge.Default, 2, 0.0, 0, 10, 3, 2, 8 ) ) + , ( 'METAL4' , ( Gauge.Horizontal, Gauge.Default, 3, 0.0, 0, 10, 3, 2, 8 ) ) + , ( 'METAL5' , ( Gauge.Vertical , Gauge.Default, 4, 0.0, 0, 10, 3, 2, 8 ) ) + #, ( 'METAL6' , ( Gauge.Horizontal, Gauge.Default, 5, 0.0, 0, 10, 5, 2, 8 ) ) ) diff --git a/crlcore/etc/scmos_deep_018/plugins.conf b/crlcore/etc/scmos_deep_018/plugins.conf index 5b16ad52..a704c0ed 100644 --- a/crlcore/etc/scmos_deep_018/plugins.conf +++ b/crlcore/etc/scmos_deep_018/plugins.conf @@ -22,6 +22,6 @@ parametersTable = \ , ('chip.pad.pvddeck' , TypeString, 'pvddeck_mpx') , ('chip.pad.pvsseck' , TypeString, 'pvsseck_mpx') , ('clockTree.minimumSide' , TypeInt , 1000) - , ('clockTree.buffer' , TypeString, 'bf1_x4') + , ('clockTree.buffer' , TypeString, 'buf_x2') , ('clockTree.placerEngine' , TypeString, 'Etesian') ) diff --git a/crlcore/etc/scmos_deep_018/stratus1.conf b/crlcore/etc/scmos_deep_018/stratus1.conf index 338bc34c..4f4ce74d 100644 --- a/crlcore/etc/scmos_deep_018/stratus1.conf +++ b/crlcore/etc/scmos_deep_018/stratus1.conf @@ -5,9 +5,7 @@ import helpers # Status1 parameters. parametersTable = \ - ( ("stratus1.mappingName", TypeString, helpers.sysConfDir+"/stratus2sxlib.xml", - { 'flags':Cfg.Parameter.Flags.NeedRestart|Cfg.Parameter.Flags.MustExist } ) - , ("stratus1.format" , TypeString, "vst") + ( ("stratus1.format" , TypeString, "vst") , ("stratus1.simulator" , TypeString, "asimut") ,) diff --git a/crlcore/etc/scmos_deep_018/technology.conf b/crlcore/etc/scmos_deep_018/technology.conf index c447d50e..059d339b 100644 --- a/crlcore/etc/scmos_deep_018/technology.conf +++ b/crlcore/etc/scmos_deep_018/technology.conf @@ -60,7 +60,7 @@ symbolicRulesTable = \ , ('NTRANS.nImplant.extention.cap' , 2.0) , ('NTRANS.nImplant.extention.width' , 7.0) , ('NTRANS.active.extention.cap' , 0.0) - , ('NTRANS.active.extention.width' , 4.0) + , ('NTRANS.active.extention.width' , 3.0) , ('NTRANS.poly.extention.cap' , 3.0) , ('NTRANS.poly.extention.width' , 0.0) @@ -70,7 +70,7 @@ symbolicRulesTable = \ , ('PTRANS.pImplant.extention.cap' , 2.0) , ('PTRANS.pImplant.extention.width' , 7.0) , ('PTRANS.active.extention.cap' , 0.0) - , ('PTRANS.active.extention.width' , 4.0) + , ('PTRANS.active.extention.width' , 3.0) , ('PTRANS.poly.extention.cap' , 3.0) , ('PTRANS.poly.extention.width' , 0.0) diff --git a/crlcore/etc/techno.conf b/crlcore/etc/techno.conf index 4eae5fc1..67f51417 100644 --- a/crlcore/etc/techno.conf +++ b/crlcore/etc/techno.conf @@ -1,4 +1,4 @@ # -*- Mode:Python -*- symbolicTechno = 'cmos' -realTechno = 'hcmos9gp' +realTechno = '130/hcmos9gp' diff --git a/crlcore/etc/vsc200/kite.conf b/crlcore/etc/vsc200/kite.conf index d339882f..8b756b7c 100644 --- a/crlcore/etc/vsc200/kite.conf +++ b/crlcore/etc/vsc200/kite.conf @@ -25,18 +25,18 @@ parametersTable = \ # Format of routingGaugesTable (dictionary): # A list of entry of the form: -# ( METAL_NAME, (Direction, Type, depth, density, offset, pitch, wire_width, via_width) ) +# ( METAL_NAME, (Direction, Type, depth, density, offset, pitch, wire_width, via_width, obs_dw) ) routingGaugesTable = {} routingGaugesTable['vsclib'] = \ - ( ( 'METAL1', ( Gauge.Vertical , Gauge.PinOnly, 0, 0.0, 4, 8, 3, 2 ) ) - , ( 'METAL2', ( Gauge.Horizontal, Gauge.Default, 1, 7.0, 0, 8, 4, 2 ) ) - , ( 'METAL3', ( Gauge.Vertical , Gauge.Default, 2, 0.0, 4, 8, 4, 2 ) ) - , ( 'METAL4', ( Gauge.Horizontal, Gauge.Default, 3, 0.0, 0, 8, 4, 2 ) ) - , ( 'METAL5', ( Gauge.Vertical , Gauge.Default, 4, 0.0, 4, 8, 4, 2 ) ) - #, ( 'METAL6', ( Gauge.Horizontal, Gauge.Default, 5, 0.0, 0, 8, 4, 2 ) ) - #, ( 'METAL7', ( Gauge.Vertical , Gauge.Default, 6, 0.0, 4, 8, 4, 2 ) ) + ( ( 'METAL1', ( Gauge.Vertical , Gauge.PinOnly, 0, 0.0, 4, 8, 3, 2, 6.5 ) ) + , ( 'METAL2', ( Gauge.Horizontal, Gauge.Default, 1, 7.0, 0, 8, 4, 2, 6 ) ) + , ( 'METAL3', ( Gauge.Vertical , Gauge.Default, 2, 0.0, 4, 8, 4, 2, 6 ) ) + , ( 'METAL4', ( Gauge.Horizontal, Gauge.Default, 3, 0.0, 0, 8, 4, 2, 6 ) ) + , ( 'METAL5', ( Gauge.Vertical , Gauge.Default, 4, 0.0, 4, 8, 4, 2, 6 ) ) + #, ( 'METAL6', ( Gauge.Horizontal, Gauge.Default, 5, 0.0, 0, 8, 4, 2, 6 ) ) + #, ( 'METAL7', ( Gauge.Vertical , Gauge.Default, 6, 0.0, 4, 8, 4, 2, 6 ) ) ) diff --git a/crlcore/etc/vsc200/stratus1.conf b/crlcore/etc/vsc200/stratus1.conf index 2237bee5..126b291a 100644 --- a/crlcore/etc/vsc200/stratus1.conf +++ b/crlcore/etc/vsc200/stratus1.conf @@ -5,9 +5,7 @@ import helpers # Status1 parameters. parametersTable = \ - ( ("stratus1.mappingName", TypeString, helpers.sysConfDir+"/stratus2sxlib.xml", - { 'flags':Cfg.Parameter.Flags.NeedRestart|Cfg.Parameter.Flags.MustExist } ) - , ("stratus1.format" , TypeString, "vst") + ( ("stratus1.format" , TypeString, "vst") , ("stratus1.simulator" , TypeString, "asimut") ,) diff --git a/crlcore/python/coriolisInit.py b/crlcore/python/coriolisInit.py index 0cc65a0c..11b243f5 100644 --- a/crlcore/python/coriolisInit.py +++ b/crlcore/python/coriolisInit.py @@ -160,4 +160,14 @@ def coriolisConfigure(): #sys.stdout.write(CRL.AllianceFramework.get().getEnvironment().getPrint()) + if Cfg.getParamString('stratus1.mappingName').asString() == 'not_set': + vendorTech = helpers.realTechno.split('/')[-1] + mappingFile = os.path.join( helpers.realDir, 'stratus.xml' ) + if not os.path.isfile(mappingFile): + mappingFile = os.path.join( helpers.sysConfDir, 'stratus2sxlib.xml' ) + + parameter = Cfg.getParamString('stratus1.mappingName') + parameter.setString( mappingFile ) + parameter.flags = Cfg.Parameter.Flags.NeedRestart|Cfg.Parameter.Flags.MustExist + return diff --git a/crlcore/python/helpers/Alliance.py b/crlcore/python/helpers/Alliance.py index bd17d397..1a196ef1 100644 --- a/crlcore/python/helpers/Alliance.py +++ b/crlcore/python/helpers/Alliance.py @@ -1,7 +1,7 @@ # -*- Mode:Python; explicit-buffer-name: "Alliance.py" -*- # # This file is part of the Coriolis Software. -# Copyright (c) UPMC 2012-2015, All Rights Reserved +# Copyright (c) UPMC 2012-2016, All Rights Reserved # # +-----------------------------------------------------------------+ # | C O R I O L I S | @@ -152,10 +152,10 @@ def loadRoutingGaugesTable ( routingGaugesTable, fromFile ): ,'Must have exactly two fields ("METAL_LAYER", (parameters_list)).' ,str(entry) ]) - if len(entry[1]) != 8: + if len(entry[1]) != 9: raise ErrorMessage(1,['Malformed entry in .' % gaugeName - ,'Parameters list must have exactly eight fields:' - ,' (direction, type, depth, density, offset, pitch, wire_width, via_width)' + ,'Parameters list must have exactly nine fields:' + ,' (direction, type, depth, density, offset, pitch, wire_width, via_width, obs_dw)' ,str(entry) ]) @@ -168,6 +168,7 @@ def loadRoutingGaugesTable ( routingGaugesTable, fromFile ): , DbU.fromLambda(entry[1][5]) # Pitch. , DbU.fromLambda(entry[1][6]) # Wire width. , DbU.fromLambda(entry[1][7]) # Via width. + , DbU.fromLambda(entry[1][8]) # Obstacle dW. ) ) except Exception, e: diff --git a/crlcore/python/helpers/Display.py b/crlcore/python/helpers/Display.py index 2941f3db..adb28d16 100644 --- a/crlcore/python/helpers/Display.py +++ b/crlcore/python/helpers/Display.py @@ -17,28 +17,29 @@ displayFile = '' stdColors = \ - { 'Black' : '0,0,0' - , 'Gray50' : '050,050,050' - , 'Gray238' : '238,238,238' - , 'White' : '255,255,255' - , 'Seashell4' : '139,134,130' - , 'Red' : '255,0,0' # Shade of Reds. - , 'OrangeRed' : "255,69,0" - , 'DarkOrange' : "255,140,0" - , 'Orange' : "255,165,0" - , 'Wheat' : "245,222,179" - , 'LightPink' : '255,182,193' - , 'Green' : '0,255,0' # Shade of Green. - , 'LawnGreen' : '124,252,0' - , 'Blue' : '0,0,255' # Shade of Blue. - , 'Aqua' : '0,255,255' - , 'BlueViolet' : '138,43,226' - , 'Violet' : '238;130;238' # Shade of Violets. - , 'Magenta' : '255,0,255' - , 'Magenta4' : '139,0,139' - , 'Tan' : '210,180,140' # Shade of Browns - , 'Yellow' : '255,255,0' # Shade of Yellows. - , 'LightYellow' : '255,255,224' + { 'Black' : '0,0,0' + , 'Gray50' : '050,050,050' + , 'Gray238' : '238,238,238' + , 'White' : '255,255,255' + , 'Seashell4' : '139,134,130' + , 'Red' : '255,0,0' # Shade of Reds. + , 'OrangeRed' : "255,69,0" + , 'DarkOrange' : "255,140,0" + , 'Orange' : "255,165,0" + , 'Wheat' : "245,222,179" + , 'LightPink' : '255,182,193' + , 'Green' : '0,255,0' # Shade of Green. + , 'LawnGreen' : '124,252,0' + , 'Blue' : '0,0,255' # Shade of Blue. + , 'Aqua' : '0,255,255' + , 'DarkTurquoise' : '0,206,209' + , 'BlueViolet' : '138,43,226' + , 'Violet' : '238;130;238' # Shade of Violets. + , 'Magenta' : '255,0,255' + , 'Magenta4' : '139,0,139' + , 'Tan' : '210,180,140' # Shade of Browns + , 'Yellow' : '255,255,0' # Shade of Yellows. + , 'LightYellow' : '255,255,224' } diff --git a/crlcore/python/helpers/__init__.py b/crlcore/python/helpers/__init__.py index 7e223455..f437de58 100644 --- a/crlcore/python/helpers/__init__.py +++ b/crlcore/python/helpers/__init__.py @@ -1,14 +1,14 @@ # -*- mode:Python; explicit-buffer-name: "__init__.py" -*- # # This file is part of the Coriolis Software. -# Copyright (c) UPMC 2012-2015, All Rights Reserved +# Copyright (c) UPMC 2012-2016, All Rights Reserved # # +-----------------------------------------------------------------+ # | C O R I O L I S | # | C o r i o l i s / C h a m s B u i l d e r | # | | # | Author : Jean-Paul Chaput | -# | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +# | E-mail : Jean-Paul.Chaput@lip6.fr | # | =============================================================== | # | Python : "./crlcore/__init__.py" | # +-----------------------------------------------------------------+ @@ -26,9 +26,10 @@ import traceback import Hurricane sysConfDir = None +ndaConfDir = None symbolicTechno = 'cmos' symbolicDir = None -realTechno = 'hcmos9gp' +realTechno = '130/hcmos9gp' realDir = None tab = None _trace = None @@ -246,6 +247,7 @@ def setTraceLevel ( level ): def initTechno ( quiet ): + global ndaConfDir global realDir global realTechno global symbolicDir @@ -265,14 +267,19 @@ def initTechno ( quiet ): if moduleGlobals.has_key('symbolicTechnology'): symbolicTechno = symbolicTechnology else: - print '[WARNING] The symbolic technology name is not set. Using .' + print '[WARNING] The symbolic technology name is not set. Using <%s>.' % symbolicTechno if moduleGlobals.has_key('realTechnology'): realTechno = realTechnology else: - print '[WARNING] The real technology name is not set. Using .' + print '[WARNING] The real technology name is not set. Using <%s>.' % realTechno + + if moduleGlobals.has_key('NdaDirectory'): + ndaConfDir = os.path.join( NdaDirectory, 'etc/coriolis2' ) + else: + ndaConfDir = sysConfDir symbolicDir = os.path.join( sysConfDir, symbolicTechno ) - realDir = os.path.join( sysConfDir, realTechno ) + realDir = os.path.join( ndaConfDir, realTechno ) if not quiet: print ' - Technologies: %s+%s.' % (symbolicTechno,realTechno) diff --git a/crlcore/python/helpers/misc.py b/crlcore/python/helpers/misc.py index fb51b6b5..405b7d5c 100644 --- a/crlcore/python/helpers/misc.py +++ b/crlcore/python/helpers/misc.py @@ -11,9 +11,12 @@ Cfg.getParamBool("misc.bug" ).setBool(False) Cfg.getParamBool("misc.logMode" ).setBool(True ) Cfg.getParamBool("misc.verboseLevel1").setBool(True ) Cfg.getParamBool("misc.verboseLevel2").setBool(False) -Cfg.getParamInt ("misc.traceLevel" ).setInt (1000 ) -param = Cfg.getParamInt ("misc.traceLevel") +Cfg.getParamInt ("misc.minTraceLevel").setInt (0 ) +Cfg.getParamInt ("misc.maxTraceLevel").setInt (0 ) +param = Cfg.getParamInt ("misc.minTraceLevel") param.setMin(0) +param = Cfg.getParamInt ("misc.maxTraceLevel") +param.setMax(0) # Misc. tab layout. layout = Cfg.Configuration.get().getLayout() @@ -26,4 +29,5 @@ layout.addParameter ( "Misc.", "misc.info" , "Show Infos" , 0 ) layout.addParameter ( "Misc.", "misc.paranoid" , "Show Everything" , 0 ) layout.addParameter ( "Misc.", "misc.bug" , "Show Bugs" , 0 ) layout.addParameter ( "Misc.", "misc.logMode" , "Output is a TTY" , 0 ) -layout.addParameter ( "Misc.", "misc.traceLevel" , "Trace Level" , 1 ) +layout.addParameter ( "Misc.", "misc.minTraceLevel", "Min. Trace Level", 1 ) +layout.addParameter ( "Misc.", "misc.maxTraceLevel", "Max. Trace Level", 1 ) diff --git a/crlcore/src/LibraryManager/CellDatas.cpp b/crlcore/src/LibraryManager/CellDatas.cpp index c729dca1..0243ce8c 100644 --- a/crlcore/src/LibraryManager/CellDatas.cpp +++ b/crlcore/src/LibraryManager/CellDatas.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2015-2015, All Rights Reserved +// Copyright (c) UPMC 2015-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/crlcore/src/LibraryManager/CellsModel.cpp b/crlcore/src/LibraryManager/CellsModel.cpp index 12410cb4..44305193 100644 --- a/crlcore/src/LibraryManager/CellsModel.cpp +++ b/crlcore/src/LibraryManager/CellsModel.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2015-2015, All Rights Reserved +// Copyright (c) UPMC 2015-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -226,6 +226,7 @@ namespace CRL { Catalog* catalog = AllianceFramework::get()->getCatalog(); CellLoaders* loaders = CellLoaders::get(); + getCellsDatas().clear(); forEach ( Cell*, icell, library->getLibrary()->getCells() ) { CellDatas* datas = new CellDatas(*icell); getCellsDatas().push_back( datas ); @@ -245,6 +246,7 @@ namespace CRL { CellDatas* key = new CellDatas( cellName ); auto idatas = lower_bound( getCellsDatas().begin(), getCellsDatas().end(), key, LessCellDatas ); + if ( (idatas == getCellsDatas().end()) or ((*idatas)->getName() != cellName ) ) { getCellsDatas().push_back( key ); diff --git a/crlcore/src/LibraryManager/CellsWidget.cpp b/crlcore/src/LibraryManager/CellsWidget.cpp index b181039b..81ccb6ba 100644 --- a/crlcore/src/LibraryManager/CellsWidget.cpp +++ b/crlcore/src/LibraryManager/CellsWidget.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2015-2015, All Rights Reserved +// Copyright (c) UPMC 2015-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -86,6 +86,10 @@ namespace CRL { } + void CellsWidget::updateLibrary () + { _baseModel->updateLibrary(); } + + void CellsWidget::updateSelected () { if (_selected.isValid()) _baseModel->emitDataChanged(_selected); } diff --git a/crlcore/src/LibraryManager/LibrariesModel.cpp b/crlcore/src/LibraryManager/LibrariesModel.cpp index 326942e8..3f667de5 100644 --- a/crlcore/src/LibraryManager/LibrariesModel.cpp +++ b/crlcore/src/LibraryManager/LibrariesModel.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2015-2015, All Rights Reserved +// Copyright (c) UPMC 2015-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -24,6 +24,7 @@ namespace CRL { + using namespace std; using Hurricane::Graphics; @@ -37,6 +38,10 @@ namespace CRL { { } + void LibrariesModel::update () + { emit layoutChanged(); } + + QVariant LibrariesModel::data ( const QModelIndex& index, int role ) const { static QFont nameFont = Graphics::getFixedFont( QFont::Bold ); diff --git a/crlcore/src/LibraryManager/LibrariesWidget.cpp b/crlcore/src/LibraryManager/LibrariesWidget.cpp index 8726461e..331f984d 100644 --- a/crlcore/src/LibraryManager/LibrariesWidget.cpp +++ b/crlcore/src/LibraryManager/LibrariesWidget.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2015-2015, All Rights Reserved +// Copyright (c) UPMC 2015-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -75,6 +75,10 @@ namespace CRL { } + void LibrariesWidget::update () + { _baseModel->update(); } + + void LibrariesWidget::initSelection () { _view->selectRow( 0 ); } diff --git a/crlcore/src/LibraryManager/LibraryManager.cpp b/crlcore/src/LibraryManager/LibraryManager.cpp index e95c7cb0..2c0bced1 100644 --- a/crlcore/src/LibraryManager/LibraryManager.cpp +++ b/crlcore/src/LibraryManager/LibraryManager.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2015-2015, All Rights Reserved +// Copyright (c) UPMC 2015-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -23,6 +23,7 @@ #include "hurricane/Error.h" #include "hurricane/viewer/Graphics.h" #include "hurricane/viewer/CellViewer.h" +#include "crlcore/AllianceFramework.h" #include "crlcore/LibraryManager.h" #include "crlcore/LibrariesWidget.h" #include "crlcore/CellsWidget.h" @@ -39,13 +40,30 @@ namespace CRL { using Hurricane::Graphics; +// ------------------------------------------------------------------- +// Class : "FrameworkObserver". + + void FrameworkObserver::notify ( unsigned int flags ) + { + LibraryManager* manager = getOwner(); + if (flags & (AllianceFramework::AddedLibrary + |AllianceFramework::RemovedLibrary)) { + manager->getLibrariesWidget()->update(); + } + } + + +// ------------------------------------------------------------------- +// Class : "LibraryManager". + LibraryManager::LibraryManager ( QWidget* parent ) - : QWidget (parent) - , _librariesWidget(new LibrariesWidget()) - , _cellsWidget (new CellsWidget()) - , _viewsWidget (new ViewsWidget()) - , _cellViewer (NULL) - , _libPath (NULL) + : QWidget (parent) + , _frameworkObserver(this) + , _librariesWidget (new LibrariesWidget()) + , _cellsWidget (new CellsWidget()) + , _viewsWidget (new ViewsWidget()) + , _cellViewer (NULL) + , _libPath (NULL) { setObjectName ( "libraryManager" ); setAttribute ( Qt::WA_QuitOnClose, false ); @@ -100,10 +118,18 @@ namespace CRL { _librariesWidget->initSelection(); + AllianceFramework::get()->addObserver( &_frameworkObserver ); + resize( Graphics::toHighDpi(750), Graphics::toHighDpi(550) ); } + LibraryManager::~LibraryManager () + { + AllianceFramework::get()->removeObserver( &_frameworkObserver ); + } + + void LibraryManager::toggleShow () { setVisible( not isVisible() ); } @@ -139,5 +165,8 @@ namespace CRL { } + void LibraryManager::updateLibrary ( Cell* ) + { _cellsWidget->updateLibrary(); } + } // CRL namespace. diff --git a/crlcore/src/LibraryManager/ViewsModel.cpp b/crlcore/src/LibraryManager/ViewsModel.cpp index 51e6c1d1..cf7d3103 100644 --- a/crlcore/src/LibraryManager/ViewsModel.cpp +++ b/crlcore/src/LibraryManager/ViewsModel.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2015-2015, All Rights Reserved +// Copyright (c) UPMC 2015-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/crlcore/src/LibraryManager/ViewsWidget.cpp b/crlcore/src/LibraryManager/ViewsWidget.cpp index 46c90d00..0f634aff 100644 --- a/crlcore/src/LibraryManager/ViewsWidget.cpp +++ b/crlcore/src/LibraryManager/ViewsWidget.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2015-2015, All Rights Reserved +// Copyright (c) UPMC 2015-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/crlcore/src/LibraryManager/crlcore/CellDatas.h b/crlcore/src/LibraryManager/crlcore/CellDatas.h index 9aa07472..b39d89f8 100644 --- a/crlcore/src/LibraryManager/crlcore/CellDatas.h +++ b/crlcore/src/LibraryManager/crlcore/CellDatas.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2015-2015, All Rights Reserved +// Copyright (c) UPMC 2015-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/crlcore/src/LibraryManager/crlcore/CellsModel.h b/crlcore/src/LibraryManager/crlcore/CellsModel.h index 56324b3a..9376bc7e 100644 --- a/crlcore/src/LibraryManager/crlcore/CellsModel.h +++ b/crlcore/src/LibraryManager/crlcore/CellsModel.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2015-2015, All Rights Reserved +// Copyright (c) UPMC 2015-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -60,7 +60,9 @@ namespace CRL { }; - inline const AllianceLibrary* CellsModel::getLibrary () const { return (const AllianceLibrary*)_ilibrary->first; } + inline const AllianceLibrary* CellsModel::getLibrary () const + { return (_ilibrary != _libraries.end()) ? (const AllianceLibrary*)_ilibrary->first : NULL; } + inline const std::vector& CellsModel::getCellsDatas () const { return _ilibrary->second; } inline std::vector& CellsModel::getCellsDatas () { return _ilibrary->second; } diff --git a/crlcore/src/LibraryManager/crlcore/CellsWidget.h b/crlcore/src/LibraryManager/crlcore/CellsWidget.h index 2719e236..f05d7445 100644 --- a/crlcore/src/LibraryManager/crlcore/CellsWidget.h +++ b/crlcore/src/LibraryManager/crlcore/CellsWidget.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2015-2015, All Rights Reserved +// Copyright (c) UPMC 2015-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -47,6 +47,7 @@ namespace CRL { void selectedCell ( CellDatas* ); public slots: void updateSelected (); + void updateLibrary (); void selectCurrent ( const QModelIndex& index, const QModelIndex& ); void setLibrary ( const AllianceLibrary* ); private: diff --git a/crlcore/src/LibraryManager/crlcore/LibrariesModel.h b/crlcore/src/LibraryManager/crlcore/LibrariesModel.h index 3c3ebb6a..35b519fb 100644 --- a/crlcore/src/LibraryManager/crlcore/LibrariesModel.h +++ b/crlcore/src/LibraryManager/crlcore/LibrariesModel.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2015-2015, All Rights Reserved +// Copyright (c) UPMC 2015-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -39,6 +39,7 @@ namespace CRL { QVariant headerData ( int section, Qt::Orientation orientation, int role=Qt::DisplayRole ) const; const AllianceLibrary* getLibrary ( const QModelIndex& ); const AllianceLibrary* getLibrary ( size_t ); + void update (); private: const AllianceLibraries& _libraries; }; diff --git a/crlcore/src/LibraryManager/crlcore/LibrariesWidget.h b/crlcore/src/LibraryManager/crlcore/LibrariesWidget.h index fe05ead4..4e94aee1 100644 --- a/crlcore/src/LibraryManager/crlcore/LibrariesWidget.h +++ b/crlcore/src/LibraryManager/crlcore/LibrariesWidget.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2015-2015, All Rights Reserved +// Copyright (c) UPMC 2015-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -36,12 +36,12 @@ namespace CRL { // ------------------------------------------------------------------- // Class : "LibrariesWidget". - class LibrariesWidget : public QWidget { Q_OBJECT; public: LibrariesWidget ( QWidget* parent=NULL ); void initSelection (); + void update (); signals: void selectedLibrary ( const AllianceLibrary* ); public slots: diff --git a/crlcore/src/LibraryManager/crlcore/LibraryManager.h b/crlcore/src/LibraryManager/crlcore/LibraryManager.h index 50cfbfc5..cd5a9c34 100644 --- a/crlcore/src/LibraryManager/crlcore/LibraryManager.h +++ b/crlcore/src/LibraryManager/crlcore/LibraryManager.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2015-2015, All Rights Reserved +// Copyright (c) UPMC 2015-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -18,6 +18,7 @@ #define CRL_LIBRARY_MANAGER_H #include +#include "hurricane/Observer.h" class QLabel; class QModelIndex; @@ -34,10 +35,29 @@ namespace CRL { using Hurricane::Cell; using Hurricane::CellViewer; + using Hurricane::Observer; class AllianceLibrary; class ViewsWidget; class CellsWidget; class LibrariesWidget; + class LibraryManager; + + +// ------------------------------------------------------------------- +// Class : "FrameworkObserver". + + class FrameworkObserver : public Observer { + public: + inline FrameworkObserver ( LibraryManager* ); + virtual void notify ( unsigned int flags ); + private: + FrameworkObserver ( const FrameworkObserver& ); + }; + + + inline FrameworkObserver::FrameworkObserver ( LibraryManager* owner ) + : Observer(owner) + { } // ------------------------------------------------------------------- @@ -47,24 +67,29 @@ namespace CRL { class LibraryManager : public QWidget { Q_OBJECT; public: - LibraryManager ( QWidget* parent=NULL ); - inline void setCellViewer ( CellViewer* ); - inline CellViewer* getCellViewer () const; - public slots: - void toggleShow (); - void setLibrary ( const AllianceLibrary* library ); - CellViewer* openCell ( Cell*, unsigned int flags ); + LibraryManager ( QWidget* parent=NULL ); + ~LibraryManager (); + inline void setCellViewer ( CellViewer* ); + inline CellViewer* getCellViewer () const; + inline LibrariesWidget* getLibrariesWidget () const; + public slots: + void toggleShow (); + void setLibrary ( const AllianceLibrary* library ); + CellViewer* openCell ( Cell*, unsigned int flags ); + void updateLibrary ( Cell* ); private: - LibrariesWidget* _librariesWidget; - CellsWidget* _cellsWidget; - ViewsWidget* _viewsWidget; - CellViewer* _cellViewer; - QLabel* _libPath; + FrameworkObserver _frameworkObserver; + LibrariesWidget* _librariesWidget; + CellsWidget* _cellsWidget; + ViewsWidget* _viewsWidget; + CellViewer* _cellViewer; + QLabel* _libPath; }; - inline void LibraryManager::setCellViewer ( CellViewer* cw ) { _cellViewer=cw; } - inline CellViewer* LibraryManager::getCellViewer () const { return _cellViewer; } + inline void LibraryManager::setCellViewer ( CellViewer* cw ) { _cellViewer=cw; } + inline CellViewer* LibraryManager::getCellViewer () const { return _cellViewer; } + inline LibrariesWidget* LibraryManager::getLibrariesWidget () const { return _librariesWidget; } } // CRL namespace. diff --git a/crlcore/src/LibraryManager/crlcore/ViewsModel.h b/crlcore/src/LibraryManager/crlcore/ViewsModel.h index 70072a42..83274210 100644 --- a/crlcore/src/LibraryManager/crlcore/ViewsModel.h +++ b/crlcore/src/LibraryManager/crlcore/ViewsModel.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2015-2015, All Rights Reserved +// Copyright (c) UPMC 2015-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/crlcore/src/LibraryManager/crlcore/ViewsWidget.h b/crlcore/src/LibraryManager/crlcore/ViewsWidget.h index a72328ad..38a1a630 100644 --- a/crlcore/src/LibraryManager/crlcore/ViewsWidget.h +++ b/crlcore/src/LibraryManager/crlcore/ViewsWidget.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2015-2015, All Rights Reserved +// Copyright (c) UPMC 2015-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/crlcore/src/ccore/AllianceFramework.cpp b/crlcore/src/ccore/AllianceFramework.cpp index 847517f6..f7701e36 100644 --- a/crlcore/src/ccore/AllianceFramework.cpp +++ b/crlcore/src/ccore/AllianceFramework.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -13,36 +13,37 @@ // | C++ Module : "./AllianceFramework.cpp" | // +-----------------------------------------------------------------+ - -#include -#include "vlsisapd/utilities/Path.h" -#include "hurricane/Warning.h" -#include "hurricane/Technology.h" -#include "hurricane/DataBase.h" -#include "hurricane/Library.h" -#include "hurricane/Cell.h" -#include "hurricane/Instance.h" -#include "hurricane/viewer/Graphics.h" -#include "crlcore/Utilities.h" -#include "crlcore/GraphicsParser.h" -#include "crlcore/SymbolicTechnologyParser.h" -#include "crlcore/RealTechnologyParser.h" -#include "crlcore/CellGauge.h" -#include "crlcore/RoutingGauge.h" -#include "crlcore/RoutingLayerGauge.h" -#include "crlcore/AllianceFramework.h" - - - +#include +#include "vlsisapd/utilities/Path.h" +#include "hurricane/Initializer.h" +#include "hurricane/Warning.h" +#include "hurricane/DataBase.h" +#include "hurricane/Technology.h" +#include "hurricane/Library.h" +#include "hurricane/Cell.h" +#include "hurricane/Instance.h" +#include "hurricane/viewer/Graphics.h" +#include "crlcore/Utilities.h" +#include "crlcore/GraphicsParser.h" +#include "crlcore/SymbolicTechnologyParser.h" +#include "crlcore/RealTechnologyParser.h" +#include "crlcore/CellGauge.h" +#include "crlcore/RoutingGauge.h" +#include "crlcore/RoutingLayerGauge.h" +#include "crlcore/AllianceFramework.h" namespace CRL { - + using namespace std::placeholders; + using Hurricane::Initializer; + using Hurricane::JsonTypes; + using Hurricane::JsonArray; using Hurricane::Warning; using Hurricane::tab; using Hurricane::Graphics; using Hurricane::ForEachIterator; + using Hurricane::getCollection; using Hurricane::Instance; using Hurricane::PrivateProperty; @@ -57,6 +58,8 @@ namespace CRL { static Name getPropertyName (); virtual Name getName () const; inline AllianceFramework* getFramework () const; + virtual bool hasJson () const; + virtual void toJson ( JsonWriter*, const DBo* ) const; virtual string _getTypeName () const; virtual Record* _getRecord () const; private: @@ -64,10 +67,19 @@ namespace CRL { AllianceFramework* _framework; private: inline AllianceFrameworkProperty ( AllianceFramework* ); + public: + class JsonProperty : public JsonObject { + public: + static void initialize (); + JsonProperty ( unsigned long flags ); + virtual string getTypeName () const; + virtual JsonProperty* clone ( unsigned long ) const; + virtual void toData ( JsonStack& ); + }; }; - Name AllianceFrameworkProperty::_name = "AllianceFramework"; + Name AllianceFrameworkProperty::_name = "AllianceFrameworkProperty"; inline AllianceFrameworkProperty::AllianceFrameworkProperty ( AllianceFramework* af ) @@ -111,6 +123,56 @@ namespace CRL { } + bool AllianceFrameworkProperty::hasJson () const + { return true; } + + + void AllianceFrameworkProperty::toJson ( JsonWriter* w, const DBo* ) const + { + w->startObject(); + std::string tname = getString(getPropertyName()); + jsonWrite( w, "@typename" , tname ); + jsonWrite( w, "_framework", _framework ); + w->endObject(); + } + + + Initializer jsonFrameworkPropertyInit ( 20 ); + + + AllianceFrameworkProperty::JsonProperty::JsonProperty ( unsigned long flags ) + : JsonObject(flags) + { + add( "_framework", typeid(AllianceFramework*) ); + } + + + string AllianceFrameworkProperty::JsonProperty::getTypeName () const + { return getString(AllianceFrameworkProperty::getPropertyName()); } + + + void AllianceFrameworkProperty::JsonProperty::initialize () + { JsonTypes::registerType( new JsonProperty (JsonWriter::RegisterMode) ); } + + + AllianceFrameworkProperty::JsonProperty* AllianceFrameworkProperty::JsonProperty::clone ( unsigned long flags ) const + { return new JsonProperty ( flags ); } + + + void AllianceFrameworkProperty::JsonProperty::toData ( JsonStack& stack ) + { + check( stack, "AllianceFrameworkProperty::JsonProperty::toData" ); + + DBo* dbo = stack.back_dbo(); + AllianceFramework* framework = get(stack,"_framework"); + AllianceFrameworkProperty* property + = AllianceFrameworkProperty::create(framework); + if (dbo) dbo->put( property ); + + update( stack, property ); + } + + // ------------------------------------------------------------------- // Class : "CRL::AllianceFramework". @@ -121,18 +183,23 @@ namespace CRL { AllianceFramework::AllianceFramework () - : _environment() - , _parsers() - , _drivers() - , _catalog() - , _parentLibrary(NULL) - , _routingGauges() + : _observers () + , _environment () + , _parsers () + , _drivers () + , _catalog () + , _parentLibrary (NULL) + , _routingGauges () + , _defaultRoutingGauge(NULL) + , _cellGauges () + , _defaultCellGauge (NULL) { DataBase* db = DataBase::getDB (); if ( not db ) db = DataBase::create (); db->put ( AllianceFrameworkProperty::create(this) ); + db->_setCellLoader( bind(&AllianceFramework::cellLoader,this,_1) ); //cmess1 << " o Reading Alliance Environment." << endl; @@ -176,7 +243,7 @@ namespace CRL { void AllianceFramework::_bindLibraries () { DataBase* db = DataBase::getDB (); - unsigned int flags = InSearchPath; + unsigned int flags = AppendLibrary; SearchPath& LIBRARIES = _environment.getLIBRARIES (); Library* rootLibrary = db->getRootLibrary (); @@ -192,7 +259,8 @@ namespace CRL { for ( unsigned i=0 ; i_bindLibraries(); } @@ -217,7 +286,7 @@ namespace CRL { AllianceFramework* AllianceFramework::get () { - return create (); + return create(); } @@ -233,6 +302,18 @@ namespace CRL { } + void AllianceFramework::addObserver ( BaseObserver* observer ) + { _observers.addObserver( observer ); } + + + void AllianceFramework::removeObserver ( BaseObserver* observer ) + { _observers.removeObserver( observer ); } + + + void AllianceFramework::notify ( unsigned flags ) + { _observers.notify( flags ); } + + AllianceLibrary* AllianceFramework::getAllianceLibrary ( unsigned index ) { if ( index >= _libraries.size() ) @@ -242,7 +323,7 @@ namespace CRL { } - AllianceLibrary* AllianceFramework::getAllianceLibrary ( const Name &libName, unsigned int& flags ) + AllianceLibrary* AllianceFramework::getAllianceLibrary ( const Name &libName, unsigned int flags ) { for ( size_t ilib=0 ; ilib<_libraries.size() ; ++ilib ) { if ( _libraries[ilib]->getLibrary()->getName() == libName ) @@ -262,6 +343,15 @@ namespace CRL { } + Cell* AllianceFramework::cellLoader ( const string& rpath ) + { + size_t dot = rpath.rfind('.'); + string cellName = rpath.substr(dot+1); + + return getCell( cellName, Catalog::State::Views ); + } + + Cell* AllianceFramework::getCell ( const string& name, unsigned int mode, unsigned int depth ) { bool createCell = false; @@ -325,7 +415,7 @@ namespace CRL { } - AllianceLibrary* AllianceFramework::createLibrary ( const string& path, unsigned int& flags, string libName ) + AllianceLibrary* AllianceFramework::createLibrary ( const string& path, unsigned int flags, string libName ) { if ( libName.empty() ) libName = SearchPath::extractLibName(path); @@ -333,7 +423,7 @@ namespace CRL { string dupLibName = libName; for ( size_t duplicate=1 ; true ; ++duplicate ) { - AllianceLibrary* library = getAllianceLibrary ( dupLibName, flags ); + AllianceLibrary* library = getAllianceLibrary ( dupLibName, flags & ~CreateLibrary ); if (library == NULL) break; ostringstream oss; @@ -349,31 +439,42 @@ namespace CRL { // } SearchPath& LIBRARIES = _environment.getLIBRARIES (); - if ( not (flags & InSearchPath) ) LIBRARIES.prepend ( path, dupLibName ); - else LIBRARIES.select ( path ); + if ( not (flags & AppendLibrary) ) LIBRARIES.prepend ( path, dupLibName ); + else LIBRARIES.select ( path ); - AllianceLibrary* library = new AllianceLibrary ( path, Library::create(getParentLibrary(),dupLibName) ); + Library* hlibrary = getParentLibrary()->getLibrary( dupLibName ); + if (not hlibrary) + hlibrary = Library::create( getParentLibrary(), dupLibName ); + + AllianceLibrary* alibrary = new AllianceLibrary ( path, hlibrary ); AllianceLibraries::iterator ilib = _libraries.begin(); - for ( size_t i=0 ; igetLibrary()) ) flags |= HasCatalog; + if ( _catalog.loadFromFile(catalog,alibrary->getLibrary()) ) flags |= HasCatalog; ParserFormatSlot& parser = _parsers.getParserSlot ( path, Catalog::State::Physical, _environment ); - if ( not parser.loadByLib() ) return library; + if ( not parser.loadByLib() ) { + notify ( AddedLibrary ); + return alibrary; + } // Load the whole library. - if ( ! _readLocate(dupLibName,Catalog::State::State::Logical,true) ) return library; + if ( ! _readLocate(dupLibName,Catalog::State::State::Logical,true) ) return alibrary; // Call the parser function. - (parser.getParsLib())( _environment.getLIBRARIES().getSelected() , library->getLibrary() , _catalog ); + (parser.getParsLib())( _environment.getLIBRARIES().getSelected() , alibrary->getLibrary() , _catalog ); - return library; + notify ( AddedLibrary ); + return alibrary; } @@ -474,6 +575,17 @@ namespace CRL { } + Library* AllianceFramework::getLibrary ( const Name &libName ) + { + for ( size_t ilib=0 ; ilib<_libraries.size() ; ++ilib ) { + if ( _libraries[ilib]->getLibrary()->getName() == libName ) + return _libraries[ilib]->getLibrary(); + } + + return NULL; + } + + unsigned int AllianceFramework::loadLibraryCells ( Library *library ) { cmess2 << " " << tab++ << "+ Library: " << getString(library->getName()) << endl; @@ -564,6 +676,18 @@ namespace CRL { } + RoutingGauge* AllianceFramework::setRoutingGauge ( const Name& name ) + { + RoutingGauge* gauge = getRoutingGauge( name ); + if (gauge) _defaultRoutingGauge = gauge; + else + cerr << Error( "AllianceFramework::setRoutingGauge(): No gauge named \"%s\"." + , getString(name).c_str() ) << endl; + + return _defaultRoutingGauge; + } + + RoutingGauge* AllianceFramework::getRoutingGauge ( const Name& name ) { if ( name.isEmpty() ) return _defaultRoutingGauge; @@ -595,6 +719,18 @@ namespace CRL { } + CellGauge* AllianceFramework::setCellGauge ( const Name& name ) + { + CellGauge* gauge = getCellGauge( name ); + if (gauge) _defaultCellGauge = gauge; + else + cerr << Error( "AllianceFramework::setCellGauge(): No gauge named \"%s\"." + , getString(name).c_str() ) << endl; + + return _defaultCellGauge; + } + + CellGauge* AllianceFramework::getCellGauge ( const Name& name ) { if ( name.isEmpty() ) return _defaultCellGauge; @@ -656,15 +792,83 @@ namespace CRL { Record *AllianceFramework::_getRecord () const { Record* record = new Record ( "" ); - record->add ( getSlot ( "_environment" , &_environment ) ); - record->add ( getSlot ( "_libraries" , &_libraries ) ); - record->add ( getSlot ( "_catalog" , &_catalog ) ); - record->add ( getSlot ( "_defaultRroutingGauge", _defaultRoutingGauge ) ); - record->add ( getSlot ( "_routingGauges" , _routingGauges ) ); - record->add ( getSlot ( "_defaultCellGauge" , _defaultCellGauge ) ); - record->add ( getSlot ( "_cellGauges" , _cellGauges ) ); + record->add ( getSlot ( "_environment" , &_environment ) ); + record->add ( getSlot ( "_libraries" , &_libraries ) ); + record->add ( getSlot ( "_catalog" , &_catalog ) ); + record->add ( getSlot ( "_defaultRoutingGauge", _defaultRoutingGauge ) ); + record->add ( getSlot ( "_routingGauges" , _routingGauges ) ); + record->add ( getSlot ( "_defaultCellGauge" , _defaultCellGauge ) ); + record->add ( getSlot ( "_cellGauges" , _cellGauges ) ); return record; } + void AllianceFramework::toJson ( JsonWriter* w ) const + { + w->startObject(); + jsonWrite( w, "@typename" , _getTypeName() ); + jsonWrite( w, "_environment" , &_environment ); + jsonWrite( w, "_defaultRoutingGauge", _defaultRoutingGauge->getName() ); + jsonWrite( w, "_defaultCellGauge" , _defaultCellGauge->getName() ); + jsonWrite( w, "+libraries" , getAllianceLibraries() ); + jsonWrite( w, "+routingGauges" , _routingGauges ); + jsonWrite( w, "+cellGauges" , _cellGauges ); + w->endObject(); + } + + +// ------------------------------------------------------------------- +// Class : "CRL::JsonAllianceFramework". + + Initializer jsonFrameworkInit ( 20 ); + + + JsonAllianceFramework::JsonAllianceFramework ( unsigned long flags ) + : JsonObject (flags) + , _defaultRoutingGauge() + , _defaultCellGauge () + { + add( "_environment" , typeid(Environment*) ); + add( "_defaultRoutingGauge", typeid(string) ); + add( "_defaultCellGauge" , typeid(string) ); + add( "+libraries" , typeid(JsonArray) ); + add( "+routingGauges" , typeid(JsonArray) ); + add( "+cellGauges" , typeid(JsonArray) ); + } + + + JsonAllianceFramework::~JsonAllianceFramework () + { + AllianceFramework* framework = AllianceFramework::get(); + framework->setRoutingGauge( _defaultRoutingGauge ); + framework->setCellGauge ( _defaultCellGauge ); + } + + + string JsonAllianceFramework::getTypeName () const + { return "AllianceFramework"; } + + + void JsonAllianceFramework::initialize () + { JsonTypes::registerType( new JsonAllianceFramework (JsonWriter::RegisterMode) ); } + + + JsonAllianceFramework* JsonAllianceFramework::clone ( unsigned long flags ) const + { return new JsonAllianceFramework ( flags ); } + + + void JsonAllianceFramework::toData ( JsonStack& stack ) + { + check( stack, "JsonAllianceFramework::toData" ); + + // It's a singleton. Do not create it... + AllianceFramework* framework = AllianceFramework::get(); + + string _defaultRoutingGauge = get( stack, "_defaultRoutingGauge" ); + string _defaultCellGauge = get( stack, "_defaultCellGauge" ); + + update( stack, framework ); + } + + } // End of CRL namespace. diff --git a/crlcore/src/ccore/AllianceLibrary.cpp b/crlcore/src/ccore/AllianceLibrary.cpp index 2e468d3f..fa9d8d15 100644 --- a/crlcore/src/ccore/AllianceLibrary.cpp +++ b/crlcore/src/ccore/AllianceLibrary.cpp @@ -1,67 +1,39 @@ - // -*- C++ -*- // -// This file is part of the Coriolis Project. -// Copyright (C) Laboratoire LIP6 - Departement ASIM -// Universite Pierre et Marie Curie +// This file is part of the Coriolis Software. +// Copyright (c) UPMC 2008-2016, All Rights Reserved // -// Main contributors : -// Christophe Alexandre -// Sophie Belloeil -// Hugo Clément -// Jean-Paul Chaput -// Damien Dupuis -// Christian Masson -// Marek Sroka -// -// The Coriolis Project is free software; you can redistribute it -// and/or modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// The Coriolis Project is distributed in the hope that it will be -// useful, but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with the Coriolis Project; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -// USA -// -// License-Tag -// Authors-Tag -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | C O R I O L I S | // | Alliance / Hurricane Interface | // | | -// | Author : Rémy Escassut | -// | E-mail : Remy.Escassut@silvaco.com | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | -// | C++ Header : "./AllianceLibrary.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x - - - - -# include "hurricane/Library.h" - -# include "crlcore/Utilities.h" -# include "crlcore/AllianceLibrary.h" +// | C++ Module : "./AllianceLibrary.cpp" | +// +-----------------------------------------------------------------+ +#include "hurricane/Warning.h" +#include "hurricane/SharedPath.h" +#include "hurricane/Library.h" +#include "hurricane/DataBase.h" +#include "crlcore/Utilities.h" +#include "crlcore/AllianceLibrary.h" +#include "crlcore/AllianceFramework.h" namespace CRL { + using namespace std; + using Hurricane::tab; + using Hurricane::Initializer; + using Hurricane::JsonTypes; + using Hurricane::Warning; + using Hurricane::Name; + using Hurricane::SharedPath; + using Hurricane::DataBase; + // ------------------------------------------------------------------- // Class : "AllianceDirectory". @@ -107,12 +79,99 @@ namespace CRL { Record* AllianceLibrary::_getRecord() const { Record* record = new Record ( getString(this) ); - record->add ( getSlot("Path" ,&_path ) ); - record->add ( getSlot("Library", _library) ); + record->add ( getSlot("_path" ,&_path ) ); + record->add ( getSlot("_library", _library) ); return ( record ); } + void AllianceLibrary::toJson ( JsonWriter* w ) const + { + w->startObject(); + jsonWrite( w, "@typename", _getTypeName() ); + jsonWrite( w, "_path" , _path ); + jsonWrite( w, "_library" , _library->getHierarchicalName() ); + w->endObject(); + } + + +// ------------------------------------------------------------------- +// Class : "JsonAllianceLibrary". + + Initializer jsonAllianceLibraryInit ( 0 ); + + + void JsonAllianceLibrary::initialize () + { JsonTypes::registerType( new JsonAllianceLibrary (JsonWriter::RegisterMode) ); } + + + JsonAllianceLibrary::JsonAllianceLibrary ( unsigned long flags ) + : JsonObject(flags) + { + add( "_path" , typeid(string) ); + add( "_library", typeid(string) ); + } + + string JsonAllianceLibrary::getTypeName () const + { return "AllianceLibrary"; } + + + JsonAllianceLibrary* JsonAllianceLibrary::clone ( unsigned long flags ) const + { return new JsonAllianceLibrary ( flags ); } + + + void JsonAllianceLibrary::toData ( JsonStack& stack ) + { + check( stack, "JsonAllianceLibrary::toData" ); + + string libDbPath = get( stack, "_library" ); + string libOsPath = get( stack, "_path" ); + + AllianceFramework* af = AllianceFramework::get(); + Library* library = DataBase::getDB()->getLibrary( libDbPath + , DataBase::CreateLib|DataBase::WarnCreateLib ); + AllianceLibrary* aLibrary = NULL; + + cdebug.log(19) << "| " << libDbPath << " : " << library << endl; + + if (library) { + aLibrary = af->getAllianceLibrary( library ); + } + if (not aLibrary) { + char separator = SharedPath::getNameSeparator(); + size_t dot = libDbPath.rfind( separator ); + Name libName = libDbPath.substr(dot+1); + aLibrary = af->getAllianceLibrary( libName, AllianceFramework::AppendLibrary ); + + if (not aLibrary) { + aLibrary = af->getAllianceLibrary( libOsPath + , AllianceFramework::CreateLibrary + | AllianceFramework::AppendLibrary ); + } + if (not library) library = aLibrary->getLibrary(); + } + + cdebug.log(19) << "| Associates to: " << aLibrary << endl; + + if (aLibrary->getLibrary() != library) { + cerr << Warning( "JsonAllianceLibrary::toData(): Underlying Hurricane Library discrepency for \"%s\".\n" + " (may be caused by a change in search path order)" + , getString(library->getName()).c_str() + ) << endl; + } + if (aLibrary->getPath() != Name(libOsPath)) { + cerr << Warning( "JsonAllianceLibrary::toData(): Underlying OS path discrepency for \"%s\":\n" + " - Blob: %s\n" + " - System: %s" + , getString(library->getName()).c_str() + , libOsPath.c_str() + , getString(aLibrary->getPath()).c_str() + ) << endl; + } + + update( stack, aLibrary ); + } + } // End of CRL namespace. diff --git a/crlcore/src/ccore/Banner.cpp b/crlcore/src/ccore/Banner.cpp index 7c840e02..fb60e028 100644 --- a/crlcore/src/ccore/Banner.cpp +++ b/crlcore/src/ccore/Banner.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/crlcore/src/ccore/Catalog.cpp b/crlcore/src/ccore/Catalog.cpp index 26bb3723..15acd735 100644 --- a/crlcore/src/ccore/Catalog.cpp +++ b/crlcore/src/ccore/Catalog.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -17,17 +17,26 @@ # include using namespace std; +#include "hurricane/Initializer.h" +#include "hurricane/SharedPath.h" #include "hurricane/Collection.h" +#include "hurricane/DataBase.h" #include "hurricane/Library.h" #include "hurricane/Name.h" #include "crlcore/Utilities.h" #include "crlcore/Catalog.h" +#include "crlcore/AllianceFramework.h" namespace CRL { + using Hurricane::tab; + using Hurricane::Initializer; + using Hurricane::JsonTypes; + using Hurricane::SharedPath; + using Hurricane::DataBase; - const char* MissingStateProperty = "%s:\n\n Missing Catalog State Property in cell \"%s\".\n"; + const char* MissingStateProperty = "%s:\n\n Missing Catalog State Property in cell \"%s\".\n"; // ------------------------------------------------------------------- @@ -41,6 +50,17 @@ namespace CRL { } + Cell* Catalog::State::setCell ( Cell* cell ) + { + _cell = cell; + if (_cell) { + if (isPad ()) _cell->setPad ( true ); + if (isFeed()) _cell->setFeed( true ); + } + return _cell; + } + + void Catalog::State::merge ( const State& other ) { if ( (_cell ==NULL) && other._cell ) _cell = other._cell; @@ -79,6 +99,80 @@ namespace CRL { } + void Catalog::State::toJson ( JsonWriter* w ) const + { + w->startObject(); + jsonWrite( w, "@typename", _getTypeName() ); + jsonWrite( w, "_flags" , _getString() ); + jsonWrite( w, "_depth" , _depth ); + + string cellName = ""; + if (_cell) cellName = getString( _cell->getHierarchicalName() ); + jsonWrite( w, "_cell", cellName ); + w->endObject(); + } + + + Initializer jsonCatalogStateInit ( 20 ); + + + Catalog::State::JsonState::JsonState ( unsigned long flags ) + : JsonObject(flags) + { + add( "_flags", typeid(string) ); + add( "_depth", typeid(int64_t) ); + add( "_cell" , typeid(string) ); + } + + + string Catalog::State::JsonState::getTypeName () const + { return "Catalog::State"; } + + + void Catalog::State::JsonState::initialize () + { JsonTypes::registerType( new JsonState (JsonWriter::RegisterMode) ); } + + + Catalog::State::JsonState* Catalog::State::JsonState::clone ( unsigned long flags ) const + { return new JsonState ( flags ); } + + + void Catalog::State::JsonState::toData ( JsonStack& stack ) + { + check( stack, "Catalog::State::JsonState::toData" ); + + string cellPath = get ( stack, "_cell" ); + string sflags = get ( stack, "_flags" ); + unsigned int depth = get( stack, "_depth" ); + + char separator = SharedPath::getNameSeparator(); + size_t dot = cellPath.rfind( separator ); + string cellName = cellPath.substr(dot+1); + string libraryName = cellPath.substr(0,dot); + + Library* library = DataBase::getDB()->getLibrary( libraryName + , DataBase::CreateLib|DataBase::WarnCreateLib ); + Cell* cell = library->getCell( cellName ); + + Catalog* catalog = AllianceFramework::get()->getCatalog(); + Catalog::State* state = catalog->getState( cellName ); + + if (not state) state = catalog->getState( cellName, true ); + if (state->getCell () != cell ) state->setCell ( cell ); + if (state->getLibrary() != library) state->setLibrary( library ); + + state->setDepth( depth ); + state->setFlattenLeaf( (sflags[0] == 'C') ); + state->setFeed( (sflags[1] == 'F') ); + state->setPad( (sflags[2] == 'P') ); + state->setGds( (sflags[3] == 'G') ); + state->setDelete( (sflags[4] == 'D') ); + state->setInMemory( (sflags[5] == 'm') ); + + update( stack, state ); + } + + // ------------------------------------------------------------------- // Class : "Catalog". @@ -238,8 +332,7 @@ namespace CRL { // ------------------------------------------------------------------- // Class : "CatalogProperty" - - Name CatalogProperty::_name = "Alliance Catalog State"; + Name CatalogProperty::_name = "Catalog::State::Property"; CatalogProperty* CatalogProperty::create ( Catalog::State* state ) @@ -296,6 +389,76 @@ namespace CRL { } + bool CatalogProperty::hasJson () const + { return true; } + + + void CatalogProperty::toJson ( JsonWriter* w, const DBo* ) const + { + w->startObject(); + std::string tname = getString(getPropertyName()); + jsonWrite( w, "@typename", tname ); + jsonWrite( w, "_state" , _state ); + w->endObject(); + } + + +// ------------------------------------------------------------------- +// Class : "JsonCatalogProperty" + + Initializer jsonCatalogPropertyInit ( 20 ); + + + JsonCatalogProperty::JsonCatalogProperty ( unsigned long flags ) + : JsonObject(flags) + { + add( "_state", typeid(Catalog::State*) ); + } + + + string JsonCatalogProperty::getTypeName () const + { return getString(CatalogProperty::getPropertyName()); } + + + void JsonCatalogProperty::initialize () + { JsonTypes::registerType( new JsonCatalogProperty (JsonWriter::RegisterMode) ); } + + + JsonCatalogProperty* JsonCatalogProperty::clone ( unsigned long flags ) const + { return new JsonCatalogProperty ( flags ); } + + + void JsonCatalogProperty::toData ( JsonStack& stack ) + { + check( stack, "JsonCatalogProperty::toData" ); + + DBo* dbo = stack.back_dbo(); + Catalog::State* state = get( stack, "_state" ); + CatalogProperty* property = NULL; + + cdebug.log(19) << "topDBo:" << dbo << endl; + + Cell* cell = dynamic_cast( dbo ); + if (cell) { + Property* base = cell->getProperty( CatalogProperty::getPropertyName() ); + if (base) { + property = static_cast( base ); + if (property->getState() != state) { + cerr << Error( "JsonCatalogProperty::toData(): State object incoherency on Cell \"%s\"." + , getString(cell->getName()).c_str() + ) << endl; + } + } else { + property = CatalogProperty::create( state ); + cell->put( property ); + } + } + // NULL Cell means we are parsing the Catalog. + + update( stack, property ); + } + + // ------------------------------------------------------------------- // Class : "CatalogExtension" diff --git a/crlcore/src/ccore/CellGauge.cpp b/crlcore/src/ccore/CellGauge.cpp index 7ffa6e56..7d64ccd9 100644 --- a/crlcore/src/ccore/CellGauge.cpp +++ b/crlcore/src/ccore/CellGauge.cpp @@ -1,16 +1,9 @@ - - // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | C O R I O L I S | // | Alliance / Hurricane Interface | // | | @@ -18,24 +11,16 @@ // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | // | C++ Header : "./CellGauge.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x - - +// +-----------------------------------------------------------------+ #include - #include "crlcore/CellGauge.h" - - +#include "crlcore/AllianceFramework.h" namespace { - // const char *missingMandatoryAttr = // "CRoutingGauge::createFromXml () :\n\n" // " Can't found mandatory attribute \"%s\".\n"; @@ -57,19 +42,18 @@ namespace { // "::createCellGaugeFromXml () :\n\n" // " cellgauge name tag attribute is empty.\n"; - -} // End of Anonymous namespace. - - +} // Anonymous namespace. namespace CRL { + using namespace std; + using Hurricane::JsonTypes; + // ------------------------------------------------------------------- // Class : "CRL::CellGauge". - CellGauge::CellGauge ( const char* name , const char* pinLayerName , const DbU::Unit pitch @@ -151,4 +135,84 @@ namespace CRL { } + void CellGauge::toJson ( JsonWriter* w ) const + { + w->startObject(); + jsonWrite( w, "@typename" , "CellGauge" ); + jsonWrite( w, "_name" , _name ); + jsonWrite( w, "_pinLayerName", _pinLayerName ); + jsonWrite( w, "_pitch" , _pitch ); + jsonWrite( w, "_sliceHeight" , _sliceHeight ); + jsonWrite( w, "_sliceStep" , _sliceStep ); + w->endObject(); + } + + +// ------------------------------------------------------------------- +// Class : "JsonCellGauge" + + Initializer jsonCellGaugeInit ( 0 ); + + + void JsonCellGauge::initialize () + { JsonTypes::registerType( new JsonCellGauge (JsonWriter::RegisterMode) ); } + + + JsonCellGauge::JsonCellGauge( unsigned long flags ) + : JsonObject(flags) + { + add( "_name" , typeid(string) ); + add( "_pinLayerName", typeid(string) ); + add( "_pitch" , typeid(int64_t) ); + add( "_sliceHeight" , typeid(int64_t) ); + add( "_sliceStep" , typeid(int64_t) ); + } + + + string JsonCellGauge::getTypeName () const + { return "CellGauge"; } + + + JsonCellGauge* JsonCellGauge::clone ( unsigned long flags ) const + { return new JsonCellGauge ( flags ); } + + + void JsonCellGauge::toData ( JsonStack& stack ) + { + check( stack, "JsonCellGauge::toData" ); + + AllianceFramework* af = get( stack, "_framework" ); + CellGauge* cg = NULL; + string name = get ( stack, "_name" ); + string pinLayerName = get ( stack, "_pinLayerName" ); + DbU::Unit pitch = get( stack, "_pitch" ); + DbU::Unit sliceHeight = get( stack, "_sliceHeight" ); + DbU::Unit sliceStep = get( stack, "_sliceStep" ); + + if (stack.issetFlags(JsonWriter::TechnoMode)) { + if (af) { + if (not name.empty()) { + cg = CellGauge::create( name.c_str() + , pinLayerName.c_str() + , pitch + , sliceHeight + , sliceStep + ); + af->addCellGauge( cg ); + } + } else { + cerr << Error( "JsonCellGauge::toData(): Missing \"_framework\" in stack context." ) << endl; + } + } else { + if (af) { + cg = af->getCellGauge( name ); + } + } + + update( stack, cg ); +} + + + + } // End of CRL namespace. diff --git a/crlcore/src/ccore/Environment.cpp b/crlcore/src/ccore/Environment.cpp index 9bc6bcc6..1e86b303 100644 --- a/crlcore/src/ccore/Environment.cpp +++ b/crlcore/src/ccore/Environment.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -22,6 +22,7 @@ #include "crlcore/Utilities.h" #include "crlcore/XmlParser.h" #include "crlcore/Environment.h" +#include "crlcore/AllianceFramework.h" namespace { @@ -505,6 +506,12 @@ namespace { namespace CRL { + using Hurricane::Initializer; + using Hurricane::JsonTypes; + + +// ------------------------------------------------------------------- +// Class : "Environment". Environment::Environment () : _CORIOLIS_TOP (CORIOLIS_TOP) @@ -523,7 +530,7 @@ namespace CRL { setBLOCKAGE ( "^obs$" ); setPad ( "^.*_px$" ); - _LIBRARIES.append ( "." ); + _LIBRARIES.append ( ".", "working" ); _inConstructor = false; } @@ -753,4 +760,83 @@ namespace CRL { } + void Environment::toJson ( JsonWriter* w ) const + { + w->startObject(); + jsonWrite( w, "@typename" , _getTypeName() ); + jsonWrite( w, "_CORIOLIS_TOP", _CORIOLIS_TOP ); + jsonWrite( w, "_displayStyle", _displayStyle ); + jsonWrite( w, "_SCALE_X" , _SCALE_X ); + jsonWrite( w, "_IN_LO" , _IN_LO ); + jsonWrite( w, "_IN_PH" , _IN_PH ); + jsonWrite( w, "_OUT_LO" , _OUT_LO ); + jsonWrite( w, "_OUT_PH" , _OUT_PH ); + jsonWrite( w, "_POWER" , _POWER ); + jsonWrite( w, "_GROUND" , _GROUND ); + jsonWrite( w, "_CLOCK" , _CLOCK ); + jsonWrite( w, "_BLOCKAGE" , _BLOCKAGE ); + jsonWrite( w, "_pad" , _pad ); + jsonWrite( w, "_CATALOG" , _CATALOG ); + w->endObject(); + } + + +// ------------------------------------------------------------------- +// Class : "JsonEnvironment". + + Initializer jsonEnvironmentInit ( 0 ); + + + void JsonEnvironment::initialize () + { JsonTypes::registerType( new JsonEnvironment (JsonWriter::RegisterMode) ); } + + + JsonEnvironment::JsonEnvironment ( unsigned long flags ) + : JsonObject(flags) + { + add( "_CORIOLIS_TOP", typeid(string) ); + add( "_displayStyle", typeid(string) ); + add( "_SCALE_X" , typeid(int64_t) ); + add( "_IN_LO" , typeid(string) ); + add( "_IN_PH" , typeid(string) ); + add( "_OUT_LO" , typeid(string) ); + add( "_OUT_PH" , typeid(string) ); + add( "_POWER" , typeid(string) ); + add( "_GROUND" , typeid(string) ); + add( "_BLOCKAGE" , typeid(string) ); + add( "_pad" , typeid(string) ); + add( "_CATALOG" , typeid(string) ); + add( "_CLOCK" , typeid(string) ); + } + + string JsonEnvironment::getTypeName () const + { return "Environment"; } + + + JsonEnvironment* JsonEnvironment::clone ( unsigned long flags ) const + { return new JsonEnvironment ( flags ); } + + + void JsonEnvironment::toData ( JsonStack& stack ) + { + check( stack, "JsonEnvironment::toData" ); + + Environment* environement = AllianceFramework::get()->getEnvironment(); + environement->setDisplayStyle( get (stack,"_displayStyle").c_str() ); + environement->setSCALE_X ( get(stack,"_SCALE_X" ) ); + environement->setIN_LO ( get (stack,"_IN_LO" ).c_str() ); + environement->setIN_PH ( get (stack,"_IN_PH" ).c_str() ); + environement->setOUT_LO ( get (stack,"_OUT_LO" ).c_str() ); + environement->setOUT_PH ( get (stack,"_OUT_PH" ).c_str() ); + environement->setPOWER ( get (stack,"_POWER" ).c_str() ); + environement->setGROUND ( get (stack,"_GROUND" ).c_str() ); + environement->setCLOCK ( get (stack,"_CLOCK" ).c_str() ); + environement->setBLOCKAGE ( get (stack,"_BLOCKAGE" ).c_str() ); + environement->setPad ( get (stack,"_pad" ).c_str() ); + environement->setCATALOG ( get (stack,"_CATALOG" ).c_str() ); + + update( stack, environement ); + } + + } // End of CRL namespace. diff --git a/crlcore/src/ccore/GraphicToolEngine.cpp b/crlcore/src/ccore/GraphicToolEngine.cpp index 55c02530..68e4df95 100644 --- a/crlcore/src/ccore/GraphicToolEngine.cpp +++ b/crlcore/src/ccore/GraphicToolEngine.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/crlcore/src/ccore/ParsersDrivers.cpp b/crlcore/src/ccore/ParsersDrivers.cpp index 4e18abf1..907211d1 100644 --- a/crlcore/src/ccore/ParsersDrivers.cpp +++ b/crlcore/src/ccore/ParsersDrivers.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/crlcore/src/ccore/RoutingGauge.cpp b/crlcore/src/ccore/RoutingGauge.cpp index 2fcfb504..e664f396 100644 --- a/crlcore/src/ccore/RoutingGauge.cpp +++ b/crlcore/src/ccore/RoutingGauge.cpp @@ -1,20 +1,20 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | // | Alliance / Hurricane Interface | // | | // | Author : Jean-Paul CHAPUT | -// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Module : "./RoutingGauge.cpp" | // +-----------------------------------------------------------------+ -#include +#include #include #include #include "hurricane/Commons.h" @@ -24,6 +24,7 @@ #include "crlcore/XmlParser.h" #include "crlcore/RoutingLayerGauge.h" #include "crlcore/RoutingGauge.h" +#include "crlcore/AllianceFramework.h" namespace { @@ -40,15 +41,20 @@ namespace { namespace CRL { - + using Hurricane::JsonTypes; + using Hurricane::JsonArray; using Hurricane::DataBase; using Hurricane::ViaLayer; + using Hurricane::getCollection; // ------------------------------------------------------------------- // Class : "RoutingGauge". + const size_t RoutingGauge::nlayerdepth = std::numeric_limits::max(); + + RoutingGauge::RoutingGauge ( const char* name ) : _name (name) , _layerGauges() @@ -74,7 +80,8 @@ namespace CRL { , gauge._layerGauges[i]->getOffset() , gauge._layerGauges[i]->getPitch() , gauge._layerGauges[i]->getWireWidth() - , gauge._layerGauges[i]->getViaWidth() ) + , gauge._layerGauges[i]->getViaWidth() + , gauge._layerGauges[i]->getObstacleDw() ) ); } @@ -150,7 +157,7 @@ namespace CRL { if ( _layerGauges[i]->getLayer()->getMask() == bottomLayer->getMask() ) return i; } - return UINT_MAX; + return nlayerdepth; } @@ -160,7 +167,7 @@ namespace CRL { if ( _layerGauges[i]->getLayer()->getMask() == layer->getMask() ) return i; } - return UINT_MAX; + return nlayerdepth; } @@ -261,4 +268,65 @@ namespace CRL { } + void RoutingGauge::toJson ( JsonWriter* w ) const + { + w->startObject(); + jsonWrite( w, "@typename", "RoutingGauge" ); + jsonWrite( w, "_name" , _name ); + jsonWrite( w, "+routingLayerGauges", getCollection(getLayerGauges()) ); + w->endObject(); + } + + +// ------------------------------------------------------------------- +// Class : "JsonRoutingGauge" + + Initializer jsonRoutingGaugeInit ( 0 ); + + + void JsonRoutingGauge::initialize () + { JsonTypes::registerType( new JsonRoutingGauge (JsonWriter::RegisterMode) ); } + + + JsonRoutingGauge::JsonRoutingGauge( unsigned long flags ) + : JsonObject(flags) + { + add( "_name" , typeid(string) ); + add( "+routingLayerGauges", typeid(JsonArray) ); + } + + + string JsonRoutingGauge::getTypeName () const + { return "RoutingGauge"; } + + + JsonRoutingGauge* JsonRoutingGauge::clone ( unsigned long flags ) const + { return new JsonRoutingGauge ( flags ); } + + + void JsonRoutingGauge::toData ( JsonStack& stack ) + { + check( stack, "JsonRoutingGauge::toData" ); + + AllianceFramework* af = get( stack, "_framework" ); + string name = get ( stack, "_name" ); + RoutingGauge* rg = NULL; + + if (stack.issetFlags(JsonWriter::TechnoMode)) { + if (af) { + if (not name.empty()) { + rg = RoutingGauge::create( name.c_str() ); + af->addRoutingGauge( rg ); + } + } else { + cerr << Error( "JsonRoutingGauge::toData(): Missing \"_framework\" in stack context." ) << endl; + } + } else { + rg = af->getRoutingGauge( name ); + } + + update( stack, rg ); + } + + } // End of CRL namespace. diff --git a/crlcore/src/ccore/RoutingLayerGauge.cpp b/crlcore/src/ccore/RoutingLayerGauge.cpp index f3809779..db76413d 100644 --- a/crlcore/src/ccore/RoutingLayerGauge.cpp +++ b/crlcore/src/ccore/RoutingLayerGauge.cpp @@ -1,14 +1,14 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | // | C o r e L i b r a r y | // | | // | Author : Jean-Paul CHAPUT | -// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Module : "./RoutingLayerGauge.cpp" | // +-----------------------------------------------------------------+ @@ -17,10 +17,11 @@ #include - -#include "hurricane/BasicLayer.h" - -#include "crlcore/RoutingLayerGauge.h" +#include "hurricane/BasicLayer.h" +#include "hurricane/DataBase.h" +#include "hurricane/Technology.h" +#include "crlcore/RoutingLayerGauge.h" +#include "crlcore/RoutingGauge.h" namespace { @@ -86,28 +87,27 @@ namespace CRL { using namespace std; - + using Hurricane::JsonTypes; using Hurricane::Tabulation; using Hurricane::BasicLayer; - using Hurricane::trace_in; - using Hurricane::trace_out; - using Hurricane::in_trace; using Hurricane::tab; + using Hurricane::DataBase; + using Hurricane::Technology; // ------------------------------------------------------------------- // Class : "RoutingLayerGauge" - - RoutingLayerGauge::RoutingLayerGauge ( const Layer* layer - , unsigned int direction - , unsigned int type - , unsigned int depth - , double density - , DbU::Unit offset - , DbU::Unit pitch - , DbU::Unit wireWidth - , DbU::Unit viaWidth ) + RoutingLayerGauge::RoutingLayerGauge ( const Layer* layer + , Constant::Direction direction + , Constant::LayerGaugeType type + , unsigned int depth + , double density + , DbU::Unit offset + , DbU::Unit pitch + , DbU::Unit wireWidth + , DbU::Unit viaWidth + , DbU::Unit obsDw ) : _layer (layer) , _blockageLayer(layer->getBlockageLayer()) , _direction (direction) @@ -118,18 +118,20 @@ namespace CRL { , _pitch (pitch) , _wireWidth (wireWidth) , _viaWidth (viaWidth) + , _obstacleDw (obsDw) { } - RoutingLayerGauge* RoutingLayerGauge::create ( const Layer* layer - , unsigned int direction - , unsigned int type - , unsigned int depth - , double density - , DbU::Unit offset - , DbU::Unit pitch - , DbU::Unit wireWidth - , DbU::Unit viaWidth ) + RoutingLayerGauge* RoutingLayerGauge::create ( const Layer* layer + , Constant::Direction direction + , Constant::LayerGaugeType type + , unsigned int depth + , double density + , DbU::Unit offset + , DbU::Unit pitch + , DbU::Unit wireWidth + , DbU::Unit viaWidth + , DbU::Unit obsDw ) { // Temporary: must write a more smart check. // BasicLayer* basicLayer = dynamic_cast(layer); @@ -147,7 +149,8 @@ namespace CRL { , offset , pitch , wireWidth - , viaWidth ); + , viaWidth + , obsDw ); return gauge; } @@ -204,18 +207,17 @@ namespace CRL { unsigned RoutingLayerGauge::getTrackIndex ( DbU::Unit start, DbU::Unit stop, DbU::Unit position, unsigned mode ) const { - trace << "RoutingLayerGauge::getTrackIndex ( " << position << " )" << endl; - trace_in (); + cdebug.log(100,1) << "RoutingLayerGauge::getTrackIndex ( " << position << " )" << endl; long modulo; long depth; divide ( position-start, depth, modulo ); - trace << "depth := " << depth << endl; + cdebug.log(100) << "depth := " << depth << endl; if ( depth < 0 ) { - trace_out (); + cdebug.tabw(100,-1); return 0; // throw Error ( negativeIndex @@ -237,7 +239,7 @@ namespace CRL { unsigned int tracksNumber = getTrackNumber(start,stop); if ( (unsigned)depth >= tracksNumber ) { - trace_out (); + cdebug.tabw(100,-1); return (tracksNumber > 0) ? tracksNumber-1 : 0; // throw Error ( overflowIndex // , getString(this).c_str() @@ -247,7 +249,7 @@ namespace CRL { // ); } - trace_out (); + cdebug.tabw(100,-1); return depth; } @@ -302,4 +304,107 @@ namespace CRL { } -} // End of Coriolis namespace. + void RoutingLayerGauge::toJson ( JsonWriter* w ) const + { + w->startObject(); + jsonWrite( w, "@typename", "RoutingLayerGauge" ); + jsonWrite( w, "_layer" , _layer->getName() ); + jsonWrite( w, "_direction" , getString(&_direction) ); + jsonWrite( w, "_type" , getString(&_type ) ); + jsonWrite( w, "_depth" , _depth ); + jsonWrite( w, "_density" , _density ); + jsonWrite( w, "_offset" , _offset ); + jsonWrite( w, "_pitch" , _pitch ); + jsonWrite( w, "_wireWidth" , _wireWidth ); + jsonWrite( w, "_viaWidth" , _viaWidth ); + jsonWrite( w, "_obstacleDw" , _obstacleDw ); + w->endObject(); + } + + +// ------------------------------------------------------------------- +// Class : "JsonRoutingLayerGauge" + + Initializer jsonRoutingLayerGaugeInit ( 0 ); + + + void JsonRoutingLayerGauge::initialize () + { JsonTypes::registerType( new JsonRoutingLayerGauge (JsonWriter::RegisterMode) ); } + + + JsonRoutingLayerGauge::JsonRoutingLayerGauge( unsigned long flags ) + : JsonObject(flags) + { + add( ".RoutingGauge" , typeid(RoutingGauge*) ); + add( "_layer" , typeid(string) ); + add( "_direction" , typeid(string) ); + add( "_type" , typeid(string) ); + add( "_depth" , typeid(unsigned int) ); + add( "_density" , typeid(double) ); + add( "_offset" , typeid(int64_t) ); + add( "_pitch" , typeid(int64_t) ); + add( "_wireWidth" , typeid(int64_t) ); + add( "_viaWidth" , typeid(int64_t) ); + add( "_obstacleDw" , typeid(int64_t) ); + } + + + string JsonRoutingLayerGauge::getTypeName () const + { return "RoutingLayerGauge"; } + + + JsonRoutingLayerGauge* JsonRoutingLayerGauge::clone ( unsigned long flags ) const + { return new JsonRoutingLayerGauge ( flags ); } + + + void JsonRoutingLayerGauge::toData ( JsonStack& stack ) + { + check( stack, "JsonRoutingLayerGauge::toData" ); + + Technology* techno = DataBase::getDB()->getTechnology(); + RoutingGauge* rg = get( stack, ".RoutingGauge" ); + RoutingLayerGauge* rlg = NULL; + string layer = get ( stack, "_layer" ); + unsigned int depth = get ( stack, "_depth" ); + double density = get ( stack, "_density" ); + DbU::Unit offset = get ( stack, "_offset" ); + DbU::Unit pitch = get ( stack, "_pitch" ); + DbU::Unit wireWidth = get ( stack, "_wireWidth" ); + DbU::Unit viaWidth = get ( stack, "_viaWidth" ); + DbU::Unit obstacleDw = get ( stack, "_obstacleDw" ); + + Constant::Direction direction; + Constant::LayerGaugeType type; + from( direction, get(stack,"_direction") ); + from( type , get(stack,"_type" ) ); + + if (stack.issetFlags(JsonWriter::TechnoMode)) { + if (rg) { + if (not layer.empty()) { + rlg = RoutingLayerGauge::create( techno->getLayer(layer) + , direction + , type + , depth + , density + , offset + , pitch + , wireWidth + , viaWidth + , obstacleDw + ); + rg->addLayerGauge( rlg ); + } + } else { + cerr << Error( "JsonRoutingLayerGauge::toData(): Missing \".RoutingGauge\" in stack context." ) << endl; + } + } else { + if (rg) { + rlg = rg->getLayerGauge( techno->getLayer(layer) ); + } + } + + update( stack, rlg ); +} + + +} // Coriolis namespace. diff --git a/crlcore/src/ccore/SearchPath.cpp b/crlcore/src/ccore/SearchPath.cpp index 260308b3..b2b72be3 100644 --- a/crlcore/src/ccore/SearchPath.cpp +++ b/crlcore/src/ccore/SearchPath.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/crlcore/src/ccore/ToolEngine.cpp b/crlcore/src/ccore/ToolEngine.cpp index a8759d48..e5e69b70 100644 --- a/crlcore/src/ccore/ToolEngine.cpp +++ b/crlcore/src/ccore/ToolEngine.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/crlcore/src/ccore/Utilities.cpp b/crlcore/src/ccore/Utilities.cpp index d19730ea..ebc76453 100644 --- a/crlcore/src/ccore/Utilities.cpp +++ b/crlcore/src/ccore/Utilities.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -88,9 +88,17 @@ namespace { } - void traceLevelChanged ( Cfg::Parameter* p ) + void minTraceLevelChanged ( Cfg::Parameter* p ) { - ltracelevel ( p->asInt() ); + //cerr << "minTraceLevelChanged:" << p->asInt() << endl; + cdebug.setMinLevel( p->asInt() ); + } + + + void maxTraceLevelChanged ( Cfg::Parameter* p ) + { + //cerr << "maxTraceLevelChanged:" << p->asInt() << endl; + cdebug.setMaxLevel( p->asInt() ); } @@ -322,25 +330,26 @@ namespace CRL { // Triggers Configuration singleton creation. Cfg::Configuration::get (); - Cfg::getParamBool ("misc.catchCore" ,true )->registerCb ( catchCoreChanged ); - Cfg::getParamBool ("misc.verboseLevel1" ,true )->registerCb ( verboseLevel1Changed ); - Cfg::getParamBool ("misc.verboseLevel2" ,true )->registerCb ( verboseLevel2Changed ); - Cfg::getParamBool ("misc.info" ,false)->registerCb ( infoChanged ); - Cfg::getParamBool ("misc.paranoid" ,false)->registerCb ( paranoidChanged ); - Cfg::getParamBool ("misc.bug" ,false)->registerCb ( bugChanged ); - Cfg::getParamBool ("misc.logMode" ,false)->registerCb ( logModeChanged ); - Cfg::getParamInt ("misc.traceLevel" ,1000 )->registerCb ( traceLevelChanged ); - Cfg::getParamString("stratus1.mappingName","./stratus2sxlib.xml")->registerCb ( stratus1MappingNameChanged ); + Cfg::getParamBool ("misc.catchCore" ,false)->registerCb ( this, catchCoreChanged ); + Cfg::getParamBool ("misc.verboseLevel1" ,true )->registerCb ( this, verboseLevel1Changed ); + Cfg::getParamBool ("misc.verboseLevel2" ,true )->registerCb ( this, verboseLevel2Changed ); + Cfg::getParamBool ("misc.info" ,false)->registerCb ( this, infoChanged ); + Cfg::getParamBool ("misc.paranoid" ,false)->registerCb ( this, paranoidChanged ); + Cfg::getParamBool ("misc.bug" ,false)->registerCb ( this, bugChanged ); + Cfg::getParamBool ("misc.logMode" ,false)->registerCb ( this, logModeChanged ); + Cfg::getParamInt ("misc.minTraceLevel" ,0 )->registerCb ( this, minTraceLevelChanged ); + Cfg::getParamInt ("misc.maxTraceLevel" ,0 )->registerCb ( this, maxTraceLevelChanged ); + Cfg::getParamString("stratus1.mappingName","not_set")->registerCb ( this, stratus1MappingNameChanged ); // Immediate update from the configuration. - catchCoreChanged ( Cfg::getParamBool("misc.catchCore" ) ); - verboseLevel1Changed ( Cfg::getParamBool("misc.verboseLevel1") ); - verboseLevel2Changed ( Cfg::getParamBool("misc.verboseLevel2") ); - infoChanged ( Cfg::getParamBool("misc.info" ) ); - paranoidChanged ( Cfg::getParamBool("misc.paranoid" ) ); - bugChanged ( Cfg::getParamBool("misc.bug" ) ); - logModeChanged ( Cfg::getParamBool("misc.logMode" ) ); - traceLevelChanged ( Cfg::getParamInt ("misc.traceLevel" ) ); + //catchCoreChanged ( Cfg::getParamBool("misc.catchCore" ) ); + //verboseLevel1Changed ( Cfg::getParamBool("misc.verboseLevel1") ); + //verboseLevel2Changed ( Cfg::getParamBool("misc.verboseLevel2") ); + //infoChanged ( Cfg::getParamBool("misc.info" ) ); + //paranoidChanged ( Cfg::getParamBool("misc.paranoid" ) ); + //bugChanged ( Cfg::getParamBool("misc.bug" ) ); + //logModeChanged ( Cfg::getParamBool("misc.logMode" ) ); + //traceLevelChanged ( Cfg::getParamInt ("misc.traceLevel" ) ); Utilities::Path stratusMappingName; if ( arguments.count("stratus_mapping_name") ) { diff --git a/crlcore/src/ccore/agds/AgdsDriver.cpp b/crlcore/src/ccore/agds/AgdsDriver.cpp index 2fc7f88a..0baf669b 100644 --- a/crlcore/src/ccore/agds/AgdsDriver.cpp +++ b/crlcore/src/ccore/agds/AgdsDriver.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2009-2015, All Rights Reserved +// Copyright (c) UPMC 2009-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/crlcore/src/ccore/alliance/ap/Ap.h b/crlcore/src/ccore/alliance/ap/Ap.h index bd07a41f..c28752f0 100644 --- a/crlcore/src/ccore/alliance/ap/Ap.h +++ b/crlcore/src/ccore/alliance/ap/Ap.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/crlcore/src/ccore/alliance/ap/ApDriver.cpp b/crlcore/src/ccore/alliance/ap/ApDriver.cpp index 5ac39d13..55deaaf7 100644 --- a/crlcore/src/ccore/alliance/ap/ApDriver.cpp +++ b/crlcore/src/ccore/alliance/ap/ApDriver.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -15,22 +15,20 @@ #include - -#include "hurricane/Pin.h" -#include "hurricane/Instance.h" -#include "hurricane/Net.h" -#include "hurricane/NetExternalComponents.h" -#include "hurricane/Reference.h" -#include "hurricane/Horizontal.h" -#include "hurricane/Vertical.h" -#include "hurricane/RoutingPad.h" -#include "hurricane/Cell.h" -#include "hurricane/Layer.h" -#include "hurricane/RegularLayer.h" -#include "hurricane/Warning.h" - -#include "Ap.h" -#include "crlcore/Catalog.h" +#include "hurricane/Pin.h" +#include "hurricane/Instance.h" +#include "hurricane/Net.h" +#include "hurricane/NetExternalComponents.h" +#include "hurricane/Reference.h" +#include "hurricane/Horizontal.h" +#include "hurricane/Vertical.h" +#include "hurricane/RoutingPad.h" +#include "hurricane/Cell.h" +#include "hurricane/Layer.h" +#include "hurricane/RegularLayer.h" +#include "hurricane/Warning.h" +#include "Ap.h" +#include "crlcore/Catalog.h" using namespace std; diff --git a/crlcore/src/ccore/alliance/ap/ApParser.cpp b/crlcore/src/ccore/alliance/ap/ApParser.cpp index 9d3507e4..d48843af 100644 --- a/crlcore/src/ccore/alliance/ap/ApParser.cpp +++ b/crlcore/src/ccore/alliance/ap/ApParser.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -355,6 +355,9 @@ namespace { net->setType ( Net::Type::CLOCK ); net->setGlobal ( true ); } + if ( _framework->isBLOCKAGE(hName) ) { + net->setType ( Net::Type::BLOCKAGE ); + } } return net; diff --git a/crlcore/src/ccore/alliance/vst/VhdlBit.cpp b/crlcore/src/ccore/alliance/vst/VhdlBit.cpp index 10cf8dbc..e4ac3bc2 100644 --- a/crlcore/src/ccore/alliance/vst/VhdlBit.cpp +++ b/crlcore/src/ccore/alliance/vst/VhdlBit.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2015-2015, All Rights Reserved +// Copyright (c) UPMC 2015-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/crlcore/src/ccore/alliance/vst/VhdlEntity.cpp b/crlcore/src/ccore/alliance/vst/VhdlEntity.cpp index 149c742b..253bacc1 100644 --- a/crlcore/src/ccore/alliance/vst/VhdlEntity.cpp +++ b/crlcore/src/ccore/alliance/vst/VhdlEntity.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2015-2015, All Rights Reserved +// Copyright (c) UPMC 2015-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -100,7 +100,8 @@ namespace Vhdl { Entity::Entity ( EntityProperty* property, Cell* cell, unsigned int flags ) - : _signals() + : _ns (NamingScheme::FromVerilog) + , _signals() , _globals() , _flags (flags) { @@ -111,16 +112,17 @@ namespace Vhdl { if (_flags == NoFlags) _flags = EntityMode; - forEach ( Net*, inet, cell->getNets() ) { - if (not inet->isExternal() and (flags & ComponentMode)) continue; + for ( Net* net : cell->getNets() ) { + if (net->isDeepNet()) continue; + if (not net->isExternal() and (flags & ComponentMode)) continue; string stem; size_t index = 0; - if (parseNetName(*inet,stem,index)) { - if (inet->isGlobal()) { + if (parseNetName(net,stem,index)) { + if (net->isGlobal()) { cerr << Warning( "Vhdl::Entity::Entity(): Net is both vectorized and global, this is not allowed.\n" " On Net <%s> of Cell <%s>." - , getString(inet->getName()).c_str() + , getString(net->getName()).c_str() , getString(cell->getName()).c_str() ) << endl; } @@ -128,12 +130,13 @@ namespace Vhdl { VectorSignal* signal = const_cast( dynamic_cast( getSignal(stem) ) ); if (not signal) signal = new VectorSignal ( stem ); - signal->addNet( index, *inet ); + signal->addNet( index, net ); _signals.insert( signal ); } else { - _signals.insert( new ScalarSignal(*inet) ); - if (inet->isGlobal()) - _globals.insert( new ScalarSignal(*inet) ); + ScalarSignal* signal = new ScalarSignal(net); + _signals.insert( signal ); + if (net->isGlobal()) + _globals.insert( signal ); } } @@ -144,6 +147,7 @@ namespace Vhdl { Entity::~Entity () { for ( auto signal : _signals ) delete signal; + //for ( auto global : _globals ) delete global; for ( auto ientity=_entities.begin() ; ientity!=_entities.end() ; ++ientity ) { if (*ientity == this) { _entities.erase( ientity ); @@ -160,7 +164,7 @@ namespace Vhdl { bool Entity::parseNetName ( const Net* net, string& stem, size_t& index ) { string error; - string name = getString(net->getName()); + string name = getString(_ns.convert(net->getName())); size_t leftpar = name.find( '(' ); size_t rightpar = name.find( ')' ); @@ -210,19 +214,20 @@ namespace Vhdl { { if (isEntityMode()) return; - forEach ( Net*, inet, getCell()->getNets() ) { - if (inet->isExternal()) continue; + for ( Net* net : getCell()->getNets() ) { + if (net->isDeepNet()) continue; + if (net->isExternal()) continue; string stem; size_t index = 0; - if (parseNetName(*inet,stem,index)) { + if (parseNetName(net,stem,index)) { VectorSignal* signal = const_cast( dynamic_cast( getSignal(stem) ) ); if (not signal) signal = new VectorSignal ( stem ); - signal->addNet( index, *inet ); + signal->addNet( index, net ); _signals.insert( signal ); } else { - _signals.insert( new ScalarSignal(*inet) ); + _signals.insert( new ScalarSignal(net) ); } } } @@ -332,11 +337,12 @@ namespace Vhdl { out << "use IEEE.numeric_std.all;\n\n\n"; } - out << tab++ << "entity " << getCell()->getName() << " is\n"; + string cellName = getString( _ns.convert( getCell()->getName()) ); + out << tab++ << "entity " << cellName << " is\n"; toPort( out ); - out << --tab << "\nend " << getCell()->getName() << ";\n\n"; + out << --tab << "\nend " << cellName << ";\n\n"; - out << "architecture structural of " << getCell()->getName() << " is\n\n"; + out << "architecture structural of " << cellName << " is\n\n"; ++tab; set masterCells; @@ -367,7 +373,9 @@ namespace Vhdl { void Entity::toComponent ( ostream& out ) const { - out << tab++ << "component " << getCell()->getName() << "\n"; + string cellName = getString( _ns.convert( getCell()->getName()) ); + + out << tab++ << "component " << cellName << "\n"; toPort( out ); out << "\n" << --tab << "end component;\n"; } @@ -375,7 +383,10 @@ namespace Vhdl { void Entity::toInstance ( ostream& out, Instance* instance ) const { - out << tab << instance->getName() << " : " << instance->getMasterCell()->getName() << "\n"; + string instanceName = getString( _ns.convert( instance->getName() ) ); + string masterName = getString( _ns.convert( instance->getMasterCell()->getName() ) ); + + out << tab << instanceName << " : " << masterName << "\n"; out << tab << "port map ( "; Entity* masterEntity = EntityExtension::get( instance->getMasterCell() ); @@ -518,7 +529,7 @@ namespace Vhdl { void EntityExtension::destroy ( Cell* cell ) { Property* property = cell->getProperty( EntityProperty::getPropertyName() ); - if (property) static_cast(property)->destroy(); + if (property) cell->remove( property ); _owner = NULL; _cache = NULL; diff --git a/crlcore/src/ccore/alliance/vst/VhdlPortMap.cpp b/crlcore/src/ccore/alliance/vst/VhdlPortMap.cpp index 542e3cb8..b34a6cce 100644 --- a/crlcore/src/ccore/alliance/vst/VhdlPortMap.cpp +++ b/crlcore/src/ccore/alliance/vst/VhdlPortMap.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2015-2015, All Rights Reserved +// Copyright (c) UPMC 2015-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/crlcore/src/ccore/alliance/vst/VhdlSignal.cpp b/crlcore/src/ccore/alliance/vst/VhdlSignal.cpp index 77f4ca01..c2ccec76 100644 --- a/crlcore/src/ccore/alliance/vst/VhdlSignal.cpp +++ b/crlcore/src/ccore/alliance/vst/VhdlSignal.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2015-2015, All Rights Reserved +// Copyright (c) UPMC 2015-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -102,7 +102,7 @@ namespace Vhdl { { } ScalarSignal::~ScalarSignal () - { } + { _bit->destroy(); } bool ScalarSignal::isScalar () const { return true; } bool ScalarSignal::isVector () const { return false; } @@ -150,7 +150,7 @@ namespace Vhdl { { } VectorSignal::~VectorSignal () - { for ( auto bit : _bits ) bit->getProperty()->destroy(); } + { for ( auto bit : _bits ) bit->destroy(); } bool VectorSignal::isScalar () const { return false; } diff --git a/crlcore/src/ccore/alliance/vst/VstDriver.cpp b/crlcore/src/ccore/alliance/vst/VstDriver.cpp index c93da64e..21cad2c5 100644 --- a/crlcore/src/ccore/alliance/vst/VstDriver.cpp +++ b/crlcore/src/ccore/alliance/vst/VstDriver.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2004-2015, All Rights Reserved +// Copyright (c) UPMC 2004-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -38,7 +38,7 @@ namespace CRL { void vstDriver ( const string cellPath, Cell *cell, unsigned int &saveState ) { - NamingScheme::toVhdl( cell, NamingScheme::FromVerilog ); + //NamingScheme::toVhdl( cell, NamingScheme::FromVerilog ); Vhdl::Entity* vhdlEntity = Vhdl::EntityExtension::create( cell , Vhdl::Entity::EntityMode //| Vhdl::Entity::IeeeMode diff --git a/crlcore/src/ccore/alliance/vst/VstParserGrammar.yy b/crlcore/src/ccore/alliance/vst/VstParserGrammar.yy index e13df406..f85bbcde 100644 --- a/crlcore/src/ccore/alliance/vst/VstParserGrammar.yy +++ b/crlcore/src/ccore/alliance/vst/VstParserGrammar.yy @@ -1,7 +1,7 @@ %{ // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/crlcore/src/ccore/alliance/vst/VstParserScanner.ll b/crlcore/src/ccore/alliance/vst/VstParserScanner.ll index 8e751efc..6b27ae24 100644 --- a/crlcore/src/ccore/alliance/vst/VstParserScanner.ll +++ b/crlcore/src/ccore/alliance/vst/VstParserScanner.ll @@ -4,7 +4,7 @@ %{ // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/crlcore/src/ccore/blif/BlifParser.cpp b/crlcore/src/ccore/blif/BlifParser.cpp index 16d31761..0823b774 100644 --- a/crlcore/src/ccore/blif/BlifParser.cpp +++ b/crlcore/src/ccore/blif/BlifParser.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2015-2015, All Rights Reserved +// Copyright (c) UPMC 2015-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -339,7 +339,7 @@ namespace { void Model::connectModels () { for ( Model* blifModel : _blifOrder ){ - cmess2 << "Handling model <" << blifModel->getCell()->getName() << ">" << endl; + //cmess2 << "Handling model <" << blifModel->getCell()->getName() << ">" << endl; blifModel->connectSubckts(); } } @@ -366,7 +366,6 @@ namespace { , _subckts() , _depth (0) { - _blifLut.insert( make_pair(getString(_cell->getName()), this) ); if (_cell->isTerminal()) _depth = 1; @@ -398,17 +397,21 @@ namespace { Net* Model::mergeNet ( string name, bool isExternal, unsigned int direction ) { + bool isClock = AllianceFramework::get()->isCLOCK( name ); + Net* net = _cell->getNet( name ); if (not net) { net = Net::create( _cell, name ); net->setExternal ( isExternal ); net->setDirection( (Net::Direction::Code)direction ); + if (isClock) net->setType( Net::Type::CLOCK ); } else { net->addAlias( name ); if (isExternal) net->setExternal( true ); direction &= ~Net::Direction::UNDEFINED; direction |= net->getDirection(); net->setDirection( (Net::Direction::Code)direction ); + if (isClock) net->setType( Net::Type::CLOCK ); } return net; } @@ -469,6 +472,12 @@ namespace { void Model::connectSubckts () { + auto framework = AllianceFramework::get(); + + unsigned int supplyCount = 0; + Cell* zero = framework->getCell( "zero_x0", Catalog::State::Views ); + Cell* one = framework->getCell( "one_x0" , Catalog::State::Views); + for ( Subckt* subckt : _subckts ) { if(not subckt->getModel()) throw Error( "No .model or cell named <%s> has been found.\n" @@ -486,9 +495,8 @@ namespace { // << "plug: <" << masterNetName << ">, " // << "external: <" << netName << ">." // << endl; - Net* net = _cell->getNet( netName ); - - Net* masterNet = instance->getMasterCell()->getNet(masterNetName); + Net* net = _cell->getNet( netName ); + Net* masterNet = instance->getMasterCell()->getNet(masterNetName); if(not masterNet) { ostringstream tmes; tmes << "The master net <" << masterNetName << "> hasn't been found " @@ -499,7 +507,7 @@ namespace { throw Error(tmes.str()); } - Plug* plug = instance->getPlug( masterNet ); + Plug* plug = instance->getPlug( masterNet ); if(not plug) { ostringstream tmes; tmes << "The plug in net <" << netName << "> " @@ -511,8 +519,7 @@ namespace { throw Error(tmes.str()); } - - Net* plugNet = plug->getNet(); + Net* plugNet = plug->getNet(); if (not plugNet) { // Plug not connected yet if (not net) net = Net::create( _cell, netName ); @@ -523,20 +530,38 @@ namespace { plugNet->addAlias( netName ); } else if (plugNet != net){ // Plus already connected to another net - plugNet->merge( net ); + if (not plugNet->isExternal()) net->merge( plugNet ); + else plugNet->merge( net ); } - if( plugNet->getType() == Net::Type::POWER or plugNet->getType() == Net::Type::GROUND ){ - ostringstream tmes; - string powType = plugNet->getType() == Net::Type::POWER ? "power" : "ground"; - string plugName = plugNet->getName()._getString(); // Name of the original net - tmes << "Connecting instance <" << subckt->getInstanceName() << "> " - << "of <" << subckt->getModelName() << "> " - << "to the " << powType << " net <" << plugName << "> "; - if(netName != plugName) - tmes << "with the alias <" << netName << ">. "; - tmes << "Maybe you should use tie cells?"; - cerr << Warning(tmes.str()) << endl; + if (plugNet->isSupply() and not plug->getMasterNet()->isSupply()) { + ostringstream message; + message << "In " << instance << "\n " + << "Terminal " << plug->getMasterNet()->getName() + << " is connected to POWER/GROUND " << plugNet->getName() + << " through the alias " << netName + << "."; + cerr << Warning( message.str() ) << endl; + + if (plugNet->isPower()) { + ostringstream insName; insName << "one_" << supplyCount++; + + Instance* insOne = Instance::create( _cell, insName.str(), one ); + Net* netOne = Net::create( _cell, insName.str() ); + + insOne->getPlug( one->getNet("q") )->setNet( netOne ); + plug->setNet( netOne ); + } + + if (plugNet->isGround()) { + ostringstream insName; insName << "zero_" << supplyCount++; + + Instance* insZero = Instance::create( _cell, insName.str(), zero ); + Net* netZero = Net::create( _cell, insName.str() ); + + insZero->getPlug( zero->getNet("nq") )->setNet( netZero ); + plug->setNet( netZero ); + } } } } @@ -647,25 +672,25 @@ namespace CRL { blifModel->mergeAlias( blifLine[1], blifLine[2] ); } else if (tokenize.state() & Tokenize::CoverZero) { cerr << Warning( "Blif::load() Definition of an alias <%s> of VSS in a \".names\". Maybe you should use tie cells?\n" - " File %s.blif at line %u." - , blifLine[1].c_str() - , blifFile.c_str() - , tokenize.lineno() - ) << endl; + " File \"%s.blif\" at line %u." + , blifLine[1].c_str() + , blifFile.c_str() + , tokenize.lineno() + ) << endl; //blifModel->mergeAlias( blifLine[1], "vss" ); blifModel->getCell()->getNet( "vss" )->addAlias( blifLine[1] ); } else if (tokenize.state() & Tokenize::CoverOne ) { cerr << Warning( "Blif::load() Definition of an alias <%s> of VDD in a \".names\". Maybe you should use tie cells?\n" - " File %s.blif at line %u." - , blifLine[1].c_str() - , blifFile.c_str() - , tokenize.lineno() - ) << endl; + " File \"%s.blif\" at line %u." + , blifLine[1].c_str() + , blifFile.c_str() + , tokenize.lineno() + ) << endl; //blifModel->mergeAlias( blifLine[1], "vdd" ); blifModel->getCell()->getNet( "vdd" )->addAlias( blifLine[1] ); } else { cerr << Error( "Blif::load() Unsupported \".names\" cover construct.\n" - " File %s.blif at line %u." + " File \"%s.blif\" at line %u." , blifFile.c_str() , tokenize.lineno() ) << endl; diff --git a/crlcore/src/ccore/bookshelf/BookshelfParser.cpp b/crlcore/src/ccore/bookshelf/BookshelfParser.cpp index df022f9c..dbffbbe9 100644 --- a/crlcore/src/ccore/bookshelf/BookshelfParser.cpp +++ b/crlcore/src/ccore/bookshelf/BookshelfParser.cpp @@ -318,7 +318,7 @@ Name BKParser::getNewNetName() bool BKParser::isNumber ( char* token ) { - trace << "isNumber = " << token; + cdebug.log(100) << "isNumber = " << token; unsigned i = 0; char tok; @@ -330,7 +330,7 @@ bool BKParser::isNumber ( char* token ) { } bool BKParser::isFloat ( char* token ) { - trace << "isFloat = " << token; + cdebug.log(100) << "isFloat = " << token; unsigned i = 0; char tok; @@ -343,7 +343,7 @@ bool BKParser::isFloat ( char* token ) { } bool BKParser::isName ( char* token ) { - trace << "isName = " << token; + cdebug.log(100) << "isName = " << token; unsigned i = 0; char tok; @@ -358,7 +358,7 @@ bool BKParser::isName ( char* token ) { } bool BKParser::isSymetry ( char* token ) { - trace << "isSymetry = " << token; + cdebug.log(100) << "isSymetry = " << token; if ( ( ( token[0] == 'X' ) && ( token[1] == char(0) ) ) || ( ( token[0] == 'Y' ) && ( token[1] == char(0) ) ) || ( ( token[0] == 'R' ) && ( token[1] == '9' ) && ( token[2] == '0' ) && ( token[3] == char(0) ) ) ) @@ -366,7 +366,7 @@ bool BKParser::isSymetry ( char* token ) { return false; } bool BKParser::isDirection ( char* token ) { - trace << "isDirection = " << token; + cdebug.log(100) << "isDirection = " << token; if ( ( ( token[0] == 'I' ) || ( token[0] == 'O' ) || ( token[0] == 'B' ) ) && ( token[1] == char(0) ) ) return true; @@ -381,7 +381,7 @@ bool BKParser::ScanAux () // The Aux record looks like : // RowBasedPlacement : .nodes .nets .wts .pl .scl // ********************************************************************************************************** - trace << "ScanAux = " << _buffer; + cdebug.log(100) << "ScanAux = " << _buffer; // *********************** // Patterns initialization @@ -441,7 +441,7 @@ bool BKParser::ScanNum ( unsigned& num ) // The NodeNum record looks like : // NumNodes : // ******************************* - trace << "ScanNum = " << _buffer; + cdebug.log(100) << "ScanNum = " << _buffer; char *p_type, *p_num; if ( ( ( p_type = strtok ( _buffer, "\t \n:" ) ) != NULL ) && @@ -460,7 +460,7 @@ bool BKParser::ScanDegree ( unsigned& degree, Name& netName ) // The NetDregree record looks like : // NetDegree : [netName] // ********************************** - trace << "ScanDegree = " << _buffer; + cdebug.log(100) << "ScanDegree = " << _buffer; bool mDegree = false; bool mName = false; @@ -502,7 +502,7 @@ bool BKParser::ScanNodes ( Name& name, DbU::Unit& width, DbU::Unit& height, bool // The Node record looks like : // [terminal] // ************************************** - trace << "ScanNodes = " << _buffer; + cdebug.log(100) << "ScanNodes = " << _buffer; char *p_name, *p_width, *p_height, *p_term; if ( ( ( p_name = strtok ( _buffer, "\t \n" ) ) != NULL ) && @@ -528,7 +528,7 @@ bool BKParser::ScanNets ( Name& insName, Net::Direction& dir, DbU::Unit& dx, DbU // The Net record looks like : // NetDegree : // ********************************* - trace << "ScanNets = " << _buffer; + cdebug.log(100) << "ScanNets = " << _buffer; bool mName = false; bool mDirection = false; @@ -580,7 +580,7 @@ bool BKParser::ScanWts ( Name& name, unsigned& weight ) // The Weight record looks like : // // ****************************** - trace << "ScanWts = " << _buffer; + cdebug.log(100) << "ScanWts = " << _buffer; //char *p_x, *p_y, *p_model, *p_name, *p_transf; @@ -622,7 +622,7 @@ bool BKParser::ScanPl ( Name& name, DbU::Unit& x, DbU::Unit& y, Transformation:: // The Placement record looks like : // : [FIXED] // ************************************* - trace << "ScanPl = " << _buffer; + cdebug.log(100) << "ScanPl = " << _buffer; char *p_name, *p_x, *p_y, *p_orient, *p_fixed; if ( ( ( p_name = strtok ( _buffer, "\t \n" ) ) != NULL ) && diff --git a/crlcore/src/ccore/crlcore/AllianceFramework.h b/crlcore/src/ccore/crlcore/AllianceFramework.h index 53acb7fa..d30eda09 100644 --- a/crlcore/src/ccore/crlcore/AllianceFramework.h +++ b/crlcore/src/ccore/crlcore/AllianceFramework.h @@ -1,8 +1,7 @@ - // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -18,17 +17,21 @@ #ifndef CRL_ALLIANCE_FRAMEWORK_H #define CRL_ALLIANCE_FRAMEWORK_H -#include -#include -#include "hurricane/Cell.h" -#include "crlcore/Environment.h" -#include "crlcore/AllianceLibrary.h" -#include "crlcore/Catalog.h" -#include "crlcore/ParsersDrivers.h" +#include +#include +#include "hurricane/Cell.h" +#include "crlcore/Environment.h" +#include "crlcore/AllianceLibrary.h" +#include "crlcore/Catalog.h" +#include "crlcore/ParsersDrivers.h" namespace CRL { + using Hurricane::Observable; + using Hurricane::BaseObserver; + using Hurricane::JsonObject; + using Hurricane::JsonStack; using Hurricane::Cell; using Hurricane::Net; class RoutingGauge; @@ -37,11 +40,23 @@ namespace CRL { class AllianceFramework { public: - enum InstancesCountFlags { Recursive=0x1, IgnoreFeeds=0x2 }; - enum LibraryFlags { CreateLibrary=0x1, InSearchPath=0x2, HasCatalog=0x4 }; + enum FunctionsFlags { NoFlags = 0 + , NoPythonInit = (1<<0) + }; + enum InstancesCountFlags { Recursive = (1<<0) + , IgnoreFeeds = (1<<1) + }; + enum LibraryFlags { CreateLibrary = (1<<0) + , AppendLibrary = (1<<1) + , HasCatalog = (1<<2) + }; + enum NotifyFlags { AddedLibrary = (1<<0) + , RemovedLibrary = (1<<1) + , ConfigChanged = (1<<2) + }; public: // Constructors. - static AllianceFramework* create (); + static AllianceFramework* create ( unsigned long flags=NoFlags ); // Destructors. void destroy (); // Accessors. @@ -71,10 +86,11 @@ namespace CRL { inline const Name& getParentLibraryName () const; inline Library* getParentLibrary (); Library* getLibrary ( unsigned int index ); + Library* getLibrary ( const Name& libName ); AllianceLibrary* getAllianceLibrary ( unsigned int index ); - AllianceLibrary* getAllianceLibrary ( const Name& libName, unsigned int& flags ); + AllianceLibrary* getAllianceLibrary ( const Name& libName, unsigned int flags ); AllianceLibrary* getAllianceLibrary ( Library* ); - AllianceLibrary* createLibrary ( const string& path, unsigned int& flags, string libName="" ); + AllianceLibrary* createLibrary ( const string& path, unsigned int flags, string libName="" ); inline const AllianceLibraries& getAllianceLibraries () const; void saveLibrary ( Library* ); void saveLibrary ( AllianceLibrary* ); @@ -82,9 +98,15 @@ namespace CRL { CellGauge* getCellGauge ( const Name& name="" ); inline const Name getDefaultCGPinLayerName () const; // Modifiers. + RoutingGauge* setRoutingGauge ( const Name& name="" ); + CellGauge* setCellGauge ( const Name& name="" ); void addRoutingGauge ( RoutingGauge* ); void addCellGauge ( CellGauge* ); + void addObserver ( BaseObserver* ); + void removeObserver ( BaseObserver* ); + void notify ( unsigned int flags ); // Cell Management. + Cell* cellLoader ( const string& rpath ); Cell* getCell ( const string& name , unsigned int mode , unsigned int depth=(unsigned int)-1 ); @@ -94,6 +116,7 @@ namespace CRL { unsigned int loadLibraryCells ( const Name& ); static size_t getInstancesCount ( Cell*, unsigned int flags ); // Hurricane Managment. + void toJson ( JsonWriter* ) const; inline string _getTypeName () const; string _getString () const; Record* _getRecord () const; @@ -102,15 +125,16 @@ namespace CRL { protected: static const Name _parentLibraryName; static AllianceFramework* _singleton; + Observable _observers; Environment _environment; ParsersMap _parsers; DriversMap _drivers; Catalog _catalog; AllianceLibraries _libraries; Library* _parentLibrary; - RoutingGauge* _defaultRoutingGauge; map _routingGauges; + RoutingGauge* _defaultRoutingGauge; map _cellGauges; CellGauge* _defaultCellGauge; @@ -158,6 +182,20 @@ namespace CRL { inline string AllianceFramework::_getTypeName () const { return "AllianceFramework"; } + class JsonAllianceFramework : public JsonObject { + public: + static void initialize (); + JsonAllianceFramework( unsigned long ); + virtual ~JsonAllianceFramework(); + virtual string getTypeName () const; + virtual JsonAllianceFramework* clone ( unsigned long ) const; + virtual void toData ( JsonStack& ); + private: + std::string _defaultRoutingGauge; + std::string _defaultCellGauge; + }; + + } // CRL namespace. diff --git a/crlcore/src/ccore/crlcore/AllianceLibrary.h b/crlcore/src/ccore/crlcore/AllianceLibrary.h index 64e8cd70..42f041fc 100644 --- a/crlcore/src/ccore/crlcore/AllianceLibrary.h +++ b/crlcore/src/ccore/crlcore/AllianceLibrary.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -30,7 +30,8 @@ namespace Hurricane { namespace CRL { using std::vector; - + using Hurricane::JsonObject; + using Hurricane::JsonStack; using Hurricane::Name; using Hurricane::Library; using Hurricane::Record; @@ -53,6 +54,7 @@ namespace CRL { inline const Name& getPath () const; inline Library* getLibrary () const; // Hurricane management. + void toJson ( JsonWriter* ) const; inline std::string _getTypeName () const; std::string _getString () const; Record* _getRecord () const; @@ -74,6 +76,19 @@ namespace CRL { inline std::string AllianceLibrary::_getTypeName () const { return _TName("AllianceLibrary"); } +// ------------------------------------------------------------------- +// Class : "JsonAllianceLibrary". + + class JsonAllianceLibrary : public JsonObject { + public: + static void initialize (); + JsonAllianceLibrary ( unsigned long flags ); + virtual std::string getTypeName () const; + virtual JsonAllianceLibrary* clone ( unsigned long flags ) const; + virtual void toData ( JsonStack& ); + }; + + } // CRL namespace. diff --git a/crlcore/src/ccore/crlcore/Banner.h b/crlcore/src/ccore/crlcore/Banner.h index cc809bb6..79f8d8ad 100644 --- a/crlcore/src/ccore/crlcore/Banner.h +++ b/crlcore/src/ccore/crlcore/Banner.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/crlcore/src/ccore/crlcore/Catalog.h b/crlcore/src/ccore/crlcore/Catalog.h index 73a9f4ed..0aa32d6d 100644 --- a/crlcore/src/ccore/crlcore/Catalog.h +++ b/crlcore/src/ccore/crlcore/Catalog.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -34,6 +34,8 @@ namespace CRL { using std::string; using std::map; + using Hurricane::JsonObject; + using Hurricane::JsonStack; using Hurricane::_TName; using Hurricane::Name; using Hurricane::Record; @@ -106,16 +108,18 @@ namespace CRL { inline bool setDelete ( bool value ); inline bool setPhysical ( bool value ); inline bool setLogical ( bool value ); + inline bool setInMemory ( bool value ); // Accessors. inline Cell* getCell () const; inline Library* getLibrary () const; inline unsigned int getDepth () const; // Modifiers. inline void merge ( const State& other ); - inline Cell* setCell ( Cell* cell ); + Cell* setCell ( Cell* cell ); inline Library* setLibrary ( Library* library ); inline void setDepth ( unsigned int depth ); // Hurricane Management. + void toJson ( JsonWriter* w ) const; inline string _getTypeName () const; string _getString () const; Record* _getRecord () const; @@ -126,7 +130,18 @@ namespace CRL { unsigned int _depth; Cell* _cell; Library* _library; - }; + + // Json Property. + public: + class JsonState : public JsonObject { + public: + static void initialize (); + JsonState ( unsigned long flags ); + virtual string getTypeName () const; + virtual JsonState* clone ( unsigned long ) const; + virtual void toData ( JsonStack& ); + }; + }; private: // Attributes. @@ -142,7 +157,6 @@ namespace CRL { // ------------------------------------------------------------------- // Class : "CRL::CatalogProperty". - class CatalogProperty : public PrivateProperty { public: @@ -154,6 +168,8 @@ namespace CRL { inline Catalog::State* getState () const; inline void setState ( Catalog::State* state ); virtual void onReleasedBy ( DBo* owner ); + virtual bool hasJson () const; + virtual void toJson ( JsonWriter* w, const DBo* ) const; virtual string _getTypeName () const; virtual string _getString () const; virtual Record* _getRecord () const; @@ -168,6 +184,19 @@ namespace CRL { }; +// ------------------------------------------------------------------- +// Class : "CRL::JsonCatalogProperty". + + class JsonCatalogProperty : public JsonObject { + public: + static void initialize (); + JsonCatalogProperty ( unsigned long ); + virtual string getTypeName () const; + virtual JsonCatalogProperty* clone ( unsigned long ) const; + virtual void toData ( JsonStack& ); + }; + + // ------------------------------------------------------------------- // Inline Functions. @@ -193,7 +222,7 @@ namespace CRL { inline bool Catalog::State::setDelete ( bool value ) { return setFlags(Delete ,value); } inline bool Catalog::State::setPhysical ( bool value ) { return setFlags(Physical ,value); } inline bool Catalog::State::setLogical ( bool value ) { return setFlags(Logical ,value); } - inline Cell* Catalog::State::setCell ( Cell* cell ) { return _cell = cell; } + inline bool Catalog::State::setInMemory ( bool value ) { return setFlags(InMemory ,value); } inline Library* Catalog::State::setLibrary ( Library* library ) { return _library = library; } inline void Catalog::State::setDepth ( unsigned int depth ) { _depth = depth; } inline Cell* Catalog::State::getCell () const { return _cell; } diff --git a/crlcore/src/ccore/crlcore/CellGauge.h b/crlcore/src/ccore/crlcore/CellGauge.h index cdb1b231..6bdd4358 100644 --- a/crlcore/src/ccore/crlcore/CellGauge.h +++ b/crlcore/src/ccore/crlcore/CellGauge.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -29,7 +29,9 @@ namespace CRL { using std::string; using std::map; - + using Hurricane::JsonObject; + using Hurricane::JsonStack; + using Hurricane::Initializer; using Hurricane::Record; using Hurricane::DbU; using Hurricane::Name; @@ -38,7 +40,6 @@ namespace CRL { // ------------------------------------------------------------------- // Class : "CRL::CellGauge". - class CellGauge { public: @@ -57,6 +58,7 @@ namespace CRL { inline const DbU::Unit getSliceStep () const; CellGauge* getClone () const; // Hurricane management. + void toJson ( JsonWriter* ) const; virtual string _getTypeName () const; virtual string _getString () const; virtual Record* _getRecord () const; @@ -96,6 +98,19 @@ namespace CRL { inline const DbU::Unit CellGauge::getSliceStep () const { return _sliceStep; } +// ------------------------------------------------------------------- +// Class : "JsonCellGauge". + + class JsonCellGauge : public JsonObject { + public: + static void initialize (); + JsonCellGauge ( unsigned long flags ); + virtual string getTypeName () const; + virtual JsonCellGauge* clone ( unsigned long flags ) const; + virtual void toData ( JsonStack& ); + }; + + } // namespace CRL. diff --git a/crlcore/src/ccore/crlcore/DefImport.h b/crlcore/src/ccore/crlcore/DefImport.h index 66cef2ca..1aa82233 100644 --- a/crlcore/src/ccore/crlcore/DefImport.h +++ b/crlcore/src/ccore/crlcore/DefImport.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2010-2015, All Rights Reserved +// Copyright (c) UPMC 2010-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/crlcore/src/ccore/crlcore/Environment.h b/crlcore/src/ccore/crlcore/Environment.h index facceecd..b41903d2 100644 --- a/crlcore/src/ccore/crlcore/Environment.h +++ b/crlcore/src/ccore/crlcore/Environment.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -19,11 +19,18 @@ #include #include -#include +#include "hurricane/Commons.h" +#include "crlcore/SearchPath.h" namespace CRL { + using Hurricane::JsonObject; + using Hurricane::JsonStack; + + +// ------------------------------------------------------------------- +// Class : "Environment". class Environment { public: @@ -76,6 +83,7 @@ namespace CRL { void addSYSTEM_LIBRARY ( const char* value, const char* libName, unsigned int mode=Append ); // Methods. std::string getPrint () const; + void toJson ( JsonWriter* ) const; inline std::string _getTypeName () const; std::string _getString () const; Record* _getRecord () const; @@ -134,6 +142,19 @@ namespace CRL { inline std::string Environment::_getTypeName () const { return "Environment"; } +// ------------------------------------------------------------------- +// Class : "JsonEnvironment". + + class JsonEnvironment : public JsonObject { + public: + static void initialize (); + JsonEnvironment ( unsigned long flags ); + virtual std::string getTypeName () const; + virtual JsonEnvironment* clone ( unsigned long flags ) const; + virtual void toData ( JsonStack& ); + }; + + } // CRL namespace. diff --git a/crlcore/src/ccore/crlcore/GdsDriver.h b/crlcore/src/ccore/crlcore/GdsDriver.h index 60b60c75..0fcc32b1 100644 --- a/crlcore/src/ccore/crlcore/GdsDriver.h +++ b/crlcore/src/ccore/crlcore/GdsDriver.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2009-2015, All Rights Reserved +// Copyright (c) UPMC 2009-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/crlcore/src/ccore/crlcore/GraphicToolEngine.h b/crlcore/src/ccore/crlcore/GraphicToolEngine.h index 55f00821..3d0f223a 100644 --- a/crlcore/src/ccore/crlcore/GraphicToolEngine.h +++ b/crlcore/src/ccore/crlcore/GraphicToolEngine.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/crlcore/src/ccore/crlcore/Ispd05Bookshelf.h b/crlcore/src/ccore/crlcore/Ispd05Bookshelf.h index b6b91c1d..91636f39 100644 --- a/crlcore/src/ccore/crlcore/Ispd05Bookshelf.h +++ b/crlcore/src/ccore/crlcore/Ispd05Bookshelf.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2014-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/crlcore/src/ccore/crlcore/LefDefExtension.h b/crlcore/src/ccore/crlcore/LefDefExtension.h index 0177112a..a4d378a9 100644 --- a/crlcore/src/ccore/crlcore/LefDefExtension.h +++ b/crlcore/src/ccore/crlcore/LefDefExtension.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/crlcore/src/ccore/crlcore/Measures.h b/crlcore/src/ccore/crlcore/Measures.h index 83fb8114..ea50a0ed 100644 --- a/crlcore/src/ccore/crlcore/Measures.h +++ b/crlcore/src/ccore/crlcore/Measures.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/crlcore/src/ccore/crlcore/NetExtension.h b/crlcore/src/ccore/crlcore/NetExtension.h index e22b87e0..ef3972df 100644 --- a/crlcore/src/ccore/crlcore/NetExtension.h +++ b/crlcore/src/ccore/crlcore/NetExtension.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/crlcore/src/ccore/crlcore/RoutingGauge.h b/crlcore/src/ccore/crlcore/RoutingGauge.h index 83ff3138..80e3d1b9 100644 --- a/crlcore/src/ccore/crlcore/RoutingGauge.h +++ b/crlcore/src/ccore/crlcore/RoutingGauge.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -34,12 +34,15 @@ namespace Hurricane { namespace CRL { - using std::string; - using std::vector; - using Hurricane::Name; - using Hurricane::Record; - using Hurricane::Layer; - using Hurricane::Technology; + using std::string; + using std::vector; + using Hurricane::JsonObject; + using Hurricane::JsonStack; + using Hurricane::Initializer; + using Hurricane::Name; + using Hurricane::Record; + using Hurricane::Layer; + using Hurricane::Technology; // ------------------------------------------------------------------- @@ -48,6 +51,8 @@ namespace CRL { class RoutingGauge { public: + // Constants. + static const size_t nlayerdepth; // Constructors & Destructors. static RoutingGauge* create ( const char* name ); virtual void destroy (); @@ -76,6 +81,7 @@ namespace CRL { void addLayerGauge ( RoutingLayerGauge* layerGauge ); void checkConnexity () const; // Hurricane Managment. + void toJson ( JsonWriter* ) const; virtual Record* _getRecord ( Record* record=NULL ) const; virtual string _getString () const; virtual string _getTypeName () const; @@ -107,6 +113,19 @@ namespace CRL { inline DbU::Unit RoutingGauge::getViaWidth ( size_t depth ) const { return getLayerGauge(depth)->getViaWidth(); } +// ------------------------------------------------------------------- +// Class : "JsonRoutingGauge". + + class JsonRoutingGauge : public JsonObject { + public: + static void initialize (); + JsonRoutingGauge ( unsigned long flags ); + virtual string getTypeName () const; + virtual JsonRoutingGauge* clone ( unsigned long flags ) const; + virtual void toData ( JsonStack& ); + }; + + } // CRL namespace. INSPECTOR_P_SUPPORT(CRL::RoutingGauge); diff --git a/crlcore/src/ccore/crlcore/RoutingLayerGauge.h b/crlcore/src/ccore/crlcore/RoutingLayerGauge.h index c81240e7..b3c10386 100644 --- a/crlcore/src/ccore/crlcore/RoutingLayerGauge.h +++ b/crlcore/src/ccore/crlcore/RoutingLayerGauge.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -20,6 +20,7 @@ #include #include "hurricane/Commons.h" +#include "hurricane/Error.h" #include "hurricane/DbU.h" #include "hurricane/Collection.h" #include "hurricane/Slot.h" @@ -32,9 +33,9 @@ namespace Hurricane { namespace Constant { - enum Direction { Horizontal = (1<<0) - , Vertical = (1<<1) - }; + enum Direction { Horizontal = (1<<0) + , Vertical = (1<<1) + }; enum LayerGaugeType { Default = (1<<0) , PinOnly = (1<<1) @@ -54,9 +55,10 @@ namespace Constant { namespace CRL { - using std::map; - + using Hurricane::JsonObject; + using Hurricane::JsonStack; + using Hurricane::Initializer; using Hurricane::GenericCollection; using Hurricane::GenericLocator; using Hurricane::GenericFilter; @@ -76,62 +78,67 @@ namespace CRL { public: // Constructors & Destructors. - static RoutingLayerGauge* create ( const Layer* layer - , unsigned int direction - , unsigned int type - , unsigned int depth - , double density - , DbU::Unit offset - , DbU::Unit pitch - , DbU::Unit wireWidth - , DbU::Unit viaWidth ); - virtual void destroy (); - // Accessors. - inline const Layer* getLayer () const; - inline const Layer* getBlockageLayer () const; - inline unsigned int getDepth () const; - inline unsigned int getDirection () const; - inline unsigned int getType () const; - inline double getDensity () const; - inline DbU::Unit getOffset () const; - inline DbU::Unit getPitch () const; - inline DbU::Unit getHalfPitch () const; - inline DbU::Unit getWireWidth () const; - inline DbU::Unit getHalfWireWidth () const; - inline DbU::Unit getViaWidth () const; - inline DbU::Unit getHalfViaWidth () const; - void divide ( DbU::Unit dividend, long& quotient, long& modulo ) const; - unsigned int getTrackNumber ( DbU::Unit start, DbU::Unit stop ) const; - unsigned int getTrackIndex ( DbU::Unit start, DbU::Unit stop, DbU::Unit position, unsigned mode ) const; - DbU::Unit getTrackPosition ( DbU::Unit start, unsigned depth ) const; - // Hurricane Managment. - virtual string _getTypeName () const; - virtual string _getString () const; - virtual Record* _getRecord () const; + static RoutingLayerGauge* create ( const Layer* layer + , Constant::Direction direction + , Constant::LayerGaugeType type + , unsigned int depth + , double density + , DbU::Unit offset + , DbU::Unit pitch + , DbU::Unit wireWidth + , DbU::Unit viaWidth + , DbU::Unit obsDw ); + virtual void destroy (); + // Accessors. + inline const Layer* getLayer () const; + inline const Layer* getBlockageLayer () const; + inline unsigned int getDepth () const; + inline Constant::Direction getDirection () const; + inline Constant::LayerGaugeType getType () const; + inline double getDensity () const; + inline DbU::Unit getOffset () const; + inline DbU::Unit getPitch () const; + inline DbU::Unit getHalfPitch () const; + inline DbU::Unit getWireWidth () const; + inline DbU::Unit getHalfWireWidth () const; + inline DbU::Unit getViaWidth () const; + inline DbU::Unit getHalfViaWidth () const; + inline DbU::Unit getObstacleDw () const; + void divide ( DbU::Unit dividend, long& quotient, long& modulo ) const; + unsigned int getTrackNumber ( DbU::Unit start, DbU::Unit stop ) const; + unsigned int getTrackIndex ( DbU::Unit start, DbU::Unit stop, DbU::Unit position, unsigned mode ) const; + DbU::Unit getTrackPosition ( DbU::Unit start, unsigned depth ) const; + // Hurricane Managment. + void toJson ( JsonWriter* ) const; + virtual string _getTypeName () const; + virtual string _getString () const; + virtual Record* _getRecord () const; protected: // Internal - Attributes. - const Layer* _layer; - const Layer* _blockageLayer; - unsigned int _direction; - unsigned int _type; - unsigned int _depth; - double _density; - DbU::Unit _offset; - DbU::Unit _pitch; - DbU::Unit _wireWidth; - DbU::Unit _viaWidth; + const Layer* _layer; + const Layer* _blockageLayer; + Constant::Direction _direction; + Constant::LayerGaugeType _type; + unsigned int _depth; + double _density; + DbU::Unit _offset; + DbU::Unit _pitch; + DbU::Unit _wireWidth; + DbU::Unit _viaWidth; + DbU::Unit _obstacleDw; // Internal - Constructors & Destructors. - RoutingLayerGauge ( const Layer* layer - , unsigned int direction - , unsigned int type - , unsigned int depth - , double density - , DbU::Unit offset - , DbU::Unit pitch - , DbU::Unit wireWidth - , DbU::Unit viaWidth ); + RoutingLayerGauge ( const Layer* layer + , Constant::Direction direction + , Constant::LayerGaugeType type + , unsigned int depth + , double density + , DbU::Unit offset + , DbU::Unit pitch + , DbU::Unit wireWidth + , DbU::Unit viaWidth + , DbU::Unit obsDw ); virtual ~RoutingLayerGauge (); virtual void _preDestroy(); RoutingLayerGauge& operator= ( const RoutingLayerGauge& ); @@ -156,23 +163,36 @@ namespace CRL { // ------------------------------------------------------------------- // Inline Functions. - inline const Layer* RoutingLayerGauge::getLayer () const { return ( _layer ); } - inline const Layer* RoutingLayerGauge::getBlockageLayer () const { return ( _blockageLayer ); } - inline unsigned int RoutingLayerGauge::getDirection () const { return ( _direction ); } - inline unsigned int RoutingLayerGauge::getType () const { return ( _type ); } - inline unsigned int RoutingLayerGauge::getDepth () const { return ( _depth ); } - inline double RoutingLayerGauge::getDensity () const { return ( _density ); } - inline DbU::Unit RoutingLayerGauge::getOffset () const { return ( _offset ); } - inline DbU::Unit RoutingLayerGauge::getPitch () const { return ( _pitch ); } - inline DbU::Unit RoutingLayerGauge::getHalfPitch () const { return ( _pitch>>1 ); } - inline DbU::Unit RoutingLayerGauge::getWireWidth () const { return ( _wireWidth ); } - inline DbU::Unit RoutingLayerGauge::getHalfWireWidth () const { return ( _wireWidth>>1 ); } - inline DbU::Unit RoutingLayerGauge::getViaWidth () const { return ( _viaWidth ); } - inline DbU::Unit RoutingLayerGauge::getHalfViaWidth () const { return ( _viaWidth>>1 ); } + inline const Layer* RoutingLayerGauge::getLayer () const { return ( _layer ); } + inline const Layer* RoutingLayerGauge::getBlockageLayer () const { return ( _blockageLayer ); } + inline Constant::Direction RoutingLayerGauge::getDirection () const { return ( _direction ); } + inline Constant::LayerGaugeType RoutingLayerGauge::getType () const { return ( _type ); } + inline unsigned int RoutingLayerGauge::getDepth () const { return ( _depth ); } + inline double RoutingLayerGauge::getDensity () const { return ( _density ); } + inline DbU::Unit RoutingLayerGauge::getOffset () const { return ( _offset ); } + inline DbU::Unit RoutingLayerGauge::getPitch () const { return ( _pitch ); } + inline DbU::Unit RoutingLayerGauge::getHalfPitch () const { return ( _pitch>>1 ); } + inline DbU::Unit RoutingLayerGauge::getWireWidth () const { return ( _wireWidth ); } + inline DbU::Unit RoutingLayerGauge::getHalfWireWidth () const { return ( _wireWidth>>1 ); } + inline DbU::Unit RoutingLayerGauge::getViaWidth () const { return ( _viaWidth ); } + inline DbU::Unit RoutingLayerGauge::getHalfViaWidth () const { return ( _viaWidth>>1 ); } + inline DbU::Unit RoutingLayerGauge::getObstacleDw () const { return ( _obstacleDw ); } +// ------------------------------------------------------------------- +// Class : "JsonRoutingLayerGauge". -} // End of CRL namespace. + class JsonRoutingLayerGauge : public JsonObject { + public: + static void initialize (); + JsonRoutingLayerGauge ( unsigned long flags ); + virtual string getTypeName () const; + virtual JsonRoutingLayerGauge* clone ( unsigned long flags ) const; + virtual void toData ( JsonStack& ); + }; + + +} // CRL namespace. INSPECTOR_P_SUPPORT(CRL::RoutingLayerGauge); @@ -182,6 +202,18 @@ INSPECTOR_P_SUPPORT(CRL::RoutingLayerGauge); // Inspector Support for : "const ::Constant::Direction*". +inline void from ( Constant::Direction& direction, const std::string& s ) +{ + if (s == "Vertical") direction = Constant::Vertical; + else { + if (s != "Horizontal") + std::cerr << Hurricane::Error( "::from(Direction&,string&): Unknown value \"%s\"." + , s.c_str() ) << std::endl; + direction = Constant::Horizontal; + } +} + + template<> inline std::string getString ( const Constant::Direction* direction ) @@ -190,7 +222,7 @@ inline std::string getString case Constant::Horizontal: return "Horizontal"; case Constant::Vertical: return "Vertical"; } - return ( "Unknown Constant::Direction" ); + return "Unknown Constant::Direction"; } @@ -202,7 +234,7 @@ inline std::string getString case Constant::Horizontal: return "Horizontal"; case Constant::Vertical: return "Vertical"; } - return ( "Unknown Constant::Direction" ); + return "Unknown Constant::Direction"; } @@ -213,19 +245,43 @@ IOSTREAM_POINTER_SUPPORT(Constant::Direction); // Inspector Support for : "const Constant::LayerGaugeType*". +inline void from ( Constant::LayerGaugeType& type, const std::string& s ) +{ + if (s == "PinOnly") type = Constant::PinOnly; + else { + if (s != "Default") + std::cerr << Hurricane::Error( "::from(LayerGaugeType&,string&): Unknown value \"%s\"." + , s.c_str() ) << std::endl; + type = Constant::Default; + } +} + + template<> inline std::string getString ( const Constant::LayerGaugeType* layerGaugeType ) { switch ( *layerGaugeType ) { - case Constant::Horizontal: return "Horizontal"; - case Constant::Vertical: return "Vertical"; + case Constant::Default: return "Default"; + case Constant::PinOnly: return "PinOnly"; } - return ( "Unknown Constant::LayerGaugeType" ); + return "Unknown Constant::LayerGaugeType"; +} + + +template<> +inline std::string getString + ( const Constant::LayerGaugeType layerGaugeType ) +{ + switch ( layerGaugeType ) { + case Constant::Default: return "Default"; + case Constant::PinOnly: return "PinOnly"; + } + return "Unknown Constant::LayerGaugeType"; } IOSTREAM_POINTER_SUPPORT(Constant::LayerGaugeType); -# endif // __CRL_ROUTING_LAYER_GAUGE_H__ +#endif // CRL_ROUTING_LAYER_GAUGE_H diff --git a/crlcore/src/ccore/crlcore/SearchPath.h b/crlcore/src/ccore/crlcore/SearchPath.h index 2b315e79..bd97ff9c 100644 --- a/crlcore/src/ccore/crlcore/SearchPath.h +++ b/crlcore/src/ccore/crlcore/SearchPath.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/crlcore/src/ccore/crlcore/ToolBox.h b/crlcore/src/ccore/crlcore/ToolBox.h index 2f90021f..7c188515 100644 --- a/crlcore/src/ccore/crlcore/ToolBox.h +++ b/crlcore/src/ccore/crlcore/ToolBox.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -69,8 +69,12 @@ namespace CRL { public: typedef std::function< Name(const Name&) > converter_t; public: - static Name vlogToVhdl ( const Name& vlogName ); - static void toVhdl ( Cell* topCell, unsigned int flags ); + static Name vlogToVhdl ( const Name& vlogName ); + static void toVhdl ( Cell* topCell, unsigned int flags ); + NamingScheme ( unsigned int flags ); + Name convert ( const Name& ) const; + private: + converter_t _converter; }; diff --git a/crlcore/src/ccore/crlcore/ToolEngine.h b/crlcore/src/ccore/crlcore/ToolEngine.h index f4b5edae..84708c59 100644 --- a/crlcore/src/ccore/crlcore/ToolEngine.h +++ b/crlcore/src/ccore/crlcore/ToolEngine.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/crlcore/src/ccore/crlcore/Utilities.h b/crlcore/src/ccore/crlcore/Utilities.h index 9dbaf189..c88e53ed 100644 --- a/crlcore/src/ccore/crlcore/Utilities.h +++ b/crlcore/src/ccore/crlcore/Utilities.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -273,6 +273,7 @@ inline std::string tty::bgcolor ( unsigned int mask ) template inline mstream& operator<< ( T* t ); template inline mstream& operator<< ( const T& t ); template inline mstream& operator<< ( const T* t ); + inline mstream& put ( char c ); inline mstream& flush (); // Overload for manipulators. inline mstream &operator<< ( std::ostream &(*pf)(std::ostream &) ); @@ -290,6 +291,7 @@ inline std::string tty::bgcolor ( unsigned int mask ) inline unsigned int mstream::getActiveMask () { return _activeMask; } inline void mstream::setStreamMask ( unsigned int mask ) { _streamMask |= mask; } inline void mstream::unsetStreamMask( unsigned int mask ) { _streamMask &= ~mask; } + inline mstream& mstream::put ( char c ) { if (enabled()) static_cast(this)->put(c); return *this; } inline mstream& mstream::flush () { if (enabled()) static_cast(this)->flush(); return *this; } inline mstream& mstream::operator<< ( std::ostream& (*pf)(std::ostream&) ) { if (enabled()) (*pf)(*this); return *this; } diff --git a/crlcore/src/ccore/crlcore/VhdlBit.h b/crlcore/src/ccore/crlcore/VhdlBit.h index ef069911..9818b6db 100644 --- a/crlcore/src/ccore/crlcore/VhdlBit.h +++ b/crlcore/src/ccore/crlcore/VhdlBit.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2015-2015, All Rights Reserved +// Copyright (c) UPMC 2015-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -59,6 +59,7 @@ namespace Vhdl { const Signal* getSignal () const; std::string getName () const; size_t getIndex () const; + inline void destroy (); std::string _getString () const; Record* _getRecord () const; private: @@ -151,6 +152,7 @@ namespace Vhdl { inline BitProperty* Bit::getProperty () const { return (BitProperty*)((ptrdiff_t)(this) - _offset); } inline const Net* Bit::getNet () const { return (const Net*)getProperty()->getOwner(); } + inline void Bit::destroy () { ((Net*)getProperty()->getOwner())->remove( getProperty() ); } } // Vhdl Namespace. diff --git a/crlcore/src/ccore/crlcore/VhdlEntity.h b/crlcore/src/ccore/crlcore/VhdlEntity.h index d5d8270f..4e74ec34 100644 --- a/crlcore/src/ccore/crlcore/VhdlEntity.h +++ b/crlcore/src/ccore/crlcore/VhdlEntity.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2015-2015, All Rights Reserved +// Copyright (c) UPMC 2015-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -25,6 +25,7 @@ namespace Hurricane { class Net; class Instance; } +#include "crlcore/ToolBox.h" #include "crlcore/VhdlSignal.h" @@ -38,6 +39,7 @@ namespace Vhdl { using Hurricane::Cell; using Hurricane::Instance; using Hurricane::PrivateProperty; + using CRL::NamingScheme; class Signal; class ScalarSignal; @@ -64,7 +66,6 @@ namespace Vhdl { , AsInnerSignal = 0x0010 }; public: - static bool parseNetName ( const Net*, std::string& stem, size_t& index ); static std::vector& getAllEntities (); public: @@ -83,11 +84,13 @@ namespace Vhdl { void toComponent ( std::ostream& ) const; void toInstance ( std::ostream&, Instance* ) const; void toEntity ( std::ostream& ) const; + bool parseNetName ( const Net*, std::string& stem, size_t& index ); std::string _getString () const; Record* _getRecord () const; private: static std::vector _entities; static std::ptrdiff_t _offset; + NamingScheme _ns; SignalSet _signals; SignalSet _globals; unsigned int _flags; diff --git a/crlcore/src/ccore/crlcore/VhdlPortMap.h b/crlcore/src/ccore/crlcore/VhdlPortMap.h index a2ae0aba..cf513456 100644 --- a/crlcore/src/ccore/crlcore/VhdlPortMap.h +++ b/crlcore/src/ccore/crlcore/VhdlPortMap.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2015-2015, All Rights Reserved +// Copyright (c) UPMC 2015-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/crlcore/src/ccore/crlcore/VhdlSignal.h b/crlcore/src/ccore/crlcore/VhdlSignal.h index 550dfd2c..14189192 100644 --- a/crlcore/src/ccore/crlcore/VhdlSignal.h +++ b/crlcore/src/ccore/crlcore/VhdlSignal.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2015-2015, All Rights Reserved +// Copyright (c) UPMC 2015-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/crlcore/src/ccore/iccad04/Iccad04Lefdef.cpp b/crlcore/src/ccore/iccad04/Iccad04Lefdef.cpp index 24d0c52e..aeb4b067 100644 --- a/crlcore/src/ccore/iccad04/Iccad04Lefdef.cpp +++ b/crlcore/src/ccore/iccad04/Iccad04Lefdef.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2010-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2010-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -420,6 +420,7 @@ namespace { DbU::Unit width = sliceHeight * (slices-2); Net* net = Net::create ( cell, "blockageNet" ); + net->setType( Net::Type::BLOCKAGE ); Horizontal::create ( net , BLOCKAGE2 diff --git a/crlcore/src/ccore/ispd05/Ispd05Bookshelf.cpp b/crlcore/src/ccore/ispd05/Ispd05Bookshelf.cpp index 893338bb..15a1d4de 100644 --- a/crlcore/src/ccore/ispd05/Ispd05Bookshelf.cpp +++ b/crlcore/src/ccore/ispd05/Ispd05Bookshelf.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2014-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/crlcore/src/ccore/lefdef/DefImport.cpp b/crlcore/src/ccore/lefdef/DefImport.cpp index d2249b25..a93a2299 100644 --- a/crlcore/src/ccore/lefdef/DefImport.cpp +++ b/crlcore/src/ccore/lefdef/DefImport.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2010-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2010-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/crlcore/src/ccore/lefdef/DefParser.cpp b/crlcore/src/ccore/lefdef/DefParser.cpp index 9bbbad52..b8aaa631 100644 --- a/crlcore/src/ccore/lefdef/DefParser.cpp +++ b/crlcore/src/ccore/lefdef/DefParser.cpp @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/crlcore/src/ccore/lefdef/LefDefExtension.cpp b/crlcore/src/ccore/lefdef/LefDefExtension.cpp index 4b4396bc..c80aff0c 100644 --- a/crlcore/src/ccore/lefdef/LefDefExtension.cpp +++ b/crlcore/src/ccore/lefdef/LefDefExtension.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/crlcore/src/ccore/lefdef/LefExport.cpp b/crlcore/src/ccore/lefdef/LefExport.cpp index 7b834f44..259d1a3d 100644 --- a/crlcore/src/ccore/lefdef/LefExport.cpp +++ b/crlcore/src/ccore/lefdef/LefExport.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) LIP6 2010-2015, All Rights Reserved +// Copyright (c) LIP6 2010-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -389,7 +389,7 @@ namespace { CHECK_STATUS(_status); #endif - if ( blockageNet != 0 ) { + if ( blockageNet != NULL ) { _status = lefwStartMacroObs (); CHECK_STATUS(_status); diff --git a/crlcore/src/ccore/lefdef/LefParser.cpp b/crlcore/src/ccore/lefdef/LefParser.cpp index b04f744e..f356703e 100644 --- a/crlcore/src/ccore/lefdef/LefParser.cpp +++ b/crlcore/src/ccore/lefdef/LefParser.cpp @@ -1,42 +1,9 @@ - // -*- C++ -*- // -// This file is part of the Coriolis Project. -// Copyright (C) Laboratoire LIP6 - Departement ASIM -// Universite Pierre et Marie Curie +// This file is part of the Coriolis Software. +// Copyright (c) UPMC 2008-2016, All Rights Reserved // -// Main contributors : -// Christophe Alexandre -// Sophie Belloeil -// Hugo Clément -// Jean-Paul Chaput -// Damien Dupuis -// Christian Masson -// Marek Sroka -// -// The Coriolis Project is free software; you can redistribute it -// and/or modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// The Coriolis Project is distributed in the hope that it will be -// useful, but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with the Coriolis Project; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -// USA -// -// License-Tag -// Authors-Tag -// =================================================================== -// -// $Id: CParsLEF.cpp,v 1.28 2007/07/29 15:27:25 jpc Exp $ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | C O R I O L I S | // | Alliance / Hurricane Interface | // | | @@ -44,30 +11,24 @@ // | E-mail : Christophe.Alexandre@lip6.fr | // | =============================================================== | // | C++ Module : "./LefParser.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ - -# include "hurricane/Warning.h" -# include "hurricane/DataBase.h" -# include "hurricane/BasicLayer.h" -# include "hurricane/ViaLayer.h" -# include "hurricane/Net.h" -# include "hurricane/Pad.h" -# include "hurricane/Vertical.h" -# include "hurricane/Horizontal.h" -# include "hurricane/NetExternalComponents.h" -# include "hurricane/Cell.h" - -# include "crlcore/AllianceFramework.h" -# include "LefDef.h" - -# if HAVE_LEFDEF && defined(LEF_ENABLED) -# include "lefrReader.hpp" -# endif +#include "hurricane/Warning.h" +#include "hurricane/DataBase.h" +#include "hurricane/BasicLayer.h" +#include "hurricane/ViaLayer.h" +#include "hurricane/Net.h" +#include "hurricane/Pad.h" +#include "hurricane/Vertical.h" +#include "hurricane/Horizontal.h" +#include "hurricane/NetExternalComponents.h" +#include "hurricane/Cell.h" +#include "crlcore/AllianceFramework.h" +#include "LefDef.h" +#if HAVE_LEFDEF && defined(LEF_ENABLED) +# include "lefrReader.hpp" +#endif # define ONLY_PAD_PINS 1 @@ -110,8 +71,10 @@ namespace { if (!layer) throw Error("No layer for blockage"); - if ( blockageNet == NULL ) + if ( blockageNet == NULL ) { blockageNet = Net::create ( cell, "blockagenet" ); + blockageNet->setType ( Net::Type::BLOCKAGE ); + } Pad::create ( blockageNet, layer, bb ); } diff --git a/crlcore/src/ccore/properties/Measures.cpp b/crlcore/src/ccore/properties/Measures.cpp index f0fa7146..c5566ecf 100644 --- a/crlcore/src/ccore/properties/Measures.cpp +++ b/crlcore/src/ccore/properties/Measures.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/crlcore/src/ccore/properties/NetExtension.cpp b/crlcore/src/ccore/properties/NetExtension.cpp index bced0153..4dc29598 100644 --- a/crlcore/src/ccore/properties/NetExtension.cpp +++ b/crlcore/src/ccore/properties/NetExtension.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/crlcore/src/ccore/toolbox/NamingScheme.cpp b/crlcore/src/ccore/toolbox/NamingScheme.cpp index 75d9aea9..067ce8ab 100644 --- a/crlcore/src/ccore/toolbox/NamingScheme.cpp +++ b/crlcore/src/ccore/toolbox/NamingScheme.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -110,7 +110,9 @@ namespace CRL { vector nets; forEach ( Net*, inet, topCell->getNets() ) nets.push_back( *inet ); - for ( auto net : nets ) net->setName( converter( net->getName() ) ); + for ( auto net : nets ) { + net->setName( converter( net->getName() ) ); + } vector instances; set models; @@ -127,4 +129,18 @@ namespace CRL { } + NamingScheme::NamingScheme ( unsigned int flags ) + : _converter(nullptr) + { + if (flags & FromVerilog) _converter = vlogToVhdl; + } + + + Name NamingScheme::convert ( const Name& name ) const + { + if (_converter == nullptr) return name; + return _converter(name); + } + + } // CRL namespace. diff --git a/crlcore/src/ccore/toolbox/RoutingPads.cpp b/crlcore/src/ccore/toolbox/RoutingPads.cpp index 4f307e07..42dde098 100644 --- a/crlcore/src/ccore/toolbox/RoutingPads.cpp +++ b/crlcore/src/ccore/toolbox/RoutingPads.cpp @@ -208,10 +208,10 @@ void createPlacedRoutingPadsAndPinsRing ( Cell* top_cell ) netOccurrence = Occurrence(net); for_each_occurrence ( plugOccurrence, HyperNet(netOccurrence).getLeafPlugOccurrences() ) { - ltrace(58) << "Creating Routing Pad " << plugOccurrence << endl;ltracein(58); - cerr << RoutingPad::create ( net, plugOccurrence, RoutingPad::BiggestArea ) << endl; - //ltraceout(58); - end_for; + cdebug.log(109,1) << "Creating Routing Pad " << plugOccurrence << endl; + cerr << RoutingPad::create ( net, plugOccurrence, RoutingPad::BiggestArea ) << endl; + //ltraceout(58); + end_for; } vector pins; for_each_pin ( pin, net->getPins() ) { diff --git a/crlcore/src/ccore/toolbox/ToVhdlName.cpp b/crlcore/src/ccore/toolbox/ToVhdlName.cpp index e0a7ec87..ef463c6d 100644 --- a/crlcore/src/ccore/toolbox/ToVhdlName.cpp +++ b/crlcore/src/ccore/toolbox/ToVhdlName.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/crlcore/src/ccore/toolbox/ToolBox.cpp b/crlcore/src/ccore/toolbox/ToolBox.cpp index d3f94173..8d921bc9 100644 --- a/crlcore/src/ccore/toolbox/ToolBox.cpp +++ b/crlcore/src/ccore/toolbox/ToolBox.cpp @@ -1,30 +1,29 @@ - // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2012, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | // | Alliance / Hurricane Interface | // | | // | Author : The Borg Collective | -// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Module : "./ToolBox.cpp" | // +-----------------------------------------------------------------+ -#include "hurricane/Plug.h" -#include "hurricane/Pin.h" -#include "hurricane/Library.h" -#include "hurricane/Net.h" -#include "hurricane/Cell.h" -#include "hurricane/Instance.h" -#include "hurricane/Segment.h" -#include "hurricane/NetExternalComponents.h" -#include "hurricane/UpdateSession.h" -#include "hurricane/Warning.h" +#include "hurricane/Plug.h" +#include "hurricane/Pin.h" +#include "hurricane/Library.h" +#include "hurricane/Net.h" +#include "hurricane/Cell.h" +#include "hurricane/Instance.h" +#include "hurricane/Segment.h" +#include "hurricane/NetExternalComponents.h" +#include "hurricane/UpdateSession.h" +#include "hurricane/Warning.h" using namespace Hurricane; #include "crlcore/ToolBox.h" @@ -279,6 +278,7 @@ static void AttachPlugOrPin(Net& net) } + void createPartRing(Cell* cell, Name nom) { if (!cell) @@ -295,6 +295,7 @@ void createPartRing(Cell* cell, Name nom) UpdateSession::close(); } + void createPartRing2(Net& net) { UpdateSession::open(); @@ -427,15 +428,16 @@ void createContactsRing(Cell* cell) void deleteEmptyNets ( Cell* cell ) { vector nets; - forEach ( Net*, inet, cell->getNets() ) - nets.push_back ( *inet ); + for ( Net* net : cell->getNets() ) + nets.push_back ( net ); - for ( size_t i=0 ; igetComponents().getFirst() - && ( nets[i]->getType() != Net::Type::POWER ) - && ( nets[i]->getType() != Net::Type::GROUND ) - && ( nets[i]->getType() != Net::Type::CLOCK ) ) { - nets[i]->destroy (); + for ( size_t i=0 ; igetComponents().getFirst() + and (nets[i]->getType() != Net::Type::POWER ) + and (nets[i]->getType() != Net::Type::GROUND ) + and (nets[i]->getType() != Net::Type::CLOCK ) + and (nets[i]->getType() != Net::Type::BLOCKAGE) ) { + nets[i]->destroy(); } } } diff --git a/crlcore/src/cyclop/Cyclop.cpp b/crlcore/src/cyclop/Cyclop.cpp index 3eefe19b..3fdc92f5 100644 --- a/crlcore/src/cyclop/Cyclop.cpp +++ b/crlcore/src/cyclop/Cyclop.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/crlcore/src/cyclop/CyclopMain.cpp b/crlcore/src/cyclop/CyclopMain.cpp index 74fe9cde..67740b97 100644 --- a/crlcore/src/cyclop/CyclopMain.cpp +++ b/crlcore/src/cyclop/CyclopMain.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -93,11 +93,10 @@ int main ( int argc, char *argv[] ) int returnCode = 0; try { - unsigned int traceLevel; - bool verbose1; - bool verbose2; - bool coreDump; - bool textMode; + bool verbose1; + bool verbose2; + bool coreDump; + bool textMode; boptions::options_description options ("Command line arguments & options"); options.add_options() @@ -110,9 +109,6 @@ int main ( int argc, char *argv[] ) , "Enable core dumping.") ( "text,t" , boptions::bool_switch(&textMode)->default_value(false) , "Run in pure text mode.") - ( "trace-level,l" , boptions::value(&traceLevel)->default_value(1000) - , "Set the level of trace, trace messages with a level superior to " - " will be printed on ." ) ( "cell,c" , boptions::value() , "The name of the cell to load, whithout extension." ); @@ -132,7 +128,7 @@ int main ( int argc, char *argv[] ) if (verbose1) mstream::enable ( mstream::Verbose0|mstream::Verbose1 ); if (verbose2) mstream::enable ( mstream::Verbose0|mstream::Verbose1|mstream::Verbose2 ); - dbo_ptr af ( AllianceFramework::create() ); + dbo_ptr af ( AllianceFramework::get() ); Technology* technology = DataBase::getDB()->getTechnology(); // technology->setWorkingLayer ( "cut0" ); diff --git a/crlcore/src/pyCRL/CMakeLists.txt b/crlcore/src/pyCRL/CMakeLists.txt index 9cea2fb4..002752b7 100644 --- a/crlcore/src/pyCRL/CMakeLists.txt +++ b/crlcore/src/pyCRL/CMakeLists.txt @@ -31,6 +31,7 @@ PyCatalog.cpp PyCatalogState.cpp PyEnvironment.cpp + PyAllianceLibrary.cpp PyCellGauge.cpp PyRoutingGauge.cpp PyRoutingLayerGauge.cpp @@ -47,6 +48,7 @@ crlcore/PyCatalog.h crlcore/PyCatalogState.h crlcore/PyEnvironment.h + crlcore/PyAllianceLibrary.h crlcore/PyCellGauge.h crlcore/PyRoutingGauge.h crlcore/PyRoutingLayerGauge.h diff --git a/crlcore/src/pyCRL/PyAcmSigda.cpp b/crlcore/src/pyCRL/PyAcmSigda.cpp index 0597e567..618a2e4f 100644 --- a/crlcore/src/pyCRL/PyAcmSigda.cpp +++ b/crlcore/src/pyCRL/PyAcmSigda.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2012-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2012-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -28,7 +28,8 @@ namespace CRL { using std::string; using std::ostringstream; using Hurricane::tab; - using Hurricane::in_trace; + using Hurricane::Exception; + using Hurricane::Bug; using Hurricane::Error; using Hurricane::Warning; using Isobar::ProxyProperty; @@ -54,7 +55,7 @@ extern "C" { static PyObject* PyAcmSigda_load ( PyObject*, PyObject* args ) { - trace << "PyAcmSigda_load()" << endl; + cdebug.log(30) << "PyAcmSigda_load()" << endl; Cell* cell = NULL; diff --git a/crlcore/src/pyCRL/PyAllianceFramework.cpp b/crlcore/src/pyCRL/PyAllianceFramework.cpp index d345b0c8..56c44fd4 100644 --- a/crlcore/src/pyCRL/PyAllianceFramework.cpp +++ b/crlcore/src/pyCRL/PyAllianceFramework.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2010-2015, All Rights Reserved +// Copyright (c) UPMC 2010-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -20,6 +20,7 @@ #include "crlcore/PyEnvironment.h" #include "crlcore/PyCellGauge.h" #include "crlcore/PyRoutingGauge.h" +#include "crlcore/PyAllianceLibrary.h" #include "crlcore/PyAllianceFramework.h" #include "crlcore/GraphicsParser.h" #include "crlcore/SymbolicTechnologyParser.h" @@ -33,10 +34,13 @@ namespace CRL { using std::hex; using std::ostringstream; using Hurricane::tab; - using Hurricane::in_trace; + using Hurricane::Exception; + using Hurricane::Bug; using Hurricane::Error; using Hurricane::Warning; using Hurricane::DataBase; + using Isobar::__cs; + using Isobar::Converter; using Isobar::ProxyProperty; using Isobar::ProxyError; using Isobar::ConstructorError; @@ -64,18 +68,24 @@ extern "C" { #if defined(__PYTHON_MODULE__) - static PyObject* PyAllianceFramework_get ( PyObject* ) + static PyObject* PyAllianceFramework_create ( PyObject*, PyObject* args ) { - trace << "PyAllianceFramework_get()" << endl; + cdebug.log(30) << "PyAllianceFramework_create()" << endl; - AllianceFramework* af = NULL; - PyAllianceFramework* pyAf = NULL; + AllianceFramework* af = NULL; + PyAllianceFramework* pyAf = NULL; + unsigned long flags = AllianceFramework::NoFlags; HTRY - af = AllianceFramework::get (); + PyObject* arg0; + if (ParseOneArg("AllianceFramework.create()", args, INT_ARG, &arg0)) { + flags = PyInt_AsUnsignedLongMask(arg0); + } - pyAf = PyObject_NEW ( PyAllianceFramework, &PyTypeAllianceFramework ); - if ( pyAf == NULL ) return NULL; + af = AllianceFramework::create( flags ); + + pyAf = PyObject_NEW( PyAllianceFramework, &PyTypeAllianceFramework ); + if (pyAf == NULL) return NULL; pyAf->_object = af; HCATCH @@ -84,9 +94,29 @@ extern "C" { } - extern PyObject* PyAllianceFramework_getEnvironment ( PyAllianceFramework* self ) + static PyObject* PyAllianceFramework_get ( PyObject* args ) { - trace << "PyAllianceFramework_getEnvironment ()" << endl; + cdebug.log(30) << "PyAllianceFramework_get()" << endl; + + AllianceFramework* af = NULL; + PyAllianceFramework* pyAf = NULL; + + HTRY + af = AllianceFramework::get(); + + pyAf = PyObject_NEW( PyAllianceFramework, &PyTypeAllianceFramework ); + if (pyAf == NULL) return NULL; + + pyAf->_object = af; + HCATCH + + return (PyObject*)pyAf; + } + + + static PyObject* PyAllianceFramework_getEnvironment ( PyAllianceFramework* self ) + { + cdebug.log(30) << "PyAllianceFramework_getEnvironment ()" << endl; Environment* env = NULL; @@ -102,9 +132,9 @@ extern "C" { } - extern PyObject* PyAllianceFramework_getLibrary ( PyAllianceFramework* self, PyObject* args ) + static PyObject* PyAllianceFramework_getLibrary ( PyAllianceFramework* self, PyObject* args ) { - trace << "PyAllianceFramework_getLibrary ()" << endl; + cdebug.log(30) << "PyAllianceFramework_getLibrary()" << endl; Library* lib = NULL; @@ -112,20 +142,64 @@ extern "C" { METHOD_HEAD("AllianceFramework.getLibrary()") PyObject* arg0; - if ( not ParseOneArg ( "AllianceFramework.getLibrary()", args, INT_ARG, &arg0 ) ) return NULL; + __cs.init ("AllianceFramework.getLibrary"); + if (not PyArg_ParseTuple( args, "O&:AllianceFramework.getLibrary", Converter, &arg0)) { + PyErr_SetString( ConstructorError, "Invalid number of parameters for AllianceFramework.getLibrary()." ); + return NULL; + } - lib = af->getLibrary ( PyAny_AsLong(arg0) ); - - if ( lib == NULL ) Py_RETURN_NONE; + if (__cs.getObjectIds() == STRING_ARG) lib = af->getLibrary( Name(PyString_AsString(arg0)) ); + else if (__cs.getObjectIds() == INT_ARG ) lib = af->getLibrary( PyAny_AsLong(arg0) ); + else { + PyErr_SetString( ConstructorError, "Bad parameter type for AllianceFramework.getLibrary()." ); + return NULL; + } + + if (lib == NULL) Py_RETURN_NONE; HCATCH return PyLibrary_Link(lib); } - extern PyObject* PyAllianceFramework_getCell ( PyAllianceFramework* self, PyObject* args ) + static PyObject* PyAllianceFramework_getAllianceLibrary ( PyAllianceFramework* self, PyObject* args ) { - trace << "PyAllianceFramework_getCell ()" << endl; + cdebug.log(30) << "PyAllianceFramework_getAllianceLibrary()" << endl; + + AllianceLibrary* alib = NULL; + + HTRY + METHOD_HEAD("AllianceFramework.getAllianceLibrary()") + + PyObject* arg0; + PyObject* arg1; + __cs.init ("AllianceFramework.getAllianceLibrary"); + if (not PyArg_ParseTuple( args + , "O&|O&:AllianceFramework.getAllianceLibrary" + , Converter, &arg0 + , Converter, &arg1)) { + PyErr_SetString( ConstructorError, "Invalid number of parameters for AllianceFramework.getLibrary()." ); + return NULL; + } + + if (__cs.getObjectIds() == INT_ARG ) alib = af->getAllianceLibrary( PyAny_AsLong(arg0) ); + else if (__cs.getObjectIds() == ":string:int") alib = af->getAllianceLibrary( Name(PyString_AsString(arg0)), PyAny_AsLong(arg1) ); + else if (__cs.getObjectIds() == ":library" ) alib = af->getAllianceLibrary( PYLIBRARY_O(arg0) ); + else { + PyErr_SetString( ConstructorError, "Bad parameter type for AllianceFramework.getAllianceLibrary()." ); + return NULL; + } + + if (alib == NULL) Py_RETURN_NONE; + HCATCH + + return PyAllianceLibrary_Link(alib); + } + + + static PyObject* PyAllianceFramework_getCell ( PyAllianceFramework* self, PyObject* args ) + { + cdebug.log(30) << "PyAllianceFramework_getCell ()" << endl; char* name = NULL; Cell* cell = NULL; @@ -146,9 +220,9 @@ extern "C" { } - extern PyObject* PyAllianceFramework_saveCell ( PyAllianceFramework* self, PyObject* args ) + static PyObject* PyAllianceFramework_saveCell ( PyAllianceFramework* self, PyObject* args ) { - trace << "PyAllianceFramework_saveCell ()" << endl; + cdebug.log(30) << "PyAllianceFramework_saveCell ()" << endl; HTRY @@ -167,9 +241,9 @@ extern "C" { } - extern PyObject* PyAllianceFramework_createCell ( PyAllianceFramework* self, PyObject* args ) + static PyObject* PyAllianceFramework_createCell ( PyAllianceFramework* self, PyObject* args ) { - trace << "PyAllianceFramework_createCell ()" << endl; + cdebug.log(30) << "PyAllianceFramework_createCell ()" << endl; char* name = NULL; Cell* cell = NULL; @@ -189,9 +263,48 @@ extern "C" { } + static PyObject* PyAllianceFramework_createLibrary ( PyAllianceFramework* self, PyObject* args ) + { + cdebug.log(30) << "PyAllianceFramework_createLibrary()" << endl; + + AllianceLibrary* alib = NULL; + string libName = ""; + + HTRY + METHOD_HEAD("AllianceFramework.createLibrary()") + + PyObject* arg0; + PyObject* arg1; + PyObject* arg2; + __cs.init ("AllianceFramework.createLibrary"); + if (not PyArg_ParseTuple( args + , "O&O&|O&:AllianceFramework.createLibrary" + , Converter, &arg0 + , Converter, &arg1 + , Converter, &arg2 + )) { + PyErr_SetString( ConstructorError, "Invalid number of parameters for AllianceFramework.createLibrary()." ); + return NULL; + } + + if (__cs.getObjectIds() == ":string:int" ) { } + else if (__cs.getObjectIds() == ":strint:int:string") libName = PyString_AsString(arg2); + else { + PyErr_SetString( ConstructorError, "Bad parameter type for AllianceFramework.createLibrary()." ); + return NULL; + } + + alib = af->createLibrary( PyString_AsString(arg0), PyAny_AsLong(arg1), libName ); + if (alib == NULL) Py_RETURN_NONE; + HCATCH + + return PyAllianceLibrary_Link(alib); + } + + static PyObject* PyAllianceFramework_isPad ( PyAllianceFramework* self, PyObject* args ) { - trace << "PyAllianceFramework_isPad ()" << endl; + cdebug.log(30) << "PyAllianceFramework_isPad ()" << endl; char* name = NULL; @@ -210,9 +323,9 @@ extern "C" { } - extern PyObject* PyAllianceFramework_addRoutingGauge ( PyAllianceFramework* self, PyObject* args ) + static PyObject* PyAllianceFramework_addRoutingGauge ( PyAllianceFramework* self, PyObject* args ) { - trace << "PyAllianceFramework_addRoutingGauge ()" << endl; + cdebug.log(30) << "PyAllianceFramework_addRoutingGauge ()" << endl; HTRY METHOD_HEAD("AllianceFramework.addRoutingGauge()") @@ -226,9 +339,9 @@ extern "C" { } - extern PyObject* PyAllianceFramework_getRoutingGauge ( PyAllianceFramework* self, PyObject* args ) + static PyObject* PyAllianceFramework_getRoutingGauge ( PyAllianceFramework* self, PyObject* args ) { - trace << "PyAllianceFramework_getRoutingGauge ()" << endl; + cdebug.log(30) << "PyAllianceFramework_getRoutingGauge ()" << endl; RoutingGauge* rg = NULL; @@ -250,9 +363,9 @@ extern "C" { } - extern PyObject* PyAllianceFramework_addCellGauge ( PyAllianceFramework* self, PyObject* args ) + static PyObject* PyAllianceFramework_addCellGauge ( PyAllianceFramework* self, PyObject* args ) { - trace << "PyAllianceFramework_addCellGauge ()" << endl; + cdebug.log(30) << "PyAllianceFramework_addCellGauge ()" << endl; HTRY METHOD_HEAD("AllianceFramework.addCellGauge()") @@ -266,9 +379,9 @@ extern "C" { } - extern PyObject* PyAllianceFramework_getCellGauge ( PyAllianceFramework* self, PyObject* args ) + static PyObject* PyAllianceFramework_getCellGauge ( PyAllianceFramework* self, PyObject* args ) { - trace << "PyAllianceFramework_getCellGauge ()" << endl; + cdebug.log(30) << "PyAllianceFramework_getCellGauge ()" << endl; CellGauge* rg = NULL; @@ -289,6 +402,35 @@ extern "C" { return PyCellGauge_Link(rg); } + + static PyObject* PyAllianceFramework_loadLibraryCells ( PyAllianceFramework* self, PyObject* args ) + { + cdebug.log(30) << "PyAllianceFramework_loadLibraryCells()" << endl; + + unsigned int count = 0; + + HTRY + METHOD_HEAD("AllianceFramework.loadLibraryCells()") + + PyObject* arg0; + __cs.init ("AllianceFramework.loadLibraryCells"); + if (not PyArg_ParseTuple( args, "O&:AllianceFramework.loadLibraryCells", Converter, &arg0)) { + PyErr_SetString( ConstructorError, "Invalid number of parameters for AllianceFramework.loadLibraryCells()." ); + return NULL; + } + + if (__cs.getObjectIds() == STRING_ARG) count = af->loadLibraryCells( Name(PyString_AsString(arg0)) ); + else if (__cs.getObjectIds() == ":library") count = af->loadLibraryCells( PYLIBRARY_O(arg0) ); + else { + PyErr_SetString( ConstructorError, "Bad parameter type for AllianceFramework.loadLibraryCells()." ); + return NULL; + } + + HCATCH + + return Py_BuildValue( "I", count ); + } + // Standart Accessors (Attributes). @@ -298,19 +440,27 @@ extern "C" { PyMethodDef PyAllianceFramework_Methods[] = - { { "get" , (PyCFunction)PyAllianceFramework_get , METH_NOARGS|METH_STATIC + { { "create" , (PyCFunction)PyAllianceFramework_create , METH_VARARGS|METH_STATIC + , "Gets the Alliance Framework." } + , { "get" , (PyCFunction)PyAllianceFramework_get , METH_NOARGS|METH_STATIC , "Gets the Alliance Framework." } , { "getEnvironment" , (PyCFunction)PyAllianceFramework_getEnvironment , METH_NOARGS , "Gets the Alliance Environment." } , { "getLibrary" , (PyCFunction)PyAllianceFramework_getLibrary , METH_VARARGS , "Gets a Library, by index." } + , { "getAllianceLibrary" , (PyCFunction)PyAllianceFramework_getAllianceLibrary , METH_VARARGS + , "Gets an AllianceLibrary, by index, name or Hurricane Library." } , { "getCell" , (PyCFunction)PyAllianceFramework_getCell , METH_VARARGS , "Gets an Alliance Cell." } , { "saveCell" , (PyCFunction)PyAllianceFramework_saveCell , METH_VARARGS , "Saves an Alliance Cell." } , { "createCell" , (PyCFunction)PyAllianceFramework_createCell , METH_VARARGS , "Create a Cell in the Alliance framework." } - , { "isPad" , (PyCFunction)PyAllianceFramework_isPad , METH_VARARGS + , { "createLibrary" , (PyCFunction)PyAllianceFramework_createLibrary , METH_VARARGS + , "Create a Library in the Alliance framework." } + , { "loadLibraryCells" , (PyCFunction)PyAllianceFramework_loadLibraryCells , METH_VARARGS + , "Load in memory all Cells from an Alliance Library." } + , { "isPad" , (PyCFunction)PyAllianceFramework_isPad , METH_VARARGS , "Tells if a cell name is a Pad." } , { "addCellGauge" , (PyCFunction)PyAllianceFramework_addCellGauge , METH_VARARGS , "Add a new cell gauge." } @@ -338,11 +488,21 @@ extern "C" { // x=================================================================x - // Link/Creation Method. PyTypeObjectDefinitions(AllianceFramework) + extern void PyAllianceFramework_postModuleInit () + { + PyObject* constant; + + LoadObjectConstant(PyTypeAllianceFramework.tp_dict,AllianceFramework::NoPythonInit ,"NoPythonInit" ); + LoadObjectConstant(PyTypeAllianceFramework.tp_dict,AllianceFramework::CreateLibrary,"CreateLibrary"); + LoadObjectConstant(PyTypeAllianceFramework.tp_dict,AllianceFramework::AppendLibrary,"AppendLibrary"); + LoadObjectConstant(PyTypeAllianceFramework.tp_dict,AllianceFramework::HasCatalog ,"HasCatalog" ); + } + + #endif // End of Shared Library Code Part. diff --git a/crlcore/src/pyCRL/PyAllianceLibrary.cpp b/crlcore/src/pyCRL/PyAllianceLibrary.cpp new file mode 100644 index 00000000..4bf7baec --- /dev/null +++ b/crlcore/src/pyCRL/PyAllianceLibrary.cpp @@ -0,0 +1,145 @@ +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC 2016-2016, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | Alliance / Hurricane Interface | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./PyAllianceLibrary.cpp" | +// +-----------------------------------------------------------------+ + + +#include "hurricane/isobar/PyLibrary.h" +#include "crlcore/PyAllianceLibrary.h" +#include +#include + + +namespace CRL { + + using std::cerr; + using std::endl; + using std::hex; + using std::string; + using std::ostringstream; + using Hurricane::tab; + using Hurricane::Exception; + using Hurricane::Bug; + using Hurricane::Error; + using Hurricane::Warning; + using Hurricane::Library; + using Isobar::ProxyProperty; + using Isobar::ProxyError; + using Isobar::ConstructorError; + using Isobar::HurricaneError; + using Isobar::HurricaneWarning; + using Isobar::ParseOneArg; + using Isobar::ParseTwoArg; + using Isobar::__cs; + using Isobar::PyLibrary_Link; + + +extern "C" { + + +#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(AllianceLibrary,alib,function) + + +#if defined(__PYTHON_MODULE__) + +// +=================================================================+ +// | "PyAllianceLibrary" Python Module Code Part | +// +=================================================================+ + + + static PyObject* PyAllianceLibrary_getLibrary ( PyAllianceLibrary* self, PyObject* args ) + { + cdebug.log(30) << "PyAllianceLibrary_getLibrary()" << endl; + + Library* lib = NULL; + + HTRY + METHOD_HEAD("AllianceLibrary.getLibrary()") + lib = alib->getLibrary(); + HCATCH + + return PyLibrary_Link(lib); + } + + + static PyObject* PyAllianceLibrary_getPath ( PyAllianceLibrary* self, PyObject* args ) + { + cdebug.log(30) << "PyAllianceLibrary_getPath()" << endl; + + HTRY + METHOD_HEAD("AllianceLibrary.getPath()") + return PyString_FromString( getString(alib->getPath()).c_str() ); + HCATCH + + return NULL; + } + + + static PyObject* PyAllianceLibrary_Repr ( PyAllianceLibrary* self ) + { + if ( self->ACCESS_OBJECT == NULL ) + return PyString_FromString(""); + + string s = getString( self->ACCESS_OBJECT ); + return PyString_FromString( s.c_str() ); + } + + + // Standart Destroy (Attribute). + // DBoDestroyAttribute(PyAllianceLibrary_destroy,PyAllianceLibrary) + + + PyMethodDef PyAllianceLibrary_Methods[] = + { { "getPath" , (PyCFunction)PyAllianceLibrary_getPath , METH_NOARGS + , "Return the complete path of the library." } + , { "getLibrary" , (PyCFunction)PyAllianceLibrary_getLibrary , METH_NOARGS + , "Returns the associated Hurricane library." } + //, { "destroy" , (PyCFunction)PyAllianceLibrary_destroy , METH_VARARGS + // , "Destroy the associated hurricane object. The python object remains." } + , {NULL, NULL, 0, NULL} /* sentinel */ + }; + + + PythonOnlyDeleteMethod(AllianceLibrary) + DirectHashMethod(PyAllianceLibrary_Hash, PyAllianceLibrary) + + extern void PyAllianceLibrary_LinkPyType() { + cdebug.log(30) << "PyAllianceLibrary_LinkType()" << endl; + + PyTypeAllianceLibrary.tp_dealloc = (destructor) PyAllianceLibrary_DeAlloc; + PyTypeAllianceLibrary.tp_repr = (reprfunc) PyAllianceLibrary_Repr; + PyTypeAllianceLibrary.tp_str = (reprfunc) PyAllianceLibrary_Repr; + PyTypeAllianceLibrary.tp_hash = (hashfunc) PyAllianceLibrary_Hash; + PyTypeAllianceLibrary.tp_methods = PyAllianceLibrary_Methods; + } + + +#else // End of Python Module Code Part. + +// +=================================================================+ +// | "PyAllianceLibrary" Shared Library Code Part | +// +=================================================================+ + + // Type Definition. + PyTypeObjectDefinitionsOfModule(CRL,AllianceLibrary) + + // Link/Creation Method. + LinkCreateMethod(AllianceLibrary) + + +#endif // End of Shared Library Code Part. + + +} // extern "C". + +} // CRL namespace. diff --git a/crlcore/src/pyCRL/PyBanner.cpp b/crlcore/src/pyCRL/PyBanner.cpp index cff665bb..386639fd 100644 --- a/crlcore/src/pyCRL/PyBanner.cpp +++ b/crlcore/src/pyCRL/PyBanner.cpp @@ -28,9 +28,10 @@ namespace CRL { using std::string; using std::ostringstream; using Hurricane::tab; - using Hurricane::in_trace; + using Hurricane::Bug; using Hurricane::Error; using Hurricane::Warning; + using Hurricane::Exception; using Isobar::ProxyProperty; using Isobar::ProxyError; using Isobar::ConstructorError; @@ -56,7 +57,7 @@ extern "C" { static PyObject* PyBanner_new ( PyTypeObject* type, PyObject* args, PyObject* kwArgs ) { - trace << "PyBanner_new()" << endl; + cdebug.log(30) << "PyBanner_new()" << endl; Banner* banner = NULL; PyBanner* pyBanner = (PyBanner*)type->tp_alloc(type,0); @@ -127,13 +128,13 @@ extern "C" { DirectGetUIntAttribute (PyBanner_getScreenWidth ,getScreenWidth ,PyBanner,Banner) // Standart Mutators (Attributes). - DirectSetCStringAttribute(PyBanner_setName ,setName ,"Banner.setName" ,PyBanner,Banner) - DirectSetCStringAttribute(PyBanner_setVersion ,setVersion ,"Banner.setVersion" ,PyBanner,Banner) - DirectSetCStringAttribute(PyBanner_setPurpose ,setPurpose ,"Banner.setPurpose" ,PyBanner,Banner) - DirectSetCStringAttribute(PyBanner_setDate ,setDate ,"Banner.setDate" ,PyBanner,Banner) - DirectSetCStringAttribute(PyBanner_setContributors,setContributors,"Banner.setContributors",PyBanner,Banner) - DirectSetCStringAttribute(PyBanner_setAuthors ,setAuthors ,"Banner.setAuthors" ,PyBanner,Banner) - DirectSetLongAttribute (PyBanner_setScreenWidth ,setScreenWidth ,"Banner.setScreenWidth" ,PyBanner,Banner) + DirectSetCStringAttribute(PyBanner_setName ,setName ,PyBanner,Banner) + DirectSetCStringAttribute(PyBanner_setVersion ,setVersion ,PyBanner,Banner) + DirectSetCStringAttribute(PyBanner_setPurpose ,setPurpose ,PyBanner,Banner) + DirectSetCStringAttribute(PyBanner_setDate ,setDate ,PyBanner,Banner) + DirectSetCStringAttribute(PyBanner_setContributors,setContributors,PyBanner,Banner) + DirectSetCStringAttribute(PyBanner_setAuthors ,setAuthors ,PyBanner,Banner) + DirectSetLongAttribute (PyBanner_setScreenWidth ,setScreenWidth ,PyBanner,Banner) // Standart Destroy (Attribute). @@ -179,7 +180,7 @@ extern "C" { DirectHashMethod(PyBanner_Hash, PyBanner) extern void PyBanner_LinkPyType() { - trace << "PyBanner_LinkType()" << endl; + cdebug.log(30) << "PyBanner_LinkType()" << endl; PyTypeBanner.tp_new = PyBanner_new; PyTypeBanner.tp_dealloc = (destructor)PyBanner_DeAlloc; diff --git a/crlcore/src/pyCRL/PyBlif.cpp b/crlcore/src/pyCRL/PyBlif.cpp index e3222f83..201d5b8a 100644 --- a/crlcore/src/pyCRL/PyBlif.cpp +++ b/crlcore/src/pyCRL/PyBlif.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2015-2015, All Rights Reserved +// Copyright (c) UPMC 2015-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -28,7 +28,8 @@ namespace CRL { using std::string; using std::ostringstream; using Hurricane::tab; - using Hurricane::in_trace; + using Hurricane::Exception; + using Hurricane::Bug; using Hurricane::Error; using Hurricane::Warning; using Isobar::ProxyProperty; @@ -54,7 +55,7 @@ extern "C" { static PyObject* PyBlif_load ( PyObject*, PyObject* args ) { - trace << "PyBlif_load()" << endl; + cdebug.log(30) << "PyBlif_load()" << endl; Cell* cell = NULL; diff --git a/crlcore/src/pyCRL/PyCRL.cpp b/crlcore/src/pyCRL/PyCRL.cpp index c59c56f3..55de9efc 100644 --- a/crlcore/src/pyCRL/PyCRL.cpp +++ b/crlcore/src/pyCRL/PyCRL.cpp @@ -1,14 +1,14 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2010-2015, All Rights Reserved +// Copyright (c) UPMC 2010-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | // | Alliance / Hurricane Interface | // | | // | Author : Jean-Paul CHAPUT | -// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Module : "./PyCRL.cpp" | // +-----------------------------------------------------------------+ @@ -22,6 +22,7 @@ #include "crlcore/PyCatalogState.h" #include "crlcore/PyAllianceFramework.h" #include "crlcore/PyEnvironment.h" +#include "crlcore/PyAllianceLibrary.h" #include "crlcore/PyCellGauge.h" #include "crlcore/PyRoutingGauge.h" #include "crlcore/PyRoutingLayerGauge.h" @@ -39,7 +40,8 @@ namespace CRL { using std::cerr; using std::endl; using Hurricane::tab; - using Hurricane::in_trace; + using Hurricane::Exception; + using Hurricane::Bug; using Hurricane::Error; using Hurricane::Warning; using Isobar::ProxyProperty; @@ -71,7 +73,7 @@ extern "C" { static PyObject* PyVhdl_destroyAllVHDL ( PyObject* module ) { - trace << "PyVhdl_destroyAllVHDL()" << endl; + cdebug.log(30) << "PyVhdl_destroyAllVHDL()" << endl; HTRY EntityExtension::destroyAll(); @@ -101,12 +103,13 @@ extern "C" { // Module Initialization : "initCRL ()" DL_EXPORT(void) initCRL () { - trace << "initCRL()" << endl; + cdebug.log(30) << "initCRL()" << endl; PyBanner_LinkPyType (); PyCatalogState_LinkPyType (); PyCatalog_LinkPyType (); PyEnvironment_LinkPyType (); + PyAllianceLibrary_LinkPyType (); PyCellGauge_LinkPyType (); PyRoutingGauge_LinkPyType (); PyRoutingLayerGauge_LinkPyType (); @@ -122,6 +125,7 @@ extern "C" { PYTYPE_READY ( CatalogState ); PYTYPE_READY ( Catalog ); PYTYPE_READY ( Environment ); + PYTYPE_READY ( AllianceLibrary ); PYTYPE_READY ( CellGauge ); PYTYPE_READY ( RoutingGauge ); PYTYPE_READY ( RoutingLayerGaugeVector ); @@ -136,6 +140,7 @@ extern "C" { PYTYPE_READY ( Blif ); // Identifier string can take up to 10 characters. + __cs.addType ( "alcLib" , &PyTypeAllianceLibrary , "" , false ); __cs.addType ( "alcEnv" , &PyTypeEnvironment , "" , false ); __cs.addType ( "cellGauge" , &PyTypeCellGauge , "" , false ); __cs.addType ( "routGauge" , &PyTypeRoutingGauge , "" , false ); @@ -155,6 +160,8 @@ extern "C" { PyModule_AddObject ( module, "Banner", (PyObject*)&PyTypeBanner ); Py_INCREF ( &PyTypeCatalog ); PyModule_AddObject ( module, "Catalog", (PyObject*)&PyTypeCatalog ); + Py_INCREF ( &PyTypeAllianceLibrary ); + PyModule_AddObject ( module, "AllianceLibrary", (PyObject*)&PyTypeAllianceLibrary ); Py_INCREF ( &PyTypeEnvironment ); PyModule_AddObject ( module, "Environment", (PyObject*)&PyTypeEnvironment ); Py_INCREF ( &PyTypeCellGauge ); @@ -185,11 +192,12 @@ extern "C" { PyCatalog_postModuleInit (); PyEnvironment_postModuleInit (); PyRoutingLayerGauge_postModuleInit (); + PyAllianceFramework_postModuleInit (); //PyObject* dictionnary = PyModule_GetDict ( module ); //DbULoadConstants ( dictionnary ); - trace << "CRL.so loaded " << (void*)&typeid(string) << endl; + cdebug.log(30) << "CRL.so loaded " << (void*)&typeid(string) << endl; } diff --git a/crlcore/src/pyCRL/PyCatalog.cpp b/crlcore/src/pyCRL/PyCatalog.cpp index 82fe53cb..051e6e9e 100644 --- a/crlcore/src/pyCRL/PyCatalog.cpp +++ b/crlcore/src/pyCRL/PyCatalog.cpp @@ -37,7 +37,6 @@ namespace CRL { using std::hex; using std::ostringstream; using Hurricane::tab; - using Hurricane::in_trace; using Hurricane::Error; using Hurricane::Warning; using Isobar::ProxyProperty; diff --git a/crlcore/src/pyCRL/PyCatalogState.cpp b/crlcore/src/pyCRL/PyCatalogState.cpp index e8c33bed..31f5a993 100644 --- a/crlcore/src/pyCRL/PyCatalogState.cpp +++ b/crlcore/src/pyCRL/PyCatalogState.cpp @@ -1,15 +1,9 @@ - // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2010-2010, All Rights Reserved +// Copyright (c) UPMC 2010-2016, All Rights Reserved // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | C O R I O L I S | // | Alliance / Hurricane Interface | // | | @@ -17,10 +11,7 @@ // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | // | C++ Module : "./PyCatalogState.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ #include "hurricane/isobar/PyCell.h" @@ -36,7 +27,8 @@ namespace CRL { using std::hex; using std::ostringstream; using Hurricane::tab; - using Hurricane::in_trace; + using Hurricane::Exception; + using Hurricane::Bug; using Hurricane::Error; using Hurricane::Warning; using Isobar::ProxyProperty; @@ -73,12 +65,12 @@ extern "C" { DirectGetBoolAttribute(PyCatalogState_isPhysical ,isPhysical ,PyCatalogState,Catalog::State) DirectGetBoolAttribute(PyCatalogState_isLogical ,isFlattenLeaf,PyCatalogState,Catalog::State) - DirectSetBoolAttribute(PyCatalogState_setFlattenLeaf,setFlattenLeaf,"Catalog::State::setFlatenLeaf",PyCatalogState,Catalog::State) - DirectSetBoolAttribute(PyCatalogState_setFeed ,setFeed ,"Catalog::State::setFeed" ,PyCatalogState,Catalog::State) - DirectSetBoolAttribute(PyCatalogState_setGds ,setGds ,"Catalog::State::setGds" ,PyCatalogState,Catalog::State) - DirectSetBoolAttribute(PyCatalogState_setDelete ,setDelete ,"Catalog::State::setDelete" ,PyCatalogState,Catalog::State) - DirectSetBoolAttribute(PyCatalogState_setPhysical ,setPhysical ,"Catalog::State::setPhysical" ,PyCatalogState,Catalog::State) - DirectSetBoolAttribute(PyCatalogState_setLogical ,setFlattenLeaf,"Catalog::State::setLogical" ,PyCatalogState,Catalog::State) + DirectSetBoolAttribute(PyCatalogState_setFlattenLeaf,setFlattenLeaf,PyCatalogState,Catalog::State) + DirectSetBoolAttribute(PyCatalogState_setFeed ,setFeed ,PyCatalogState,Catalog::State) + DirectSetBoolAttribute(PyCatalogState_setGds ,setGds ,PyCatalogState,Catalog::State) + DirectSetBoolAttribute(PyCatalogState_setDelete ,setDelete ,PyCatalogState,Catalog::State) + DirectSetBoolAttribute(PyCatalogState_setPhysical ,setPhysical ,PyCatalogState,Catalog::State) + DirectSetBoolAttribute(PyCatalogState_setLogical ,setFlattenLeaf,PyCatalogState,Catalog::State) // Standart Destroy (Attribute). @@ -122,7 +114,7 @@ extern "C" { DirectHashMethod(PyCatalogState_Hash, PyCatalogState) extern void PyCatalogState_LinkPyType() { - trace << "PyCatalogState_LinkType()" << endl; + cdebug.log(30) << "PyCatalogState_LinkType()" << endl; PyTypeCatalogState.tp_dealloc = (destructor) PyCatalogState_DeAlloc; PyTypeCatalogState.tp_compare = (cmpfunc) PyCatalogState_Cmp; PyTypeCatalogState.tp_repr = (reprfunc) PyCatalogState_Repr; diff --git a/crlcore/src/pyCRL/PyCellGauge.cpp b/crlcore/src/pyCRL/PyCellGauge.cpp index 5fb9f4e5..e50a4575 100644 --- a/crlcore/src/pyCRL/PyCellGauge.cpp +++ b/crlcore/src/pyCRL/PyCellGauge.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2012-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2012-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -27,7 +27,8 @@ namespace CRL { using std::string; using std::ostringstream; using Hurricane::tab; - using Hurricane::in_trace; + using Hurricane::Exception; + using Hurricane::Bug; using Hurricane::Error; using Hurricane::Warning; using Isobar::ProxyProperty; @@ -60,7 +61,7 @@ extern "C" { static PyObject* PyCellGauge_create ( PyObject*, PyObject* args ) { - trace << "PyCellGauge_create()" << endl; + cdebug.log(30) << "PyCellGauge_create()" << endl; CellGauge* cg = NULL; PyCellGauge* pyCg = NULL; diff --git a/crlcore/src/pyCRL/PyEnvironment.cpp b/crlcore/src/pyCRL/PyEnvironment.cpp index 5b6347f1..55e013c2 100644 --- a/crlcore/src/pyCRL/PyEnvironment.cpp +++ b/crlcore/src/pyCRL/PyEnvironment.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2012-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2012-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -27,7 +27,8 @@ namespace CRL { using std::string; using std::ostringstream; using Hurricane::tab; - using Hurricane::in_trace; + using Hurricane::Exception; + using Hurricane::Bug; using Hurricane::Error; using Hurricane::Warning; using Isobar::ProxyProperty; @@ -66,7 +67,7 @@ extern "C" { PyObject* PyEnvironment_addSYSTEM_LIBRARY ( PyEnvironment* self, PyObject* args, PyObject* kwArgs ) { - trace << "PyEnvironment_addSYSTEM_LIBRARY()" << endl; + cdebug.log(30) << "PyEnvironment_addSYSTEM_LIBRARY()" << endl; HTRY METHOD_HEAD("Environment.addSYSTEM_LIBRARY()") @@ -112,7 +113,7 @@ extern "C" { PyObject* PyEnvironment_getLIBRARYPath ( PyEnvironment* self, PyObject* args ) { - trace << "PyEnvironment_getLIBRARYPath()" << endl; + cdebug.log(30) << "PyEnvironment_getLIBRARYPath()" << endl; HTRY METHOD_HEAD("Environment.getLIBRARYPath()") @@ -164,19 +165,19 @@ extern "C" { DirectIsAFromCStringAttribute(PyEnvironment_isPad ,isPad ,PyEnvironment,Environment) // Standart Mutators (Attributes). - DirectSetCStringAttribute(PyEnvironment_setDisplayStyle ,setDisplayStyle ,"Environment.setDisplayStyle" ,PyEnvironment,Environment) - DirectSetLongAttribute (PyEnvironment_setSCALE_X ,setSCALE_X ,"Environment.setSCALE_X" ,PyEnvironment,Environment) - DirectSetCStringAttribute(PyEnvironment_setIN_LO ,setIN_LO ,"Environment.setIN_LO" ,PyEnvironment,Environment) - DirectSetCStringAttribute(PyEnvironment_setIN_PH ,setIN_PH ,"Environment.setIN_PH" ,PyEnvironment,Environment) - DirectSetCStringAttribute(PyEnvironment_setOUT_LO ,setOUT_LO ,"Environment.setOUT_LO" ,PyEnvironment,Environment) - DirectSetCStringAttribute(PyEnvironment_setOUT_PH ,setOUT_PH ,"Environment.setOUT_PH" ,PyEnvironment,Environment) - DirectSetCStringAttribute(PyEnvironment_setPOWER ,setPOWER ,"Environment.setPOWER" ,PyEnvironment,Environment) - DirectSetCStringAttribute(PyEnvironment_setGROUND ,setGROUND ,"Environment.setGROUND" ,PyEnvironment,Environment) - DirectSetCStringAttribute(PyEnvironment_setCLOCK ,setCLOCK ,"Environment.setCLOCK" ,PyEnvironment,Environment) - DirectSetCStringAttribute(PyEnvironment_setBLOCKAGE ,setBLOCKAGE ,"Environment.setBLOCKAGE" ,PyEnvironment,Environment) - DirectSetCStringAttribute(PyEnvironment_setPad ,setPad ,"Environment.setPad" ,PyEnvironment,Environment) - DirectSetCStringAttribute(PyEnvironment_setCATALOG ,setCATALOG ,"Environment.setCATALOG" ,PyEnvironment,Environment) - DirectSetCStringAttribute(PyEnvironment_setWORKING_LIBRARY ,setWORKING_LIBRARY ,"Environment.setWORKING_LIBRARY" ,PyEnvironment,Environment) + DirectSetCStringAttribute(PyEnvironment_setDisplayStyle ,setDisplayStyle ,PyEnvironment,Environment) + DirectSetLongAttribute (PyEnvironment_setSCALE_X ,setSCALE_X ,PyEnvironment,Environment) + DirectSetCStringAttribute(PyEnvironment_setIN_LO ,setIN_LO ,PyEnvironment,Environment) + DirectSetCStringAttribute(PyEnvironment_setIN_PH ,setIN_PH ,PyEnvironment,Environment) + DirectSetCStringAttribute(PyEnvironment_setOUT_LO ,setOUT_LO ,PyEnvironment,Environment) + DirectSetCStringAttribute(PyEnvironment_setOUT_PH ,setOUT_PH ,PyEnvironment,Environment) + DirectSetCStringAttribute(PyEnvironment_setPOWER ,setPOWER ,PyEnvironment,Environment) + DirectSetCStringAttribute(PyEnvironment_setGROUND ,setGROUND ,PyEnvironment,Environment) + DirectSetCStringAttribute(PyEnvironment_setCLOCK ,setCLOCK ,PyEnvironment,Environment) + DirectSetCStringAttribute(PyEnvironment_setBLOCKAGE ,setBLOCKAGE ,PyEnvironment,Environment) + DirectSetCStringAttribute(PyEnvironment_setPad ,setPad ,PyEnvironment,Environment) + DirectSetCStringAttribute(PyEnvironment_setCATALOG ,setCATALOG ,PyEnvironment,Environment) + DirectSetCStringAttribute(PyEnvironment_setWORKING_LIBRARY,setWORKING_LIBRARY,PyEnvironment,Environment) // Standart Destroy (Attribute). @@ -264,7 +265,7 @@ extern "C" { DirectHashMethod(PyEnvironment_Hash, PyEnvironment) extern void PyEnvironment_LinkPyType() { - trace << "PyEnvironment_LinkType()" << endl; + cdebug.log(30) << "PyEnvironment_LinkType()" << endl; PyTypeEnvironment.tp_dealloc = (destructor) PyEnvironment_DeAlloc; PyTypeEnvironment.tp_repr = (reprfunc) PyEnvironment_Repr; diff --git a/crlcore/src/pyCRL/PyIspd05.cpp b/crlcore/src/pyCRL/PyIspd05.cpp index 2426039f..fdf0e30f 100644 --- a/crlcore/src/pyCRL/PyIspd05.cpp +++ b/crlcore/src/pyCRL/PyIspd05.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2012-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2012-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -29,7 +29,8 @@ namespace CRL { using std::string; using std::ostringstream; using Hurricane::tab; - using Hurricane::in_trace; + using Hurricane::Exception; + using Hurricane::Bug; using Hurricane::Error; using Hurricane::Warning; using Isobar::ProxyProperty; @@ -55,7 +56,7 @@ extern "C" { static PyObject* PyIspd05_load ( PyObject*, PyObject* args ) { - trace << "PyIspd05_load()" << endl; + cdebug.log(30) << "PyIspd05_load()" << endl; Cell* cell = NULL; diff --git a/crlcore/src/pyCRL/PyRoutingGauge.cpp b/crlcore/src/pyCRL/PyRoutingGauge.cpp index e3125740..f670284f 100644 --- a/crlcore/src/pyCRL/PyRoutingGauge.cpp +++ b/crlcore/src/pyCRL/PyRoutingGauge.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2012-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2012-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -30,7 +30,8 @@ namespace CRL { using std::string; using std::ostringstream; using Hurricane::tab; - using Hurricane::in_trace; + using Hurricane::Exception; + using Hurricane::Bug; using Hurricane::Error; using Hurricane::Warning; using Isobar::ProxyProperty; @@ -66,7 +67,7 @@ extern "C" { static PyObject* PyRoutingGauge_create ( PyObject*, PyObject* args ) { - trace << "PyRoutingGauge_create()" << endl; + cdebug.log(30) << "PyRoutingGauge_create()" << endl; RoutingGauge* rg = NULL; PyRoutingGauge* pyRg = NULL; @@ -95,7 +96,7 @@ extern "C" { static PyObject* PyRoutingGauge_getTechnology ( PyRoutingGauge* self ) { - trace << "PyRoutingGauge_getTechnology()" << endl; + cdebug.log(30) << "PyRoutingGauge_getTechnology()" << endl; Technology* technology = NULL; @@ -110,7 +111,7 @@ extern "C" { static PyObject* PyRoutingGauge_getDepth ( PyRoutingGauge* self ) { - trace << "PyRoutingGauge_getDepth()" << endl; + cdebug.log(30) << "PyRoutingGauge_getDepth()" << endl; size_t depth = 0; @@ -125,7 +126,7 @@ extern "C" { static PyObject* PyRoutingGauge_getLayerDepth ( PyRoutingGauge* self, PyObject* args ) { - trace << "PyRoutingGauge_getLayerDepth()" << endl; + cdebug.log(30) << "PyRoutingGauge_getLayerDepth()" << endl; size_t depth = 0; @@ -152,7 +153,7 @@ extern "C" { static PyObject* PyRoutingGauge_getLayerGauge ( PyRoutingGauge* self, PyObject* args ) { - trace << "PyRoutingGauge_getLayerGauge()" << endl; + cdebug.log(30) << "PyRoutingGauge_getLayerGauge()" << endl; RoutingLayerGauge* rlg = NULL; @@ -187,7 +188,7 @@ extern "C" { static PyObject* PyRoutingGauge_getLayerDirection ( PyRoutingGauge* self, PyObject* args ) { - trace << "PyRoutingGauge_getLayerDirection()" << endl; + cdebug.log(30) << "PyRoutingGauge_getLayerDirection()" << endl; unsigned int direction = 0; @@ -218,7 +219,7 @@ extern "C" { static PyObject* PyRoutingGauge_getLayerPitch ( PyRoutingGauge* self, PyObject* args ) { - trace << "PyRoutingGauge_getLayerPitch()" << endl; + cdebug.log(30) << "PyRoutingGauge_getLayerPitch()" << endl; DbU::Unit pitch = 0; @@ -249,7 +250,7 @@ extern "C" { static PyObject* PyRoutingGauge_getRoutingLayer ( PyRoutingGauge* self, PyObject* args ) { - trace << "PyRoutingGauge_getRoutingLayer()" << endl; + cdebug.log(30) << "PyRoutingGauge_getRoutingLayer()" << endl; Layer* layer = NULL; @@ -276,7 +277,7 @@ extern "C" { static PyObject* PyRoutingGauge_getContactLayer ( PyRoutingGauge* self, PyObject* args ) { - trace << "PyRoutingGauge_getContactLayer()" << endl; + cdebug.log(30) << "PyRoutingGauge_getContactLayer()" << endl; Layer* layer = NULL; @@ -303,7 +304,7 @@ extern "C" { PyObject* PyRoutingGauge_addLayerGauge ( PyRoutingGauge* self, PyObject* args ) { - trace << "PyRoutingGauge_addLayerGauge()" << endl; + cdebug.log(30) << "PyRoutingGauge_addLayerGauge()" << endl; HTRY METHOD_HEAD("RoutingGauge.addLayerGauge()") diff --git a/crlcore/src/pyCRL/PyRoutingLayerGauge.cpp b/crlcore/src/pyCRL/PyRoutingLayerGauge.cpp index 3b404c0b..b7418878 100644 --- a/crlcore/src/pyCRL/PyRoutingLayerGauge.cpp +++ b/crlcore/src/pyCRL/PyRoutingLayerGauge.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2012-2015, All Rights Reserved +// Copyright (c) UPMC 2012-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -28,7 +28,8 @@ namespace CRL { using std::string; using std::ostringstream; using Hurricane::tab; - using Hurricane::in_trace; + using Hurricane::Exception; + using Hurricane::Bug; using Hurricane::Error; using Hurricane::Warning; using Isobar::ProxyProperty; @@ -59,7 +60,7 @@ extern "C" { static PyObject* PyRoutingLayerGauge_create ( PyObject*, PyObject* args ) { - trace << "PyRoutingLayerGauge_create()" << endl; + cdebug.log(30) << "PyRoutingLayerGauge_create()" << endl; RoutingLayerGauge* rlg = NULL; PyRoutingLayerGauge* pyRlg = NULL; @@ -74,9 +75,10 @@ extern "C" { long pitch; long wireWidth; long viaWidth; + long obsDw; if (PyArg_ParseTuple( args - , "OIIIdllll:RoutingLayerGauge.create" + , "OIIIdlllll:RoutingLayerGauge.create" , &pyLayer , &direction , &type @@ -86,6 +88,7 @@ extern "C" { , &pitch , &wireWidth , &viaWidth + , &obsDw )) { if ( not PyObject_IsInstance(pyLayer,(PyObject*)&PyTypeLayer) ) { PyErr_SetString ( ConstructorError, "Bad type for layer argument of RoutingLayerGauge.create()." ); @@ -107,14 +110,15 @@ extern "C" { } rlg = RoutingLayerGauge::create( PYLAYER_O(pyLayer) - , direction - , type + , (Constant::Direction)direction + , (Constant::LayerGaugeType)type , depth , density , offset , pitch , wireWidth , viaWidth + , obsDw ); } else { PyErr_SetString ( ConstructorError, "Bad parameters given to RoutingLayerGauge.create()." ); @@ -136,7 +140,7 @@ extern "C" { static PyObject* PyRoutingLayerGauge_getLayer ( PyRoutingLayerGauge* self ) { - trace << "PyRoutingLayerGauge_getLayer()" << endl; + cdebug.log(30) << "PyRoutingLayerGauge_getLayer()" << endl; Layer* layer = NULL; @@ -151,7 +155,7 @@ extern "C" { static PyObject* PyRoutingLayerGauge_getBlockageLayer ( PyRoutingLayerGauge* self ) { - trace << "PyRoutingLayerGauge_getBlockageLayer()" << endl; + cdebug.log(30) << "PyRoutingLayerGauge_getBlockageLayer()" << endl; Layer* layer = NULL; @@ -166,7 +170,7 @@ extern "C" { static PyObject* PyRoutingLayerGauge_getTrackNumber ( PyRoutingLayerGauge* self, PyObject* args ) { - trace << "PyRoutingLayerGauge_getTrackNumber()" << endl; + cdebug.log(30) << "PyRoutingLayerGauge_getTrackNumber()" << endl; unsigned int trackNumber = 0; @@ -190,7 +194,7 @@ extern "C" { static PyObject* PyRoutingLayerGauge_getTrackIndex ( PyRoutingLayerGauge* self, PyObject* args ) { - trace << "PyRoutingLayerGauge_getTrackIndex()" << endl; + cdebug.log(30) << "PyRoutingLayerGauge_getTrackIndex()" << endl; unsigned int trackIndex = 0; @@ -228,7 +232,7 @@ extern "C" { static PyObject* PyRoutingLayerGauge_getTrackPosition ( PyRoutingLayerGauge* self, PyObject* args ) { - trace << "PyRoutingLayerGauge_getTrackPosition()" << endl; + cdebug.log(30) << "PyRoutingLayerGauge_getTrackPosition()" << endl; DbU::Unit trackPosition = 0; @@ -261,6 +265,7 @@ extern "C" { DirectGetLongAttribute (PyRoutingLayerGauge_getHalfWireWidth,getHalfWireWidth,PyRoutingLayerGauge,RoutingLayerGauge) DirectGetLongAttribute (PyRoutingLayerGauge_getViaWidth ,getViaWidth ,PyRoutingLayerGauge,RoutingLayerGauge) DirectGetLongAttribute (PyRoutingLayerGauge_getHalfViaWidth ,getHalfViaWidth ,PyRoutingLayerGauge,RoutingLayerGauge) + DirectGetLongAttribute (PyRoutingLayerGauge_getObstacleDw ,getObstacleDw ,PyRoutingLayerGauge,RoutingLayerGauge) // Standart Destroy (Attribute). @@ -295,6 +300,8 @@ extern "C" { , "Returns the VIA width." } , { "getHalfViaWidth" , (PyCFunction)PyRoutingLayerGauge_getHalfViaWidth , METH_NOARGS , "Returns the half VIA width." } + , { "getObstacleDw" , (PyCFunction)PyRoutingLayerGauge_getObstacleDw , METH_NOARGS + , "Returns the dW to add to obstacle width." } , { "getTrackNumber" , (PyCFunction)PyRoutingLayerGauge_getTrackNumber , METH_VARARGS , "Compute the number of tracks included between & ." } , { "getTrackIndex" , (PyCFunction)PyRoutingLayerGauge_getTrackIndex , METH_VARARGS diff --git a/crlcore/src/pyCRL/PyToolBox.cpp b/crlcore/src/pyCRL/PyToolBox.cpp index 6ef322b0..6c7b7aeb 100644 --- a/crlcore/src/pyCRL/PyToolBox.cpp +++ b/crlcore/src/pyCRL/PyToolBox.cpp @@ -35,7 +35,8 @@ namespace CRL { using std::hex; using std::ostringstream; using Hurricane::tab; - using Hurricane::in_trace; + using Hurricane::Exception; + using Hurricane::Bug; using Hurricane::Error; using Hurricane::Warning; using Isobar::ProxyProperty; @@ -69,7 +70,7 @@ extern "C" { extern PyObject* PyToolBox_createPartRing ( PyObject* module, PyObject* args ) { - trace << "PyToolBox_createPartRing ()" << endl; + cdebug.log(30) << "PyToolBox_createPartRing ()" << endl; HTRY PyObject* arg0; diff --git a/crlcore/src/pyCRL/PyToolEngine.cpp b/crlcore/src/pyCRL/PyToolEngine.cpp index 05aa584d..51daba1f 100644 --- a/crlcore/src/pyCRL/PyToolEngine.cpp +++ b/crlcore/src/pyCRL/PyToolEngine.cpp @@ -46,7 +46,7 @@ extern "C" { static PyObject* PyToolEngine_get ( PyObject*, PyObject* args, PyObject* kwArgs ) { - trace << "PyToolEngine_get()" << endl; + cdebug.log(30) << "PyToolEngine_get()" << endl; HTRY PyObject* pyCell = NULL; @@ -98,7 +98,7 @@ extern "C" { static PyObject* PyToolEngine_destroyAll ( PyObject* ) { - trace << "PyToolEngine_destroyAll()" << endl; + cdebug.log(30) << "PyToolEngine_destroyAll()" << endl; HTRY ToolEngine::destroyAll(); @@ -110,7 +110,7 @@ extern "C" { static PyObject* PyToolEngine_getCell ( PyToolEngine* self ) { - trace << "PyToolEngine_getCell ()" << endl; + cdebug.log(30) << "PyToolEngine_getCell ()" << endl; Cell* cell = NULL; diff --git a/crlcore/src/pyCRL/crlcore/PyAllianceFramework.h b/crlcore/src/pyCRL/crlcore/PyAllianceFramework.h index 77a893c4..2a77605d 100644 --- a/crlcore/src/pyCRL/crlcore/PyAllianceFramework.h +++ b/crlcore/src/pyCRL/crlcore/PyAllianceFramework.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2010-2015, All Rights Reserved +// Copyright (c) UPMC 2010-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -42,8 +42,9 @@ extern "C" { extern PyTypeObject PyTypeAllianceFramework; extern PyMethodDef PyAllianceFramework_Methods[]; - extern PyObject* PyAllianceFramework_Link ( CRL::AllianceFramework* ); - extern void PyAllianceFramework_LinkPyType (); + extern PyObject* PyAllianceFramework_Link ( CRL::AllianceFramework* ); + extern void PyAllianceFramework_LinkPyType (); + extern void PyAllianceFramework_postModuleInit (); #define IsPyAllianceFramework(v) ( (v)->ob_type == &PyTypeAllianceFramework ) diff --git a/crlcore/src/pyCRL/crlcore/PyAllianceLibrary.h b/crlcore/src/pyCRL/crlcore/PyAllianceLibrary.h new file mode 100644 index 00000000..0c2917d2 --- /dev/null +++ b/crlcore/src/pyCRL/crlcore/PyAllianceLibrary.h @@ -0,0 +1,59 @@ +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC 2016-2016, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | Alliance / Hurricane Interface | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./crlcore/PyAllianceLibrary.h" | +// +-----------------------------------------------------------------+ + + +#ifndef CRL_PY_ALLIANCE_LIBRARY_H +#define CRL_PY_ALLIANCE_LIBRARY_H + +#include "hurricane/isobar/PyHurricane.h" +#include "crlcore/AllianceLibrary.h" + + +namespace CRL { + + +extern "C" { + + +// ------------------------------------------------------------------- +// Python Object : "PyAllianceLibrary". + + typedef struct { + PyObject_HEAD + AllianceLibrary* _object; + } PyAllianceLibrary; + + +// ------------------------------------------------------------------- +// Functions & Types exported to "PyCRL.ccp". + + extern PyTypeObject PyTypeAllianceLibrary; + extern PyMethodDef PyAllianceLibrary_Methods[]; + + extern PyObject* PyAllianceLibrary_Link ( AllianceLibrary* ); + extern void PyAllianceLibrary_LinkPyType (); + + +#define IsPyAllianceLibrary(v) ( (v)->ob_type == &PyTypeAllianceLibrary ) +#define PYALLIANCE_LIBRARY(v) ( (PyAllianceLibrary*)(v) ) +#define PYALLIANCE_LIBRARY_O(v) ( PYALLIANCE_LIBRARY(v)->_object ) + + +} // extern "C". + +} // Hurricane namespace. + + +#endif // __CRL_PY_ALLIANCE_LIBRARY__ diff --git a/crlcore/src/pyCRL/crlcore/PyBlif.h b/crlcore/src/pyCRL/crlcore/PyBlif.h index 07d3027f..79c5808c 100644 --- a/crlcore/src/pyCRL/crlcore/PyBlif.h +++ b/crlcore/src/pyCRL/crlcore/PyBlif.h @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2015-2015, All Rights Reserved +// Copyright (c) UPMC 2015-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/crlcore/src/pyCRL/crlcore/PyIspd05.h b/crlcore/src/pyCRL/crlcore/PyIspd05.h index d33be093..db11828e 100644 --- a/crlcore/src/pyCRL/crlcore/PyIspd05.h +++ b/crlcore/src/pyCRL/crlcore/PyIspd05.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2012-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2012-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/crlcore/src/x2y/x2y.cpp b/crlcore/src/x2y/x2y.cpp index 2df48370..878cc260 100644 --- a/crlcore/src/x2y/x2y.cpp +++ b/crlcore/src/x2y/x2y.cpp @@ -16,7 +16,6 @@ using namespace CRL; int main(int argc, char *argv[]) { try { - unsigned int traceLevel; bool verbose1; bool verbose2; bool coreDump; @@ -30,9 +29,6 @@ int main(int argc, char *argv[]) { , "Second level of verbosity.") ( "core-dump,D" , poptions::bool_switch(&coreDump)->default_value(false) , "Enable core dumping.") - ( "trace-level,l" , poptions::value(&traceLevel)->default_value(1000) - , "Set the level of trace, trace messages with a level superior to " - " will be printed on ." ) ( "cell,c" , poptions::value() , "The name of the cell to load, whithout extension." ); @@ -49,7 +45,7 @@ int main(int argc, char *argv[]) { if (verbose1) mstream::enable ( mstream::Verbose0|mstream::Verbose1 ); if (verbose2) mstream::enable ( mstream::Verbose0|mstream::Verbose1|mstream::Verbose2 ); - AllianceFramework* af = AllianceFramework::create (); + AllianceFramework* af = AllianceFramework::get (); Cell* cell = NULL; diff --git a/cumulus/src/Alliance.py b/cumulus/src/Alliance.py index bc3bbe83..c469ae96 100644 --- a/cumulus/src/Alliance.py +++ b/cumulus/src/Alliance.py @@ -1,7 +1,7 @@ # -*- Mode:Python; explicit-buffer-name: "Alliance.py" -*- # # This file is part of the Coriolis Software. -# Copyright (c) UPMC 2014-2015, All Rights Reserved +# Copyright (c) UPMC 2014-2016, All Rights Reserved # # +-----------------------------------------------------------------+ # | C O R I O L I S | diff --git a/cumulus/src/plugins/ChipPlugin.py b/cumulus/src/plugins/ChipPlugin.py index 7482547e..a8812e5e 100644 --- a/cumulus/src/plugins/ChipPlugin.py +++ b/cumulus/src/plugins/ChipPlugin.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # # This file is part of the Coriolis Software. -# Copyright (c) UPMC 2014-2015, All Rights Reserved +# Copyright (c) UPMC 2014-2016, All Rights Reserved # # +-----------------------------------------------------------------+ # | C O R I O L I S | @@ -95,8 +95,8 @@ class PlaceCore ( chip.Configuration.ChipConfWrapper ): coreAb = self.cores[0].getMasterCell().getAbutmentBox() if (not coreAb.isEmpty()): - if coreAb.getWidth () < self.coreSize.getWidth() \ - and coreAb.getHeight() < self.coreSize.getHeight(): + if coreAb.getWidth () <= self.coreSize.getWidth() \ + and coreAb.getHeight() <= self.coreSize.getHeight(): self.coreSize = coreAb else: print ErrorMessage( 1, [ 'Core %s already have an abutment box, bigger than the requested one:' @@ -219,7 +219,8 @@ def ScriptMain ( **kw ): except ErrorMessage, e: print e; errorCode = e.code - if editor: editor.fit() + if locals().has_key('editor') and editor \ + and locals().has_key('cell' ) and cell: editor.fit() rvalue = False except Exception, e: print '\n\n', e; errorCode = 1 diff --git a/cumulus/src/plugins/ClockTreePlugin.py b/cumulus/src/plugins/ClockTreePlugin.py index 54978b66..c4c7b8b2 100755 --- a/cumulus/src/plugins/ClockTreePlugin.py +++ b/cumulus/src/plugins/ClockTreePlugin.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # # This file is part of the Coriolis Software. -# Copyright (c) UPMC 2014-2015, All Rights Reserved +# Copyright (c) UPMC 2014-2016, All Rights Reserved # # +-----------------------------------------------------------------+ # | C O R I O L I S | diff --git a/cumulus/src/plugins/RSavePlugin.py b/cumulus/src/plugins/RSavePlugin.py index 292edadb..8494504f 100644 --- a/cumulus/src/plugins/RSavePlugin.py +++ b/cumulus/src/plugins/RSavePlugin.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # # This file is part of the Coriolis Software. -# Copyright (c) UPMC 2014-2015, All Rights Reserved +# Copyright (c) UPMC 2014-2016, All Rights Reserved # # +-----------------------------------------------------------------+ # | C O R I O L I S | @@ -51,21 +51,26 @@ except Exception, e: # of abutment box for placement, the netlist view must also # be saved. -def rsave ( cell, depth=0 ): +def rsave ( cell, views=CRL.Catalog.State.Physical, depth=0 ): if cell.isTerminal(): return framework = CRL.AllianceFramework.get() if depth == 0: print ' o Recursive Save-Cell.' - print ' %s+ %s (layout).' % ( ' '*(depth*2), cell.getName() ) - views = CRL.Catalog.State.Physical + sviews = '' + if views & CRL.Catalog.State.Logical: sviews += 'netlist' + if views & CRL.Catalog.State.Physical: + if sviews: sviews += ',' + sviews += 'layout' + + print ' %s+ %s (%s).' % ( ' '*(depth*2), cell.getName(), sviews ) if cell.isUniquified(): views |= CRL.Catalog.State.Logical framework.saveCell( cell, views ) for instance in cell.getInstances(): masterCell = instance.getMasterCell() if not masterCell.isTerminal(): - rsave( masterCell, depth+1 ) + rsave( masterCell, views, depth+1 ) return @@ -89,11 +94,14 @@ def ScriptMain ( **kw ): cell, editor = plugins.kwParseMain( **kw ) + views = CRL.Catalog.State.Physical + if kw.has_key('views'): views = kw['views'] + if not cell: print WarningMessage( 'No Cell loaded in the editor (yet), nothing done.' ) return 0 - rsave( cell ) + rsave( cell, views ) CRL.destroyAllVHDL() except ErrorMessage, e: diff --git a/cumulus/src/plugins/RSavePluginAll.py b/cumulus/src/plugins/RSavePluginAll.py index 1bb53a78..aa912dba 100644 --- a/cumulus/src/plugins/RSavePluginAll.py +++ b/cumulus/src/plugins/RSavePluginAll.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # # This file is part of the Coriolis Software. -# Copyright (c) UPMC 2015-2015, All Rights Reserved +# Copyright (c) UPMC 2015-2016, All Rights Reserved # # +-----------------------------------------------------------------+ # | C O R I O L I S | diff --git a/cumulus/src/plugins/__init__.py b/cumulus/src/plugins/__init__.py index 5b02afd3..8ef8ebc0 100644 --- a/cumulus/src/plugins/__init__.py +++ b/cumulus/src/plugins/__init__.py @@ -1,7 +1,7 @@ # -*- explicit-buffer-name: "__init__.py" -*- # # This file is part of the Coriolis Software. -# Copyright (c) UPMC 2014-2015, All Rights Reserved +# Copyright (c) UPMC 2014-2016, All Rights Reserved # # +-----------------------------------------------------------------+ # | C O R I O L I S | diff --git a/cumulus/src/plugins/chip/BlockCorona.py b/cumulus/src/plugins/chip/BlockCorona.py index 04a02ce7..221247db 100644 --- a/cumulus/src/plugins/chip/BlockCorona.py +++ b/cumulus/src/plugins/chip/BlockCorona.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # # This file is part of the Coriolis Software. -# Copyright (c) UPMC 2014-2015, All Rights Reserved +# Copyright (c) UPMC 2014-2016, All Rights Reserved # # +-----------------------------------------------------------------+ # | C O R I O L I S | diff --git a/cumulus/src/plugins/chip/BlockPower.py b/cumulus/src/plugins/chip/BlockPower.py index 64b6cd97..afea85d8 100644 --- a/cumulus/src/plugins/chip/BlockPower.py +++ b/cumulus/src/plugins/chip/BlockPower.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # # This file is part of the Coriolis Software. -# Copyright (c) UPMC 2014-2015, All Rights Reserved +# Copyright (c) UPMC 2014-2016, All Rights Reserved # # +-----------------------------------------------------------------+ # | C O R I O L I S | diff --git a/cumulus/src/plugins/chip/Configuration.py b/cumulus/src/plugins/chip/Configuration.py index 7fde3fad..ef39c905 100644 --- a/cumulus/src/plugins/chip/Configuration.py +++ b/cumulus/src/plugins/chip/Configuration.py @@ -1,7 +1,7 @@ # -*- explicit-buffer-name: "Configuration.py" -*- # # This file is part of the Coriolis Software. -# Copyright (c) UPMC 2014-2015, All Rights Reserved +# Copyright (c) UPMC 2014-2016, All Rights Reserved # # +-----------------------------------------------------------------+ # | C O R I O L I S | @@ -593,6 +593,7 @@ class ChipConf ( object ): self._blockageNet = self._cell.getNet(self._blockageName) if not self._blockageNet: self._blockageNet = Net.create( self._cell, self._blockageName ) + self._blockageNet.setType( Net.Type.BLOCKAGE ) return diff --git a/cumulus/src/plugins/chip/PadsCorona.py b/cumulus/src/plugins/chip/PadsCorona.py index 2f61b752..89d8aab1 100644 --- a/cumulus/src/plugins/chip/PadsCorona.py +++ b/cumulus/src/plugins/chip/PadsCorona.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # # This file is part of the Coriolis Software. -# Copyright (c) UPMC 2014-2015, All Rights Reserved +# Copyright (c) UPMC 2014-2016, All Rights Reserved # # +-----------------------------------------------------------------+ # | C O R I O L I S | @@ -57,10 +57,10 @@ class Side ( object ): def getAxis ( self, i ): - if self._type == chip.North: return self._corona.chipSize.getXMax() - self._corona.padHeight + self._corona._powerRails[i][2] - elif self._type == chip.South: return self._corona.chipSize.getXMin() + self._corona.padHeight - self._corona._powerRails[i][2] - elif self._type == chip.East: return self._corona.chipSize.getYMax() - self._corona.padHeight + self._corona._powerRails[i][2] - elif self._type == chip.West: return self._corona.chipSize.getYMin() + self._corona.padHeight - self._corona._powerRails[i][2] + if self._type == chip.North: return self._corona.chipSize.getYMax() - self._corona.padHeight + self._corona._powerRails[i][2] + elif self._type == chip.South: return self._corona.chipSize.getYMin() + self._corona.padHeight - self._corona._powerRails[i][2] + elif self._type == chip.East: return self._corona.chipSize.getXMax() - self._corona.padHeight + self._corona._powerRails[i][2] + elif self._type == chip.West: return self._corona.chipSize.getXMin() + self._corona.padHeight - self._corona._powerRails[i][2] else: raise ErrorMessage( 1, 'PadsCorona.Side.__init__(): Invalid value for sideType (%d)' % sideType ) return 0 @@ -120,22 +120,24 @@ class Side ( object ): trace( 550, ',+', '\t_createPowerContacts() for %s\n' % net.getName() ) + components = None masterCell = pad.getMasterCell() - if net.isGlobal(): - trace( 550, '\tLooking for global net %s\n' % net.getName() ) + trace( 550, '\tLooking for global net %s\n' % net.getName() ) + for plug in net.getPlugs(): + if plug.getInstance() == pad: + trace( 550, '\tFound Plug on %s\n' % pad ) + components = plug.getMasterNet().getExternalComponents() + if not components: masterNet = masterCell.getNet( net.getName() ) - if not masterNet: - raise ErrorMessage( 1, [ 'PadsCorona.Side._createPowerContact():' - , 'Pad model <%s> of instance <%s> do not have global net <%s>' % (pad.getName(),masterCell.getName(),net.getName()) - , 'The power/clock nets *names* in the chip must match those of the pads models.' - ] ) + if masterNet: + components = masterCell.getNet(net.getName()).getExternalComponents() + if not components: + raise ErrorMessage( 1, [ 'PadsCorona.Side._createPowerContact():' + , 'Pad model <%s> of instance <%s> neither have global net <%s>' % (pad.getName(),masterCell.getName(),net.getName()) + , 'for implicit connection nor is it explicitly connected.' + , 'The power/clock nets *names* in the chip must match those of the pads models.' + ] ) - components = masterCell.getNet(net.getName()).getExternalComponents() - else: - for plug in net.getPlugs(): - if plug.getInstance() == pad: - trace( 550, '\tFound Plug on %s\n' % pad ) - components = plug.getMasterNet().getExternalComponents() connecteds = False trace( 550, '\t %s\n' % str(masterCell.getAbutmentBox()) ) @@ -224,14 +226,14 @@ class Side ( object ): def _routePads ( self ): for i in range(len(self._corona._powerRails)): if self._type == chip.South: - Horizontal.create( self._corona._corners[chip.SouthWest ][i] + Horizontal.create( self._corona._corners[chip.SouthWest][i] , self._corona._corners[chip.SouthEast][i] , self._corona._powerRails[i][1] , self.getAxis( i ) , self._corona._powerRails[i][3] ) elif self._type == chip.North: - Horizontal.create( self._corona._corners[chip.NorthWest ][i] + Horizontal.create( self._corona._corners[chip.NorthWest][i] , self._corona._corners[chip.NorthEast][i] , self._corona._powerRails[i][1] , self.getAxis( i ) @@ -239,14 +241,14 @@ class Side ( object ): ) elif self._type == chip.East: Vertical.create( self._corona._corners[chip.SouthEast][i] - , self._corona._corners[chip.NorthEast ][i] + , self._corona._corners[chip.NorthEast][i] , self._corona._powerRails[i][1] , self.getAxis( i ) , self._corona._powerRails[i][3] ) elif self._type == chip.West: Vertical.create( self._corona._corners[chip.SouthWest][i] - , self._corona._corners[chip.NorthWest ][i] + , self._corona._corners[chip.NorthWest][i] , self._corona._powerRails[i][1] , self.getAxis( i ) , self._corona._powerRails[i][3] diff --git a/cumulus/src/plugins/chip/__init__.py b/cumulus/src/plugins/chip/__init__.py index 71f9b0c9..b854cd29 100644 --- a/cumulus/src/plugins/chip/__init__.py +++ b/cumulus/src/plugins/chip/__init__.py @@ -1,7 +1,7 @@ # -*- explicit-buffer-name: "__init__.py" -*- # # This file is part of the Coriolis Software. -# Copyright (c) UPMC 2014-2015, All Rights Reserved +# Copyright (c) UPMC 2014-2016, All Rights Reserved # # +-----------------------------------------------------------------+ # | C O R I O L I S | diff --git a/cumulus/src/plugins/clocktree/ClockTree.py b/cumulus/src/plugins/clocktree/ClockTree.py index c99ab173..d4beb9c6 100755 --- a/cumulus/src/plugins/clocktree/ClockTree.py +++ b/cumulus/src/plugins/clocktree/ClockTree.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # # This file is part of the Coriolis Software. -# Copyright (c) UPMC 2014-2015, All Rights Reserved +# Copyright (c) UPMC 2014-2016, All Rights Reserved # # +-----------------------------------------------------------------+ # | C O R I O L I S | @@ -124,7 +124,7 @@ class HTree ( GaugeConfWrapper ): self.masterClock = net break if not self.masterClock: - print '[WARNING] Cell %s has no clock net.' % cell.getName() + raise ErrorMessage( 3, 'ClockTree: Cell %s has no clock net.' % cell.getName() ) self._createChildNet( self.topBuffer, 'ck_htree' ) return @@ -132,6 +132,11 @@ class HTree ( GaugeConfWrapper ): def _getBufferIo ( self ): self.bufferCell = self.framework.getCell( Cfg.getParamString('clockTree.buffer').asString() , CRL.Catalog.State.Views ) + if not self.bufferCell: + raise ErrorMessage( 3, [ 'ClockTree: Buffer cell "%s" not found in library,' \ + % Cfg.getParamString('clockTree.buffer').asString() + , ' please check the "clockTree.buffer" configuration parameter in "plugins.conf".' ] ) + for net in self.bufferCell.getNets(): if not net.isExternal(): continue if net.isGlobal(): continue diff --git a/cumulus/src/plugins/clocktree/RSMT.py b/cumulus/src/plugins/clocktree/RSMT.py index e688151d..c2a03e29 100644 --- a/cumulus/src/plugins/clocktree/RSMT.py +++ b/cumulus/src/plugins/clocktree/RSMT.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # # This file is part of the Coriolis Software. -# Copyright (c) UPMC 2014-2015, All Rights Reserved +# Copyright (c) UPMC 2014-2016, All Rights Reserved # # +-----------------------------------------------------------------+ # | C O R I O L I S | diff --git a/documentation/UsersGuide/CMakeLists.txt b/documentation/UsersGuide/CMakeLists.txt index e50b41ed..73573c91 100644 --- a/documentation/UsersGuide/CMakeLists.txt +++ b/documentation/UsersGuide/CMakeLists.txt @@ -1,3 +1,4 @@ +# -*- mode: CMAKE; explicit-buffer-name: "CMakeLists.txt" -*- set ( htmlInstallDir share/doc/coriolis2/en/html/users-guide ) set ( latexInstallDir share/doc/coriolis2/en/latex/users-guide ) @@ -5,11 +6,18 @@ add_custom_target ( doc_HTML ALL cd ${DOCUMENTATION_SOURCE_DIR}/UsersGuide && rst2html --link-stylesheet --stylesheet=./SoC.css,./Pygments.css UsersGuide_HTML.rst UsersGuide.html ) + add_dependencies ( doc_HTML SoC.css Pygments.css UsersGuide_HTML.rst UsersGuide.rst ) add_custom_target ( doc_LaTeX ALL cd ${DOCUMENTATION_SOURCE_DIR}/UsersGuide - && rst2latex --use-latex-toc --graphicx-option=dvipdfm --stylesheet=./socstyle.tex UsersGuide_LaTeX.rst UsersGuide-raw.tex - && sed 's, \\& \\\\multicolumn{2}{l|}{, \\& \\\\multicolumn{2}{p{0.6\\\\DUtablewidth}|}{,' UsersGuide-raw.tex > UsersGuide.tex ) + && rst2latex --use-latex-toc --stylesheet=./socstyle.tex UsersGuide_LaTeX.rst UsersGuide-raw.tex + && sed 's, \\& \\\\multicolumn{2}{l|}{, \\& \\\\multicolumn{2}{p{0.6\\\\DUtablewidth}|}{,' UsersGuide-raw.tex > UsersGuide.tex + && latex UsersGuide + && latex UsersGuide + && latex UsersGuide + && dvipdfm UsersGuide + ) + add_dependencies ( doc_HTML socstyle.tex UsersGuide_LaTeX.rst UsersGuide.rst ) install ( DIRECTORY images/ DESTINATION ${htmlInstallDir}/images diff --git a/documentation/UsersGuide/LaTeX_defs.rst b/documentation/UsersGuide/LaTeX_defs.rst index 1992e2cd..8d48f8e1 100644 --- a/documentation/UsersGuide/LaTeX_defs.rst +++ b/documentation/UsersGuide/LaTeX_defs.rst @@ -22,23 +22,23 @@ .. |menu_KiteFinalizeRoute| replace:: :raw-latex:`\fbox{\textsf{\textbf{{\underline{F}inalize Route}}}}` .. Stand-alone images. -.. |ViewerSnapshot_1| replace:: :raw-latex:`\begin{center}\fbox{\includegraphics[width=.7\textwidth]{./images/Viewer-1.pdf}}\end{center}` -.. |ControllerSnapshot_1| replace:: :raw-latex:`\begin{center}\includegraphics[width=.7\textwidth]{./images/Controller-1.pdf}\end{center}` -.. |ControllerLook_1| replace:: :raw-latex:`\begin{center}\includegraphics[width=.7\textwidth]{./images/Controller-Look-1.pdf}\end{center}` -.. |ControllerFilter_1| replace:: :raw-latex:`\begin{center}\includegraphics[width=.7\textwidth]{./images/Controller-Filter-1.pdf}\end{center}` -.. |ControllerLayersGos_1| replace:: :raw-latex:`\begin{center}\includegraphics[width=.7\textwidth]{./images/Controller-LayersGos-1.pdf}\end{center}` -.. |ControllerNetlist_1| replace:: :raw-latex:`\begin{center}\includegraphics[width=.7\textwidth]{./images/Controller-Netlist-1.pdf}\end{center}` -.. |ViewerNetlist_1| replace:: :raw-latex:`\begin{center}\includegraphics[width=.7\textwidth]{./images/Viewer-Netlist-1.pdf}\end{center}` -.. |ControllerSelection_1| replace:: :raw-latex:`\begin{center}\includegraphics[width=.7\textwidth]{./images/Controller-Selection-1.pdf}\end{center}` -.. |ControllerInspector_1| replace:: :raw-latex:`\begin{center}\includegraphics[width=.7\textwidth]{./images/Controller-Inspector-1.pdf}\end{center}` -.. |ControllerInspector_2| replace:: :raw-latex:`\begin{center}\includegraphics[width=.7\textwidth]{./images/Controller-Inspector-2.pdf}\end{center}` -.. |ControllerInspector_3| replace:: :raw-latex:`\begin{center}\includegraphics[width=.7\textwidth]{./images/Controller-Inspector-3.pdf}\end{center}` -.. |ControllerSettings_1| replace:: :raw-latex:`\begin{center}\includegraphics[width=.7\textwidth]{./images/Controller-Settings-1.pdf}\end{center}` -.. |CoriolisSoftSchema| replace:: :raw-latex:`\begin{center}\includegraphics[width=.7\textwidth]{./images/Coriolis-Soft-Schema.pdf}\end{center}` -.. |ChipStructure-1| replace:: :raw-latex:`\begin{center}\includegraphics[width=.95\textwidth]{./images/chip-structure-1.pdf}\end{center}` -.. |Etesian-1| replace:: :raw-latex:`\begin{center}\includegraphics[width=.95\textwidth]{./images/etesian-1.pdf}\end{center}` +.. |ViewerSnapshot_1| replace:: :raw-latex:`\begin{center}\fbox{\includegraphics[width=.7\textwidth]{./images/Viewer-1.eps}}\end{center}` +.. |ControllerSnapshot_1| replace:: :raw-latex:`\begin{center}\includegraphics[width=.7\textwidth]{./images/Controller-1.eps}\end{center}` +.. |ControllerLook_1| replace:: :raw-latex:`\begin{center}\includegraphics[width=.7\textwidth]{./images/Controller-Look-1.eps}\end{center}` +.. |ControllerFilter_1| replace:: :raw-latex:`\begin{center}\includegraphics[width=.7\textwidth]{./images/Controller-Filter-1.eps}\end{center}` +.. |ControllerLayersGos_1| replace:: :raw-latex:`\begin{center}\includegraphics[width=.7\textwidth]{./images/Controller-LayersGos-1.eps}\end{center}` +.. |ControllerNetlist_1| replace:: :raw-latex:`\begin{center}\includegraphics[width=.7\textwidth]{./images/Controller-Netlist-1.eps}\end{center}` +.. |ViewerNetlist_1| replace:: :raw-latex:`\begin{center}\includegraphics[width=.7\textwidth]{./images/Viewer-Netlist-1.eps}\end{center}` +.. |ControllerSelection_1| replace:: :raw-latex:`\begin{center}\includegraphics[width=.7\textwidth]{./images/Controller-Selection-1.eps}\end{center}` +.. |ControllerInspector_1| replace:: :raw-latex:`\begin{center}\includegraphics[width=.7\textwidth]{./images/Controller-Inspector-1.eps}\end{center}` +.. |ControllerInspector_2| replace:: :raw-latex:`\begin{center}\includegraphics[width=.7\textwidth]{./images/Controller-Inspector-2.eps}\end{center}` +.. |ControllerInspector_3| replace:: :raw-latex:`\begin{center}\includegraphics[width=.7\textwidth]{./images/Controller-Inspector-3.eps}\end{center}` +.. |ControllerSettings_1| replace:: :raw-latex:`\begin{center}\includegraphics[width=.7\textwidth]{./images/Controller-Settings-1.eps}\end{center}` +.. |CoriolisSoftSchema| replace:: :raw-latex:`\begin{center}\includegraphics[width=.7\textwidth]{./images/Coriolis-Soft-Schema.eps}\end{center}` +.. |ChipStructure-1| replace:: :raw-latex:`\begin{center}\includegraphics[width=.95\textwidth]{./images/chip-structure-1.eps}\end{center}` +.. |Etesian-1| replace:: :raw-latex:`\begin{center}\includegraphics[width=.95\textwidth]{./images/etesian-1.eps}\end{center}` -.. |BigMouse| image:: ./images/ComputerMouse.pdf +.. |BigMouse| image:: ./images/ComputerMouse.eps :scale: 25% .. Direct LaTeX commands encapsulation. diff --git a/documentation/UsersGuide/UsersGuide.aux b/documentation/UsersGuide/UsersGuide.aux deleted file mode 100644 index a02d7b19..00000000 --- a/documentation/UsersGuide/UsersGuide.aux +++ /dev/null @@ -1,184 +0,0 @@ -\relax -\providecommand\HyperFirstAtBeginDocument{\AtBeginDocument} -\HyperFirstAtBeginDocument{\ifx\hyper@anchor\@undefined -\global\let\oldcontentsline\contentsline -\gdef\contentsline#1#2#3#4{\oldcontentsline{#1}{#2}{#3}} -\global\let\oldnewlabel\newlabel -\gdef\newlabel#1#2{\newlabelxx{#1}#2} -\gdef\newlabelxx#1#2#3#4#5#6{\oldnewlabel{#1}{{#2}{#3}}} -\AtEndDocument{\ifx\hyper@anchor\@undefined -\let\contentsline\oldcontentsline -\let\newlabel\oldnewlabel -\fi} -\fi} -\global\let\hyper@last\relax -\gdef\HyperFirstAtBeginDocument#1{#1} -\providecommand*\HyPL@Entry[1]{} -\HyPL@Entry{0<>} -\select@language{english} -\@writefile{toc}{\select@language{english}} -\@writefile{lof}{\select@language{english}} -\@writefile{lot}{\select@language{english}} -\@writefile{toc}{\contentsline {section}{Coriolis User's Guide}{1}{section*.1}} -\newlabel{coriolis-user-s-guide}{{}{1}{\relax }{section*.1}{}} -\newlabel{contents}{{}{1}{\relax }{section*.2}{}} -\HyPL@Entry{1<>} -\@writefile{toc}{\contentsline {subsection}{Credits \& License}{2}{section*.3}} -\newlabel{credits-license}{{}{2}{\relax }{section*.3}{}} -\HyPL@Entry{2<>} -\@writefile{toc}{\contentsline {subsection}{Release Notes}{3}{section*.4}} -\newlabel{release-notes}{{}{3}{\relax }{section*.4}{}} -\@writefile{toc}{\contentsline {subsubsection}{Release 1.0.1475}{3}{section*.5}} -\newlabel{release-1-0-1475}{{}{3}{\relax }{section*.5}{}} -\@writefile{toc}{\contentsline {subsubsection}{Release 1.0.1963}{3}{section*.6}} -\newlabel{release-1-0-1963}{{}{3}{\relax }{section*.6}{}} -\@writefile{toc}{\contentsline {subsubsection}{Release 1.0.2049}{3}{section*.7}} -\newlabel{release-1-0-2049}{{}{3}{\relax }{section*.7}{}} -\@writefile{toc}{\contentsline {subsubsection}{Release v2.0.1}{3}{section*.8}} -\newlabel{release-v2-0-1}{{}{3}{\relax }{section*.8}{}} -\gdef \LT@i {\LT@entry - {1}{114.85526pt}\LT@entry - {1}{303.50418pt}} -\HyPL@Entry{3<>} -\@writefile{toc}{\contentsline {subsection}{Installation}{4}{section*.9}} -\newlabel{installation}{{}{4}{\relax }{section*.9}{}} -\@writefile{toc}{\contentsline {subsubsection}{Fixed Directory Tree}{4}{section*.10}} -\newlabel{fixed-directory-tree}{{}{4}{\relax }{section*.10}{}} -\HyPL@Entry{4<>} -\@writefile{toc}{\contentsline {subsubsection}{Building Coriolis}{5}{section*.11}} -\newlabel{building-coriolis}{{}{5}{\relax }{section*.11}{}} -\@writefile{toc}{\contentsline {paragraph}{Additionnal Requirement under MacOS}{5}{section*.12}} -\newlabel{additionnal-requirement-under-macos}{{}{5}{\relax }{section*.12}{}} -\@writefile{toc}{\contentsline {subsubsection}{Packaging Coriolis}{5}{section*.13}} -\newlabel{packaging-coriolis}{{}{5}{\relax }{section*.13}{}} -\HyPL@Entry{5<>} -\@writefile{toc}{\contentsline {subsubsection}{Hooking up into Alliance}{6}{section*.14}} -\newlabel{hooking-up-into-alliance}{{}{6}{\relax }{section*.14}{}} -\@writefile{toc}{\contentsline {subsubsection}{Environment Helper}{6}{section*.15}} -\newlabel{environment-helper}{{}{6}{\relax }{section*.15}{}} -\HyPL@Entry{6<>} -\@writefile{toc}{\contentsline {subsection}{Documentation}{7}{section*.16}} -\newlabel{documentation}{{}{7}{\relax }{section*.16}{}} -\@writefile{toc}{\contentsline {subsubsection}{General Software Architecture}{7}{section*.17}} -\newlabel{general-software-architecture}{{}{7}{\relax }{section*.17}{}} -\@writefile{toc}{\contentsline {subsection}{Coriolis Configuration \& Initialisation}{7}{section*.18}} -\newlabel{coriolis-configuration-initialisation}{{}{7}{\relax }{section*.18}{}} -\gdef \LT@ii {\LT@entry - {1}{49.60522pt}\LT@entry - {1}{165.90092pt}\LT@entry - {1}{217.76141pt}} -\gdef \LT@iii {\LT@entry - {1}{49.60522pt}\LT@entry - {1}{165.90092pt}\LT@entry - {5}{217.76141pt}} -\HyPL@Entry{7<>} -\@writefile{toc}{\contentsline {subsubsection}{First Stage: Symbolic Technology Selection}{8}{section*.19}} -\newlabel{first-stage-symbolic-technology-selection}{{}{8}{\relax }{section*.19}{}} -\@writefile{toc}{\contentsline {subsubsection}{Second Stage: Technology Configuration Loading}{8}{section*.20}} -\newlabel{second-stage-technology-configuration-loading}{{}{8}{\relax }{section*.20}{}} -\@writefile{toc}{\contentsline {subsubsection}{Configuration Helpers}{8}{section*.21}} -\newlabel{configuration-helpers}{{}{8}{\relax }{section*.21}{}} -\@writefile{toc}{\contentsline {paragraph}{Alliance Helper}{8}{section*.22}} -\newlabel{id1}{{}{8}{\relax }{section*.22}{}} -\newlabel{alliance-helper}{{}{8}{\relax }{section*.22}{}} -\HyPL@Entry{8<>} -\HyPL@Entry{9<>} -\@writefile{toc}{\contentsline {paragraph}{Tools Configuration Helpers}{10}{section*.23}} -\newlabel{tools-configuration-helpers}{{}{10}{\relax }{section*.23}{}} -\HyPL@Entry{10<>} -\@writefile{toc}{\contentsline {subsubsection}{Hacking the Configuration Files}{11}{section*.24}} -\newlabel{hacking-the-configuration-files}{{}{11}{\relax }{section*.24}{}} -\HyPL@Entry{11<>} -\@writefile{toc}{\contentsline {subsection}{CGT - The Graphical Interface}{12}{section*.25}} -\newlabel{cgt-the-graphical-interface}{{}{12}{\relax }{section*.25}{}} -\HyPL@Entry{12<>} -\@writefile{toc}{\contentsline {subsection}{Viewer \& Tools}{13}{section*.26}} -\newlabel{id2}{{}{13}{\relax }{section*.26}{}} -\newlabel{viewer-tools}{{}{13}{\relax }{section*.26}{}} -\@writefile{toc}{\contentsline {subsubsection}{Stratus Netlist Capture}{13}{section*.27}} -\newlabel{stratus-netlist-capture}{{}{13}{\relax }{section*.27}{}} -\@writefile{toc}{\contentsline {subsubsection}{The Hurricane Data-Base}{13}{section*.28}} -\newlabel{the-hurricane-data-base}{{}{13}{\relax }{section*.28}{}} -\HyPL@Entry{13<>} -\@writefile{toc}{\contentsline {subsubsection}{Mauka -{}- Placer}{14}{section*.29}} -\newlabel{mauka-placer}{{}{14}{\relax }{section*.29}{}} -\@writefile{toc}{\contentsline {subsubsection}{Knik -{}- Global Router}{14}{section*.30}} -\newlabel{knik-global-router}{{}{14}{\relax }{section*.30}{}} -\@writefile{toc}{\contentsline {subsubsection}{Kite -{}- Detailed Router}{14}{section*.31}} -\newlabel{kite-detailed-router}{{}{14}{\relax }{section*.31}{}} -\HyPL@Entry{14<>} -\HyPL@Entry{15<>} -\@writefile{toc}{\contentsline {paragraph}{Kite Configuration Parameters}{16}{section*.32}} -\newlabel{kite-configuration-parameters}{{}{16}{\relax }{section*.32}{}} -\gdef \LT@iv {\LT@entry - {1}{181.77737pt}\LT@entry - {1}{102.323pt}\LT@entry - {5}{161.03175pt}} -\gdef \LT@v {\LT@entry - {1}{85.57443pt}\LT@entry - {1}{93.96251pt}\LT@entry - {1}{253.3158pt}} -\HyPL@Entry{16<>} -\@writefile{toc}{\contentsline {subsubsection}{Executing Python Scripts in Cgt}{17}{section*.33}} -\newlabel{executing-python-scripts-in-cgt}{{}{17}{\relax }{section*.33}{}} -\newlabel{python-scripts-in-cgt}{{}{17}{\relax }{section*.33}{}} -\@writefile{toc}{\contentsline {subsubsection}{Printing \& Snapshots}{17}{section*.34}} -\newlabel{printing-snapshots}{{}{17}{\relax }{section*.34}{}} -\gdef \LT@vi {\LT@entry - {1}{79.7221pt}\LT@entry - {1}{95.63461pt}\LT@entry - {1}{257.49603pt}} -\HyPL@Entry{17<>} -\@writefile{toc}{\contentsline {subsubsection}{Memento of Shortcuts in Graphic Mode}{18}{section*.35}} -\newlabel{memento-of-shortcuts-in-graphic-mode}{{}{18}{\relax }{section*.35}{}} -\gdef \LT@vii {\LT@entry - {1}{160.86342pt}\LT@entry - {1}{252.89458pt}} -\HyPL@Entry{18<>} -\@writefile{toc}{\contentsline {subsubsection}{Cgt Command Line Options}{19}{section*.36}} -\newlabel{cgt-command-line-options}{{}{19}{\relax }{section*.36}{}} -\gdef \LT@viii {\LT@entry - {1}{191.80995pt}\LT@entry - {1}{98.55759pt}\LT@entry - {5}{164.79716pt}} -\HyPL@Entry{19<>} -\@writefile{toc}{\contentsline {subsubsection}{Miscellaneous Settings}{20}{section*.37}} -\newlabel{miscellaneous-settings}{{}{20}{\relax }{section*.37}{}} -\@writefile{toc}{\contentsline {subsection}{The Controller}{20}{section*.38}} -\newlabel{id3}{{}{20}{\relax }{section*.38}{}} -\newlabel{the-controller}{{}{20}{\relax }{section*.38}{}} -\HyPL@Entry{20<>} -\@writefile{toc}{\contentsline {subsubsection}{The Look Tab}{21}{section*.39}} -\newlabel{id4}{{}{21}{\relax }{section*.39}{}} -\newlabel{the-look-tab}{{}{21}{\relax }{section*.39}{}} -\@writefile{toc}{\contentsline {subsubsection}{The Filter Tab}{21}{section*.40}} -\newlabel{id5}{{}{21}{\relax }{section*.40}{}} -\newlabel{the-filter-tab}{{}{21}{\relax }{section*.40}{}} -\HyPL@Entry{21<>} -\@writefile{toc}{\contentsline {subsubsection}{The Layers\&Go Tab}{22}{section*.41}} -\newlabel{id6}{{}{22}{\relax }{section*.41}{}} -\newlabel{the-layers-go-tab}{{}{22}{\relax }{section*.41}{}} -\HyPL@Entry{22<>} -\@writefile{toc}{\contentsline {subsubsection}{The Netlist Tab}{23}{section*.42}} -\newlabel{id7}{{}{23}{\relax }{section*.42}{}} -\newlabel{the-netlist-tab}{{}{23}{\relax }{section*.42}{}} -\HyPL@Entry{23<>} -\@writefile{toc}{\contentsline {subsubsection}{The Selection Tab}{24}{section*.43}} -\newlabel{id8}{{}{24}{\relax }{section*.43}{}} -\newlabel{the-selection-tab}{{}{24}{\relax }{section*.43}{}} -\HyPL@Entry{24<>} -\@writefile{toc}{\contentsline {subsubsection}{The Inspector Tab}{25}{section*.44}} -\newlabel{id9}{{}{25}{\relax }{section*.44}{}} -\newlabel{the-inspector-tab}{{}{25}{\relax }{section*.44}{}} -\HyPL@Entry{25<>} -\HyPL@Entry{26<>} -\@writefile{toc}{\contentsline {subsubsection}{The Settings Tab}{27}{section*.45}} -\newlabel{id10}{{}{27}{\relax }{section*.45}{}} -\newlabel{the-settings-tab}{{}{27}{\relax }{section*.45}{}} -\HyPL@Entry{27<>} -\@writefile{toc}{\contentsline {subsection}{Python Interface for Hurricane / Coriolis}{28}{section*.46}} -\newlabel{python-interface-for-hurricane-coriolis}{{}{28}{\relax }{section*.46}{}} -\newlabel{python-interface-to-coriolis}{{}{28}{\relax }{section*.46}{}} -\@writefile{toc}{\contentsline {subsection}{A Simple Example: AM2901}{28}{section*.47}} -\newlabel{a-simple-example-am2901}{{}{28}{\relax }{section*.47}{}} -\ttl@finishall diff --git a/documentation/UsersGuide/UsersGuide.html b/documentation/UsersGuide/UsersGuide.html index affefcb6..31b835e9 100644 --- a/documentation/UsersGuide/UsersGuide.html +++ b/documentation/UsersGuide/UsersGuide.html @@ -41,79 +41,80 @@
  • Release 1.0.1963
  • Release 1.0.2049
  • Release v2.0.1
  • -
  • Release v2.1
  • +
  • Release v2.1
  • +
  • Release v2.2
  • -
  • Installation
      -
    • Fixed Directory Tree
    • -
    • Building Coriolis
        -
      • Building the Devel Branch
      • -
      • Additionnal Requirement under MacOS
      • +
      • Installation
      • -
      • Documentation
          -
        • General Software Architecture
        • +
        • Documentation
        • -
        • Coriolis Configuration & Initialisation
            -
          • First Stage: Symbolic Technology Selection
          • -
          • Second Stage: Technology Configuration Loading
          • -
          • Configuration Helpers
              -
            • Alliance Helper
            • -
            • Tools Configuration Helpers
            • +
            • Coriolis Configuration & Initialisation
            • -
            • CGT - The Graphical Interface
            • -
            • Viewer & Tools
                -
              • Stratus Netlist Capture
              • -
              • The Hurricane Data-Base
              • -
              • Synthetizing and loading a design
                  -
                • Synthesis under Yosys
                • -
                • Synthesis under Alliance
                • +
                • CGT - The Graphical Interface
                • +
                • Viewer & Tools
                  -

                  Synthetizing and loading a design

                  +

                  Synthetizing and loading a design

                  Coriolis supports several file formats. It can load all file format from the Alliance toolchain (.ap for layout, behavioural and structural vhdl .vbe and .vst), BLIF netlist format as well as benchmark formats from the ISPD contests.

                  It can be compiled with LEF/DEF support, although it requires acceptance of the SI2 license and may not be compiled in your version of the software.

                  -

                  Synthesis under Yosys

                  +

                  Synthesis under Yosys

                  You can create a BLIF file from the Yosys synthetizer, which can be imported under Coriolis. Most libraries are specified as a .lib liberty file and a .lef LEF file. Yosys opens most .lib files with minor modifications, but LEF support in Coriolis relies on SI2. @@ -901,13 +923,13 @@ If Coriolis hasn't been compiled against it, the library is given in Yosys and import it (as Blif without the extension) under Coriolis to perform place&route.

                  -

                  Synthesis under Alliance

                  +

                  Synthesis under Alliance

                  Alliance is an older toolchain but has been extensively used for years. Coriolis can import and write Alliance designs and libraries directly.

                  -

                  Etesian -- Placer

                  +

                  Etesian -- Placer

                  The Etesian placer is a state of the art (as of 2015) analytical placer. It is within 5% of other placers' solutions, but is normally a bit worse than ePlace. This Coriolis tool is actually an encapsulation of Coloquinte which is the placer.

                  @@ -947,7 +969,7 @@ Timing and routability analysis are not included either, and the returned placem may be unroutable.


                  -

                  Etesian Configuration Parameters

                  +

                  Etesian Configuration Parameters

                  @@ -1018,7 +1040,7 @@ More refreshing slows the placer.

                  -

                  Knik -- Global Router

                  +

                  Knik -- Global Router

                  The quality of Knik global routing solutions are equivalent to those of FGR 1.0. For an in-depth description of Knik algorithms, you may download the thesis of D. Dupuis avalaible from here~: Knik Thesis.

                  @@ -1033,7 +1055,7 @@ a global routing solution can be saved to disk and reloaded for later u
                  -

                  Kite -- Detailed Router

                  +

                  Kite -- Detailed Router

                  Kite no longer suffers from the limitations of Nero. It can route big designs as its runtime and memory footprint is almost linear (with respect to the number of gates). It has successfully routed design of more than 150K gates. @@ -1084,7 +1106,7 @@ that step.

                  Kite (on GCells) until the routing is finalized. Special layers appears to that effect in the The Layers&Go Tab.

                  -

                  Kite Configuration Parameters

                  +

                  Kite Configuration Parameters

                  As Knik is only called through Kite, it's parameters also have the kite. prefix.

                  The Katabatic parameters control the layer assignment step.

                  @@ -1208,7 +1230,7 @@ topological modification
                  -

                  Executing Python Scripts in Cgt

                  +

                  Executing Python Scripts in Cgt

                  Python/Stratus scripts can be executed either in text or graphical mode.

                  Note

                  @@ -1228,7 +1250,7 @@ initializations and before any other argument is processed.

                  For more explanation on Python scripts see Python Interface to Coriolis.

                  -

                  Printing & Snapshots

                  +

                  Printing & Snapshots

                  Printing or saving into a pdf is fairly simple, just uses the File -> Print menu or the CTRL+P shortcut to open the dialog box.

                  The print functionality uses exactly the same rendering mechanism as for the @@ -1271,7 +1293,7 @@ or similar.

                  Saving into an image is subject to the same remarks as for pdf.

                  @@ -1408,7 +1430,7 @@ in which this model is instanciated).
                  -

                  Cgt Command Line Options

                  +

                  Cgt Command Line Options

                  Appart from the obvious --text options, all can be used for text and graphical mode.

                  @@ -1493,7 +1515,7 @@ routed design :

                  @@ -1566,7 +1588,7 @@ To generate one set this flag to True
                  -

                  The Controller

                  +

                  The Controller

                  The Controller window is composed of seven tabs:

                  1. The Look Tab to select the display style.
                  2. @@ -1581,14 +1603,14 @@ the current selection.
                  3. The Settings Tab access all the tool's configuration settings.
                  -

                  The Look Tab

                  +

                  The Look Tab

                  You can select how the layout will be displayed. There is a special one Printer.Coriolis specifically designed for Printing & Snapshots. You should select it prior to calling the print or snapshot dialog boxes.

                  Controller Basic Snapshot

                  -

                  The Filter Tab

                  +

                  The Filter Tab

                  The filter tab let you select what hierarchical levels of your design will be displayed. Hierarchy level are numbered top-down: the level 0 correspond to the top-level cell, the level one to the instances of the top-level Cell and @@ -1611,7 +1633,7 @@ They have been made very visibles as big violet lines...

                  Controller Basic Snapshot

                  -

                  The Layers&Go Tab

                  +

                  The Layers&Go Tab

                  Control the individual display of all layers and Gos.

                  • Layers correspond to a true physical layer. From a Hurricane point of @@ -1629,7 +1651,7 @@ to easily locate congested areas.
                  • Controller Basic Snapshot

                  -

                  The Netlist Tab

                  +

                  The Netlist Tab

                  The Netlist tab shows the list of nets... By default the tab is not synched with the displayed Cell. To see the nets you must check the Sync Netlist checkbox. You can narrow the set of displayed nets by @@ -1642,7 +1664,7 @@ is highlited in the Viewer.

                  Controller Basic Snapshot

                  -

                  The Selection Tab

                  +

                  The Selection Tab

                  The Selection tab list all the components currently selecteds. They can be filtered thanks to the filter pattern.

                  Used in conjunction with the Netlist Sync Selection you will all see @@ -1655,7 +1677,7 @@ the t key...

                  Controller Basic Snapshot

                  -

                  The Inspector Tab

                  +

                  The Inspector Tab

                  This tab is very useful, but mostly for Coriolis developpers. It allows to browse through the live DataBase. The Inspector provide three entry points:

                    @@ -1681,13 +1703,13 @@ is deleted, you will crash the application...

                    Controller Basic Snapshot

                  -

                  The Settings Tab

                  +

                  The Settings Tab

                  Here comes the description of the Settings tab.

                  Controller Basic Snapshot

                  -

                  Python Interface for Hurricane / Coriolis

                  +

                  Python Interface for Hurricane / Coriolis

                  The (almost) complete interface of Hurricane is exported as a Python module and some part of the other components of Coriolis (each one in a separate module). The interface has been made to mirror as closely as possible the @@ -1766,13 +1788,13 @@ lauched through cgt.

                  -

                  Plugins

                  +

                  Plugins

                  Plugins are Python scripts specially crafted to integrate with cgt. Their entry point is a ScriptMain() method as described in Python Interface to Coriolis. They can be called by user scripts through this method.

                  -

                  Chip Placement

                  +

                  Chip Placement

                  Automatically perform the placement of a complete chip. This plugin, as well as the other P&R tools expect a specific top-level hierarchy for the design. The top-level hierarchy must contains the instances of all the I/O pads and @@ -1947,7 +1969,7 @@ only four rails (2* power, 2* -

                  Clock Tree

                  +

                  Clock Tree

                  Insert a clock tree into a block. The clock tree uses the H strategy. The clock net is splitted into sub-nets, one for each branch of the tree.

                  @@ -2039,14 +2061,14 @@ into retirement very soon
                  -

                  Recursive-Save (RSave)

                  +

                  Recursive-Save (RSave)

                  Perform a recursive top down save of all the models from the top cell loaded in cgt. Force a write of any non-terminal model. This plugin is used by the clock tree plugin after the netlist clock sub-nets creation.

                  -

                  A Simple Example: AM2901

                  +

                  A Simple Example: AM2901

                  To illustrate the capabilities of Coriolis tools and Python scripting, a small example, derived from the Alliance AM2901 is supplied.

                  This example contains only the synthetized netlists and the doChip.py script diff --git a/documentation/UsersGuide/UsersGuide.pdf b/documentation/UsersGuide/UsersGuide.pdf index ee6f7d6a..5159e71a 100644 Binary files a/documentation/UsersGuide/UsersGuide.pdf and b/documentation/UsersGuide/UsersGuide.pdf differ diff --git a/documentation/UsersGuide/UsersGuide.rst b/documentation/UsersGuide/UsersGuide.rst index 74e0adfa..12e6524d 100644 --- a/documentation/UsersGuide/UsersGuide.rst +++ b/documentation/UsersGuide/UsersGuide.rst @@ -129,6 +129,7 @@ .. _hMETIS: http://glaros.dtc.umn.edu/gkhome/views/metis .. _Knik Thesis: http://www-soc.lip6.fr/en/users/damiendupuis/PhD/ .. _Coin Or Home: http://www.coin-or.org/index.html +.. _RapidJSON: http://miloyip.github.io/rapidjson/ .. _coriolis2-1.0.2049-1.slsoc6.i686.rpm: http://asim.lip6.fr/pub/coriolis/2.0/coriolis2-1.0.2049-1.slsoc6.i686.rpm .. _coriolis2-1.0.2049-1.slsoc6.x86_64.rpm: http://asim.lip6.fr/pub/coriolis/2.0/coriolis2-1.0.2049-1.slsoc6.x86_64.rpm @@ -228,9 +229,9 @@ Credits & License |medskip| -The |Hurricane| data-base is copyright© |Bull| 2000-2015 and is +The |Hurricane| data-base is copyright© |Bull| 2000-2016 and is released under the terms of the |LGPL| license. All other tools are -copyright© |UPMC| 2008-2015 and released under the |GPL| +copyright© |UPMC| 2008-2016 and released under the |GPL| license. Others important contributors to |Coriolis| are Christophe |Alexandre|, @@ -317,8 +318,8 @@ Release v2.0.1 achieve a speedup factor greater than 20... -**Release v2.1** -~~~~~~~~~~~~~~~~ +Release v2.1 +~~~~~~~~~~~~ #. Replace the old simulated annealing placer |Mauka| by the analytical placer |Etesian| and its legalization and detailed placement tools. @@ -332,7 +333,14 @@ Release v2.0.1 .. When shifting to the left, the right-half part of the screen gets .. badly redrawn. Uses |CTRL_L| to refresh. It will be corrected as soon .. as possible. - + + +**Release v2.2** +~~~~~~~~~~~~~~~~ + +#. Added JSON import/export of the whole Hurricane DataBase. Two save mode + are supported: *Cell* mode (standalone) or *Blob* mode, which dump the + whole design down and including the standard cells. |newpage| @@ -352,9 +360,11 @@ Main building prerequisites: * cmake * C++11-capable compiler +* RapidJSON_ * python2.7 * boost * libxml2 +* bzip2 * yacc & lex * Qt 4 or Qt 5 @@ -437,26 +447,37 @@ automatically created either by |ccb| or the build system. Building Coriolis ~~~~~~~~~~~~~~~~~ -The first step is to create the source directory and pull the |git| repository: :: +First step is to install the prerequisites. Currently, only RapidJSON_. +As RapidJSON is evolving fast, if you encounter compatibility problems, +the exact version we compiled against is given below. :: + + dummy@lepka:~$ mkdir -p ~/coriolis-2.x/src/support + dummy@lepka:~$ cd ~/coriolis-2.x/src/support + dummy@lepka:~$ git clone http://github.com/miloyip/rapidjson + dummy@lepka:~$ git checkout ec322005072076ef53984462fb4a1075c27c7dfd + +The second step is to create the source directory and pull the |git| repository: :: dummy@lepka:~$ mkdir -p ~/coriolis-2.x/src dummy@lepka:~$ cd ~/coriolis-2.x/src dummy@lepka:~$ git clone https://www-soc.lip6.fr/git/coriolis.git -Second and final step, build & install: :: +Third and final step, build & install: :: - dummy@lepka:src$ ./bootstrap/ccp.py --project=coriolis \ + dummy@lepka:src$ ./bootstrap/ccb.py --project=support \ + --project=coriolis \ --make="-j4 install" - dummy@lepka:src$ ./bootstrap/ccb.py --project=coriolis \ + dummy@lepka:src$ ./bootstrap/ccb.py --project=support \ + --project=coriolis \ --doc --make="-j1 install" -We need two steps because the documentation do not support to be generated with -a parallel build. So we compile & install in a first step in ``-j4`` (or whatever) -then we generate the documentation in ``-j1`` +We need to separate to perform a separate installation of the documentation because it +do not support to be generated with a parallel build. So we compile & install in a first +stage in ``-j4`` (or whatever) then we generate the documentation in ``-j1`` Under |RHEL6| or clones, you must build using the |devtoolset2|: :: - dummy@lepka:src$ ./bootstrap/ccp.py --project=coriolis \ + dummy@lepka:src$ ./bootstrap/ccb.py --project=coriolis \ --devtoolset-2 --make="-j4 install" If you want to uses Qt 5 instead of Qt 4, you may add the ``--qt5`` argument. @@ -478,7 +499,7 @@ In the |Coriolis| |git| repository, two branches are present: command just after the first step: :: dummy@lepka:~$ git checkout devel - dummy@lepka:src$ ./bootstrap/ccp.py --project=coriolis \ + dummy@lepka:src$ ./bootstrap/ccb.py --project=coriolis \ --make="-j4 install" --debug Be aware that it may requires newer versions of the dependencies and may introduce @@ -871,7 +892,8 @@ For example: :: , ('misc.logMode' , TypeBool , True ) , ('misc.verboseLevel1' , TypeBool , False ) , ('misc.verboseLevel2' , TypeBool , True ) - , ('misc.traceLevel' , TypeInt , 1000 ) + , ('misc.minTraceLevel' , TypeInt , 0 ) + , ('misc.maxTraceLevel' , TypeInt , 0 ) ) # Some ordinary Python script... @@ -1500,10 +1522,12 @@ Miscellaneous Settings +---------------------------------------+------------------+----------------------------+ | **Development/Debug Parameters** | +---------------------------------------+------------------+----------------------------+ -| ``misc.traceLevel`` | TypeInt | :cb:`0` | +| ``misc.minTraceLevel`` | TypeInt | :cb:`0` | ++---------------------------------------+------------------+----------------------------+ +| ``misc.maxTraceLevel`` | TypeInt | :cb:`0` | | +------------------+----------------------------+ -| | Display trace information *below* that level | -| | (:cb:`ltrace` stream) | +| | Display trace information *between* those two | +| | levels (:cb:`cdebug` stream) | +---------------------------------------+------------------+----------------------------+ | ``misc.catchCore`` | TypeBool | :cb:`False` | | +------------------+----------------------------+ diff --git a/documentation/UsersGuide/socstyle.tex b/documentation/UsersGuide/socstyle.tex index 967ab366..5cf8f487 100644 --- a/documentation/UsersGuide/socstyle.tex +++ b/documentation/UsersGuide/socstyle.tex @@ -2,7 +2,8 @@ \usepackage[default,osfigures,scale=0.95]{opensans} \usepackage{xspace} \usepackage{fancyhdr} - \usepackage[dvipdfm]{graphicx} +%\usepackage[dvipdfm]{graphicx} + \usepackage{graphicx} \usepackage{enumitem} \usepackage[sf,bf]{titlesec} \usepackage{titletoc} diff --git a/documentation/examples/code/engine/smurf/src/Configuration.cpp b/documentation/examples/code/engine/smurf/src/Configuration.cpp index 96e969ac..0dc97374 100644 --- a/documentation/examples/code/engine/smurf/src/Configuration.cpp +++ b/documentation/examples/code/engine/smurf/src/Configuration.cpp @@ -1,7 +1,7 @@ // -*- mode: C++; explicit-buffer-name: "Configuration.cpp" -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2014-2015, All Rights Reserved +// Copyright (c) UPMC 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/documentation/examples/code/engine/smurf/src/GraphicSmurfEngine.cpp b/documentation/examples/code/engine/smurf/src/GraphicSmurfEngine.cpp index d2ddba1e..a652bfb8 100644 --- a/documentation/examples/code/engine/smurf/src/GraphicSmurfEngine.cpp +++ b/documentation/examples/code/engine/smurf/src/GraphicSmurfEngine.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2014-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/documentation/examples/code/engine/smurf/src/PyGraphicSmurfEngine.cpp b/documentation/examples/code/engine/smurf/src/PyGraphicSmurfEngine.cpp index 069571dd..e326c3ce 100644 --- a/documentation/examples/code/engine/smurf/src/PyGraphicSmurfEngine.cpp +++ b/documentation/examples/code/engine/smurf/src/PyGraphicSmurfEngine.cpp @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2014-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/documentation/examples/code/engine/smurf/src/PySmurf.cpp b/documentation/examples/code/engine/smurf/src/PySmurf.cpp index 67845f1a..8be44b0a 100644 --- a/documentation/examples/code/engine/smurf/src/PySmurf.cpp +++ b/documentation/examples/code/engine/smurf/src/PySmurf.cpp @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2014-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/documentation/examples/code/engine/smurf/src/PySmurfEngine.cpp b/documentation/examples/code/engine/smurf/src/PySmurfEngine.cpp index 95b5bdf5..76550ecb 100644 --- a/documentation/examples/code/engine/smurf/src/PySmurfEngine.cpp +++ b/documentation/examples/code/engine/smurf/src/PySmurfEngine.cpp @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2014-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/documentation/examples/code/engine/smurf/src/SmurfEngine.cpp b/documentation/examples/code/engine/smurf/src/SmurfEngine.cpp index 1caca99f..3d404ce5 100644 --- a/documentation/examples/code/engine/smurf/src/SmurfEngine.cpp +++ b/documentation/examples/code/engine/smurf/src/SmurfEngine.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2014-2015, All Rights Reserved +// Copyright (c) UPMC 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/documentation/examples/code/engine/smurf/src/smurf/Configuration.h b/documentation/examples/code/engine/smurf/src/smurf/Configuration.h index 51ef7002..38751f40 100644 --- a/documentation/examples/code/engine/smurf/src/smurf/Configuration.h +++ b/documentation/examples/code/engine/smurf/src/smurf/Configuration.h @@ -1,7 +1,7 @@ // -*- mode: C++; explicit-buffer-name: "Configuration.h" -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2014-2015, All Rights Reserved +// Copyright (c) UPMC 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/documentation/examples/code/engine/smurf/src/smurf/GraphicSmurfEngine.h b/documentation/examples/code/engine/smurf/src/smurf/GraphicSmurfEngine.h index 40d18f75..410b1a54 100644 --- a/documentation/examples/code/engine/smurf/src/smurf/GraphicSmurfEngine.h +++ b/documentation/examples/code/engine/smurf/src/smurf/GraphicSmurfEngine.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2014-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/documentation/examples/code/engine/smurf/src/smurf/PyGraphicSmurfEngine.h b/documentation/examples/code/engine/smurf/src/smurf/PyGraphicSmurfEngine.h index 86f6a0f2..c4cb9f92 100644 --- a/documentation/examples/code/engine/smurf/src/smurf/PyGraphicSmurfEngine.h +++ b/documentation/examples/code/engine/smurf/src/smurf/PyGraphicSmurfEngine.h @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2014-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/documentation/examples/code/engine/smurf/src/smurf/PySmurfEngine.h b/documentation/examples/code/engine/smurf/src/smurf/PySmurfEngine.h index 8759a213..6b859cad 100644 --- a/documentation/examples/code/engine/smurf/src/smurf/PySmurfEngine.h +++ b/documentation/examples/code/engine/smurf/src/smurf/PySmurfEngine.h @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2014-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/documentation/examples/code/engine/smurf/src/smurf/SmurfEngine.h b/documentation/examples/code/engine/smurf/src/smurf/SmurfEngine.h index a093995d..d95d577d 100644 --- a/documentation/examples/code/engine/smurf/src/smurf/SmurfEngine.h +++ b/documentation/examples/code/engine/smurf/src/smurf/SmurfEngine.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2014-2015, All Rights Reserved +// Copyright (c) UPMC 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/etesian/src/AddFeeds.cpp b/etesian/src/AddFeeds.cpp index d177e55d..423130ab 100644 --- a/etesian/src/AddFeeds.cpp +++ b/etesian/src/AddFeeds.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2015-2015, All Rights Reserved +// Copyright (c) UPMC 2015-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -34,9 +34,6 @@ namespace { using namespace std; using Hurricane::tab; - using Hurricane::inltrace; - using Hurricane::ltracein; - using Hurricane::ltraceout; using Hurricane::ForEachIterator; using Hurricane::Warning; using Hurricane::Error; @@ -118,8 +115,8 @@ namespace { void Slice::merge ( DbU::Unit source, DbU::Unit target ) { Interval chunkToMerge = _xspan.getIntersection( Interval(source,target) ); - ltrace(300) << " Slice::merge() " << " " << chunkToMerge << endl; - ltrace(300) << " | " << _getString() << endl; + cdebug.log(129) << " Slice::merge() " << " " << chunkToMerge << endl; + cdebug.log(129) << " | " << _getString() << endl; if (chunkToMerge.isEmpty()) return; @@ -129,20 +126,20 @@ namespace { while ( ichunk != _chunks.end() ) { if (imerge == _chunks.end()) { if (chunkToMerge.getVMax() < (*ichunk).getVMin()) { - ltrace(300) << " | Insert before " << *ichunk << endl; + cdebug.log(129) << " | Insert before " << *ichunk << endl; imerge = _chunks.insert( ichunk, chunkToMerge ); break; } if (chunkToMerge.intersect(*ichunk)) { - ltrace(300) << " | Merge with " << *ichunk << endl; + cdebug.log(129) << " | Merge with " << *ichunk << endl; imerge = ichunk; (*imerge).merge( chunkToMerge ); } } else { if (chunkToMerge.getVMax() >= (*ichunk).getVMin()) { (*imerge).merge( *ichunk ); - ltrace(300) << " | Absorb (erase) " << *ichunk << endl; + cdebug.log(129) << " | Absorb (erase) " << *ichunk << endl; ichunk = _chunks.erase( ichunk ); continue; } else @@ -154,8 +151,8 @@ namespace { if (imerge == _chunks.end()) { _chunks.insert( ichunk, chunkToMerge ); - ltrace(300) << " | Insert at end " << DbU::getValueString(_ybottom) << " " << chunkToMerge << endl; - ltrace(300) << " | " << _getString() << endl; + cdebug.log(129) << " | Insert at end " << DbU::getValueString(_ybottom) << " " << chunkToMerge << endl; + cdebug.log(129) << " | " << _getString() << endl; } } diff --git a/etesian/src/Configuration.cpp b/etesian/src/Configuration.cpp index bf992b46..25f1a0a0 100644 --- a/etesian/src/Configuration.cpp +++ b/etesian/src/Configuration.cpp @@ -1,7 +1,7 @@ // -*- mode: C++; explicit-buffer-name: "Configuration.cpp" -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2014-2015, All Rights Reserved +// Copyright (c) UPMC 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -41,7 +41,6 @@ namespace Etesian { using std::ostringstream; using std::vector; using Hurricane::tab; - using Hurricane::inltrace; using Hurricane::Warning; using Hurricane::Technology; using Hurricane::DataBase; @@ -81,7 +80,7 @@ namespace Etesian { Configuration::~Configuration () { - ltrace(89) << "About to delete attribute _cg (CellGauge)." << endl; + cdebug.log(129) << "About to delete attribute _cg (CellGauge)." << endl; _cg->destroy (); } @@ -91,14 +90,14 @@ namespace Etesian { void Configuration::print ( Cell* cell ) const { - cout << " o Configuration of ToolEngine for Cell <" << cell->getName() << ">" << endl; - cout << Dots::asIdentifier(" - Cell Gauge" ,getString(_cg->getName())) << endl; - cout << Dots::asInt (" - Place Effort" ,_placeEffort ) << endl; - cout << Dots::asInt (" - Update Conf" ,_updateConf ) << endl; - cout << Dots::asInt (" - Spreading Conf",_spreadingConf) << endl; - cout << Dots::asBool (" - Routing driven",_routingDriven) << endl; - cout << Dots::asPercentage(" - Space Margin" ,_spaceMargin ) << endl; - cout << Dots::asPercentage(" - Aspect Ratio" ,_aspectRatio ) << endl; + cmess1 << " o Configuration of ToolEngine for Cell <" << cell->getName() << ">" << endl; + cmess1 << Dots::asIdentifier(" - Cell Gauge" ,getString(_cg->getName())) << endl; + cmess1 << Dots::asInt (" - Place Effort" ,_placeEffort ) << endl; + cmess1 << Dots::asInt (" - Update Conf" ,_updateConf ) << endl; + cmess1 << Dots::asInt (" - Spreading Conf",_spreadingConf) << endl; + cmess1 << Dots::asBool (" - Routing driven",_routingDriven) << endl; + cmess1 << Dots::asPercentage(" - Space Margin" ,_spaceMargin ) << endl; + cmess1 << Dots::asPercentage(" - Aspect Ratio" ,_aspectRatio ) << endl; } diff --git a/etesian/src/EtesianEngine.cpp b/etesian/src/EtesianEngine.cpp index 909ac6ad..964693b0 100644 --- a/etesian/src/EtesianEngine.cpp +++ b/etesian/src/EtesianEngine.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2014-2015, All Rights Reserved +// Copyright (c) UPMC 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -191,9 +191,6 @@ namespace Etesian { using Utilities::Dots; using Hurricane::DebugSession; using Hurricane::tab; - using Hurricane::inltrace; - using Hurricane::ltracein; - using Hurricane::ltraceout; using Hurricane::ForEachIterator; using Hurricane::Bug; using Hurricane::Error; @@ -290,13 +287,12 @@ namespace Etesian { void EtesianEngine::_preDestroy () { - ltrace(90) << "EtesianEngine::_preDestroy()" << endl; - ltracein(90); + cdebug.log(129,1) << "EtesianEngine::_preDestroy()" << endl; cmess1 << " o Deleting ToolEngine<" << getName() << "> from Cell <" << getCell()->getName() << ">" << endl; - ltraceout(90); + cdebug.log(129,-1); } @@ -404,6 +400,7 @@ namespace Etesian { _flatDesign = true; Dots dots ( cmess2, " ", 80, 1000 ); + if (not cmess2.enabled()) dots.disable(); cmess1 << " o Erasing previous placement of <" << getCell()->getName() << ">" << endl; @@ -450,9 +447,7 @@ namespace Etesian { AllianceFramework* af = AllianceFramework::get(); DbU::Unit pitch = getPitch(); - cmess1 << " - Building RoutingPads (transhierarchical) ..." << endl; - //getCell()->flattenNets( Cell::Flags::BuildRings|Cell::Flags::NoClockFlatten ); - getCell()->flattenNets( Cell::Flags::NoClockFlatten ); + if (not cmess2.enabled()) dots.disable(); // Coloquinte circuit description data-structures. size_t instancesNb = getCell()->getLeafInstanceOccurrences().getSize(); @@ -479,11 +474,16 @@ namespace Etesian { //masterCell->setAbutmentBox( topAb ); //instance->setTransformation( Transformation() ); // (0,0,ID). //instance->setPlacementStatus( Instance::PlacementStatus::PLACED ); + occurrence.makeInvalid(); instance->slaveAbutmentBox(); } } UpdateSession::close(); + cmess1 << " - Building RoutingPads (transhierarchical) ..." << endl; + //getCell()->flattenNets( Cell::Flags::BuildRings|Cell::Flags::NoClockFlatten ); + getCell()->flattenNets( Cell::Flags::NoClockFlatten ); + index_t instanceId = 0; for ( Occurrence occurrence : getCell()->getLeafInstanceOccurrences() ) { @@ -922,6 +922,14 @@ namespace Etesian { _placed = true; + UpdateSession::open(); + for ( Net* net : getCell()->getNets() ) { + for ( RoutingPad* rp : net->getComponents().getSubSet() ) { + rp->invalidate(); + } + } + UpdateSession::close(); + getCell()->setFlags( Cell::Flags::Placed ); } @@ -996,7 +1004,7 @@ namespace Etesian { ); //cerr << "Setting <" << instanceName << " @" << instancePosition << endl; - // This is temporary as it's not trans-hierarchic: we ignore the posutions + // This is temporary as it's not trans-hierarchic: we ignore the positions // of all the intermediary instances. instance->setTransformation( trans ); instance->setPlacementStatus( Instance::PlacementStatus::PLACED ); diff --git a/etesian/src/FeedCells.cpp b/etesian/src/FeedCells.cpp index d6d0b371..4aab2bac 100644 --- a/etesian/src/FeedCells.cpp +++ b/etesian/src/FeedCells.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2015-2015, All Rights Reserved +// Copyright (c) UPMC 2015-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/etesian/src/GraphicEtesianEngine.cpp b/etesian/src/GraphicEtesianEngine.cpp index b52a7066..992450e5 100644 --- a/etesian/src/GraphicEtesianEngine.cpp +++ b/etesian/src/GraphicEtesianEngine.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2014-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/etesian/src/PyEtesian.cpp b/etesian/src/PyEtesian.cpp index d655bef8..39826b90 100644 --- a/etesian/src/PyEtesian.cpp +++ b/etesian/src/PyEtesian.cpp @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2014-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -26,7 +26,6 @@ namespace Etesian { using std::cerr; using std::endl; using Hurricane::tab; - using Hurricane::in_trace; using Isobar::__cs; using CRL::PyTypeToolEngine; using CRL::PyTypeGraphicTool; @@ -66,7 +65,7 @@ extern "C" { // Module Initialization : "initEtesian ()" DL_EXPORT(void) initEtesian () { - trace << "initEtesian()" << endl; + cdebug.log(34) << "initEtesian()" << endl; PyEtesianEngine_LinkPyType(); PyGraphicEtesianEngine_LinkPyType(); diff --git a/etesian/src/PyEtesianEngine.cpp b/etesian/src/PyEtesianEngine.cpp index 0061ec65..67ed7663 100644 --- a/etesian/src/PyEtesianEngine.cpp +++ b/etesian/src/PyEtesianEngine.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2014-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -34,8 +34,8 @@ namespace Etesian { using std::hex; using std::ostringstream; using Hurricane::tab; - using Hurricane::trace_on; - using Hurricane::in_trace; + using Hurricane::Exception; + using Hurricane::Bug; using Hurricane::Error; using Hurricane::Warning; using Hurricane::ExceptionWidget; @@ -65,7 +65,7 @@ extern "C" { static PyObject* PyEtesianEngine_get ( PyObject*, PyObject* args ) { - trace << "PyEtesianEngine_get()" << endl; + cdebug.log(34) << "PyEtesianEngine_get()" << endl; EtesianEngine* etesian = NULL; @@ -82,7 +82,7 @@ extern "C" { static PyObject* PyEtesianEngine_create ( PyObject*, PyObject* args ) { - trace << "PyEtesianEngine_create()" << endl; + cdebug.log(34) << "PyEtesianEngine_create()" << endl; EtesianEngine* etesian = NULL; @@ -108,7 +108,7 @@ extern "C" { static PyObject* PyEtesianEngine_setViewer ( PyEtesianEngine* self, PyObject* args ) { - trace << "PyEtesianEngine_setViewer ()" << endl; + cdebug.log(34) << "PyEtesianEngine_setViewer ()" << endl; HTRY METHOD_HEAD( "EtesianEngine.setViewer()" ) @@ -129,7 +129,7 @@ extern "C" { static PyObject* PyEtesianEngine_place ( PyEtesianEngine* self ) { - trace << "PyEtesianEngine_place()" << endl; + cdebug.log(34) << "PyEtesianEngine_place()" << endl; HTRY METHOD_HEAD("EtesianEngine.place()") if (etesian->getViewer()) { diff --git a/etesian/src/PyGraphicEtesianEngine.cpp b/etesian/src/PyGraphicEtesianEngine.cpp index b0e0e874..64d18e41 100644 --- a/etesian/src/PyGraphicEtesianEngine.cpp +++ b/etesian/src/PyGraphicEtesianEngine.cpp @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2014-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -49,7 +49,7 @@ extern "C" { static PyObject* PyGraphicEtesianEngine_grab ( PyObject* ) { - trace << "PyGraphicEtesianEngine_grab()" << endl; + cdebug.log(34) << "PyGraphicEtesianEngine_grab()" << endl; PyGraphicEtesianEngine* pyGraphicEtesianEngine = NULL; HTRY @@ -65,7 +65,7 @@ extern "C" { static PyObject* PyGraphicEtesianEngine_getCell ( PyGraphicEtesianEngine* self ) { - trace << "PyGraphicEtesianEngine_getCell ()" << endl; + cdebug.log(34) << "PyGraphicEtesianEngine_getCell ()" << endl; Cell* cell = NULL; diff --git a/etesian/src/etesian/Configuration.h b/etesian/src/etesian/Configuration.h index eda4d8d7..886ef08c 100644 --- a/etesian/src/etesian/Configuration.h +++ b/etesian/src/etesian/Configuration.h @@ -1,7 +1,7 @@ // -*- mode: C++; explicit-buffer-name: "Configuration.h" -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2014-2015, All Rights Reserved +// Copyright (c) UPMC 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/etesian/src/etesian/EtesianEngine.h b/etesian/src/etesian/EtesianEngine.h index 2a09b1b4..f4796b05 100644 --- a/etesian/src/etesian/EtesianEngine.h +++ b/etesian/src/etesian/EtesianEngine.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2014-2015, All Rights Reserved +// Copyright (c) UPMC 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/etesian/src/etesian/FeedCells.h b/etesian/src/etesian/FeedCells.h index c8b9e448..9dd23f6a 100644 --- a/etesian/src/etesian/FeedCells.h +++ b/etesian/src/etesian/FeedCells.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2015-2015, All Rights Reserved +// Copyright (c) UPMC 2015-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/etesian/src/etesian/GraphicEtesianEngine.h b/etesian/src/etesian/GraphicEtesianEngine.h index 0493c8b0..259071c6 100644 --- a/etesian/src/etesian/GraphicEtesianEngine.h +++ b/etesian/src/etesian/GraphicEtesianEngine.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2014-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/etesian/src/etesian/PyEtesianEngine.h b/etesian/src/etesian/PyEtesianEngine.h index 3f7b1c80..6950d9d5 100644 --- a/etesian/src/etesian/PyEtesianEngine.h +++ b/etesian/src/etesian/PyEtesianEngine.h @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2014-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/etesian/src/etesian/PyGraphicEtesianEngine.h b/etesian/src/etesian/PyGraphicEtesianEngine.h index ad04c82c..4b45931f 100644 --- a/etesian/src/etesian/PyGraphicEtesianEngine.h +++ b/etesian/src/etesian/PyGraphicEtesianEngine.h @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2014-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/hurricane/CMakeLists.txt b/hurricane/CMakeLists.txt index 313f3881..bafa6a4a 100644 --- a/hurricane/CMakeLists.txt +++ b/hurricane/CMakeLists.txt @@ -18,6 +18,7 @@ setup_qt() find_package(LibXml2 REQUIRED) + find_package(BZip2 REQUIRED) find_package(BISON REQUIRED) find_package(FLEX REQUIRED) find_package(PythonLibs REQUIRED) diff --git a/hurricane/doc/hurricane/Commons.dox b/hurricane/doc/hurricane/Commons.dox index 0254fc39..8cf2cf8b 100644 --- a/hurricane/doc/hurricane/Commons.dox +++ b/hurricane/doc/hurricane/Commons.dox @@ -1,7 +1,74 @@ - // -*- C++ -*- + /*! \class tstream + * \brief Trace & indentation enabled stream. + * + * Traced \e stream are a derived class of std::ostream that provides + * integrated indentation and selective printing according to a + * verbosity level. Only messages comprised between \c minLevel and + * \c maxLevel are to be printed: + \f[ + minLevel \leq level < maxLevel + \f] + * + * The cdebug instance of this class, in conjunction with Hurricane::DebugSession + * is provided to create tailored program traces. cdebug is a global + * variable which is put in the root namespace (not the Hurricane namespace). + */ + +//! \function int tstream::getMinLevel () const; +//! \Return The current mimimum level for the messages to be printeds +//! (equal or superior). + +//! \function int tstream::getMaxLevel () const; +//! \Return The current maximum level for the messages to be printeds +//! (strictly inferior). + +//! \function int tstream::setMinLevel ( int level ); +//! Sets the minimum level, returns the \e previous value of the level. + +//! \function int tstream::setMaxLevel ( int level ); +//! Sets the maximum level, returns the \e previous value of the level. + +//! \function int tstream::getLevel () const; +//! \Return The level of the latest message that was submitted to the stream. +//! It is automatically set up after any call to tstream::log() or +//! tstream::tabw(). + +//! \function int tstream::setLevel ( int level ); +//! Sets the current level, returns the \e previous value of the level. +//! This is the level of the latest message that was submitted to the +//! stream. + +//! \function bool tstream::enabled () const; +//! \Return \true if the currently memorised level is inside the current valid range. + +//! \function bool tstream::enabled ( int level ) const; +//! \Return \true if this level is inside the current valid range. + +//! \function tstream& tstream::log ( int level, int count=0 ) const; +//! \param level The level into which to print. +//! \param count Increment/decrement the number of tabulations to print +//! at the beginning of a line. +//! \return A reference to the stream so the operator \c << can be used. +//! +//! Send a message into the stream, that will be displayed if \c level +//! is enabled. The number of tabulations printed at the beginning of +//! the line will be changed \e after this message has been printed +//! (or discarted). + +//! \function tstream& tstream::tabw ( int level, int count=0 ) const; +//! \param level The level into which to print. +//! \param count Increment/decrement the number of tabulations to print +//! at the beginning of a line. +//! \return A reference to the stream. +//! +//! This function is dedicated to change the indentation level, but +//! not print something on the stream (event if it returns a reference +//! to it). + + namespace Hurricane { /*! \namespace Hurricane diff --git a/hurricane/doc/hurricane/DebugSession.dox b/hurricane/doc/hurricane/DebugSession.dox new file mode 100644 index 00000000..f6a2e1ee --- /dev/null +++ b/hurricane/doc/hurricane/DebugSession.dox @@ -0,0 +1,117 @@ +// -*- C++ -*- + + + namespace Hurricane { + + /*! \class DebugSession + * \brief Enable/Disable trace information (\c API). + * + * DebugSession provide a way to control what and when text send through the + * cdebug stream is printed. cdebug display selectively the trace/debug messages + * between a \c minLevel and a \c maxLevel : + \f[ + minLevel \leq level < maxLevel + \f] + * + * DebugSession manage a stack of \c (min,max) pairs so multiple session + * can be opened. On opening a new session the \c (min,max) pair is + * pushed on the top of the stack and define the active range of trace + * levels. On closing, the pair is removed from the top and the previous + * range became active again. Do not forget to match any opening with a + * closing. + * + * In addition to the levels, a DebugSession also can be triggered by a + * \e symbol (i.e. a \c (void*) pointer). The DebugSession has contains + * a user managed table of symbols. When, in opening a session, you give + * a symbol, the session will actually changes the trace levels only if + * the symbol is in the internal table. Otherwise a session is still + * opened \e but it will keep the current trace levels. So, in any case + * the session must be closed. + * + * + * \section secTraceLevels Trace Levels + * + * + * To avoid mixing messages between different parts of the software, + * the following allotments have been done: + * + *

                  + * + * + *
                  Trace/Debug level allotments (provisional)
                  \b C++ / Coriolis + *
                  \b Tool/Library \b Minimum \b Maximum + *
                  Hurricane \c 0 \c 19 + *
                  CRL Core \c 100 \c 110 + *
                  Anabatic \c 110 \c 120 + *
                  Etesian \c 120 \c 130 + *
                  Knik \c 130 \c 140 + *
                  Katabatic \c 140 \c 150 + *
                  Kite \c 150 \c 160 + *
                  Solstice \c 160 \c 170 + *
                  Equinox \c 170 \c 180 + *
                  Unicorn \c 180 \c 190 + *
                  \b C++ / CHAMS + *
                  \b Tool/Library \b Minimum \b Maximum + *
                  HurricaneAMS \c 500 \c 510 + *
                  amsCore \c 510 \c 520 + *
                  Pharos \c 520 \c 530 + *
                  Isis \c 530 \c 540 + *
                  Horus \c 530 \c 540 + *
                  \b Python Wrappers / Coriolis + *
                  \b Tool/Library \b Minimum \b Maximum + *
                  Isobar \c 20 \c 30 + *
                  CRL Core/Python \c 30 \c 32 + *
                  Anabatic/Python \c 32 \c 34 + *
                  Etesian/Python \c 34 \c 36 + *
                  Knik/Python \c 36 \c 38 + *
                  Katabatic/Python \c 38 \c 40 + *
                  Kite/Python \c 40 \c 42 + *
                  Solstice/Python \c 42 \c 44 + *
                  Equinox/Python \c 44 \c 46 + *
                  Unicorn/Python \c 46 \c 48 + *
                  \b Python Wrappers / CHAMS + *
                  \b Tool/Library \b Minimum \b Maximum + *
                  isobarAMS \c 48 \c 50 + *
                  amsCore \c 50 \c 51 + *
                  Pharos/Python \c 52 \c 60 + *
                  Isis/Python \c 60 \c 61 + *
                  Horus/Python \c 61 \c 62 + *
                  \b Special levels + *
                  Determinim check \c 9000 \c 9001 + *
                  JSON parsers/drivers\c 19 \c 20 + *
                  + *
                  + */ + + //! \function void DebugSession::open ( int minLevel, int maxLevel ); + //! \param minLevel minimum debug/tracelevel (>=). + //! \param maxLevel maximum debug/tracelevel (<). + //! + //! Change the current debug level to (minLevel,maxLevel). + //! The previous range is stacked and will be restored when this + //! session will be closed. + + //! \function void DebugSession::open ( const void* symbol, int minLevel, int maxLevel ); + //! \param symbol symbol to match. + //! \param minLevel minimum debug/tracelevel (>=). + //! \param maxLevel maximum debug/tracelevel (<). + //! + //! Change the current debug level to (minLevel,maxLevel) only if + //! \c symbol is traced. If the \c symbol is traced, then the new levels pair + //! is stacked, otherwise the current level are stacked (we duplicate the + //! top of the stack). This session, successful or not, must be closed as + //! any other. + + //! \function void DebugSession::close (); + //! Close a DebugSession and restore the previous trace levels. + + //! \function bool DebugSession::isTraced ( const void* symbol ); + //! \Returns \true if the \c symbol is in the DebugSession symbol table. + + //! \function void DebugSession::addToTrace ( const void* symbol ); + //! Adds the \c symbol to the table of traced symbols. + + //! \function void DebugSession::addToTrace ( const Cell* cell, const Name& name ); + //! Adds the Net \c name from \c Cell to the table of traced symbols. + + } // Hurricane namespace. diff --git a/hurricane/doc/hurricane/Initializer.dox b/hurricane/doc/hurricane/Initializer.dox new file mode 100644 index 00000000..e1ec285d --- /dev/null +++ b/hurricane/doc/hurricane/Initializer.dox @@ -0,0 +1,29 @@ + // -*- C++ -*- + + + namespace Hurricane { + + /*! \class Initializer + * \brief Register a static initialization function. + * + * \section secInitializerMechanism Initializer Mechanism + * + * In C++, there is currently no way to guarantee the order into + * which the static initialization (variables) in various modules + * will be done. + * + * The Initializer template class provide a way to perform a static + * initialization across multiple modules in an ordered fashion, + * thus solving potential dependency problems between initialisation. + */ + + //! \function Initializer::Initializer ( unsigned int order ); + //! Register a static initializer for the template type \c T. + //! Initializer is a object that must be kept in a \c static + //! variable in a compilation unit (i.e. a \c .cpp file). + //! + //! The template type \c T (a class) must provide a static function + //! named \c initialize, with exactly the following signature: + //! void T::initialize(). + + } diff --git a/hurricane/doc/hurricane/JsonObject.dox b/hurricane/doc/hurricane/JsonObject.dox new file mode 100644 index 00000000..cf1e3a1b --- /dev/null +++ b/hurricane/doc/hurricane/JsonObject.dox @@ -0,0 +1,323 @@ + // -*- C++ -*- + + + namespace Hurricane { + + //! \addtogroup JsonSupport + //! \{ + + /*! \class JsonObject + * \brief Support for JSON export. + * + */ + + //! \} + + //! \function JsonObject::JsonObject ( unsigned long flags ); + //! \param flags Flags sets by derived classes. + //! + //! Base object to be used by all JSON parsers. Provides + //! helpers functions. Store three separated lists of + //! requirements/attributes needes to build the object. + //! - \c stackeds : thoses are \b not attributes of the + //! current object, but other objects that are expected + //! to be already in the stack. They are needed to build the + //! current object. Their key must start with a \c '.' + //! character. + //! - \c attributes : the simple attributes of the object. + //! Their key must start with a \c '_'. + //! - \c collections : any container, collection or whatever + //! set of other objects part of the current object. + //! Their key must start with a \c '+' character. + //! + //! For adding a requirement/attribute, see JsonObject::add(). + + //! \function bool JsonObject::isDummy () const; + //! \Return \true if the concrete object is of type \c JsonDummy, \false otherwise. + + //! \function string JsonObject::getTypeName () const; + //! \Return The typename of the concrete object, that is, the value + //! of the \c @typename key of the JSON object. + + //! \function string JsonObject::getStackName () const; + //! \Return The key with which the DataBase object will be pushed on + //! the parser stack. + //! + //! If the current object is associated to an attribute (that + //! is, a key in JSON), then the \c name attribute of the JsonObject + //! should have been set, and it will be returned here. + //! + //! If the \c name attribute has not been set (for example, + //! because we are in an array). Then the typename (JsonObject::getTypeName()), + //! prefixed by a \c '.' character will be returned. + //! + //! If the JsonObject is, for instance, a JsonBox (typename: \c "Box") : + //! - If \c name is set to \c "_abutmentBox", the box will be stacked + //! with that key. + //! - If \c name is \b not set, then the key will be \c ".Box". + + //! \function JsonObject* JsonObject::setFlags ( unsigned long mask ); + //! \param mask Flag(s) to be raised. + //! \return The current object. + + //! \function JsonObject* JsonObject::resetFlags ( unsigned long mask ); + //! \param mask Flag(s) to be lowered. + //! \return The current object. + + //! \function bool JsonObject::issetFlags ( unsigned long mask ) const; + //! \param mask The combination of flags to be checked. + //! \return \true if \b all the flags given in \c mask are sets. + + //! \function bool JsonObject::check ( JsonStack& stack, string fname ) const; + //! \param stack Where the objects already parsed are stored. + //! \param fname The function name on behalf of which the check is + //! performed. + //! \return \true if the check is successful. + //! + //! Check that the \c stack actually contains all the objects (i.e. attributes) + //! needed to build the current object. The list of \e attributes is built + //! using the JsonObject::add() function. If an attribute is missing, a warning + //! is issued, but the parser will try to continue. + + //! \function bool JsonObject::has ( const string& key ) const; + //! \param key The key name to search for. + //! \return \true if the object possess such a key. + + //! \function void JsonObject::add ( const string& key, type_index tid ); + //! \param key The requirement/attribute to add. + //! \param tid The type index of the attribute. + //! + //! Adds a new requirement or attribute to the object. The first character + //! of the key tells which kind it is: + //! - \c '.' : a requirement (not part of the object) that must be present + //! in the stack. + //! - \c '_' : a simple attribute of the object. + //! - \c '+' : belongs to a collection or container. + //! + //! A more detailed description could be found in JsonObject::JsonObject(). + + //! \function void JsonObject::remove ( const string& key ); + //! \param key The key of the requirement/attribute to remove. + //! + //! Removes an attribute from the current object. + + //! \function T JsonObject::get ( JsonStack& stack, const string& key ) const; + //! \param stack The object stack of the parser. + //! \param key The key of the requested object. + //! \return The first object associated with \c key, starting from the top + //! of the stack. + //! + //! Retrieve requirements or attributes from the parser stack. + //! - If no element with a corresponding key is found, an empty element + //! of type \c T is returned (by calling the default \c T constructor). + //! - If an element matching the key is found, \b but it's type do not + //! match \c T, an exception from \c any_cast<> will be thrown. + + //! \function T* JsonObject::jget ( JsonStack& stack ) const; + //! \param stack The parser stack. + //! \Return the first JsonObject that can be cast into type \c T*. + //! + //! Search the JsonObject stack, from the top, the first object that + //! can be cast into type \c T*. Base classes can be used here, as the + //! \c dynamic_cast<> operator is used to perform the casts. + //! + //! This function \b always return a pointer (never a value). + + //! \function void JsonObject::copyAttrs ( const JsonObject* other, bool reset=false ); + //! \param other The object from which to copy attributes. + //! \param reset Whether to keep or erase the original attributes of the object. + //! + //! Copy the attributes from \c other into the current object. \b Only the + //! \b attributes are copied. Neither the requirements, nor the collections. + //! By default, the attributes are added to the existing one of the object, + //! but if \c reset is \true, the original ones will be suppresseds. + + //! \function void JsonObject::clear (); + //! Removes all requirements/attributes/collections of the object. + //! Also unbind it from any generated DataBase object. + + //! \function string JsonObject::getName () const; + //! \Return The name of the whole object as attribute. + //! + //! During the parsing of the JSON structure, excepted when in an array, + //! an object is associated with a key. This is the string returned by + //! this function. It is called \c getName() instead of \c getKey() to + //! avoid confusing with the attributes keys. + + //! \function void JsonObject::setName ( const string& name ); + //! \param name Set the key associated to this object. + //! + //! See JsonObject::getName() for the meaning of the name (key). + + //! \function T& JsonObject::getObject () const; + //! \Return The associated DataBase object. + //! + //! Once all the attributes have been gathered, the creation of the + //! DataBase object is triggered by calling JsonObject::toData(). + //! We keep track of that DataBase object by storing it (or a pointer + //! to it) in an \c boost::any field of the JsonObject. + + //! \function void JsonObject::setObject ( T ); + //! \param T The DataBase object. + //! + //! Associate the constructed DataBase object \c T to the JSON + //! object (for later access). + + //! \function bool JsonObject::isBound () const; + //! \Return \true if a DataBase object is associated to the JSON object + //! (see JsonObject::setObject()). + + //! \function JsonObject* JsonObject::clone ( unsigned long flags ) const; + //! \Return a new \b empty object of the same dynamic type + //! as the source one. + //! + //! This is not a true clone operation in the sense that the datas + //! of the original object are not copied. The cloning is about the + //! type, and is the result of a call to the \c new operator. + //! + //! \Important This method must be overloaded in each concrete derived class. + + //! \function void JsonObject::toData ( JsonStack& stack ); + //! \param The parser object stack. + //! + //! \Important This method must be overloaded in each concrete derived class. + //! + //! Creates the DataBase object. The requirements and attributes + //! must be on top of the stack, they are popped, the DataBase object + //! is created from them and the result is then pushed back. + + //! \function unsigned int JsonObject::presetId ( JsonStack& stack ); + //! \param stack The parser object stack. + //! \Return the next id that has been set. + //! + //! \Remark This is a helper for JsonStack::toData(). + //! + //! In blob mode, the DataBase must be restored as is, + //! including the \c ids of all the Entities (see Entity). + //! This function read from the stack the \c _id attribute + //! and sets it so that the next Entity created will use it. + + //! \function void JsonObject::update ( JsonStack& stack, T hobject ); + //! \param stack parser object stack. + //! \param hobject the newly created DataBase object. + //! + //! \Remark This is a helper for JsonStack::toData(). + //! + //! Pop the attributes from the stack. Push the newly created + //! object and bind it to the JsonObject. + + + //! \addtogroup JsonSupport + //! \{ + + /*! \class JsonStack + * \brief JSON Parser Stack + * + * + * The JSON parser stack contains three separate stacks and a lookup + * table: + * -# The \c attribute stack. Objects that have been translated from + * JSON to the Hurricane database (or POD objects). + * -# The \c dbo stack, similar to the previous one, but contains + * \b only objects whose base class is DBo. + * -# The JsonObject stack. The stack of objects currently under + * parsing. + * -# A lookup table for the Entity, between the Hurricane \c id and + * the JSON \c id. + */ + + //! \} + + + //! \function size_t JsonStack::size () const; + //! \Return The size of the attribute stack. + + //! \function void JsonStack::push_back ( const std::string& key, T hobject ); + //! \param key Key associated to \c hobject + //! \param hobject The \e attribute object. + //! + //! Push back (on top) an element on the \e attribute stack. + + //! \function void JsonStack::pop_back ( size_t count=1 ); + //! \param count The number of element to pop. + //! + //! Remove \c count element(s) from the top of the stack. + + //! \function int JsonStack::rhas ( const string& key ); + //! \param key The key element's to look for. + //! \return the index of the element, from the top. + //! + //! The function name's stands for "Reverse HAS". + //! Search from the top of the \e attribute stack downward an + //! element with \c key. Return an index from the top of the stack, + //! that is, the end of the vector. The returned index is a negative + //! value, for exemple the element on top of the stack has an index + //! of \c -1. If no element with a matching key is found, returns 0. + + //! \function T JsonStack::as ( const std::string& key ) const; + //! \param key The key's element to search. + //! \return The element, casted as type T. + //! + //! Search an element with key matching \c key, from the top of the + //! stack. If found, returns the element casted as type \c T. + //! As the cast operation uses \c boost::any_cast<>, the exact type + //! \c T must be used (\b not a base class of \c T), otherwise the + //! cast will fail and an exception will be thrown. + + //! \function T JsonStack::as ( int index ) const; + //! \param index the position of the element to convert. + //! \return The element, casted as type T. + //! + //! Cast the element at \c index into type T. + //! As the cast operation uses \c boost::any_cast<>, the exact type + //! \c T must be used (\b not a base class of \c T), otherwise the + //! cast will fail and an exception will be thrown. + //! + //! A positive or null index means the element must be taken from the + //! bottom of the stack and a stictly negative one means from the top + //! of the stack. + + //! \function void JsonStack::push_back_dbo ( DBo* dbo ); + //! \param dbo The DataBase object to push back. + //! + //! Dedicated stack to push objects \e after they had been casted + //! into the DBo* base class. We need to create this separate stack + //! from the \e attribute stack due to the inability of \c boost::any_cast<> + //! to use a base class. + + //! \function void JsonStack::pop_back_dbo (); + //! Remove one element from the top of the DBo* stack. + + //! \function DBo* JsonStack::back_dbo () const; + //! \Return The elemet at the top of the DBo* stack. + + //! \function void JsonStack::addEntity ( unsigned int jsonId, Entity* entity ); + //! \param jsonId the \c id of the Entity, in the JSON file + //! \param entity the associated Entity. + //! + //! When parsing a DataBase object \b not in \e blob mode, we cannot + //! restore the ids of the Entities as they are in the file. + //! Thus when an Entity is re-created, it comes with a different id. + //! So we have to keep track of the association between this newbox + //! id (in the Hurricane database) and the one in the JSON file. + //! + //! This function adds such an association. + + //! \function T JsonStack::getEntity ( unsigned int jsonId ) const; + //! \Return The entity, casted as type \c T. + //! + //! Find an Entity with the JSON id \c jsonId and cast it into + //! type \c T. + //! + //! Obviously, this Entity must have been registered with a call + //! to addEntity() before. + + //! \function vector& JsonStack::jobjects (); + //! \Return the stack of JSON objects, for direct manipulation by the involded + //! parties. + + //! \function void JsonStack::print ( std::ostream& o ) const; + //! Dump the contents of the \e attribute stack int the stream \c o. + //! For debugging purposes. + + } diff --git a/hurricane/doc/hurricane/JsonSupport.dox b/hurricane/doc/hurricane/JsonSupport.dox new file mode 100644 index 00000000..a56c837d --- /dev/null +++ b/hurricane/doc/hurricane/JsonSupport.dox @@ -0,0 +1,339 @@ + // -*- C++ -*- + + + namespace Hurricane { + + /*! \defgroup JsonSupport JSON Support + * \brief JSON Import/Export of the DataBase + * + * \section secJsonSupportIntro Introduction + * + * One key feature of the Hurricane DataBase is it's hierarchical + * managment. But unfortunatly the simple approach of saving a design + * Cell by Cell, hierarchical level by hierarchical level makes it + * very difficult to save the trans-hierarchical informations (mainly + * is the occurrences) + * + * One solution is to save the design and all it's levels, down and + * including the standard cells. With all the levels saved, we then + * can add the occurrences and all the attached trans-hierarchical + * informations. We call that comprehensive saving of a design, + * a design blob. + * + * Instead of creating one more ad-hoc format, we just dump the + * DataBase objects in a mirror like way in JSON format. + * + * As it is a textual format, the generated files are larges. + * So the files are compressed through \c gzip. + * + * + * \section secJsonSemantic JSON Additional Semantic + * + * To ease the work of the parser, some semantic has been added + * to the JSON objects representing a Hurricane DataBase. + * -# The first key/value pair must have the key \c "@typename" + * and give the kind of JsonObject associated. The value is + * the string returned by \c JsonObject::getTypeName(). + * -# Attributes keys must start by a \c '_' character. + * (yes, I know, the C++ convention has changed and it should + * be put at the end). + * -# Collections or containers must be put \e after all the + * scalar attributes and their keys must start by a \c '+' + * character. + * +\code{.json} +{ + "@typename": "Cell", + "_id": 3, + "_library": "RootLibrary.AllianceFramework.sxlib", + "_name": "o3_x2", + "_abutmentBox": { + "@typename": "Box", + "_xMin": 0, + "_yMin": 0, + "_xMax": 72000, + "_yMax": 120000 + }, + "+instanceMap": [], + "+netMap": [ + ], +} +\endcode + * + * \section secJsonDriver JSON Driver Support + * + * The driver is implemented through overloads (template and + * non-template) of the \c jsonWriter() function. For the + * template overload to work, even for non-Hurricane classes, + * it is defined outside the Hurricane namespace. + * + * For POD types, four overloads of \c jsonWriter() are defined: + * +\code +void jsonWrite ( JsonWriter* w, const int* v ); +void jsonWrite ( JsonWriter* w, int v ); +void jsonWrite ( JsonWriter* w, const std::string& key, const int* value ) +void jsonWrite ( JsonWriter* w, const std::string& key, int value ) +\endcode + * + * The first two writes the object (here: \c int) "as is" while + * the two later writes a pair key/object. + * + * For other class/object that needs to be writen in the JSON file, + * they must provide a \c toJson() function. It doesn't even need + * to be virtual. For Point: + * +\code +void Point::toJson ( JsonWriter* w ) const +{ + w->startObject(); + jsonWrite( w, "@typename", "Point" ); + jsonWrite( w, "_x", getX() ); + jsonWrite( w, "_y", getY() ); + w->endObject(); +} +\endcode + * + * This function allows three templates of \c jsonWrite() to be + * used with an object of class Point: + * +\code +template +void jsonWrite ( JsonWriter* w, const C* object ); + +template +void jsonWrite ( JsonWriter* w, const std::string& key, C* object ); + +template +void jsonWrite ( JsonWriter* w, const std::string& key, const C* object ); +\endcode + * + * Note that through those three overloads we only provides + * support for pointers to object. The driving mechanism is + * designed in such a way that passing arguments by value is + * not supported for non-POD types. Trying to do so will + * result in an unsupported message inside the generated + * JSON file. + * + * + * \subsection secJsonDriverDBo DBos Special Case + * + * For DBo objects, a complete parallel hierarchy of JsonObjects + * mimicking the one of DBos has been implemented. The \c toJson() + * function is implemented in the DBo base object, and the + * derived classes must implement the following virtual functions: + * +\code +class DBo { + public: + virtual void _toJson ( JsonWriter* ) const; + virtual void _toJsonCollections ( JsonWriter* ) const; + virtual void _toJsonSignature ( JsonWriter* ) const; + void toJson ( JsonWriter* ) const; + void toJsonSignature ( JsonWriter* ) const; +\endcode + * + * The JSON driver functions is splitted in two parts: + * - \c _toJson() must drive the scalar attributes. + * - \c _toJsonCollections() must drive the various collections + * or containers. + * This is to ensure that all the scalars attributes are put + * before the collections, event through inheritance. + * + * The additionnal \c toJsonSignature() method provide the + * signature for an Entity which is used by an occurrence. + * The signature of an occurrence is needed when we create + * a JSON for a Cell only. In that case we cannot directly save + * the transhierarchical informations, so we need a way to + * characterize the deep Entity (which is not part of the + * saved Cell). Most of the time, the signature is the scalar + * attributes of the occurrenced object, it is far from foolproof, + * but it will do for now. + * + * + * \section secJsonParser JSON Parser Support + * + * To enable JSON parsing support for an object, say Point, + * an associated \c JsonPoint class must be created. This + * class must be derived (directly or not) from JsonObject. + * It must implement one static functions and four methods, + * as shown below. + * +\code +class JsonPoint : public JsonObject { + public: + static void initialize (); + JsonPoint (unsigned long flags); + virtual string getTypeName() const; + virtual JsonPoint* clone (unsigned long flags) const; + virtual void toData (JsonStack&); +}; +\endcode + * + * The \c initialize() static function must be present in + * concrete class only. It is used to register the Json + * object into the parser during the static initialization + * of the program. + * +\code +#include "hurricane/Initializer.h" +#include "hurricane/Point.h" + +Initializer jsonPointInit ( 0 ); + +void JsonPoint::initialize () +{ JsonTypes::registerType( new JsonPoint (JsonWriter::RegisterMode) ); } + +\endcode + * + * The constructor has to declare requirements, attributes, + * and collections needed to build the DataBase object. + * Note the the requirements are not part of the objects + * but only needed to build it. + * +\code{.cpp} +JsonPoint::JsonPoint ( unsigned long flags ) + : JsonObject(flags) +{ + add( "_x", typeid(int64_t) ); + add( "_y", typeid(int64_t) ); +} +\endcode + * + * The \c getTypeName() virtual function must return the + * typename used for the \c "@typename" key in the JSON + * file. Most of the time it's the same name as the + * object itself, but not always. + * +\code{.cpp} +string JsonPoint::getTypeName () const +{ return "Point"; } +\endcode + * + * The \c clone() virtual function must return a brand new + * Json object of the same type. The datas of the orignal + * object \b must not be copied. The cloning is about the + * class type, not the contents. + * +\code +JsonPoint* JsonPoint::clone ( unsigned long flags ) const +{ return new JsonPoint ( flags ); } +\endcode + * + * The \c toData() virtual function actually gather the + * attributes to recreate the DataBase object. It needs + * the parser stack to pull the attributes and to push + * the created object. + * +\code{.cpp} +void JsonPoint::toData ( JsonStack& stack ) +{ + check( stack, "JsonPoint::toData" ); + Point point ( DbU::fromDb(get(stack,"_x")) + , DbU::fromDb(get(stack,"_y")) ); + update( stack, point ); +} +\endcode + * + * + * \subsection secJsonArray JSON Array + * + * JSON array are not translated into containers of any kind. + * They are simply ignored (from the stack point of view). + * Objects in array comes from a great variety of containers + * including Hurricane::Collection, in almost all cases, their + * very constructors are responsibles for inserting the object + * in the relevant container/collection. So there is no need + * to build a mechanism to keep track of all the objects in an + * array through a temporary container. + * + * The corollary is that an object in an array must be able to + * extract the relevant context information from the stack. + * Say, if we are in an array of components, they must belong + * to a Net, which must be present in the stack with a key ".Net". + * + * + * \subsection secJsonStack Parser Stack + * + * While performing the parsing, the parser maintain a stack + * (JsonStack) containing: + * - The stack of attributes translateds, but not consumeds + * by the parser and the objects currently openeds (that is, + * which parsing is not completed). This stack contains POD + * or Hurricane objects (value or pointer). + * It is a vector of pair \c (key,value) where the \e key + * is either the attribute name (\c _boundingBox, \c _xMin, + * \c _masterCell, ...) or the class name (\c .Net, \c .Cell, ...). + * - The stack of JSON objects currently openeds, thoses objects + * are all derived classes of JsonObject. + * - A stack of currently opened DBo*. This stack is somewhat + * redundant with the first, but is needed because + * \c boost::any_cast<> is not able to perform dynamic conversions. + * You have to know the exact for the conversion to work. + * Here, everything is DBo*, so the problem do not arises. + * + * + * \subsection secJsonCycle JsonObject Life Cycle + * +\code{.json} +{ # JsonDummy() (1). + "_typename": "Net", # JsonNet() CTOR (2). + "_id": 14622, + "_name": "saccu(0)", + "_isGlobal": false, + "_isExternal": false, + "_isAutomatic": false, + "_type": "LOGICAL", + "_direction": "---- (UNDEFINED)", + "+aliases": [], # JsonNet::toData() (3). + "+componentSet": [ + { + "@typename": "RoutingPad", + "_id": 27410, + "_bodyHook": "Contact::AnchorHook.46566", + "_occurrence": { + "@typename": "Occurrence", + "_path": "14720.14976", + "_entity": 3888 + }, + "+propertySet": [] + }, + { + "@typename": "RoutingPad", + "_id": 27409, + "_bodyHook": "Contact::AnchorHook.46574", + "_occurrence": { + "@typename": "Occurrence", + "_path": "14654.18564", + "_entity": 4529 + }, + "+propertySet": [] + } + } +} # ~JsonNet() DTOR (4). +\endcode + * + * At \c (1) , before \c _typename is encountered, we know that a new + * object is about to be created, but do not know what is type will be. + * So we push on top of the stack a \c JsonDummy. + * + * At \c (2) , the \c _typename allows us to create the right kind of + * JsonObject, which will \e replace the \c JsonDummy on top of the + * stack. + * + * At \c (3) , a first non-POD attribute of JsonNet is encountered. + * This triggers the call to \c JsonObject::toData(), which creates + * the Hurricane object Net, and put it back on the attribute stack + * with the key \c ".Net" (because it is \e not an attribute). + * + * At \c (4) , the Json parser knows that the current JsonObject is + * finished, so it removes JsonNet from the stack and destroy it. + * + * So, if you need to perform specific post-processing that can only + * take place \c after the object and all it's sub-objects has been + * fully parsed, you may do it in the destructor of the JsonObject. + * For example, this technique is used to rebuild the rings of a Net. + */ + + + } // Hurricane namespace. diff --git a/hurricane/doc/hurricane/SoC.css b/hurricane/doc/hurricane/SoC.css index 9f833e18..cbb67dce 100644 --- a/hurricane/doc/hurricane/SoC.css +++ b/hurricane/doc/hurricane/SoC.css @@ -220,6 +220,18 @@ font-size: 110%; } + table.UserDefined { + border: 1px solid; + } + + table.UserDefined th { + border: 1px solid; + } + + table.UserDefined td { + padding: 0px 5px; + } + table.DoxUser td, table.DoxUser th { padding: 0px 5px; border: 0px; diff --git a/hurricane/doc/hurricane/StandardSharedProperty.dox b/hurricane/doc/hurricane/StandardSharedProperty.dox index 69d27df7..c8c9b0f6 100644 --- a/hurricane/doc/hurricane/StandardSharedProperty.dox +++ b/hurricane/doc/hurricane/StandardSharedProperty.dox @@ -13,7 +13,4 @@ * relation between a name and a value. */ - // \} - - } // End of Hurricane namespace. diff --git a/hurricane/doc/hurricane/Transformation.dox b/hurricane/doc/hurricane/Transformation.dox index 0e944a9b..3ff9697b 100644 --- a/hurricane/doc/hurricane/Transformation.dox +++ b/hurricane/doc/hurricane/Transformation.dox @@ -42,50 +42,52 @@ * This enumeration defines the orientation associated to a * transformation object. * - * - * - * - * - * - * - * - * - * - * - * - *
                  Orientation codes and associated transformation matrix
                  Name
                  - *
                  Aspect
                  - *
                  Code
                  - *
                  Signification
                  - *
                  a
                  - *
                  b
                  - *
                  c
                  - *
                  d
                  - *
                  ID
                  \image html transf-ID.png "" - *
                  0
                  Identity - *
                  1
                  0
                  0
                  1
                  - *
                  R1
                  \image html transf-R1.png "" - *
                  1
                  Simple rotation (90°) - *
                  0
                  -1
                  1
                  0
                  - *
                  R2
                  \image html transf-R2.png "" - *
                  2
                  Double rotation (180°) - *
                  -1
                  0
                  0
                  -1
                  - *
                  R3
                  \image html transf-R3.png "" - *
                  3
                  Triple rotation (270°) - *
                  0
                  1
                  -1
                  0
                  - *
                  MX
                  \image html transf-MX.png "" - *
                  4
                  Horizontal symetry (Mirror X) - *
                  -1
                  0
                  0
                  1
                  - *
                  XR
                  \image html transf-XR.png "" - *
                  5
                  Horizontal symetry followed by a 90° rotation - *
                  0
                  -1
                  -1
                  0
                  - *
                  MY
                  \image html transf-MY.png "" - *
                  6
                  Vertical symetry (Mirror Y) - *
                  1
                  0
                  0
                  -1
                  - *
                  YR
                  \image html transf-YR.png "" - *
                  7
                  Vertical symetry followed by a 90° rotation - *
                  0
                  1
                  1
                  0
                  - *
                  + *
                  + * + * + * + * + * + * + * + * + * + * + * + *
                  Orientation codes and associated transformation matrix
                  Name
                  + *
                  Aspect
                  + *
                  Code
                  + *
                  Signification
                  + *
                  a
                  + *
                  b
                  + *
                  c
                  + *
                  d
                  + *
                  ID
                  \image html transf-ID.png "" + *
                  0
                  Identity + *
                  1
                  0
                  0
                  1
                  + *
                  R1
                  \image html transf-R1.png "" + *
                  1
                  Simple rotation (90°) + *
                  0
                  -1
                  1
                  0
                  + *
                  R2
                  \image html transf-R2.png "" + *
                  2
                  Double rotation (180°) + *
                  -1
                  0
                  0
                  -1
                  + *
                  R3
                  \image html transf-R3.png "" + *
                  3
                  Triple rotation (270°) + *
                  0
                  1
                  -1
                  0
                  + *
                  MX
                  \image html transf-MX.png "" + *
                  4
                  Horizontal symetry (Mirror X) + *
                  -1
                  0
                  0
                  1
                  + *
                  XR
                  \image html transf-XR.png "" + *
                  5
                  Horizontal symetry followed by a 90° rotation + *
                  0
                  -1
                  -1
                  0
                  + *
                  MY
                  \image html transf-MY.png "" + *
                  6
                  Vertical symetry (Mirror Y) + *
                  1
                  0
                  0
                  -1
                  + *
                  YR
                  \image html transf-YR.png "" + *
                  7
                  Vertical symetry followed by a 90° rotation + *
                  0
                  1
                  1
                  0
                  + *
                  + *
                  * * The transformation formula is given by: \f[ diff --git a/hurricane/doc/hurricane/UpdateSession.dox b/hurricane/doc/hurricane/UpdateSession.dox index d0352579..6cad7e5f 100644 --- a/hurricane/doc/hurricane/UpdateSession.dox +++ b/hurricane/doc/hurricane/UpdateSession.dox @@ -7,6 +7,43 @@ /*! \class UpdateSession * \brief UpdateSession description (\b API) * + * \section secUpdateSessionMechanism Update Session Mechanism + * + * Here is only an outline of the UpdateSession mechanism. The classes + * involved are: + * - Go (Graphical Objects and their sub-classes). + * - Cell and it's QuadTree(s). Note that the Cell is \e not a Go. + * - UpdateSession. + * + * When a Go is to be displayed, it has to be inserted inside one + * of the QuadTree of it's owner Cell. QuadTree allows fast geometric + * queries which are used extensively to perform the display. + * If a Go is \b not inserted in a QuadTree it will \b not be displayed + * at all or be included in any geometric query. When we insert a Go + * in a QuadTree, we talk about \b materialization. So a Go can be in + * two states: \b materialized or \b unmaterialized. The default behavior + * is to materialize a Go as soon as it is created. + * + * Now comes the UpdateSession mechanism. When the characteristics + * of a Go are changed, it may be needed to update it's position inside + * the QuadTree, or even to change of QuadTree (in case of a Layer change). + * Basically, the mechanism proceed in three stages: + * + * - Start a new UpdateSession (it's a SharedProperty). + * + * - When a Go is changed, the \c invalidate() method is called, that + * \e unmaterialize() it, then adds it to the current UpdateSession. + * This is done by adding the UpdateSession, as a property, to the Go. + * The Go owner (it's Cell) is also notified a \c Cell::Flags::CellAboutToChange. + * + * - On closing the UpdateSession, all the stored Gos are \b materialized + * again. The owner Cell and their instances are then send a + * notification \c Cell::Flags::CellChanged. + * + * It is very important to notice that the Cells gets change notifications + * only when a Go is \e changed, not when it is \e created. If we want the + * Cell to be notified, we must invalidate it manually. This is particularly + * critical when working with ExtensionGo. */ } diff --git a/hurricane/doc/hurricane/doxyfile b/hurricane/doc/hurricane/doxyfile index 61fbbc2b..4e4bfcab 100644 --- a/hurricane/doc/hurricane/doxyfile +++ b/hurricane/doc/hurricane/doxyfile @@ -586,6 +586,14 @@ WARN_LOGFILE = doxygen.warn.log # with spaces. INPUT = Generalities.dox \ + ../../src/hurricane/hurricane/DebugSession.h \ + DebugSession.dox \ + JsonSupport.dox \ + Initializer.dox \ + ../../src/hurricane/hurricane/Initializer.h \ + JsonObject.dox \ + ../../src/hurricane/hurricane/JsonObject.h \ + ../../src/hurricane/hurricane/JsonReader.h \ Hurricane.dox \ ../../src/hurricane/hurricane/Commons.h \ Commons.dox \ diff --git a/hurricane/doc/hurricane/footer.html b/hurricane/doc/hurricane/footer.html index d900c42e..d1f33d69 100644 --- a/hurricane/doc/hurricane/footer.html +++ b/hurricane/doc/hurricane/footer.html @@ -9,7 +9,7 @@ - +
                  Hurricane VLSI DatabaseCopyright © 2000-2015 Bull S.A. All rights reservedCopyright © 2000-2016 Bull S.A. All rights reserved
                  diff --git a/hurricane/doc/viewer/footer.html b/hurricane/doc/viewer/footer.html index d8728dd2..5798a888 100644 --- a/hurricane/doc/viewer/footer.html +++ b/hurricane/doc/viewer/footer.html @@ -9,7 +9,7 @@ - +
                  Hurricane Design ViewerCopyright © 2008-2015 UPMC All rights reservedCopyright © 2008-2016 UPMC All rights reserved
                  diff --git a/hurricane/src/hurricane/Backtrace.cpp b/hurricane/src/hurricane/Backtrace.cpp index c5f508fd..2849cecd 100644 --- a/hurricane/src/hurricane/Backtrace.cpp +++ b/hurricane/src/hurricane/Backtrace.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // diff --git a/hurricane/src/hurricane/BasicLayer.cpp b/hurricane/src/hurricane/BasicLayer.cpp index b4367db1..1bda8e6a 100644 --- a/hurricane/src/hurricane/BasicLayer.cpp +++ b/hurricane/src/hurricane/BasicLayer.cpp @@ -1,7 +1,6 @@ - // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -19,12 +18,7 @@ // License along with Hurricane. If not, see // . // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | H U R R I C A N E | // | V L S I B a c k e n d D a t a - B a s e | // | | @@ -32,15 +26,13 @@ // | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Module : "./BasicLayer.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ -# include "hurricane/BasicLayer.h" -# include "hurricane/Technology.h" -# include "hurricane/Error.h" +#include "hurricane/Error.h" +#include "hurricane/DataBase.h" +#include "hurricane/Technology.h" +#include "hurricane/BasicLayer.h" namespace Hurricane { @@ -272,13 +264,29 @@ namespace Hurricane { { Record* record = Layer::_getRecord(); if (record) { - record->add(getSlot("Material", &_material)); - record->add(getSlot("RealName", &_realName)); + record->add(getSlot("_material" , &_material)); + record->add(getSlot("_realName" , &_realName)); + record->add(getSlot("_blockageLayer", _blockageLayer)); } return record; } + void BasicLayer::_toJson ( JsonWriter* writer ) const + { + Super::_toJson( writer ); + + jsonWrite( writer, "_material" , getString(&_material) ); + jsonWrite( writer, "_extractNumber", _extractNumber ); + jsonWrite( writer, "_realName" , _realName ); + if (_blockageLayer) { + jsonWrite( writer, "_blockageLayer", _blockageLayer->getName() ); + } else { + jsonWrite( writer, "_blockageLayer", "no_blockage_layer" ); + } + } + + // ------------------------------------------------------------------- // Class : "Hurricane::BasicLayer::Material". @@ -300,6 +308,23 @@ namespace Hurricane { } + BasicLayer::Material BasicLayer::Material::fromString ( const string& s ) + { + Code code = other; + if (s == "nWell" ) code = nWell; + else if (s == "pWell" ) code = pWell; + else if (s == "nImplant") code = nImplant; + else if (s == "pImplant") code = pImplant; + else if (s == "active" ) code = active; + else if (s == "poly" ) code = poly; + else if (s == "cut" ) code = cut; + else if (s == "metal" ) code = metal; + else if (s == "blockage") code = blockage; + + return Material(code); + } + + string BasicLayer::Material::_getString () const { return getString(&_code); } @@ -312,4 +337,120 @@ namespace Hurricane { } -} // End of Hurricane namespace. +// ------------------------------------------------------------------- +// Class : "Hurricane::JsonBasicLayer". + + Initializer jsonBasicLayerInit ( 0 ); + + + void JsonBasicLayer::initialize () + { JsonTypes::registerType( new JsonBasicLayer (JsonWriter::RegisterMode) ); } + + + JsonBasicLayer::JsonBasicLayer ( unsigned long flags ) + : JsonLayer(flags) + { + if (flags & JsonWriter::RegisterMode) return; + + cdebug.log(19) << "JsonBasicLayer::JsonBasicLayer()" << endl; + + add( "_material" , typeid(string) ); + add( "_extractNumber", typeid(string) ); + add( "_blockageLayer", typeid(string) ); + add( "_realName" , typeid(string) ); + } + + + JsonBasicLayer::~JsonBasicLayer () + { } + + + string JsonBasicLayer::getTypeName () const + { return "BasicLayer"; } + + + JsonBasicLayer* JsonBasicLayer::clone ( unsigned long flags ) const + { return new JsonBasicLayer ( flags ); } + + + void JsonBasicLayer::toData(JsonStack& stack) + { + cdebug.tabw(19,1); + + check( stack, "JsonBasicLayer::toData" ); + + Technology* techno = lookupTechnology( stack, "JsonBasicLayer::toData" ); + BasicLayer* basicLayer = NULL; + + if (techno) { + string name = get ( stack, "_name" ); + string smask = get ( stack, "_mask" ); + DbU::Unit minimalSize = get( stack, "_minimalSize" ); + DbU::Unit minimalSpacing = get( stack, "_minimalSpacing" ); + bool isWorking = get ( stack, "_working" ); + string materialName = get ( stack, "_material" ); + unsigned int extractNumber = get( stack, "_extractNumber" ); + string blockageLayer = get ( stack, "_blockageLayer" ); + string realName = get ( stack, "_realName" ); + + BasicLayer::Material material = BasicLayer::Material::fromString(materialName); + Layer::Mask mask = Layer::Mask::fromString(smask); + + if (stack.issetFlags(JsonWriter::TechnoMode)) { + // Actual creation. + basicLayer = BasicLayer::create( techno + , name + , material + , extractNumber + , minimalSize + , minimalSpacing + ); + basicLayer->setWorking( isWorking ); + + if (blockageLayer != "no_blockage_layer") { + JsonTechnology* jtechno = jget( stack ); + if (jtechno) { + jtechno->addBlockageRef( blockageLayer, basicLayer ); + } + } + + if (basicLayer->getMask() != mask) { + cerr << Error( "JsonBasicLayer::toData(): Layer mask re-creation discrepency on \"%s\":\n" + " Blob: %s\n" + " DataBase: %s" + , name.c_str() + , getString(mask).c_str() + , getString(basicLayer->getMask()).c_str() + ) << endl; + } + // Add here association with blockage layer... + } else { + // Check coherency with existing layer. + basicLayer = dynamic_cast( techno->getLayer(name) ); + if (basicLayer) { + if (basicLayer->getMask() != mask) { + cerr << Error( "JsonBasicLayer::toData(): Layer mask discrepency on \"%s\":\n" + " Blob: %s\n" + " DataBase: %s" + , name.c_str() + , getString(mask).c_str() + , getString(basicLayer->getMask()).c_str() + ) << endl; + } + } else { + cerr << Error( "JsonBasicLayer::toData(): No BasicLayer \"%s\" in the existing technology." + , name.c_str() + ) << endl; + } + } + } else { + cerr << Error( "JsonBasicLayer::toData(): Cannot find technology, aborting BasicLayer creation." ) << endl; + } + + update( stack, basicLayer ); + + cdebug.tabw(19,-1); + } + + +} // Hurricane namespace. diff --git a/hurricane/src/hurricane/Box.cpp b/hurricane/src/hurricane/Box.cpp index 5cb0e291..4968efec 100644 --- a/hurricane/src/hurricane/Box.cpp +++ b/hurricane/src/hurricane/Box.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./Box.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -17,8 +17,8 @@ // not, see . // **************************************************************************************************** -#include "hurricane/Error.h" #include "hurricane/Box.h" +#include "hurricane/Error.h" namespace Hurricane { @@ -318,7 +318,7 @@ Box& Box::merge(const Box& box) } Box& Box::translate(const DbU::Unit& dx, const DbU::Unit& dy) -// ************************************************ +// ********************************************************** { if (!isEmpty()) { _xMin += dx; @@ -353,10 +353,69 @@ Record* Box::_getRecord() const return record; } +void Box::toJson(JsonWriter* w) const +// *********************************** +{ + w->startObject(); + jsonWrite( w, "@typename", "Box" ); + jsonWrite( w, "_xMin", getXMin() ); + jsonWrite( w, "_yMin", getYMin() ); + jsonWrite( w, "_xMax", getXMax() ); + jsonWrite( w, "_yMax", getYMax() ); + w->endObject(); +} + + +Initializer jsonBoxInit ( 0 ); + +void JsonBox::initialize() +// ************************** +{ JsonTypes::registerType( new JsonBox (JsonWriter::RegisterMode) ); } + +JsonBox::JsonBox(unsigned long flags) +// ********************************** + : JsonObject(flags) +{ + add( "_xMin", typeid(int64_t) ); + add( "_yMin", typeid(int64_t) ); + add( "_xMax", typeid(int64_t) ); + add( "_yMax", typeid(int64_t) ); +} + +string JsonBox::getTypeName() const +// ********************************* +{ return "Box"; } + +JsonBox* JsonBox::clone(unsigned long flags) const +// *********************************************** +{ return new JsonBox ( flags ); } + +void JsonBox::toData(JsonStack& stack) +// *********************************** +{ + check( stack, "JsonBox::toData" ); + + DbU::Unit xMin = DbU::fromDb(get(stack,"_xMin")); + DbU::Unit yMin = DbU::fromDb(get(stack,"_yMin")); + DbU::Unit xMax = DbU::fromDb(get(stack,"_xMax")); + DbU::Unit yMax = DbU::fromDb(get(stack,"_yMax")); + + Box box; + + if ( (xMin <= xMax) and (yMin <= yMax) ) + box.merge( xMin, yMin, xMax, yMax ); + + cdebug.log(19) << "Box(" << xMin << ", " + << yMin << ", " + << xMax << ", " + << yMax << ")" << endl; + + update( stack, box ); +} } // End of Hurricane namespace. // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/Breakpoint.cpp b/hurricane/src/hurricane/Breakpoint.cpp index 7a8848df..9f9d5528 100644 --- a/hurricane/src/hurricane/Breakpoint.cpp +++ b/hurricane/src/hurricane/Breakpoint.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // diff --git a/hurricane/src/hurricane/Bug.cpp b/hurricane/src/hurricane/Bug.cpp index 24b39deb..471c2639 100644 --- a/hurricane/src/hurricane/Bug.cpp +++ b/hurricane/src/hurricane/Bug.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // diff --git a/hurricane/src/hurricane/CMakeLists.txt b/hurricane/src/hurricane/CMakeLists.txt index abb9a7c2..e66a1acc 100644 --- a/hurricane/src/hurricane/CMakeLists.txt +++ b/hurricane/src/hurricane/CMakeLists.txt @@ -1,11 +1,20 @@ include_directories ( ${HURRICANE_SOURCE_DIR}/src/hurricane + ${CONFIGURATION_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} + ${BZIP2_INCLUDE_DIR} ) set ( includes hurricane/Mask.h hurricane/Flags.h + hurricane/Initializer.h hurricane/DebugSession.h hurricane/Backtrace.h + hurricane/FileReadGzStream.h + hurricane/FileWriteGzStream.h + hurricane/JsonWriter.h + hurricane/JsonObject.h + hurricane/JsonReader.h + hurricane/Signature.h hurricane/Observer.h hurricane/BasicLayer.h hurricane/BasicLayers.h hurricane/RegularLayer.h hurricane/RegularLayers.h @@ -93,9 +102,16 @@ ) set ( cpps Record.cpp Slot.cpp + Initializer.cpp Commons.cpp Flags.cpp Backtrace.cpp + FileReadGzStream.cpp + FileWriteGzStream.cpp + JsonWriter.cpp + JsonObject.cpp + JsonReader.cpp + Signature.cpp Exception.cpp Bug.cpp Error.cpp @@ -167,7 +183,7 @@ ) add_library ( hurricane ${cpps} ) - target_link_libraries ( hurricane ${Boost_LIBRARIES} ) + target_link_libraries ( hurricane ${Boost_LIBRARIES} ${BZIP2_LIBRARIES} ) set_target_properties ( hurricane PROPERTIES VERSION 1.0 SOVERSION 1 ) install ( TARGETS hurricane DESTINATION lib${LIB_SUFFIX} ) install ( FILES ${includes} DESTINATION include/coriolis2/hurricane ) diff --git a/hurricane/src/hurricane/Cell.cpp b/hurricane/src/hurricane/Cell.cpp index 81bb29b4..8b1bb527 100644 --- a/hurricane/src/hurricane/Cell.cpp +++ b/hurricane/src/hurricane/Cell.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./Cell.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -21,13 +21,17 @@ #include "hurricane/Warning.h" #include "hurricane/SharedName.h" -#include "hurricane/Cell.h" #include "hurricane/DataBase.h" +#include "hurricane/Cell.h" #include "hurricane/Library.h" #include "hurricane/Instance.h" #include "hurricane/Net.h" #include "hurricane/Pin.h" #include "hurricane/RoutingPad.h" +#include "hurricane/Horizontal.h" +#include "hurricane/Vertical.h" +#include "hurricane/Contact.h" +#include "hurricane/Pad.h" #include "hurricane/Layer.h" #include "hurricane/Slice.h" #include "hurricane/Rubber.h" @@ -35,10 +39,15 @@ #include "hurricane/Component.h" #include "hurricane/UpdateSession.h" #include "hurricane/Error.h" +#include "hurricane/JsonReader.h" namespace Hurricane { +// **************************************************************************************************** +// UniquifyRelation implementation +// **************************************************************************************************** + const Name Cell::UniquifyRelation::_name = "Cell::UniquifyRelation"; @@ -95,6 +104,18 @@ namespace Hurricane { } + string Cell::UniquifyRelation::getTrunkName ( Name name ) + { + string trunk = getString(name); + size_t suffix = trunk.rfind( "_u" ); + + if (suffix != string::npos) + trunk = trunk.substr( 0, suffix ); + + return trunk; + } + + Record* Cell::UniquifyRelation::_getRecord () const { Record* record = Relation::_getRecord(); @@ -105,6 +126,357 @@ namespace Hurricane { } + bool Cell::UniquifyRelation::hasJson () const + { return true; } + + + void Cell::UniquifyRelation::toJson ( JsonWriter* w, const DBo* owner ) const + { + w->startObject(); + std::string tname = getString( staticGetName() ); + if (getMasterOwner() == owner) { + jsonWrite( w, "@typename" , tname ); + jsonWrite( w, "_refcount" , getOwners().getSize() ); + jsonWrite( w, "_duplicates", _duplicates ); + } else { + tname.insert( 0, "&" ); + jsonWrite( w, "@typename", tname ); + + Cell* masterOwner = dynamic_cast( getMasterOwner() ); + if (masterOwner) { + jsonWrite( w, "_masterOwner", masterOwner->getHierarchicalName() ); + } else { + cerr << Error( "UniquifyRelation::toJson(): Master owner is not a Cell (%s)." + , getString(owner).c_str() + ) << endl; + jsonWrite( w, "_masterOwner", "" ); + } + } + w->endObject(); + } + + +// **************************************************************************************************** +// UniquifyRelation::JsonProperty implementation +// **************************************************************************************************** + + + Initializer jsonUniquifyRelationInit ( 10 ); + + + Cell::UniquifyRelation::JsonProperty::JsonProperty ( unsigned long flags ) + : JsonObject(flags) + { + add( "_refcount" , typeid(int64_t) ); + add( "_duplicates", typeid(int64_t) ); + } + + + string Cell::UniquifyRelation::JsonProperty::getTypeName () const + { return getString(Cell::UniquifyRelation::staticGetName()); } + + + void Cell::UniquifyRelation::JsonProperty::initialize () + { JsonTypes::registerType( new Cell::UniquifyRelation::JsonProperty (JsonWriter::RegisterMode) ); } + + + Cell::UniquifyRelation::JsonProperty* Cell::UniquifyRelation::JsonProperty::clone ( unsigned long flags ) const + { return new Cell::UniquifyRelation::JsonProperty ( flags ); } + + + void Cell::UniquifyRelation::JsonProperty::toData ( JsonStack& stack ) + { + check( stack, "Cell::UniquifyRelation::JsonProperty::toData" ); + + DBo* dbo = stack.back_dbo(); + unsigned int refcount = get( stack, "_refcount" ); + unsigned int duplicates = get( stack, "_duplicates" ); + UniquifyRelation* relation = NULL; + Cell* cell = dynamic_cast( dbo ); + + cdebug.log(19) << "topDBo:" << dbo << endl; + + if (cell) { + relation = UniquifyRelation::get( cell ); + if (not relation) { + string tag = cell->getHierarchicalName()+"::"+getString(UniquifyRelation::staticGetName()); + relation = dynamic_cast( SharedProperty::getOrphaned( tag ) ); + + if (not relation) { + relation = Cell::UniquifyRelation::create( cell ); + SharedProperty::addOrphaned( tag, relation ); + } + SharedProperty::refOrphaned( tag ); + SharedProperty::countOrphaned( tag, refcount ); + cell->put( relation ); + } + relation->_setMasterOwner( cell ); + relation->_setDuplicates ( duplicates ); + } + + update( stack, relation ); + } + + +// **************************************************************************************************** +// UniquifyRelation::JsonPropertyRef implementation +// **************************************************************************************************** + + + Initializer jsonUniquifyRelationRefInit ( 10 ); + + + Cell::UniquifyRelation::JsonPropertyRef::JsonPropertyRef ( unsigned long flags ) + : JsonObject(flags) + { + add( "_masterOwner", typeid(string) ); + } + + + string Cell::UniquifyRelation::JsonPropertyRef::getTypeName () const + { return string("&")+getString(Cell::UniquifyRelation::staticGetName()); } + + + void Cell::UniquifyRelation::JsonPropertyRef::initialize () + { JsonTypes::registerType( new Cell::UniquifyRelation::JsonPropertyRef (JsonWriter::RegisterMode) ); } + + + Cell::UniquifyRelation::JsonPropertyRef* Cell::UniquifyRelation::JsonPropertyRef::clone ( unsigned long flags ) const + { return new Cell::UniquifyRelation::JsonPropertyRef ( flags ); } + + + void Cell::UniquifyRelation::JsonPropertyRef::toData ( JsonStack& stack ) + { + check( stack, "Cell::UniquifyRelation::JsonPropertyRef::toData" ); + + DBo* dbo = stack.back_dbo(); + string masterName = get( stack, "_masterOwner" ); + UniquifyRelation* relation = NULL; + Cell* cell = dynamic_cast( dbo ); + string tag = masterName+"::"+getString(UniquifyRelation::staticGetName()); + + if (cell) { + if (not relation) { + relation = dynamic_cast( SharedProperty::getOrphaned( tag ) ); + if (not relation) { + relation = Cell::UniquifyRelation::create( cell ); + SharedProperty::addOrphaned( tag, relation ); + } + } + + if (relation) { + cell->put( relation ); + SharedProperty::refOrphaned( tag ); + } + } + + update( stack, relation ); + } + + +// **************************************************************************************************** +// SlavedsRelation implementation +// **************************************************************************************************** + + const Name Cell::SlavedsRelation::_name = "Cell::SlavedsRelation"; + + + Cell::SlavedsRelation::SlavedsRelation ( Cell* masterOwner ) + : Relation (masterOwner) + { } + + + Cell::SlavedsRelation* Cell::SlavedsRelation::create ( Cell* masterOwner ) + { + SlavedsRelation* relation = new SlavedsRelation(masterOwner); + + relation->_postCreate(); + + return relation; + } + + + void Cell::SlavedsRelation::_preDestroy () + { + Relation::_preDestroy(); + } + + + Cell::SlavedsRelation* Cell::SlavedsRelation::get ( const Cell* cell ) + { + if (not cell) + throw Error( "Can't get Cell::SlavedsRelation : empty cell" ); + Property* property = cell->getProperty( staticGetName() ); + if (property) { + SlavedsRelation* relation = dynamic_cast(property); + if (not relation ) + throw Error ( "Bad Property type: Must be a SlavedsRelation" ); + return relation; + } + return NULL; + } + + + Name Cell::SlavedsRelation::staticGetName () { return _name; } + Name Cell::SlavedsRelation::getName () const { return _name; } + string Cell::SlavedsRelation::_getTypeName () const { return "Cell::SlavedsRelation"; } + + + Record* Cell::SlavedsRelation::_getRecord () const + { + Record* record = Relation::_getRecord(); + return record; + } + + + bool Cell::SlavedsRelation::hasJson () const + { return true; } + + + void Cell::SlavedsRelation::toJson ( JsonWriter* w, const DBo* owner ) const + { + w->startObject(); + std::string tname = getString( staticGetName() ); + if (getMasterOwner() == owner) { + jsonWrite( w, "@typename" , tname ); + jsonWrite( w, "_refcount" , getOwners().getSize() ); + } else { + tname.insert( 0, "&" ); + jsonWrite( w, "@typename", tname ); + + Cell* masterOwner = dynamic_cast( getMasterOwner() ); + if (masterOwner) { + jsonWrite( w, "_masterOwner", masterOwner->getHierarchicalName() ); + } else { + cerr << Error( "SlavedsRelation::toJson(): Master owner is not a Cell (%s)." + , getString(owner).c_str() + ) << endl; + jsonWrite( w, "_masterOwner", "" ); + } + } + w->endObject(); + } + + +// **************************************************************************************************** +// SlavedsRelation::JsonProperty implementation +// **************************************************************************************************** + + + Initializer jsonSlavedsRelationInit ( 10 ); + + + Cell::SlavedsRelation::JsonProperty::JsonProperty ( unsigned long flags ) + : JsonObject(flags) + { + add( "_refcount" , typeid(int64_t) ); + } + + + string Cell::SlavedsRelation::JsonProperty::getTypeName () const + { return getString(Cell::SlavedsRelation::staticGetName()); } + + + void Cell::SlavedsRelation::JsonProperty::initialize () + { JsonTypes::registerType( new Cell::SlavedsRelation::JsonProperty (JsonWriter::RegisterMode) ); } + + + Cell::SlavedsRelation::JsonProperty* Cell::SlavedsRelation::JsonProperty::clone ( unsigned long flags ) const + { return new Cell::SlavedsRelation::JsonProperty ( flags ); } + + + void Cell::SlavedsRelation::JsonProperty::toData ( JsonStack& stack ) + { + check( stack, "Cell::SlavedsRelation::JsonProperty::toData" ); + + DBo* dbo = stack.back_dbo(); + unsigned int refcount = get( stack, "_refcount" ); + SlavedsRelation* relation = NULL; + Cell* cell = dynamic_cast( dbo ); + + cdebug.log(19) << "topDBo:" << dbo << endl; + + if (cell) { + relation = SlavedsRelation::get( cell ); + if (not relation) { + string tag = cell->getHierarchicalName()+"::"+getString(SlavedsRelation::staticGetName()); + relation = dynamic_cast( SharedProperty::getOrphaned( tag ) ); + + if (not relation) { + relation = Cell::SlavedsRelation::create( cell ); + SharedProperty::addOrphaned( tag, relation ); + } + SharedProperty::refOrphaned( tag ); + SharedProperty::countOrphaned( tag, refcount ); + cell->put( relation ); + } + relation->_setMasterOwner( cell ); + } + + update( stack, relation ); + } + + +// **************************************************************************************************** +// SlavedsRelation::JsonPropertyRef implementation +// **************************************************************************************************** + + + Initializer jsonSlavedsRelationRefInit ( 10 ); + + + Cell::SlavedsRelation::JsonPropertyRef::JsonPropertyRef ( unsigned long flags ) + : JsonObject(flags) + { + add( "_masterOwner", typeid(string) ); + } + + + string Cell::SlavedsRelation::JsonPropertyRef::getTypeName () const + { return string("&")+getString(Cell::SlavedsRelation::staticGetName()); } + + + void Cell::SlavedsRelation::JsonPropertyRef::initialize () + { JsonTypes::registerType( new Cell::SlavedsRelation::JsonPropertyRef (JsonWriter::RegisterMode) ); } + + + Cell::SlavedsRelation::JsonPropertyRef* Cell::SlavedsRelation::JsonPropertyRef::clone ( unsigned long flags ) const + { return new Cell::SlavedsRelation::JsonPropertyRef ( flags ); } + + + void Cell::SlavedsRelation::JsonPropertyRef::toData ( JsonStack& stack ) + { + check( stack, "Cell::SlavedsRelation::JsonPropertyRef::toData" ); + + DBo* dbo = stack.back_dbo(); + string masterName = get( stack, "_masterOwner" ); + SlavedsRelation* relation = NULL; + Cell* cell = dynamic_cast( dbo ); + string tag = masterName+"::"+getString(SlavedsRelation::staticGetName()); + + if (cell) { + if (not relation) { + relation = dynamic_cast( SharedProperty::getOrphaned( tag ) ); + if (not relation) { + relation = Cell::SlavedsRelation::create( cell ); + SharedProperty::addOrphaned( tag, relation ); + } + } + + if (relation) { + cell->put( relation ); + SharedProperty::refOrphaned( tag ); + } + } + + update( stack, relation ); + } + + +// **************************************************************************************************** +// Cell Slice related implementation +// **************************************************************************************************** + void Cell::_insertSlice ( ExtensionSlice* slice ) { ExtensionSliceMap::iterator islice = _extensionSlices.find ( slice->getName() ); @@ -173,14 +545,14 @@ Cell::Cell(Library* library, const Name& name) _observers(), _flags(Flags::Terminal) { - if (!_library) - throw Error("Can't create " + _TName("Cell") + " : null library"); + if (!_library) + throw Error("Can't create " + _TName("Cell") + " : null library"); - if (name.isEmpty()) - throw Error("Can't create " + _TName("Cell") + " : empty name"); + if (name.isEmpty()) + throw Error("Can't create " + _TName("Cell") + " : empty name"); - if (_library->getCell(_name)) - throw Error("Can't create " + _TName("Cell") + " " + getString(_name) + " : already exists"); + if (_library->getCell(_name)) + throw Error("Can't create " + _TName("Cell") + " " + getString(_name) + " : already exists"); } Cell* Cell::create(Library* library, const Name& name) @@ -193,6 +565,22 @@ Cell* Cell::create(Library* library, const Name& name) return cell; } +Cell* Cell::fromJson(const string& filename) +// ***************************************** +{ + UpdateSession::open(); + + JsonReader reader ( JsonWriter::CellMode ); + reader.parse( filename ); + + UpdateSession::close(); + + const JsonStack& stack = reader.getStack(); + if (stack.rhas(".Cell")) return stack.as(".Cell"); + + return NULL; +} + Box Cell::getBoundingBox() const // ***************************** { @@ -237,6 +625,10 @@ bool Cell::isNetAlias ( const Name& name ) const bool Cell::isUnique() const // ************************ { + // ltrace(10) << "Cell::isUnique() " << this << endl; + // for ( Instance* instance : getSlaveInstances() ) { + // ltrace(10) << "| Slave instance:" << instance << endl; + // } return getSlaveInstances().getSize() < 2; } @@ -254,6 +646,91 @@ bool Cell::isUniquifyMaster() const return (not relation) or (relation->getMasterOwner() == this); } +string Cell::getHierarchicalName () const +// ************************************** +{ + return getLibrary()->getHierarchicalName() + "." + getString(getName()); +} + +Entity* Cell::getEntity(const Signature& signature) const +// ****************************************************** +{ + if ( (signature.getType() == Signature::TypeContact ) + or (signature.getType() == Signature::TypeHorizontal) + or (signature.getType() == Signature::TypeVertical ) + or (signature.getType() == Signature::TypePad ) ) { + Net* net = getNet( signature.getName() ); + if (not net) { + cerr << Error( "Cell::getEntity(): Cell %s do have Net %s, signature incoherency." + , getString(getName()).c_str() + , signature.getName().c_str() ) << endl; + return NULL; + } + + cdebug.log(18) << "Cell::getEntity(): <" << getName() << ">, Net:<" << net->getName() << ">" << endl; + + if (signature.getType() == Signature::TypeContact) { + cdebug.log(18) << "Looking in Contacts..." << endl; + for ( Contact* component : getComponents().getSubSet() ) { + cdebug.log(18) << "| " << component << endl; + if ( (component->getLayer () == signature.getLayer()) + and (component->getDx () == signature.getDim(Signature::ContactDx)) + and (component->getDy () == signature.getDim(Signature::ContactDy)) + and (component->getWidth () == signature.getDim(Signature::ContactWidth)) + and (component->getHeight() == signature.getDim(Signature::ContactHeight)) ) + return component; + } + } + + if (signature.getType() == Signature::TypeVertical) { + cdebug.log(18) << "Looking in Verticals..." << endl; + for ( Vertical* component : getComponents().getSubSet() ) { + cdebug.log(18) << "| " << component << endl; + if ( (component->getLayer () == signature.getLayer()) + and (component->getWidth () == signature.getDim(Signature::VerticalWidth)) + and (component->getX () == signature.getDim(Signature::VerticalX)) + and (component->getDySource() == signature.getDim(Signature::VerticalDySource)) + and (component->getDyTarget() == signature.getDim(Signature::VerticalDyTarget)) ) + return component; + } + } + + if (signature.getType() == Signature::TypeHorizontal) { + cdebug.log(18) << "Looking in Horizontals..." << endl; + for ( Horizontal* component : getComponents().getSubSet() ) { + cdebug.log(18) << "| " << component << endl; + if ( (component->getLayer () == signature.getLayer()) + and (component->getWidth () == signature.getDim(Signature::HorizontalWidth)) + and (component->getY () == signature.getDim(Signature::HorizontalY)) + and (component->getDxSource() == signature.getDim(Signature::HorizontalDxSource)) + and (component->getDxTarget() == signature.getDim(Signature::HorizontalDxTarget)) ) + return component; + } + } + + if (signature.getType() == Signature::TypePad) { + cdebug.log(18) << "Looking in Pads..." << endl; + for ( Pad* component : getComponents().getSubSet() ) { + cdebug.log(18) << "| " << component << endl; + if ( (component->getLayer() == signature.getLayer()) + and (component->getBoundingBox().getXMin() == signature.getDim(Signature::PadXMin)) + and (component->getBoundingBox().getYMin() == signature.getDim(Signature::PadYMin)) + and (component->getBoundingBox().getXMax() == signature.getDim(Signature::PadXMax)) + and (component->getBoundingBox().getYMax() == signature.getDim(Signature::PadYMax)) ) + return component; + } + } + + cerr << Error( "Cell::getEntity(): Cannot find a Component of type %d matching Signature." + , signature.getType() ) << endl; + } else { + cerr << Error( "Cell::getEntity(): Signature type %d is unsupported yet." + , signature.getType() ) << endl; + } + + return NULL; +} + Net* Cell::getNet ( const Name& name ) const //****************************************** { @@ -286,7 +763,26 @@ void Cell::setName(const Name& name) } void Cell::setAbutmentBox(const Box& abutmentBox) -// ********************************************** +// *********************************************** +{ + SlavedsRelation* slaveds = SlavedsRelation::get( this ); + if (not slaveds or (this == slaveds->getMasterOwner())) { + _setAbutmentBox( abutmentBox ); + + if (getFlags().isset(Flags::SlavedAb)) return; + + for ( Cell* slavedCell : SlavedsSet(this) ) + slavedCell->_setAbutmentBox( abutmentBox ); + } else { + cerr << Error( "Cell::setAbutmentBox(): Abutment box of \"%s\" is slaved to \"%s\"." + , getString(getName()).c_str() + , getString(static_cast(slaveds->getMasterOwner())->getName()).c_str() + ) << endl; + } +} + +void Cell::_setAbutmentBox(const Box& abutmentBox) +// *********************************************** { if (abutmentBox != _abutmentBox) { if (not _abutmentBox.isEmpty() and @@ -295,12 +791,6 @@ void Cell::setAbutmentBox(const Box& abutmentBox) _abutmentBox = abutmentBox; _fit( _abutmentBox ); } - - for ( Instance* instance : getInstances() ) { - Cell* masterCell = instance->getMasterCell(); - if (masterCell->getFlags().isset(Flags::MergedQuadTree)) - masterCell->setAbutmentBox( abutmentBox ); - } } @@ -327,10 +817,12 @@ DeepNet* Cell::getDeepNet ( Path path, const Net* leafNet ) const void Cell::flattenNets(unsigned int flags) // *************************************** { - trace << "Cell::flattenNets() flags:0x" << hex << flags << endl; + cdebug.log(18) << "Cell::flattenNets() flags:0x" << hex << flags << endl; UpdateSession::open(); + bool reFlatten = _flags.isset(Flags::FlattenedNets); + _flags |= Flags::FlattenedNets; vector hyperNets; @@ -347,24 +839,29 @@ void Cell::flattenNets(unsigned int flags) if (not duplicate) { hyperNets.push_back( HyperNet(occurrence) ); } else { - trace << "Found " << duplicate << " in " << duplicate->getCell() << endl; + if (not reFlatten) + cerr << Warning( "Cell::flattenNets(): In \"%s\", found duplicate: %s for %s." + , getString(duplicate->getCell()->getName()).c_str() + , getString(duplicate).c_str() + , getString(net).c_str() + ) << endl; } - } else { - bool hasRoutingPads = false; - for ( Component* component : net->getComponents() ) { - RoutingPad* rp = dynamic_cast( component ); - if (rp) { - // At least one RoutingPad is present: assumes that the net is already - // flattened (completly). - //cerr << net << " has already RoutingPads, skipped " << rp << endl; - hasRoutingPads = true; - break; - } - } - if (hasRoutingPads) continue; - - topHyperNets.push_back( HyperNet(occurrence) ); + continue; } + + bool hasRoutingPads = false; + for ( Component* component : net->getComponents() ) { + RoutingPad* rp = dynamic_cast( component ); + if (rp) { + // At least one RoutingPad is present: assumes that the net is already + // flattened (completly). + hasRoutingPads = true; + break; + } + } + if (hasRoutingPads) continue; + + topHyperNets.push_back( HyperNet(occurrence) ); } for ( size_t i=0 ; igetComponents() ) { + if (dynamic_cast(component)) { buildRing = false; break; } + Plug* primaryPlug = dynamic_cast( component ); if (primaryPlug) { if (not primaryPlug->getBodyHook()->getSlaveHooks().isEmpty()) { @@ -426,6 +924,7 @@ void Cell::createRoutingPadRings(unsigned int flags) } } } + if (not buildRing) continue; for ( RoutingPad* rp : net->getRoutingPads() ) { if ( previousRp @@ -447,7 +946,6 @@ Cell* Cell::getCloneMaster() const UniquifyRelation* uniquify = UniquifyRelation::get( this ); if (not uniquify) return const_cast(this); - uniquify = UniquifyRelation::get( this ); return dynamic_cast( uniquify->getMasterOwner() ); } @@ -505,13 +1003,23 @@ Cell* Cell::getClone() void Cell::uniquify(unsigned int depth) // ************************************ { -//cerr << "Cell::uniquify() " << this << endl; + cdebug.log(18,1) << "Cell::uniquify() " << this << endl; + + vector deepNets; + for ( DeepNet* deepNet : getNets().getSubSet() ) { + deepNets.push_back( deepNet ); + } + while ( not deepNets.empty() ) { + deepNets.back()->destroy(); + deepNets.pop_back(); + } vector toUniquify; set masterCells; for ( Instance* instance : getInstances() ) { Cell* masterCell = instance->getMasterCell(); + cdebug.log(18) << "| " << instance << endl; if (masterCell->isTerminal()) continue; if (masterCells.find(masterCell) == masterCells.end()) { @@ -533,6 +1041,9 @@ void Cell::uniquify(unsigned int depth) for ( auto cell : masterCells ) cell->uniquify( depth-1 ); } + + cdebug.tabw(18,-1); + cdebug.log(18) << "Cell::uniquify() END " << this << endl; } void Cell::materialize() @@ -566,7 +1077,7 @@ void Cell::unmaterialize() void Cell::slaveAbutmentBox ( Cell* topCell ) // ****************************************** { - if (_flags.isset(Flags::MergedQuadTree)) { + if (_flags.isset(Flags::SlavedAb)) { cerr << Error( "Cell::slaveAbutmentBox(): %s is already slaved, action cancelled." , getString(this).c_str() ) << endl; return; @@ -609,15 +1120,16 @@ void Cell::_slaveAbutmentBox ( Cell* topCell ) } } - setAbutmentBox( topCell->getAbutmentBox() ); + _setAbutmentBox( topCell->getAbutmentBox() ); - _changeQuadTree( topCell ); - - for ( Instance* instance : getInstances() ) { - Cell* masterCell = instance->getMasterCell(); - if (masterCell->getFlags().isset(Flags::MergedQuadTree)) - masterCell->_slaveAbutmentBox( topCell ); + SlavedsRelation* slaveds = SlavedsRelation::get( topCell ); + if (not slaveds) { + slaveds = SlavedsRelation::create( topCell ); } + put( slaveds ); + _flags.set( Flags::SlavedAb ); + +//_changeQuadTree( topCell ); } @@ -656,19 +1168,24 @@ void Cell::_postCreate() void Cell::_preDestroy() // ******************** { + notify( Flags::CellDestroyed ); + while ( _slaveEntityMap.size() ) { _slaveEntityMap.begin()->second->destroy(); } -//for ( View* view : getViews() ) view->setCell( NULL ); - for ( Marker* marker : getMarkers() ) marker->destroy(); - for ( Instance* slaveInstance : getSlaveInstances() ) slaveInstance->destroy(); - for ( Instance* instance : getInstances() ) instance->destroy(); - for ( Net* net : getNets() ) { + Markers markers = getMarkers (); while ( markers .getFirst() ) markers .getFirst()->destroy(); + Instances instances = getSlaveInstances(); while ( instances.getFirst() ) instances.getFirst()->destroy(); + instances = getInstances (); while ( instances.getFirst() ) instances.getFirst()->destroy(); + + Nets nets = getNets(); + while ( nets.getFirst() ) { + Net* net = nets.getFirst(); net->_getMainName().detachAll(); net->destroy(); } - for ( auto islave : _netAliasSet ) delete islave; + for ( auto islave : _netAliasSet ) delete islave; + for ( Slice* slice : getSlices() ) slice->_destroy(); while ( not _extensionSlices.empty() ) _removeSlice( _extensionSlices.begin()->second ); @@ -793,6 +1310,25 @@ void Cell::notify(unsigned flags) _observers.notify(flags); } +void Cell::_toJson(JsonWriter* writer) const +// ***************************************** +{ + Inherit::_toJson( writer ); + + jsonWrite( writer, "_library" , getLibrary()->getHierarchicalName() ); + jsonWrite( writer, "_name" , getName() ); + jsonWrite( writer, "_abutmentBox", &_abutmentBox ); +} + +void Cell::_toJsonCollections(JsonWriter* writer) const +// ***************************************** +{ + writer->setFlags( JsonWriter::CellObject ); + jsonWrite( writer, "+instanceMap", getInstances() ); + jsonWrite( writer, "+netMap" , getNets() ); + Inherit::_toJsonCollections( writer ); + writer->resetFlags( JsonWriter::CellObject ); +} // **************************************************************************************************** // Cell::Flags implementation @@ -816,29 +1352,14 @@ void Cell::notify(unsigned flags) if (not _flags) return ""; string s = "<"; - if (_flags & Pad) { - s += "Pad"; - } - if (_flags & Terminal) { - if (s.size() > 1) s += "|"; - s += "Terminal"; - } - if (_flags & FlattenLeaf) { - if (s.size() > 1) s += "|"; - s += "FlattenLeaf"; - } - if (_flags & FlattenedNets) { - if (s.size() > 1) s += "|"; - s += "FlattenedNets"; - } - if (_flags & Placed) { - if (s.size() > 1) s += "|"; - s += "Placed"; - } - if (_flags & Routed) { - if (s.size() > 1) s += "|"; - s += "Routed"; - } + if (_flags & Pad ) { s += "Pad"; } + if (_flags & Terminal ) { if (s.size() > 1) s += "|"; s += "Terminal"; } + if (_flags & FlattenLeaf ) { if (s.size() > 1) s += "|"; s += "FlattenLeaf"; } + if (_flags & FlattenedNets) { if (s.size() > 1) s += "|"; s += "FlattenedNets"; } + if (_flags & Placed ) { if (s.size() > 1) s += "|"; s += "Placed"; } + if (_flags & Routed ) { if (s.size() > 1) s += "|"; s += "Routed"; } + if (_flags & SlavedAb ) { if (s.size() > 1) s += "|"; s += "SlavedAb"; } + if (_flags & Materialized ) { if (s.size() > 1) s += "|"; s += "Materialized"; } s += ">"; return s; @@ -905,6 +1426,66 @@ void Cell::notify(unsigned flags) } +// **************************************************************************************************** +// Cell::SlavedsSet implementation +// **************************************************************************************************** + + Cell::SlavedsSet::Locator::Locator ( const Cell* cell ) + : Hurricane::Locator() + , _dboLocator (NULL) + { + SlavedsRelation* slaveds = SlavedsRelation::get( cell ); + if (slaveds) { + _dboLocator = slaveds->getSlaveOwners().getLocator(); + } + } + + + Locator* Cell::SlavedsSet::Locator::getClone () const + { return new Locator(*this); } + + + Cell* Cell::SlavedsSet::Locator::getElement () const + { return (_dboLocator and _dboLocator->isValid()) + ? dynamic_cast(_dboLocator->getElement()) : NULL; } + + + bool Cell::SlavedsSet::Locator::isValid () const + { return (_dboLocator and _dboLocator->isValid()); } + + + void Cell::SlavedsSet::Locator::progress () + { + _dboLocator->progress(); + } + + + string Cell::SlavedsSet::Locator::_getString () const + { + string s = "<" + _TName("Cell::SlavedsSet::Locator") + + getString(getElement()) + + ">"; + return s; + } + + + Collection* Cell::SlavedsSet::getClone () const + { return new SlavedsSet(*this); } + + + Locator* Cell::SlavedsSet::getLocator () const + { return new Locator(_cell); } + + + string Cell::SlavedsSet::_getString () const + { + string s = "<" + _TName("Cell_SlavedsSet") + " " + + getString(_cell->getName()) + + ">"; + return s; + } + + // **************************************************************************************************** // Cell::InstanceMap implementation // **************************************************************************************************** @@ -1105,9 +1686,57 @@ void Cell::MarkerSet::_setNextElement(Marker* marker, Marker* nextMarker) const marker->_setNextOfCellMarkerSet(nextMarker); } + + +// **************************************************************************************************** +// JsonCell implementation +// **************************************************************************************************** + + +Initializer jsonCellInitialize ( 10 ); + + +JsonCell::JsonCell(unsigned long flags) +// ************************************ + : JsonEntity(flags) +{ + remove( ".Cell" ); + add( "_library" , typeid(string) ); + add( "_name" , typeid(string) ); + add( "_abutmentBox" , typeid(Box) ); + add( "+instanceMap" , typeid(JsonArray) ); + add( "+netMap" , typeid(JsonArray) ); +} + +string JsonCell::getTypeName() const +// ********************************* +{ return "Cell"; } + +void JsonCell::initialize() +// ************************* +{ JsonTypes::registerType( new JsonCell (JsonWriter::RegisterMode) ); } + +JsonCell* JsonCell::clone(unsigned long flags) const +// ************************************************* +{ return new JsonCell ( flags ); } + +void JsonCell::toData(JsonStack& stack) +// ************************************ +{ + check( stack, "JsonCell::toData" ); + presetId( stack ); + + Library* library = DataBase::getDB()->getLibrary( get(stack,"_library") + , DataBase::CreateLib|DataBase::WarnCreateLib ); + Cell* cell = Cell::create( library, get(stack,"_name") ); + cell->setAbutmentBox( stack.as("_abutmentBox") ); + + update( stack, cell ); +} + } // End of Hurricane namespace. // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/CellCollections.cpp b/hurricane/src/hurricane/CellCollections.cpp index 5f05d09b..904cff01 100644 --- a/hurricane/src/hurricane/CellCollections.cpp +++ b/hurricane/src/hurricane/CellCollections.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./CellCollections.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -4704,7 +4704,7 @@ string Cell_HyperNetRootNetOccurrences::_getString() const // **************************************************************************************************** Cell_HyperNetRootNetOccurrences::Locator::Locator() -// *********************************** +// ************************************************ : Inherit(), _path(), _netLocator(), @@ -4714,22 +4714,24 @@ Cell_HyperNetRootNetOccurrences::Locator::Locator() } Cell_HyperNetRootNetOccurrences::Locator::Locator(const Cell* cell, Path path) -// ************************************************************** +// *************************************************************************** : Inherit(), _path(path), _netLocator(), _instanceLocator(), _hyperNetRootNetOccurrenceLocator() { - _netLocator=cell->getNets().getLocator(); + _netLocator = cell->getNets().getLocator(); + _instanceLocator = cell->getInstances().getLocator(); - _instanceLocator=cell->getInstances().getLocator(); - - while (_netLocator.isValid() && !isHyperNetRootNetOccurrence(Occurrence(_netLocator.getElement(),_path))) + while ( _netLocator.isValid() + and ( dynamic_cast(_netLocator.getElement()) + or _netLocator.getElement()->isAutomatic() + or not isHyperNetRootNetOccurrence(Occurrence(_netLocator.getElement(),_path))) ) _netLocator.progress(); - if (!_netLocator.isValid()) - while (!_hyperNetRootNetOccurrenceLocator.isValid() && _instanceLocator.isValid()) + if (not _netLocator.isValid()) + while (not _hyperNetRootNetOccurrenceLocator.isValid() and _instanceLocator.isValid()) { Instance* instance = _instanceLocator.getElement(); _hyperNetRootNetOccurrenceLocator=Locator(instance->getMasterCell(),Path(_path,instance)); @@ -4738,7 +4740,7 @@ Cell_HyperNetRootNetOccurrences::Locator::Locator(const Cell* cell, Path path) } Cell_HyperNetRootNetOccurrences::Locator::Locator(const Locator& locator) -// ********************************************************* +// ********************************************************************** : Inherit(), _path(locator._path), _netLocator(locator._netLocator), @@ -4748,7 +4750,7 @@ Cell_HyperNetRootNetOccurrences::Locator::Locator(const Locator& locator) } Cell_HyperNetRootNetOccurrences::Locator& Cell_HyperNetRootNetOccurrences::Locator::operator=(const Locator& locator) -// **************************************************************************************** +// ****************************************************************************************************************** { _path = locator._path; _netLocator = locator._netLocator; @@ -4758,7 +4760,7 @@ Cell_HyperNetRootNetOccurrences::Locator& Cell_HyperNetRootNetOccurrences::Locat } Occurrence Cell_HyperNetRootNetOccurrences::Locator::getElement() const -// ****************************************************** +// ******************************************************************** { if (_netLocator.isValid()) return Occurrence(_netLocator.getElement(),_path); @@ -4770,25 +4772,26 @@ Occurrence Cell_HyperNetRootNetOccurrences::Locator::getElement() const } Locator* Cell_HyperNetRootNetOccurrences::Locator::getClone() const -// ************************************************************** +// **************************************************************************** { return new Locator(*this); } bool Cell_HyperNetRootNetOccurrences::Locator::isValid() const -// ********************************************** +// *********************************************************** { return (_netLocator.isValid() || (_hyperNetRootNetOccurrenceLocator.isValid())); } void Cell_HyperNetRootNetOccurrences::Locator::progress() -// ***************************************** +// ****************************************************** { if (_netLocator.isValid()) { _netLocator.progress(); while ( _netLocator.isValid() ) { if ( not dynamic_cast(_netLocator.getElement()) + and not _netLocator.getElement()->isAutomatic() and isHyperNetRootNetOccurrence(Occurrence(_netLocator.getElement(),_path))) break; _netLocator.progress(); @@ -4808,7 +4811,7 @@ void Cell_HyperNetRootNetOccurrences::Locator::progress() } string Cell_HyperNetRootNetOccurrences::Locator::_getString() const -// *************************************************** +// **************************************************************** { string s = "<" + _TName("Cell::HyperNetRootNetOccurrences::Locator"); if (!_path.isEmpty()) @@ -5075,5 +5078,5 @@ string Cell_RecursiveSlavePathes::_getString () const // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/Commons.cpp b/hurricane/src/hurricane/Commons.cpp index ee8b5476..54620a16 100644 --- a/hurricane/src/hurricane/Commons.cpp +++ b/hurricane/src/hurricane/Commons.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./Commons.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -22,80 +22,11 @@ #include "hurricane/Commons.h" +tstream cdebug ( std::cerr ); + + namespace Hurricane { - - -// **************************************************************************************************** -// Tracing tools -// **************************************************************************************************** - -static long TRACE_LEVEL = 0; -static unsigned int TRACE_SHOW_LEVEL = (unsigned int)-1; - -bool in_trace() -// ************ -{ - return (0 < TRACE_LEVEL); -} - -void trace_on() -// ************ -{ - TRACE_LEVEL++; -} - -void trace_off() -// ************* -{ - if (0 < TRACE_LEVEL) TRACE_LEVEL--; -} - -void trace_in() -// ************ -{ - if (0 < TRACE_LEVEL) tab++; -} - -void trace_out() -// ************* -{ - if (0 < TRACE_LEVEL) tab--; -} - -bool inltrace ( unsigned int level ) -//*********************************** -{ - return TRACE_SHOW_LEVEL <= level; -} - -unsigned int ltracelevel () -//************************** -{ - return TRACE_SHOW_LEVEL; -} - -unsigned int ltracelevel ( unsigned int level ) -//********************************************** -{ - unsigned int previousLevel = TRACE_SHOW_LEVEL; - TRACE_SHOW_LEVEL = level; - - return previousLevel; -} - -void ltracein (unsigned int level, unsigned int count ) -//****************************************************** -{ - if ( inltrace(level) ) while ( count-- ) tab++; -} - -void ltraceout (unsigned int level, unsigned int count ) -//******************************************************* -{ - if ( inltrace(level) ) while ( count-- ) tab--; -} - // ------------------------------------------------------------------- // Function : "demangle ()". @@ -241,5 +172,5 @@ bool Scan ( const string &s // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/Component.cpp b/hurricane/src/hurricane/Component.cpp index 70f7463a..d5e1f3c8 100644 --- a/hurricane/src/hurricane/Component.cpp +++ b/hurricane/src/hurricane/Component.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./Component.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -330,37 +330,37 @@ ComponentFilter Component::getIsUnderFilter(const Box& area) void Component::materialize() // ************************** { -// trace << "materialize() - " << this << endl; + cdebug.log(18) << "Component::materialize() - " << this << endl; - if (!isMaterialized()) { - Cell* cell = getCell(); - const Layer* layer = getLayer(); - if (cell && layer) { - Slice* slice = cell->getSlice(layer); - if (!slice) slice = Slice::_create(cell, layer); - QuadTree* quadTree = slice->_getQuadTree(); - quadTree->insert(this); - cell->_fit(quadTree->getBoundingBox()); - } else { - //cerr << "[WARNING] " << this << " not inserted into QuadTree." << endl; - } + if (!isMaterialized()) { + Cell* cell = getCell(); + const Layer* layer = getLayer(); + if (cell && layer) { + Slice* slice = cell->getSlice(layer); + if (!slice) slice = Slice::_create(cell, layer); + QuadTree* quadTree = slice->_getQuadTree(); + quadTree->insert(this); + cell->_fit(quadTree->getBoundingBox()); + } else { + //cerr << "[WARNING] " << this << " not inserted into QuadTree." << endl; } + } } void Component::unmaterialize() // **************************** { -// trace << "Unmaterializing " << this << endl; + cdebug.log(18) << "Component::unmaterialize() " << this << endl; - if (isMaterialized()) { - Cell* cell = getCell(); - Slice* slice = cell->getSlice(getLayer()); - if (slice) { - cell->_unfit(getBoundingBox()); - slice->_getQuadTree()->remove(this); - if (slice->isEmpty()) slice->_destroy(); - } + if (isMaterialized()) { + Cell* cell = getCell(); + Slice* slice = cell->getSlice(getLayer()); + if (slice) { + cell->_unfit(getBoundingBox()); + slice->_getQuadTree()->remove(this); + if (slice->isEmpty()) slice->_destroy(); } + } } void Component::invalidate(bool propagateFlag) @@ -378,6 +378,25 @@ void Component::invalidate(bool propagateFlag) } } + +void Component::forceId(unsigned int id) +// ************************************* +{ + if (not inForcedIdMode()) + throw Error( "Component::forceId(): DataBase *must* be in forced id mode to call this method." ); + + if (getId() == id) return; + + bool materialized = isMaterialized(); + if (materialized) unmaterialize(); + if (_net) _net->_getComponentSet()._remove(this); + + setId( id ); + + if (_net) _net->_getComponentSet()._insert(this); + if (materialized) materialize(); +} + void Component::_postCreate() // ************************** { @@ -389,8 +408,7 @@ void Component::_postCreate() void Component::_preDestroy() // ************************* { -// trace << "entering Component::_Predestroy: " << this << endl; -// trace_in(); + cdebug.log(18,1) << "entering Component::_Predestroy: " << this << endl; clearProperties(); @@ -450,8 +468,22 @@ void Component::_preDestroy() if (_net) _net->_getComponentSet()._remove(this); - // trace << "exiting Component::_Predestroy:" << endl; - // trace_out(); + cdebug.log(18) << "exiting Component::_Predestroy:" << endl; + cdebug.tabw(18,-1); +} + +void Component::_toJson( JsonWriter* writer ) const +// ************************************************ +{ + Inherit::_toJson( writer ); + jsonWrite( writer, "_bodyHook", _bodyHook.getNextHook()->toJson() ); +} + +void Component::_toJsonSignature( JsonWriter* writer ) const +// ********************************************************* +{ + jsonWrite( writer, "_net" , getNet()->getName() ); + _toJson( writer ); } string Component::_getString() const @@ -523,10 +555,12 @@ Component::BodyHook::BodyHook(Component* component) : Inherit() { if (!component) - throw Error("Can't create " + _TName("Component::BodyHook") + " : null component"); + throw Error("Can't create " + _getTypeName() + " : null component"); - if (BODY_HOOK_OFFSET == -1) + if (BODY_HOOK_OFFSET == -1) { BODY_HOOK_OFFSET = (unsigned long)this - (unsigned long)component; + Hook::addCompToHook(_getTypeName(),_compToHook); + } } Component* Component::BodyHook::getComponent() const @@ -541,6 +575,11 @@ string Component::BodyHook::_getString() const return "<" + _TName("Component::BodyHook") + " " + getString(getComponent()) + ">"; } +Hook* Component::BodyHook::_compToHook(Component* component) +// ************************************************************* +{ return &(component->_bodyHook); } + + // **************************************************************************************************** // Component_Hooks implementation // **************************************************************************************************** @@ -941,11 +980,21 @@ double getArea ( Component* component ) } +// **************************************************************************************************** +// JsonComponent implementation +// **************************************************************************************************** + +JsonComponent::JsonComponent(unsigned long flags) +// ********************************************** + : JsonEntity(flags) +{ + add( "_bodyHook", typeid(string) ); +} } // End of Hurricane namespace. // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/Contact.cpp b/hurricane/src/hurricane/Contact.cpp index ddbaa333..7db49e72 100644 --- a/hurricane/src/hurricane/Contact.cpp +++ b/hurricane/src/hurricane/Contact.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./Contact.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -17,6 +17,8 @@ // not, see . // **************************************************************************************************** +#include "hurricane/DataBase.h" +#include "hurricane/Technology.h" #include "hurricane/Contact.h" #include "hurricane/Net.h" #include "hurricane/Layer.h" @@ -323,15 +325,27 @@ void Contact::setOffset(const DbU::Unit& dx, const DbU::Unit& dy) void Contact::_preDestroy() // *********************** { -// trace << "entering Contact::PreDestroy " << this << endl; -// trace_in(); + cdebug.log(18,1) << "entering Contact::PreDestroy " << this << endl; - Inherit::_preDestroy(); + Inherit::_preDestroy(); - _anchorHook.detach(); + _anchorHook.detach(); -// trace << "exiting Contact::PreDestroy" << endl; -// trace_out(); + cdebug.log(19) << "exiting Contact::PreDestroy" << endl; + cdebug.tabw(18,-1); +} + +void Contact::_toJson(JsonWriter* writer) const +// ******************************************** +{ + Inherit::_toJson( writer ); + + jsonWrite( writer, "_anchorHook", _anchorHook.getNextHook()->toJson() ); + jsonWrite( writer, "_layer" , _layer->getName() ); + jsonWrite( writer, "_dx" , _dx ); + jsonWrite( writer, "_dy" , _dy ); + jsonWrite( writer, "_width" , _width ); + jsonWrite( writer, "_height" , _height ); } string Contact::_getString() const @@ -373,10 +387,12 @@ Contact::AnchorHook::AnchorHook(Contact* contact) : Inherit() { if (!contact) - throw Error("Can't create " + _TName("Contact::AnchorHook") + " : null contact"); + throw Error("Can't create " + _getTypeName() + " : null contact"); - if (ANCHOR_HOOK_OFFSET == -1) - ANCHOR_HOOK_OFFSET = (unsigned long)this - (unsigned long)contact; + if (ANCHOR_HOOK_OFFSET == -1) { + ANCHOR_HOOK_OFFSET = (unsigned long)this - (unsigned long)contact; + Hook::addCompToHook(_getTypeName(),_compToHook); + } } Component* Contact::AnchorHook::getComponent() const @@ -391,6 +407,16 @@ string Contact::AnchorHook::_getString() const return "<" + _TName("Contact::AnchorHook") + " " + getString(getComponent()) + ">"; } +Hook* Contact::AnchorHook::_compToHook(Component* component) +// *************************************************************** +{ + Contact* contact = dynamic_cast(component); + if (not contact) { + throw Error( "AnchorHook::_compToAnchorhook(): Unable to cast %s into Contact*." + , getString(component).c_str() ); + } + return &(contact->_anchorHook); +} // **************************************************************************************************** @@ -508,9 +534,69 @@ string Contact_Hooks::Locator::_getString() const return s; } + + +// **************************************************************************************************** +// JsonContact implementation +// **************************************************************************************************** + +Initializer jsonContactInit ( 0 ); + + +void JsonContact::initialize() +// **************************** +{ JsonTypes::registerType( new JsonContact (JsonWriter::RegisterMode) ); } + +JsonContact::JsonContact(unsigned long flags) +// ****************************************** + : JsonComponent(flags) +{ + add( "_anchorHook", typeid(string) ); + add( "_layer" , typeid(string) ); + add( "_dx" , typeid(int64_t) ); + add( "_dy" , typeid(int64_t) ); + add( "_width" , typeid(int64_t) ); + add( "_height" , typeid(int64_t) ); +} + +string JsonContact::getTypeName() const +// ************************************ +{ return "Contact"; } + +JsonContact* JsonContact::clone(unsigned long flags) const +// ******************************************************* +{ return new JsonContact ( flags ); } + +void JsonContact::toData(JsonStack& stack) +// *************************************** +{ + check( stack, "JsonContact::toData" ); + unsigned int jsonId = presetId( stack ); + + Contact* contact = Contact::create + ( get(stack,".Net") + , DataBase::getDB()->getTechnology()->getLayer( get(stack,"_layer") ) + , DbU::fromDb( get(stack,"_dx" ) ) + , DbU::fromDb( get(stack,"_dy" ) ) + , DbU::fromDb( get(stack,"_width" ) ) + , DbU::fromDb( get(stack,"_height") ) + ); + + JsonNet* jnet = jget( stack ); + if (jnet) { + jnet->addHookLink( contact->getBodyHook (), jsonId, get(stack,"_bodyHook" ) ); + jnet->addHookLink( contact->getAnchorHook(), jsonId, get(stack,"_anchorHook") ); + } else { + cerr << Error( "JsonContact::toData(): Missing (Json)Net in stack context." ) << endl; + } + +// Hook/Ring rebuild are done as a post-process. + update( stack, contact ); +} + } // End of Hurricane namespace. // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/ContactLayer.cpp b/hurricane/src/hurricane/ContactLayer.cpp index 646ea69c..c5badb40 100644 --- a/hurricane/src/hurricane/ContactLayer.cpp +++ b/hurricane/src/hurricane/ContactLayer.cpp @@ -1,7 +1,6 @@ - // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -19,12 +18,7 @@ // License along with Hurricane. If not, see // . // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | H U R R I C A N E | // | V L S I B a c k e n d D a t a - B a s e | // | | @@ -32,16 +26,14 @@ // | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Module : "./ContactLayer.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ -# include "hurricane/BasicLayer.h" -# include "hurricane/ContactLayer.h" -# include "hurricane/Technology.h" -# include "hurricane/Error.h" +#include "hurricane/DataBase.h" +#include "hurricane/Technology.h" +#include "hurricane/BasicLayer.h" +#include "hurricane/ContactLayer.h" +#include "hurricane/Error.h" namespace { @@ -199,4 +191,150 @@ namespace Hurricane { } + void ContactLayer::_toJson ( JsonWriter* w ) const + { + Super::_toJson( w ); + + jsonWrite( w, "_metal" , _basicLayers[0]->getName() ); + jsonWrite( w, "_cut" , _basicLayers[1]->getName() ); + jsonWrite( w, "_active" , _basicLayers[2]->getName() ); + jsonWrite( w, "_diffusion", _basicLayers[3]->getName() ); + if (_basicLayers.size() == 5) jsonWrite( w, "_well", _basicLayers[4]->getName() ); + else jsonWrite( w, "_well", "no_well_layer" ); + + jsonWrite( w, "_enclosure.metal" , _enclosures[0] ); + jsonWrite( w, "_enclosure.cut" , _enclosures[1] ); + jsonWrite( w, "_enclosure.active" , _enclosures[2] ); + jsonWrite( w, "_enclosure.diffusion", _enclosures[3] ); + jsonWrite( w, "_enclosure.well" , (_basicLayers.size() == 5) ? _enclosures[4] : 0 ); + } + + +// ------------------------------------------------------------------- +// Class : "Hurricane::JsonContactLayer". + + Initializer jsonContactLayerInit ( 0 ); + + + void JsonContactLayer::initialize () + { JsonTypes::registerType( new JsonContactLayer (JsonWriter::RegisterMode) ); } + + + JsonContactLayer::JsonContactLayer ( unsigned long flags ) + : JsonLayer(flags) + { + if (flags & JsonWriter::RegisterMode) return; + + cdebug.log(19) << "JsonContactLayer::JsonContactLayer()" << endl; + + add( "_metal" , typeid(string) ); + add( "_cut" , typeid(string) ); + add( "_active" , typeid(string) ); + add( "_diffusion" , typeid(string) ); + add( "_well" , typeid(string) ); + add( "_enclosure.metal" , typeid(int64_t) ); + add( "_enclosure.cut" , typeid(int64_t) ); + add( "_enclosure.active" , typeid(int64_t) ); + add( "_enclosure.diffusion", typeid(int64_t) ); + add( "_enclosure.well" , typeid(int64_t) ); + } + + + JsonContactLayer::~JsonContactLayer () + { } + + + string JsonContactLayer::getTypeName () const + { return "ContactLayer"; } + + + JsonContactLayer* JsonContactLayer::clone ( unsigned long flags ) const + { return new JsonContactLayer ( flags ); } + + + void JsonContactLayer::toData(JsonStack& stack) + { + cdebug.tabw(19,1); + + check( stack, "JsonContactLayer::toData" ); + + Technology* techno = lookupTechnology( stack, "JsonContactLayer::toData" ); + ContactLayer* layer = NULL; + + if (techno) { + string name = get ( stack, "_name" ); + string smask = get ( stack, "_mask" ); + //DbU::Unit minimalSize = get( stack, "_minimalSize" ); + //DbU::Unit minimalSpacing = get( stack, "_minimalSpacing" ); + bool isWorking = get ( stack, "_working" ); + + BasicLayer* metal = techno->getBasicLayer( get(stack,"_metal" ) ); + BasicLayer* cut = techno->getBasicLayer( get(stack,"_cut" ) ); + BasicLayer* active = techno->getBasicLayer( get(stack,"_active" ) ); + BasicLayer* diffusion = techno->getBasicLayer( get(stack,"_diffusion") ); + BasicLayer* well = techno->getBasicLayer( get(stack,"_well" ) ); + DbU::Unit metalEncl = get( stack, "_enclosure.metal" ); + DbU::Unit cutEncl = get( stack, "_enclosure.cut" ); + DbU::Unit activeEncl = get( stack, "_enclosure.active" ); + DbU::Unit diffusionEncl = get( stack, "_enclosure.diffusion" ); + DbU::Unit wellEncl = get( stack, "_enclosure.well" ); + + Layer::Mask mask = Layer::Mask::fromString( smask ); + + if (stack.issetFlags(JsonWriter::TechnoMode)) { + // Actual creation. + layer = ContactLayer::create( techno + , name + , metal + , cut + , active + , diffusion + , well + ); + layer->setWorking ( isWorking ); + layer->setEnclosure( metal , metalEncl ); + layer->setEnclosure( cut , cutEncl ); + layer->setEnclosure( active , activeEncl ); + layer->setEnclosure( diffusion, diffusionEncl ); + if (well) layer->setEnclosure( well, wellEncl ); + + if (layer->getMask() != mask) { + cerr << Error( "JsonContactLayer::toData(): Layer mask re-creation discrepency on \"%s\":\n" + " Blob: %s\n" + " DataBase: %s" + , name.c_str() + , getString(mask).c_str() + , getString(layer->getMask()).c_str() + ) << endl; + } + // Add here association with blockage layer... + } else { + // Check coherency with existing layer. + layer = dynamic_cast( techno->getLayer(name) ); + if (layer) { + if (layer->getMask() != mask) { + cerr << Error( "JsonContactLayer::toData(): Layer mask discrepency on \"%s\":\n" + " Blob: %s\n" + " DataBase: %s" + , name.c_str() + , getString(mask).c_str() + , getString(layer->getMask()).c_str() + ) << endl; + } + } else { + cerr << Error( "JsonContactLayer::toData(): No ContactLayer \"%s\" in the existing technology." + , name.c_str() + ) << endl; + } + } + } else { + cerr << Error( "JsonContactLayer::toData(): Cannot find technology, aborting ContactLayer creation." ) << endl; + } + + update( stack, layer ); + + cdebug.tabw(19,-1); + } + + } // End of Hurricane namespace. diff --git a/hurricane/src/hurricane/DBo.cpp b/hurricane/src/hurricane/DBo.cpp index 53431460..88045cf0 100644 --- a/hurricane/src/hurricane/DBo.cpp +++ b/hurricane/src/hurricane/DBo.cpp @@ -1,6 +1,6 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -18,8 +18,6 @@ // License along with Hurricane. If not, see // . // -// =================================================================== -// // +-----------------------------------------------------------------+ // | H U R R I C A N E | // | V L S I B a c k e n d D a t a - B a s e | @@ -31,8 +29,10 @@ // +-----------------------------------------------------------------+ -#include "hurricane/Property.h" +#include "hurricane/Initializer.h" #include "hurricane/DBo.h" +#include "hurricane/Entity.h" +#include "hurricane/Property.h" #include "hurricane/Quark.h" #include "hurricane/Error.h" @@ -65,7 +65,6 @@ namespace Hurricane { void DBo::destroy () { _preDestroy(); - delete this; } @@ -151,6 +150,25 @@ namespace Hurricane { } + void DBo::_toJson ( JsonWriter* writer ) const + { } + + + void DBo::_toJsonSignature ( JsonWriter* writer ) const + { _toJson( writer ); } + + + void DBo::_toJsonCollections ( JsonWriter* writer ) const + { + writer->key( "+propertySet" ); + writer->startArray(); + for ( Property* property : getProperties() ) { + if (property->hasJson()) property->toJson( writer, this ); + } + writer->endArray(); + } + + string DBo::_getTypeName () const { return "DBo"; @@ -171,4 +189,42 @@ namespace Hurricane { } + void DBo::toJsonSignature ( JsonWriter* w ) const + { + w->startObject(); + std::string tname = "Signature." + _getTypeName(); + jsonWrite( w, "@typename", tname ); + _toJsonSignature( w ); + w->endObject(); + } + + + void DBo::toJson ( JsonWriter* w ) const + { + w->startObject(); + const Entity* entity = dynamic_cast( this ); + if (w->issetFlags(JsonWriter::UseEntityReference) and entity) { + jsonWrite( w, "@typename", "&Entity" ); + jsonWrite( w, "_id" , entity->getId() ); + } else { + std::string tname = _getTypeName(); + if (w->issetFlags(JsonWriter::UsePlugReference) and (tname == "Plug")) { + tname.insert( 0, "&" ); + } + jsonWrite( w, "@typename", tname ); + _toJson( w ); + _toJsonCollections( w ); + } + w->endObject(); + } + + +// ------------------------------------------------------------------- +// Class : "Hurricane::JsonDBo". + + JsonDBo::JsonDBo ( unsigned int flags ) + : JsonObject(flags | JsonWriter::DBoObject) + { } + + } // End of Hurricane namespace. diff --git a/hurricane/src/hurricane/DRCError.cpp b/hurricane/src/hurricane/DRCError.cpp index ae513cdd..879ffa73 100644 --- a/hurricane/src/hurricane/DRCError.cpp +++ b/hurricane/src/hurricane/DRCError.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./DRCError.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -87,5 +87,5 @@ Record* DRCError::_getRecord() const } // End of Hurricane namespace. // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/DataBase.cpp b/hurricane/src/hurricane/DataBase.cpp index a8971688..cc070d68 100644 --- a/hurricane/src/hurricane/DataBase.cpp +++ b/hurricane/src/hurricane/DataBase.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./DataBase.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -17,11 +17,91 @@ // not, see . // **************************************************************************************************** +#include "hurricane/Initializer.h" +#include "hurricane/Warning.h" +#include "hurricane/Error.h" +#include "hurricane/SharedPath.h" +#include "hurricane/UpdateSession.h" #include "hurricane/DataBase.h" #include "hurricane/Technology.h" #include "hurricane/Library.h" -#include "hurricane/Error.h" -#include "hurricane/UpdateSession.h" + + +namespace { + + using namespace std; + using namespace Hurricane; + + + class CellDepths { + public: + typedef map CellMap; + typedef multimap DepthMap; + public: + CellDepths ( Library* ); + inline const DepthMap& getDepths () const; + private: + void _gatherCells ( Library* ); + void _computeDepths (); + int _computeDepth ( pair& ); + private: + CellMap _cellMap; + DepthMap _depthMap; + }; + + + inline const CellDepths::DepthMap& CellDepths::getDepths () const { return _depthMap; } + + + CellDepths::CellDepths ( Library* library ) + : _cellMap () + , _depthMap() + { + _gatherCells ( library ); + _computeDepths(); + } + + + void CellDepths::_gatherCells ( Library* library ) + { + for ( Cell* cell : library->getCells() ) _cellMap.insert( make_pair(cell,-1) ); + + for ( Library* childLibrary : library->getLibraries() ) + _gatherCells( childLibrary ); + } + + + int CellDepths::_computeDepth ( pair& cellDepth ) + { + if (cellDepth.second != -1) return cellDepth.second; + + int depth = 0; + + if (not cellDepth.first->isLeaf()) { + for ( Instance* instance : cellDepth.first->getInstances() ) { + Cell* masterCell = instance->getMasterCell(); + pair& masterDepth = *(_cellMap.find( masterCell )); + depth = std::max( depth, _computeDepth(masterDepth)+1 ); + } + } + + cellDepth.second = depth; + return cellDepth.second; + } + + + void CellDepths::_computeDepths () + { + _depthMap.clear(); + + for ( auto cellDepth : _cellMap ) { + _computeDepth( cellDepth ); + _depthMap.insert( make_pair(cellDepth.second,cellDepth.first) ); + } + } + + +} // Anonymous namespace. namespace Hurricane { @@ -33,6 +113,7 @@ namespace Hurricane { DataBase* DataBase::_db = NULL; + DataBase::DataBase() // ***************** : Inherit(), @@ -56,9 +137,10 @@ DataBase* DataBase::create() void DataBase::_postCreate() // ************************* { - Inherit::_postCreate(); + Init::runOnce(); + Inherit::_postCreate(); - _db = this; + _db = this; } void DataBase::_preDestroy() @@ -81,7 +163,7 @@ string DataBase::_getString() const } Record* DataBase::_getRecord() const -// *************************** +// ********************************* { Record* record = Inherit::_getRecord(); if (record) { @@ -100,11 +182,146 @@ DataBase* DataBase::getDB() return _db; } +Library* DataBase::getLibrary(string rpath, unsigned int flags) +// ************************************************************ +{ + Library* parent = getRootLibrary(); + if ( not parent and (not (flags & CreateLib)) ) return NULL; + + char separator = SharedPath::getNameSeparator(); + Name childName; + size_t dot = rpath.find( separator ); + if (dot != string::npos) { + childName = rpath.substr( 0, dot ); + rpath = rpath.substr( dot+1 ); + } else { + childName = rpath; + rpath.clear(); + } + + if (not parent) { + parent = Library::create( this, childName ); + if (flags & WarnCreateLib) { + cerr << Warning( "DataBase::getLibrary(): Creating Root library \"%s\"." + , getString(childName).c_str() + ) << endl; + } + } + if (childName != parent->getName()) + return NULL; + + while ( (dot != string::npos) and parent ) { + dot = rpath.find( separator ); + if (dot != string::npos) { + childName = rpath.substr( 0, dot ); + rpath = rpath.substr( dot+1 ); + } else { + childName = rpath; + rpath.clear(); + } + + Library* child = parent->getLibrary( childName ); + if ( not child and (flags & CreateLib) ) { + child = Library::create( parent, childName ); + if (flags & WarnCreateLib) { + cerr << Warning( "DataBase::getLibrary(): Creating library \"%s\" (parent:\"%s\")." + , getString(childName).c_str() + , getString(parent->getName()).c_str() + ) << endl; + } + } + parent = child; + } + return parent; +} + +Cell* DataBase::getCell(string rpath, unsigned int flags) +// ****************************************************** +{ + char separator = SharedPath::getNameSeparator(); + size_t dot = rpath.rfind( separator ); + string cellName = rpath.substr(dot+1); + Library* library = getLibrary( rpath.substr(0,dot), flags ); + Cell* cell = NULL; + + if (library) + cell = library->getCell( rpath.substr(dot+1) ); + + if (not cell and _cellLoader) return _cellLoader( rpath ); + + return cell; + +} + +void DataBase::_toJson(JsonWriter* w) const +// **************************************** +{ + Inherit::_toJson( w ); + + jsonWrite( w, "_precision" , DbU::getPrecision() ); + jsonWrite( w, "_gridsPerLambda" , DbU::getGridsPerLambda() ); + jsonWrite( w, "_physicalsPerGrid", DbU::getPhysicalsPerGrid() ); + jsonWrite( w, "_technology" , _technology ); + jsonWrite( w, "_rootLibrary" , _rootLibrary ); + + w->key( "+cellsOrderedByDepth" ); + w->startArray(); + CellDepths cells = CellDepths( _rootLibrary ); + for ( auto depthCell : cells.getDepths() ) { + depthCell.second->toJson( w ); + } + w->endArray(); +} + + +// **************************************************************************************************** +// JsonDataBase implementation +// **************************************************************************************************** + + +Initializer jsonDataBaseInit ( 0 ); + + +JsonDataBase::JsonDataBase(unsigned long flags) +// ******************************************** + : JsonDBo(flags) +{ + add( "_precision" , typeid(int64_t ) ); + add( "_gridsPerLambda" , typeid(double ) ); + add( "_physicalsPerGrid", typeid(double ) ); + add( "_technology" , typeid(Technology*) ); + add( "_rootLibrary" , typeid(Library* ) ); +} + +string JsonDataBase::getTypeName() const +// ********************************* +{ return "DataBase"; } + +void JsonDataBase::initialize() +// ***************************** +{ JsonTypes::registerType( new JsonDataBase (JsonWriter::RegisterMode) ); } + +JsonDataBase* JsonDataBase::clone(unsigned long flags) const +// ************************************************* +{ return new JsonDataBase ( flags ); } + +void JsonDataBase::toData(JsonStack& stack) +// *************************************** +{ + check( stack, "JsonDataBase::toData" ); + + DataBase* db = DataBase::getDB(); + DbU::setPrecision ( get(stack,"_precision" ), DbU::NoTechnoUpdate ); + DbU::setGridsPerLambda ( get(stack,"_gridsPerLambda" ), DbU::NoTechnoUpdate ); + DbU::setPhysicalsPerGrid( get(stack,"_physicalsPerGrid"), DbU::Unity ); + + update( stack, db ); +} } // End of Hurricane namespace. // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/DbU.cpp b/hurricane/src/hurricane/DbU.cpp index 1f4253a5..81f7227f 100644 --- a/hurricane/src/hurricane/DbU.cpp +++ b/hurricane/src/hurricane/DbU.cpp @@ -1,6 +1,6 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -144,7 +144,7 @@ namespace Hurricane { { return _resolution; } - void DbU::setPrecision ( unsigned int precision ) + void DbU::setPrecision ( unsigned int precision, unsigned int flags ) { if ( _maximalPrecision < precision) throw Error ( "DbU::Unit::setPrecision(): Precision %ud exceed maximal precision %ud." @@ -159,7 +159,8 @@ namespace Hurricane { _resolution = 1; while ( precision-- ) _resolution /= 10; - DataBase::getDB()->getTechnology()->_onDbuChange ( scale ); + if (not (flags & NoTechnoUpdate)) + DataBase::getDB()->getTechnology()->_onDbuChange ( scale ); setSymbolicSnapGridStep ( DbU::lambda( 1.0) ); setRealSnapGridStep ( DbU::grid (10.0) ); @@ -197,7 +198,7 @@ namespace Hurricane { { return ( physical * getUnitPower(p) ) / _physicalsPerGrid; } - void DbU::setGridsPerLambda ( double gridsPerLambda ) + void DbU::setGridsPerLambda ( double gridsPerLambda, unsigned int flags ) { if ( ( rint(gridsPerLambda) != gridsPerLambda ) || ( remainder(gridsPerLambda,2.0) != 0.0 ) ) @@ -209,7 +210,8 @@ namespace Hurricane { _gridsPerLambda = gridsPerLambda; - DataBase::getDB()->getTechnology()->_onDbuChange ( scale ); + if (not (flags & NoTechnoUpdate)) + DataBase::getDB()->getTechnology()->_onDbuChange ( scale ); setSymbolicSnapGridStep ( DbU::lambda(1) ); diff --git a/hurricane/src/hurricane/DebugSession.cpp b/hurricane/src/hurricane/DebugSession.cpp index cf6694f7..848f34ff 100644 --- a/hurricane/src/hurricane/DebugSession.cpp +++ b/hurricane/src/hurricane/DebugSession.cpp @@ -1,6 +1,6 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // diff --git a/hurricane/src/hurricane/DeepNet.cpp b/hurricane/src/hurricane/DeepNet.cpp index 00794bd0..25a210e5 100644 --- a/hurricane/src/hurricane/DeepNet.cpp +++ b/hurricane/src/hurricane/DeepNet.cpp @@ -1,6 +1,6 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -29,6 +29,7 @@ // +-----------------------------------------------------------------+ +#include "hurricane/Warning.h" #include "hurricane/DeepNet.h" #include "hurricane/Cell.h" #include "hurricane/Instance.h" @@ -49,14 +50,13 @@ namespace Hurricane { // ------------------------------------------------------------------- // Class : "DeepNet". - DeepNet::DeepNet ( Occurrence& netOccurrence ) : Net(netOccurrence.getOwnerCell() ,netOccurrence.getName() ) , _netOccurrence(netOccurrence) { - //trace << "DeepNet::DeepNet() " << getCell() << " " << this << endl; + cdebug.log(18) << "DeepNet::DeepNet() " << getCell() << " " << this << endl; } @@ -65,14 +65,20 @@ namespace Hurricane { if (not hyperNet.isValid()) throw Error ( "Can't create " + _TName("DeepNet") + ": occurence is invalid." ); + if (not isHyperNetRootNetOccurrence(hyperNet.getNetOccurrence())) { + cerr << Warning( "DeepNet::create(): Occurrence \"%s\" is not a root one." + , hyperNet.getNetOccurrence().getCompactString().c_str() + ) << endl; + } + Occurrence rootNetOccurrence = getHyperNetRootNetOccurrence( hyperNet.getNetOccurrence() ); if (rootNetOccurrence.getMasterCell()->isFlattenLeaf()) return NULL; if (rootNetOccurrence.getPath().isEmpty()) return NULL; - + DeepNet* deepNet = new DeepNet( rootNetOccurrence ); deepNet->_postCreate(); - + return deepNet; } @@ -82,18 +88,24 @@ namespace Hurricane { size_t nbRoutingPads = 0; HyperNet hyperNet ( _netOccurrence ); RoutingPad* currentRp = NULL; + bool createRp = true; - forEach ( Occurrence, ioccurrence, hyperNet.getLeafPlugOccurrences() ) { + for ( Occurrence occurrence : hyperNet.getComponentOccurrences() ) { + RoutingPad* rp = dynamic_cast(occurrence.getEntity()); + if ( rp and (rp->getCell() == getCell()) ) { createRp = false; break; } + if ( dynamic_cast(occurrence.getEntity()) ) { createRp = false; break; } + } + if (not createRp) return 0; + + for ( Occurrence occurrence : hyperNet.getLeafPlugOccurrences() ) { nbRoutingPads++; - currentRp = RoutingPad::create( this, *ioccurrence, RoutingPad::BiggestArea ); + currentRp = RoutingPad::create( this, occurrence, RoutingPad::BiggestArea ); if (flags & Cell::Flags::WarnOnUnplacedInstances) currentRp->isPlacedOccurrence ( RoutingPad::ShowWarning ); if (nbRoutingPads == 1) { - //Net* net = currentRp->getNet(); - //cerr << "_createRoutingPads on " << net->getName() << " buildRing:" << buildRing << endl; } } @@ -122,4 +134,65 @@ namespace Hurricane { } + void DeepNet::_toJson( JsonWriter* writer ) const + { + Inherit::_toJson( writer ); + + jsonWrite( writer, "_netOccurrence", &_netOccurrence ); + } + + +// ------------------------------------------------------------------- +// Class : "JsonDeepNet". + + Initializer jsonDeepNetInit ( 0 ); + + void JsonDeepNet::initialize () + { JsonTypes::registerType( new JsonDeepNet (JsonWriter::RegisterMode) ); } + + + JsonDeepNet::JsonDeepNet ( unsigned long flags ) + : JsonNet(flags) + { + cdebug.log(19) << "JsonDeepNet::JsonDeepNet()" << endl; + + add( "_netOccurrence", typeid(Occurrence) ); + } + + + JsonDeepNet::~JsonDeepNet () + { } + + + string JsonDeepNet::getTypeName () const + { return "DeepNet"; } + + + JsonDeepNet* JsonDeepNet::clone ( unsigned long flags ) const + { return new JsonDeepNet ( flags ); } + + + void JsonDeepNet::toData(JsonStack& stack) + { + cdebug.tabw(19,1); + + check( stack, "JsonDeepNet::toData" ); + presetId( stack ); + + HyperNet hyperNet ( get(stack,"_netOccurrence") ); + + _net = DeepNet::create( hyperNet ); + _net->setGlobal ( get(stack,"_isGlobal" ) ); + _net->setExternal ( get(stack,"_isExternal" ) ); + _net->setAutomatic( get(stack,"_isAutomatic") ); + _net->setType ( Net::Type (get(stack,"_type")) ); + _net->setDirection( Net::Direction(get(stack,"_direction")) ); + + setName( ".Net" ); + update( stack, _net ); + + cdebug.tabw(19,-1); + } + + } // End of Hurricane namespace. diff --git a/hurricane/src/hurricane/DiffusionLayer.cpp b/hurricane/src/hurricane/DiffusionLayer.cpp index 456084d9..c68f5229 100644 --- a/hurricane/src/hurricane/DiffusionLayer.cpp +++ b/hurricane/src/hurricane/DiffusionLayer.cpp @@ -1,7 +1,6 @@ - // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -19,12 +18,7 @@ // License along with Hurricane. If not, see // . // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | H U R R I C A N E | // | V L S I B a c k e n d D a t a - B a s e | // | | @@ -32,16 +26,14 @@ // | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Module : "./DiffusionLayer.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ -#include "hurricane/BasicLayer.h" -#include "hurricane/DiffusionLayer.h" -#include "hurricane/Technology.h" -#include "hurricane/Error.h" +#include "hurricane/DataBase.h" +#include "hurricane/Technology.h" +#include "hurricane/BasicLayer.h" +#include "hurricane/DiffusionLayer.h" +#include "hurricane/Error.h" namespace { @@ -95,7 +87,7 @@ namespace Hurricane { _setMask ( activeLayer->getMask() | diffusionLayer->getMask() ); _setExtractMask ( activeLayer->getExtractMask() | diffusionLayer->getExtractMask() ); - + if ( wellLayer ) { _basicLayers .push_back ( wellLayer ); _extentionCaps .push_back ( 0 ); @@ -227,4 +219,149 @@ namespace Hurricane { } + void DiffusionLayer::_toJson ( JsonWriter* w ) const + { + Super::_toJson( w ); + + jsonWrite( w, "_active" , _basicLayers[0]->getName() ); + jsonWrite( w, "_diffusion", _basicLayers[1]->getName() ); + if (_basicLayers.size() == 3) jsonWrite( w, "_well", _basicLayers[2]->getName() ); + else jsonWrite( w, "_well", "no_well_layer" ); + + jsonWrite( w, "_extentionCap.active" , _extentionCaps[0] ); + jsonWrite( w, "_extentionCap.diffusion", _extentionCaps[1] ); + jsonWrite( w, "_extentionCap.well" , (_basicLayers.size() == 3) ? _extentionCaps[2] : 0 ); + + jsonWrite( w, "_extentionWidth.active" , _extentionWidths[0] ); + jsonWrite( w, "_extentionWidth.diffusion", _extentionWidths[1] ); + jsonWrite( w, "_extentionWidth.well" , (_basicLayers.size() == 3) ? _extentionWidths[2] : 0 ); + } + + +// ------------------------------------------------------------------- +// Class : "Hurricane::JsonDiffusionLayer". + + Initializer jsonDiffusionLayerInit ( 0 ); + + + void JsonDiffusionLayer::initialize () + { JsonTypes::registerType( new JsonDiffusionLayer (JsonWriter::RegisterMode) ); } + + + JsonDiffusionLayer::JsonDiffusionLayer ( unsigned long flags ) + : JsonLayer(flags) + { + if (flags & JsonWriter::RegisterMode) return; + + cdebug.log(19) << "JsonDiffusionLayer::JsonDiffusionLayer()" << endl; + + add( "_active" , typeid(string) ); + add( "_diffusion" , typeid(string) ); + add( "_well" , typeid(string) ); + add( "_extentionCap.active" , typeid(int64_t) ); + add( "_extentionCap.diffusion" , typeid(int64_t) ); + add( "_extentionCap.well" , typeid(int64_t) ); + add( "_extentionWidth.active" , typeid(int64_t) ); + add( "_extentionWidth.diffusion", typeid(int64_t) ); + add( "_extentionWidth.well" , typeid(int64_t) ); + } + + + JsonDiffusionLayer::~JsonDiffusionLayer () + { } + + + string JsonDiffusionLayer::getTypeName () const + { return "DiffusionLayer"; } + + + JsonDiffusionLayer* JsonDiffusionLayer::clone ( unsigned long flags ) const + { return new JsonDiffusionLayer ( flags ); } + + + void JsonDiffusionLayer::toData(JsonStack& stack) + { + cdebug.tabw(19,1); + + check( stack, "JsonDiffusionLayer::toData" ); + + Technology* techno = lookupTechnology( stack, "JsonDiffusionLayer::toData" ); + DiffusionLayer* layer = NULL; + + if (techno) { + string name = get ( stack, "_name" ); + string smask = get ( stack, "_mask" ); + //DbU::Unit minimalSize = get( stack, "_minimalSize" ); + //DbU::Unit minimalSpacing = get( stack, "_minimalSpacing" ); + bool isWorking = get ( stack, "_working" ); + + BasicLayer* active = techno->getBasicLayer( get(stack,"_active" ) ); + BasicLayer* diffusion = techno->getBasicLayer( get(stack,"_diffusion" ) ); + BasicLayer* well = techno->getBasicLayer( get(stack,"_well" ) ); + DbU::Unit eCapActive = get( stack, "_extentionCap.active" ); + DbU::Unit eCapDiffusion = get( stack, "_extentionCap.diffusion" ); + DbU::Unit eCapWell = get( stack, "_extentionCap.well" ); + DbU::Unit eWidthActive = get( stack, "_extentionWidth.active" ); + DbU::Unit eWidthDiffusion = get( stack, "_extentionWidth.diffusion" ); + DbU::Unit eWidthWell = get( stack, "_extentionWidth.well" ); + + Layer::Mask mask = Layer::Mask::fromString( smask ); + + if (stack.issetFlags(JsonWriter::TechnoMode)) { + // Actual creation. + layer = DiffusionLayer::create( techno + , name + , active + , diffusion + , well + ); + layer->setWorking ( isWorking ); + layer->setExtentionCap ( active , eCapActive ); + layer->setExtentionCap ( diffusion, eCapDiffusion ); + layer->setExtentionWidth( active , eWidthActive ); + layer->setExtentionWidth( diffusion, eWidthDiffusion ); + if (well) { + layer->setExtentionCap ( well, eCapWell ); + layer->setExtentionWidth( well, eWidthWell ); + } + + if (layer->getMask() != mask) { + cerr << Error( "JsonDiffusionLayer::toData(): Layer mask re-creation discrepency on \"%s\":\n" + " Blob: %s\n" + " DataBase: %s" + , name.c_str() + , getString(mask).c_str() + , getString(layer->getMask()).c_str() + ) << endl; + } + // Add here association with blockage layer... + } else { + // Check coherency with existing layer. + layer = dynamic_cast( techno->getLayer(name) ); + if (layer) { + if (layer->getMask() != mask) { + cerr << Error( "JsonDiffusionLayer::toData(): Layer mask discrepency on \"%s\":\n" + " Blob: %s\n" + " DataBase: %s" + , name.c_str() + , getString(mask).c_str() + , getString(layer->getMask()).c_str() + ) << endl; + } + } else { + cerr << Error( "JsonDiffusionLayer::toData(): No DiffusionLayer \"%s\" in the existing technology." + , name.c_str() + ) << endl; + } + } + } else { + cerr << Error( "JsonDiffusionLayer::toData(): Cannot find technology, aborting DiffusionLayer creation." ) << endl; + } + + update( stack, layer ); + + cdebug.tabw(19,-1); + } + + } // End of Hurricane namespace. diff --git a/hurricane/src/hurricane/Entity.cpp b/hurricane/src/hurricane/Entity.cpp index 34e74d95..dadaf30c 100644 --- a/hurricane/src/hurricane/Entity.cpp +++ b/hurricane/src/hurricane/Entity.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./Entity.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -28,22 +28,73 @@ namespace Hurricane { - // **************************************************************************************************** // Entity implementation // **************************************************************************************************** - unsigned int Entity::_idCounter = 0; + unsigned long Entity::_flags = 0; + unsigned int Entity::_nextId = 0; + unsigned int Entity::_idCounter = 1; unsigned int Entity::getIdCounter () { return _idCounter; } + bool Entity::inForcedIdMode () + { return _flags & ForcedIdMode; } + + + void Entity::enableForcedIdMode () + { + if (_flags & ForcedIdMode) return; + if (_idCounter != 1) { + throw Error( "Entity::enableForcedIdMode(): DataBase must be reset before forcind ids." ); + } + _flags |= ForcedIdMode; + } + + + void Entity::disableForcedIdMode () + { + if (not (_flags & ForcedIdMode)) return; + _flags &= ~ForcedIdMode; + } + + + void Entity::setNextId ( unsigned int nid ) + { + if (not (_flags & ForcedIdMode)) { + cerr << Error("Entity::setNextId(): Not in forced id mode, ignored.") << endl; + return; + } + _nextId = nid; + if (nid > _idCounter) _idCounter = nid; + _flags |= NextIdSet; + } + + + unsigned int Entity::getNextId () + { + if (_flags & ForcedIdMode) { + if (_flags & NextIdSet) { + _flags &= ~NextIdSet; + cdebug.log(18) << demangle(typeid(*this).name()) + << "::getNextId(): Consuming the preset id:" << _nextId << endl; + return _nextId; + } else { + throw Error("Entity::getNextId(): Next id is not set, while in forced id mode."); + } + } + + return _idCounter++; + } + + Entity::Entity() : Inherit() - , _id(_idCounter++) + , _id (getNextId()) { if (_idCounter == std::numeric_limits::max()) { throw Error( "Entity::Entity(): Identifier counter has reached it's limit (%d bits)." @@ -64,7 +115,6 @@ namespace Hurricane { for(; it != end ; it++) slaveEntities.push_back(it->second); for(; slaveEntities.size() ; slaveEntities.pop_back()) { - cerr << "Erasing " << slaveEntities.back() << endl; slaveEntities.back()->destroy(); } @@ -96,32 +146,109 @@ namespace Hurricane { //ltraceout(10); } -string Entity::_getString() const -// ****************************** -{ - string s = Inherit::_getString(); - s.insert(1, "id:"+getString(_id)+" "); - return s; -} -Record* Entity::_getRecord() const -// ************************* -{ + void Entity::setId ( unsigned int id ) + { + if (_flags & ForcedIdMode) { + _id = id; + if (_id > _idCounter) _idCounter = _id; + } else { + throw Error("Entity::setId(): Attempt to set id while not in forced id mode."); + } + } + + + void Entity::_toJson ( JsonWriter* writer ) const + { + Inherit::_toJson( writer ); + + jsonWrite( writer, "_id", getId() ); + } + + + string Entity::_getString() const + { + string s = Inherit::_getString(); + s.insert( 1, "id:"+getString(_id)+" " ); + return s; + } + + + Record* Entity::_getRecord() const + { Record* record = Inherit::_getRecord(); if (record) { - record->add(getSlot("_id", _id)); - Occurrence occurrence = Occurrence(this); - if (occurrence.hasProperty()) - record->add(getSlot("Occurrence", occurrence)); + record->add( getSlot("_id", _id) ); + Occurrence occurrence = Occurrence(this); + if (occurrence.hasProperty()) + record->add( getSlot("Occurrence", occurrence) ); } return record; -} + } + JsonEntity::JsonEntity (unsigned long flags) + : JsonDBo(flags) + { + add( "_id", typeid(uint64_t) ); + } + + +// ------------------------------------------------------------------- +// Class : "JsonEntityRef". + + Initializer jsonEntityRefInit ( 0 ); + + + void JsonEntityRef::initialize () + { JsonTypes::registerType( new JsonEntityRef (JsonWriter::RegisterMode) ); } + + + JsonEntityRef::JsonEntityRef ( unsigned long flags ) + : JsonObject(flags) + { + if (flags & JsonWriter::RegisterMode) return; + + add( "_id", typeid(int64_t) ); + } + + + string JsonEntityRef::getTypeName () const + { return "&Entity"; } + + + JsonEntityRef* JsonEntityRef::clone( unsigned long flags ) const + { return new JsonEntityRef ( flags ); } + + + void JsonEntityRef::toData ( JsonStack& stack ) + { + cdebug.tabw(19,1); + + check( stack, "JsonEntityRef::toData" ); + + unsigned int jsonId = get( stack, "_id" ); + Entity* entity = stack.getEntity( jsonId ); + + cdebug.log(19) << "jsonId:" << jsonId << " entity:" << entity << endl; + + if (entity) { + JsonBaseArray* array = jget< JsonBaseArray >( stack ); + if (array) array->push_back( entity ); + else + cerr << Error( "JsonEntityRef::toData(): Missing JsonBaseArray in stack context." ) << endl; + } else { + cerr << Error( "JsonEntityRef::toData(): No Entity id:%u in stack LUT.", jsonId ) << endl; + } + + update( stack, NULL ); + + cdebug.tabw(19,-1); + } } // End of Hurricane namespace. // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/Error.cpp b/hurricane/src/hurricane/Error.cpp index edbb79c3..76a83b9c 100644 --- a/hurricane/src/hurricane/Error.cpp +++ b/hurricane/src/hurricane/Error.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // diff --git a/hurricane/src/hurricane/Exception.cpp b/hurricane/src/hurricane/Exception.cpp index e97d0ad1..48201a47 100644 --- a/hurricane/src/hurricane/Exception.cpp +++ b/hurricane/src/hurricane/Exception.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./Exception.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -54,5 +54,5 @@ Exception::~Exception() // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/ExtensionGo.cpp b/hurricane/src/hurricane/ExtensionGo.cpp index 4cc5aae4..8d67ddc5 100644 --- a/hurricane/src/hurricane/ExtensionGo.cpp +++ b/hurricane/src/hurricane/ExtensionGo.cpp @@ -1,7 +1,6 @@ - // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -19,12 +18,7 @@ // License along with Hurricane. If not, see // . // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | H U R R I C A N E | // | V L S I B a c k e n d D a t a - B a s e | // | | @@ -32,10 +26,7 @@ // | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Module : "./ExtensionGo.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ #include "hurricane/Error.h" @@ -59,22 +50,22 @@ namespace Hurricane { void ExtensionGo::_preDestroy () { - ltrace(10) << "ExtensionGo::_preDestroy() - " << (void*)this << endl; + cdebug.log(18) << "ExtensionGo::_preDestroy() - " << (void*)this << endl; Go::_preDestroy (); } void ExtensionGo::materialize () { - if ( !isMaterialized() ) { - if ( _cell ) { - ExtensionSlice* slice = _cell->getExtensionSlice ( getName() ); - if ( !slice ) slice = ExtensionSlice::_create ( _cell, getName() ); - QuadTree* quadTree = slice->_getQuadTree (); - quadTree->insert ( this ); - _cell->_fit ( quadTree->getBoundingBox() ); + if (not isMaterialized()) { + if (_cell) { + ExtensionSlice* slice = _cell->getExtensionSlice( getName() ); + if (not slice) slice = ExtensionSlice::_create( _cell, getName() ); + QuadTree* quadTree = slice->_getQuadTree(); + quadTree->insert( this ); + _cell->_fit( quadTree->getBoundingBox() ); } else { - cerr << Warning("%s not inserted into QuadTree.",getString(this).c_str()) << endl; + cerr << Warning( "%s not inserted into QuadTree.", getString(this).c_str() ) << endl; } } } @@ -82,20 +73,19 @@ namespace Hurricane { void ExtensionGo::unmaterialize () { - //ltrace(9) << "ExtensionGo::unmaterialize() - " << (void*)this << endl; - //ltracein(9); + cdebug.log(18,1) << "ExtensionGo::unmaterialize() - start" << (void*)this << endl; if ( isMaterialized() ) { - ExtensionSlice* slice = _cell->getExtensionSlice ( getName() ); - if ( slice ) { - _cell->_unfit ( getBoundingBox() ); - slice->_getQuadTree()->remove ( this ); - if ( slice->isEmpty() ) slice->_destroy (); + ExtensionSlice* slice = _cell->getExtensionSlice( getName() ); + if (slice) { + _cell->_unfit( getBoundingBox() ); + slice->_getQuadTree()->remove( this ); + if (slice->isEmpty()) slice->_destroy(); } } - //ltrace(9) << "ExtensionGo::unmaterialize() - exit" << endl; - //ltraceout(9); + cdebug.tabw(18,-1); + cdebug.log(18) << "ExtensionGo::unmaterialize() - completed" << endl; } @@ -114,7 +104,7 @@ namespace Hurricane { string ExtensionGo::_getString () const { string s = Go::_getString(); - s.insert ( s.length() - 1, " " + getString(getName()) ); + //s.insert ( s.length() - 1, " " + getString(getName()) ); return s; } diff --git a/hurricane/src/hurricane/ExtensionSlice.cpp b/hurricane/src/hurricane/ExtensionSlice.cpp index 81d9183e..39fc9809 100644 --- a/hurricane/src/hurricane/ExtensionSlice.cpp +++ b/hurricane/src/hurricane/ExtensionSlice.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -66,7 +66,7 @@ namespace Hurricane { ExtensionSlice::~ExtensionSlice () { - ltrace(10) << "ExtensionSlice::~ExtensionSlice() - " << (void*)this << endl; + cdebug.log(18) << "ExtensionSlice::~ExtensionSlice() - " << (void*)this << endl; _cell->_removeSlice ( this ); } diff --git a/hurricane/src/hurricane/FileReadGzStream.cpp b/hurricane/src/hurricane/FileReadGzStream.cpp new file mode 100644 index 00000000..cb51bf4f --- /dev/null +++ b/hurricane/src/hurricane/FileReadGzStream.cpp @@ -0,0 +1,83 @@ +// -*- mode: C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC 2016-2016, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./FileReadGzStream.h" | +// +-----------------------------------------------------------------+ + + +#include +#include "hurricane/Error.h" +#include "hurricane/FileReadGzStream.h" + + +namespace Hurricane { + + +// ------------------------------------------------------------------- +// Class : "FileReadGzStream". + + FileReadGzStream::FileReadGzStream ( std::FILE* fp + , char* buffer + , size_t bufferSize + ) + : fp_ (fp) + , bzfp_ (NULL) + , buffer_ (buffer) + , bufferSize_(bufferSize) + , bufferLast_(0) + , current_ (buffer_) + , readCount_ (0) + , count_ (0) + , eof_ (false) + , bzerror_ (BZ_OK) + { + assert(fp_ != 0); + assert(bufferSize >= 4); + + bzfp_ = BZ2_bzReadOpen( &bzerror_, fp_, 0, 0, NULL, 0 ); + if (bzerror_ != BZ_OK) { + cerr << Error( "FileReadGzStream::FileReadGzstream(): Unable to initialize bzip2 stream." ) << endl; + eof_ = true; + } + + Read(); + } + + + void FileReadGzStream::Read () + { + if (current_ < bufferLast_) + ++current_; + else if (not eof_) { + count_ += readCount_; + readCount_ = BZ2_bzRead( &bzerror_, bzfp_, buffer_, bufferSize_ ); + bufferLast_ = buffer_ + readCount_ - 1; + current_ = buffer_; + + if (readCount_ < bufferSize_) { + buffer_[readCount_] = '\0'; + ++bufferLast_; + eof_ = true; + } + + if (bzerror_ != BZ_OK) { + eof_ = true; + if (bzerror_ != BZ_STREAM_END) { + cerr << Error( "FileReadGzStream::Read(): Unexpected termination of bzip2 stream." ) << endl; + } + BZ2_bzReadClose ( &bzerror_, bzfp_ ); + } + } + } + + +} // Hurricane namespace. diff --git a/hurricane/src/hurricane/FileWriteGzStream.cpp b/hurricane/src/hurricane/FileWriteGzStream.cpp new file mode 100644 index 00000000..31b20380 --- /dev/null +++ b/hurricane/src/hurricane/FileWriteGzStream.cpp @@ -0,0 +1,79 @@ +// -*- mode: C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC 2016-2016, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./FileWriteGzStream.h" | +// +-----------------------------------------------------------------+ + + +#include +#include "hurricane/Error.h" +#include "hurricane/FileWriteGzStream.h" + + +namespace Hurricane { + + +// ------------------------------------------------------------------- +// Class : "FileWriteGzStream". + + FileWriteGzStream::FileWriteGzStream ( std::FILE* fp + , char* buffer + , size_t bufferSize + ) + : fp_ (fp) + , bzfp_ (NULL) + , buffer_ (buffer) + , bufferEnd_(buffer + bufferSize), current_(buffer_) + , bzerror_ (BZ_OK) + { + assert(fp_ != 0); + + bzfp_ = BZ2_bzWriteOpen( &bzerror_, fp_, 9, 0, 0 ); + if (bzerror_ != BZ_OK) { + cerr << Error( "FileWriteGzStream::FileWriteGzstream(): Unable to initialize bzip2 stream." ) << endl; + } + } + + + FileWriteGzStream::~FileWriteGzStream () + { + if (not bzfp_) return; + + unsigned int bytesin = 0; + unsigned int bytesout = 0; + + BZ2_bzWriteClose( &bzerror_, bzfp_, 0, &bytesin, &bytesout ); + if (bzerror_ != BZ_OK) { + cerr << Error( "FileWriteGzStream::~FileWritegzstream(): I/O error while closing stream." ) << endl; + } + } + + + void FileWriteGzStream::Flush () + { + if (current_ != buffer_) { + BZ2_bzWrite( &bzerror_,bzfp_, buffer_, static_cast(current_ - buffer_) ); + if (bzerror_ != BZ_OK) { + unsigned int bytesin = 0; + unsigned int bytesout = 0; + + BZ2_bzWriteClose( &bzerror_, bzfp_, 0, &bytesin, &bytesout ); + if (bzerror_ != BZ_OK) { + cerr << Error( "FileWriteGzStream::Write(): I/O error in bzip2 stream." ) << endl; + } + } + current_ = buffer_; + } + } + + +} // Hurricane namespace. diff --git a/hurricane/src/hurricane/Flags.cpp b/hurricane/src/hurricane/Flags.cpp index a81928e9..ffecdbe5 100644 --- a/hurricane/src/hurricane/Flags.cpp +++ b/hurricane/src/hurricane/Flags.cpp @@ -1,6 +1,6 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // diff --git a/hurricane/src/hurricane/Go.cpp b/hurricane/src/hurricane/Go.cpp index f010983b..be6ffb04 100644 --- a/hurricane/src/hurricane/Go.cpp +++ b/hurricane/src/hurricane/Go.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./Go.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -103,5 +103,5 @@ Record* Go::_getRecord() const // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/Hook.cpp b/hurricane/src/hurricane/Hook.cpp index aab27b2e..5c6d75a7 100644 --- a/hurricane/src/hurricane/Hook.cpp +++ b/hurricane/src/hurricane/Hook.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./Hook.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -187,6 +187,9 @@ class Hook_SlaveHooks : public Collection { // Hook implementation // **************************************************************************************************** +map Hook::_compToHookMap; + + Hook::Hook() // ********* : _nextHook(this) @@ -385,7 +388,30 @@ Record* Hook::_getRecord() const return record; } +string Hook::toJson() const +// ************************ +{ + if (_nextHook == this) return ""; + string s = _getTypeName()+"."+getString(getComponent()->getId()); + return s; +} +void Hook::addCompToHook(const string& tname, Hook::compToHook_t converter) +// ************************************************************************ +{ + _compToHookMap.insert( make_pair(tname,converter) ); +} + +Hook* Hook::compToHook(const string& tname, Component* component) +// ************************************************************** +{ + map::const_iterator iconv = _compToHookMap.find(tname); + if (iconv == _compToHookMap.end()) { + throw Error( "Hook::fromJson(): No converter registered for type name \"%s\"" + , tname.c_str() ); + } + return (*iconv).second(component); +} // **************************************************************************************************** // Hook_Hooks implementation @@ -628,5 +654,5 @@ string Hook_SlaveHooks::Locator::_getString() const // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/Horizontal.cpp b/hurricane/src/hurricane/Horizontal.cpp index 0d013308..cef2f90c 100644 --- a/hurricane/src/hurricane/Horizontal.cpp +++ b/hurricane/src/hurricane/Horizontal.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./Horizontal.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -17,6 +17,8 @@ // not, see . // **************************************************************************************************** +#include "hurricane/DataBase.h" +#include "hurricane/Technology.h" #include "hurricane/Horizontal.h" #include "hurricane/Layer.h" #include "hurricane/BasicLayer.h" @@ -173,6 +175,16 @@ void Horizontal::translate(const DbU::Unit& dy) } } +void Horizontal::_toJson(JsonWriter* writer) const +// *********************************************** +{ + Inherit::_toJson( writer ); + + jsonWrite( writer, "_y" , _y ); + jsonWrite( writer, "_dxSource", _dxSource ); + jsonWrite( writer, "_dxTarget", _dxTarget ); +} + string Horizontal::_getString() const // ********************************** { @@ -191,9 +203,66 @@ Record* Horizontal::_getRecord() const return record; } + +// **************************************************************************************************** +// JsonHorizontal implementation +// **************************************************************************************************** + +Initializer jsonHorizontalInit ( 0 ); + + +void JsonHorizontal::initialize() +// ******************************* +{ JsonTypes::registerType( new JsonHorizontal (JsonWriter::RegisterMode) ); } + +JsonHorizontal::JsonHorizontal(unsigned long flags) +// ************************************************ + : JsonSegment(flags) +{ + add( "_y" , typeid(uint64_t) ); + add( "_dxSource", typeid(uint64_t) ); + add( "_dxTarget", typeid(uint64_t) ); +} + +string JsonHorizontal::getTypeName() const +// *************************************** +{ return "Horizontal"; } + +JsonHorizontal* JsonHorizontal::clone(unsigned long flags) const +// ************************************************************* +{ return new JsonHorizontal ( flags ); } + +void JsonHorizontal::toData(JsonStack& stack) +// ****************************************** +{ + check( stack, "JsonHorizontal::toData" ); + unsigned int jsonId = presetId( stack ); + + Horizontal* horizontal = Horizontal::create + ( get(stack,".Net") + , DataBase::getDB()->getTechnology()->getLayer( get(stack,"_layer") ) + , DbU::fromDb( get(stack,"_y" ) ) + , DbU::fromDb( get(stack,"_width" ) ) + , DbU::fromDb( get(stack,"_dxSource") ) + , DbU::fromDb( get(stack,"_dxTarget") ) + ); + + JsonNet* jnet = jget( stack ); + if (jnet) { + jnet->addHookLink( horizontal->getBodyHook (), jsonId, get(stack,"_bodyHook" ) ); + jnet->addHookLink( horizontal->getSourceHook(), jsonId, get(stack,"_sourceHook") ); + jnet->addHookLink( horizontal->getTargetHook(), jsonId, get(stack,"_targetHook") ); + } else { + cerr << Error( "JsonHorizontal::toData(): Missing (Json)Net in stack context." ) << endl; + } + +// Hook/Ring rebuild are done as a post-process. + update( stack, horizontal ); +} + } // End of Hurricane namespace. // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/HyperNet.cpp b/hurricane/src/hurricane/HyperNet.cpp index 0260b049..7f6c5091 100644 --- a/hurricane/src/hurricane/HyperNet.cpp +++ b/hurricane/src/hurricane/HyperNet.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./HyperNet.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -253,6 +253,78 @@ class HyperNet_LeafPlugOccurrences : public Collection { }; +// **************************************************************************************************** +// HyperNet_ComponentOccurrences definition +// **************************************************************************************************** + +class HyperNet_ComponentOccurrences : public Collection { +// ***************************************************************** + +// Types +// ***** + + public: typedef Collection Inherit; + + public: class Locator : public Hurricane::Locator { + // ********************************************************* + + public: typedef Hurricane::Locator Inherit; + + private: bool _withLeafCells; + private: OccurrenceLocator _netOccurrenceLocator; + private: ComponentLocator _componentLocator; + private: Occurrence _componentOccurrence; + + public: Locator(); + public: Locator(const HyperNet* hyperNet, bool withLeafCells = false, bool doExtraction = false, bool allowInterruption = false); + public: Locator(const Locator& locator); + + public: Locator& operator=(const Locator& locator); + + public: virtual Occurrence getElement() const; + public: virtual Hurricane::Locator* getClone() const; + + public: virtual bool isValid() const; + + public: virtual void progress(); + + public: virtual string _getString() const; + + }; + +// Attributes +// ********** + + private: const HyperNet* _hyperNet; + private: bool _withLeafCells; + private: bool _doExtraction; + private: bool _allowInterruption; + +// Constructors +// ************ + + public: HyperNet_ComponentOccurrences(); + public: HyperNet_ComponentOccurrences(const HyperNet* hyperNet, bool withLeafCells = false, bool doExtraction = false, bool allowInterruption = false); + public: HyperNet_ComponentOccurrences(const HyperNet_ComponentOccurrences& componentOccurrences); + +// Operators +// ********* + + public: HyperNet_ComponentOccurrences& operator=(const HyperNet_ComponentOccurrences& componentOccurrences); + +// Accessors +// ********* + + public: virtual Collection* getClone() const; + public: virtual Hurricane::Locator* getLocator() const; + +// Others +// ****** + + public: virtual string _getString() const; + +}; + // **************************************************************************************************** // HyperNet implementation @@ -292,6 +364,12 @@ Occurrences HyperNet::getLeafPlugOccurrences(bool doExtraction, bool allowInterr return HyperNet_LeafPlugOccurrences(this, doExtraction, allowInterruption); } +Occurrences HyperNet::getComponentOccurrences(bool doExtraction, bool allowInterruption) const +// ******************************************************************************************* +{ + return HyperNet_ComponentOccurrences(this, doExtraction, allowInterruption); +} + string HyperNet::_getString() const // ******************************** { @@ -1001,9 +1079,188 @@ string HyperNet_LeafPlugOccurrences::Locator::_getString() const } +// **************************************************************************************************** +// HyperNet_ComponentOccurrences implementation +// **************************************************************************************************** + +HyperNet_ComponentOccurrences::HyperNet_ComponentOccurrences() +// *********************************************************** +: Inherit(), + _hyperNet(NULL), + _withLeafCells(false), + _doExtraction(false), + _allowInterruption(false) +{ +} + + HyperNet_ComponentOccurrences::HyperNet_ComponentOccurrences(const HyperNet* hyperNet, bool withLeafCells, bool doExtraction, bool allowInterruption) +// **************************************************************************************************************************************************** +: Inherit(), + _hyperNet(hyperNet), + _withLeafCells(withLeafCells), + _doExtraction(doExtraction), + _allowInterruption(allowInterruption) +{ +} + +HyperNet_ComponentOccurrences::HyperNet_ComponentOccurrences(const HyperNet_ComponentOccurrences& netOccurrences) +// ************************************************************************************************************** +: Inherit(), + _hyperNet(netOccurrences._hyperNet), + _withLeafCells(netOccurrences._withLeafCells), + _doExtraction(netOccurrences._doExtraction), + _allowInterruption(netOccurrences._allowInterruption) +{ +} + +HyperNet_ComponentOccurrences& HyperNet_ComponentOccurrences::operator=(const HyperNet_ComponentOccurrences& netOccurrences) +// ************************************************************************************************************************* +{ + _hyperNet = netOccurrences._hyperNet; + _withLeafCells = netOccurrences._withLeafCells; + _doExtraction = netOccurrences._doExtraction; + _allowInterruption = netOccurrences._allowInterruption; + return *this; +} + +Collection* HyperNet_ComponentOccurrences::getClone() const +// ******************************************************************** +{ + return new HyperNet_ComponentOccurrences(*this); +} + +Locator* HyperNet_ComponentOccurrences::getLocator() const +// ******************************************************************* +{ + return new Locator(_hyperNet, _withLeafCells, _doExtraction, _allowInterruption); +} + +string HyperNet_ComponentOccurrences::_getString() const +// ***************************************************** +{ + string s = "<" + _TName("HyperNet::ComponentOccurrences"); + if (_hyperNet) { + s += " " + getString(_hyperNet); + if (_withLeafCells) { + s += " LEAFS"; + if (_doExtraction) { + s += " DO_EXTRACTION"; + if (_allowInterruption) s += " ALLOW_INTERRUPTION"; + } + } + } + s += ">"; + return s; +} + + + +// **************************************************************************************************** +// HyperNet_ComponentOccurrences::Locator implementation +// **************************************************************************************************** + +HyperNet_ComponentOccurrences::Locator::Locator() +// ********************************************** +: Inherit(), + _netOccurrenceLocator(), + _componentLocator(), + _componentOccurrence() + +{ +} + +HyperNet_ComponentOccurrences::Locator::Locator(const HyperNet* hyperNet, bool withLeafCells, bool doExtraction, bool allowInterruption) +// ************************************************************************************************************************************* +: Inherit(), + _withLeafCells(withLeafCells), + _netOccurrenceLocator(), + _componentLocator(), + _componentOccurrence() +{ + if (hyperNet) { + _netOccurrenceLocator = hyperNet->getNetOccurrences(doExtraction,allowInterruption).getLocator(); + progress(); + } +} + +HyperNet_ComponentOccurrences::Locator::Locator(const Locator& locator) +// ******************************************************************** +: Inherit(), + _withLeafCells(locator._withLeafCells), + _netOccurrenceLocator(locator._netOccurrenceLocator), + _componentLocator(locator._componentLocator), + _componentOccurrence(locator._componentOccurrence) +{ +} + +HyperNet_ComponentOccurrences::Locator& HyperNet_ComponentOccurrences::Locator::operator=(const Locator& locator) +// ************************************************************************************************************** +{ + _withLeafCells = locator._withLeafCells; + _netOccurrenceLocator = locator._netOccurrenceLocator; + _componentLocator = locator._componentLocator; + _componentOccurrence = locator._componentOccurrence; + return *this; +} + +Occurrence HyperNet_ComponentOccurrences::Locator::getElement() const +// ****************************************************************** +{ + return _componentOccurrence; +} + +Locator* HyperNet_ComponentOccurrences::Locator::getClone() const +// ************************************************************************** +{ + return new Locator(*this); +} + +bool HyperNet_ComponentOccurrences::Locator::isValid() const +// ********************************************************* +{ + return _componentOccurrence.isValid(); +} + + +void HyperNet_ComponentOccurrences::Locator::progress() +// **************************************************** +{ + _componentOccurrence = Occurrence(); + while ( not _componentOccurrence.isValid() ) { + if (_componentLocator.isValid()) { + Path path = _netOccurrenceLocator.getElement().getPath(); + Component* component = _componentLocator.getElement(); + _componentLocator.progress(); + + _componentOccurrence = Occurrence( component, path.getHeadPath() ); + } else { + if (_netOccurrenceLocator.isValid()) { + Occurrence netOccurrence = _netOccurrenceLocator.getElement(); + _netOccurrenceLocator.progress(); + + Net* net = static_cast( netOccurrence.getEntity() ); + if (_withLeafCells or not net->getCell()->isTerminal()) { + _componentLocator = net->getComponents().getLocator(); + } + } else + break; + } + } +} + +string HyperNet_ComponentOccurrences::Locator::_getString() const +// ************************************************************** +{ + string s = "<" + _TName("HyperNet::ComponentOccurrences::Locator"); + s += " " + getString(_netOccurrenceLocator); + s += "+" + getString(_componentLocator); + s += ">"; + return s; +} + } // End of Hurricane namespace. // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/Initializer.cpp b/hurricane/src/hurricane/Initializer.cpp new file mode 100644 index 00000000..c74cc376 --- /dev/null +++ b/hurricane/src/hurricane/Initializer.cpp @@ -0,0 +1,78 @@ +// -*- C++ -*- +// +// Copyright (c) BULL S.A. 2015-2016, All Rights Reserved +// +// This file is part of Hurricane. +// +// Hurricane is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// Hurricane is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- +// TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU +// General Public License for more details. +// +// You should have received a copy of the Lesser GNU General Public +// License along with Hurricane. If not, see +// . +// +// +-----------------------------------------------------------------+ +// | H U R R I C A N E | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Authors : Jean-Paul Chaput | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./Initializer.cpp" | +// +-----------------------------------------------------------------+ + + +#include +#include "hurricane/Initializer.h" + + +namespace Hurricane { + + using namespace std; + + +// ------------------------------------------------------------------- +// Class : "Init". + + bool Init::_run = false; + Init::InitializerMap* Init::_initializers = NULL; + + + void Init::destroy () + { + if (_initializers) delete _initializers; + _initializers = NULL; + _run = false; + } + + + Init::InitializerMap& Init::initializers () + { + if (not _initializers) _initializers = new InitializerMap(); + return *_initializers; + } + + + void Init::addInitializer ( unsigned int order,initializer_t initFunction ) + { initializers().insert( make_pair(order,initFunction) ); } + + + bool Init::runOnce () + { + if (_run) return false; + + for ( auto init : initializers() ) init.second(); + _run = true; + + return true; + } + + +} // Hurricane namespace. diff --git a/hurricane/src/hurricane/Instance.cpp b/hurricane/src/hurricane/Instance.cpp index ae5dbb9e..90060f79 100644 --- a/hurricane/src/hurricane/Instance.cpp +++ b/hurricane/src/hurricane/Instance.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./Instance.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -20,6 +20,7 @@ #include "hurricane/Warning.h" #include "hurricane/UpdateSession.h" #include "hurricane/SharedPath.h" +#include "hurricane/DataBase.h" #include "hurricane/Instance.h" #include "hurricane/Cell.h" #include "hurricane/Net.h" @@ -30,7 +31,6 @@ namespace Hurricane { - // **************************************************************************************************** // Filters declaration & implementation // **************************************************************************************************** @@ -201,7 +201,10 @@ Instance* Instance::create(Cell* cell, const Name& name, Cell* masterCell, bool // **************************************************************************************** { if (not cell) - throw Error( "Instance::create(): NULL master Cell argument." ); + throw Error( "Instance::create(): NULL owner Cell argument for %s.", getString(name).c_str() ); + + if (not masterCell) + throw Error( "Instance::create(): NULL master Cell argument for %s.", getString(name).c_str() ); // if (cell->isUniquified()) // throw Error( "Instance::create(): %s master Cell is an uniquified copy.", getString(cell).c_str() ); @@ -217,7 +220,10 @@ Instance* Instance::create(Cell* cell, const Name& name, Cell* masterCell, const // ********************************************************************************************************************************************************************** { if (not cell) - throw Error( "Instance::create(): NULL master Cell argument." ); + throw Error( "Instance::create(): NULL owner Cell argument for %s.", getString(name).c_str() ); + + if (not masterCell) + throw Error( "Instance::create(): NULL master Cell argument for %s.", getString(name).c_str() ); // if (cell->isUniquified()) // throw Error( "Instance::create(): %s master Cell is an uniquified copy.", getString(cell).c_str() ); @@ -404,102 +410,123 @@ void Instance::setTransformation(const Transformation& transformation) } } -void Instance::setPlacementStatus(const PlacementStatus& placementstatus) +void Instance::setPlacementStatus(const PlacementStatus& placementStatus) // ********************************************************************** { - if (placementstatus != _placementStatus) { + if (placementStatus != _placementStatus) { invalidate(true); - if (_placementStatus == PlacementStatus::UNPLACED) { + if (placementStatus & (PlacementStatus::PLACED|PlacementStatus::FIXED)) { materialize (); - } else if (placementstatus == PlacementStatus::UNPLACED) + } else if (placementStatus == PlacementStatus::UNPLACED) unmaterialize (); - _placementStatus = placementstatus; + _placementStatus = placementStatus; } } void Instance::setMasterCell(Cell* masterCell, bool secureFlag) // ************************************************************ { - if (masterCell != _masterCell) { - UpdateSession::open(); + cdebug.log(18,1) << "Instance::setMasterCell() on " << this << endl; + cdebug.log(18) << "NEW masterCell:" << masterCell << endl; - if (!masterCell) - throw Error("Can't set master : null master cell"); + if (masterCell != _masterCell) { + UpdateSession::open(); - if (secureFlag && _cell->isCalledBy(masterCell)) - throw Error("Can't set master : cyclic construction"); + if (!masterCell) + throw Error("Can't set master : null master cell"); - list connectedPlugList; - list masterNetList; - for_each_plug(plug, getConnectedPlugs()) { - Net* masterNet = masterCell->getNet(plug->getMasterNet()->getName()); - if (!masterNet || !masterNet->isExternal()) - throw Error("Can't set master (bad master net matching)"); - connectedPlugList.push_back(plug); - masterNetList.push_back(masterNet); - end_for; - } + if (secureFlag && _cell->isCalledBy(masterCell)) + throw Error("Can't set master : cyclic construction"); - for_each_shared_path(sharedPath, _getSharedPathes()) { - if (!sharedPath->getTailSharedPath()) - // if the tail is empty the SharedPath isn't impacted by the change - delete sharedPath; - end_for; - } - - invalidate(true); - - for_each_plug(plug, getUnconnectedPlugs()) { - plug->_destroy(); - end_for; - } - - while (!connectedPlugList.empty() && !masterNetList.empty()) { - Plug* plug = connectedPlugList.front(); - Net* masterNet = masterNetList.front(); - _plugMap._remove(plug); - plug->_setMasterNet(masterNet); - _plugMap._insert(plug); - connectedPlugList.pop_front(); - masterNetList.pop_front(); - } - - _masterCell->_getSlaveInstanceSet()._remove(this); - _masterCell = masterCell; - _masterCell->_getSlaveInstanceSet()._insert(this); - - for_each_net(externalNet, _masterCell->getExternalNets()) { - if (!getPlug(externalNet)) Plug::_create(this, externalNet); - end_for; - } - - UpdateSession::close(); + list connectedPlugList; + list masterNetList; + for_each_plug(plug, getConnectedPlugs()) { + Net* masterNet = masterCell->getNet(plug->getMasterNet()->getName()); + if (!masterNet || !masterNet->isExternal()) + throw Error("Can't set master (bad master net matching)"); + connectedPlugList.push_back(plug); + masterNetList.push_back(masterNet); + end_for; } + + for_each_shared_path(sharedPath, _getSharedPathes()) { + if (!sharedPath->getTailSharedPath()) + // if the tail is empty the SharedPath isn't impacted by the change + delete sharedPath; + end_for; + } + + invalidate(true); + + for_each_plug(plug, getUnconnectedPlugs()) { + plug->_destroy(); + end_for; + } + + while (!connectedPlugList.empty() && !masterNetList.empty()) { + Plug* plug = connectedPlugList.front(); + Net* masterNet = masterNetList.front(); + _plugMap._remove(plug); + plug->_setMasterNet(masterNet); + _plugMap._insert(plug); + connectedPlugList.pop_front(); + masterNetList.pop_front(); + } + + cdebug.log(18) << "Remove " << this << " from " << _masterCell << endl; + _masterCell->_getSlaveInstanceSet()._remove(this); + _masterCell = masterCell; + + cdebug.log(18) << "Add (before) " << this << " to " << _masterCell << endl; + _masterCell->isUnique(); + _masterCell->_getSlaveInstanceSet()._insert(this); + cdebug.log(18) << "Add (after) " << this << " to " << _masterCell << endl; + _masterCell->isUnique(); + + for_each_net(externalNet, _masterCell->getExternalNets()) { + if (!getPlug(externalNet)) Plug::_create(this, externalNet); + end_for; + } + + UpdateSession::close(); + } + + cdebug.tabw(19,-1); } void Instance::uniquify() // ********************** { - if (_masterCell->isUniquified()) { - cerr << Warning( "Instance::uniquify(): Master Cell %s of %s is already uniquified, cancelled." + if (_masterCell->isUnique()) { + cerr << Warning( "Instance::uniquify(): Master Cell %s of %s is unique or already uniquified, cancelled." , getString(_masterCell->getName()).c_str() , getString(getName()).c_str() ) << endl; return; } + + if (not _getSharedPathMap().isEmpty()) { + cerr << Warning( "Instance::uniquify(): While uniquifying model %s of instance %s, SharedPathMap is not empty.\n" + " (%u Entity's Occurrences will still uses the original master Cell)" + , getString(_masterCell->getName()).c_str() + , getString(getName()).c_str() + , _getSharedPathMap()._getSize() + ) << endl; + } + setMasterCell( _masterCell->getClone() ); } void Instance::slaveAbutmentBox() // ****************************** { - if (not _masterCell->isUniquified()) uniquify(); + if (not _masterCell->isUnique()) uniquify(); + _masterCell->slaveAbutmentBox( getCell() ); +//_masterCell->_setShuntedPath( Path(getCell()->getShuntedPath(),this) ); setTransformation( Transformation() ); setPlacementStatus( Instance::PlacementStatus::PLACED ); - _masterCell->slaveAbutmentBox( getCell() ); - _masterCell->_setShuntedPath( Path(getCell()->getShuntedPath(),this) ); } Instance* Instance::getClone(Cell* cloneCell) const @@ -512,6 +539,13 @@ Instance* Instance::getClone(Cell* cloneCell) const , getPlacementStatus() ); + if (not clone->_getSharedPathMap().isEmpty()) { + cerr << Warning( "Instance::getClone(): While cloning instance %s, SharedPathMap is not empty.\n" + " (Occurrence will still uses the original instance)" + , getString(getName()).c_str() + ) << endl; + } + for( Plug* iplug : getPlugs() ) { if (iplug->isConnected()) { Plug* clonePlug = clone->getPlug( iplug->getMasterNet() ); @@ -556,16 +590,17 @@ void Instance::_postCreate() void Instance::_preDestroy() // ************************ { - for_each_shared_path(sharedPath, _getSharedPathes()) delete sharedPath; end_for; + for ( SharedPath* sharedPath : _getSharedPathes() ) delete sharedPath; - Inherit::_preDestroy(); + Inherit::_preDestroy(); - for_each_plug(plug, getPlugs()) plug->_destroy(); end_for; + Plugs plugs = getPlugs(); + while ( plugs.getFirst() ) plugs.getFirst()->_destroy(); - _masterCell->_getSlaveInstanceSet()._remove(this); - _cell->_getInstanceMap()._remove(this); + _masterCell->_getSlaveInstanceSet()._remove(this); + _cell->_getInstanceMap()._remove(this); - if (_masterCell->isUniquified()) _masterCell->destroy(); + if (_masterCell->isUniquified()) _masterCell->destroy(); } string Instance::_getString() const @@ -595,6 +630,24 @@ Record* Instance::_getRecord() const return record; } +void Instance::_toJson( JsonWriter* writer ) const +// *********************************************** +{ + Inherit::_toJson( writer ); + + jsonWrite( writer, "_name" , getName() ); + jsonWrite( writer, "_masterCell" , _masterCell->getHierarchicalName() ); + jsonWrite( writer, "_transformation" , &_transformation ); + jsonWrite( writer, "_placementStatus", _placementStatus ); +} + +void Instance::_toJsonCollections(JsonWriter* writer) const +// ******************************************************** +{ + jsonWrite( writer, "+plugMap", getPlugs() ); + Inherit::_toJsonCollections( writer ); +} + // **************************************************************************************************** // Instance::PlugMap implementation // **************************************************************************************************** @@ -672,13 +725,20 @@ void Instance::SharedPathMap::_setNextElement(SharedPath* sharedPath, SharedPath Instance::PlacementStatus::PlacementStatus(const Code& code) // ********************************************************* : _code(code) -{ -} +{ } Instance::PlacementStatus::PlacementStatus(const PlacementStatus& placementstatus) // ******************************************************************************* : _code(placementstatus._code) +{ } + +Instance::PlacementStatus::PlacementStatus(string s) +// ************************************************* +: _code(UNPLACED) { + if (s == "UNPLACED") _code = UNPLACED; + else if (s == "PLACED" ) _code = PLACED; + else if (s == "FIXED" ) _code = FIXED; } Instance::PlacementStatus& Instance::PlacementStatus::operator=(const PlacementStatus& placementstatus) @@ -702,9 +762,56 @@ Record* Instance::PlacementStatus::_getRecord() const return record; } + +// **************************************************************************************************** +// JsonInstance implementation +// **************************************************************************************************** + +Initializer jsonInstanceInit ( 0 ); + +void JsonInstance::initialize() +// ***************************** +{ JsonTypes::registerType( new JsonInstance (JsonWriter::RegisterMode) ); } + +JsonInstance::JsonInstance(unsigned long flags) +// ******************************************** + : JsonEntity(flags) +{ + add( "_name" , typeid(string) ); + add( "_masterCell" , typeid(string) ); + add( "_transformation" , typeid(Transformation*) ); + add( "_placementStatus", typeid(string) ); + add( "+plugMap" , typeid(JsonArray) ); +} + +string JsonInstance::getTypeName() const +// ************************************* +{ return "Instance"; } + +JsonInstance* JsonInstance::clone(unsigned long flags) const +// ********************************************************* +{ return new JsonInstance ( flags ); } + +void JsonInstance::toData(JsonStack& stack) +// **************************************** +{ + check( stack, "JsonInstance::toData" ); + presetId( stack ); + + Instance* instance = Instance::create + ( get(stack,".Cell") + , get(stack,"_name") + , DataBase::getDB()->getCell( get(stack,"_masterCell"), DataBase::NoFlags ) + , get(stack,"_transformation") + , Instance::PlacementStatus(get(stack,"_placementStatus") ) + ); + + update( stack, instance ); +} + } // End of Hurricane namespace. // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/Interruption.cpp b/hurricane/src/hurricane/Interruption.cpp index 255455ec..c8aade2d 100644 --- a/hurricane/src/hurricane/Interruption.cpp +++ b/hurricane/src/hurricane/Interruption.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./Interruption.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -65,5 +65,5 @@ string Interruption::_getString() const // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/Interval.cpp b/hurricane/src/hurricane/Interval.cpp index a3f980b8..073be0ae 100644 --- a/hurricane/src/hurricane/Interval.cpp +++ b/hurricane/src/hurricane/Interval.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./Interval.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -265,5 +265,5 @@ Record* Interval::_getRecord() const // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/JsonObject.cpp b/hurricane/src/hurricane/JsonObject.cpp new file mode 100644 index 00000000..5467c64d --- /dev/null +++ b/hurricane/src/hurricane/JsonObject.cpp @@ -0,0 +1,287 @@ +// -*- C++ -*- +// +// Copyright (c) BULL S.A. 2015-2016, All Rights Reserved +// +// This file is part of Hurricane. +// +// Hurricane is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// Hurricane is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- +// TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU +// General Public License for more details. +// +// You should have received a copy of the Lesser GNU General Public +// License along with Hurricane. If not, see +// . +// +// +-----------------------------------------------------------------+ +// | H U R R I C A N E | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul Chaput | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./JsonObject.cpp" | +// +-----------------------------------------------------------------+ + + +// Needed for registering. May be deleted later. +#include "hurricane/Initializer.h" +#include "hurricane/DebugSession.h" +#include "hurricane/Warning.h" +#include "hurricane/Library.h" +#include "hurricane/Cell.h" + + +namespace Hurricane { + + using namespace std; + + +// ------------------------------------------------------------------- +// Class : "JsonObject". + + JsonObject::JsonObject ( unsigned long flags ) + : _flags (flags) + , _name () + , _stackeds () + , _attributes () + , _collections() + , _object () + { } + + + JsonObject::~JsonObject () + { } + + + bool JsonObject::isDummy () const + { return false; } + + + void JsonObject::add ( const string& key, type_index tid ) + { + if (key.empty()) { + cerr << "[ERROR] JsonObject::add(): Attempt to add attribute with an empty name, ignored." + << endl; + return; + } + if (has(key)) { + cerr << "[ERROR] JsonObject::add(): Attempt to add attribute \"" << key << "\" twice, cancelled." + << endl; + return; + } + + switch ( key[0] ) { + case '.': _stackeds .push_back( JsonAttribute(key,tid) ); return; + case '_': _attributes .push_back( JsonAttribute(key,tid) ); return; + case '+': _collections.push_back( JsonAttribute(key,tid) ); return; + default: break; + } + + cerr << "[ERROR] JsonObject::add(): Key name \"" << key + << "\" do not follow naming convention, cancelled." << endl; + } + + + void JsonObject::remove ( const std::string& key ) + { + if (key.empty()) { + cerr << Error( "JsonObject::remove(): Attempt to remove attribute with an empty name, ignored." ) << endl; + return; + } + + switch ( key[0] ) { + case '.': + for ( auto it = _stackeds.begin() ; it != _stackeds.end() ; ++it ) + if (key == (*it).key()) { _stackeds.erase(it); break; } + break; + case '_': + for ( auto it = _attributes.begin() ; it != _attributes.end() ; ++it ) + if (key == (*it).key()) { _attributes.erase(it); break; } + break; + case '+': + for ( auto it = _collections.begin() ; it != _collections.end() ; ++it ) + if (key == (*it).key()) { _collections.erase(it); break; } + break; + } + } + + + bool JsonObject::has ( const std::string& key ) const + { + if (key.empty()) return false; + switch ( key[0] ) { + case '.': + for ( size_t i=0 ; i<_stackeds.size() ; ++i ) + if (key == _stackeds[i].key()) return true; + break; + case '_': + for ( size_t i=0 ; i<_attributes.size() ; ++i ) + if (key == _attributes[i].key()) return true; + break; + case '+': + for ( size_t i=0 ; i<_collections.size() ; ++i ) + if (key == _collections[i].key()) return true; + break; + } + return false; + } + + + bool JsonObject::check ( JsonStack& stack, string fname ) const + { + for ( size_t i=0 ; i<_stackeds.size() ; ++i ) { + if (not stack.rhas(_stackeds[i].key())) { + cerr << Error( "%s(): Stack is missing context element with key \"%s\"" + , fname.c_str(), _stackeds[i].key().c_str() ) << endl; + return false; + } + } + for ( size_t i=0 ; i<_attributes.size() ; ++i ) { + if (not stack.rhas(_attributes[i].key())) { + cerr << Error( "%s(): Stack is missing attribute element with key \"%s\"" + , fname.c_str(), _attributes[i].key().c_str() ) << endl; + return false; + } + } + return true; + } + + + void JsonObject::toData ( JsonStack& ) + { } + + + unsigned int JsonObject::presetId ( JsonStack& stack ) + { + unsigned int jsonId = get( stack, "_id" ); + if (issetFlags(JsonWriter::DesignBlobMode)) { + Entity::setNextId( jsonId ); + } + return jsonId; + } + + + void JsonObject::print ( ostream& o ) const + { + o << tab << "JsonObject for type: " << getTypeName() << endl; + for ( size_t i=0 ; i<_stackeds.size() ; ++i ) + o << tab << "key:" << left << setw(20) << _stackeds[i].key() + << " type:" << _stackeds[i].tid().name() << endl; + + for ( size_t i=0 ; i<_attributes.size() ; ++i ) + o << tab << "key:" << left << setw(20) << _attributes[i].key() + << " type:" << _attributes[i].tid().name() << endl; + + for ( size_t i=0 ; i<_collections.size() ; ++i ) + o << tab << "key:" << left << setw(20) << _collections[i].key() + << " type:" << _collections[i].tid().name() << endl; + } + + +// ------------------------------------------------------------------- +// Class : "JsonKey". + + JsonKey::JsonKey ( const string& key ) + : JsonObject(0) + , _key (key) + { } + + + string JsonKey::getTypeName () const { return _key; } + JsonKey* JsonKey::clone ( unsigned long ) const { return new JsonKey ( *this ); } + + +// ------------------------------------------------------------------- +// Class : "JsonDummy". + + JsonDummy::JsonDummy () + : JsonObject(0) + , _typename ("dummy") + { } + + + bool JsonDummy::isDummy () const { return true; } + string JsonDummy::getTypeName () const { return _typename; } + void JsonDummy::setTypeName ( const string& name ) { _typename=name; } + JsonDummy* JsonDummy::clone ( unsigned long ) const { return new JsonDummy ( *this ); } + + +// ------------------------------------------------------------------- +// Class : "JsonTypes". + + Initializer jsonTypesInitialize ( 10 ); + + JsonTypes* JsonTypes::_jsonTypes = NULL; + + + JsonTypes::JsonTypes () + : _jsonObjects() + { } + + + JsonTypes::~JsonTypes () + { + for ( JsonObject* object : _jsonObjects ) delete object; + } + + + void JsonTypes::_registerType ( JsonObject* object ) + { + if (_find(object->getTypeName())) { + throw Error( "JsonTypes::_registerType(): Attempt to register <%s> twice.", object->getTypeName().c_str() ); + } + _jsonObjects.insert( object ); + } + + + JsonObject* JsonTypes::_find ( const string& tname ) + { + JsonKey key( tname ); + set::iterator it = _jsonObjects.find( &key ); + if (it != _jsonObjects.end()) return (*it); + return NULL; + } + + + void JsonTypes::registerType ( JsonObject* object ) + { + if (not _jsonTypes) initialize(); + _jsonTypes->_registerType( object ); + } + + + JsonObject* JsonTypes::find ( const string& tname ) + { + if (not _jsonTypes) initialize(); + return _jsonTypes->_find( tname ); + } + + + void JsonTypes::initialize () + { if (not _jsonTypes) _jsonTypes = new JsonTypes (); } + + +// ------------------------------------------------------------------- +// Class : "JsonStack". + + void JsonStack::addEntity ( unsigned int jsonId, Entity* entity ) + { _entities.insert( std::make_pair(jsonId,entity) ); } + + + void JsonStack::print ( ostream& o ) const + { + o << tab << "JsonStack::print() Stack contains " << _stack.size() << " elements." << endl; + for ( size_t i=0 ; i<_stack.size() ; ++i ) { + o << "[" << right << setw(2) << i << "] key: \"" << left << setw(20) << _stack[i].first + << "\", type: \"" << demangle(_stack[i].second.type()) << "\"." << endl; + } + } + + +} // Hurricane namespace. diff --git a/hurricane/src/hurricane/JsonReader.cpp b/hurricane/src/hurricane/JsonReader.cpp new file mode 100644 index 00000000..d09c399e --- /dev/null +++ b/hurricane/src/hurricane/JsonReader.cpp @@ -0,0 +1,380 @@ +// -*- C++ -*- +// +// Copyright (c) BULL S.A. 2015-2016, All Rights Reserved +// +// This file is part of Hurricane. +// +// Hurricane is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// Hurricane is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- +// TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU +// General Public License for more details. +// +// You should have received a copy of the Lesser GNU General Public +// License along with Hurricane. If not, see +// . +// +// +-----------------------------------------------------------------+ +// | H U R R I C A N E | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul Chaput | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./JsonReader.cpp" | +// +-----------------------------------------------------------------+ + + +#include "hurricane/DebugSession.h" +#include "hurricane/Error.h" +#include "hurricane/Warning.h" +#include "hurricane/Signature.h" +#include "hurricane/JsonReader.h" +#include "hurricane/Entity.h" +#include "hurricane/Property.h" + + +namespace Hurricane { + + using namespace std; + using namespace rapidjson; + + +// ------------------------------------------------------------------- +// Class : "HurricaneHandler" (declaration). + + class HurricaneHandler { + public: + HurricaneHandler ( JsonReader& ); + public: + bool Null (); + bool Bool ( bool ); + bool Int ( int ); + bool Int64 ( int64_t ); + bool Uint ( unsigned int ); + bool Uint64 ( uint64_t ); + bool Double ( double ); + bool RawNumber ( const char*, SizeType, bool copy ); + bool String ( const char*, SizeType, bool copy ); + bool Key ( const char*, SizeType, bool copy ); + bool StartObject (); + bool EndObject ( SizeType ); + bool StartArray (); + bool EndArray ( SizeType ); + inline bool isDummy () const; + inline bool doCallToData () const; + inline JsonStack& stack (); + inline vector& objects (); + inline vector& objects () const; + inline unsigned long flags (); + private: + enum Flags { TypenameKey = (1<<0) + }; + private: + unsigned long _state; + string _key; + string _objectName; + JsonReader& _reader; + }; + + +// ------------------------------------------------------------------- +// Class : "HurricaneHandler" (definition). + + HurricaneHandler::HurricaneHandler ( JsonReader& reader ) + : _state (0) + , _key () + , _objectName() + , _reader (reader) + { } + + + inline JsonStack& HurricaneHandler::stack () { return _reader.getStack(); } + inline vector& HurricaneHandler::objects () { return _reader.getStack().jobjects(); } + inline vector& HurricaneHandler::objects () const { return _reader.getStack().jobjects(); } + inline unsigned long HurricaneHandler::flags () { return _reader.getStack().getFlags(); } + + + inline bool HurricaneHandler::isDummy () const + { return objects().empty() or objects().back()->isDummy(); } + + + inline bool HurricaneHandler::doCallToData () const + { return not objects().empty() and objects().back() and not objects().back()->isBound(); } + + + bool HurricaneHandler::Null () + { + if (isDummy()) return true; + stack().push_back( _key, (DBo*)NULL ); + _key.clear(); + return true; + } + + + bool HurricaneHandler::Bool ( bool v ) + { + if (isDummy()) return true; + stack().push_back( _key, v ); + _key.clear(); + return true; + } + + + bool HurricaneHandler::Int ( int v ) + { + if (isDummy()) return true; + stack().push_back( _key, v ); + _key.clear(); + return true; + } + + + bool HurricaneHandler::Int64 ( int64_t v ) + { + if (isDummy()) return true; + stack().push_back( _key, v ); + _key.clear(); + return true; + } + + + bool HurricaneHandler::Uint ( unsigned int v ) + { + if (isDummy()) return true; + stack().push_back( _key, v ); + _key.clear(); + return true; + } + + + bool HurricaneHandler::Uint64 ( uint64_t v ) + { + if (isDummy()) return true; + stack().push_back( _key, v ); + _key.clear(); + return true; + } + + + bool HurricaneHandler::Double ( double v ) + { + if (isDummy()) return true; + stack().push_back( _key, v ); + _key.clear(); + return true; + } + + + bool HurricaneHandler::RawNumber ( const char* value, SizeType, bool copy ) + { + cerr << Warning( "HurricaneHandler::RawNumber(): Unmanaged (value=\"%s\").", value ) << endl; + return true; + } + + bool HurricaneHandler::String ( const char* value, SizeType, bool copy ) + { + if (isDummy() and not (_state & TypenameKey)) return true; + if (_state & TypenameKey) { + _state &= ~TypenameKey; + + if (_key != "@typename") { + cerr << Warning("JsonReader::parse(): First field is not @typename, skipping object." ) << endl; + _key.clear(); + return true; + } + + string svalue = value; + JsonObject* object = NULL; + JsonSignature* signature = NULL; + if (svalue.compare(0,10,"Signature.") == 0) object = JsonTypes::find( "Signature" ); + else object = JsonTypes::find( value ); + + if (not object) { + // Keep the dummy object on top of the stack. + cerr << Warning( "JsonReader::parse(): Do not know how to parse type \"%s\" (ignored)." + , value ) << endl; + dynamic_cast(objects().back())->setTypeName( value ); + } else { + // Replace the dummy object on top of the stack. + delete objects().back(); + objects()[objects().size()-1] = object->clone( flags() ); + objects().back()->setName( _objectName ); + + signature = dynamic_cast( objects().back() ); + if (signature) { + size_t dot = svalue.find('.'); + signature->setSubType( svalue.substr(dot+1) ); + } + } + + cdebug.log(19) << "HurricaneHandler::String() [key/typename] \"" << value << "\"." << endl; + _key.clear(); + return true; + } + + stack().push_back( _key, value ); + _key.clear(); + return true; + } + + + bool HurricaneHandler::Key ( const char* key, SizeType, bool copy ) + { + if (isDummy() and not (_state & TypenameKey)) return true; + + _key = key; + if (_state & TypenameKey) return true; + + //cdebug.log(19) << "HurricaneHandler::Key() key:" << _key << " objects().size():" << objects().size() << endl; + + if (objects().back()) { + if ( doCallToData() and not _key.empty() and (_key[0] != '_') ) { + // The key is no longer a simple attribute of the object. + // Triggers it's creation in the Json stack. + cdebug.log(19) << "HurricaneHandler::key() Calling " + << objects().back()->getTypeName() << "::toData(JsonStack&)." << endl; + objects().back()->toData( stack() ); + } + } + + return true; + } + + + bool HurricaneHandler::StartObject () + { + cdebug.log(19,1) << "Hurricane::StartObject()" << endl; + + _state |= TypenameKey; + _objectName = _key; + objects().push_back( new JsonDummy() ); + _key.clear(); + cdebug.log(19) << "objects().push_back(NULL), size():" << objects().size() << "." << endl; + cdebug.tabw(19,1); + return true; + } + + + bool HurricaneHandler::EndObject ( SizeType ) + { + cdebug.tabw(19,-2); + cdebug.log(19) << "HurricaneHandler::EndObject()" << endl; + cdebug.tabw(19,1); + + _objectName.clear(); + if (not isDummy()) { + if (doCallToData()) { + cdebug.log(19) << "Calling " << objects().back()->getTypeName() << "::toData(JsonStack&)." << endl; + objects().back()->toData( stack() ); + } + if (stack().size() > 1) { + if (stack()[-1].first[0] != '_') stack().pop_back(); + } + } + + cdebug.log(19) << "objects().pop_back(), size():" << objects().size() << "." << endl; + if (objects().back()->issetFlags(JsonWriter::DBoObject)) + stack().pop_back_dbo(); + + delete objects().back(); + objects().pop_back(); + + cdebug.tabw(19,-1); + return true; + } + + + bool HurricaneHandler::StartArray() + { + cdebug.log(19,1) << "HurricaneHandler::StartArray() key:\"" << _key << "\"." << endl; + + _objectName.clear(); + if (_key[0] != '+') { + cerr << Warning("JsonReader::parse(): Array attributes must start by \'+\' %s.", _key.c_str() ) << endl; + return true; + } + _key.clear(); + + return true; + } + + + bool HurricaneHandler::EndArray ( SizeType ) + { + cdebug.tabw(19,-1); + cdebug.log(19) << "HurricaneHandler::EndArray()" << endl; + return true; + } + + +// ------------------------------------------------------------------- +// Class : "JsonReader" (definition). + + JsonReader::JsonReader ( unsigned long flags ) + : _bufferSize(65536) + , _buffer (new char [_bufferSize]) + , _file (NULL) + , _stream (NULL) + , _stack () + , _reader () + , _handler (new HurricaneHandler(*this)) + { + _stack.setFlags( flags ); + } + + + JsonReader::~JsonReader () + { + close(); + delete [] _buffer; + delete _handler; + } + + + void JsonReader::close () + { + if (_stream) { delete _stream; _stream = NULL; } + if (_file ) { fclose(_file); _file = NULL; } + } + + + void JsonReader::parse ( string fileName ) + { + close(); + + //DebugSession::open( 19, 20 ); + + fileName += ".json.bz2"; + _file = fopen( fileName.c_str(), "r" ); + cdebug.log(19) << "_file:" << _file << ", _buffer:" << (void*)_buffer << endl; + + if (not _file) { + throw Error( "JsonReader::parse(): Cannot open file \"%s\"." + , fileName.c_str() ); + } + + _stream = new FileReadGzStream ( _file, _buffer, _bufferSize ); + + if (issetFlags(JsonWriter::DesignBlobMode)) + Entity::enableForcedIdMode(); + _reader.Parse( *_stream, *_handler ); + if (_stack.size() != 1) { + cerr << Error( "JsonReader::parse(): Stack must contain exatly one element upon completion." ) << endl; + _stack.print( cerr ); + } + if (issetFlags(JsonWriter::DesignBlobMode)) + Entity::disableForcedIdMode(); + + //DebugSession::close(); + close(); + + SharedProperty::clearOrphaneds(); + } + + +} // Hurricane namespace. diff --git a/hurricane/src/hurricane/JsonWriter.cpp b/hurricane/src/hurricane/JsonWriter.cpp new file mode 100644 index 00000000..15b7724e --- /dev/null +++ b/hurricane/src/hurricane/JsonWriter.cpp @@ -0,0 +1,108 @@ +// -*- C++ -*- +// +// Copyright (c) BULL S.A. 2015-2016, All Rights Reserved +// +// This file is part of Hurricane. +// +// Hurricane is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// Hurricane is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- +// TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU +// General Public License for more details. +// +// You should have received a copy of the Lesser GNU General Public +// License along with Hurricane. If not, see +// . +// +// +-----------------------------------------------------------------+ +// | H U R R I C A N E | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul Chaput | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./JsonWriter.cpp" | +// +-----------------------------------------------------------------+ + + +//#include "rapidjson/filewritestream.h" +#include "rapidjson/prettywriter.h" +#include "hurricane/Commons.h" +#include "hurricane/FileWriteGzStream.h" + + +//namespace Hurricane { + +//typedef rapidjson::PrettyWriter JsonOfstream; + typedef rapidjson::PrettyWriter JsonOfstream; + +#define _WRITER reinterpret_cast(_writer) + + +// ------------------------------------------------------------------- +// Class : "JsonWriter". + + JsonWriter::JsonWriter ( std::string fileName ) + : _flags (0) + , _bufferSize(65536) + , _buffer (new char [_bufferSize]) + , _file (NULL) + , _stream (NULL) + , _writer (NULL) + { + _file = fopen( fileName.c_str(), "w" ); + //_stream = new rapidjson::FileWriteGzStream ( _file, _buffer, _bufferSize ); + _stream = new Hurricane::FileWriteGzStream ( _file, _buffer, _bufferSize ); + _writer = new JsonOfstream ( *_stream ); + _WRITER->SetIndent( ' ', 2 ); + } + + + JsonWriter::~JsonWriter () + { close(); } + + + void JsonWriter::close () + { + if (_writer) { delete _WRITER; _writer = NULL; } + if (_stream) { delete _stream; _stream = NULL; } + if (_file ) { fclose(_file); _file = NULL; } + } + + + void JsonWriter::key ( const char* k ) { _WRITER->Key(k); }; + void JsonWriter::key ( std::string k ) { _WRITER->Key(k.c_str()); }; + void JsonWriter::startObject() { _WRITER->StartObject(); }; + void JsonWriter::startArray () { _WRITER->StartArray(); }; + void JsonWriter::endObject () { _WRITER->EndObject(); }; + void JsonWriter::endArray () { _WRITER->EndArray(); }; + void JsonWriter::write () { _WRITER->Null(); }; + void JsonWriter::write ( const char* s ) { _WRITER->String(s); }; + void JsonWriter::write ( const std::string* s ) { _WRITER->String(s->c_str()); }; + void JsonWriter::write ( std::string s ) { _WRITER->String(s.c_str()); }; + void JsonWriter::write ( const bool* v ) { _WRITER->Bool (*v); } + void JsonWriter::write ( bool v ) { _WRITER->Bool ( v); } + void JsonWriter::write ( const int* v ) { _WRITER->Int (*v); } + void JsonWriter::write ( int v ) { _WRITER->Int ( v); } + void JsonWriter::write ( const long* v ) { _WRITER->Int64 (*v); } + void JsonWriter::write ( long v ) { _WRITER->Int64 ( v); } + void JsonWriter::write ( const unsigned int* v ) { _WRITER->Uint (*v); } + void JsonWriter::write ( unsigned int v ) { _WRITER->Uint ( v); } + void JsonWriter::write ( const unsigned long* v ) { _WRITER->Uint64(*v); } + void JsonWriter::write ( unsigned long v ) { _WRITER->Uint64( v); } + void JsonWriter::write ( const float* v ) { _WRITER->Double((double)*v); } + void JsonWriter::write ( float v ) { _WRITER->Double((double) v); } + void JsonWriter::write ( const double* v ) { _WRITER->Double(*v); } + void JsonWriter::write ( double v ) { _WRITER->Double( v); } + JsonWriter* JsonWriter::setFlags ( unsigned long mask ) { _flags |= mask; return this; } + JsonWriter* JsonWriter::resetFlags ( unsigned long mask ) { _flags &= ~mask; return this; } + bool JsonWriter::issetFlags ( unsigned long mask ) const { return _flags & mask; } + unsigned long JsonWriter::getFlags () const { return _flags; } + + + +//} // Hurricane namespace. diff --git a/hurricane/src/hurricane/Layer.cpp b/hurricane/src/hurricane/Layer.cpp index b2eacc8a..c646f49b 100644 --- a/hurricane/src/hurricane/Layer.cpp +++ b/hurricane/src/hurricane/Layer.cpp @@ -1,7 +1,6 @@ - // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -19,12 +18,7 @@ // License along with Hurricane. If not, see // . // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | H U R R I C A N E | // | V L S I B a c k e n d D a t a - B a s e | // | | @@ -32,16 +26,14 @@ // | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Module : "./Layer.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ -# include "hurricane/Layer.h" -# include "hurricane/BasicLayer.h" -# include "hurricane/Technology.h" -# include "hurricane/Error.h" +#include "hurricane/DataBase.h" +#include "hurricane/Technology.h" +#include "hurricane/Layer.h" +#include "hurricane/BasicLayer.h" +#include "hurricane/Error.h" namespace Hurricane { @@ -50,7 +42,6 @@ namespace Hurricane { // ------------------------------------------------------------------- // Class : "Hurricane::Layer". - Layer::Layer ( Technology* technology , const Name& name , const DbU::Unit& minimalSize @@ -219,7 +210,7 @@ namespace Hurricane { } - string Layer::_getString() const + string Layer::_getString () const { string s = DBo::_getString(); s.insert(s.length() - 1, " " + getString(_name)); @@ -227,7 +218,7 @@ namespace Hurricane { } - Record* Layer::_getRecord() const + Record* Layer::_getRecord () const { Record* record = DBo::_getRecord(); if (record) { @@ -242,4 +233,49 @@ namespace Hurricane { } -} // End of Hurricane namespace. + const Name& Layer::_sgetName ( const Layer* layer ) + { return layer->getName(); } + + + void Layer::_toJson ( JsonWriter* writer ) const + { + Super::_toJson( writer ); + + jsonWrite( writer, "_name" , getName() ); + jsonWrite( writer, "_mask" , getString(_mask) ); + jsonWrite( writer, "_extractMask" , getString(_extractMask) ); + jsonWrite( writer, "_minimalSize" , _minimalSize ); + jsonWrite( writer, "_minimalSpacing", _minimalSpacing ); + jsonWrite( writer, "_working" , _working ); + } + + +// ------------------------------------------------------------------- +// Class : "Hurricane::JsonLayer". + + JsonLayer::JsonLayer ( unsigned long flags ) + : JsonDBo(flags) + { + add( "_name" , typeid(string) ); + add( "_mask" , typeid(string) ); + add( "_extractMask" , typeid(string) ); + add( "_minimalSize" , typeid(uint64_t) ); + add( "_minimalSpacing", typeid(uint64_t) ); + add( "_working" , typeid(uint64_t) ); + } + + + Technology* JsonLayer::lookupTechnology ( JsonStack& stack, const string& fname ) const + { + Technology* techno = get( stack, ".Technology" ); + if (not techno) { + techno = get( stack, "_technology" ); + } + if (not techno) { + cerr << Error( "%s(): .Technology/_technology missing in the stack.", fname.c_str() ) << endl; + techno = DataBase::getDB()->getTechnology(); + } + return techno; + } + +} // Hurricane namespace. diff --git a/hurricane/src/hurricane/Library.cpp b/hurricane/src/hurricane/Library.cpp index c348b9be..e7716929 100644 --- a/hurricane/src/hurricane/Library.cpp +++ b/hurricane/src/hurricane/Library.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./Library.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -97,6 +97,19 @@ void Library::setName(const Name& name) } } +string Library::getHierarchicalName () const +// ***************************************** +{ + string rpath; + Library* library = getLibrary(); + do { + rpath.insert( 0, getString(library->getName())+"." ); + + library = library->getLibrary(); + } while ( library ); + + return rpath + getString(getName()); +} void Library::_postCreate() // ************************ { @@ -113,13 +126,11 @@ void Library::_preDestroy() { Inherit::_preDestroy(); - for_each_cell(cell, getCells()) cell->destroy(); end_for; - for_each_library(library, getLibraries()) library->destroy(); end_for; + Cells cells = getCells (); while (cells .getFirst()) cells .getFirst()->destroy(); + Libraries libraries = getLibraries(); while (libraries.getFirst()) libraries.getFirst()->destroy(); - if (!_library) - _dataBase->_setRootLibrary(NULL); - else - _library->_getLibraryMap()._remove(this); + if (not _library) _dataBase->_setRootLibrary( NULL ); + else _library->_getLibraryMap()._remove( this ); } string Library::_getString() const @@ -215,10 +226,83 @@ void Library::CellMap::_setNextElement(Cell* cell, Cell* nextCell) const cell->_setNextOfLibraryCellMap(nextCell); }; +void Library::_toJson(JsonWriter* w) const +// *************************************** +{ + Inherit::_toJson( w ); + + jsonWrite( w, "_name" , getName() ); +//jsonWrite( w, "+cellMap" , getCells() ); + jsonWrite( w, "+libraryMap", getLibraries() ); +} + + +// **************************************************************************************************** +// JsonLibrary implementation +// **************************************************************************************************** + +Initializer jsonLibraryInit ( 0 ); + +void JsonLibrary::initialize() +// ************************** +{ JsonTypes::registerType( new JsonLibrary (JsonWriter::RegisterMode) ); } + +JsonLibrary::JsonLibrary(unsigned long flags) +// ************************************ + : JsonDBo(flags) +{ +//add( ".Library" , typeid(Library*) ); + add( "_name" , typeid(string) ); +//add( "+cellMap" , typeid(JsonArray) ); + add( "+libraryMap", typeid(JsonArray) ); +} + +string JsonLibrary::getTypeName() const +// ********************************* +{ return "Library"; } + +JsonLibrary* JsonLibrary::clone(unsigned long flags) const +// ************************************************* +{ return new JsonLibrary ( flags ); } + +void JsonLibrary::toData(JsonStack& stack) +// *************************************** +{ + check( stack, "JsonLibrary::toData" ); + + Name libName ( get ( stack, "_name" ) ); + Library* library = NULL; + Library* parent = NULL; + + if (stack.rhas(".Library")) + parent = get( stack, ".Library" ); + else if (stack.rhas("_rootLibrary")) + parent = get( stack, "_rootLibrary" ); + + if (parent) { + library = parent->getLibrary( libName ); + if (not library) + library = Library::create( parent, libName ); + } else { + library = DataBase::getDB()->getRootLibrary(); + if (not library) + library = Library::create( DataBase::getDB(), libName ); + else { + if (library->getName() != libName) { + throw Error( "JsonLibrary::toData(): Root library name discrepency, \"%s\" vs. \"%s\"." + , getString(library->getName()).c_str() + , getString(libName).c_str() + ); + } + } + } + + update( stack, library ); +} } // End of Hurricane namespace. // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/Marker.cpp b/hurricane/src/hurricane/Marker.cpp index c732b5d1..4bd58466 100644 --- a/hurricane/src/hurricane/Marker.cpp +++ b/hurricane/src/hurricane/Marker.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./Marker.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -101,5 +101,5 @@ Record* Marker::_getRecord() const // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/Name.cpp b/hurricane/src/hurricane/Name.cpp index 8d9ab0df..9024ab45 100644 --- a/hurricane/src/hurricane/Name.cpp +++ b/hurricane/src/hurricane/Name.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./Name.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -204,5 +204,5 @@ Record* Name::_getRecord() const // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/Net.cpp b/hurricane/src/hurricane/Net.cpp index 56e75993..6cea668f 100644 --- a/hurricane/src/hurricane/Net.cpp +++ b/hurricane/src/hurricane/Net.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./Net.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -18,6 +18,7 @@ // **************************************************************************************************** #include "hurricane/Warning.h" +#include "hurricane/Error.h" #include "hurricane/Net.h" #include "hurricane/Cell.h" #include "hurricane/Instance.h" @@ -30,7 +31,7 @@ #include "hurricane/Horizontal.h" #include "hurricane/Pad.h" #include "hurricane/UpdateSession.h" -#include "hurricane/Error.h" +#include "hurricane/NetExternalComponents.h" namespace Hurricane { @@ -267,14 +268,14 @@ Net::Net(Cell* cell, const Name& name) _nextOfCellNetMap(NULL), _mainName(this) { - if (!_cell) - throw Error("Can't create " + _TName("Net") + " : null cell"); + if (!_cell) + throw Error("Can't create " + _TName("Net") + " : null cell"); - if (name.isEmpty()) - throw Error("Can't create " + _TName("Net") + " : empty name"); + if (name.isEmpty()) + throw Error("Can't create " + _TName("Net") + " : empty name"); - if (_cell->getNet(_name)) - throw Error("Can't create " + _TName("Net ") + getString(_name) + " : already exists"); + if (_cell->getNet(_name)) + throw Error("Can't create " + _TName("Net ") + getString(_name) + " : already exists"); } Net* Net::create(Cell* cell, const Name& name) @@ -426,20 +427,27 @@ NetFilter Net::getIsGroundFilter() return Net_IsGroundFilter(); } -void Net::setName(const Name& name) -// ******************************** +void Net::setName(Name name) +// ************************* { - if (name != _name) { - if (name.isEmpty()) - throw Error("Can't change net name : empty name"); + if (name != _name) { + if (name.isEmpty()) + throw Error( "Net::setName(): Empty name, keep \"%s\"", getString(_name).c_str() ); - if (_cell->getNet(name)) - throw Error("Can't change net name : already exists"); + bool swapAlias = hasAlias( name ); + if (not swapAlias and _cell->getNet(name)) + throw Error( "Net::setName(): On \"%s\", another net named \"%s\" already exists." + , getString(_name).c_str() + , getString( name).c_str() ); - _cell->_getNetMap()._remove(this); - _name = name; - _cell->_getNetMap()._insert(this); - } + if (swapAlias) removeAlias(name); + + _cell->_getNetMap()._remove(this); + std::swap( _name, name ); + _cell->_getNetMap()._insert(this); + + if (swapAlias) addAlias(name); + } } void Net::setArity(const Arity& arity) @@ -506,9 +514,21 @@ void Net::setDirection(const Direction& direction) _direction = direction; } -bool Net::addAlias(const Name& name ) -// ********************************** +bool Net::hasAlias(const Name& name) const +// *************************************** { + if (name == _name) return true; + for ( NetAliasHook* alias : getAliases() ) { + if (alias->getName() == name) return true; + } + return false; +} + +bool Net::addAlias(const Name& name) +// ********************************* +{ + if (hasAlias(name)) return true; + if (getCell()->getNet(name)) { cerr << Warning( "Net::addAlias(): Cannot add alias %s to net %s, already taken." , getString(name).c_str() @@ -610,10 +630,18 @@ void Net::merge(Net* net) throw Error("Can't merge net : itself"); if (net->getCell() != _cell) - throw Error("Can't merge net : incompatible net"); + throw Error( "Net::merge(): Cannot merge %s (%s) with %s (%s)." + , getString(getName()).c_str() + , getString(getCell()->getName()).c_str() + , getString(net->getName()).c_str() + , getString(net->getCell()->getName()).c_str() + ); if (!isExternal() && net->isExternal() && !net->getConnectedSlavePlugs().isEmpty()) - throw Error("Can't merge net : incompatible net"); + throw Error( "Net::merge(): Cannot merge external (%s) with an internal net (%s)." + , getString(net->getName()).c_str() + , getString(getName()).c_str() + ); for_each_rubber(rubber, net->getRubbers()) rubber->_setNet(this); end_for; for_each_component(component, net->getComponents()) component->_setNet(this); end_for; @@ -680,11 +708,13 @@ void Net::_preDestroy() { Inherit::_preDestroy(); - for_each_plug(slavePlug, getSlavePlugs()) slavePlug->_destroy(); end_for; + Plugs plugs = getSlavePlugs(); + while ( plugs.getFirst() ) plugs.getFirst()->_destroy(); unmaterialize(); - for_each_rubber(rubber, getRubbers()) rubber->_destroy(); end_for; + Rubbers rubbers = getRubbers(); + while ( rubbers.getFirst() ) rubbers.getFirst()->_destroy(); for_each_component(component, getComponents()) { for_each_hook(hook, component->getHooks()) { @@ -693,16 +723,17 @@ void Net::_preDestroy() //if (!hook->IsMaster()) hook->detach(); hook->detach(); end_for; + // 24/02/2016 jpc: the answer, at last... we cannot iterate + // over a collection as it is modificated/destroyed! } end_for; } - for_each_component(component, getComponents()) { - if (!dynamic_cast(component)) - component->destroy(); - else - ((Plug*)component)->setNet(NULL); - end_for; + Components components = getComponents(); + while ( components.getFirst() ) { + Component* component = components.getFirst(); + if (!dynamic_cast(component)) component->destroy(); + else (static_cast(component))->setNet(NULL); } _mainName.clear(); @@ -738,6 +769,40 @@ Record* Net::_getRecord() const return record; } +void Net::_toJson(JsonWriter* writer) const +// **************************************** +{ + Inherit::_toJson( writer ); + + jsonWrite( writer, "_name" , getName() ); + jsonWrite( writer, "_isGlobal" , isGlobal() ); + jsonWrite( writer, "_isExternal" , isExternal() ); + jsonWrite( writer, "_isAutomatic" , isAutomatic() ); + jsonWrite( writer, "_type" , getString(getType()) ); + jsonWrite( writer, "_direction" , getString(getDirection()) ); +} + +void Net::_toJsonSignature(JsonWriter* writer) const +// ************************************************* +{ + jsonWrite( writer, "_name", getName() ); +} + +void Net::_toJsonCollections(JsonWriter* writer) const +// *************************************************** +{ + jsonWrite( writer, "+aliases", getAliases() ); + writer->setFlags( JsonWriter::UsePlugReference ); + jsonWrite( writer, "+componentSet", getComponents() ); + writer->resetFlags( JsonWriter::UsePlugReference ); + + writer->key( "+externalComponents" ); + NetExternalComponents::toJson( writer, this ); + + Inherit::_toJsonCollections( writer ); +} + + // **************************************************************************************************** // Net::Type implementation // **************************************************************************************************** @@ -745,13 +810,23 @@ Record* Net::_getRecord() const Net::Type::Type(const Code& code) // ****************************** : _code(code) -{ -} +{ } Net::Type::Type(const Type& type) // ****************************** : _code(type._code) +{ } + +Net::Type::Type(string s) +// ********************** +: _code(UNDEFINED) { + if (s == "UNDEFINED") _code = UNDEFINED; + else if (s == "LOGICAL" ) _code = LOGICAL; + else if (s == "CLOCK" ) _code = CLOCK; + else if (s == "POWER" ) _code = POWER; + else if (s == "GROUND" ) _code = GROUND; + else if (s == "BLOCKAGE" ) _code = BLOCKAGE; } Net::Type& Net::Type::operator=(const Type& type) @@ -784,13 +859,23 @@ Record* Net::Type::_getRecord() const Net::Direction::Direction(const Code& code) // **************************************** : _code(code) -{ -} +{ } Net::Direction::Direction(const Direction& direction) // ************************************************** : _code(direction._code) +{ } + +Net::Direction::Direction(string s) +// ******************************** +: _code(UNDEFINED) { + if (s.size() > 3) { + if (s[0] == 'i') *this |= DirIn; + if (s[0] == 'o') *this |= DirOut; + if (s[0] == 't') *this |= ConnTristate; + if (s[0] == 'w') *this |= ConnWiredOr; + } } Net::Direction& Net::Direction::operator=(const Direction& direction) @@ -1008,9 +1093,187 @@ string Net_SlavePlugs::Locator::_getString() const return s; } -} // End of Hurricane namespace. + +// ------------------------------------------------------------------- +// Class : "JsonNet". + + + Initializer jsonNetInit ( 0 ); + + + void JsonNet::initialize () + { JsonTypes::registerType( new JsonNet (JsonWriter::RegisterMode) ); } + + + JsonNet::JsonNet ( unsigned long flags ) + : JsonEntity (flags) + , _autoMaterialize(not Go::autoMaterializationIsDisabled()) + , _net (NULL) + , _hooks () + { + if (flags & JsonWriter::RegisterMode) return; + + cdebug.log(19) << "JsonNet::JsonNet()" << endl; + + add( "_name" , typeid(string) ); + add( "_isGlobal" , typeid(bool) ); + add( "_isExternal" , typeid(bool) ); + add( "_isAutomatic" , typeid(bool) ); + add( "_type" , typeid(string) ); + add( "_direction" , typeid(string) ); + add( "+aliases" , typeid(JsonArray) ); + add( "+componentSet" , typeid(JsonArray) ); + add( "+externalComponents", typeid(JsonArray) ); + + cdebug.log(19) << "Disabling auto-materialization (" << _autoMaterialize << ")." << endl; + Go::disableAutoMaterialization(); + } + + + JsonNet::~JsonNet () + { + checkRings(); + buildRings(); + clearHookLinks(); + + _net->materialize(); + + if (_autoMaterialize) { + Go::enableAutoMaterialization(); + cdebug.log(18) << "Enabling auto-materialization." << endl; + } + } + + + string JsonNet::getTypeName () const + { return "Net"; } + + + JsonNet* JsonNet::clone( unsigned long flags ) const + { return new JsonNet ( flags ); } + + + void JsonNet::toData ( JsonStack& stack ) + { + cdebug.tabw(19,1); + + check( stack, "JsonNet::toData" ); + presetId( stack ); + + _net = Net::create( get(stack,".Cell") , get(stack,"_name") ); + _net->setGlobal ( get(stack,"_isGlobal" ) ); + _net->setExternal ( get(stack,"_isExternal" ) ); + _net->setAutomatic( get(stack,"_isAutomatic") ); + _net->setType ( Net::Type (get(stack,"_type")) ); + _net->setDirection( Net::Direction(get(stack,"_direction")) ); + + update( stack, _net ); + + cdebug.tabw(19,-1); + } + + + void JsonNet::addHookLink ( Hook* hook, unsigned int jsonId, const string& jsonNext ) + { + if (jsonNext.empty()) return; + + unsigned int id = jsonId; + string tname = hook->_getTypeName(); + + auto ielement = _hooks.find( HookKey(id,tname) ); + if (ielement == _hooks.end()) { + auto r = _hooks.insert( make_pair( HookKey(id,tname), HookElement(hook) ) ); + ielement = r.first; + (*ielement).second.setFlags( HookElement::OpenRingStart ); + } + HookElement* current = &((*ielement).second); + if (not current->hook()) current->setHook( hook ); + + hookFromString( jsonNext, id, tname ); + ielement = _hooks.find( HookKey(id,tname) ); + if (ielement == _hooks.end()) { + auto r = _hooks.insert( make_pair( HookKey(id,tname), HookElement(NULL) ) ); + ielement = r.first; + } else { + (*ielement).second.resetFlags( HookElement::OpenRingStart ); + } + current->setNext( &((*ielement).second) ); + } + + + Hook* JsonNet::getHook ( unsigned int jsonId, const std::string& tname ) const + { + auto ihook = _hooks.find( HookKey(jsonId,tname) ); + if (ihook == _hooks.end()) return NULL; + + return (*ihook).second.hook(); + } + + + bool JsonNet::hookFromString ( std::string s, unsigned int& id, std::string& tname ) + { + size_t dot = s.rfind('.'); + if (dot == string::npos) return false; + + tname = s.substr( 0, dot ); + id = stoul( s.substr(dot+1) ); + return true; + } + + + bool JsonNet::checkRings () const + { + bool status = true; + + for ( auto kv : _hooks ) { + HookElement* ringStart = &(kv.second); + if (ringStart->issetFlags(HookElement::ClosedRing)) continue; + + if (ringStart->issetFlags(HookElement::OpenRingStart)) { + cerr << Error( "JsonNet::checkRing(): Open ring found, starting with %s.\n" + " Closing the ring..." + , getString(ringStart->hook()).c_str() ) << endl; + + status = false; + HookElement* element = ringStart; + while ( true ) { + if (not element->next()) { + // The ring is open: close it (loop on ringStart). + element->setNext( ringStart ); + element->setFlags( HookElement::ClosedRing ); + + cerr << Error( "Simple open ring." ) << endl; + break; + } + if (element->next()->issetFlags(HookElement::ClosedRing)) { + // The ring is half merged with itself, or another ring. + // (i.e. *multiple* hooks pointing the *same* next element) + element->setNext( ringStart ); + element->setFlags( HookElement::ClosedRing ); + + cerr << Error( "Complex fault: ring partially merged (convergent)." ) << endl; + break; + } + element = element->next(); + } + } + } + + return status; + } + + + void JsonNet::buildRings () const + { + for ( auto kv : _hooks ) { + kv.second.hook()->_setNextHook( kv.second.next()->hook() ); + } + } + + +} // Hurricane namespace. // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/NetAlias.cpp b/hurricane/src/hurricane/NetAlias.cpp index 18788180..864bda66 100644 --- a/hurricane/src/hurricane/NetAlias.cpp +++ b/hurricane/src/hurricane/NetAlias.cpp @@ -1,6 +1,6 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2015-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2015-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -212,6 +212,15 @@ namespace Hurricane { } + void NetAliasName::toJson ( JsonWriter* w ) const + { + w->startObject(); + jsonWrite( w, "@typename", "NetAlias" ); + jsonWrite( w, "_name" , _name ); + w->endObject(); + } + + // ------------------------------------------------------------------- // Class : "Hurricane::AliasList" (Collection). @@ -263,4 +272,47 @@ namespace Hurricane { } +// ------------------------------------------------------------------- +// Class : "Hurricane::JsonNetAlias". + + Initializer jsonNetAliasInit ( 0 ); + + + void JsonNetAlias::initialize () + { JsonTypes::registerType( new JsonNetAlias (JsonWriter::RegisterMode) ); } + + + JsonNetAlias::JsonNetAlias( unsigned long flags ) + : JsonObject(flags) + { + add( ".Net" , typeid(Net*) ); + add( "_name", typeid(string) ); + } + + + string JsonNetAlias::getTypeName () const + { return "NetAlias"; } + + + JsonNetAlias* JsonNetAlias::clone ( unsigned long flags ) const + { return new JsonNetAlias ( flags ); } + + + void JsonNetAlias::toData ( JsonStack& stack ) + { + check( stack, "JsonNetAlias::toData" ); + + Net* net = get( stack, ".Net" ); + if (net) { + string name = get( stack, "_name" ); + if (not name.empty()) { + net->addAlias( name ); + } + } else { + cerr << Error( "JsonNetAlias::toData(): Missing \".Net\" in stack context." ) << endl; + } + + update( stack, NULL ); +} + } // Hurricane namespace. diff --git a/hurricane/src/hurricane/NetExternalComponents.cpp b/hurricane/src/hurricane/NetExternalComponents.cpp index 01f46ed9..ed5f8b40 100644 --- a/hurricane/src/hurricane/NetExternalComponents.cpp +++ b/hurricane/src/hurricane/NetExternalComponents.cpp @@ -1,7 +1,6 @@ - // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -19,12 +18,7 @@ // License along with Hurricane. If not, see // . // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | H U R R I C A N E | // | V L S I B a c k e n d D a t a - B a s e | // | | @@ -32,10 +26,7 @@ // | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Module : "./NetExternalComponents.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ #include "hurricane/Error.h" @@ -45,6 +36,8 @@ namespace Hurricane { +// ------------------------------------------------------------------- +// Class : "NetExternalComponents". const Name NetExternalComponents::_name = "ExternalComponentsRelation"; @@ -96,4 +89,73 @@ namespace Hurricane { } + void NetExternalComponents::toJson ( JsonWriter* w, const Net* net ) + { + w->startObject(); + jsonWrite( w, "@typename", "NetExternalComponents" ); + + w->setFlags( JsonWriter::UseEntityReference ); + if (net->isExternal()) { + jsonWrite( w, "+entities", get(net) ); + } else { + w->key( "+entities" ); + w->startArray(); + w->endArray(); + } + w->resetFlags( JsonWriter::UseEntityReference ); + w->endObject(); + } + + +// ------------------------------------------------------------------- +// Class : "JsonNetExternalComponents". + + Initializer jsonNetExternalComponentsInit ( 0 ); + + + void JsonNetExternalComponents::initialize () + { JsonTypes::registerType( new JsonNetExternalComponents (JsonWriter::RegisterMode) ); } + + + JsonNetExternalComponents::JsonNetExternalComponents ( unsigned long flags ) + : JsonBaseArray(flags) + { + if (flags & JsonWriter::RegisterMode) return; + + add( "+entities", typeid(JsonArray) ); + } + + + JsonNetExternalComponents::~JsonNetExternalComponents () + { + for ( Entity* entity : array() ) { + Component* component = dynamic_cast( entity ); + if (component) NetExternalComponents::setExternal( component ); + else { + cerr << Error( "JsonNetExternalComponents(): %s in not a Component." + , getString(entity).c_str() ) << endl; + } + } + } + + + string JsonNetExternalComponents::getTypeName () const + { return "NetExternalComponents"; } + + + JsonNetExternalComponents* JsonNetExternalComponents::clone( unsigned long flags ) const + { return new JsonNetExternalComponents ( flags ); } + + + void JsonNetExternalComponents::toData ( JsonStack& stack ) + { + cdebug.tabw(19,1); + + check ( stack, "JsonNetExternalComponents::toData" ); + update( stack, NULL ); + + cdebug.tabw(19,-1); + } + + } // End of Hurricane namespace. diff --git a/hurricane/src/hurricane/NetRoutingProperty.cpp b/hurricane/src/hurricane/NetRoutingProperty.cpp index ab67ea5a..8d2099af 100644 --- a/hurricane/src/hurricane/NetRoutingProperty.cpp +++ b/hurricane/src/hurricane/NetRoutingProperty.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2014-2015, All Rights Reserved +// Copyright (c) UPMC 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -14,8 +14,9 @@ // +-----------------------------------------------------------------+ -#include "hurricane/NetRoutingProperty.h" -#include "hurricane/Net.h" +#include "hurricane/NetRoutingProperty.h" +#include "hurricane/Initializer.h" +#include "hurricane/Net.h" namespace Hurricane { @@ -24,13 +25,18 @@ namespace Hurricane { using Hurricane::Property; +// ------------------------------------------------------------------- +// Class : "NetRoutingState" + string NetRoutingState::_getString () const { string s; - if (isFixed ()) s += 'f'; - if (isManualGlobalRoute ()) s += 'm'; - if (isAutomaticGlobalRoute()) s += 'a'; + s += (isExcluded ()) ? 'e' : '-'; + s += (isFixed ()) ? 'f' : '-'; + s += (isUnconnected ()) ? 'u' : '-'; + s += (isManualGlobalRoute ()) ? 'm' : '-'; + s += (isAutomaticGlobalRoute()) ? 'a' : '-'; return s; } @@ -101,6 +107,88 @@ namespace Hurricane { } + bool NetRoutingProperty::hasJson () const + { return true; } + + + void NetRoutingProperty::toJson ( JsonWriter* w, const DBo* ) const + { + w->startObject(); + jsonWrite( w, "@typename", _getTypeName() ); + jsonWrite( w, "_state" , _state._getString() ); + w->endObject(); + } + + +// ------------------------------------------------------------------- +// Class : "JsonNetRoutingProperty" + + Initializer jsonNetRoutingPropertyInit ( 20 ); + + + JsonNetRoutingProperty::JsonNetRoutingProperty ( unsigned long flags ) + : JsonObject(flags) + { + add( "_state", typeid(string) ); + } + + + string JsonNetRoutingProperty::getTypeName () const + { return "NetRoutingProperty"; } + + + void JsonNetRoutingProperty::initialize () + { JsonTypes::registerType( new JsonNetRoutingProperty (JsonWriter::RegisterMode) ); } + + + JsonNetRoutingProperty* JsonNetRoutingProperty::clone ( unsigned long flags ) const + { return new JsonNetRoutingProperty ( flags ); } + + + void JsonNetRoutingProperty::toData ( JsonStack& stack ) + { + check( stack, "JsonNetRoutingProperty::toData" ); + + string sflags = get( stack, "_state" ); + unsigned int flags = 0; + + flags |= (sflags[0] == 'e') ? NetRoutingState::Excluded : 0; + flags |= (sflags[1] == 'f') ? NetRoutingState::Fixed : 0; + flags |= (sflags[2] == 'u') ? NetRoutingState::Unconnected : 0; + flags |= (sflags[3] == 'm') ? NetRoutingState::ManualGlobalRoute : 0; + flags |= (sflags[4] == 'a') ? NetRoutingState::AutomaticGlobalRoute : 0; + + NetRoutingProperty* property = NULL; + DBo* dbo = stack.back_dbo(); + if (dbo) { + Net* net = dynamic_cast( dbo ); + if (net) { + property = dynamic_cast( net->getProperty( NetRoutingProperty::getPropertyName() ) ); + if (property) { + cerr << Error( "JsonNetRoutingProperty::toData(): %s has already a NetRoutingProperty (overwrite)." + , getString(net).c_str() + ) << endl; + NetRoutingState* state = property->getState(); + state->unsetFlags( (unsigned int)-1 ); + state->setFlags( flags ); + } else { + property = NetRoutingProperty::create( net ); + property->getState()->setFlags( flags ); + net->put( property ); + } + } else { + cerr << Error( "JsonNetRoutingProperty::toData(): %s must be a Net." + , getString(dbo).c_str() + ) << endl; + } + } else { + cerr << Error( "JsonNetRoutingProperty::toData(): No DBo in stack to attach to." ) << endl; + } + + update( stack, property ); + } + + // ------------------------------------------------------------------- // Class : "NetRoutingExtension" diff --git a/hurricane/src/hurricane/Observer.cpp b/hurricane/src/hurricane/Observer.cpp index ed652482..8326cc34 100644 --- a/hurricane/src/hurricane/Observer.cpp +++ b/hurricane/src/hurricane/Observer.cpp @@ -1,7 +1,7 @@ // -*- mode: C++; explicit-buffer-name: "Observer.cpp" -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/hurricane/src/hurricane/Occurrence.cpp b/hurricane/src/hurricane/Occurrence.cpp index 077a2969..04d78293 100644 --- a/hurricane/src/hurricane/Occurrence.cpp +++ b/hurricane/src/hurricane/Occurrence.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./Occurrence.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -34,23 +34,23 @@ namespace Hurricane { // **************************************************************************************************** Occurrence::Occurrence(const Entity* entity) -// ********************************* - : _entity(const_cast(entity)), - _sharedPath(NULL) +// ***************************************** + : _entity(const_cast(entity)) + , _sharedPath(NULL) { } Occurrence::Occurrence(const Entity* entity, const Path& path) -// *************************************************** - : _entity(const_cast(entity)), - _sharedPath(path._getSharedPath()) +// *********************************************************** + : _entity(const_cast(entity)) + , _sharedPath(path._getSharedPath()) { - if (!_entity) { - throw Error("Can't create " + _TName("Occurrence") + " : null entity"); - } - if (_sharedPath) - if (_entity->getCell() != _sharedPath->getMasterCell()) - throw Error("Can't create " + _TName("Occurrence") + " : incompatible path"); + if (!_entity) { + throw Error("Can't create " + _TName("Occurrence") + " : null entity"); + } + if (_sharedPath) + if (_entity->getCell() != _sharedPath->getMasterCell()) + throw Error("Can't create " + _TName("Occurrence") + " : incompatible path"); } Occurrence::Occurrence(const Occurrence& occurrence) @@ -261,6 +261,23 @@ string Occurrence::getCompactString() const return s; } +void Occurrence::toJson(JsonWriter* w) const +// ****************************************** +{ + w->startObject(); + jsonWrite( w, "@typename", "Occurrence" ); + jsonWrite( w, "_path" , getPath().getJsonString(w->getFlags()) ); + + w->key( "_entity" ); + if (not w->issetFlags(JsonWriter::DesignBlobMode)) { + getEntity()->toJsonSignature( w ); + } else { + jsonWrite( w, getEntity()->getId() ); + } + + w->endObject(); +} + Record* Occurrence::_getRecord() const // **************************** { @@ -308,9 +325,88 @@ string Occurrence::getName() const } +Initializer jsonOccurrenceInit ( 0 ); + + +void JsonOccurrence::initialize() +// ******************************* +{ JsonTypes::registerType( new JsonOccurrence (JsonWriter::RegisterMode) ); } + +JsonOccurrence::JsonOccurrence(unsigned long flags) +// ************************************************ + : JsonObject(flags) +{ + add( ".Cell" , typeid(Cell*) ); + add( "_path" , typeid(string) ); + + if (issetFlags(JsonWriter::DesignBlobMode)) { + add( "_entity", typeid(uint64_t) ); + } else { + add( "_entity", typeid(Entity*) ); + } +} + +JsonOccurrence* JsonOccurrence::clone(unsigned long flags) const +// ************************************************************* +{ return new JsonOccurrence ( flags ); } + +string JsonOccurrence::getTypeName() const +// *************************************** +{ return "Occurrence"; } + +void JsonOccurrence::toData(JsonStack& stack) +// ****************************************** +{ + check( stack, "JsonOccurrence::toData" ); + + Path path; + Entity* entity = NULL; + if (issetFlags(JsonWriter::DesignBlobMode)) { + entity = stack.getEntity( get(stack,"_entity") ); + + //Cell* cell = get( stack, ".Cell" ); + Instance* instance = NULL; + char separator = SharedPath::getNameSeparator(); + string pathIds = get( stack, "_path" ); + unsigned long id; + size_t dot = pathIds.find( separator ); + + if (dot != string::npos) { + id = stoul( pathIds.substr( 0, dot ) ); + pathIds = pathIds.substr( dot+1 ); + } else + id = stol( pathIds ); + + instance = stack.getEntity(id); + if (not instance) + throw Error( "JsonOccurrence::toData(): No Instance id:lu% (or not an Instance) in stack LUT.", id ); + path = Path( instance ); + + while ( dot != string::npos ) { + dot = pathIds.find( separator ); + if (dot != string::npos) { + id = stoul( pathIds.substr( 0, dot ) ); + pathIds = pathIds.substr( dot+1 ); + } else + id = stol( pathIds ); + + instance = stack.getEntity(id); + if (not instance) + throw Error( "JsonOccurrence::toData(): No Instance id:lu% (or not an Instance) in stack LUT.", id ); + path = Path( path, instance ); + } + } else { + entity = get(stack,"_entity"); + path = Path( get(stack,".Cell"), get(stack,"_path") ); + } + + Occurrence occurrence ( entity, path ); + update( stack, occurrence ); +} + } // End of Hurricane namespace. // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/Pad.cpp b/hurricane/src/hurricane/Pad.cpp index 2ad7aa36..da0e0b30 100644 --- a/hurricane/src/hurricane/Pad.cpp +++ b/hurricane/src/hurricane/Pad.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./Pad.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -17,6 +17,8 @@ // not, see . // **************************************************************************************************** +#include "hurricane/DataBase.h" +#include "hurricane/Technology.h" #include "hurricane/Pad.h" #include "hurricane/Net.h" #include "hurricane/BasicLayer.h" @@ -117,6 +119,15 @@ void Pad::setBoundingBox(const Box& boundingBox) } } +void Pad::_toJson(JsonWriter* writer) const +// **************************************** +{ + Inherit::_toJson( writer ); + + jsonWrite( writer, "_layer" , _layer->getName() ); + jsonWrite( writer, "_boundingBox", &_boundingBox ); +} + string Pad::_getString() const // *************************** { @@ -137,9 +148,60 @@ Record* Pad::_getRecord() const return record; } + +// **************************************************************************************************** +// JsonPad implementation +// **************************************************************************************************** + +Initializer jsonPadInit ( 0 ); + + +void JsonPad::initialize() +// ************************ +{ JsonTypes::registerType( new JsonPad (JsonWriter::RegisterMode) ); } + +JsonPad::JsonPad(unsigned long flags) +// ********************************** + : JsonComponent(flags) +{ + add( "_layer" , typeid(string) ); + add( "_boundingBox", typeid(Box) ); +} + +string JsonPad::getTypeName() const +// ******************************** +{ return "Pad"; } + +JsonPad* JsonPad::clone(unsigned long flags) const +// *********************************************** +{ return new JsonPad ( flags ); } + +void JsonPad::toData(JsonStack& stack) +// *********************************** +{ + check( stack, "JsonPad::toData" ); + unsigned int jsonId = presetId( stack ); + + Pad* pad = Pad::create + ( get(stack,".Net") + , DataBase::getDB()->getTechnology()->getLayer( get(stack,"_layer") ) + , get(stack,".Box") + ); + + JsonNet* jnet = jget( stack ); + if (jnet) { + jnet->addHookLink( pad->getBodyHook (), jsonId, get(stack,"_bodyHook" ) ); + } else { + cerr << Error( "JsonPad::toData(): Missing (Json)Net in stack context." ) << endl; + } + +// Hook/Ring rebuild are done as a post-process. + update( stack, pad ); +} + } // End of Hurricane namespace. // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/Path.cpp b/hurricane/src/hurricane/Path.cpp index 72c0253d..86ba8996 100644 --- a/hurricane/src/hurricane/Path.cpp +++ b/hurricane/src/hurricane/Path.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./Path.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -245,6 +245,38 @@ void Path::setNameSeparator(char nameSeparator) SharedPath::setNameSeparator(nameSeparator); } +string Path::getCompactString() const +// ********************************** +{ + if (isEmpty()) return ""; + + string s = "<"; + s += getString(getOwnerCell()->getName()); + s += ":"; + s += getString(_sharedPath->getName()) + ":"; + s += getString(getMasterCell()->getName()) + ">"; + return s; +} + +string Path::getJsonString(unsigned long flags) const +// ************************************************** +{ + if (isEmpty()) return ""; + + string s; + if (flags & JsonWriter::DesignBlobMode) { + //s += getString(getOwnerCell()->getId()) + "::"; + s += getString(_sharedPath->getJsonString(flags)); + //s += "::" + getString(getMasterCell()->getId()); + } else { + //s += getString(getOwnerCell()->getName()) + "::"; + s += getString(_sharedPath->getJsonString(flags)); + //s += "::" + getString(getMasterCell()->getName()); + } + + return s; +} + string Path::_getString() const // **************************** { @@ -269,10 +301,9 @@ Record* Path::_getRecord() const } - } // End of Hurricane namespace. // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/Pin.cpp b/hurricane/src/hurricane/Pin.cpp index 4eb64caf..45135e48 100644 --- a/hurricane/src/hurricane/Pin.cpp +++ b/hurricane/src/hurricane/Pin.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./Pin.cpp // Authors: Christophe Alexandre. -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -254,5 +254,5 @@ Record* Pin::PlacementStatus::_getRecord() const // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/Plug.cpp b/hurricane/src/hurricane/Plug.cpp index e65a2c5a..4c84cf51 100644 --- a/hurricane/src/hurricane/Plug.cpp +++ b/hurricane/src/hurricane/Plug.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./Plug.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -153,11 +153,12 @@ void Plug::setNet(Net* net) Plug* Plug::_create(Instance* instance, Net* masterNet) // **************************************************** { - Plug* plug = new Plug(instance, masterNet); + if (Entity::inForcedIdMode()) Entity::setNextId( 0 ); - plug->_postCreate(); + Plug* plug = new Plug(instance, masterNet); - return plug; + plug->_postCreate(); + return plug; } void Plug::_postCreate() @@ -179,15 +180,27 @@ void Plug::_destroy() void Plug::_preDestroy() // ******************** { -// trace << "entering Plug::_preDestroy: " << this << endl; -// trace_in(); + cdebug.log(18,1) << "entering Plug::_preDestroy: " << this << endl; - Inherit::_preDestroy(); + Inherit::_preDestroy(); - _instance->_getPlugMap()._remove(this); + _instance->_getPlugMap()._remove(this); -// trace << "exiting Plug::_preDestroy:" << endl; -// trace_out(); + cdebug.log(18) << "exiting Plug::_preDestroy:" << endl; + cdebug.tabw(18,-1); +} + +void Plug::_toJson(JsonWriter* writer) const +// ***************************************** +{ + if (writer->issetFlags(JsonWriter::UsePlugReference)) { + jsonWrite( writer, "_id" , getId() ); + jsonWrite( writer, "_instance", getInstance()->getName() ); + jsonWrite( writer, "_bodyHook", (const_cast(this)->getBodyHook())->getNextHook()->toJson() ); + } else { + Inherit::_toJson( writer ); + jsonWrite( writer, "_masterNet", getMasterNet()->getName() ); + } } string Plug::_getString() const @@ -217,9 +230,132 @@ string Plug::getName() const + getString(_masterNet->getName()); } + + +// **************************************************************************************************** +// JsonPlug implementation +// **************************************************************************************************** + +Initializer jsonPlugInit ( 0 ); + + +void JsonPlug::initialize() +// ************************* +{ JsonTypes::registerType( new JsonPlug (JsonWriter::RegisterMode) ); } + +JsonPlug::JsonPlug(unsigned long flags) +// ************************************ + : JsonComponent(flags) +{ + add( "_masterNet", typeid(string) ); +} + +string JsonPlug::getTypeName() const +// ********************************* +{ return "Plug"; } + +JsonPlug* JsonPlug::clone(unsigned long flags) const +// ************************************************* +{ return new JsonPlug ( flags ); } + +void JsonPlug::toData(JsonStack& stack) +// ************************************ +{ +// We are parsing an Instance. +// Plugs are automatically createds whith the Instance. +// Here we add the Plug to the stack's entity table that +// associates the Json Ids to the actual Hurricane ones. +// At the same time, we perform some coherency checking +// (i.e. the same Plug already exists). + +// For now, simply discard "_id" & "_propertySet". + check( stack, "JsonPlug::toData" ); + + Instance* instance = get(stack,".Instance"); + Plug* plug = NULL; + if (instance) { + Net* masterNet = instance->getMasterCell()->getNet( get(stack,"_masterNet") ); + if (not masterNet) { + cerr << Error( "JsonPlug::toData(): Incoherency, instance %s master doesn't containt net %s." + , getString(instance->getName()).c_str() + , get(stack,"_masterNet").c_str() + ) << endl; + } else { + unsigned int jsonId = get(stack,"_id"); + plug = instance->getPlug( masterNet ); + if (issetFlags(JsonWriter::DesignBlobMode)) + plug->forceId( jsonId ); + } + } else { + cerr << Error( "JsonPlug::toData(): Cannot find \".Instance\" in stack, skipping." ) << endl; + } + cdebug.log(19) << "Instance Plug contents ignored for now." << endl; + + update( stack, plug ); +} + + + +// **************************************************************************************************** +// JsonPlugRef implementation +// **************************************************************************************************** + +Initializer jsonPlugRefInit ( 0 ); + +void JsonPlugRef::initialize() +// **************************** +{ JsonTypes::registerType( new JsonPlugRef (JsonWriter::RegisterMode) ); } + +JsonPlugRef::JsonPlugRef(unsigned long flags) +// ****************************************** + : JsonObject(flags) +{ + add( ".Net" , typeid(Net*) ); + add( "_id" , typeid(uint64_t) ); + add( "_instance", typeid(string) ); + add( "_bodyHook", typeid(string) ); +} + +string JsonPlugRef::getTypeName() const +// ************************************ +{ return "&Plug"; } + +JsonPlugRef* JsonPlugRef::clone(unsigned long flags) const +// ******************************************************* +{ return new JsonPlugRef ( flags ); } + +void JsonPlugRef::toData(JsonStack& stack) +// *************************************** +{ + check( stack, "JsonPlugRef::toData" ); + +// We are parsing a Net, perform only a "Plug::setNet()". + Net* net = get(stack,".Net"); + Instance* instance = net->getCell()->getInstance( get(stack,"_instance") ); + unsigned int id = get(stack,"_id"); + + Plug* plug = stack.getEntity(id); + if (plug) { + plug->setNet( net ); + + JsonNet* jnet = jget( stack ); + if (jnet) { + jnet->addHookLink( plug->getBodyHook (), id, get(stack,"_bodyHook" ) ); + } else { + cerr << Error( "JsonPlug::toData(): Missing (Json)Net in stack context." ) << endl; + } + } else { + cerr << Error( "JsonPlugRef::toData(): No Plug id:%u in instance %s, while building net %s." + , id, getString(instance->getName()).c_str(), getString(net->getName()).c_str() + ) << endl; + } + + update( stack, plug ); +} + } // End of Hurricane namespace. // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/Point.cpp b/hurricane/src/hurricane/Point.cpp index 902dee17..f43557ed 100644 --- a/hurricane/src/hurricane/Point.cpp +++ b/hurricane/src/hurricane/Point.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./Point.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -123,11 +123,51 @@ Record* Point::_getRecord() const return record; } +void Point::toJson ( JsonWriter* w ) const +// **************************************** +{ + w->startObject(); + jsonWrite( w, "@typename", "Point" ); + jsonWrite( w, "_x", getX() ); + jsonWrite( w, "_y", getY() ); + w->endObject(); +} + +Initializer jsonPointInit ( 0 ); + +void JsonPoint::initialize() +// ************************** +{ JsonTypes::registerType( new JsonPoint (JsonWriter::RegisterMode) ); } + +JsonPoint::JsonPoint(unsigned long flags) +// ************************************** + : JsonObject(flags) +{ + add( "_x", typeid(int64_t) ); + add( "_y", typeid(int64_t) ); +} + +JsonPoint* JsonPoint::clone(unsigned long flags) const +// *************************************************** +{ return new JsonPoint ( flags ); } + +string JsonPoint::getTypeName() const +// ********************************** +{ return "Point"; } + +void JsonPoint::toData(JsonStack& stack) +// ************************************* +{ + check( stack, "JsonPoint::toData" ); + Point point ( DbU::fromDb(get(stack,"_x")) + , DbU::fromDb(get(stack,"_y")) ); + update( stack, point ); +} } // End of Hurricane namespace. // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/Property.cpp b/hurricane/src/hurricane/Property.cpp index cb03d59b..c29667db 100644 --- a/hurricane/src/hurricane/Property.cpp +++ b/hurricane/src/hurricane/Property.cpp @@ -1,7 +1,6 @@ - // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -19,12 +18,7 @@ // License along with Hurricane. If not, see // . // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | H U R R I C A N E | // | V L S I B a c k e n d D a t a - B a s e | // | | @@ -32,10 +26,7 @@ // | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Module : "./Property.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ #include "hurricane/Property.h" @@ -94,6 +85,13 @@ namespace Hurricane { } + bool Property::hasJson () const + { return false; } + + + void Property::toJson ( JsonWriter*, const DBo* ) const + { } + // ------------------------------------------------------------------- // Class : "Hurricane::PrivateProperty". @@ -149,6 +147,76 @@ namespace Hurricane { // ------------------------------------------------------------------- // Class : "Hurricane::SharedProperty". + SharedProperty::OrphanedMap SharedProperty::_orphaneds; + + + const SharedProperty::OrphanedMap& SharedProperty::getOrphaneds () + { return _orphaneds; } + + + SharedProperty* SharedProperty::getOrphaned ( const string& tag ) + { + auto iorphaned = _orphaneds.find( tag ); + if (iorphaned != _orphaneds.end()) return (*iorphaned).second._property; + + return NULL; + } + + + void SharedProperty::addOrphaned ( const string& tag, SharedProperty* property ) + { + auto iorphaned = _orphaneds.find( tag ); + if (iorphaned == _orphaneds.end()) { + _orphaneds.insert( make_pair(tag,Orphaned(property)) ); + } else { + if ((*iorphaned).second._property != property) { + cerr << Error( "SharedProperty::addOrphaned(): Multiple properties with the same tag \"%s\"." + , tag.c_str() + ) << endl; + } + } + } + + + void SharedProperty::refOrphaned ( const string& tag ) + { + auto iorphaned = _orphaneds.find( tag ); + if (iorphaned != _orphaneds.end()) { + (*iorphaned).second._refcount++; + } + } + + + void SharedProperty::countOrphaned ( const string& tag , unsigned int count ) + { + auto iorphaned = _orphaneds.find( tag ); + if (iorphaned != _orphaneds.end()) { + (*iorphaned).second._count = count; + } + } + + + void SharedProperty::removeOrphaned ( const string& tag ) + { + auto iorphaned = _orphaneds.find( tag ); + if (iorphaned != _orphaneds.end()) _orphaneds.erase( iorphaned ); + } + + + void SharedProperty::clearOrphaneds () + { + for ( auto element : _orphaneds ) { + if (element.second._refcount != element.second._count) { + cerr << Error( "SharedProperty::clearOrphaneds(): On tag \"%s\", count:%u refcount:%u." + , element.first.c_str() + , element.second._count + , element.second._refcount + ) << endl; + } + } + _orphaneds.clear(); + } + SharedProperty::SharedProperty () : Property() diff --git a/hurricane/src/hurricane/QuadTree.cpp b/hurricane/src/hurricane/QuadTree.cpp index 90ae798b..168adf25 100644 --- a/hurricane/src/hurricane/QuadTree.cpp +++ b/hurricane/src/hurricane/QuadTree.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./QuadTree.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -849,5 +849,5 @@ string QuadTree_GosUnder::Locator::_getString() const // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/Quark.cpp b/hurricane/src/hurricane/Quark.cpp index 13bd5606..0795ded6 100644 --- a/hurricane/src/hurricane/Quark.cpp +++ b/hurricane/src/hurricane/Quark.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./Quark.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -81,20 +81,19 @@ void Quark::_postCreate() void Quark::_preDestroy() // ********************* { -// trace << "entering Quark::_preDestroy: " << this << endl; -// trace_in(); + cdebug.log(18,1) << "entering Quark::_preDestroy: " << this << endl; - Inherit::_preDestroy(); + Inherit::_preDestroy(); - SharedPath* sharedPath = _occurrence._getSharedPath(); + SharedPath* sharedPath = _occurrence._getSharedPath(); - if (sharedPath) - sharedPath->_getQuarkMap()._remove(this); - else - if (NULL_SHARED_PATH_QUARK_MAP) NULL_SHARED_PATH_QUARK_MAP->_remove(this); + if (sharedPath) + sharedPath->_getQuarkMap()._remove(this); + else + if (NULL_SHARED_PATH_QUARK_MAP) NULL_SHARED_PATH_QUARK_MAP->_remove(this); -// trace << "exiting Quark::_preDestroy:" << endl; -// trace_out(); + cdebug.log(18) << "exiting Quark::_preDestroy:" << endl; + cdebug.tabw(18,-1); } string Quark::_getString() const @@ -138,5 +137,5 @@ Quark* Entity::_getQuark(SharedPath* sharedPath) const // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/Query.cpp b/hurricane/src/hurricane/Query.cpp index 4765d05e..b39bc620 100644 --- a/hurricane/src/hurricane/Query.cpp +++ b/hurricane/src/hurricane/Query.cpp @@ -1,6 +1,6 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // diff --git a/hurricane/src/hurricane/Record.cpp b/hurricane/src/hurricane/Record.cpp index 6309d8c8..2e0e160c 100644 --- a/hurricane/src/hurricane/Record.cpp +++ b/hurricane/src/hurricane/Record.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // diff --git a/hurricane/src/hurricane/Reference.cpp b/hurricane/src/hurricane/Reference.cpp index b907f926..9dfd156c 100644 --- a/hurricane/src/hurricane/Reference.cpp +++ b/hurricane/src/hurricane/Reference.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./Reference.cpp // Authors: J.-P. Chaput -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -105,5 +105,5 @@ Record* Reference::_getRecord() const // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/Region.cpp b/hurricane/src/hurricane/Region.cpp index acae74a4..883dec42 100644 --- a/hurricane/src/hurricane/Region.cpp +++ b/hurricane/src/hurricane/Region.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./Region.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -3142,5 +3142,5 @@ Region::leftRightFacing (const Box box) const // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/RegularLayer.cpp b/hurricane/src/hurricane/RegularLayer.cpp index b5ef14bd..ada523ed 100644 --- a/hurricane/src/hurricane/RegularLayer.cpp +++ b/hurricane/src/hurricane/RegularLayer.cpp @@ -1,6 +1,6 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -29,6 +29,7 @@ // +-----------------------------------------------------------------+ +#include "hurricane/DataBase.h" #include "hurricane/BasicLayer.h" #include "hurricane/RegularLayer.h" #include "hurricane/Technology.h" @@ -323,4 +324,123 @@ namespace Hurricane { } + void RegularLayer::_toJson ( JsonWriter* writer ) const + { + Super::_toJson( writer ); + + jsonWrite( writer, "_basicLayer" , _basicLayer->getName() ); + jsonWrite( writer, "_enclosure" , _enclosure ); + jsonWrite( writer, "_extentionCap" , _extentionCap ); + jsonWrite( writer, "_extentionWidth" , _extentionWidth ); + } + + +// ------------------------------------------------------------------- +// Class : "Hurricane::JsonRegularLayer". + + Initializer jsonRegularLayerInit ( 0 ); + + + void JsonRegularLayer::initialize () + { JsonTypes::registerType( new JsonRegularLayer (JsonWriter::RegisterMode) ); } + + + JsonRegularLayer::JsonRegularLayer ( unsigned long flags ) + : JsonLayer(flags) + { + if (flags & JsonWriter::RegisterMode) return; + + cdebug.log(19) << "JsonRegularLayer::JsonRegularLayer()" << endl; + + add( "_basicLayer" , typeid(string) ); + add( "_enclosure" , typeid(int64_t) ); + add( "_extentionCap" , typeid(int64_t) ); + add( "_extentionWidth", typeid(int64_t) ); + } + + + JsonRegularLayer::~JsonRegularLayer () + { } + + + string JsonRegularLayer::getTypeName () const + { return "RegularLayer"; } + + + JsonRegularLayer* JsonRegularLayer::clone ( unsigned long flags ) const + { return new JsonRegularLayer ( flags ); } + + + void JsonRegularLayer::toData( JsonStack& stack ) + { + cdebug.tabw(19,1); + + check( stack, "JsonRegularLayer::toData" ); + + Technology* techno = lookupTechnology( stack, "JsonRegularLayer::toData" ); + RegularLayer* layer = NULL; + + if (techno) { + string name = get ( stack, "_name" ); + string smask = get ( stack, "_mask" ); + DbU::Unit minimalSize = get( stack, "_minimalSize" ); + DbU::Unit minimalSpacing = get( stack, "_minimalSpacing" ); + bool isWorking = get ( stack, "_working" ); + + BasicLayer* basicLayer = techno->getBasicLayer( get(stack,"_basicLayer" ) ); + DbU::Unit enclosure = get( stack, "_enclosure" ); + DbU::Unit extensionCap = get( stack, "_extentionCap" ); + DbU::Unit extensionWidth = get( stack, "_extentionWidth" ); + + Layer::Mask mask = Layer::Mask::fromString( smask ); + + if (stack.issetFlags(JsonWriter::TechnoMode)) { + // Actual creation. + layer = RegularLayer::create( techno, name ); + layer->setBasicLayer ( basicLayer ); + layer->setWorking ( isWorking ); + layer->setMinimalSize ( minimalSize ); + layer->setMinimalSpacing( minimalSpacing ); + layer->setEnclosure ( basicLayer, enclosure ); + layer->setExtentionCap ( basicLayer, extensionCap ); + layer->setExtentionWidth( basicLayer, extensionWidth ); + + if (layer->getMask() != mask) { + cerr << Error( "JsonRegularLayer::toData(): Layer mask re-creation discrepency on \"%s\":\n" + " Blob: %s\n" + " DataBase: %s" + , name.c_str() + , getString(mask).c_str() + , getString(layer->getMask()).c_str() + ) << endl; + } + // Add here association with blockage layer... + } else { + // Check coherency with existing layer. + layer = dynamic_cast( techno->getLayer(name) ); + if (layer) { + if (layer->getMask() != mask) { + cerr << Error( "JsonRegularLayer::toData(): Layer mask discrepency on \"%s\":\n" + " Blob: %s\n" + " DataBase: %s" + , name.c_str() + , getString(mask).c_str() + , getString(layer->getMask()).c_str() + ) << endl; + } + } else { + cerr << Error( "JsonRegularLayer::toData(): No RegularLayer \"%s\" in the existing technology." + , name.c_str() + ) << endl; + } + } + } else { + cerr << Error( "JsonRegularLayer::toData(): Cannot find technology, aborting RegularLayer creation." ) << endl; + } + + update( stack, layer ); + + cdebug.tabw(19,-1); + } + } // Hurricane namespace. diff --git a/hurricane/src/hurricane/Relation.cpp b/hurricane/src/hurricane/Relation.cpp index ae58bac3..3a34cc07 100644 --- a/hurricane/src/hurricane/Relation.cpp +++ b/hurricane/src/hurricane/Relation.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./Relation.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -173,5 +173,5 @@ Record* StandardRelation::_getRecord() const // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/RoutingPad.cpp b/hurricane/src/hurricane/RoutingPad.cpp index 91b18cc8..726ba860 100644 --- a/hurricane/src/hurricane/RoutingPad.cpp +++ b/hurricane/src/hurricane/RoutingPad.cpp @@ -1,6 +1,6 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -38,6 +38,7 @@ #include "hurricane/Segment.h" #include "hurricane/Horizontal.h" #include "hurricane/Vertical.h" +#include "hurricane/Pad.h" #include "hurricane/Cell.h" #include "hurricane/Instance.h" #include "hurricane/Warning.h" @@ -50,6 +51,9 @@ namespace Hurricane { using std::ostringstream; +// ------------------------------------------------------------------- +// Class : "RoutingPad". + RoutingPad::RoutingPad ( Net* net, Occurrence occurrence ) : Inherit (net) , _occurrence(occurrence) @@ -61,18 +65,27 @@ namespace Hurricane { if ( not net ) throw Error ("Can't create RoutingPad : NULL net"); if ( not occurrence.isValid() ) throw Error ("Can't create RoutingPag : Invalid occurrence"); - Plug* plug = NULL; - Pin* pin = NULL; - Contact* contact = NULL; + Plug* plug = NULL; + Pin* pin = NULL; + Contact* contact = NULL; + Horizontal* horizontal = NULL; + Vertical* vertical = NULL; + Pad* pad = NULL; if ( (plug = dynamic_cast(occurrence.getEntity()) ) == NULL) { if ( (pin = dynamic_cast(occurrence.getEntity()) ) == NULL) { - contact = dynamic_cast(occurrence.getEntity()); + if ( (contact = dynamic_cast(occurrence.getEntity()) ) == NULL) { + if ( (horizontal = dynamic_cast(occurrence.getEntity()) ) == NULL) { + if ( (vertical = dynamic_cast(occurrence.getEntity()) ) == NULL) { + pad = dynamic_cast(occurrence.getEntity()); + } + } + } } } - if ( (not plug) and (not pin) and (not contact) ) - throw Error ("Can't create RoutingPad : Plug, Pin, or Contact Occurrence *required*"); + if ( (not plug) and (not pin) and (not contact) and (not horizontal) and (not vertical) and (not pad) ) + throw Error ("Can't create RoutingPad : Plug, Pin, Contact, Horizontal, Vertical or Pad Occurrence *required*"); RoutingPad* routingPad = new RoutingPad( net, occurrence ); routingPad->_postCreate(); @@ -156,8 +169,9 @@ namespace Hurricane { Box RoutingPad::getBoundingBox ( const BasicLayer* basicLayer ) const { Component* component = _getEntityAsComponent(); - if ( component ) + if ( component ) { return _occurrence.getPath().getTransformation().getBox ( component->getBoundingBox(basicLayer) ); + } return Box(getPosition()); } @@ -175,8 +189,9 @@ namespace Hurricane { Point RoutingPad::getPosition () const { Component* component = _getEntityAsComponent(); - if (component) + if (component) { return _occurrence.getPath().getTransformation().getPoint( component->getCenter() ); + } return Point(); } @@ -221,18 +236,23 @@ namespace Hurricane { void RoutingPad::_preDestroy () { - // trace << "entering RoutingPad::preDestroy: " << this << endl; - // trace_in(); + cdebug.log(18,1) << "entering RoutingPad::preDestroy: " << this << endl; if ( not _occurrence.getPath().isEmpty() ) _occurrence.getMasterCell()->_removeSlaveEntity(_occurrence.getEntity(),this); Inherit::_preDestroy(); - // trace << "exiting RoutingPad::preDestroy:" << endl; - // trace_out(); + cdebug.log(18) << "exiting RoutingPad::preDestroy:" << endl; + cdebug.tabw(18,-1); } + void RoutingPad::_toJson ( JsonWriter* writer ) const + { + Inherit::_toJson( writer ); + jsonWrite( writer, "_occurrence", &_occurrence ); + } + string RoutingPad::_getString () const { string s = Inherit::_getString(); @@ -379,4 +399,49 @@ namespace Hurricane { } +// ------------------------------------------------------------------- +// Class : "JsonRoutingPad". + + Initializer jsonRoutingPadInit ( 0 ); + + + void JsonRoutingPad::initialize () + { JsonTypes::registerType( new JsonRoutingPad (JsonWriter::RegisterMode) ); } + + + JsonRoutingPad::JsonRoutingPad ( unsigned long flags ) + : JsonComponent(flags) + { + add( "_occurrence", typeid(Occurrence) ); + } + + string JsonRoutingPad::getTypeName () const + { return "RoutingPad"; } + + + JsonRoutingPad* JsonRoutingPad::clone ( unsigned long flags ) const + { return new JsonRoutingPad ( flags ); } + + + void JsonRoutingPad::toData ( JsonStack& stack ) + { + check( stack, "JsonRoutingPad::toData" ); + unsigned int jsonId = presetId( stack ); + + RoutingPad* rp = RoutingPad::create + ( get (stack,".Net") + , get(stack,"_occurrence") + ); + + JsonNet* jnet = jget( stack ); + if (jnet) { + jnet->addHookLink( rp->getBodyHook (), jsonId, get(stack,"_bodyHook" ) ); + } else { + cerr << Error( "JsonRoutingPad::toData(): Missing (Json)Net in stack context." ) << endl; + } + + update( stack, rp ); + } + + } // End of Hurricane namespace. diff --git a/hurricane/src/hurricane/Rubber.cpp b/hurricane/src/hurricane/Rubber.cpp index f959898a..a676eaf8 100644 --- a/hurricane/src/hurricane/Rubber.cpp +++ b/hurricane/src/hurricane/Rubber.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./Rubber.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -179,22 +179,21 @@ void Rubber::_destroy() void Rubber::_preDestroy() // ********************** { -// trace << "entering Rubber::_preDestroy: " << this << endl; -// trace_in(); + cdebug.log(18,1) << "entering Rubber::_preDestroy: " << this << endl; - Inherit::_preDestroy(); + Inherit::_preDestroy(); - _count = (unsigned)-1; // to avoid a new destruction + _count = (unsigned)-1; // to avoid a new destruction - for_each_hook(hook, getHooks()) { - hook->getComponent()->_setRubber(NULL); - end_for; - } + for_each_hook(hook, getHooks()) { + hook->getComponent()->_setRubber(NULL); + end_for; + } - _net->_getRubberSet()._remove(this); + _net->_getRubberSet()._remove(this); -// trace << "exiting Rubber::_preDestroy:" << endl; -// trace_out(); + cdebug.log(18) << "exiting Rubber::_preDestroy:" << endl; + cdebug.tabw(18,-1); } string Rubber::_getString() const @@ -270,5 +269,5 @@ typedef struct pcmp_s { // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/Segment.cpp b/hurricane/src/hurricane/Segment.cpp index 1eba7e0c..aa0ecc21 100644 --- a/hurricane/src/hurricane/Segment.cpp +++ b/hurricane/src/hurricane/Segment.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./Segment.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -294,16 +294,26 @@ void Segment::invert() void Segment::_preDestroy() // *********************** { -// trace << "entering Segment::_preDestroy: " << this << endl; -// trace_in(); + cdebug.log(18,1) << "entering Segment::_preDestroy: " << this << endl; - Inherit::_preDestroy(); + Inherit::_preDestroy(); - _sourceHook.detach(); - _targetHook.detach(); + _sourceHook.detach(); + _targetHook.detach(); -// trace << "exiting Segment::_preDestroy:" << endl; -// trace_out(); + cdebug.log(18) << "exiting Segment::_preDestroy:" << endl; + cdebug.tabw(18,-1); +} + +void Segment::_toJson(JsonWriter* writer) const +// ******************************************** +{ + Inherit::_toJson( writer ); + + jsonWrite( writer, "_sourceHook", _sourceHook.getNextHook()->toJson() ); + jsonWrite( writer, "_targetHook", _targetHook.getNextHook()->toJson() ); + jsonWrite( writer, "_layer" , _layer->getName() ); + jsonWrite( writer, "_width" , _width ); } string Segment::_getString() const @@ -318,7 +328,7 @@ string Segment::_getString() const } Record* Segment::_getRecord() const -// ************************** +// ******************************** { Record* record = Inherit::_getRecord(); if (record) { @@ -332,6 +342,7 @@ Record* Segment::_getRecord() const return record; } + // **************************************************************************************************** // Segment::SourceHook implementation // **************************************************************************************************** @@ -342,11 +353,13 @@ Segment::SourceHook::SourceHook(Segment* segment) // ********************************************** : Inherit() { - if (!segment) - throw Error("Can't create " + _TName("Segment::SourceHook") + " (null segment)"); + if (!segment) + throw Error("Can't create " + _getTypeName() + " (null segment)"); - if (SOURCE_HOOK_OFFSET == -1) - SOURCE_HOOK_OFFSET = (unsigned long)this - (unsigned long)segment; + if (SOURCE_HOOK_OFFSET == -1) { + SOURCE_HOOK_OFFSET = (unsigned long)this - (unsigned long)segment; + Hook::addCompToHook(_getTypeName(),_compToHook); + } } Component* Segment::SourceHook::getComponent() const @@ -361,6 +374,16 @@ string Segment::SourceHook::_getString() const return "<" + _TName("Segment::SourceHook") + " " + getString(getComponent()) + ">"; } +Hook* Segment::SourceHook::_compToHook(Component* component) +// *************************************************************** +{ + Segment* segment = dynamic_cast(component); + if (not segment) { + throw Error( "SourceHook::_compToHook(): Unable to cast %s into Segment*." + , getString(component).c_str() ); + } + return &(segment->_sourceHook); +} // **************************************************************************************************** @@ -376,8 +399,10 @@ Segment::TargetHook::TargetHook(Segment* segment) if (!segment) throw Error("Can't create " + _TName("Segment::TargetHook") + " (null segment)"); - if (TARGET_HOOK_OFFSET == -1) - TARGET_HOOK_OFFSET = (unsigned long)this - (unsigned long)segment; + if (TARGET_HOOK_OFFSET == -1) { + TARGET_HOOK_OFFSET = (unsigned long)this - (unsigned long)segment; + Hook::addCompToHook(_getTypeName(),_compToHook); + } } Component* Segment::TargetHook::getComponent() const @@ -392,6 +417,18 @@ string Segment::TargetHook::_getString() const return "<" + _TName("Segment::TargetHook") + " " + getString(getComponent()) + ">"; } +Hook* Segment::TargetHook::_compToHook(Component* component) +// *************************************************************** +{ + Segment* segment = dynamic_cast(component); + if (not segment) { + throw Error( "TargetHook::_compToHook(): Unable to cast %s into Segment*." + , getString(component).c_str() ); + } + return &(segment->_targetHook); +} + + // **************************************************************************************************** // Segment_Hooks implementation // **************************************************************************************************** @@ -633,9 +670,23 @@ string Segment_Anchors::Locator::_getString() const +// **************************************************************************************************** +// JsonSegment implementation +// **************************************************************************************************** + +JsonSegment::JsonSegment(unsigned long flags) +// ****************************************** + : JsonComponent(flags) +{ + add( "_sourceHook", typeid(string) ); + add( "_targetHook", typeid(string) ); + add( "_layer" , typeid(uint64_t) ); + add( "_width" , typeid(uint64_t) ); +} + } // End of Hurricane namespace. // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/SharedName.cpp b/hurricane/src/hurricane/SharedName.cpp index a9fad720..f5d1f065 100644 --- a/hurricane/src/hurricane/SharedName.cpp +++ b/hurricane/src/hurricane/SharedName.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./SharedName.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -99,5 +99,5 @@ bool SharedName::SharedNameMapComparator::operator()(string* s1, string* s2) con // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/SharedPath.cpp b/hurricane/src/hurricane/SharedPath.cpp index 04d83f7e..5fb5a79a 100644 --- a/hurricane/src/hurricane/SharedPath.cpp +++ b/hurricane/src/hurricane/SharedPath.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./SharedPath.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -122,9 +122,13 @@ SharedPath::SharedPath(Instance* headInstance, SharedPath* tailSharedPath) if (_tailSharedPath && (_tailSharedPath->getOwnerCell() != _headInstance->getMasterCell())) throw Error( "Can't create %s, incompatible tail path between:\n" + " - head instance %s\n" + " - tail path %s\n" " - head owner %s\n" " - tail owner %s\n" , _TName("SharedPath").c_str() + , getString(_headInstance ).c_str() + , getString(_tailSharedPath).c_str() , getString(_headInstance ->getMasterCell()).c_str() , getString(_tailSharedPath->getOwnerCell ()).c_str() ); @@ -186,6 +190,23 @@ string SharedPath::getName() const return name; } +string SharedPath::getJsonString(unsigned long flags) const +// ******************************************************** +{ + string name = ""; + SharedPath* sharedPath = (SharedPath*)this; + while (sharedPath) { + if (flags & JsonWriter::DesignBlobMode) + name += getString(sharedPath->getHeadInstance()->getId()); + else + name += getString(sharedPath->getHeadInstance()->getName()); + + sharedPath = sharedPath->getTailSharedPath(); + if (sharedPath) name += getNameSeparator(); + } + return name; +} + Cell* SharedPath::getOwnerCell() const // *********************************** { @@ -398,5 +419,5 @@ string SharedPath_Instances::Locator::_getString() const // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/Signature.cpp b/hurricane/src/hurricane/Signature.cpp new file mode 100644 index 00000000..c300bf9e --- /dev/null +++ b/hurricane/src/hurricane/Signature.cpp @@ -0,0 +1,174 @@ +// -*- C++ -*- +// +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved +// +// This file is part of Hurricane. +// +// Hurricane is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// Hurricane is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- +// TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU +// General Public License for more details. +// +// You should have received a copy of the Lesser GNU General Public +// License along with Hurricane. If not, see +// . +// +// +-----------------------------------------------------------------+ +// | H U R R I C A N E | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Authors : Jean-Paul Chaput | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./Signature.cpp" | +// +-----------------------------------------------------------------+ + + +#include "hurricane/Path.h" +#include "hurricane/DataBase.h" +#include "hurricane/Technology.h" +#include "hurricane/Net.h" +#include "hurricane/Cell.h" +#include "hurricane/Instance.h" +#include "hurricane/Contact.h" +#include "hurricane/Vertical.h" +#include "hurricane/Horizontal.h" +#include "hurricane/Pad.h" +#include "hurricane/Signature.h" + + +namespace Hurricane { + + using std::ostringstream; + + +// ------------------------------------------------------------------- +// Class : "Signature". + + void Signature::setLayer ( const std::string& layer ) + { + _layer = DataBase::getDB()->getTechnology()->getLayer( layer ); + } + + +// ------------------------------------------------------------------- +// Class : "JsonSignature". + + Initializer jsonSignatureInit ( 0 ); + + + void JsonSignature::initialize () + { JsonTypes::registerType( new JsonSignature (JsonWriter::RegisterMode) ); } + + + JsonSignature::JsonSignature ( unsigned long flags ) + : JsonObject (flags) + , _subTypeName("unset") + { } + + string JsonSignature::getTypeName () const + { return "Signature"; } + + + void JsonSignature::setSubType ( const std::string& subTypeName ) + { + clear(); + _subTypeName = subTypeName; + + if (_subTypeName == "Instance") { + add( "_instance" , typeid(string) ); + } else if (_subTypeName == "Net") { + add( "_name", typeid(string) ); + } else if (_subTypeName == "Plug") { + add( "_masterNet", typeid(string) ); + } else if (_subTypeName == "Contact") { + add( "_net", typeid(string) ); + JsonContact jobject (0); + copyAttrs( &jobject ); + } else if (_subTypeName == "Vertical") { + add( "_net", typeid(string) ); + JsonVertical jobject (0); + copyAttrs( &jobject ); + } else if (_subTypeName == "Horizontal") { + add( "_net", typeid(string) ); + JsonHorizontal jobject (0); + copyAttrs( &jobject ); + } + } + + JsonSignature* JsonSignature::clone ( unsigned long flags ) const + { return new JsonSignature ( flags ); } + + + void JsonSignature::toData ( JsonStack& stack ) + { + cdebug.log(19) << (void*)this << " _subTypeName:" << _subTypeName << endl; + + check( stack, "JsonSignature::toData" ); + + Cell* ownerCell = get ( stack, ".Cell" ); + string pathName = get( stack, "_path" ); + Path path ( ownerCell, pathName ); + Cell* masterCell = path.getMasterCell(); + Entity* entity = NULL; + + if (_subTypeName == "Instance") { + entity = masterCell->getInstance( get(stack,"_name") ); + } else if (_subTypeName == "Net") { + entity = masterCell->getNet( get(stack,"_name") ); + } else if (_subTypeName == "Plug") { + Net* masterNet = masterCell->getNet( get(stack,"_masterNet") ); + entity = path.getTailInstance()->getPlug( masterNet ); + } else if (_subTypeName == "Contact") { + Signature signature; + signature.setType ( Signature::TypeContact ); + signature.setName ( get(stack,"_net" ) ); + signature.setLayer( get(stack,"_layer" ) ); + signature.setDim( Signature::ContactDx , get(stack,"_dx" ) ); + signature.setDim( Signature::ContactDy , get(stack,"_dy" ) ); + signature.setDim( Signature::ContactWidth , get(stack,"_width" ) ); + signature.setDim( Signature::ContactHeight, get(stack,"_height") ); + entity = masterCell->getEntity( signature ); + } else if (_subTypeName == "Vertical") { + Signature signature; + signature.setType ( Signature::TypeVertical ); + signature.setName ( get(stack,"_net" ) ); + signature.setLayer( get(stack,"_layer") ); + signature.setDim( Signature::VerticalWidth , get(stack,"_width" ) ); + signature.setDim( Signature::VerticalX , get(stack,"_x" ) ); + signature.setDim( Signature::VerticalDySource, get(stack,"_dySource") ); + signature.setDim( Signature::VerticalDyTarget, get(stack,"_dyTarget") ); + entity = masterCell->getEntity( signature ); + } else if (_subTypeName == "Horizontal") { + Signature signature; + signature.setType ( Signature::TypeHorizontal ); + signature.setName ( get(stack,"_net" ) ); + signature.setLayer( get(stack,"_layer") ); + signature.setDim( Signature::HorizontalWidth , get(stack,"_width" ) ); + signature.setDim( Signature::HorizontalY , get(stack,"_y" ) ); + signature.setDim( Signature::HorizontalDxSource, get(stack,"_dxSource") ); + signature.setDim( Signature::HorizontalDxTarget, get(stack,"_dxTarget") ); + entity = masterCell->getEntity( signature ); + } else if (_subTypeName == "Pad") { + Signature signature; + signature.setType ( Signature::TypePad ); + signature.setName ( get(stack,"_net" ) ); + signature.setLayer( get(stack,"_layer") ); + Box bb = get(stack, "_boundingBox" ); + signature.setDim( Signature::PadXMin, bb.getXMin() ); + signature.setDim( Signature::PadYMin, bb.getYMin() ); + signature.setDim( Signature::PadXMax, bb.getXMax() ); + signature.setDim( Signature::PadYMax, bb.getYMax() ); + entity = masterCell->getEntity( signature ); + } + + update( stack, entity ); + } + + +} // End of Hurricane namespace. diff --git a/hurricane/src/hurricane/Slice.cpp b/hurricane/src/hurricane/Slice.cpp index 17751fb8..2595cb86 100644 --- a/hurricane/src/hurricane/Slice.cpp +++ b/hurricane/src/hurricane/Slice.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./Slice.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -125,5 +125,5 @@ Record* Slice::_getRecord() const // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/Slot.cpp b/hurricane/src/hurricane/Slot.cpp index bc3bce15..107b56a1 100644 --- a/hurricane/src/hurricane/Slot.cpp +++ b/hurricane/src/hurricane/Slot.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -41,8 +41,6 @@ #include "hurricane/Commons.h" - - namespace Hurricane { diff --git a/hurricane/src/hurricane/Tabulation.cpp b/hurricane/src/hurricane/Tabulation.cpp index 39a0ac42..d750916d 100644 --- a/hurricane/src/hurricane/Tabulation.cpp +++ b/hurricane/src/hurricane/Tabulation.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./Tabulation.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -17,7 +17,8 @@ // not, see . // **************************************************************************************************** -#include "hurricane/Tabulation.h" + +#include "hurricane/Commons.h" namespace Hurricane { @@ -107,5 +108,5 @@ Tabulation tab(" "); // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/Technology.cpp b/hurricane/src/hurricane/Technology.cpp index 04e536fe..5b5ce23a 100644 --- a/hurricane/src/hurricane/Technology.cpp +++ b/hurricane/src/hurricane/Technology.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./Technology.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -17,6 +17,8 @@ // not, see . // **************************************************************************************************** +#include "hurricane/Warning.h" +#include "hurricane/Error.h" #include "hurricane/SharedName.h" #include "hurricane/Technology.h" #include "hurricane/DataBase.h" @@ -27,6 +29,21 @@ #include "hurricane/Error.h" +namespace { + + class CompareByMask { + public: + bool operator() ( const Hurricane::Layer* lhs, const Hurricane::Layer* rhs ) + { + if (not lhs) return rhs; + if (not rhs) return false; + + return lhs->getMask() < rhs->getMask(); + } + }; + +} // Anonymous namespace. + namespace Hurricane { @@ -334,10 +351,9 @@ void Technology::_preDestroy() // ************************** { - while ( !_layerMap.isEmpty() ) { + while ( not _layerMap.isEmpty() ) { _layerMap.getElements().getFirst()->destroy(); } - //for_each_layer(layer, getLayers()) layer->destroy(); end_for; _dataBase->_setTechnology(NULL); DBo::_preDestroy(); @@ -363,14 +379,12 @@ void Technology::_removeFromLayerMaskMap ( Layer* layer ) } } - string Technology::_getTypeName () const +// ************************************** { return _TName("Technology"); } - - string Technology::_getString() const // ********************************** { @@ -393,6 +407,38 @@ Record* Technology::_getRecord() const return record; } +void Technology::_toJson(JsonWriter* writer) const +// *********************************************** +{ + Inherit::_toJson( writer ); + + jsonWrite( writer, "_name", getName() ); +} + +void Technology::_toJsonCollections(JsonWriter* writer) const +// *********************************************************** +{ + writer->key( "+layers" ); + writer->startArray(); + + vector basicLayers; + vector layers; + for ( Layer* layer : getLayers() ) { + BasicLayer* basicLayer = dynamic_cast( layer ); + if (basicLayer) basicLayers.push_back( basicLayer ); + else layers .push_back( layer ); + } + + sort( basicLayers.begin(), basicLayers.end(), CompareByMask() ); + sort( layers .begin(), layers .end(), CompareByMask() ); + + for ( BasicLayer* basicLayer : basicLayers ) jsonWrite( writer, basicLayer ); + for ( Layer* layer : layers ) jsonWrite( writer, layer ); + + writer->endArray(); +} + + // **************************************************************************************************** // Technology::LayerMap implementation // **************************************************************************************************** @@ -575,9 +621,99 @@ string Technology_BasicLayers::Locator::_getString() const return s; } + + +// **************************************************************************************************** +// JsonTechnology implementation +// **************************************************************************************************** + +Initializer jsonTechnologyInit ( 0 ); + +void JsonTechnology::initialize() +// ******************************* +{ JsonTypes::registerType( new JsonTechnology (JsonWriter::RegisterMode) ); } + +JsonTechnology::JsonTechnology(unsigned long flags) +// ************************************************ + : JsonDBo (flags) + , _blockagesMap() +{ + if (flags & JsonWriter::RegisterMode) return; + + cdebug.log(19) << "JsonTechnology::JsonTechnology()" << endl; + + add( "_name" , typeid(string) ); + add( "+layers", typeid(JsonArray) ); +} + +JsonTechnology::~JsonTechnology() +// ****************************** +{ + const Technology* techno = getObject(); + + for ( auto element : _blockagesMap ) { + BasicLayer* blockage = techno->getBasicLayer( element.first ); + if (blockage) { + for ( BasicLayer* layer : element.second ) { + layer->setBlockageLayer( blockage ); + } + } + } +} + +string JsonTechnology::getTypeName() const +// **************************************** +{ return "Technology"; } + +JsonTechnology* JsonTechnology::clone(unsigned long flags) const +// ************************************************************* +{ return new JsonTechnology ( flags ); } + +void JsonTechnology::addBlockageRef(const string& blockageLayer, BasicLayer* layer ) +// ********************************************************************************* +{ + map< string, vector >::iterator im = _blockagesMap.find( blockageLayer ); + if (im != _blockagesMap.end()) { + (*im).second.push_back( layer ); + } else { + _blockagesMap.insert( make_pair( blockageLayer, vector(1,layer) ) ); + } +} + +void JsonTechnology::toData(JsonStack& stack) +// ****************************************** +{ + cdebug.tabw(19,1); + + check( stack, "JsonTechnology::toData" ); + + string technoName = get( stack, "_name" ); + Technology* techno = DataBase::getDB()->getTechnology(); + + if (techno) { + if (techno->getName() == technoName) { + cerr << Warning( "JsonTechnology::toData(): A technology with the same name (%s) is already loaded." + , technoName.c_str() + ) << endl; + } else { + cerr << Error( "JsonTechnology::toData(): Try to load \"%s\", but \"%s\" is already loaded." + , technoName.c_str() + , getString(techno->getName()).c_str() + ) << endl; + } + } else { + techno = Technology::create( DataBase::getDB(), technoName ); + stack.setFlags( JsonWriter::TechnoMode ); + } + + update( stack, techno ); + + cdebug.tabw(19,-1); +} + } // End of Hurricane namespace. // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/Transformation.cpp b/hurricane/src/hurricane/Transformation.cpp index fd83a29a..cf629c7b 100644 --- a/hurricane/src/hurricane/Transformation.cpp +++ b/hurricane/src/hurricane/Transformation.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./Transformation.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -255,6 +255,16 @@ Record* Transformation::_getRecord() const return record; } +void Transformation::toJson ( JsonWriter* w ) const +// ************************************************* +{ + w->startObject(); + jsonWrite( w, "@typename", "Transformation" ); + jsonWrite( w, "_tx", getTx() ); + jsonWrite( w, "_ty", getTy() ); + jsonWrite( w, "_orientation", getString( &(getOrientation().getCode()) ) ); + w->endObject(); +} // **************************************************************************************************** @@ -273,6 +283,20 @@ Transformation::Orientation::Orientation(const Orientation& orientation) { } +Transformation::Orientation::Orientation(const string& s) +// ****************************************************** +: _code(ID) +{ + if (s == "ID") _code = ID; + else if (s == "R1") _code = R1; + else if (s == "R2") _code = R2; + else if (s == "R3") _code = R3; + else if (s == "MX") _code = MX; + else if (s == "XR") _code = XR; + else if (s == "MY") _code = MY; + else if (s == "YR") _code = YR; +} + Transformation::Orientation& Transformation::Orientation::operator=(const Orientation& orientation) // ************************************************************************************************ { @@ -295,10 +319,48 @@ Record* Transformation::Orientation::_getRecord() const } +// **************************************************************************************************** +// JsonTransformation implementation +// **************************************************************************************************** + +Initializer jsonTransformationInit ( 0 ); + +void JsonTransformation::initialize() +// ************************** +{ JsonTypes::registerType( new JsonTransformation (JsonWriter::RegisterMode) ); } + +JsonTransformation::JsonTransformation(unsigned long flags) +// ******************************************************** + : JsonObject(flags) +{ + add( "_tx" , typeid(int64_t) ); + add( "_ty" , typeid(int64_t) ); + add( "_orientation", typeid(string) ); +} + +string JsonTransformation::getTypeName() const +// ******************************************* +{ return "Transformation"; } + +JsonTransformation* JsonTransformation::clone(unsigned long flags) const +// ********************************************************************* +{ return new JsonTransformation ( flags ); } + +void JsonTransformation::toData(JsonStack& stack) +// ********************************************** +{ + check( stack, "JsonTransformation::toData" ); + + Transformation transf ( get(stack,"_tx") + , get(stack,"_ty") + , Transformation::Orientation(get(stack,"_orientation")) ); + + update( stack, transf ); +} } // End of Hurricane namespace. // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/TransistorLayer.cpp b/hurricane/src/hurricane/TransistorLayer.cpp index 9a678d4a..41ecde68 100644 --- a/hurricane/src/hurricane/TransistorLayer.cpp +++ b/hurricane/src/hurricane/TransistorLayer.cpp @@ -1,7 +1,6 @@ - // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -19,12 +18,7 @@ // License along with Hurricane. If not, see // . // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | H U R R I C A N E | // | V L S I B a c k e n d D a t a - B a s e | // | | @@ -32,16 +26,14 @@ // | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Module : "./TransistorLayer.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ -#include "hurricane/BasicLayer.h" -#include "hurricane/TransistorLayer.h" -#include "hurricane/Technology.h" -#include "hurricane/Error.h" +#include "hurricane/DataBase.h" +#include "hurricane/Technology.h" +#include "hurricane/BasicLayer.h" +#include "hurricane/TransistorLayer.h" +#include "hurricane/Error.h" namespace { @@ -229,4 +221,161 @@ namespace Hurricane { } + void TransistorLayer::_toJson ( JsonWriter* w ) const + { + Super::_toJson( w ); + + jsonWrite( w, "_gate" , _basicLayers[0]->getName() ); + jsonWrite( w, "_active" , _basicLayers[1]->getName() ); + jsonWrite( w, "_diffusion", _basicLayers[2]->getName() ); + if (_basicLayers.size() == 4) jsonWrite( w, "_well" , _basicLayers[3]->getName() ); + else jsonWrite( w, "_well", "no_well_layer" ); + + jsonWrite( w, "_extentionCap.gate" , _extentionCaps[0] ); + jsonWrite( w, "_extentionCap.active" , _extentionCaps[1] ); + jsonWrite( w, "_extentionCap.diffusion", _extentionCaps[2] ); + jsonWrite( w, "_extentionCap.well" , (_basicLayers.size() == 4) ? _extentionCaps[3] : 0 ); + + jsonWrite( w, "_extentionWidth.gate" , _extentionWidths[0] ); + jsonWrite( w, "_extentionWidth.active" , _extentionWidths[1] ); + jsonWrite( w, "_extentionWidth.diffusion", _extentionWidths[2] ); + jsonWrite( w, "_extentionWidth.well" , (_basicLayers.size() == 4) ? _extentionWidths[3] : 0 ); + } + + +// ------------------------------------------------------------------- +// Class : "Hurricane::JsonTransistorLayer". + + Initializer jsonTransistorLayerInit ( 0 ); + + + void JsonTransistorLayer::initialize () + { JsonTypes::registerType( new JsonTransistorLayer (JsonWriter::RegisterMode) ); } + + + JsonTransistorLayer::JsonTransistorLayer ( unsigned long flags ) + : JsonLayer(flags) + { + if (flags & JsonWriter::RegisterMode) return; + + cdebug.log(19) << "JsonTransistorLayer::JsonTransistorLayer()" << endl; + + add( "_gate" , typeid(string) ); + add( "_active" , typeid(string) ); + add( "_diffusion" , typeid(string) ); + add( "_well" , typeid(string) ); + add( "_extentionCap.gate" , typeid(int64_t) ); + add( "_extentionCap.active" , typeid(int64_t) ); + add( "_extentionCap.diffusion" , typeid(int64_t) ); + add( "_extentionCap.well" , typeid(int64_t) ); + add( "_extentionWidth.gate" , typeid(int64_t) ); + add( "_extentionWidth.active" , typeid(int64_t) ); + add( "_extentionWidth.diffusion", typeid(int64_t) ); + add( "_extentionWidth.well" , typeid(int64_t) ); + } + + + JsonTransistorLayer::~JsonTransistorLayer () + { } + + + string JsonTransistorLayer::getTypeName () const + { return "TransistorLayer"; } + + + JsonTransistorLayer* JsonTransistorLayer::clone ( unsigned long flags ) const + { return new JsonTransistorLayer ( flags ); } + + + void JsonTransistorLayer::toData ( JsonStack& stack ) + { + cdebug.tabw(19,1); + + check( stack, "JsonTransistorLayer::toData" ); + + Technology* techno = lookupTechnology( stack, "JsonTransistorLayer::toData" ); + TransistorLayer* layer = NULL; + + if (techno) { + string name = get ( stack, "_name" ); + string smask = get ( stack, "_mask" ); + //DbU::Unit minimalSize = get( stack, "_minimalSize" ); + //DbU::Unit minimalSpacing = get( stack, "_minimalSpacing" ); + bool isWorking = get ( stack, "_working" ); + + BasicLayer* gate = techno->getBasicLayer( get(stack,"_gate" ) ); + BasicLayer* active = techno->getBasicLayer( get(stack,"_active" ) ); + BasicLayer* diffusion = techno->getBasicLayer( get(stack,"_diffusion" ) ); + BasicLayer* well = techno->getBasicLayer( get(stack,"_well" ) ); + DbU::Unit eCapGate = get( stack, "_extentionCap.gate" ); + DbU::Unit eCapActive = get( stack, "_extentionCap.active" ); + DbU::Unit eCapDiffusion = get( stack, "_extentionCap.diffusion" ); + DbU::Unit eCapWell = get( stack, "_extentionCap.well" ); + DbU::Unit eWidthGate = get( stack, "_extentionWidth.gate" ); + DbU::Unit eWidthActive = get( stack, "_extentionWidth.active" ); + DbU::Unit eWidthDiffusion = get( stack, "_extentionWidth.diffusion" ); + DbU::Unit eWidthWell = get( stack, "_extentionWidth.well" ); + + Layer::Mask mask = Layer::Mask::fromString( smask ); + + if (stack.issetFlags(JsonWriter::TechnoMode)) { + // Actual creation. + layer = TransistorLayer::create( techno + , name + , gate + , active + , diffusion + , well + ); + layer->setWorking ( isWorking ); + layer->setExtentionCap ( gate , eCapGate ); + layer->setExtentionCap ( active , eCapActive ); + layer->setExtentionCap ( diffusion, eCapDiffusion ); + layer->setExtentionWidth( gate , eWidthGate ); + layer->setExtentionWidth( active , eWidthActive ); + layer->setExtentionWidth( diffusion, eWidthDiffusion ); + if (well) { + layer->setExtentionCap ( well, eCapWell ); + layer->setExtentionWidth( well, eWidthWell ); + } + + if (layer->getMask() != mask) { + cerr << Error( "JsonTransistorLayer::toData(): Layer mask re-creation discrepency on \"%s\":\n" + " Blob: %s\n" + " DataBase: %s" + , name.c_str() + , getString(mask).c_str() + , getString(layer->getMask()).c_str() + ) << endl; + } + // Add here association with blockage layer... + } else { + // Check coherency with existing layer. + layer = dynamic_cast( techno->getLayer(name) ); + if (layer) { + if (layer->getMask() != mask) { + cerr << Error( "JsonTransistorLayer::toData(): Layer mask discrepency on \"%s\":\n" + " Blob: %s\n" + " DataBase: %s" + , name.c_str() + , getString(mask).c_str() + , getString(layer->getMask()).c_str() + ) << endl; + } + } else { + cerr << Error( "JsonTransistorLayer::toData(): No TransistorLayer \"%s\" in the existing technology." + , name.c_str() + ) << endl; + } + } + } else { + cerr << Error( "JsonTransistorLayer::toData(): Cannot find technology, aborting TransistorLayer creation." ) << endl; + } + + update( stack, layer ); + + cdebug.tabw(19,-1); + } + + } // End of Hurricane namespace. diff --git a/hurricane/src/hurricane/UpdateSession.cpp b/hurricane/src/hurricane/UpdateSession.cpp index 0a6e31e2..1f02e2a6 100644 --- a/hurricane/src/hurricane/UpdateSession.cpp +++ b/hurricane/src/hurricane/UpdateSession.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./UpdateSession.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -36,8 +36,7 @@ stack* UPDATOR_STACK = NULL; UpdateSession::UpdateSession() // *************************** : Inherit() -{ -} +{ } void UpdateSession::destroy() // ************************* @@ -126,9 +125,9 @@ Record* UpdateSession::_getRecord() const return record; } - void UpdateSession::onCapturedBy(DBo* owner) - // ***************************************** - { +void UpdateSession::onCapturedBy(DBo* owner) +// ***************************************** +{ if ( not dynamic_cast(owner) and not dynamic_cast(owner) ) throw Error( "Bad update session capture : not a graphic object (Go) or a Cell" ); @@ -137,8 +136,7 @@ Record* UpdateSession::_getRecord() const void UpdateSession::onNotOwned() // ***************************** -{ -} +{ } @@ -146,18 +144,18 @@ void UpdateSession::onNotOwned() // Go::invalidate implementation : located here to access UPDATOR_STACK variable // **************************************************************************************************** - void Go::invalidate(bool propagateFlag) - // ************************************ - { - // trace << "invalidate(" << this << ")" << endl; - // trace_in(); +void Go::invalidate(bool propagateFlag) +// ************************************ +{ + cdebug.log(18,1) << "Go::invalidate(" << this << ")" << endl; - if (not UPDATOR_STACK or UPDATOR_STACK->empty()) - throw Error( "Can't invalidate go: empty update session stack" ); + if (not UPDATOR_STACK or UPDATOR_STACK->empty()) + throw Error( "Can't invalidate go: empty update session stack" ); - Property* property = getProperty( UpdateSession::getPropertyName() ); + Property* property = getProperty( UpdateSession::getPropertyName() ); + + if (property) { - if (property) { if (not dynamic_cast(property)) throw Error( "Can't invalidate go : bad update session type" ); } else { @@ -185,29 +183,31 @@ void UpdateSession::onNotOwned() } } } -// trace << "done" << endl; -// trace_out(); + + cdebug.log(18) << "Go::invalidate(" << this << ") - Completed." << endl; + cdebug.tabw(18,-1); } -void UpdateSession::open() { -// trace << "OpenUpdateSession()" << endl; -// trace_in(); - UpdateSession::_create(); +void UpdateSession::open() +// *********************** +{ + cdebug.log(18,1) << "UpdateSession::open()" << endl; + UpdateSession::_create(); } -void UpdateSession::close() { -// trace << "CloseUpdateSession()" << endl; -// trace_in(); +void UpdateSession::close() +// ************************ +{ + cdebug.tabw(18,-1); + cdebug.log(18,1) << "UpdateSession::close() - Start materialization." << endl; - if (!UPDATOR_STACK || UPDATOR_STACK->empty()) - throw Error("Can't end update : empty update session stack"); + if (!UPDATOR_STACK || UPDATOR_STACK->empty()) + throw Error("Can't end update : empty update session stack"); - UPDATOR_STACK->top()->_destroy(); + UPDATOR_STACK->top()->_destroy(); -// trace << "done" << endl; -// trace_out(); -// trace << "done" << endl; -// trace_out(); + cdebug.tabw(18,-1); + cdebug.log(18) << "UpdateSession::close() - Materialization completed." << endl; } @@ -216,5 +216,5 @@ void UpdateSession::close() { // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/Vertical.cpp b/hurricane/src/hurricane/Vertical.cpp index 8a0b0948..822b443f 100644 --- a/hurricane/src/hurricane/Vertical.cpp +++ b/hurricane/src/hurricane/Vertical.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./Vertical.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -17,6 +17,8 @@ // not, see . // **************************************************************************************************** +#include "hurricane/DataBase.h" +#include "hurricane/Technology.h" #include "hurricane/Vertical.h" #include "hurricane/Layer.h" #include "hurricane/BasicLayer.h" @@ -176,6 +178,16 @@ void Vertical::translate(const DbU::Unit& dx) } } +void Vertical::_toJson(JsonWriter* writer) const +// ******************************************** +{ + Inherit::_toJson( writer ); + + jsonWrite( writer, "_x" , _x ); + jsonWrite( writer, "_dySource", _dySource ); + jsonWrite( writer, "_dyTarget", _dyTarget ); +} + string Vertical::_getString() const // ******************************** { @@ -194,9 +206,66 @@ Record* Vertical::_getRecord() const return record; } + +// **************************************************************************************************** +// JsonVertical implementation +// **************************************************************************************************** + +Initializer jsonVerticalInit ( 0 ); + + +void JsonVertical::initialize() +// ***************************** +{ JsonTypes::registerType( new JsonVertical (JsonWriter::RegisterMode) ); } + +JsonVertical::JsonVertical(unsigned long flags) +// ******************************************** + : JsonSegment(flags) +{ + add( "_x" , typeid(uint64_t) ); + add( "_dySource", typeid(uint64_t) ); + add( "_dyTarget", typeid(uint64_t) ); +} + +string JsonVertical::getTypeName() const +// ************************************* +{ return "Vertical"; } + +JsonVertical* JsonVertical::clone(unsigned long flags) const +// ********************************************************* +{ return new JsonVertical ( flags ); } + +void JsonVertical::toData(JsonStack& stack) +// **************************************** +{ + check( stack, "JsonVertical::toData" ); + unsigned int jsonId = presetId( stack ); + + Vertical* vertical = Vertical::create + ( get(stack,".Net") + , DataBase::getDB()->getTechnology()->getLayer( get(stack,"_layer") ) + , DbU::fromDb( get(stack,"_x" ) ) + , DbU::fromDb( get(stack,"_width" ) ) + , DbU::fromDb( get(stack,"_dySource") ) + , DbU::fromDb( get(stack,"_dyTarget") ) + ); + + JsonNet* jnet = jget( stack ); + if (jnet) { + jnet->addHookLink( vertical->getBodyHook (), jsonId, get(stack,"_bodyHook" ) ); + jnet->addHookLink( vertical->getSourceHook(), jsonId, get(stack,"_sourceHook") ); + jnet->addHookLink( vertical->getTargetHook(), jsonId, get(stack,"_targetHook") ); + } else { + cerr << Error( "JsonVertical::toData(): Missing (Json)Net in stack context." ) << endl; + } + +// Hook/Ring rebuild are done as a post-process. + update( stack, vertical ); +} + } // End of Hurricane namespace. // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/ViaLayer.cpp b/hurricane/src/hurricane/ViaLayer.cpp index ee31d192..6be52d52 100644 --- a/hurricane/src/hurricane/ViaLayer.cpp +++ b/hurricane/src/hurricane/ViaLayer.cpp @@ -1,7 +1,6 @@ - // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -19,12 +18,7 @@ // License along with Hurricane. If not, see // . // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | H U R R I C A N E | // | V L S I B a c k e n d D a t a - B a s e | // | | @@ -32,16 +26,14 @@ // | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Module : "./ViaLayer.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ -# include "hurricane/BasicLayer.h" -# include "hurricane/ViaLayer.h" -# include "hurricane/Technology.h" -# include "hurricane/Error.h" +#include "hurricane/DataBase.h" +#include "hurricane/Technology.h" +#include "hurricane/BasicLayer.h" +#include "hurricane/ViaLayer.h" +#include "hurricane/Error.h" namespace { @@ -65,7 +57,6 @@ namespace Hurricane { // ------------------------------------------------------------------- // Class : "Hurricane::ViaLayer". - ViaLayer::ViaLayer ( Technology* technology , const Name& name , BasicLayer* bottomLayer @@ -210,4 +201,133 @@ namespace Hurricane { } + void ViaLayer::_toJson ( JsonWriter* w ) const + { + Super::_toJson( w ); + + jsonWrite( w, "_bottom", _basicLayers[0]->getName() ); + jsonWrite( w, "_cut" , _basicLayers[1]->getName() ); + jsonWrite( w, "_top" , _basicLayers[2]->getName() ); + + jsonWrite( w, "_enclosure.bottom", _enclosures[0] ); + jsonWrite( w, "_enclosure.cut" , _enclosures[1] ); + jsonWrite( w, "_enclosure.top" , _enclosures[2] ); + } + + +// ------------------------------------------------------------------- +// Class : "Hurricane::JsonViaLayer". + + Initializer jsonViaLayerInit ( 0 ); + + + void JsonViaLayer::initialize () + { JsonTypes::registerType( new JsonViaLayer (JsonWriter::RegisterMode) ); } + + + JsonViaLayer::JsonViaLayer ( unsigned long flags ) + : JsonLayer(flags) + { + if (flags & JsonWriter::RegisterMode) return; + + cdebug.log(19) << "JsonViaLayer::JsonViaLayer()" << endl; + + add( "_bottom" , typeid(string) ); + add( "_cut" , typeid(string) ); + add( "_top" , typeid(string) ); + add( "_enclosure.bottom", typeid(int64_t) ); + add( "_enclosure.cut" , typeid(int64_t) ); + add( "_enclosure.top" , typeid(int64_t) ); + } + + + JsonViaLayer::~JsonViaLayer () + { } + + + string JsonViaLayer::getTypeName () const + { return "ViaLayer"; } + + + JsonViaLayer* JsonViaLayer::clone ( unsigned long flags ) const + { return new JsonViaLayer ( flags ); } + + + void JsonViaLayer::toData(JsonStack& stack) + { + cdebug.tabw(19,1); + + check( stack, "JsonViaLayer::toData" ); + + Technology* techno = lookupTechnology( stack, "JsonViaLayer::toData" ); + ViaLayer* layer = NULL; + + if (techno) { + string name = get ( stack, "_name" ); + string smask = get ( stack, "_mask" ); + //DbU::Unit minimalSize = get( stack, "_minimalSize" ); + //DbU::Unit minimalSpacing = get( stack, "_minimalSpacing" ); + bool isWorking = get ( stack, "_working" ); + + BasicLayer* bottom = techno->getBasicLayer( get(stack,"_bottom" ) ); + BasicLayer* cut = techno->getBasicLayer( get(stack,"_cut" ) ); + BasicLayer* top = techno->getBasicLayer( get(stack,"_top" ) ); + DbU::Unit bottomEncl = get( stack, "_enclosure.bottom" ); + DbU::Unit cutEncl = get( stack, "_enclosure.cut" ); + DbU::Unit topEncl = get( stack, "_enclosure.top" ); + + Layer::Mask mask = Layer::Mask::fromString( smask ); + + if (stack.issetFlags(JsonWriter::TechnoMode)) { + // Actual creation. + layer = ViaLayer::create( techno + , name + , bottom + , cut + , top + ); + layer->setWorking ( isWorking ); + layer->setEnclosure( bottom, bottomEncl ); + layer->setEnclosure( cut , cutEncl ); + layer->setEnclosure( top , topEncl ); + + if (layer->getMask() != mask) { + cerr << Error( "JsonViaLayer::toData(): Layer mask re-creation discrepency on \"%s\":\n" + " Blob: %s\n" + " DataBase: %s" + , name.c_str() + , getString(mask).c_str() + , getString(layer->getMask()).c_str() + ) << endl; + } + // Add here association with blockage layer... + } else { + // Check coherency with existing layer. + layer = dynamic_cast( techno->getLayer(name) ); + if (layer) { + if (layer->getMask() != mask) { + cerr << Error( "JsonViaLayer::toData(): Layer mask discrepency on \"%s\":\n" + " Blob: %s\n" + " DataBase: %s" + , name.c_str() + , getString(mask).c_str() + , getString(layer->getMask()).c_str() + ) << endl; + } + } else { + cerr << Error( "JsonViaLayer::toData(): No ViaLayer \"%s\" in the existing technology." + , name.c_str() + ) << endl; + } + } + } else { + cerr << Error( "JsonViaLayer::toData(): Cannot find technology, aborting ViaLayer creation." ) << endl; + } + + update( stack, layer ); + + cdebug.tabw(19,-1); + } + + } // End of Hurricane namespace. diff --git a/hurricane/src/hurricane/Warning.cpp b/hurricane/src/hurricane/Warning.cpp index 065d8338..9c94155d 100644 --- a/hurricane/src/hurricane/Warning.cpp +++ b/hurricane/src/hurricane/Warning.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // diff --git a/hurricane/src/hurricane/grenier/Builder.cpp b/hurricane/src/hurricane/grenier/Builder.cpp index 71f9cd8f..058b317e 100644 --- a/hurricane/src/hurricane/grenier/Builder.cpp +++ b/hurricane/src/hurricane/grenier/Builder.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: Builder.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** #include "Builder.h" @@ -98,5 +98,5 @@ H::Builder* GetBuilder(const string& token) } // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/grenier/Builder.h b/hurricane/src/hurricane/grenier/Builder.h index e72991aa..cc00e276 100644 --- a/hurricane/src/hurricane/grenier/Builder.h +++ b/hurricane/src/hurricane/grenier/Builder.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: Builder.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** #ifndef HURRICANE_BUILDER @@ -75,5 +75,5 @@ H::Builder* GetBuilder(const string& token); #endif // HURRICANE_BUILDER // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/grenier/Command.cpp b/hurricane/src/hurricane/grenier/Command.cpp index 7e3beeef..86bfce0b 100644 --- a/hurricane/src/hurricane/grenier/Command.cpp +++ b/hurricane/src/hurricane/grenier/Command.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: Command.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** #include "Command.h" @@ -137,5 +137,5 @@ void Command::_OnButtonRelease(View* view, const Point& position, unsigned state } // End of Hurricane namespace. // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/grenier/Command.h b/hurricane/src/hurricane/grenier/Command.h index f1b7a1a3..ce089fe3 100644 --- a/hurricane/src/hurricane/grenier/Command.h +++ b/hurricane/src/hurricane/grenier/Command.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: Command.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** #ifndef HURRICANE_COMMAND @@ -89,5 +89,5 @@ SetNestedSlotAdapter(Hurricane::Command) #endif // HURRICANE_COMMAND // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/grenier/Commands.h b/hurricane/src/hurricane/grenier/Commands.h index 2a9481a1..43beb7bd 100644 --- a/hurricane/src/hurricane/grenier/Commands.h +++ b/hurricane/src/hurricane/grenier/Commands.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: Commands.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** #ifndef HURRICANE_COMMANDS @@ -58,5 +58,5 @@ typedef GenericFilter CommandFilter; #endif // HURRICANE_COMMANDS // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/grenier/GtkUtils.cpp b/hurricane/src/hurricane/grenier/GtkUtils.cpp index 7633e73a..3c8ecc48 100644 --- a/hurricane/src/hurricane/grenier/GtkUtils.cpp +++ b/hurricane/src/hurricane/grenier/GtkUtils.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: GtkUtils.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** #include "GtkUtils.h" @@ -250,5 +250,5 @@ string GdkKeyvalName ( int keyval ) } // End of Hurricane namespace. // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/grenier/GtkUtils.h b/hurricane/src/hurricane/grenier/GtkUtils.h index 33a88c29..1b3e47ba 100644 --- a/hurricane/src/hurricane/grenier/GtkUtils.h +++ b/hurricane/src/hurricane/grenier/GtkUtils.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: GtkUtils.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** #ifndef HURRICANE_GTK_UTILS @@ -46,5 +46,5 @@ string GdkKeyvalName ( int keyval ); #endif // HURRICANE_GTK_UTILS // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/grenier/InputFile.cpp b/hurricane/src/hurricane/grenier/InputFile.cpp index 919dd308..d72fb60d 100644 --- a/hurricane/src/hurricane/grenier/InputFile.cpp +++ b/hurricane/src/hurricane/grenier/InputFile.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: InputFile.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** #include "InputFile.h" @@ -207,5 +207,5 @@ Record* InputFile::_GetRecord() const } // End of Hurricane namespace. // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/grenier/InputFile.h b/hurricane/src/hurricane/grenier/InputFile.h index b2deeaf0..365af407 100644 --- a/hurricane/src/hurricane/grenier/InputFile.h +++ b/hurricane/src/hurricane/grenier/InputFile.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: InputFile.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** #ifndef HURRICANE_INPUT_FILE @@ -99,5 +99,5 @@ class InputFile { #endif // HURRICANE_INPUT_FILE // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/grenier/MainView.cpp b/hurricane/src/hurricane/grenier/MainView.cpp index 1e217898..3db19d88 100644 --- a/hurricane/src/hurricane/grenier/MainView.cpp +++ b/hurricane/src/hurricane/grenier/MainView.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: MainView.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** #include "MainView.h" @@ -108,5 +108,5 @@ void MainView::_SetTransformation(const Transformation& transformation) } // End of Hurricane namespace. // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/grenier/MainView.h b/hurricane/src/hurricane/grenier/MainView.h index 349db568..5fba1b74 100644 --- a/hurricane/src/hurricane/grenier/MainView.h +++ b/hurricane/src/hurricane/grenier/MainView.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: MainView.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** #ifndef HURRICANE_MAIN_VIEW @@ -78,5 +78,5 @@ SetNestedSlotAdapter(Hurricane::MainView) #endif // HURRICANE_MAIN_VIEW // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/grenier/MainViews.h b/hurricane/src/hurricane/grenier/MainViews.h index df7c63b2..1f244243 100644 --- a/hurricane/src/hurricane/grenier/MainViews.h +++ b/hurricane/src/hurricane/grenier/MainViews.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: MainViews.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** #ifndef HURRICANE_MAIN_VIEWS @@ -58,5 +58,5 @@ typedef GenericFilter MainViewFilter; #endif // HURRICANE_MAIN_VIEWS // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/grenier/MapView.cpp b/hurricane/src/hurricane/grenier/MapView.cpp index b2bd095d..b7a5ea68 100644 --- a/hurricane/src/hurricane/grenier/MapView.cpp +++ b/hurricane/src/hurricane/grenier/MapView.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: MapView.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** #include "MapView.h" @@ -146,5 +146,5 @@ void MapView::_PostRepaint() } // End of Hurricane namespace. // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/grenier/MapView.h b/hurricane/src/hurricane/grenier/MapView.h index 00f06eeb..3792afb7 100644 --- a/hurricane/src/hurricane/grenier/MapView.h +++ b/hurricane/src/hurricane/grenier/MapView.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: MapView.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** #ifndef HURRICANE_MAP_VIEW @@ -78,5 +78,5 @@ SetNestedSlotAdapter(Hurricane::MapView) #endif // HURRICANE_MAP_VIEW // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/grenier/OutputFile.cpp b/hurricane/src/hurricane/grenier/OutputFile.cpp index 9e0fbd84..4c488e81 100644 --- a/hurricane/src/hurricane/grenier/OutputFile.cpp +++ b/hurricane/src/hurricane/grenier/OutputFile.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: OutputFile.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** #include "OutputFile.h" @@ -140,5 +140,5 @@ Record* OutputFile::_GetRecord() const } // End of Hurricane namespace. // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/grenier/OutputFile.h b/hurricane/src/hurricane/grenier/OutputFile.h index 16d9b08d..e417fa61 100644 --- a/hurricane/src/hurricane/grenier/OutputFile.h +++ b/hurricane/src/hurricane/grenier/OutputFile.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: OutputFile.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** #ifndef HURRICANE_OUTPUT_FILE @@ -104,5 +104,5 @@ class OutputFile { #endif // HURRICANE_OUTPUT_FILE // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/grenier/Primitive.cpp b/hurricane/src/hurricane/grenier/Primitive.cpp index fb1f8a5d..251d9960 100644 --- a/hurricane/src/hurricane/grenier/Primitive.cpp +++ b/hurricane/src/hurricane/grenier/Primitive.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: Primitive.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** #include "Primitive.h" @@ -605,5 +605,5 @@ void Polygon::_Draw(View* view, const Box& updateArea, const Transformation& tra } // End of Hurricane namespace. // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/grenier/Primitive.h b/hurricane/src/hurricane/grenier/Primitive.h index 3b86f359..dc9d9a24 100644 --- a/hurricane/src/hurricane/grenier/Primitive.h +++ b/hurricane/src/hurricane/grenier/Primitive.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: Primitive.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** #ifndef HURRICANE_PRIMITIVE @@ -361,5 +361,5 @@ SetNestedSlotAdapter(Hurricane::Polygon) #endif // HURRICANE_PRIMITIVE // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/grenier/Selector.cpp b/hurricane/src/hurricane/grenier/Selector.cpp index 920d0852..ce9b362d 100644 --- a/hurricane/src/hurricane/grenier/Selector.cpp +++ b/hurricane/src/hurricane/grenier/Selector.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: Selector.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** #include "Selector.h" @@ -115,5 +115,5 @@ void Selector::_DetachFrom(View* view, bool inDeletion) } // End of Hurricane namespace. // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/grenier/Selector.h b/hurricane/src/hurricane/grenier/Selector.h index f93d81c7..28fd7c6d 100644 --- a/hurricane/src/hurricane/grenier/Selector.h +++ b/hurricane/src/hurricane/grenier/Selector.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: Selector.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** #ifndef HURRICANE_SELECTOR @@ -74,5 +74,5 @@ SetNestedSlotAdapter(Hurricane::Selector) #endif // HURRICANE_SELECTOR // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/grenier/Symbol.cpp b/hurricane/src/hurricane/grenier/Symbol.cpp index b86f0183..6c30b806 100644 --- a/hurricane/src/hurricane/grenier/Symbol.cpp +++ b/hurricane/src/hurricane/grenier/Symbol.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: Symbol.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** #include "Symbol.h" @@ -340,5 +340,5 @@ void Symbol::CellSet::_SetNextElement(Cell* cell, Cell* nextCell) const } // End of Hurricane namespace. // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/grenier/Symbol.h b/hurricane/src/hurricane/grenier/Symbol.h index 308725d1..7ab5e357 100644 --- a/hurricane/src/hurricane/grenier/Symbol.h +++ b/hurricane/src/hurricane/grenier/Symbol.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: Symbol.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** #ifndef HURRICANE_SYMBOL @@ -116,5 +116,5 @@ SetNestedSlotAdapter(Hurricane::Symbol) #endif // HURRICANE_SYMBOL // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/grenier/View.cpp b/hurricane/src/hurricane/grenier/View.cpp index c5447b58..15335aeb 100644 --- a/hurricane/src/hurricane/grenier/View.cpp +++ b/hurricane/src/hurricane/grenier/View.cpp @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: View.cpp // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** // 21-10-2003 Alignment BULL-LIP6 (Lip6 addded DisplaySlots) (added VisualMaps) @@ -1807,5 +1807,5 @@ Record* View::RubberDisplayType::_GetRecord() const // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/grenier/View.h b/hurricane/src/hurricane/grenier/View.h index b2f22334..b0bbdbb4 100644 --- a/hurricane/src/hurricane/grenier/View.h +++ b/hurricane/src/hurricane/grenier/View.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: View.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** #ifndef HURRICANE_VIEW @@ -391,5 +391,5 @@ SetNestedSlotAdapter(Hurricane::View) #endif // HURRICANE_VIEW // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/grenier/VisualMap.cpp b/hurricane/src/hurricane/grenier/VisualMap.cpp index e6c7406f..571a2558 100644 --- a/hurricane/src/hurricane/grenier/VisualMap.cpp +++ b/hurricane/src/hurricane/grenier/VisualMap.cpp @@ -1,7 +1,7 @@ #include "Error.h" // // This file is part of the Tsunami Project. -// Copyright (c) 2001-2015 Laboratoire LIP6 - Departement ASIM +// Copyright (c) 2001-2016 Laboratoire LIP6 - Departement ASIM // Universite Pierre et Marie Curie. // #include "Relation.h" diff --git a/hurricane/src/hurricane/grenier/VisualMap.h b/hurricane/src/hurricane/grenier/VisualMap.h index 147ca252..e7cafc1a 100644 --- a/hurricane/src/hurricane/grenier/VisualMap.h +++ b/hurricane/src/hurricane/grenier/VisualMap.h @@ -1,7 +1,7 @@ #ifndef HURRICANE_VISUAL_MAP // // This file is part of the Tsunami Project. -// Copyright (c) 2001-2015 Laboratoire LIP6 - Departement ASIM +// Copyright (c) 2001-2016 Laboratoire LIP6 - Departement ASIM // Universite Pierre et Marie Curie. // #define HURRICANE_VISUAL_MAP diff --git a/hurricane/src/hurricane/grenier/VisualMaps.h b/hurricane/src/hurricane/grenier/VisualMaps.h index cec163c3..209aaaad 100644 --- a/hurricane/src/hurricane/grenier/VisualMaps.h +++ b/hurricane/src/hurricane/grenier/VisualMaps.h @@ -52,5 +52,5 @@ typedef GenericFilter VisualMapFilter; #endif // HURRICANE_VISUAL_MAPS // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/grenier/json/DBo.cpp b/hurricane/src/hurricane/grenier/json/DBo.cpp new file mode 100644 index 00000000..4d9b8b78 --- /dev/null +++ b/hurricane/src/hurricane/grenier/json/DBo.cpp @@ -0,0 +1,198 @@ +// -*- C++ -*- +// +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved +// +// This file is part of Hurricane. +// +// Hurricane is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// Hurricane is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- +// TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU +// General Public License for more details. +// +// You should have received a copy of the Lesser GNU General Public +// License along with Hurricane. If not, see +// . +// +// +-----------------------------------------------------------------+ +// | H U R R I C A N E | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Remy Escassut | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./DBo.cpp" | +// +-----------------------------------------------------------------+ + + +#include "hurricane/Property.h" +#include "hurricane/DBo.h" +#include "hurricane/Quark.h" +#include "hurricane/Error.h" + + +namespace Hurricane { + + +// ------------------------------------------------------------------- +// Class : "Hurricane::DBo". + + + DBo::DBo (): _propertySet() + { } + + + DBo::~DBo () + { } + + + void DBo::_postCreate () + { } + + + void DBo::_preDestroy () + { + clearProperties (); + } + + + void DBo::destroy () + { + _preDestroy(); + + delete this; + } + + + Property* DBo::getProperty ( const Name& name ) const + { + set::const_iterator iterator = _propertySet.begin(); + while ( iterator != _propertySet.end() ) { + Property* property = *iterator; + if (property->getName() == name) return property; + ++iterator; + } + return NULL; + } + + + Properties DBo::getProperties () const + { + return getCollection(_propertySet); + } + + + void DBo::put ( Property* property ) + { + if ( !property ) + throw Error("DBo::put(): Can't put property : NULL property."); + + Property* oldProperty = getProperty ( property->getName() ); + if ( property != oldProperty ) { + if ( oldProperty ) { + _propertySet.erase ( oldProperty ); + oldProperty->onReleasedBy ( this ); + } + _propertySet.insert ( property ); + property->onCapturedBy ( this ); + } + } + + + void DBo::remove ( Property* property ) + { + if ( !property ) + throw Error("DBo::remove(): Can't remove property : NULL property."); + + if ( _propertySet.find(property) != _propertySet.end() ) { + _propertySet.erase ( property ); + property->onReleasedBy ( this ); + if ( dynamic_cast(this) && _propertySet.empty() ) + destroy(); + } + } + + + void DBo::removeProperty ( const Name& name ) + { + Property* property = getProperty ( name ); + if ( property ) { + _propertySet.erase ( property ); + property->onReleasedBy ( this ); + if ( dynamic_cast(this) && _propertySet.empty() ) + destroy(); + } + } + + + void DBo::_onDestroyed ( Property* property ) + { + if ( property && ( _propertySet.find(property) != _propertySet.end() ) ) { + _propertySet.erase ( property ); + if ( dynamic_cast(this) && _propertySet.empty() ) + destroy(); + } + } + + + void DBo::clearProperties () + { + while ( !_propertySet.empty() ) { + Property* property = *_propertySet.begin(); + _propertySet.erase ( property ); + property->onReleasedBy ( this ); + } + } + + + void DBo::_toJson ( JsonWriter* writer ) const + { + // writer->key( "+propertySet" ); + // writer->startArray(); + // writer->endArray(); + } + + + void DBo::_toJsonProperties ( JsonWriter* writer ) const + { + writer->key( "+propertySet" ); + writer->startArray(); + writer->endArray(); + } + + + string DBo::_getTypeName () const + { + return "DBo"; + } + + + string DBo::_getString () const + { + return "<" + _getTypeName() + ">"; + } + + + Record* DBo::_getRecord () const + { + Record* record = new Record ( getString(this) ); + record->add ( getSlot("_propertySet", &_propertySet) ); + return record; + } + + +// ------------------------------------------------------------------- +// Class : "Hurricane::JsonDBo". + + JsonDBo::JsonDBo ( unsigned long flags ) + : JsonObject() + { + add( "+propertySet", &DBo::getProperties ); + } + + +} // End of Hurricane namespace. diff --git a/hurricane/src/hurricane/grenier/json/DBo.h b/hurricane/src/hurricane/grenier/json/DBo.h new file mode 100644 index 00000000..76ad3a33 --- /dev/null +++ b/hurricane/src/hurricane/grenier/json/DBo.h @@ -0,0 +1,114 @@ +// -*- C++ -*- +// +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved +// +// This file is part of Hurricane. +// +// Hurricane is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// Hurricane is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- +// TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU +// General Public License for more details. +// +// You should have received a copy of the Lesser GNU General Public +// License along with Hurricane. If not, see +// . +// +// +-----------------------------------------------------------------+ +// | H U R R I C A N E | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Remy Escassut | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./hurricane/DBo.h" | +// +-----------------------------------------------------------------+ + + +#ifndef HURRICANE_DBO_H +#define HURRICANE_DBO_H + +#include "hurricane/DBos.h" +#include "hurricane/Name.h" +#include "hurricane/Properties.h" + + +namespace Hurricane { + + class JsonDBo; + + +// ------------------------------------------------------------------- +// Class : "Hurricane::DBo". + + class DBo { + friend class JsonDBo; + public: + virtual void destroy (); + inline set& _getPropertySet (); + void _onDestroyed ( Property* property ); + Property* getProperty ( const Name& ) const; + Properties getProperties () const; + inline bool hasProperty () const; + void put ( Property* ); + void remove ( Property* ); + void removeProperty ( const Name& ); + void clearProperties (); + virtual void _toJson ( JsonWriter* ) const; + virtual void _toJsonProperties ( JsonWriter* ) const; + virtual string _getTypeName () const; + virtual string _getString () const; + virtual Record* _getRecord () const; + + private: + mutable set _propertySet; + + protected: + DBo (); + virtual ~DBo (); + virtual void _postCreate (); + virtual void _preDestroy (); + + private: + DBo ( const DBo& ); + DBo& operator= ( const DBo& ); + }; + + +// Inline Functions. + inline set& DBo::_getPropertySet () { return _propertySet; } + inline bool DBo::hasProperty () const { return !_propertySet.empty(); } + + +// ------------------------------------------------------------------- +// Class : "Hurricane::JsonDBo". + + class JsonDBo : public JsonObject { + public: + JsonDBo ( unsigned long flags ); +}; + + +} // Hurricane namespace. + + +// inline void jsonWrite ( JsonWriter* w, const Hurricane::DBo* dbo ) +// { +// w->startObject(); +// std::string tname = dbo->_getTypeName(); +// if (w->issetFlags(JsonWriter::UsePlugReference) and (tname == "Plug")) { +// tname.insert( 0, "&" ); +// } +// jsonWrite( w, "@typename", tname ); +// dbo->_toJson( w ); +// dbo->_toJsonProperties( w ); +// w->endObject(); +// } + +INSPECTOR_P_SUPPORT(Hurricane::DBo); + +#endif // HURRICANE_DBO_H diff --git a/hurricane/src/hurricane/grenier/json/JsonReader.cpp b/hurricane/src/hurricane/grenier/json/JsonReader.cpp new file mode 100644 index 00000000..e75e0026 --- /dev/null +++ b/hurricane/src/hurricane/grenier/json/JsonReader.cpp @@ -0,0 +1,650 @@ +// -*- C++ -*- +// +// Copyright (c) BULL S.A. 2015-2016, All Rights Reserved +// +// This file is part of Hurricane. +// +// Hurricane is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// Hurricane is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- +// TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU +// General Public License for more details. +// +// You should have received a copy of the Lesser GNU General Public +// License along with Hurricane. If not, see +// . +// +// +-----------------------------------------------------------------+ +// | H U R R I C A N E | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul Chaput | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./JsonReader.cpp" | +// +-----------------------------------------------------------------+ + + +#include "rapidjson/filereadstream.h" +#include "rapidjson/reader.h" +// Needed for registering. May be deleted later. +#include "hurricane/DebugSession.h" +#include "hurricane/Warning.h" +#include "hurricane/JsonReader.h" +#include "hurricane/Cell.h" +#include "hurricane/Net.h" +#include "hurricane/Instance.h" +#include "hurricane/RoutingPad.h" +#include "hurricane/Contact.h" +#include "hurricane/Vertical.h" +#include "hurricane/Horizontal.h" +#include "hurricane/Pad.h" + + +namespace { + + using namespace std; + using namespace rapidjson; + using namespace Hurricane; + + +// ------------------------------------------------------------------- +// Struct : "HurricaneHandler". + + class HurricaneHandler { + public: + HurricaneHandler ( JsonStack& ); + public: + bool Null (); + bool Bool ( bool ); + bool Int ( int ); + bool Int64 ( int64_t ); + bool Uint ( unsigned int ); + bool Uint64 ( uint64_t ); + bool Double ( double ); + bool String ( const char*, SizeType, bool copy ); + bool Key ( const char*, SizeType, bool copy ); + bool StartObject (); + bool EndObject ( SizeType ); + bool StartArray (); + bool EndArray ( SizeType ); + bool doCallToData () const; + private: + enum Flags { TypenameKey = (1<<0) + , ArrayMode = (1<<2) + , SkipObject = (1<<3) + , SkipArray = (1<<4) + , SkipMask = SkipObject | SkipArray + }; + private: + unsigned long _state; + string _key; + string _objectName; + vector _objects; + JsonStack& _stack; + }; + + + HurricaneHandler::HurricaneHandler ( JsonStack& stack ) + : _state (0) + , _key () + , _objectName() + , _objects () + , _stack (stack) + { } + + + bool HurricaneHandler::doCallToData () const + { return not _objects.empty() and _objects.back() and not _objects.back()->isCreated(); } + + + bool HurricaneHandler::Null () + { + //if (not _objects.empty()) ltrace(59) << "null _objects.back(): " << _objects.back() << endl; + + if (_state & SkipMask) return true; + _stack.push_back( _key, NULL ); + return true; + } + + + bool HurricaneHandler::Bool ( bool v ) + { + if (_state & SkipMask) return true; + _stack.push_back( _key, v ); + return true; + } + + + bool HurricaneHandler::Int ( int v ) + { + if (_state & SkipMask) return true; + _stack.push_back( _key, v ); + return true; + } + + + bool HurricaneHandler::Int64 ( int64_t v ) + { + if (_state & SkipMask) return true; + _stack.push_back( _key, v ); + return true; + } + + + bool HurricaneHandler::Uint ( unsigned int v ) + { + if (_state & SkipMask) return true; + _stack.push_back( _key, v ); + return true; + } + + + bool HurricaneHandler::Uint64 ( uint64_t v ) + { + if (_state & SkipMask) return true; + _stack.push_back( _key, v ); + return true; + } + + + bool HurricaneHandler::Double ( double v ) + { + if (_state & SkipMask) return true; + _stack.push_back( _key, v ); + return true; + } + + + bool HurricaneHandler::String ( const char* value, SizeType, bool copy ) + { + if (_state & SkipMask) return true; + if (_state & TypenameKey) { + _state &= ~TypenameKey; + + JsonObject* object = JsonTypes::find( value ); + _objects[_objects.size()-1] = object->clone(); + + if (not object) { + cerr << Warning("JsonReader::parse(): Do not know how to parse type %s.", value ) << endl; + _state |= SkipObject; + } else { + _objects[_objects.size()-1]->setName( _objectName ); + } + + cdebug.log(19) << "HurricaneHandler::String() [key/typename] " << value << endl; + return true; + } + + _stack.push_back( _key, value ); + return true; + } + + + bool HurricaneHandler::Key ( const char* key, SizeType, bool copy ) + { + _key = key; + if (_state & SkipMask) { + _key.clear(); + return true; + } + + if (_state & TypenameKey) { + if (_key != "@typename") { + _state |= SkipObject; + _key.clear(); + } + return true; + } + + //cdebug.log(19) << "HurricaneHandler::Key() key:" << _key << " _objects.size():" << _objects.size() << endl; + + if (_objects.back()) { + if ( doCallToData() and not _key.empty() and (_key[0] != '_') ) { + // The key is no longer a simple attribute of the object. + // Triggers it's creation in the Json stack. + cdebug.log(19) << "HurricaneHandler::key() Calling " + << _objects.back()->getTypeName() << "::toData(JsonStack&)." << endl; + _objects.back()->toData( _stack ); + } + } + + return true; + } + + + bool HurricaneHandler::StartObject () + { + cdebug.log(19) << "Hurricane::StartObject()" << endl; + ltracein(50); + + _state |= TypenameKey; + // if (doCallToData()) { + // cdebug.log(19) << "Calling " << _objects.back()->getTypeName() << "::toData(JsonStack&)." << endl; + // _objects.back()->toData( _stack ); + // } + _objectName = (_key == ".Array") ? "" : _key; + _objects.push_back( NULL ); + cdebug.log(19) << "_objects.push_back(NULL), size():" << _objects.size() << "." << endl; + + ltracein(50); + return true; + } + + + bool HurricaneHandler::EndObject ( SizeType ) + { + ltraceout(50,2); + cdebug.log(19) << "HurricaneHandler::EndObject()" << endl; + ltracein(50); + + _objectName.clear(); + if (_state & SkipObject) { + _state &= ~SkipObject; + } else { + if (doCallToData()) { + cdebug.log(19) << "Calling " << _objects.back()->getTypeName() << "::toData(JsonStack&)." << endl; + _objects.back()->toData( _stack ); + } + if (_objects.size() > 1) { + cdebug.log(19) << "_objects.pop_back(), size():" << _objects.size() << "." << endl; + delete _objects.back(); + _objects.pop_back(); + } + if (_stack.size() > 1) { + if (_stack[-1].first[0] != '_') _stack.pop_back(); + } + } + cdebug.tabw(19,-1); + return true; + } + + + bool HurricaneHandler::StartArray() + { + cdebug.log(19) << "HurricaneHandler::StartArray() key:\"" << _key << "\"." << endl; + ltracein(50); + + _objectName.clear(); + if (_key.empty()) { _state |= SkipArray; return true; } + if (_key[0] != '+') { + cerr << Warning("JsonReader::parse(): Array attributes must start by \'+\' %s.", _key.c_str() ) << endl; + _state |= SkipArray; + return true; + } + + _state |= ArrayMode; + _key = ".Array"; + + return true; + } + + bool HurricaneHandler::EndArray ( SizeType ) + { + cdebug.tabw(19,-1); + cdebug.log(19) << "HurricaneHandler::EndArray()" << endl; + ltracein(50); + + _state &= ~(ArrayMode | SkipArray); + _key.clear(); + + cdebug.tabw(19,-1); + return true; + } + + +// ------------------------------------------------------------------- +// Class : "JsonReader". + + class JsonReader { + public: + enum Mode { CellMode = (1<<0) }; + public: + JsonReader (); + ~JsonReader (); + JsonReader* setFlags ( unsigned long mask ); + JsonReader* resetFlags ( unsigned long mask ); + bool issetFlags ( unsigned long mask ) const; + const JsonStack& getStack () const; + void parse ( std::string fileName, unsigned int flags ); + void close (); + private: + JsonReader ( const JsonReader& ); + JsonReader& operator= ( const JsonReader& ) const; + private: + unsigned long _flags; + size_t _bufferSize; + char* _buffer; + FILE* _file; + FileReadStream* _stream; + JsonStack _stack; + Reader _reader; + HurricaneHandler _handler; + }; + + + JsonReader::JsonReader () + : _flags (0) + , _bufferSize(65536) + , _buffer (new char [_bufferSize]) + , _file (NULL) + , _stream (NULL) + , _stack () + , _reader () + , _handler (_stack) + { + } + + + JsonReader::~JsonReader () + { + close(); + delete _buffer; + } + + + void JsonReader::close () + { + if (_stream) { delete _stream; _stream = NULL; } + if (_file ) { fclose(_file); _file = NULL; } + } + + + const JsonStack& JsonReader::getStack () const + { return _stack; } + + + void JsonReader::parse ( string fileName, unsigned int flags ) + { + close(); + + DebugSession::open( 50 ); + + fileName += ".json"; + _file = fopen( fileName.c_str(), "r" ); + cerr << "_file:" << _file << ", _buffer:" << (void*)_buffer << endl; + _stream = new FileReadStream ( _file, _buffer, _bufferSize ); + + _reader.Parse( *_stream, _handler ); + _stack.print( cerr ); + + DebugSession::close(); + close(); + } + + +} // local namespace. + + +namespace Hurricane { + + using namespace std; + + +// ------------------------------------------------------------------- +// Class : "JsonAttribute". + + JsonAttribute::~JsonAttribute () + { } + + +// ------------------------------------------------------------------- +// Class : "JsonStacked". + + JsonStacked::~JsonStacked () + { } + + + type_index JsonStacked::tid () const + { return typeid(JsonStacked); } + + + void JsonStacked::toJson ( JsonWriter*, boost::any object ) const + { + cerr << Error("JsonStacked::toJson() is a dummy method that should never be called.") << endl; + } + + + JsonStacked* JsonStacked::clone () const + { return new JsonStacked( *this ); } + + +// ------------------------------------------------------------------- +// Class : "JsonObject". + + JsonObject::JsonObject () + : _name () + , _stackeds () + , _attributes () + , _collections() + , _object () + { } + + + JsonObject::JsonObject ( const JsonObject& other ) + : _name (other._name) + , _stackeds () + , _attributes () + , _collections() + , _object () + { + for ( JsonAttribute* attribute : other._stackeds ) _stackeds.push_back( attribute->clone() ); + for ( JsonAttribute* attribute : other._attributes ) _stackeds.push_back( attribute->clone() ); + for ( JsonAttribute* attribute : other._collections ) _stackeds.push_back( attribute->clone() ); + } + + + JsonObject::~JsonObject () + { clear(); } + + + bool JsonObject::isJsonObject () const + { return _flags & IsJsonObject; } + + + void JsonObject::remove ( const std::string& key ) + { + if (key.empty()) { + cerr << Error( "JsonObject::remove(): Attempt to remove attribute with an empty name, ignored." ) << endl; + return; + } + + switch ( key[0] ) { + case '.': + for ( auto it = _stackeds.begin() ; it != _stackeds.end() ; ++it ) + if (key == (*it)->key()) { delete (*it); _stackeds.erase(it); break; } + break; + case '_': + for ( auto it = _attributes.begin() ; it != _attributes.end() ; ++it ) + if (key == (*it)->key()) { delete (*it); _attributes.erase(it); break; } + break; + case '+': + for ( auto it = _collections.begin() ; it != _collections.end() ; ++it ) + if (key == (*it)->key()) { delete (*it); _collections.erase(it); break; } + break; + } + } + + + bool JsonObject::has ( const std::string& key ) const + { + if (key.empty()) return false; + switch ( key[0] ) { + case '.': + for ( size_t i=0 ; i<_stackeds.size() ; ++i ) + if (key == _stackeds[i]->key()) return true; + break; + case '_': + for ( size_t i=0 ; i<_attributes.size() ; ++i ) + if (key == _attributes[i]->key()) return true; + break; + case '+': + for ( size_t i=0 ; i<_collections.size() ; ++i ) + if (key == _collections[i]->key()) return true; + break; + } + return false; + } + + + bool JsonObject::check ( JsonStack& stack, string fname ) const + { + for ( size_t i=0 ; i<_stackeds.size() ; ++i ) { + if (not stack.rhas(_stackeds[i]->key())) { + cerr << Error( "%s(): Stack is missing context element with key \"%s\"" + , fname.c_str(), _stackeds[i]->key().c_str() ) << endl; + return false; + } + } + for ( size_t i=0 ; i<_attributes.size() ; ++i ) { + if (not stack.rhas(_attributes[i]->key())) { + cerr << Error( "%s(): Stack is missing attribute element with key \"%s\"" + , fname.c_str(), _attributes[i]->key().c_str() ) << endl; + return false; + } + } + return true; + } + + + void JsonObject::toData ( JsonStack& ) + { } + + + void JsonObject::print ( ostream& o ) const + { + o << tab << "JsonObject for type: " << getTypeName() << endl; + for ( size_t i=0 ; i<_stackeds.size() ; ++i ) + o << tab << "key:" << left << setw(20) << _stackeds[i]->key() + << " type:" << _stackeds[i]->tid().name() << endl; + + for ( size_t i=0 ; i<_attributes.size() ; ++i ) + o << tab << "key:" << left << setw(20) << _attributes[i]->key() + << " type:" << _attributes[i]->tid().name() << endl; + + for ( size_t i=0 ; i<_collections.size() ; ++i ) + o << tab << "key:" << left << setw(20) << _collections[i]->key() + << " type:" << _collections[i]->tid().name() << endl; + } + + + JsonKey::JsonKey ( const string& key ) + : JsonObject() + , _key (key) + { } + + + string JsonKey::getTypeName () const + { return _key; } + + + JsonKey* JsonKey::clone () const + { return new JsonKey ( *this ); } + + +// ------------------------------------------------------------------- +// Class : "JsonTypes". + + JsonTypes* JsonTypes::_jsonTypes = NULL; + + + JsonTypes::JsonTypes () + : _jsonObjects() + { } + + + JsonTypes::~JsonTypes () + { + for ( JsonObject* object : _jsonObjects ) delete object; + } + + + void JsonTypes::_registerType ( JsonObject* object ) + { + if (_find(object->getTypeName())) { + throw Error( "JsonTypes::_registerType(): Attempt to register <%s> twice.", object->getTypeName().c_str() ); + } + _jsonObjects.insert( object ); + } + + + JsonObject* JsonTypes::_find ( const string& tname ) + { + JsonKey key( tname ); + set::iterator it = _jsonObjects.find( &key ); + if (it != _jsonObjects.end()) return (*it); + return NULL; + } + + + void JsonTypes::registerType ( JsonObject* object ) + { + if (not _jsonTypes) initialize(); + _jsonTypes->_registerType( object ); + } + + + JsonObject* JsonTypes::find ( const string& tname ) + { + if (not _jsonTypes) initialize(); + return _jsonTypes->_find( tname ); + } + + + void JsonTypes::initialize () + { + if (_jsonTypes) return; + + _jsonTypes = new JsonTypes (); + _jsonTypes->_registerType( new JsonPoint (0) ); + _jsonTypes->_registerType( new JsonBox (0) ); + _jsonTypes->_registerType( new JsonTransformation(0) ); + _jsonTypes->_registerType( new JsonCell (0) ); + _jsonTypes->_registerType( new JsonNet (0) ); + _jsonTypes->_registerType( new JsonPlugRef (0) ); + _jsonTypes->_registerType( new JsonRoutingPad (0) ); + _jsonTypes->_registerType( new JsonContact (0) ); + _jsonTypes->_registerType( new JsonVertical (0) ); + _jsonTypes->_registerType( new JsonHorizontal (0) ); + _jsonTypes->_registerType( new JsonPad (0) ); + _jsonTypes->_registerType( new JsonInstance (0) ); + _jsonTypes->_registerType( new JsonPlug (0) ); + } + + +// ------------------------------------------------------------------- +// Class : "JsonStack". + + void JsonStack::addEntity ( unsigned int jsonId, Entity* entity ) + { _entities.insert( std::make_pair(jsonId,entity) ); } + + + void JsonStack::print ( ostream& o ) const + { + o << tab << "JsonStack::print() Stack contains " << _stack.size() << " elements." << endl; + for ( size_t i=0 ; i<_stack.size() ; ++i ) { + o << "[" << right << setw(2) << i << "] key: \"" << left << setw(20) << _stack[i].first + << "\", type: \"" << demangle(_stack[i].second.type()) << "\"." << endl; + } + } + + +// ------------------------------------------------------------------- +// Function : Json Cell parser. + + Cell* jsonCellParse ( string filename ) + { + JsonReader reader; + reader.parse( filename, JsonReader::CellMode ); + + const JsonStack& stack = reader.getStack(); + if (stack.rhas(".Cell")) return stack.as(".Cell"); + return NULL; + } + + +} // Hurricane namespace. diff --git a/hurricane/src/hurricane/grenier/json/JsonReader.h b/hurricane/src/hurricane/grenier/json/JsonReader.h new file mode 100644 index 00000000..e23e6374 --- /dev/null +++ b/hurricane/src/hurricane/grenier/json/JsonReader.h @@ -0,0 +1,790 @@ +// -*- C++ -*- +// +// Copyright (c) BULL S.A. 2015-2016, All Rights Reserved +// +// This file is part of Hurricane. +// +// Hurricane is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// Hurricane is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- +// TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU +// General Public License for more details. +// +// You should have received a copy of the Lesser GNU General Public +// License along with Hurricane. If not, see +// . +// +// +-----------------------------------------------------------------+ +// | H U R R I C A N E | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul Chaput | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./hurricane/JsonReader.h" | +// +-----------------------------------------------------------------+ + + +#ifndef HURRICANE_JSON_READER_H +#define HURRICANE_JSON_READER_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace Hurricane { + + class Entity; + class Cell; + +// ------------------------------------------------------------------- +// Class : "JsonObject". + + class JsonStack; + class JsonArray { }; + + +// ------------------------------------------------------------------- +// Class : "JsonAttribute". + + class JsonAttribute { + public: + inline JsonAttribute ( const std::string& key, unsigned long flags ); + virtual ~JsonAttribute (); + inline std::string key () const; + virtual std::type_index tid () const = 0; + virtual void toJson ( JsonWriter*, boost::any object ) const = 0; + virtual JsonAttribute* clone () const = 0; + inline void setFlags ( unsigned long mask ); + inline void resetFlags ( unsigned long mask ); + inline bool issetFlags ( unsigned long mask ) const; + private: + std::string _key; + unsigned long _flags; + }; + + inline JsonAttribute::JsonAttribute ( const std::string& key, unsigned long flags ): _key(key), _flags(flags) { } + inline std::string JsonAttribute::key () const { return _key; } + inline void JsonAttribute::setFlags ( unsigned long mask ) { _flags |= mask; } + inline void JsonAttribute::resetFlags ( unsigned long mask ) { _flags &= ~mask; } + inline bool JsonAttribute::issetFlags ( unsigned long mask ) const { return _flags & mask; } + + +// ------------------------------------------------------------------- +// Class : "JsonStacked". + + class JsonStacked : public JsonAttribute { + public: + inline JsonStacked ( const std::string& key ); + virtual ~JsonStacked (); + virtual std::type_index tid () const; + virtual void toJson ( JsonWriter*, boost::any object ) const; + virtual JsonStacked* clone () const; + }; + + inline JsonStacked::JsonStacked ( const std::string& key ): JsonAttribute(key,0) { } + + +// ------------------------------------------------------------------- +// Class : "JsonAnyAttribute". + + template + class JsonAnyAttribute : public JsonAttribute { + public: + JsonAnyAttribute ( const std::string& key + , unsigned long flags + , T C::* attr + ); + virtual ~JsonAnyAttribute (); + virtual std::type_index tid () const; + virtual JsonAnyAttribute* clone () const; + virtual void toJson ( JsonWriter*, boost::any object ) const; + private: + T C::* _attribute; + }; + + + template + JsonAnyAttribute::JsonAnyAttribute ( const std::string& key + , unsigned long flags + , T C::* attr + ) + : JsonAttribute(key,flags) + , _attribute (attr) + { } + + template + JsonAnyAttribute::~JsonAnyAttribute () + { } + + template + std::type_index JsonAnyAttribute::tid () + { return typeid(T); } + + template + JsonAnyAttribute* JsonAnyAttribute::clone () const + { return new JsonAnyAttribute( *this ); } + + +// ------------------------------------------------------------------- +// Class : "JsonStrAttribute". + + template + class JsonStrAttribute : public JsonAttribute { + public: + JsonStrAttribute ( const std::string& key + , unsigned long flags + , T C::* attr + ); + virtual ~JsonStrAttribute (); + virtual std::type_index tid () const; + virtual JsonStrAttribute* clone () const; + virtual void toJson ( JsonWriter*, boost::any object ) const; + private: + T C::* _attribute; + }; + + + template + JsonStrAttribute::JsonStrAttribute ( const std::string& key + , unsigned long flags + , T C::* attr + ) + : JsonAttribute(key,flags) + , _attribute (attr) + { } + + template + JsonStrAttribute::~JsonStrAttribute () + { } + + template + std::type_index JsonStrAttribute::tid () + { return typeid(T); } + + template + JsonStrAttribute* JsonStrAttribute::clone () const + { return new JsonStrAttribute( *this ); } + + template + void JsonStrAttribute::toJson ( JsonWriter* w, boost::any object ) const + { jsonWrite( w, key(), getString( boost::any_cast(object)->*_attribute ) ); } + + +// ------------------------------------------------------------------- +// Class : "JsonFtrrAttribute". + + template + class JsonFtrrAttribute : public JsonAttribute { + public: + JsonFtrrAttribute ( const std::string& key + , unsigned long flags + , T C::* attr + , std::function tr + ); + virtual ~JsonFtrrAttribute (); + virtual std::type_index tid () const; + virtual JsonFtrrAttribute* clone () const; + virtual void toJson ( JsonWriter*, boost::any object ) const; + private: + T C::* _attribute; + std::function _tr; + }; + + + template + JsonFtrrAttribute::JsonFtrrAttribute ( const std::string& key + , unsigned long flags + , T C::* attr + , std::function tr + ) + : JsonAttribute(key,flags) + , _attribute (attr) + , _tr (tr) + { } + + template + JsonFtrrAttribute::~JsonFtrrAttribute () + { } + + template + std::type_index JsonFtrrAttribute::tid () + { return typeid(T); } + + template + JsonFtrrAttribute* JsonFtrrAttribute::clone () const + { return new JsonFtrrAttribute( *this ); } + + template + void JsonFtrrAttribute::toJson ( JsonWriter* w, boost::any object ) const + { jsonWrite( w, key(), _tr( boost::any_cast(object)->*_attribute ) ); } + + +// ------------------------------------------------------------------- +// Class : "JsonFtrpAttribute". + + template + class JsonFtrpAttribute : public JsonAttribute { + public: + JsonFtrpAttribute ( const std::string& key + , unsigned long flags + , T* C::* attr + , std::function tr + ); + virtual ~JsonFtrpAttribute (); + virtual std::type_index tid () const; + virtual JsonFtrpAttribute* clone () const; + virtual void toJson ( JsonWriter*, boost::any object ) const; + private: + T* C::* _attribute; + std::function _tr; + }; + + + template + JsonFtrpAttribute::JsonFtrpAttribute ( const std::string& key + , unsigned long flags + , T* C::* attr + , std::function tr + ) + : JsonAttribute(key,flags) + , _attribute (attr) + , _tr (tr) + { } + + template + JsonFtrpAttribute::~JsonFtrpAttribute () + { } + + template + std::type_index JsonFtrpAttribute::tid () + { return typeid(T); } + + template + JsonFtrpAttribute* JsonFtrpAttribute::clone () const + { return new JsonFtrpAttribute( *this ); } + + template + void JsonFtrpAttribute::toJson ( JsonWriter* w, boost::any object ) const + { jsonWrite( w, key(), _tr( boost::any_cast(object)->*_attribute ) ); } + + +// ------------------------------------------------------------------- +// Class : "JsonMethAttribute". + + template + class JsonMethAttribute : public JsonAttribute { + public: + JsonMethAttribute ( const std::string& key + , unsigned long flags + , R (C::* meth )() const + ); + virtual ~JsonMethAttribute (); + virtual std::type_index tid () const; + virtual JsonMethAttribute* clone () const; + virtual void toJson ( JsonWriter*, boost::any object ) const; + private: + R (C::* _meth)() const; + }; + + + template + JsonMethAttribute::JsonMethAttribute ( const std::string& key + , unsigned long flags + , R (C::* meth)() const + ) + : JsonAttribute(key,flags) + , _meth (meth) + { } + + template + JsonMethAttribute::~JsonMethAttribute () + { } + + template + std::type_index JsonMethAttribute::tid () + { return typeid(R); } + + template + JsonMethAttribute* JsonMethAttribute::clone () const + { return new JsonMethAttribute( *this ); } + + template + void JsonMethAttribute::toJson ( JsonWriter* w, boost::any object ) const + { jsonWrite( w, key(), (boost::any_cast(object)->*_meth)() ); } + + +// ------------------------------------------------------------------- +// Class : "JsonAnyAttribute". + +#define JSON_POD_ATTRIBUTE(pod_t) \ + template \ + class JsonAnyAttribute : public JsonAttribute { \ + public: \ + JsonAnyAttribute ( const std::string& key \ + , unsigned long flags \ + , pod_t C::* attr \ + ); \ + virtual ~JsonAnyAttribute (); \ + virtual std::type_index tid () const; \ + virtual JsonAnyAttribute* clone () const; \ + virtual void toJson ( JsonWriter*, boost::any object ) const; \ + private: \ + pod_t C::* _attribute; \ + }; \ + \ + \ + template \ + JsonAnyAttribute::JsonAnyAttribute ( const std::string& key \ + , unsigned long flags \ + , pod_t C::* attr \ + ) \ + : JsonAttribute(key,flags) \ + , _attribute (attr) \ + { } \ + \ + template \ + JsonAnyAttribute::~JsonAnyAttribute () \ + { } \ + \ + template \ + std::type_index JsonMethAttribute::tid () \ + { return typeid(pod_t); } \ + \ + template \ + JsonAnyAttribute* JsonAnyAttribute::clone () const \ + { return new JsonAnyAttribute( *this ); } \ + \ + template \ + void JsonAnyAttribute::toJson ( JsonWriter* w, boost::any object ) const \ + { jsonWrite( w, key(), boost::any_cast(object)->*_attribute ); } + + +// Build a specialized JsonAnyAttribute for all POD types. + JSON_POD_ATTRIBUTE(bool) + JSON_POD_ATTRIBUTE(int) + JSON_POD_ATTRIBUTE(long) + JSON_POD_ATTRIBUTE(unsigned int) + JSON_POD_ATTRIBUTE(unsigned long) + + +// ------------------------------------------------------------------- +// Class : "JsonObject". + + class JsonObject { + public: + enum Flags { IsJsonObject = (1<<0) + , UsePlugReference = (1<<1) + , UseReference = (1<<3) + }; + public: + JsonObject (); + JsonObject ( const JsonObject& ); + virtual ~JsonObject (); + virtual std::string getTypeName () const = 0; + inline std::string getStackName () const; + virtual bool isJsonObject () const; + bool check ( JsonStack&, string fname ) const; + void print ( std::ostream& ) const; + bool has ( const std::string& key ) const; + template + inline T get ( JsonStack&, const std::string& key ) const; + void add ( const std::string& key, unsigned long flags ); + template + void add ( const std::string& key, T C::* attr, unsigned long flags ); + template + void add ( const std::string& key, T C::* attr, R(*tr)(T&), unsigned long flags ); + template + void add ( const std::string& key, T* C::* attr, R(*tr)(T*), unsigned long flags ); + template + void add ( const std::string& key, R(C::* meth)() const, unsigned long flags ); + template + void addS ( const std::string& key, T C::* attr, unsigned long flags ); + void remove ( const std::string& key ); + template + T access ( const std::string& key ); + inline void clear (); + inline std::string getName () const; + inline void setName ( const string& ); + template inline T& getObject () const; + template inline void setObject ( T& ) ; + inline bool isCreated () const; + virtual JsonObject* clone () const = 0; + template void toJson ( JsonWriter*, C* object ) const; + virtual void toData ( JsonStack& ); + template inline void update ( JsonStack&, T ); + inline void setFlags ( unsigned long mask ); + inline void resetFlags ( unsigned long mask ); + inline bool issetFlags ( unsigned long mask ) const; + protected: + inline bool _checkKey ( const std::string& key ) const; + protected: + unsigned long _flags; + std::string _name; + std::vector _stackeds; + std::vector _attributes; + std::vector _collections; + boost::any _object; + }; + + + inline bool JsonObject::isCreated () const { return not _object.empty(); } + inline std::string JsonObject::getName () const { return _name; } + inline void JsonObject::setName ( const string& name ) { _name=name; } + inline void JsonObject::setFlags ( unsigned long mask ) { _flags |= mask; } + inline void JsonObject::resetFlags ( unsigned long mask ) { _flags &= ~mask; } + inline bool JsonObject::issetFlags ( unsigned long mask ) const { return _flags & mask; } + + inline std::string JsonObject::getStackName () const + { return (_name.empty()) ? std::string(".")+getTypeName(): _name; } + + template inline T& JsonObject::getObject () const + { return boost::any_cast(_object); } + + template inline void JsonObject::setObject ( T& t ) + { _object = t; } + + + bool JsonObject::checkKey ( const std::string& key ) const + { + if (key.empty()) { + cerr << "[ERROR] JsonObject::add(): Attempt to add attribute with an empty name, ignored." + << endl; + return false; + } + if (has(key)) { + cerr << "[ERROR] JsonObject::add(): Attempt to add attribute \"" << key << "\" twice, cancelled." + << endl; + return false; + } + return true; + } + + + void JsonObject::add ( const std::string& key ) + { + if ( _checkKey(key) and (key[0] == '.') ) { + _stackeds.push_back( new JsonStacked(key) ); + return; + } + cerr << "[ERROR] JsonObject::add(): Stack requirement key \"" << key + << "\" do not follow naming convention, cancelled." << endl; + } + + + template + void JsonObject::add( const std::string& key, T C::* attr, unsigned long flags ) + { + if (not _checkKey(key)) return; + switch ( key[0] ) { + case '_': _attributes.push_back( new JsonAnyAttribute(key,flags,attr) ); + case '+': _attributes.push_back( new JsonAnyAttribute(key,flags,attr) ); + return; + } + cerr << "[ERROR] JsonObject::add(): Key name \"" << key + << "\" do not follow naming convention, cancelled." << endl; + } + + + template + void JsonObject::add( const std::string& key, T C::* attr, R(*tr)(T&), unsigned long flags ) + { + if (not _checkKey(key)) return; + switch ( key[0] ) { + case '_': _attributes.push_back( new JsonFtrrAttribute(key,flags,attr,std::function(tr)) ); + case '+': _attributes.push_back( new JsonFtrrAttribute(key,flags,attr,std::function(tr)) ); + return; + } + cerr << "[ERROR] JsonObject::add(): Key name \"" << key + << "\" do not follow naming convention, cancelled." << endl; + } + + + template + void JsonObject::add( const std::string& key, T* C::* attr, R(*tr)(T*), unsigned long flags ) + { + if (not _checkKey(key)) return; + switch ( key[0] ) { + case '_': _attributes.push_back( new JsonFtrpAttribute(key,flags,attr,std::function(tr)) ); + case '+': _attributes.push_back( new JsonFtrpAttribute(key,flags,attr,std::function(tr)) ); + return; + } + cerr << "[ERROR] JsonObject::add(): Key name \"" << key + << "\" do not follow naming convention, cancelled." << endl; + } + + + template + void JsonObject::add( const std::string& key, R(C::*meth)() const, unsigned long flags ) + { + if (not _checkKey(key)) return; + switch ( key[0] ) { + case '_': _attributes.push_back( new JsonMethAttribute(key,flags,meth) ); + case '+': _attributes.push_back( new JsonMethAttribute(key,flags,meth) ); + return; + } + cerr << "[ERROR] JsonObject::add(): Key name \"" << key + << "\" do not follow naming convention, cancelled." << endl; + } + + + template + void JsonObject::addS( const std::string& key, T C::* attr, unsigned int flags ) + { + if (not _checkKey(key)) return; + switch ( key[0] ) { + case '_': _attributes.push_back( new JsonStrAttribute(key,flags,attr) ); + return; + } + cerr << "[ERROR] JsonObject::addS(): Key name \"" << key + << "\" do not follow naming convention, cancelled." << endl; + } + + + template void JsonObject::toJson ( JsonWriter* w, C* object ) const + { + if (isJsonObject()) { + w->startObject(); + jsonWrite( w, "@typename", getTypeName() ); + for ( JsonAttribute* attribute : _attributes ) attribute ->toJson( w, object ); + for ( JsonAttribute* collection : _collections ) collection->toJson( w, object ); + w->endObject(); + } + } + + + inline void JsonObject::clear () + { + for ( JsonAttribute* attribute : _stackeds ) delete attribute; + for ( JsonAttribute* attribute : _attributes ) delete attribute; + for ( JsonAttribute* attribute : _collections ) delete attribute; + + _stackeds .clear(); + _attributes .clear(); + _collections.clear(); + } + + + class JsonKey : public JsonObject { + public: + inline JsonKey ( const std::string& ); + virtual std::string getTypeName () const; + virtual JsonKey* clone () const; + private: + std::string _key; + }; + + +} // Hurricane namespace. + + +namespace std { + + template<> + struct less { + inline bool operator() ( const Hurricane::JsonObject* lhs, const Hurricane::JsonObject* rhs ) + { return lhs->getTypeName() < rhs->getTypeName(); } + }; + +} // std namespace. + + +namespace Hurricane { + +// ------------------------------------------------------------------- +// Class : "JsonTypes". + + class JsonTypes { + public: + static void initialize (); + static void registerType ( JsonObject* ); + static JsonObject* find ( const std::string& tname ); + private: + JsonTypes (); + ~JsonTypes (); + JsonTypes ( const JsonTypes& ); + void _registerType ( JsonObject* ); + JsonObject* _find ( const std::string& tname ); + private: + static JsonTypes* _jsonTypes; + std::set _jsonObjects; + }; + + +// ------------------------------------------------------------------- +// Class : "JsonStack". + + class JsonStack { + public: + typedef std::pair Element; + public: + inline JsonStack (); + inline size_t size () const; + template inline void push_back ( const std::string&, T ); + inline void pop_back ( size_t count=1 ); + inline int rhas ( const std::string& ) const; + template inline T as ( const std::string& ) const; + template inline T as ( int ) const; + template inline T getEntity ( unsigned int ) const; + void addEntity ( unsigned int jsonId, Entity* ); + void print ( std::ostream& ) const; + inline JsonStack* setFlags ( unsigned long mask ); + inline JsonStack* resetFlags ( unsigned long mask ); + inline bool issetFlags ( unsigned long mask ) const; + inline const Element& operator[] ( int index ) const; + private: + unsigned long _flags; + vector _stack; + std::map _entities; + }; + + + inline JsonStack::JsonStack () + : _flags(0), _stack(), _entities() + { } + + template inline void JsonStack::push_back ( const std::string& key, T t ) { + cdebug.log(19) << "JsonStack::push_back() key:" << key << " t:" << t + << " (" << demangle(typeid(T)) << ")." << endl; + _stack.push_back(std::make_pair(key,boost::any(t))); + } + + inline void JsonStack::pop_back ( size_t count ) + { while (count--) { + if (_stack.empty()) { + std::cerr << "[ERROR] JsonStack::pop_back(): Stack is empty, but " + << (count+1) << " elements remains to pop." << std::endl; + break; + } + cdebug.log(19) << "| _stack.pop_back() " << _stack.back().first << endl; + _stack.pop_back(); + } + } + + inline const JsonStack::Element& JsonStack::operator[] ( int index ) const + { + if (index < 0) return _stack[_stack.size()+index]; + return _stack[index]; + } + + inline int JsonStack::rhas ( const std::string& key ) const + { + if (_stack.empty()) return 0; + + int i = _stack.size()-1; + do { + if (_stack[i].first == key) { + cdebug.log(19) << "JsonStack::rhas(): key \"" << key << "\" found at index:" + << (i-(int)_stack.size()) << " (i:" << i << ")." << endl; + return i-(int)_stack.size(); + } + if (i == 0) break; + --i; + } while ( true ); + + cdebug.log(19) << "JsonStack::rhas(): key \"" << key << "\" not found (returning index: 0)." << endl; + return 0; + } + + template inline T JsonStack::as ( const std::string& key ) const + { + if (not _stack.empty()) { + int i = _stack.size()-1; + do { + if (_stack[i].first == key) { + cdebug.log(19) << "JsonStack::as() k:" << key + << " t:" << _stack[i].second.type().name() << std::endl; + return boost::any_cast( _stack[i].second ); + } + if (i == 0) break; + --i; + } while ( true ); + + std::cerr << "[ERROR] JsonStack::as(key): No element with key \"" + << key << "\" in stack." << std::endl; + } else { + std::cerr << "[ERROR] JsonStack::as(key): Stack is empty while searching for key \"" + << key << "\"." << std::endl; + } + + return T(); + } + + template inline T JsonStack::as ( int index ) const + { + size_t i = (index >= 0) ? index : (_stack.size()+index); + return boost::any_cast( _stack[i].second ); + } + + template inline T JsonStack::getEntity ( unsigned int id ) const { + std::map::const_iterator it = _entities.find(id); + if (it == _entities.end()) return NULL; + return dynamic_cast((*it).second); + } + + inline size_t JsonStack::size () const { return _stack.size(); } + inline JsonStack* JsonStack::setFlags ( unsigned long mask ) { _flags |= mask; return this; } + inline JsonStack* JsonStack::resetFlags ( unsigned long mask ) { _flags &= ~mask; return this; } + inline bool JsonStack::issetFlags ( unsigned long mask ) const { return _flags & mask; } + + + template + T JsonObject::get ( JsonStack& stack, const std::string& key ) const + { + int index = stack.rhas(key); + if (index == 0) return T();; + + return stack.as( index ); + } + + template inline void JsonObject::update ( JsonStack& stack, T hobject ) + { + stack.pop_back( _attributes.size() ); + stack.push_back( getStackName(), hobject ); + setObject( hobject ); + } + + +// ------------------------------------------------------------------- +// Function : Json Cell parser. + + Cell* jsonCellParse ( std::string filename ); + + +} // Hurricane namespace. + + +template +inline void jsonWrite ( JsonWriter* w, const std::string& key, const C* object, unsigned long flags ) +{ + w->key( key ); + Hurricane::JsonObject* jobject = C::getJsonObject(flags); + jobject->toJson( w, object ); + delete jobject; +} + + +namespace Hurricane { + +// Delayed "void JsonAnyAttribute::toJson()" template definition, because +// it needs the jsonWrite<> template specialisation for "const T*", which can +// be only declared after "JsonObject". + + template + void JsonAnyAttribute::toJson ( JsonWriter* w, boost::any object ) const + { jsonWrite( w, key(), &(boost::any_cast(object)->*_attribute) ); } + +} // Hurricane namespace. + +#endif // HURRICANE_JSON_READER_H diff --git a/hurricane/src/hurricane/grenier/json/Net.cpp b/hurricane/src/hurricane/grenier/json/Net.cpp new file mode 100644 index 00000000..5654ba5e --- /dev/null +++ b/hurricane/src/hurricane/grenier/json/Net.cpp @@ -0,0 +1,1106 @@ +// **************************************************************************************************** +// File: ./Net.cpp +// Authors: R. Escassut +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved +// +// This file is part of Hurricane. +// +// Hurricane is free software: you can redistribute it and/or modify it under the terms of the GNU +// Lesser General Public License as published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// Hurricane is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU +// General Public License for more details. +// +// You should have received a copy of the Lesser GNU General Public License along with Hurricane. If +// not, see . +// **************************************************************************************************** + +#include "hurricane/Warning.h" +#include "hurricane/Net.h" +#include "hurricane/Cell.h" +#include "hurricane/Instance.h" +#include "hurricane/Plug.h" +#include "hurricane/RoutingPad.h" +#include "hurricane/RoutingPads.h" +#include "hurricane/Pin.h" +#include "hurricane/Contact.h" +#include "hurricane/Vertical.h" +#include "hurricane/Horizontal.h" +#include "hurricane/Pad.h" +#include "hurricane/UpdateSession.h" +#include "hurricane/Error.h" + +namespace Hurricane { + + + +// **************************************************************************************************** +// Filters declaration & implementation +// **************************************************************************************************** + +class Net_IsCellNetFilter : public Filter { +// ******************************************* + + public: Net_IsCellNetFilter() {}; + + public: Net_IsCellNetFilter(const Net_IsCellNetFilter& filter) {}; + + public: Net_IsCellNetFilter& operator=(const Net_IsCellNetFilter& filter) {return *this;}; + + public: virtual Filter* getClone() const {return new Net_IsCellNetFilter(*this);}; + + public: virtual bool accept(Net* net) const {return !net->isDeepNet();}; + + public: virtual string _getString() const {return "<" + _TName("Net::IsCellNetFilter>");}; + +}; + +class Net_IsDeepNetFilter : public Filter { +// ******************************************* + + public: Net_IsDeepNetFilter() {}; + + public: Net_IsDeepNetFilter(const Net_IsDeepNetFilter& filter) {}; + + public: Net_IsDeepNetFilter& operator=(const Net_IsDeepNetFilter& filter) {return *this;}; + + public: virtual Filter* getClone() const {return new Net_IsDeepNetFilter(*this);}; + + public: virtual bool accept(Net* net) const {return net->isDeepNet();}; + + public: virtual string _getString() const {return "<" + _TName("Net::IsDeepNetFilter>");}; + +}; + +class Net_IsGlobalFilter : public Filter { +// ******************************************* + + public: Net_IsGlobalFilter() {}; + + public: Net_IsGlobalFilter(const Net_IsGlobalFilter& filter) {}; + + public: Net_IsGlobalFilter& operator=(const Net_IsGlobalFilter& filter) {return *this;}; + + public: virtual Filter* getClone() const {return new Net_IsGlobalFilter(*this);}; + + public: virtual bool accept(Net* net) const {return net->isGlobal();}; + + public: virtual string _getString() const {return "<" + _TName("Net::IsGlobalFilter>");}; + +}; + +class Net_IsExternalFilter : public Filter { +// ********************************************* + + public: Net_IsExternalFilter() {}; + + public: Net_IsExternalFilter(const Net_IsExternalFilter& filter) {}; + + public: Net_IsExternalFilter& operator=(const Net_IsExternalFilter& filter) {return *this;}; + + public: virtual Filter* getClone() const {return new Net_IsExternalFilter(*this);}; + + public: virtual bool accept(Net* net) const {return net->isExternal();}; + + public: virtual string _getString() const {return "<" + _TName("Net::IsExternalFilter>");}; + +}; + +class Net_IsClockFilter : public Filter { +// ****************************************** + + public: Net_IsClockFilter() {}; + + public: Net_IsClockFilter(const Net_IsClockFilter& filter) {}; + + public: Net_IsClockFilter& operator=(const Net_IsClockFilter& filter) {return *this;}; + + public: virtual Filter* getClone() const {return new Net_IsClockFilter(*this);}; + + public: virtual bool accept(Net* net) const {return net->isClock();}; + + public: virtual string _getString() const {return "<" + _TName("Net::IsClockFilter>");}; + +}; + +class Net_IsSupplyFilter : public Filter { +// ******************************************* + + public: Net_IsSupplyFilter() {}; + + public: Net_IsSupplyFilter(const Net_IsSupplyFilter& filter) {}; + + public: Net_IsSupplyFilter& operator=(const Net_IsSupplyFilter& filter) {return *this;}; + + public: virtual Filter* getClone() const {return new Net_IsSupplyFilter(*this);}; + + public: virtual bool accept(Net* net) const {return net->isSupply();}; + + public: virtual string _getString() const {return "<" + _TName("Net::IsSupplyFilter>");}; + +}; + +class Net_IsPowerFilter : public Filter { +// ******************************************* + + public: Net_IsPowerFilter() {}; + + public: Net_IsPowerFilter(const Net_IsPowerFilter& filter) {}; + + public: Net_IsPowerFilter& operator=(const Net_IsPowerFilter& filter) {return *this;}; + + public: virtual Filter* getClone() const {return new Net_IsPowerFilter(*this);}; + + public: virtual bool accept(Net* net) const {return net->isPower();}; + + public: virtual string _getString() const {return "<" + _TName("Net::IsPowerFilter>");}; + +}; + +class Net_IsGroundFilter : public Filter { +// ******************************************* + + public: Net_IsGroundFilter() {}; + + public: Net_IsGroundFilter(const Net_IsGroundFilter& filter) {}; + + public: Net_IsGroundFilter& operator=(const Net_IsGroundFilter& filter) {return *this;}; + + public: virtual Filter* getClone() const {return new Net_IsGroundFilter(*this);}; + + public: virtual bool accept(Net* net) const {return net->isGround();}; + + public: virtual string _getString() const {return "<" + _TName("Net::IsGroundFilter>");}; + +}; + + + +// **************************************************************************************************** +// Net_SlavePlugs implementation +// **************************************************************************************************** + +class Net_SlavePlugs : public Collection { +// ******************************************** + +// Types +// ***** + + public: typedef Collection Inherit; + + public: class Locator : public Hurricane::Locator { + // ***************************************************** + + public: typedef Hurricane::Locator Inherit; + + private: const Net* _net; + private: Plug* _plug; + private: InstanceLocator _instanceLocator; + + public: Locator(const Net* net = NULL); + public: Locator(const Locator& locator); + + public: Locator& operator=(const Locator& locator); + + public: virtual Plug* getElement() const; + public: virtual Hurricane::Locator* getClone() const; + + public: virtual bool isValid() const; + + public: virtual void progress(); + + public: virtual string _getString() const; + + }; + +// Attributes +// ********** + + private: const Net* _net; + +// Constructors +// ************ + + public: Net_SlavePlugs(const Net* net = NULL); + public: Net_SlavePlugs(const Net_SlavePlugs& slavePlugs); + +// Operators +// ********* + + public: Net_SlavePlugs& operator=(const Net_SlavePlugs& slavePlugs); + +// Accessors +// ********* + + public: virtual Collection* getClone() const; + public: virtual Hurricane::Locator* getLocator() const; + +// Others +// ****** + + public: virtual string _getString() const; + +}; + + + +// **************************************************************************************************** +// Net implementation +// **************************************************************************************************** + +Net::Net(Cell* cell, const Name& name) +// *********************************** +: Inherit(), + _cell(cell), + _name(name), + _arity(1), + _isGlobal(false), + _isExternal(false), + _isAutomatic(false), + _type(Type::LOGICAL), // default is Type::LOGICAL : no more Type::Undefined - Damien.Dupuis 01/10/2010 + _direction(), + _position(0,0), + _componentSet(), + _rubberSet(), + _nextOfCellNetMap(NULL), + _mainName(this) +{ + if (!_cell) + throw Error("Can't create " + _TName("Net") + " : null cell"); + + if (name.isEmpty()) + throw Error("Can't create " + _TName("Net") + " : empty name"); + + if (_cell->getNet(_name)) + throw Error("Can't create " + _TName("Net ") + getString(_name) + " : already exists"); +} + +Net* Net::create(Cell* cell, const Name& name) +// ******************************************* +{ + Net* net = new Net(cell, name); + + net->_postCreate(); + + return net; +} + +Box Net::getBoundingBox() const +// **************************** +{ + Box boundingBox; + for_each_component(component, getComponents()) { + boundingBox.merge(component->getBoundingBox()); + end_for; + } + return boundingBox; +} + +RoutingPads Net::getRoutingPads() const +// ************************ +{ + // return getComponents().getSubSet(); + return SubTypeCollection(getComponents()); +} + +Plugs Net::getPlugs() const +// ************************ +{ + // return getComponents().getSubSet(); + return SubTypeCollection(getComponents()); +} + +Pins Net::getPins() const +// ********************** +{ + // return getComponents().getSubSet(); + return SubTypeCollection(getComponents()); +} + +Contacts Net::getContacts() const +// ****************************** +{ + // return getComponents().getSubSet(); + return SubTypeCollection(getComponents()); +} + +Segments Net::getSegments() const +// ****************************** +{ + // return getComponents().getSubSet(); + return SubTypeCollection(getComponents()); +} + +Verticals Net::getVerticals() const +// ******************************** +{ + // return getComponents().getSubSet(); + return SubTypeCollection(getComponents()); +} + +Horizontals Net::getHorizontals() const +// ************************************ +{ + // return getComponents().getSubSet(); + return SubTypeCollection(getComponents()); +} + +Pads Net::getPads() const +// ********************** +{ + // return getComponents().getSubSet(); + return SubTypeCollection(getComponents()); +} + +Plugs Net::getSlavePlugs() const +// ***************************** +{ + return Net_SlavePlugs(this); +} + +Plugs Net::getConnectedSlavePlugs() const +// ************************************** +{ + return getSlavePlugs().getSubSet(Plug::getIsConnectedFilter()); +} + +Plugs Net::getUnconnectedSlavePlugs() const +// **************************************** +{ + return getSlavePlugs().getSubSet(Plug::getIsUnconnectedFilter()); +} + +NetFilter Net::getIsCellNetFilter() +// ******************************* +{ + return Net_IsCellNetFilter(); +} + +NetFilter Net::getIsDeepNetFilter() +// ******************************* +{ + return Net_IsDeepNetFilter(); +} + +NetFilter Net::getIsGlobalFilter() +// ******************************* +{ + return Net_IsGlobalFilter(); +} + +NetFilter Net::getIsExternalFilter() +// ********************************* +{ + return Net_IsExternalFilter(); +} + +NetFilter Net::getIsInternalFilter() +// ********************************* +{ + return !Net_IsExternalFilter(); +} + +NetFilter Net::getIsClockFilter() +// ****************************** +{ + return Net_IsClockFilter(); +} + +NetFilter Net::getIsSupplyFilter() +// ******************************* +{ + return Net_IsSupplyFilter(); +} + +NetFilter Net::getIsPowerFilter() +// ******************************* +{ + return Net_IsPowerFilter(); +} + +NetFilter Net::getIsGroundFilter() +// ******************************* +{ + return Net_IsGroundFilter(); +} + +void Net::setName(const Name& name) +// ******************************** +{ + if (name != _name) { + if (name.isEmpty()) + throw Error("Can't change net name : empty name"); + + if (_cell->getNet(name)) + throw Error("Can't change net name : already exists"); + + _cell->_getNetMap()._remove(this); + _name = name; + _cell->_getNetMap()._insert(this); + } +} + +void Net::setArity(const Arity& arity) +// *********************************** +{ + _arity = arity; +} + +void Net::setGlobal(bool isGlobal) +// ******************************* +{ + _isGlobal = isGlobal; +} + +void Net::setExternal(bool isExternal) +// *********************************** +{ + if (isExternal != _isExternal) { + if (!isExternal) { + if (!getConnectedSlavePlugs().isEmpty()) + throw Error("Can't set internal : has connected slave plugs"); + _direction = Direction::UNDEFINED; + } + _isExternal = isExternal; + if (_isExternal) { + UpdateSession::open(); + setPosition(Point(0,0)); + for_each_instance(instance, _cell->getSlaveInstances()) { + Plug::_create(instance, this); + end_for; + } + UpdateSession::close(); + } + } +} + +void Net::setAutomatic(bool isAutomatic) +// ************************************* +{ + _isAutomatic = isAutomatic; +} + +void Net::setType(const Type& type) +// ******************************** +{ + _type = type; +} + +void Net::setPosition(const Point& position) +// ***************************************** +{ + if (_position != position) { + for_each_plug(plug, getSlavePlugs()) { + plug->invalidate(true); + end_for; + } + _position = position; + } +} + +void Net::setDirection(const Direction& direction) +// *********************************************** +{ + _direction = direction; +} + +bool Net::addAlias(const Name& name ) +// ********************************** +{ + if (getCell()->getNet(name)) { + cerr << Warning( "Net::addAlias(): Cannot add alias %s to net %s, already taken." + , getString(name).c_str() + , getString(getName()).c_str() + ) << endl; + return false; + } + + NetAliasName* slave = new NetAliasName ( name ); + _mainName.attach( slave ); + getCell()->_addNetAlias( slave ); + + return true; +} + +bool Net::removeAlias(const Name& name ) +// ************************************* +{ + NetAliasName* slave = _mainName.find( name ); + if (slave) { + slave->detach(); + getCell()->_removeNetAlias( slave ); + return true; + } + return false; +} + +Net* Net::getClone(Cell* clonedCell) +// ********************************* +{ + Net* clonedNet = Net::create( clonedCell, getName() ); + clonedNet->setArity ( getArity() ); + clonedNet->setGlobal ( isGlobal() ); + clonedNet->setExternal ( isExternal() ); + clonedNet->setType ( getType() ); + clonedNet->setDirection( getDirection() ); + + return clonedNet; +} + +void Net::materialize() +// ******************** +{ + for_each_component(component, getComponents()) { + component->materialize(); + end_for; + } + for_each_rubber(rubber, getRubbers()) { + rubber->materialize(); + end_for; + } +} + +void Net::unmaterialize() +// ********************** +{ + for_each_rubber(rubber, getRubbers()) { + rubber->unmaterialize(); + end_for; + } + for_each_component(component, getComponents()) { + component->unmaterialize(); + end_for; + } +} + +static void mergeNets(Net* net1, Net* net2) +// **************************************** +{ + assert(net1); + assert(net2); + + if (net2->getName()[0] != '~') { + if ((net1->getName()[0] == '~') || + (net2->isGlobal() && !net1->isGlobal()) || + (net2->isExternal() && !net1->isExternal())) { + Net* tmpNet = net1; + net1 = net2; + net2 = tmpNet; + } + } + + if (net2->isExternal() && !net1->isExternal()) { + Net* tmpNet = net1; + net1 = net2; + net2 = tmpNet; + } + + net1->merge(net2); +} + +void Net::merge(Net* net) +// ********************** +{ + if (!net) + throw Error("Can't merge net : null net"); + + if (net == this) + throw Error("Can't merge net : itself"); + + if (net->getCell() != _cell) + throw Error("Can't merge net : incompatible net"); + + if (!isExternal() && net->isExternal() && !net->getConnectedSlavePlugs().isEmpty()) + throw Error("Can't merge net : incompatible net"); + + for_each_rubber(rubber, net->getRubbers()) rubber->_setNet(this); end_for; + for_each_component(component, net->getComponents()) component->_setNet(this); end_for; + + if (isExternal() && net->isExternal()) { + for_each_plug(plug, net->getConnectedSlavePlugs()) { + Plug* mainPlug = plug->getInstance()->getPlug(this); + if (mainPlug->isConnected() && (mainPlug->getNet() != plug->getNet())) + mergeNets(mainPlug->getNet(), plug->getNet()); + end_for; + } + for_each_plug(plug, net->getConnectedSlavePlugs()) { + Plug* mainPlug = plug->getInstance()->getPlug(this); + if (!mainPlug->isConnected()) mainPlug->setNet(plug->getNet()); + Hook* masterHook = plug->getBodyHook(); + Hook* nextMasterHook = masterHook->getNextMasterHook(); + if (nextMasterHook != masterHook) { + masterHook->detach(); + mainPlug->getBodyHook()->merge(nextMasterHook); + } + Hooks slaveHooks = masterHook->getSlaveHooks(); + while (!slaveHooks.isEmpty()) { + Hook* slaveHook = slaveHooks.getFirst(); + slaveHook->detach(); + slaveHook->attach(mainPlug->getBodyHook()); + } + plug->_destroy(); + end_for; + } + } + + Name mergedName = net->getName(); + NetAliasName* slaves = NULL; + if (net->_mainName.isAttached()) { + slaves = dynamic_cast( net->_mainName.getNext() ); + net->_mainName.detach(); + } + + if (net->isExternal() and not isExternal()) + setExternal( true ); + net->destroy(); + + if (slaves) _mainName.attach( slaves ); + addAlias( mergedName ); +} + +void Net::_postCreate() +// ******************** +{ + _cell->_getNetMap()._insert(this); + + if (_isExternal) { + for_each_instance(instance, _cell->getSlaveInstances()) { + Plug::_create(instance, this); + end_for; + } + } + + Inherit::_postCreate(); +} + +void Net::_preDestroy() +// ******************* +{ + Inherit::_preDestroy(); + + for_each_plug(slavePlug, getSlavePlugs()) slavePlug->_destroy(); end_for; + + unmaterialize(); + + for_each_rubber(rubber, getRubbers()) rubber->_destroy(); end_for; + + for_each_component(component, getComponents()) { + for_each_hook(hook, component->getHooks()) { + // 15 05 2006 xtof : detach all hooks in rings when + // a net deletion occurs, can't see why master hooks were not detached. + //if (!hook->IsMaster()) hook->detach(); + hook->detach(); + end_for; + } + end_for; + } + + for_each_component(component, getComponents()) { + if (!dynamic_cast(component)) + component->destroy(); + else + ((Plug*)component)->setNet(NULL); + end_for; + } + + _mainName.clear(); + _cell->_getNetMap()._remove(this); +} + +string Net::_getString() const +// *************************** +{ + string s = Inherit::_getString(); + s.insert(s.length() - 1, " " + getString(_name)); + return s; +} + +Record* Net::_getRecord() const +// ********************** +{ + Record* record = Inherit::_getRecord(); + if (record) { + record->add(getSlot("_cell", _cell)); + record->add(getSlot("_name", &_name)); + record->add(getSlot("_arity", &_arity)); + record->add(getSlot("_isGlobal", &_isGlobal)); + record->add(getSlot("_isExternal", &_isExternal)); + record->add(getSlot("_isAutomatic", &_isAutomatic)); + record->add(getSlot("_type", &_type)); + record->add(getSlot("_direction", &_direction)); + record->add(getSlot("_position", &_position)); + record->add(getSlot("_componentsSet", &_componentSet)); + record->add(getSlot("_rubberSet", &_rubberSet)); + record->add(getSlot("_mainName", &_mainName)); + } + return record; +} + +void Net::_toJson( JsonWriter* writer ) const +// ****************************************** +{ + // Inherit::_toJson( writer ); + + // jsonWrite( writer, "_name" , getName() ); + // jsonWrite( writer, "_isGlobal" , isGlobal() ); + // jsonWrite( writer, "_isExternal" , isExternal() ); + // jsonWrite( writer, "_isAutomatic" , isAutomatic() ); + // jsonWrite( writer, "_type" , getType() ); + // jsonWrite( writer, "_direction" , getDirection() ); + // jsonWrite( writer, "+aliases" , getAliases() ); + + // writer->setFlags( JsonWriter::UsePlugReference ); + // jsonWrite( writer, "+componentSet", getComponents() ); + // writer->setFlags( JsonWriter::UsePlugReference ); +} + +JsonObject* Net::getJsonObject(unsigned long flags) +// ************************************************ +{ + return new JsonNet ( flags ); +} + +// **************************************************************************************************** +// Net::Type implementation +// **************************************************************************************************** + +Net::Type::Type(const Code& code) +// ****************************** +: _code(code) +{ } + +Net::Type::Type(const Type& type) +// ****************************** +: _code(type._code) +{ } + +Net::Type::Type(string s) +// ********************** +: _code(UNDEFINED) +{ + if (s == "UNDEFINED") _code = UNDEFINED; + else if (s == "LOGICAL" ) _code = LOGICAL; + else if (s == "CLOCK" ) _code = CLOCK; + else if (s == "POWER" ) _code = POWER; + else if (s == "GROUND" ) _code = GROUND; +} + +Net::Type& Net::Type::operator=(const Type& type) +// ********************************************** +{ + _code = type._code; + return *this; +} + +string Net::Type::_getString() const +// ********************************* +{ + return getString(&_code); +} + +Record* Net::Type::_getRecord() const +// **************************** +{ + Record* record = new Record(getString(this)); + record->add(getSlot("Code", &_code)); + return record; +} + + + +// **************************************************************************************************** +// Net::Direction implementation +// **************************************************************************************************** + +Net::Direction::Direction(const Code& code) +// **************************************** +: _code(code) +{ } + +Net::Direction::Direction(const Direction& direction) +// ************************************************** +: _code(direction._code) +{ } + +Net::Direction::Direction(string s) +// ******************************** +: _code(UNDEFINED) +{ + if (s.size() > 3) { + if (s[0] == 'i') *this |= DirIn; + if (s[0] == 'o') *this |= DirOut; + if (s[0] == 't') *this |= ConnTristate; + if (s[0] == 'w') *this |= ConnWiredOr; + } +} + +Net::Direction& Net::Direction::operator=(const Direction& direction) +// ****************************************************************** +{ + _code = direction._code; + return *this; +} + +Net::Direction& Net::Direction::operator|=(const Direction& direction) +// ****************************************************************** +{ + _code = (Code)((unsigned int)_code | (unsigned int)direction._code); + return *this; +} + +string Net::Direction::_getString() const +// ************************************** +{ + return getString(&_code); +} + +Record* Net::Direction::_getRecord() const +// ********************************* +{ + Record* record = new Record(getString(this)); + record->add(getSlot("Code", &_code)); + return record; +} + + + +// **************************************************************************************************** +// Net::ComponentSet implementation +// **************************************************************************************************** + +Net::ComponentSet::ComponentSet() +// ****************************** +: Inherit() +{ +} + +unsigned Net::ComponentSet::_getHashValue(Component* component) const +// ****************************************************************** +{ + return component->getId() / 8; +} + +Component* Net::ComponentSet::_getNextElement(Component* component) const +// ********************************************************************** +{ + return component->_getNextOfNetComponentSet(); +} + +void Net::ComponentSet::_setNextElement(Component* component, Component* nextComponent) const +// ****************************************************************************************** +{ + component->_setNextOfNetComponentSet(nextComponent); +} + + + +// **************************************************************************************************** +// Net::RubberSet implementation +// **************************************************************************************************** + +Net::RubberSet::RubberSet() +// ************************ +: Inherit() +{ +} + +unsigned Net::RubberSet::_getHashValue(Rubber* rubber) const +// ********************************************************* +{ + return rubber->getId() / 8; +} + +Rubber* Net::RubberSet::_getNextElement(Rubber* rubber) const +// ********************************************************** +{ + return rubber->_getNextOfNetRubberSet(); +} + +void Net::RubberSet::_setNextElement(Rubber* rubber, Rubber* nextRubber) const +// *************************************************************************** +{ + rubber->_setNextOfNetRubberSet(nextRubber); +} + + + +// **************************************************************************************************** +// Net_SlavePlugs implementation +// **************************************************************************************************** + +Net_SlavePlugs::Net_SlavePlugs(const Net* net) +// ******************************************* +: Inherit(), + _net(net) +{ +} + +Net_SlavePlugs::Net_SlavePlugs(const Net_SlavePlugs& slavePlugs) +// ************************************************************* +: Inherit(), + _net(slavePlugs._net) +{ +} + +Net_SlavePlugs& Net_SlavePlugs::operator=(const Net_SlavePlugs& slavePlugs) +// ************************************************************************ +{ + _net = slavePlugs._net; + return *this; +} + +Collection* Net_SlavePlugs::getClone() const +// ************************************************ +{ + return new Net_SlavePlugs(*this); +} + +Locator* Net_SlavePlugs::getLocator() const +// *********************************************** +{ + return new Locator(_net); +} + +string Net_SlavePlugs::_getString() const +// ************************************** +{ + string s = "<" + _TName("Net::SlavePlugs"); + if (_net) s += " " + getString(_net); + s += ">"; + return s; +} + + + +// **************************************************************************************************** +// Net_SlavePlugs::Locator implementation +// **************************************************************************************************** + +Net_SlavePlugs::Locator::Locator(const Net* net) +// ********************************************* +: Inherit(), + _net(net), + _plug(NULL), + _instanceLocator() +{ + if (_net) { + _instanceLocator = _net->getCell()->getSlaveInstances().getLocator(); + while (!_plug && _instanceLocator.isValid()) { + _plug = _instanceLocator.getElement()->getPlug(_net); + _instanceLocator.progress(); + } + } +} + +Net_SlavePlugs::Locator::Locator(const Locator& locator) +// ***************************************************** +: Inherit(), + _net(locator._net), + _plug(locator._plug), + _instanceLocator(locator._instanceLocator) +{ +} + +Net_SlavePlugs::Locator& Net_SlavePlugs::Locator::operator=(const Locator& locator) +// ******************************************************************************** +{ + _net = locator._net; + _plug = locator._plug; + _instanceLocator = locator._instanceLocator; + return *this; +} + +Plug* Net_SlavePlugs::Locator::getElement() const +// ********************************************** +{ + return _plug; +} + +Locator* Net_SlavePlugs::Locator::getClone() const +// ****************************************************** +{ + return new Locator(*this); +} + +bool Net_SlavePlugs::Locator::isValid() const +// ****************************************** +{ + return (_plug != NULL); +} + +void Net_SlavePlugs::Locator::progress() +// ************************************* +{ + if (isValid()) { + _plug = NULL; + while (!_plug && _instanceLocator.isValid()) { + _plug = _instanceLocator.getElement()->getPlug(_net); + _instanceLocator.progress(); + } + } +} + +string Net_SlavePlugs::Locator::_getString() const +// *********************************************** +{ + string s = "<" + _TName("Net::SlavePlugs::Locator"); + if (_net) s += " " + getString(_net); + s += ">"; + return s; +} + + + +// **************************************************************************************************** +// JsonNet implementation +// **************************************************************************************************** + +JsonNet::JsonNet(unsigned long flags) +// ********************************** + : JsonEntity(flags) +{ + addS( "_name" , &Net::_name ); + add ( "_isGlobal" , &Net::_isGlobal ); + add ( "_isExternal" , &Net::_isExternal ); + add ( "_isAutomatic" , &Net::_isAutomatic ); + addS( "_type" , &Net::_type ); + addS( "_direction" , &Net::_direction ); +//addC( "+aliases" , &Net::getAliases ); + add ( "+componentSet", &Net::getComponents ); +} + +string JsonNet::getTypeName() const +// ********************************* +{ return "Net"; } + +JsonNet* JsonNet::clone() const +// **************************** +{ return new JsonNet ( *this ); } + +void JsonNet::toData(JsonStack& stack) +// *********************************** +{ + ltracein(51); + check( stack, "JsonNet::toData" ); + +//unsigned int jsonId = get(stack,"_id"); + Net* net = Net::create ( get(stack,".Cell") , get(stack,"_name") ); + net->setGlobal ( get(stack,"_isGlobal" ) ); + net->setExternal ( get(stack,"_isExternal" ) ); + net->setAutomatic( get(stack,"_isAutomatic") ); + net->setType ( Net::Type (get(stack,"_type")) ); + net->setDirection( Net::Direction(get(stack,"_direction")) ); + + update( stack, net ); + + cdebug.tabw(19,-1); +} + +} // End of Hurricane namespace. + + +// **************************************************************************************************** +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved +// **************************************************************************************************** diff --git a/hurricane/src/hurricane/grenier/json/Net.h b/hurricane/src/hurricane/grenier/json/Net.h new file mode 100644 index 00000000..a2749efd --- /dev/null +++ b/hurricane/src/hurricane/grenier/json/Net.h @@ -0,0 +1,363 @@ +// **************************************************************************************************** +// File: ./hurricane/Net.h +// Authors: R. Escassut +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved +// +// This file is part of Hurricane. +// +// Hurricane is free software: you can redistribute it and/or modify it under the terms of the GNU +// Lesser General Public License as published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// Hurricane is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU +// General Public License for more details. +// +// You should have received a copy of the Lesser GNU General Public License along with Hurricane. If +// not, see . +// **************************************************************************************************** + +#ifndef HURRICANE_NET +#define HURRICANE_NET + +#include +#include "hurricane/Entity.h" +#include "hurricane/Nets.h" +#include "hurricane/Component.h" +#include "hurricane/Rubbers.h" +#include "hurricane/Rubber.h" +#include "hurricane/RoutingPads.h" +#include "hurricane/Plugs.h" +#include "hurricane/Pins.h" +#include "hurricane/Contacts.h" +#include "hurricane/Segments.h" +#include "hurricane/Verticals.h" +#include "hurricane/Horizontals.h" +#include "hurricane/Pads.h" +#include "hurricane/IntrusiveSet.h" +#include "hurricane/Path.h" +#include "hurricane/NetAlias.h" + +namespace Hurricane { + + class JsonNet; + +// **************************************************************************************************** +// Net declaration +// **************************************************************************************************** + +class Net : public Entity { +// ********************** + + friend class JsonNet; + +// Types +// ***** + + public: typedef Entity Inherit; + + public: typedef unsigned Arity; + + public: class Type { + // *************** + + public: enum Code {UNDEFINED=0, LOGICAL=1, CLOCK=2, POWER=3, GROUND=4}; + + private: Code _code; + + public: Type(const Code& code = UNDEFINED); + public: Type(const Type& type); + public: Type(string); + + public: Type& operator=(const Type& type); + + public: operator const Code&() const {return _code;}; + + public: const Code& getCode() const {return _code;}; + + public: string _getTypeName() const { return _TName("Net::type"); }; + public: string _getString() const; + public: Record* _getRecord() const; + + }; + + public: class Direction { + // ******************** + + public: enum Code { DirIn = 0x0001 + , DirOut = 0x0002 + , DirUndefined = 0x0000 + , ConnTristate = 0x0100 + , ConnWiredOr = 0x0200 + , UNDEFINED = DirUndefined + , IN = DirIn + , OUT = DirOut + , INOUT = DirIn | DirOut + , TRISTATE = DirOut | ConnTristate + , TRANSCV = DirIn | DirOut | ConnTristate + , WOR_OUT = DirOut | ConnWiredOr + , WOR_INOUT = DirIn | DirOut | ConnWiredOr + , DirMask = DirIn | DirOut | DirUndefined + }; + + private: Code _code; + + public: Direction(const Code& code = UNDEFINED); + public: Direction(const Direction& direction); + public: Direction(string); + + public: Direction& operator =(const Direction& direction); + public: Direction& operator|=(const Direction& direction); + + public: operator const Code&() const {return _code;}; + + public: const Code& getCode() const {return _code;}; + + public: string _getTypeName() const { return _TName("Net::Direction"); }; + public: string _getString() const; + public: Record* _getRecord() const; + + }; + + class ComponentSet : public IntrusiveSet { + // ************************************************ + + public: typedef IntrusiveSet Inherit; + + public: ComponentSet(); + + public: virtual unsigned _getHashValue(Component* component) const; + public: virtual Component* _getNextElement(Component* component) const; + public: virtual void _setNextElement(Component* component, Component* nextComponent) const; + + }; + + class RubberSet : public IntrusiveSet { + // ****************************************** + + public: typedef IntrusiveSet Inherit; + + public: RubberSet(); + + public: virtual unsigned _getHashValue(Rubber* rubber) const; + public: virtual Rubber* _getNextElement(Rubber* rubber) const; + public: virtual void _setNextElement(Rubber* rubber, Rubber* nextRubber) const; + + }; + +// Attributes +// ********** + + private: Cell* _cell; + private: Name _name; + private: Arity _arity; + private: bool _isGlobal; + private: bool _isExternal; + private: bool _isAutomatic; + private: Type _type; + private: Direction _direction; + private: Point _position; + private: ComponentSet _componentSet; + private: RubberSet _rubberSet; + private: Net* _nextOfCellNetMap; + private: NetMainName _mainName; + +// Constructors +// ************ + + protected: Net(Cell* cell, const Name& name); + + public: static Net* create(Cell* cell, const Name& name); + +// Accessors +// ********* + + public: virtual Cell* getCell() const {return _cell;}; + public: virtual Box getBoundingBox() const; + public: const Name& getName() const {return _name;}; + public: const NetMainName* getMainName() const { return &_mainName; } + public: const Arity& getArity() const {return _arity;}; + public: const Type& getType() const {return _type;}; + public: const Direction& getDirection() const {return _direction;}; + public: const Point& getPosition() const {return _position;}; + public: const DbU::Unit& getX() const {return _position.getX();}; + public: const DbU::Unit& getY() const {return _position.getY();}; + public: Components getComponents() const {return _componentSet.getElements();}; + public: Rubbers getRubbers() const {return _rubberSet.getElements();}; + public: RoutingPads getRoutingPads() const; + public: Plugs getPlugs() const; + public: Pins getPins() const; + public: Contacts getContacts() const; + public: Segments getSegments() const; + public: Verticals getVerticals() const; + public: Horizontals getHorizontals() const; + public: Pads getPads() const; + public: Plugs getSlavePlugs() const; + public: Plugs getConnectedSlavePlugs() const; + public: Plugs getUnconnectedSlavePlugs() const; + public: Aliases getAliases() const { return new AliasList(this); }; + +// Filters +// ******* + + public: static NetFilter getIsCellNetFilter(); + public: static NetFilter getIsDeepNetFilter(); + public: static NetFilter getIsGlobalFilter(); + public: static NetFilter getIsExternalFilter(); + public: static NetFilter getIsInternalFilter(); + public: static NetFilter getIsClockFilter(); + public: static NetFilter getIsSupplyFilter(); + public: static NetFilter getIsPowerFilter(); + public: static NetFilter getIsGroundFilter(); + +// Predicates +// ********** + + public: virtual bool isDeepNet () const {return false;}; + public: bool isGlobal () const {return _isGlobal;}; + public: bool isExternal () const {return _isExternal;}; + public: bool isAutomatic() const {return _isAutomatic;}; + public: bool isLogical () const {return (_type == Type::LOGICAL);}; + public: bool isClock () const {return (_type == Type::CLOCK);}; + public: bool isPower () const {return (_type == Type::POWER);}; + public: bool isGround () const {return (_type == Type::GROUND);}; + public: bool isSupply () const {return (isPower() || isGround());}; + +// Updators +// ******** + + public: void setName(const Name& name); + public: void setArity(const Arity& arity); + public: void setGlobal(bool isGlobal); + public: void setExternal(bool isExternal); + public: void setAutomatic(bool isAutomatic); + public: void setType(const Type& type); + public: void setDirection(const Direction& direction); + public: void setPosition(const Point& position); + public: void materialize(); + public: void unmaterialize(); + public: bool addAlias(const Name& name); + public: bool removeAlias(const Name& name); + public: void merge(Net* net); + public: Net* getClone(Cell* cloneCell); + +// Others +// ****** + + protected: virtual void _postCreate(); + protected: virtual void _preDestroy(); + + public: virtual void _toJson ( JsonWriter* ) const; + public: static JsonObject* getJsonObject(unsigned long flags); + public: virtual string _getTypeName() const {return _TName("Net");}; + public: virtual string _getString() const; + public: virtual Record* _getRecord() const; + public: NetMainName& _getMainName() { return _mainName; } + public: ComponentSet& _getComponentSet() {return _componentSet;}; + public: RubberSet& _getRubberSet() {return _rubberSet;}; + public: Net* _getNextOfCellNetMap() const {return _nextOfCellNetMap;}; + + public: void _setNextOfCellNetMap(Net* net) {_nextOfCellNetMap = net;}; + +}; + +class JsonNet : public JsonEntity { +// ******************************** + + public: JsonNet(unsigned long flags); + public: virtual string getTypeName() const; + public: virtual JsonNet* clone() const; + public: virtual void toData(JsonStack&); +}; + +} // End of Hurricane namespace. + + +// ------------------------------------------------------------------- +// Inspector Support for : Net::Type::Code*". + +template<> +inline std::string getString + ( const Hurricane::Net::Type::Code* object ) + { + switch ( *object ) { + case Hurricane::Net::Type::UNDEFINED: return "UNDEFINED"; + case Hurricane::Net::Type::LOGICAL: return "LOGICAL"; + case Hurricane::Net::Type::CLOCK: return "CLOCK"; + case Hurricane::Net::Type::POWER: return "POWER"; + case Hurricane::Net::Type::GROUND: return "GROUND"; + } + return "ABNORMAL"; + } + +template<> +inline Hurricane::Record* getRecord + ( const Hurricane::Net::Type::Code* object ) + { + Hurricane::Record* record = new Hurricane::Record(getString(object)); + record->add(getSlot("Code", (unsigned int*)object)); + return record; + } + + +// ------------------------------------------------------------------- +// Inspector Support for : "const Net::Direction::Code*". + +template<> +inline std::string getString + ( const Hurricane::Net::Direction::Code* object ) + { + std::ostringstream s; + s << (((*object) & Hurricane::Net::Direction::DirIn ) ? 'i' : '-'); + s << (((*object) & Hurricane::Net::Direction::DirOut ) ? 'o' : '-'); + s << (((*object) & Hurricane::Net::Direction::ConnTristate) ? 't' : '-'); + s << (((*object) & Hurricane::Net::Direction::ConnWiredOr ) ? 'w' : '-'); + + switch ( (int)*object ) { + case Hurricane::Net::Direction::UNDEFINED: s << " (UNDEFINED)"; break; + case Hurricane::Net::Direction::IN: s << " (IN)"; break; + case Hurricane::Net::Direction::OUT: s << " (OUT)"; break; + case Hurricane::Net::Direction::INOUT: s << " (INOUT)"; break; + case Hurricane::Net::Direction::TRISTATE: s << " (TRISTATE)"; break; + case Hurricane::Net::Direction::TRANSCV: s << " (TRANSCV)"; break; + case Hurricane::Net::Direction::WOR_OUT: s << " (WOR_OUT)"; break; + case Hurricane::Net::Direction::WOR_INOUT: s << " (WOR_INOUT)"; break; + } + return s.str(); + } + +template<> +inline Hurricane::Record* getRecord + ( const Hurricane::Net::Direction::Code* object ) + { + Hurricane::Record* record = new Hurricane::Record(getString(object)); + record->add(getSlot("Code", (unsigned int*)object)); + return record; + } + + +INSPECTOR_P_SUPPORT(Hurricane::Net); +INSPECTOR_P_SUPPORT(Hurricane::Net::ComponentSet); +INSPECTOR_P_SUPPORT(Hurricane::Net::RubberSet); +INSPECTOR_PV_SUPPORT(Hurricane::Net::Type); +INSPECTOR_PV_SUPPORT(Hurricane::Net::Direction); +IOSTREAM_POINTER_SUPPORT(Hurricane::Net::Type::Code); +IOSTREAM_VALUE_SUPPORT(Hurricane::Net::Type::Code); +IOSTREAM_POINTER_SUPPORT(Hurricane::Net::Direction::Code); +IOSTREAM_VALUE_SUPPORT(Hurricane::Net::Direction::Code); + + +namespace Hurricane { + +// Force SlotTemplate<> expansion on Net* type. +// Because sometimes it didn't happens (?). + const SlotTemplate dummyNetSlot ( string("dummyNetSlot"), NULL ); + +} + +#endif // HURRICANE_NET + + +// **************************************************************************************************** +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved +// **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Backtrace.h b/hurricane/src/hurricane/hurricane/Backtrace.h index b1be9e94..506e985b 100644 --- a/hurricane/src/hurricane/hurricane/Backtrace.h +++ b/hurricane/src/hurricane/hurricane/Backtrace.h @@ -1,7 +1,7 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // diff --git a/hurricane/src/hurricane/hurricane/BasicLayer.h b/hurricane/src/hurricane/hurricane/BasicLayer.h index 4b56b99c..9b5ff5da 100644 --- a/hurricane/src/hurricane/hurricane/BasicLayer.h +++ b/hurricane/src/hurricane/hurricane/BasicLayer.h @@ -1,7 +1,7 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -42,6 +42,8 @@ namespace Hurricane { class BasicLayer : public Layer { + public: + typedef Layer Super; public: // Subclass: Material. @@ -66,6 +68,7 @@ namespace Hurricane { Material& operator= ( const Material& material ); inline operator const Code& () const; inline const Code& getCode () const; + static Material fromString ( const string& ); inline string _getTypeName () const; string _getString () const; Record* _getRecord () const; @@ -95,6 +98,7 @@ namespace Hurricane { inline void setExtractNumber ( unsigned int ); inline void setRealName ( const char* realName); // Hurricane Managment. + virtual void _toJson ( JsonWriter* writer ) const; virtual BasicLayer* _getSymbolicBasicLayer (); virtual string _getTypeName () const; virtual string _getString () const; @@ -135,6 +139,20 @@ namespace Hurricane { inline void BasicLayer::setRealName ( const char* realName) { _realName = realName; } +// ------------------------------------------------------------------- +// Class : "Hurricane::JsonBasicLayer". + + class JsonBasicLayer : public JsonLayer { + public: + static void initialize (); + JsonBasicLayer ( unsigned long flags ); + ~JsonBasicLayer (); + virtual string getTypeName () const; + virtual JsonBasicLayer* clone ( unsigned long ) const; + virtual void toData ( JsonStack& ); + }; + + } // End of Hurricane namespace. diff --git a/hurricane/src/hurricane/hurricane/BasicLayers.h b/hurricane/src/hurricane/hurricane/BasicLayers.h index fb719017..7ccee838 100644 --- a/hurricane/src/hurricane/hurricane/BasicLayers.h +++ b/hurricane/src/hurricane/hurricane/BasicLayers.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/BasicLayers.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -72,5 +72,5 @@ typedef GenericFilter BasicLayerFilter; // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Box.h b/hurricane/src/hurricane/hurricane/Box.h index e8b18f5f..b3f00072 100644 --- a/hurricane/src/hurricane/hurricane/Box.h +++ b/hurricane/src/hurricane/hurricane/Box.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Box.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -24,8 +24,6 @@ namespace Hurricane { - - // **************************************************************************************************** // Box declaration // **************************************************************************************************** @@ -36,7 +34,6 @@ class Box { // Attributes // ********** - private: DbU::Unit _xMin; private: DbU::Unit _yMin; private: DbU::Unit _xMax; @@ -125,10 +122,21 @@ class Box { public: string _getTypeName() const { return _TName("Box"); }; public: string _getString() const; public: Record* _getRecord() const; + public: void toJson(JsonWriter*) const; }; +class JsonBox : public JsonObject { +// ******************************** + + public: static void initialize(); + public: JsonBox(unsigned long); + public: virtual string getTypeName() const; + public: virtual JsonBox* clone(unsigned long) const; + public: virtual void toData(JsonStack&); +}; + } // End of Hurricane namespace. @@ -140,5 +148,5 @@ INSPECTOR_PV_SUPPORT(Hurricane::Box); // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Boxes.h b/hurricane/src/hurricane/hurricane/Boxes.h index 2f30cf1f..2619e2ae 100644 --- a/hurricane/src/hurricane/hurricane/Boxes.h +++ b/hurricane/src/hurricane/hurricane/Boxes.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Boxes.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -71,5 +71,5 @@ typedef GenericFilter BoxFilter; // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Bug.h b/hurricane/src/hurricane/hurricane/Bug.h index 9d0b0a13..e71095b6 100644 --- a/hurricane/src/hurricane/hurricane/Bug.h +++ b/hurricane/src/hurricane/hurricane/Bug.h @@ -1,7 +1,7 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -19,12 +19,7 @@ // License along with Hurricane. If not, see // . // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | H U R R I C A N E | // | V L S I B a c k e n d D a t a - B a s e | // | | @@ -32,14 +27,11 @@ // | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Header : "./hurricane/Bug.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ -# ifndef __HURRICANE_BUG__ -# define __HURRICANE_BUG__ +#ifndef HURRICANE_BUG_H +#define HURRICANE_BUG_H # include "hurricane/Exception.h" @@ -75,7 +67,7 @@ namespace Hurricane { inline int Bug::getCode () const { return _code; } -} // End of Hurricane namespace. +} // Hurricane namespace. GETSTRING_POINTER_SUPPORT(Hurricane::Bug); @@ -84,4 +76,4 @@ IOSTREAM_POINTER_SUPPORT(Hurricane::Bug); IOSTREAM_VALUE_SUPPORT(Hurricane::Bug); -# endif // __HURRICANE_BUG__ +#endif // HURRICANE_BUG_H diff --git a/hurricane/src/hurricane/hurricane/Cell.h b/hurricane/src/hurricane/hurricane/Cell.h index 9ef539dd..82d32077 100644 --- a/hurricane/src/hurricane/hurricane/Cell.h +++ b/hurricane/src/hurricane/hurricane/Cell.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Cell.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -23,6 +23,7 @@ #include #include "hurricane/Flags.h" #include "hurricane/Observer.h" +#include "hurricane/Signature.h" #include "hurricane/Relation.h" #include "hurricane/Pathes.h" #include "hurricane/Entity.h" @@ -54,7 +55,6 @@ namespace Hurricane { class Library; class BasicLayer; - typedef multimap SlaveEntityMap; @@ -84,15 +84,18 @@ class Cell : public Entity { // Flags set for Observers. , CellAboutToChange = 0x00000100 , CellChanged = 0x00000200 + , CellDestroyed = 0x00000400 // Cell states , Terminal = 0x00001000 , FlattenLeaf = 0x00002000 , Pad = 0x00004000 - , FlattenedNets = 0x00008000 - , Placed = 0x00010000 - , Routed = 0x00020000 - , MergedQuadTree = 0x00040000 - , Materialized = 0x00080000 + , Feed = 0x00008000 + , FlattenedNets = 0x00010000 + , Placed = 0x00020000 + , Routed = 0x00040000 + , MergedQuadTree = 0x00080000 + , SlavedAb = 0x00100000 + , Materialized = 0x00200000 }; public: @@ -109,15 +112,39 @@ class Cell : public Entity { virtual Name getName () const; static Name staticGetName (); Name getUniqueName (); + static std::string getTrunkName ( Name name ); + virtual bool hasJson () const; + virtual void toJson ( JsonWriter*, const DBo* ) const; + inline void _setOwner ( Cell* ); + inline void _setDuplicates ( unsigned int ); virtual string _getTypeName () const; virtual Record* _getRecord () const; private: static const Name _name; - unsigned int _duplicates; + unsigned int _duplicates; private: UniquifyRelation ( Cell* ); protected: virtual void _preDestroy (); + + public: + class JsonProperty : public JsonObject { + public: + static void initialize (); + JsonProperty ( unsigned long flags ); + virtual string getTypeName () const; + virtual JsonProperty* clone ( unsigned long ) const; + virtual void toData ( JsonStack& ); + }; + public: + class JsonPropertyRef : public JsonObject { + public: + static void initialize (); + JsonPropertyRef ( unsigned long flags ); + virtual string getTypeName () const; + virtual JsonPropertyRef* clone ( unsigned long ) const; + virtual void toData ( JsonStack& ); + }; }; class ClonedSet : public Collection { @@ -146,6 +173,70 @@ class Cell : public Entity { const Cell* _cell; }; + class SlavedsRelation : public Relation { + public: + static SlavedsRelation* create ( Cell* ); + static SlavedsRelation* get ( const Cell* ); + virtual Name getName () const; + static Name staticGetName (); + virtual bool hasJson () const; + virtual void toJson ( JsonWriter*, const DBo* ) const; + inline void _setOwner ( Cell* ); + virtual string _getTypeName () const; + virtual Record* _getRecord () const; + private: + static const Name _name; + private: + SlavedsRelation ( Cell* ); + protected: + virtual void _preDestroy (); + + public: + class JsonProperty : public JsonObject { + public: + static void initialize (); + JsonProperty ( unsigned long flags ); + virtual string getTypeName () const; + virtual JsonProperty* clone ( unsigned long ) const; + virtual void toData ( JsonStack& ); + }; + public: + class JsonPropertyRef : public JsonObject { + public: + static void initialize (); + JsonPropertyRef ( unsigned long flags ); + virtual string getTypeName () const; + virtual JsonPropertyRef* clone ( unsigned long ) const; + virtual void toData ( JsonStack& ); + }; + }; + + class SlavedsSet : public Collection { + public: + // Sub-Class: Locator. + class Locator : public Hurricane::Locator { + public: + Locator ( const Cell* ); + inline Locator ( const Locator& ); + virtual Cell* getElement () const; + virtual Hurricane::Locator* getClone () const; + virtual bool isValid () const; + virtual void progress (); + virtual string _getString () const; + protected: + Hurricane::Locator* _dboLocator; + }; + + public: + inline SlavedsSet ( const Cell* cell ); + inline SlavedsSet ( const SlavedsSet& ); + virtual Hurricane::Collection* getClone () const; + virtual Hurricane::Locator* getLocator () const; + virtual string _getString () const; + protected: + const Cell* _cell; + }; + class InstanceMap : public IntrusiveMap { // **************************************************** @@ -300,11 +391,16 @@ class Cell : public Entity { public: void _slaveAbutmentBox(Cell*); public: void _changeQuadTree(Cell*); public: void _setShuntedPath(Path path) { _shuntedPath=path; } + protected: void _setAbutmentBox(const Box& abutmentBox); + + public: virtual void _toJson(JsonWriter*) const; + public: virtual void _toJsonCollections(JsonWriter*) const; // Constructors // ************ public: static Cell* create(Library* library, const Name& name); + public: static Cell* fromJson(const string& filename); // Accessors // ********* @@ -312,9 +408,11 @@ class Cell : public Entity { public: virtual Cell* getCell() const {return (Cell*)this;}; public: virtual Box getBoundingBox() const; public: Library* getLibrary() const {return _library;}; + public: string getHierarchicalName() const; public: const Name& getName() const {return _name;}; public: const Flags& getFlags() const { return _flags; } public: Path getShuntedPath() const { return _shuntedPath; } + public: Entity* getEntity(const Signature&) const; public: Instance* getInstance(const Name& name) const {return _instanceMap.getElement(name);}; public: Instances getInstances() const {return _instanceMap.getElements();}; public: Instances getPlacedInstances() const; @@ -391,6 +489,7 @@ class Cell : public Entity { public: bool isUniquified() const; public: bool isUniquifyMaster() const; public: bool isPad() const {return _flags.isset(Flags::Pad);}; + public: bool isFeed() const {return _flags.isset(Flags::Feed);}; public: bool isFlattenedNets() const {return _flags.isset(Flags::FlattenedNets);}; public: bool isPlaced() const {return _flags.isset(Flags::Placed);}; public: bool isRouted() const {return _flags.isset(Flags::Routed);}; @@ -406,6 +505,7 @@ class Cell : public Entity { public: void setTerminal(bool isTerminal) {_flags.set(Flags::Terminal,isTerminal);}; public: void setFlattenLeaf(bool isFlattenLeaf) {_flags.set(Flags::FlattenLeaf,isFlattenLeaf);}; public: void setPad(bool isPad) {_flags.set(Flags::Pad,isPad);}; + public: void setFeed(bool isFeed) {_flags.set(Flags::Feed,isFeed);}; public: void flattenNets(unsigned int flags=Flags::BuildRings); public: void createRoutingPadRings(unsigned int flags=Flags::BuildRings); public: void setFlags(unsigned int flags) { _flags |= flags; } @@ -438,6 +538,39 @@ inline Cell::ClonedSet::ClonedSet ( const ClonedSet& other ) { } +inline void Cell::UniquifyRelation::_setOwner ( Cell* owner ) { _setMasterOwner(owner); } +inline void Cell::UniquifyRelation::_setDuplicates ( unsigned int duplicates ) { _duplicates=duplicates; } + + +inline Cell::SlavedsSet::Locator::Locator ( const Locator& other ) + : Hurricane::Locator() + , _dboLocator(other._dboLocator) +{ } + +inline Cell::SlavedsSet::SlavedsSet ( const Cell* cell ) + : Hurricane::Collection() + , _cell(cell) +{ } + +inline Cell::SlavedsSet::SlavedsSet ( const SlavedsSet& other ) + : Hurricane::Collection() + , _cell(other._cell) +{ } + + +inline void Cell::SlavedsRelation::_setOwner ( Cell* owner ) { _setMasterOwner(owner); } + + +class JsonCell : public JsonEntity { +// ********************************* + + public: static void initialize(); + public: JsonCell(unsigned long flags); + public: virtual string getTypeName() const; + public: virtual JsonCell* clone(unsigned long) const; + public: virtual void toData(JsonStack&); +}; + } // End of Hurricane namespace. @@ -455,5 +588,5 @@ INSPECTOR_P_SUPPORT(Hurricane::Cell::MarkerSet); // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Cells.h b/hurricane/src/hurricane/hurricane/Cells.h index 2f5e03b7..b302acb3 100644 --- a/hurricane/src/hurricane/hurricane/Cells.h +++ b/hurricane/src/hurricane/hurricane/Cells.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Cells.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -72,5 +72,5 @@ typedef GenericFilter CellFilter; // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Collection.h b/hurricane/src/hurricane/hurricane/Collection.h index 0064f0ab..a84bc090 100644 --- a/hurricane/src/hurricane/hurricane/Collection.h +++ b/hurricane/src/hurricane/hurricane/Collection.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Collection.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -27,6 +27,7 @@ namespace Hurricane { template class GenericCollection; template class SubTypeCollection; +template class NotSubTypeCollection; template class SubSetCollection; @@ -113,6 +114,12 @@ template class Collection { return getSubSet().getSubSet(filter); } + public: template GenericCollection getNotSubSet() const + // **************************************************************************** + { + return NotSubTypeCollection(this); + } + // Predicates // ********** @@ -627,6 +634,171 @@ template class SubTypeCollection : public Collection< }; +// **************************************************************************************************** +// NotSubTypeCollection declaration +// **************************************************************************************************** + +template class NotSubTypeCollection : public Collection { +// ****************************************************************************************** + +// Types +// ***** + + public: typedef Collection Inherit; + + public: class Locator : public Hurricane::Locator { + // ******************************************************* + + // Types + // ***** + + public: typedef Hurricane::Locator Inherit; + + // Attributes + // ********** + + private: GenericLocator _locator; + + // Constructors + // ************ + + public: Locator(const GenericCollection& collection) + // ******************************************************** + : Inherit(), + _locator(collection.getLocator()) + { + while (_locator.isValid() && dynamic_cast(_locator.getElement())) + _locator.progress(); + } + + public: Locator(const GenericLocator& genericLocator) + // ******************************************************** + : Inherit(), + _locator(genericLocator.getClone()) + { + while (_locator.isValid() && !dynamic_cast(_locator.getElement())) + _locator.progress(); + } + + // Accessors + // ********* + + public: virtual SubType getElement() const + // *************************************** + { + return (_locator.isValid()) ? (SubType)_locator.getElement() : SubType(); + } + + public: virtual Hurricane::Locator* getClone() const + // ********************************************************** + { + return new Locator(_locator); + } + + public: virtual Hurricane::Locator* getLocator() // 21-10-03 + // ************************************************* + { + return dynamic_cast*> ( + _locator.getLocator()->getLocator() ); + } + + + // Predicates + // ********** + + public: virtual bool isValid() const + // ********************************* + { + return _locator.isValid(); + } + + // Updators + // ******** + + public: virtual void progress() + // **************************** + { + if (_locator.isValid()) { + do { + _locator.progress(); + } while (_locator.isValid() && !dynamic_cast(_locator.getElement())); + } + } + + }; + +// Attributes +// ********** + + private: GenericCollection _collection; + +// Constructors +// ************ + + public: NotSubTypeCollection() + // ******************** + : Inherit(), + _collection() + { + } + + public: NotSubTypeCollection(const Collection* collection) + // ********************************************************** + : Inherit(), + _collection(collection->getClone()) + { + } + + public: NotSubTypeCollection(const GenericCollection& collection) + // ***************************************************************** + : Inherit(), + _collection(collection) + { + } + + public: NotSubTypeCollection(const NotSubTypeCollection& subTypeCollection) + // ****************************************************************** + : Inherit(), + _collection(subTypeCollection._collection) + { + } + +// Operators +// ********* + + public: NotSubTypeCollection& operator=(const NotSubTypeCollection& subTypeCollection) + // ***************************************************************************** + { + _collection = subTypeCollection._collection; + return *this; + } + +// Accessors +// ********* + + public: virtual Collection* getClone() const + // ************************************************** + { + return new NotSubTypeCollection(_collection); + } + + public: virtual Hurricane::Locator* getLocator() const + // ************************************************************ + { + return new Locator(_collection); + } + +// Accessors +// ********* + + public: virtual string _getString() const + // ************************************** + { + return "<" + _TName("NotSubTypeCollection") + " " + getString(_collection) + ">"; + } + +}; + // **************************************************************************************************** // SubSetCollection implementation @@ -909,7 +1081,6 @@ inline ForEachIterator& ForEachIterator::operator++ (int) for ( ForEachIterator iterator(collection); iterator.isValid() ; iterator++ ) - } // End of Hurricane namespace. @@ -932,6 +1103,23 @@ template inline Hurricane::Record* getRecord ( const Hurricane::C { return collection->_getRecord(); } +template +inline void jsonWrite ( JsonWriter* w, const std::string& key, Hurricane::GenericCollection collection ) +{ + if (cdebug.enabled(19)) + cdebug.log(19) << "jsonWrite< GenericCollection<" << Hurricane::demangle(typeid(Type).name()) + << "> >(w,key,coll)" << " key:\"" << key << "\"" << std::endl; + cdebug.tabw(19,1); + + w->key( key ); + w->startArray(); + for ( Type element : collection ) jsonWrite( w, element ); + w->endArray(); + + cdebug.tabw(19,-1); +} + + #include "hurricane/MultisetCollection.h" #include "hurricane/SetCollection.h" #include "hurricane/MapCollection.h" @@ -946,5 +1134,5 @@ template inline Hurricane::Record* getRecord ( const Hurricane::C // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Commons.h b/hurricane/src/hurricane/hurricane/Commons.h index 9825b625..c91ed20f 100644 --- a/hurricane/src/hurricane/hurricane/Commons.h +++ b/hurricane/src/hurricane/hurricane/Commons.h @@ -1,7 +1,6 @@ - // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -19,10 +18,6 @@ // License along with Hurricane. If not, see // . // -// =================================================================== -// -// $Id$ -// // +-----------------------------------------------------------------+ // | H U R R I C A N E | // | V L S I B a c k e n d D a t a - B a s e | @@ -64,28 +59,6 @@ namespace Hurricane { class Slot; - // +-------------------------------------------------------------+ - // | Tracing/Debugging Utilites | - // +-------------------------------------------------------------+ - - - bool in_trace (); - void trace_on (); - void trace_off (); - void trace_in (); - void trace_out (); - bool inltrace ( unsigned int level ); - unsigned int ltracelevel (); - unsigned int ltracelevel ( unsigned int level ); - void ltracein ( unsigned int level, unsigned int count=1 ); - void ltraceout ( unsigned int level, unsigned int count=1 ); - -#define trace if (in_trace() ) cerr << tab -#define ltrace(level) if (inltrace(level)) cerr << tab - - - - // +-------------------------------------------------------------+ // | shared_ptr<> support for DBo | // +-------------------------------------------------------------+ @@ -121,6 +94,13 @@ namespace Hurricane { string demangle ( const char* symbol ); inline string demangle ( const type_info& info ) { return demangle(info.name()); } + template + inline void erase_element ( vector& v, const Element* e ) + { + for ( auto ielement = v.begin() ; ielement != v.end() ; ++ielement ) + if (*ielement == e) { v.erase( ielement ); return; } + } + #if DEPRECATED // For a complete explanation of this function, please look at : @@ -322,7 +302,7 @@ inline Hurricane::Record* getRecord ( std::vector* v ) Hurricane::Record* record = NULL; if ( !v->empty() ) { record = new Hurricane::Record ( "std::vector" ); - unsigned n = 1; + unsigned n = 0; typename std::vector::iterator iterator = v->begin(); while ( iterator != v->end() ) { record->add ( getSlot(getString(n++), *iterator) ); @@ -347,7 +327,7 @@ inline Hurricane::Record* getRecord ( const std::vector* v ) Hurricane::Record* record = NULL; if ( !v->empty() ) { record = new Hurricane::Record ( "const std::vector" ); - unsigned n = 1; + unsigned n = 0; typename std::vector::const_iterator iterator = v->begin(); while ( iterator != v->end() ) { record->add ( getSlot(getString(n++), *iterator) ); @@ -733,13 +713,116 @@ inline Hurricane::Record* getRecord ( const std::multiset* s ) IOSTREAM_VALUE_SUPPORT(Data) +#include "hurricane/Tabulation.h" + + +// ------------------------------------------------------------------- +// Class : "::cdebug()". +// +// Wrapper around the STL ostream which to print debugging messages. + +class tstream : public std::ostream { + public: + inline int getMinLevel () const; + inline int getMaxLevel () const; + inline int setMinLevel ( int ); + inline int setMaxLevel ( int ); + inline int getLevel () const; + inline int setLevel ( int ); + inline bool enabled () const; + inline bool enabled ( int ) const; + inline tstream& log ( int level, int count=0 ); + inline tstream& tabw ( int level, int count ); + inline tstream ( std::ostream & ); + private: + inline tstream& _tab (); + inline tstream& _tabw ( int count ); + public: + // Overload for formatted outputs. + //template inline tstream& operator<< ( T t ); + template inline tstream& operator<< ( T* t ); + template inline tstream& operator<< ( const T t ); + template inline tstream& operator<< ( const T* t ); + inline tstream& put ( char c ); + inline tstream& flush (); + // Overload for manipulators. + inline tstream &operator<< ( std::ostream &(*pf)(std::ostream &) ); + private: + int _minLevel; + int _maxLevel; + int _level; + Hurricane::Tabulation _tabulation; +}; + + +inline tstream::tstream ( std::ostream& s ) + : std::ostream(s.rdbuf()) + , _minLevel(0) + , _maxLevel(0) + , _level(0) + , _tabulation(" ") +{ } + +inline int tstream::getMinLevel () const { return _minLevel; } +inline int tstream::getMaxLevel () const { return _maxLevel; } +inline int tstream::setMinLevel ( int l ) { int pl=_minLevel; _minLevel=l; return pl; } +inline int tstream::setMaxLevel ( int l ) { int pl=_maxLevel; _maxLevel=l; return pl; } +inline int tstream::getLevel () const { return _level; } +inline int tstream::setLevel ( int l ) { int pl=_level; _level=l; return pl; } +inline bool tstream::enabled () const { return (_level >= _minLevel) and (_level < _maxLevel); } +inline bool tstream::enabled ( int l ) const { return (l >= _minLevel) and (l < _maxLevel); } +inline tstream& tstream::tabw ( int level, int count ) { setLevel(level); return _tabw(count); } +inline tstream& tstream::put ( char c ) { if (enabled()) static_cast(this)->put(c); return *this; } +inline tstream& tstream::flush () { if (enabled()) static_cast(this)->flush(); return *this; } +inline tstream& tstream::operator<< ( std::ostream& (*pf)(std::ostream&) ) { if (enabled()) (*pf)(*this); return *this; } + + +inline tstream& tstream::_tab () { if (enabled()) (*this) << _tabulation; return *this; } +inline tstream& tstream::_tabw ( int count ) +{ + if (enabled()) { + if (count > 0) while(count--) _tabulation++; + else if (count < 0) while(count++) _tabulation--; + } + return *this; +} + +inline tstream& tstream::log ( int level, int count ) +{ setLevel(level); _tab(); return _tabw(count); } + +// For POD Types. +// template +// inline tstream& tstream::operator<< ( T& t ) +// { if (enabled()) { *(static_cast(this)) << t; } return *this; }; + +template +inline tstream& tstream::operator<< ( T* t ) +{ if (enabled()) { *(static_cast(this)) << t; } return *this; }; + +template +inline tstream& tstream::operator<< ( const T t ) +{ if (enabled()) { *(static_cast(this)) << t; } return *this; }; + +template +inline tstream& tstream::operator<< ( const T* t ) +{ if (enabled()) { *(static_cast(this)) << t; } return *this; }; + +// For STL Types. +inline tstream& operator<< ( tstream& o, const std::string& s ) +{ if (o.enabled()) { static_cast(o) << s; } return o; }; + + +extern tstream cdebug; + // x-----------------------------------------------------------------x // | Classes Neededs in All Hurricane Modules | // x-----------------------------------------------------------------x #include "hurricane/Slot.h" -#include "hurricane/Tabulation.h" +#include "hurricane/Initializer.h" +#include "hurricane/JsonWriter.h" +#include "hurricane/JsonObject.h" #endif // HURRICANE_COMMONS_H diff --git a/hurricane/src/hurricane/hurricane/Component.h b/hurricane/src/hurricane/hurricane/Component.h index 232b1e1d..f55b9051 100644 --- a/hurricane/src/hurricane/hurricane/Component.h +++ b/hurricane/src/hurricane/hurricane/Component.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Component.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -33,7 +33,6 @@ class Rubber; class Layer; - // **************************************************************************************************** // Component declaration // **************************************************************************************************** @@ -59,8 +58,9 @@ class Component : public Go { public: virtual bool isMaster() const {return true;}; - public: virtual string _getTypeName() const { return _TName("Component::BodyHook"); }; + public: virtual string _getTypeName() const { return "Component::BodyHook"; }; public: virtual string _getString() const; + public: static Hook* _compToHook(Component*); }; @@ -101,6 +101,7 @@ class Component : public Go { public: virtual void materialize(); public: virtual void unmaterialize(); public: virtual void invalidate(bool propagateFlag = true); + public: virtual void forceId(unsigned int id); // Filters // ******* @@ -114,6 +115,8 @@ class Component : public Go { protected: virtual void _preDestroy(); + public: virtual void _toJson ( JsonWriter* ) const; + public: virtual void _toJsonSignature(JsonWriter*) const; public: virtual string _getString() const; public: virtual Record* _getRecord() const; public: Component* _getNextOfNetComponentSet() const {return _nextOfNetComponentSet;}; @@ -128,6 +131,12 @@ class Component : public Go { double getArea ( Component* component ); +class JsonComponent : public JsonEntity { +// ************************************ + + public: JsonComponent(unsigned long flags); +}; + } // End of Hurricane namespace. @@ -140,5 +149,5 @@ INSPECTOR_P_SUPPORT(Hurricane::Component::BodyHook); // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Components.h b/hurricane/src/hurricane/hurricane/Components.h index c57c2bf5..1cc2a01f 100644 --- a/hurricane/src/hurricane/hurricane/Components.h +++ b/hurricane/src/hurricane/hurricane/Components.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Components.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -72,5 +72,5 @@ typedef GenericFilter ComponentFilter; // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Contact.h b/hurricane/src/hurricane/hurricane/Contact.h index 942c5b29..619c616f 100644 --- a/hurricane/src/hurricane/hurricane/Contact.h +++ b/hurricane/src/hurricane/hurricane/Contact.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Contact.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -26,7 +26,6 @@ namespace Hurricane { - // **************************************************************************************************** // Contact declaration // **************************************************************************************************** @@ -52,8 +51,9 @@ class Contact : public Component { public: virtual bool isMaster() const {return false;}; - public: virtual string _getTypeName() const { return _TName("Contact::AnchorHook"); }; + public: virtual string _getTypeName() const { return "Contact::AnchorHook"; }; public: virtual string _getString() const; + public: static Hook* _compToHook(Component*); }; // Attributes @@ -141,6 +141,7 @@ class Contact : public Component { protected: virtual void _preDestroy(); + public: virtual void _toJson(JsonWriter*) const; public: virtual string _getTypeName() const {return _TName("Contact");}; public: virtual string _getString() const; public: virtual Record* _getRecord() const; @@ -148,6 +149,16 @@ class Contact : public Component { }; +class JsonContact : public JsonComponent { +// *************************************** + + public: static void initialize(); + public: JsonContact(unsigned long flags); + public: virtual string getTypeName() const; + public: virtual JsonContact* clone(unsigned long) const; + public: virtual void toData(JsonStack&); +}; + } // End of Hurricane namespace. @@ -159,5 +170,5 @@ INSPECTOR_P_SUPPORT(Hurricane::Contact::AnchorHook); // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/ContactLayer.h b/hurricane/src/hurricane/hurricane/ContactLayer.h index 493f42ec..f97e841a 100644 --- a/hurricane/src/hurricane/hurricane/ContactLayer.h +++ b/hurricane/src/hurricane/hurricane/ContactLayer.h @@ -1,7 +1,6 @@ - // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -19,12 +18,7 @@ // License along with Hurricane. If not, see // . // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | H U R R I C A N E | // | V L S I B a c k e n d D a t a - B a s e | // | | @@ -32,14 +26,11 @@ // | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Header : "./hurricane/ContactLayer.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ -#ifndef __HURRICANE_CONTACT_LAYER__ -#define __HURRICANE_CONTACT_LAYER__ +#ifndef HURRICANE_CONTACT_LAYER_H +#define HURRICANE_CONTACT_LAYER_H #include @@ -49,7 +40,12 @@ namespace Hurricane { +// ------------------------------------------------------------------- +// Class : "Hurricane::ContactLayer". + class ContactLayer : public Layer { + public: + typedef Layer Super; public: // Constructor. @@ -68,6 +64,7 @@ namespace Hurricane { // Updators. virtual void setEnclosure ( const BasicLayer* layer, DbU::Unit enclosure ); // Hurricane Managment. + virtual void _toJson ( JsonWriter* ) const; virtual void _onDbuChange ( float scale ); virtual string _getTypeName () const; virtual string _getString () const; @@ -91,6 +88,20 @@ namespace Hurricane { }; +// ------------------------------------------------------------------- +// Class : "Hurricane::JsonContactLayer". + + class JsonContactLayer : public JsonLayer { + public: + static void initialize (); + JsonContactLayer ( unsigned long flags ); + ~JsonContactLayer (); + virtual string getTypeName () const; + virtual JsonContactLayer* clone ( unsigned long ) const; + virtual void toData ( JsonStack& ); + }; + + } // End of Hurricane namespace. diff --git a/hurricane/src/hurricane/hurricane/Contacts.h b/hurricane/src/hurricane/hurricane/Contacts.h index b753d18f..c387d84c 100644 --- a/hurricane/src/hurricane/hurricane/Contacts.h +++ b/hurricane/src/hurricane/hurricane/Contacts.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Contacts.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -72,5 +72,5 @@ typedef GenericFilter ContactFilter; // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/DBo.h b/hurricane/src/hurricane/hurricane/DBo.h index 197ae473..5361d76e 100644 --- a/hurricane/src/hurricane/hurricane/DBo.h +++ b/hurricane/src/hurricane/hurricane/DBo.h @@ -1,7 +1,6 @@ - // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -19,12 +18,7 @@ // License along with Hurricane. If not, see // . // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | H U R R I C A N E | // | V L S I B a c k e n d D a t a - B a s e | // | | @@ -32,14 +26,11 @@ // | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Header : "./hurricane/DBo.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ -#ifndef __HURRICANE_DBO__ -#define __HURRICANE_DBO__ +#ifndef HURRICANE_DBO_H +#define HURRICANE_DBO_H #include "hurricane/DBos.h" #include "hurricane/Name.h" @@ -52,40 +43,39 @@ namespace Hurricane { // ------------------------------------------------------------------- // Class : "Hurricane::DBo". - class DBo { - public: - // Methods. - virtual void destroy(); - inline set& _getPropertySet (); - void _onDestroyed ( Property* property ); - Property* getProperty ( const Name& ) const; - Properties getProperties () const; - inline bool hasProperty () const; - void put ( Property* ); - void remove ( Property* ); - void removeProperty ( const Name& ); - void clearProperties (); - // Hurricane Managment. - virtual string _getTypeName () const; - virtual string _getString () const; - virtual Record* _getRecord () const; - - private: - // Internal: Attributes. - mutable set _propertySet; - - protected: - // Internal: Constructors & Destructors. - DBo (); - virtual ~DBo (); - virtual void _postCreate (); - virtual void _preDestroy (); - private: - // Forbidden: Copies. - DBo ( const DBo& ); - DBo& operator= ( const DBo& ); + virtual void destroy (); + inline set& _getPropertySet (); + void _onDestroyed ( Property* property ); + Property* getProperty ( const Name& ) const; + Properties getProperties () const; + inline bool hasProperty () const; + void put ( Property* ); + void remove ( Property* ); + void removeProperty ( const Name& ); + void clearProperties (); + virtual string _getTypeName () const; + virtual string _getString () const; + virtual Record* _getRecord () const; + virtual void _toJson ( JsonWriter* ) const; + virtual void _toJsonCollections ( JsonWriter* ) const; + virtual void _toJsonSignature ( JsonWriter* ) const; + void toJson ( JsonWriter* ) const; + void toJsonSignature ( JsonWriter* ) const; + + private: + mutable set _propertySet; + + protected: + DBo (); + virtual ~DBo (); + virtual void _postCreate (); + virtual void _preDestroy (); + + private: + DBo ( const DBo& ); + DBo& operator= ( const DBo& ); }; @@ -94,10 +84,25 @@ namespace Hurricane { inline bool DBo::hasProperty () const { return !_propertySet.empty(); } -} // End of Hurricane namespace. +// ------------------------------------------------------------------- +// Class : "Hurricane::JsonDBo". + class JsonDBo : public JsonObject { + public: + JsonDBo ( unsigned int flags ); + template inline void update ( JsonStack&, T ); + }; + + + template inline void JsonDBo::update ( JsonStack& stack, T hobject ) + { + JsonObject::update( stack, hobject ); + stack.push_back_dbo( dynamic_cast(hobject) ); + } + + +} // Hurricane namespace. INSPECTOR_P_SUPPORT(Hurricane::DBo); - -#endif // __HURRICANE_DBO__ +#endif // HURRICANE_DBO_H diff --git a/hurricane/src/hurricane/hurricane/DBos.h b/hurricane/src/hurricane/hurricane/DBos.h index d6c2b31f..d23781a3 100644 --- a/hurricane/src/hurricane/hurricane/DBos.h +++ b/hurricane/src/hurricane/hurricane/DBos.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/DBos.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -72,5 +72,5 @@ typedef GenericFilter DBoFilter; // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/DRCError.h b/hurricane/src/hurricane/hurricane/DRCError.h index 8d67bac6..edd721b6 100644 --- a/hurricane/src/hurricane/hurricane/DRCError.h +++ b/hurricane/src/hurricane/hurricane/DRCError.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/DRCError.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -78,5 +78,5 @@ class DRCError : public Marker { // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/DataBase.h b/hurricane/src/hurricane/hurricane/DataBase.h index 81054082..bbdf9337 100644 --- a/hurricane/src/hurricane/hurricane/DataBase.h +++ b/hurricane/src/hurricane/hurricane/DataBase.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/DataBase.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -20,11 +20,14 @@ #ifndef HURRICANE_DATA_BASE #define HURRICANE_DATA_BASE +#include +#include #include "hurricane/DBo.h" #include "hurricane/DbU.h" namespace Hurricane { +class Cell; class Library; class Technology; @@ -37,12 +40,13 @@ class Technology; class DataBase : public DBo { // ************************ -# if !defined(__DOXYGEN_PROCESSOR__) - // Types // ***** - public: typedef DBo Inherit; + public: typedef DBo Inherit; + public: enum Flags { NoFlags = 0 + , CreateLib =(1<<0) + , WarnCreateLib=(1<<2) }; // Attributes // ********** @@ -50,6 +54,7 @@ class DataBase : public DBo { private: static DataBase* _db; private: Technology* _technology; private: Library* _rootLibrary; + private: function _cellLoader; // Constructors // ************ @@ -63,14 +68,14 @@ class DataBase : public DBo { protected: virtual void _preDestroy(); + public: virtual void _toJson(JsonWriter*) const; public: virtual string _getTypeName() const {return _TName("DataBase");}; public: virtual string _getString() const; public: virtual Record* _getRecord() const; public: void _setTechnology(Technology* technology) {_technology = technology;}; public: void _setRootLibrary(Library* rootLibrary) {_rootLibrary = rootLibrary;}; - -# endif + public: void _setCellLoader(function loader) { _cellLoader=loader; }; public: static DataBase* create(); @@ -79,10 +84,29 @@ class DataBase : public DBo { public: Technology* getTechnology() const {return _technology;}; public: Library* getRootLibrary() const {return _rootLibrary;}; + public: Library* getLibrary(string,unsigned int flags); + public: Cell* getCell(string, unsigned int flags); public: static DataBase* getDB(); }; + + +// **************************************************************************************************** +// JsonDataBase declaration +// **************************************************************************************************** + +class JsonDataBase : public JsonDBo { +// ******************************** + + public: static void initialize(); + public: JsonDataBase(unsigned long flags); + public: virtual string getTypeName() const; + public: virtual JsonDataBase* clone(unsigned long) const; + public: virtual void toData(JsonStack&); +}; + + } // End of Hurricane namespace. @@ -93,5 +117,5 @@ INSPECTOR_P_SUPPORT(Hurricane::DataBase); // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/DbU.h b/hurricane/src/hurricane/hurricane/DbU.h index 11b03828..a209f341 100644 --- a/hurricane/src/hurricane/hurricane/DbU.h +++ b/hurricane/src/hurricane/hurricane/DbU.h @@ -1,6 +1,6 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -42,26 +42,28 @@ namespace Hurricane { class DbU { public: - enum UnitPower { Pico = 1 - , Nano - , Micro - , Milli - , Unity - , Kilo - }; + enum FunctionFlags { NoFlags = 0 + , NoTechnoUpdate = (1<<0) + }; + enum UnitPower { Pico = 1 + , Nano + , Micro + , Milli + , Unity + , Kilo + }; + enum StringMode { Db = (1<<0) + , Grid = (1<<1) + , Symbolic = (1<<2) + , Physical = (1<<3) + , SmartTruncate = (1<<4) + }; + enum SnapMode { Inferior = 1 + , Superior = 2 + , Nearest = 4 + }; public: typedef long Unit; - public: - enum StringMode { Db = (1<<0) - , Grid = (1<<1) - , Symbolic = (1<<2) - , Physical = (1<<3) - , SmartTruncate = (1<<4) - }; - enum SnapMode { Inferior = 1 - , Superior = 2 - , Nearest = 4 - }; public: static void checkGridBound ( double value ); @@ -81,14 +83,14 @@ namespace Hurricane { static unsigned int getPrecision (); static unsigned int getMaximalPrecision (); static double getResolution (); - static void setPrecision ( unsigned int precision ); + static void setPrecision ( unsigned int precision, unsigned int flags=NoFlags ); // Founder Grid Managment. static double getUnitPower ( UnitPower p ); static void setPhysicalsPerGrid ( double gridsPerLambda, UnitPower p ); static double getPhysicalsPerGrid (); static double physicalToGrid ( double physical, UnitPower p ); // Lamba Managment. - static void setGridsPerLambda ( double gridsPerLambda ); + static void setGridsPerLambda ( double gridsPerLambda, unsigned int flags=NoFlags ); static double getGridsPerLambda (); // Snap Grid Managment. static DbU::Unit getRealSnapGridStep (); @@ -180,4 +182,8 @@ namespace Hurricane { } // End of Hurricane namespace. +// inline void jsonWriteDbU ( JsonWriter* w, const std::string& key, long* value ) +// { w->key( key ); w->write( value ); } + + #endif // HURRICANE_DBU_H diff --git a/hurricane/src/hurricane/hurricane/DebugSession.h b/hurricane/src/hurricane/hurricane/DebugSession.h index 51208e7f..2b87579e 100644 --- a/hurricane/src/hurricane/hurricane/DebugSession.h +++ b/hurricane/src/hurricane/hurricane/DebugSession.h @@ -1,6 +1,6 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -43,6 +43,8 @@ namespace Hurricane { class Net; class Cell; + using std::pair; + using std::make_pair; using std::set; using std::stack; @@ -61,8 +63,8 @@ namespace Hurricane { static inline void addToTrace ( const void* symbol ); static inline void addToTrace ( const Cell*, const Name& ); static inline void addToTrace ( const Net* ); - static inline void open ( unsigned int traceLevel ); - static inline void open ( const void* symbol, unsigned int traceLevel=80 ); + static inline void open ( int minLevel, int maxLevel ); + static inline void open ( const void* symbol, int minLevel, int maxLevel ); static inline void close (); // Singleton Access. inline bool _isTraced ( const void* symbol ) const; @@ -76,9 +78,9 @@ namespace Hurricane { protected: // Internal: Attributes. - static DebugSession* _singleton; - set _symbols; - stack _levels; + static DebugSession* _singleton; + set _symbols; + stack< pair > _levels; protected: // Internal: Constructor & Destructor. @@ -92,18 +94,21 @@ namespace Hurricane { // Inline Functions. - void DebugSession::open ( unsigned int traceLevel ) + void DebugSession::open ( int minLevel, int maxLevel ) { - _singleton->_levels.push ( ltracelevel(traceLevel) ); + _singleton->_levels.push( make_pair( cdebug.setMinLevel(minLevel) + , cdebug.setMaxLevel(maxLevel) ) ); } - void DebugSession::open ( const void* symbol, unsigned int traceLevel ) + void DebugSession::open ( const void* symbol, int minLevel, int maxLevel ) { if ( _singleton->_isTraced(symbol) ) - _singleton->_levels.push ( ltracelevel(traceLevel) ); + _singleton->_levels.push( make_pair( cdebug.setMinLevel(minLevel) + , cdebug.setMaxLevel(maxLevel) ) ); else { - _singleton->_levels.push ( ltracelevel() ); + _singleton->_levels.push ( make_pair( cdebug.getMinLevel() + , cdebug.getMaxLevel() ) ); } } @@ -111,7 +116,8 @@ namespace Hurricane { void DebugSession::close () { if ( not _singleton->_levels.empty() ) { - ltracelevel ( _singleton->_levels.top() ); + cdebug.setMinLevel( _singleton->_levels.top().first ); + cdebug.setMaxLevel( _singleton->_levels.top().second ); _singleton->_levels.pop (); } } diff --git a/hurricane/src/hurricane/hurricane/DeepNet.h b/hurricane/src/hurricane/hurricane/DeepNet.h index e41c0d0a..6878e07d 100644 --- a/hurricane/src/hurricane/hurricane/DeepNet.h +++ b/hurricane/src/hurricane/hurricane/DeepNet.h @@ -1,6 +1,6 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -36,45 +36,48 @@ #include "hurricane/HyperNet.h" #include "hurricane/Occurrence.h" - namespace Hurricane { - class DeepNet : public Net { - // Attributes. +// ------------------------------------------------------------------- +// Class : "DeepNet". + + class DeepNet : public Net { + public: + typedef Net Inherit; + public: + static DeepNet* create ( HyperNet& hyperNet ); + inline Occurrence getRootNetOccurrence () const; + virtual bool isDeepNet () const { return true; }; + size_t _createRoutingPads ( unsigned int flags=0 ); + virtual Record* _getRecord () const; + virtual string _getTypeName () const { return "DeepNet"; }; + virtual void _toJson ( JsonWriter* ) const; + protected: + DeepNet ( Occurrence& netOccurrence ); protected: Occurrence _netOccurrence; - // Constructors. - protected: - DeepNet ( Occurrence& netOccurrence ); + }; - // Inspector Management. + + inline Occurrence DeepNet::getRootNetOccurrence() const { return _netOccurrence; } + + Net* getDeepNet(HyperNet& hyperNet); + + +// ------------------------------------------------------------------- +// Class : "JsonDeepNet". + + class JsonDeepNet : public JsonNet { public: - virtual Record* _getRecord () const; - virtual string _getTypeName() const { return "DeepNet"; }; - - // Constructors. - public: - static DeepNet* create ( HyperNet& hyperNet ); - - // Accessors. - public: - inline Occurrence getRootNetOccurrence () const; - - // Predicates. - public: - virtual bool isDeepNet () const { return true; }; - - // Internal Modifiers. - public: - size_t _createRoutingPads ( unsigned int flags=0 ); - -}; - -inline Occurrence DeepNet::getRootNetOccurrence() const { return _netOccurrence; } - -Net* getDeepNet(HyperNet& hyperNet); + static void initialize (); + JsonDeepNet ( unsigned long flags ); + virtual ~JsonDeepNet (); + virtual string getTypeName () const; + virtual JsonDeepNet* clone ( unsigned long ) const; + virtual void toData ( JsonStack&); + }; } // Hurricane namespace. diff --git a/hurricane/src/hurricane/hurricane/DiffusionLayer.h b/hurricane/src/hurricane/hurricane/DiffusionLayer.h index c2ded2d5..b0c3e1b6 100644 --- a/hurricane/src/hurricane/hurricane/DiffusionLayer.h +++ b/hurricane/src/hurricane/hurricane/DiffusionLayer.h @@ -1,7 +1,6 @@ - // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -19,12 +18,7 @@ // License along with Hurricane. If not, see // . // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | H U R R I C A N E | // | V L S I B a c k e n d D a t a - B a s e | // | | @@ -32,14 +26,11 @@ // | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Header : "./hurricane/DiffusionLayer.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ -#ifndef __HURRICANE_DIFFUSION_LAYER__ -#define __HURRICANE_DIFFUSION_LAYER__ +#ifndef HURRICANE_DIFFUSION_LAYER_H +#define HURRICANE_DIFFUSION_LAYER_H #include @@ -48,8 +39,12 @@ namespace Hurricane { +// ------------------------------------------------------------------- +// Class : "Hurricane::DiffusionLayer". class DiffusionLayer : public Layer { + public: + typedef Layer Super; public: // Constructor. @@ -69,6 +64,7 @@ namespace Hurricane { virtual void setExtentionCap ( const BasicLayer* layer, DbU::Unit cap ); virtual void setExtentionWidth ( const BasicLayer* layer, DbU::Unit width ); // Hurricane Managment. + virtual void _toJson ( JsonWriter* ) const; virtual void _onDbuChange ( float scale ); virtual string _getTypeName () const; virtual string _getString () const; @@ -93,10 +89,24 @@ namespace Hurricane { }; +// ------------------------------------------------------------------- +// Class : "Hurricane::JsonDiffusionLayer". + + class JsonDiffusionLayer : public JsonLayer { + public: + static void initialize (); + JsonDiffusionLayer ( unsigned long flags ); + ~JsonDiffusionLayer (); + virtual string getTypeName () const; + virtual JsonDiffusionLayer* clone ( unsigned long ) const; + virtual void toData ( JsonStack& ); + }; + + } // End of Hurricane namespace. INSPECTOR_P_SUPPORT(Hurricane::DiffusionLayer); -# endif +#endif diff --git a/hurricane/src/hurricane/hurricane/Entities.h b/hurricane/src/hurricane/hurricane/Entities.h index 90923728..950b820d 100644 --- a/hurricane/src/hurricane/hurricane/Entities.h +++ b/hurricane/src/hurricane/hurricane/Entities.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Entities.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -72,5 +72,5 @@ typedef GenericFilter EntityFilter; // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Entity.h b/hurricane/src/hurricane/hurricane/Entity.h index b3c5679f..979bd430 100644 --- a/hurricane/src/hurricane/hurricane/Entity.h +++ b/hurricane/src/hurricane/hurricane/Entity.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Entity.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -35,26 +35,38 @@ namespace Hurricane { // ------------------------------------------------------------------- // Class : "Hurricane::Entity". - class Entity : public DBo { public: typedef DBo Inherit; public: - static unsigned int getIdCounter (); + enum EntityFlags { ForcedIdMode = (1<<0) + , NextIdSet = (1<<1) + }; public: - inline unsigned int getId () const; - virtual Cell* getCell () const = 0; - virtual Box getBoundingBox() const = 0; - virtual string _getString () const; - virtual Record* _getRecord () const; - Quark* _getQuark ( SharedPath* sharedPath = NULL ) const; - protected: - Entity (); - virtual void _preDestroy (); + static unsigned int getIdCounter (); + unsigned int getNextId (); + static void setNextId ( unsigned int ); + static bool inForcedIdMode (); + static void enableForcedIdMode (); + static void disableForcedIdMode (); + public: + inline unsigned int getId () const; + virtual Cell* getCell () const = 0; + virtual Box getBoundingBox () const = 0; + void setId ( unsigned int ); + virtual void _toJson ( JsonWriter* ) const; + virtual string _getString () const; + virtual Record* _getRecord () const; + Quark* _getQuark ( SharedPath* sharedPath = NULL ) const; + protected: + Entity (); + virtual void _preDestroy (); private: - static unsigned int _idCounter; - unsigned int _id; + static unsigned long _flags; + static unsigned int _nextId; + static unsigned int _idCounter; + unsigned int _id; public: struct CompareById : public std::binary_function { @@ -68,6 +80,38 @@ namespace Hurricane { { return ((lhs)?lhs->getId():0) < ((rhs)?rhs->getId():0); } +// ------------------------------------------------------------------- +// Class : "Hurricane::JsonEntity". + + class JsonEntity : public JsonDBo { + public: + JsonEntity ( unsigned long flags ); + template inline void update ( JsonStack&, T ); + }; + + + template inline void JsonEntity::update ( JsonStack& stack, T hobject ) + { + unsigned int jsonId = get(stack,"_id"); + + JsonDBo::update( stack, hobject ); + stack.addEntity( jsonId, hobject ); + } + + +// ------------------------------------------------------------------- +// Class : "JsonEntityRef". + + class JsonEntityRef : public JsonObject { + public: + static void initialize (); + JsonEntityRef ( unsigned long flags ); + virtual string getTypeName () const; + virtual JsonEntityRef* clone ( unsigned long ) const; + virtual void toData ( JsonStack& ); + }; + + } // Hurricane namespace. @@ -77,5 +121,5 @@ INSPECTOR_P_SUPPORT(Hurricane::Entity); #endif // HURRICANE_ENTITY // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Error.h b/hurricane/src/hurricane/hurricane/Error.h index 61f701f4..e675ff0e 100644 --- a/hurricane/src/hurricane/hurricane/Error.h +++ b/hurricane/src/hurricane/hurricane/Error.h @@ -1,7 +1,7 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // diff --git a/hurricane/src/hurricane/hurricane/Exception.h b/hurricane/src/hurricane/hurricane/Exception.h index 34ab618d..ed323436 100644 --- a/hurricane/src/hurricane/hurricane/Exception.h +++ b/hurricane/src/hurricane/hurricane/Exception.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Exception.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -81,5 +81,5 @@ class Exception { // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/ExtensionGo.h b/hurricane/src/hurricane/hurricane/ExtensionGo.h index b66ca9d0..45663470 100644 --- a/hurricane/src/hurricane/hurricane/ExtensionGo.h +++ b/hurricane/src/hurricane/hurricane/ExtensionGo.h @@ -1,7 +1,6 @@ - // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -19,12 +18,7 @@ // License along with Hurricane. If not, see // . // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | H U R R I C A N E | // | V L S I B a c k e n d D a t a - B a s e | // | | @@ -32,14 +26,11 @@ // | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Header : "./hurricane/ExtensionGo.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ -#ifndef __HURRICANE_EXTENSION_GO__ -#define __HURRICANE_EXTENSION_GO__ +#ifndef HURRICANE_EXTENSION_GO_H +#define HURRICANE_EXTENSION_GO_H #include "hurricane/Name.h" #include "hurricane/Go.h" @@ -76,6 +67,6 @@ namespace Hurricane { } // End of Hurricane namespace. -#endif // __HURRICANE_EXTENSION_GO__ +#endif // HURRICANE_EXTENSION_GO_H diff --git a/hurricane/src/hurricane/hurricane/ExtensionGos.h b/hurricane/src/hurricane/hurricane/ExtensionGos.h index a6dfb4d9..b8242735 100644 --- a/hurricane/src/hurricane/hurricane/ExtensionGos.h +++ b/hurricane/src/hurricane/hurricane/ExtensionGos.h @@ -1,7 +1,7 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // diff --git a/hurricane/src/hurricane/hurricane/ExtensionSlice.h b/hurricane/src/hurricane/hurricane/ExtensionSlice.h index f6f95a7f..d8eea63b 100644 --- a/hurricane/src/hurricane/hurricane/ExtensionSlice.h +++ b/hurricane/src/hurricane/hurricane/ExtensionSlice.h @@ -1,7 +1,7 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // diff --git a/hurricane/src/hurricane/hurricane/ExtensionSlices.h b/hurricane/src/hurricane/hurricane/ExtensionSlices.h index a2d57966..29248abc 100644 --- a/hurricane/src/hurricane/hurricane/ExtensionSlices.h +++ b/hurricane/src/hurricane/hurricane/ExtensionSlices.h @@ -1,7 +1,7 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // diff --git a/hurricane/src/hurricane/hurricane/FileReadGzStream.h b/hurricane/src/hurricane/hurricane/FileReadGzStream.h new file mode 100644 index 00000000..cf6fe163 --- /dev/null +++ b/hurricane/src/hurricane/hurricane/FileReadGzStream.h @@ -0,0 +1,73 @@ +// -*- mode: C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC 2016-2016, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./hurricane/FileReadGzStream.h" | +// +-----------------------------------------------------------------+ + + +#ifndef HURRICANE_FILEREADGZSTREAM_H +#define HURRICANE_FILEREADGZSTREAM_H + + +namespace Hurricane { + + typedef void BZFILE; // Must be identical to the typedef in . + + +// ------------------------------------------------------------------- +// Class : "FileReadGzStream". + + class FileReadGzStream { + public: + typedef char Ch; + public: + FileReadGzStream ( std::FILE* fp + , char* buffer + , size_t bufferSize + ); + inline Ch Peek () const; + inline Ch Take (); + inline size_t Tell () const; + inline void Put ( Ch ); + inline void Flush (); + inline Ch* PutBegin (); + inline size_t PutEnd ( Ch* ); + inline const Ch* Peek4 () const; + private: + void Read (); + private: + std::FILE* fp_; + BZFILE* bzfp_; + Ch* buffer_; + size_t bufferSize_; + Ch* bufferLast_; + Ch* current_; + size_t readCount_; + size_t count_; + bool eof_; + int bzerror_; + }; + + + inline FileReadGzStream::Ch FileReadGzStream::Peek () const { return *current_; } + inline FileReadGzStream::Ch FileReadGzStream::Take () { Ch c = *current_; Read(); return c; } + inline size_t FileReadGzStream::Tell () const { return count_ + static_cast(current_ - buffer_); } + inline void FileReadGzStream::Put ( Ch ) { assert(false); } + inline void FileReadGzStream::Flush () { assert(false); } + inline FileReadGzStream::Ch* FileReadGzStream::PutBegin () { assert(false); return 0; } + inline size_t FileReadGzStream::PutEnd ( Ch* ) { assert(false); return 0; } + inline const FileReadGzStream::Ch* FileReadGzStream::Peek4 () const { return (current_ + 4 <= bufferLast_) ? current_ : 0; } + + +} // Hurricane namespace. + +#endif // HURRICANE_FILEREADGZSTREAM_H diff --git a/hurricane/src/hurricane/hurricane/FileWriteGzStream.h b/hurricane/src/hurricane/hurricane/FileWriteGzStream.h new file mode 100644 index 00000000..45fd78c0 --- /dev/null +++ b/hurricane/src/hurricane/hurricane/FileWriteGzStream.h @@ -0,0 +1,101 @@ +// -*- mode: C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC 2016-2016, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./hurricane/FileWriteGzStream.h" | +// +-----------------------------------------------------------------+ + + +#ifndef HURRICANE_FILEWRITEGZSTREAM_H +#define HURRICANE_FILEWRITEGZSTREAM_H + +#include "rapidjson/rapidjson.h" +#include "rapidjson/filewritestream.h" + + +namespace Hurricane { + + typedef void BZFILE; // Must be identical to the typedef in . + + + class FileWriteGzStream { + public: + typedef char Ch; + public: + FileWriteGzStream ( std::FILE* fp, char* buffer, size_t bufferSize ); + ~FileWriteGzStream (); + inline void Put ( char c ); + inline void PutN ( char c, size_t n ); + void Flush (); + inline char Peek () const; + inline char Take (); + inline size_t Tell () const; + inline char* PutBegin (); + inline size_t PutEnd ( char* ); + private: + FileWriteGzStream ( const FileWriteGzStream& ); + FileWriteGzStream& operator= ( const FileWriteGzStream& ); + private: + std::FILE* fp_; + BZFILE* bzfp_; + char* buffer_; + char* bufferEnd_; + char* current_; + int bzerror_; + }; + + + inline void FileWriteGzStream::Put ( char c ) + { + if (current_ >= bufferEnd_) Flush(); + *current_++ = c; + } + + + inline void FileWriteGzStream::PutN ( char c, size_t n ) + { + size_t avail = static_cast( bufferEnd_ - current_ ); + while (n > avail) { + std::memset( current_, c, avail ); + current_ += avail; + Flush(); + n -= avail; + avail = static_cast( bufferEnd_ - current_ ); + } + + if (n > 0) { + std::memset( current_, c, n ); + current_ += n; + } + } + + +// Not implemented + inline char FileWriteGzStream::Peek () const { assert(false); return 0; } + inline char FileWriteGzStream::Take () { assert(false); return 0; } + inline size_t FileWriteGzStream::Tell () const { assert(false); return 0; } + inline char* FileWriteGzStream::PutBegin () { assert(false); return 0; } + inline size_t FileWriteGzStream::PutEnd ( char* ) { assert(false); return 0; } + + +} // Hurricane namespace. + + +namespace rapidjson { + + + template<> + inline void PutN ( Hurricane::FileWriteGzStream& stream, char c, size_t n ) { stream.PutN(c,n); } + + +} // rapidjson namespace. + +#endif // HURRICANE_FILEWRITEGZSTREAM_H diff --git a/hurricane/src/hurricane/hurricane/Filter.h b/hurricane/src/hurricane/hurricane/Filter.h index 660842e3..71142982 100644 --- a/hurricane/src/hurricane/hurricane/Filter.h +++ b/hurricane/src/hurricane/hurricane/Filter.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Filter.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -307,5 +307,5 @@ template class NotFilter : public Filter { // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Flags.h b/hurricane/src/hurricane/hurricane/Flags.h index d435fc5c..eeebb3d4 100644 --- a/hurricane/src/hurricane/hurricane/Flags.h +++ b/hurricane/src/hurricane/hurricane/Flags.h @@ -1,6 +1,6 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -55,6 +55,11 @@ namespace Hurricane { inline BaseFlags operator bitand ( BaseFlags ) const; inline BaseFlags operator bitor ( BaseFlags ) const; inline BaseFlags operator xor ( BaseFlags ) const; + inline BaseFlags operator bitand ( int ) const; + inline BaseFlags operator bitor ( int ) const; + inline BaseFlags operator xor ( int ) const; + inline BaseFlags lshift ( int ) const; + inline BaseFlags rshift ( int ) const; inline BaseFlags operator bitand ( unsigned int ) const; inline BaseFlags operator bitor ( unsigned int ) const; inline BaseFlags operator xor ( unsigned int ) const; @@ -66,13 +71,20 @@ namespace Hurricane { inline bool operator != ( BaseFlags ) const; inline bool operator < ( BaseFlags ) const; inline bool operator > ( BaseFlags ) const; + inline BaseFlags& operator |= ( int ); + inline BaseFlags& operator &= ( int ); + inline bool operator == ( int ) const; + inline bool operator != ( int ) const; + inline bool operator < ( int ) const; + inline bool operator > ( int ) const; inline BaseFlags& operator |= ( unsigned int ); inline BaseFlags& operator &= ( unsigned int ); inline bool operator == ( unsigned int ) const; inline bool operator != ( unsigned int ) const; inline bool operator < ( unsigned int ) const; inline bool operator > ( unsigned int ) const; - inline operator unsigned int () const; + inline operator bool () const; + //inline operator unsigned int () const; // Hurricane Managment. virtual std::string _getTypeName () const; virtual std::string _getString () const; @@ -88,12 +100,18 @@ namespace Hurricane { inline bool BaseFlags::zero () const { return _flags == 0; } inline BaseFlags& BaseFlags::reset ( BaseFlags flags ) { _flags &= ~flags._flags; return *this; } inline bool BaseFlags::isset ( BaseFlags flags ) const { return _flags & flags._flags; } - inline bool BaseFlags::contains ( BaseFlags flags ) const { return (_flags & flags._flags) && !(~_flags & flags._flags); } +//inline bool BaseFlags::contains ( BaseFlags flags ) const { return (_flags & flags._flags) && !(~_flags & flags._flags); } + inline bool BaseFlags::contains ( BaseFlags flags ) const { return (_flags & flags._flags) == flags._flags; } inline bool BaseFlags::intersect ( BaseFlags flags ) const { return _flags & flags._flags; } inline BaseFlags BaseFlags::operator compl () const { return ~_flags; } inline BaseFlags BaseFlags::operator bitand ( BaseFlags flags ) const { return _flags & flags._flags; } inline BaseFlags BaseFlags::operator bitor ( BaseFlags flags ) const { return _flags | flags._flags; } inline BaseFlags BaseFlags::operator xor ( BaseFlags flags ) const { return _flags ^ flags._flags; } + inline BaseFlags BaseFlags::operator bitand ( int flags ) const { return _flags & (unsigned int)flags; } + inline BaseFlags BaseFlags::operator bitor ( int flags ) const { return _flags | (unsigned int)flags; } + inline BaseFlags BaseFlags::operator xor ( int flags ) const { return _flags ^ (unsigned int)flags; } + inline BaseFlags BaseFlags::lshift ( int s ) const { return _flags << (unsigned int)s; } + inline BaseFlags BaseFlags::rshift ( int s ) const { return _flags >> (unsigned int)s; } inline BaseFlags BaseFlags::operator bitand ( unsigned int flags ) const { return _flags & flags; } inline BaseFlags BaseFlags::operator bitor ( unsigned int flags ) const { return _flags | flags; } inline BaseFlags BaseFlags::operator xor ( unsigned int flags ) const { return _flags ^ flags; } @@ -105,13 +123,21 @@ namespace Hurricane { inline bool BaseFlags::operator != ( BaseFlags flags ) const { return _flags != flags._flags; } inline bool BaseFlags::operator < ( BaseFlags flags ) const { return _flags < flags._flags; } inline bool BaseFlags::operator > ( BaseFlags flags ) const { return _flags > flags._flags; } + inline BaseFlags& BaseFlags::operator |= ( int flags ) { _flags |= (unsigned int)flags; return *this; } + inline BaseFlags& BaseFlags::operator &= ( int flags ) { _flags &= (unsigned int)flags; return *this; } + inline bool BaseFlags::operator == ( int flags ) const { return _flags == (unsigned int)flags; } + inline bool BaseFlags::operator != ( int flags ) const { return _flags != (unsigned int)flags; } + inline bool BaseFlags::operator < ( int flags ) const { return _flags < (unsigned int)flags; } + inline bool BaseFlags::operator > ( int flags ) const { return _flags > (unsigned int)flags; } inline BaseFlags& BaseFlags::operator |= ( unsigned int flags ) { _flags |= flags; return *this; } inline BaseFlags& BaseFlags::operator &= ( unsigned int flags ) { _flags &= flags; return *this; } inline bool BaseFlags::operator == ( unsigned int flags ) const { return _flags == flags; } inline bool BaseFlags::operator != ( unsigned int flags ) const { return _flags != flags; } inline bool BaseFlags::operator < ( unsigned int flags ) const { return _flags < flags; } inline bool BaseFlags::operator > ( unsigned int flags ) const { return _flags > flags; } - inline BaseFlags::operator unsigned int () const { return _flags; } + inline BaseFlags::operator bool () const { return _flags != 0; } +//inline BaseFlags::operator unsigned int () const { return _flags; } +//inline BaseFlags::operator unsigned int () const { return _flags; } inline BaseFlags& BaseFlags::set ( BaseFlags flags, bool state ) { diff --git a/hurricane/src/hurricane/hurricane/Go.h b/hurricane/src/hurricane/hurricane/Go.h index 5c3fc01c..ed6f0b8b 100644 --- a/hurricane/src/hurricane/hurricane/Go.h +++ b/hurricane/src/hurricane/hurricane/Go.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Go.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -104,5 +104,5 @@ INSPECTOR_P_SUPPORT(Hurricane::Go); // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Gos.h b/hurricane/src/hurricane/hurricane/Gos.h index 88794703..60063684 100644 --- a/hurricane/src/hurricane/hurricane/Gos.h +++ b/hurricane/src/hurricane/hurricane/Gos.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Gos.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -72,5 +72,5 @@ typedef GenericFilter GoFilter; // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Hook.h b/hurricane/src/hurricane/hurricane/Hook.h index 8cc8de2d..d2e1c705 100644 --- a/hurricane/src/hurricane/hurricane/Hook.h +++ b/hurricane/src/hurricane/hurricane/Hook.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Hook.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -35,9 +35,12 @@ class Component; class Hook { // ********* + typedef Hook* (*compToHook_t)(Component*); + // Attributes // ********** + private: static map _compToHookMap; private: Hook* _nextHook; // Constructors @@ -95,13 +98,16 @@ class Hook { // Others // ****** + public: static void addCompToHook(const string&, compToHook_t ); + public: static Hook* compToHook(const string& tname, Component* ); + public: string toJson() const; + public: virtual string _getTypeName() const = 0; public: virtual string _getString() const = 0; public: virtual Record* _getRecord() const; }; - } // End of Hurricane namespace. @@ -112,5 +118,5 @@ INSPECTOR_P_SUPPORT(Hurricane::Hook); // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Hooks.h b/hurricane/src/hurricane/hurricane/Hooks.h index 8a88f6c4..7d7d28e9 100644 --- a/hurricane/src/hurricane/hurricane/Hooks.h +++ b/hurricane/src/hurricane/hurricane/Hooks.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Hooks.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -72,5 +72,5 @@ typedef GenericFilter HookFilter; // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Horizontal.h b/hurricane/src/hurricane/hurricane/Horizontal.h index d2e3c1d0..21fde3ed 100644 --- a/hurricane/src/hurricane/hurricane/Horizontal.h +++ b/hurricane/src/hurricane/hurricane/Horizontal.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Horizontal.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -104,6 +104,8 @@ class Horizontal : public Segment { // Others // ****** + public: virtual void _toJson(JsonWriter*) const; + public: static JsonObject* getJsonObject(unsigned long flags); public: virtual string _getTypeName() const {return _TName("Horizontal");}; public: virtual string _getString() const; public: virtual Record* _getRecord() const; @@ -111,6 +113,16 @@ class Horizontal : public Segment { }; +class JsonHorizontal : public JsonSegment { +// **************************************** + + public: static void initialize(); + public: JsonHorizontal(unsigned long flags); + public: virtual string getTypeName() const; + public: virtual JsonHorizontal* clone(unsigned long) const; + public: virtual void toData(JsonStack&); +}; + } // End of Hurricane namespace. @@ -121,5 +133,5 @@ INSPECTOR_P_SUPPORT(Hurricane::Horizontal); // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Horizontals.h b/hurricane/src/hurricane/hurricane/Horizontals.h index fcfe5d70..417f2bff 100644 --- a/hurricane/src/hurricane/hurricane/Horizontals.h +++ b/hurricane/src/hurricane/hurricane/Horizontals.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Horizontals.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -72,5 +72,5 @@ typedef GenericFilter HorizontalFilter; // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/HyperNet.h b/hurricane/src/hurricane/hurricane/HyperNet.h index cb29e911..bb0352c3 100644 --- a/hurricane/src/hurricane/hurricane/HyperNet.h +++ b/hurricane/src/hurricane/hurricane/HyperNet.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/HyperNet.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -58,6 +58,7 @@ class HyperNet { public: Occurrences getNetOccurrencesUnder(Box area, bool doExtraction = false, bool allowInterruption = false) const; public: Occurrences getLeafPlugOccurrences(bool doExtraction = false , bool allowInterruption = false) const; + public: Occurrences getComponentOccurrences(bool doExtraction = false , bool allowInterruption = false) const; // Predicates // ********** @@ -83,6 +84,7 @@ bool isHyperNetRootNetOccurrence(Occurrence netoccurrence); INSPECTOR_P_SUPPORT(Hurricane::HyperNet); +IOSTREAM_VALUE_SUPPORT(Hurricane::HyperNet); @@ -95,5 +97,5 @@ INSPECTOR_P_SUPPORT(Hurricane::HyperNet); // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Initializer.h b/hurricane/src/hurricane/hurricane/Initializer.h new file mode 100644 index 00000000..b0fbc558 --- /dev/null +++ b/hurricane/src/hurricane/hurricane/Initializer.h @@ -0,0 +1,72 @@ +// -*- C++ -*- +// +// Copyright (c) BULL S.A. 2015-2016, All Rights Reserved +// +// This file is part of Hurricane. +// +// Hurricane is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// Hurricane is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- +// TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU +// General Public License for more details. +// +// You should have received a copy of the Lesser GNU General Public +// License along with Hurricane. If not, see +// . +// +// +-----------------------------------------------------------------+ +// | H U R R I C A N E | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Authors : Jean-Paul Chaput | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./hurricane/Initializer.h" | +// +-----------------------------------------------------------------+ + + +#ifndef HURRICANE_INITIALIZER_H +#define HURRICANE_INITIALIZER_H + +#include +#include + + +namespace Hurricane { + + +// ------------------------------------------------------------------- +// Class : "Init". + + class Init { + public: + typedef std::function initializer_t; + typedef std::multimap InitializerMap; + public: + static void destroy (); + static InitializerMap& initializers (); + static void addInitializer ( unsigned int order, initializer_t ); + static bool runOnce (); + private: + static bool _run; + static InitializerMap* _initializers; + }; + + +// ------------------------------------------------------------------- +// Class : "Initializer". + + template + class Initializer { + public: + inline Initializer ( unsigned int order ) { Init::addInitializer( order, T::initialize ); } + }; + + +} // Hurricane namespace. + +#endif // HURRICANE_INITIALIZER_H diff --git a/hurricane/src/hurricane/hurricane/Instance.h b/hurricane/src/hurricane/hurricane/Instance.h index 538714b7..e8f1ea6b 100644 --- a/hurricane/src/hurricane/hurricane/Instance.h +++ b/hurricane/src/hurricane/hurricane/Instance.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Instance.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -51,6 +51,7 @@ class Instance : public Go { public: PlacementStatus(const Code& code = UNPLACED); public: PlacementStatus(const PlacementStatus& placementstatus); + public: PlacementStatus(string); public: PlacementStatus& operator=(const PlacementStatus& placementstatus); @@ -178,6 +179,8 @@ class Instance : public Go { public: virtual string _getTypeName() const {return _TName("Instance");}; public: virtual string _getString() const; public: virtual Record* _getRecord() const; + public: virtual void _toJson(JsonWriter*) const; + public: virtual void _toJsonCollections(JsonWriter*) const; public: PlugMap& _getPlugMap() {return _plugMap;}; public: SharedPath* _getSharedPath(const SharedPath* tailSharedPath) const {return _sharedPathMap.getElement(tailSharedPath);} public: SharedPathes _getSharedPathes() const {return _sharedPathMap.getElements();}; @@ -191,6 +194,16 @@ class Instance : public Go { }; +class JsonInstance : public JsonEntity { +// ************************************* + + public: static void initialize(); + public: JsonInstance(unsigned long flags); + public: virtual string getTypeName() const; + public: virtual JsonInstance* clone(unsigned long) const; + public: virtual void toData(JsonStack&); +}; + } // End of Hurricane namespace. @@ -245,10 +258,15 @@ INSPECTOR_P_SUPPORT(Hurricane::Instance::PlacementStatus); INSPECTOR_P_SUPPORT(Hurricane::Instance::PlugMap); INSPECTOR_P_SUPPORT(Hurricane::Instance::SharedPathMap); +inline void jsonWrite ( JsonWriter* w, const std::string& key, const Hurricane::Instance::PlacementStatus& status ) +{ + w->key( key ); + w->write( getString(status.getCode()) ); +} #endif // HURRICANE_INSTANCE // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Instances.h b/hurricane/src/hurricane/hurricane/Instances.h index dfae06da..b1fb1d6f 100644 --- a/hurricane/src/hurricane/hurricane/Instances.h +++ b/hurricane/src/hurricane/hurricane/Instances.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Instances.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -72,5 +72,5 @@ typedef GenericFilter InstanceFilter; // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Interruption.h b/hurricane/src/hurricane/hurricane/Interruption.h index a4ed42bd..1dc68afb 100644 --- a/hurricane/src/hurricane/hurricane/Interruption.h +++ b/hurricane/src/hurricane/hurricane/Interruption.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Interruption.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -78,5 +78,5 @@ class Interruption : public Exception { // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Interval.h b/hurricane/src/hurricane/hurricane/Interval.h index e62c2841..76b14f7a 100644 --- a/hurricane/src/hurricane/hurricane/Interval.h +++ b/hurricane/src/hurricane/hurricane/Interval.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Interval.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -108,6 +108,15 @@ class Interval { } // End of Hurricane namespace. +inline void jsonWrite ( JsonWriter* w, const std::string& key, const Hurricane::Interval* interval ) +{ + w->key( key ); + w->startArray(); + w->write( &interval->getVMin() ); + w->write( &interval->getVMax() ); + w->endArray(); +} + INSPECTOR_PV_SUPPORT(Hurricane::Interval); @@ -115,5 +124,5 @@ INSPECTOR_PV_SUPPORT(Hurricane::Interval); // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Intervals.h b/hurricane/src/hurricane/hurricane/Intervals.h index e75acdd4..3fd7236e 100644 --- a/hurricane/src/hurricane/hurricane/Intervals.h +++ b/hurricane/src/hurricane/hurricane/Intervals.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Intervals.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -71,5 +71,5 @@ typedef GenericFilter IntervalFilter; // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/IntrusiveMap.h b/hurricane/src/hurricane/hurricane/IntrusiveMap.h index cffd7474..620eb42a 100644 --- a/hurricane/src/hurricane/hurricane/IntrusiveMap.h +++ b/hurricane/src/hurricane/hurricane/IntrusiveMap.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/IntrusiveMap.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -449,6 +449,13 @@ template class IntrusiveMap { }; + template + inline GenericCollection getCollection(const IntrusiveMap& intrusiveMap) + // ******************************************************************************************** + { + return intrusiveMap.getElements(); + } + } // End of Hurricane namespace. @@ -470,9 +477,18 @@ inline Hurricane::Record* getRecord ( const Hurricane::IntrusiveMap { return intrusiveMap->_getRecord(); } +template +inline void jsonWrite ( JsonWriter* w, const std::string& key, Hurricane::IntrusiveMap* intrusiveMap ) +{ + w->key( key ); + w->startArray(); + for ( Element* element : intrusiveMap->getElements() ) jsonWrite( w, element ); + w->endArray(); +} + #endif // HURRICANE_INTRUSIVE_MAP // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/IntrusiveSet.h b/hurricane/src/hurricane/hurricane/IntrusiveSet.h index 97b9f04b..44faeb35 100644 --- a/hurricane/src/hurricane/hurricane/IntrusiveSet.h +++ b/hurricane/src/hurricane/hurricane/IntrusiveSet.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/IntrusiveSet.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -470,6 +470,11 @@ template class IntrusiveSet { }; + template + inline GenericCollection getCollection(const IntrusiveSet& intrusiveSet) + // **************************************************************************************** + { return intrusiveSet.getElements(); } + } // End of Hurricane namespace. @@ -487,5 +492,5 @@ inline Hurricane::Record* getRecord ( Hurricane::IntrusiveSet& intrusiveSe // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/JsonObject.h b/hurricane/src/hurricane/hurricane/JsonObject.h new file mode 100644 index 00000000..cf1068b8 --- /dev/null +++ b/hurricane/src/hurricane/hurricane/JsonObject.h @@ -0,0 +1,424 @@ +// -*- C++ -*- +// +// Copyright (c) BULL S.A. 2015-2016, All Rights Reserved +// +// This file is part of Hurricane. +// +// Hurricane is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// Hurricane is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- +// TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU +// General Public License for more details. +// +// You should have received a copy of the Lesser GNU General Public +// License along with Hurricane. If not, see +// . +// +// +-----------------------------------------------------------------+ +// | H U R R I C A N E | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul Chaput | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./hurricane/JsonObject.h" | +// +-----------------------------------------------------------------+ + + +#ifndef HURRICANE_JSON_OBJECT_H +#define HURRICANE_JSON_OBJECT_H + +#ifndef HURRICANE_SLOT_H +#error "JsonObject.h must be included through Commons.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace Hurricane { + + class DBo; + class Hook; + class Entity; + class Cell; + class Component; + class JsonStack; + + class JsonArray { }; + + +// ------------------------------------------------------------------- +// Class : "JsonAttribute". + + class JsonAttribute { + public: + inline JsonAttribute ( const std::string& key, std::type_index tid ); + inline std::string key () const; + inline std::type_index tid () const; + private: + std::string _key; + std::type_index _tid; + }; + + inline JsonAttribute::JsonAttribute ( const std::string& key, std::type_index tid ) : _key(key), _tid(tid) { } + inline std::string JsonAttribute::key () const { return _key; } + inline std::type_index JsonAttribute::tid () const { return _tid; } + + +// ------------------------------------------------------------------- +// Class : "JsonObject". + + class JsonObject { + public: + JsonObject ( unsigned long flags ); + virtual ~JsonObject (); + virtual bool isDummy () const; + virtual std::string getTypeName () const = 0; + inline std::string getStackName () const; + bool check ( JsonStack&, std::string fname ) const; + void print ( std::ostream& ) const; + bool has ( const std::string& key ) const; + void add ( const std::string& key, std::type_index tid ); + void remove ( const std::string& key ); + template inline T get ( JsonStack&, const std::string& key ) const; + template inline T* jget ( JsonStack& ) const; + inline void copyAttrs ( const JsonObject*, bool reset=false ); + inline void clear (); + inline std::string getName () const; + inline void setName ( const std::string& ); + template inline T getObject () const; + template inline void setObject ( T ) ; + inline bool isBound () const; + virtual JsonObject* clone ( unsigned long flags ) const = 0; + virtual void toData ( JsonStack& ); + unsigned int presetId ( JsonStack& ); + template inline void update ( JsonStack&, T ); + inline JsonObject* setFlags ( unsigned long mask ); + inline JsonObject* resetFlags ( unsigned long mask ); + inline bool issetFlags ( unsigned long mask ) const; + protected: + unsigned long _flags; + std::string _name; + std::vector _stackeds; + std::vector _attributes; + std::vector _collections; + boost::any _object; + }; + + + inline bool JsonObject::isBound () const { return not _object.empty(); } + inline std::string JsonObject::getName () const { return _name; } + inline void JsonObject::setName ( const string& name ) { _name=name; } + inline JsonObject* JsonObject::setFlags ( unsigned long mask ) { _flags |= mask; return this; } + inline JsonObject* JsonObject::resetFlags ( unsigned long mask ) { _flags &= ~mask; return this; } + inline bool JsonObject::issetFlags ( unsigned long mask ) const { return _flags & mask; } + + inline std::string JsonObject::getStackName () const + { return (_name.empty()) ? std::string(".")+getTypeName(): _name; } + + template inline T JsonObject::getObject () const + { return boost::any_cast(_object); } + + template inline void JsonObject::setObject ( T t ) + { _object = t; } + + inline void JsonObject::copyAttrs ( const JsonObject* other, bool reset ) + { + if (reset) _attributes.clear(); + for ( size_t i=0 ; i_attributes.size() ; ++i ) + _attributes.push_back( other->_attributes[i] ); + } + + void JsonObject::clear () + { + _stackeds.clear(); + _attributes.clear(); + _collections.clear(); + boost::any emptyAny; + _object.swap( emptyAny ); + } + + +// ------------------------------------------------------------------- +// Class : "JsonKey". + + class JsonKey : public JsonObject { + public: + inline JsonKey ( const std::string& ); + virtual std::string getTypeName () const; + virtual JsonKey* clone ( unsigned long ) const; + private: + std::string _key; + }; + + +// ------------------------------------------------------------------- +// Class : "JsonDummy". + + class JsonDummy : public JsonObject { + public: + JsonDummy (); + virtual bool isDummy () const; + virtual std::string getTypeName () const; + void setTypeName ( const std::string& name ); + virtual JsonDummy* clone ( unsigned long ) const; + private: + std::string _typename; + }; + + +// ------------------------------------------------------------------- +// Class : "JsonBaseArray". + + template + class JsonBaseArray : public JsonObject { + public: + inline JsonBaseArray ( unsigned long flags ); + inline const std::vector& array () const; + inline void push_back ( T ); + private: + std::vector _array; + }; + + + template + inline JsonBaseArray::JsonBaseArray ( unsigned long flags ) + : JsonObject(flags) + , _array() + { } + + template + inline const std::vector& JsonBaseArray::array () const { return _array; } + + template + inline void JsonBaseArray::push_back ( T element ) + { _array.push_back(element); } + + +} // Hurricane namespace. + + +namespace std { + + template<> + struct less { + inline bool operator() ( const Hurricane::JsonObject* lhs, const Hurricane::JsonObject* rhs ) + { return lhs->getTypeName() < rhs->getTypeName(); } + }; + +} // std namespace. + + +namespace Hurricane { + +// ------------------------------------------------------------------- +// Class : "JsonTypes". + + class JsonTypes { + public: + static void initialize (); + static void registerType ( JsonObject* ); + static JsonObject* find ( const std::string& tname ); + private: + JsonTypes (); + ~JsonTypes (); + JsonTypes ( const JsonTypes& ); + void _registerType ( JsonObject* ); + JsonObject* _find ( const std::string& tname ); + private: + static JsonTypes* _jsonTypes; + std::set _jsonObjects; + }; + + +// ------------------------------------------------------------------- +// Class : "JsonStack". + + class JsonStack { + public: + typedef std::pair Element; + public: + inline JsonStack (); + inline size_t size () const; + template inline void push_back ( const std::string&, T ); + inline void pop_back ( size_t count=1 ); + inline int rhas ( const std::string& ) const; + template inline T as ( const std::string& ) const; + template inline T as ( int ) const; + inline void push_back_dbo ( DBo* ); + inline void pop_back_dbo (); + inline DBo* back_dbo () const; + inline vector& jobjects (); + template inline T getEntity ( unsigned int ) const; + void addEntity ( unsigned int jsonId, Entity* ); + void print ( std::ostream& ) const; + inline unsigned long getFlags () const; + inline JsonStack* setFlags ( unsigned long mask ); + inline JsonStack* resetFlags ( unsigned long mask ); + inline bool issetFlags ( unsigned long mask ) const; + inline const Element& operator[] ( int index ) const; + private: + unsigned long _flags; + vector _stack; + vector _jstack; + vector _dbos; + std::map _entities; + }; + + + inline JsonStack::JsonStack () + : _flags(0), _stack(), _jstack(), _dbos(), _entities() + { } + + template inline void JsonStack::push_back ( const std::string& key, T t ) + { + cdebug.log(19) << "JsonStack::push_back(T) key:" << key << " value:" << t + << " (" << demangle(typeid(T)) << ")." << endl; + _stack.push_back(std::make_pair(key,boost::any(t))); + } + + inline void JsonStack::pop_back ( size_t count ) + { + while (count--) { + if (_stack.empty()) { + std::cerr << "[ERROR] JsonStack::pop_back(): Stack is empty, but " + << (count+1) << " elements remains to pop." << std::endl; + break; + } + cdebug.log(19) << "| _stack.pop_back() \"" << _stack.back().first + << "\", size:" << _stack.size() << ", dbos:" << _dbos.size() << endl; + _stack.pop_back(); + } + } + + inline const JsonStack::Element& JsonStack::operator[] ( int index ) const + { + if (index < 0) return _stack[_stack.size()+index]; + return _stack[index]; + } + + inline int JsonStack::rhas ( const std::string& key ) const + { + if (_stack.empty()) return 0; + + int i = _stack.size()-1; + do { + if (_stack[i].first == key) { + cdebug.log(19) << "JsonStack::rhas(): key \"" << key << "\" found at index:" + << (i-(int)_stack.size()) << " (i:" << i << ") " + << "(" << demangle(_stack[i].second.type().name()) << ")." + << endl; + return i-(int)_stack.size(); + } + if (i == 0) break; + --i; + } while ( true ); + + cdebug.log(19) << "JsonStack::rhas(): key \"" << key << "\" not found (returning index: 0)." << endl; + return 0; + } + + template inline T JsonStack::as ( const std::string& key ) const + { + if (not _stack.empty()) { + int i = _stack.size()-1; + do { + if (_stack[i].first == key) { + cdebug.log(19) << "JsonStack::as() k:" << key + << " value:" << demangle(_stack[i].second.type().name()) << std::endl; + return boost::any_cast( _stack[i].second ); + } + if (i == 0) break; + --i; + } while ( true ); + + std::cerr << "[ERROR] JsonStack::as(key): No element with key \"" + << key << "\" in stack." << std::endl; + } else { + std::cerr << "[ERROR] JsonStack::as(key): Stack is empty while searching for key \"" + << key << "\"." << std::endl; + } + + return T(); + } + + template inline T JsonStack::as ( int index ) const + { + size_t i = (index >= 0) ? index : (_stack.size()+index); + return boost::any_cast( _stack[i].second ); + } + + + template inline T JsonStack::getEntity ( unsigned int id ) const + { + std::map::const_iterator it = _entities.find(id); + if (it == _entities.end()) return NULL; + return dynamic_cast((*it).second); + } + + inline void JsonStack::push_back_dbo ( DBo* dbo ) { _dbos.push_back(dbo); } + inline void JsonStack::pop_back_dbo () { _dbos.pop_back(); } + inline DBo* JsonStack::back_dbo () const { return (_dbos.empty()) ? NULL : _dbos.back(); } + inline vector& JsonStack::jobjects () { return _jstack; } + inline size_t JsonStack::size () const { return _stack.size(); } + inline unsigned long JsonStack::getFlags () const { return _flags; } + inline JsonStack* JsonStack::setFlags ( unsigned long mask ) { _flags |= mask; return this; } + inline JsonStack* JsonStack::resetFlags ( unsigned long mask ) { _flags &= ~mask; return this; } + inline bool JsonStack::issetFlags ( unsigned long mask ) const { return _flags & mask; } + + template + T JsonObject::get ( JsonStack& stack, const std::string& key ) const + { + int index = stack.rhas(key); + if (index == 0) return T();; + if (stack[index].second.type() == typeid(void*)) return T(); + + return stack.as( index ); + } + + template + T* JsonObject::jget ( JsonStack& stack ) const + { + vector& jobjects = stack.jobjects(); + vector::reverse_iterator rit = jobjects.rbegin(); + + for ( ; rit != jobjects.rend() ; ++rit ) { + T* jobject = dynamic_cast( *rit ); + if (jobject) return jobject; + } + + return NULL; + } + + template + inline void JsonObject::update ( JsonStack& stack, T hobject ) + { + cdebug.log(19) << "JsonObject::update()" << endl; + stack.pop_back( _attributes.size() ); + stack.push_back( getStackName(), hobject ); + setObject( hobject ); + } + + +// ------------------------------------------------------------------- +// Function : Json Parsers. + + Cell* jsonCellParse ( std::string filename ); + Cell* jsonBlobParse ( std::string filename ); + + +} // Hurricane namespace. + +#endif // HURRICANE_JSON_OBJECT_H diff --git a/hurricane/src/hurricane/hurricane/JsonReader.h b/hurricane/src/hurricane/hurricane/JsonReader.h new file mode 100644 index 00000000..fc28a9d8 --- /dev/null +++ b/hurricane/src/hurricane/hurricane/JsonReader.h @@ -0,0 +1,86 @@ +// -*- C++ -*- +// +// Copyright (c) BULL S.A. 2015-2016, All Rights Reserved +// +// This file is part of Hurricane. +// +// Hurricane is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// Hurricane is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- +// TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU +// General Public License for more details. +// +// You should have received a copy of the Lesser GNU General Public +// License along with Hurricane. If not, see +// . +// +// +-----------------------------------------------------------------+ +// | H U R R I C A N E | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul Chaput | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./hurricane/JsonReader.h" | +// +-----------------------------------------------------------------+ + + +#ifndef HURRICANE_JSON_READER_H +#define HURRICANE_JSON_READER_H + +#include +#include +#include "rapidjson/filereadstream.h" +#include "rapidjson/reader.h" +#include "hurricane/Commons.h" +#include "hurricane/FileReadGzStream.h" + + +namespace Hurricane { + + using rapidjson::Reader; + class HurricaneHandler; + + +// ------------------------------------------------------------------- +// Class : "JsonReader". + + class JsonReader { + public: + JsonReader ( unsigned long flags ); + ~JsonReader (); + inline JsonReader* setFlags ( unsigned long mask ); + inline JsonReader* resetFlags ( unsigned long mask ); + inline bool issetFlags ( unsigned long mask ) const; + inline unsigned long getFlags () const; + inline JsonStack& getStack (); + void parse ( std::string fileName ); + void close (); + private: + JsonReader ( const JsonReader& ); + JsonReader& operator= ( const JsonReader& ) const; + private: + size_t _bufferSize; + char* _buffer; + FILE* _file; + FileReadGzStream* _stream; + JsonStack _stack; + Reader _reader; + HurricaneHandler* _handler; + }; + + + inline JsonReader* JsonReader::setFlags ( unsigned long mask ) { _stack.setFlags(mask); return this; } + inline JsonReader* JsonReader::resetFlags ( unsigned long mask ) { _stack.resetFlags(mask); return this; } + inline bool JsonReader::issetFlags ( unsigned long mask ) const { return _stack.issetFlags(mask); } + inline unsigned long JsonReader::getFlags () const { return _stack.getFlags(); } + inline JsonStack& JsonReader::getStack () { return _stack; } + + +} // Hurricane namespace. + +#endif // HURRICANE_JSON_READER_H diff --git a/hurricane/src/hurricane/hurricane/JsonWriter.h b/hurricane/src/hurricane/hurricane/JsonWriter.h new file mode 100644 index 00000000..1160b7a6 --- /dev/null +++ b/hurricane/src/hurricane/hurricane/JsonWriter.h @@ -0,0 +1,289 @@ +// -*- C++ -*- +// +// Copyright (c) BULL S.A. 2015-2016, All Rights Reserved +// +// This file is part of Hurricane. +// +// Hurricane is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// Hurricane is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- +// TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU +// General Public License for more details. +// +// You should have received a copy of the Lesser GNU General Public +// License along with Hurricane. If not, see +// . +// +// +-----------------------------------------------------------------+ +// | H U R R I C A N E | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul Chaput | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./hurricane/JsonWriter.h" | +// +-----------------------------------------------------------------+ + + +#ifndef HURRICANE_SLOT_H +#error "JsonWriter.h must be included through Commons.h" +#endif + +#ifndef HURRICANE_JSON_WRITER_H +#define HURRICANE_JSON_WRITER_H + +#include +#include +#include +#include + +namespace rapidjson { + class FileWriteStream; +} + +namespace Hurricane { + class FileWriteGzStream; +} +//namespace Hurricane { + + +// ------------------------------------------------------------------- +// Class : "JsonWriter". + + class JsonWriter { + public: + enum Mode { UsePlugReference = (1<< 0) + , UseEntityReference = (1<< 1) + , DesignBlobMode = (1<< 2) + , CellMode = (1<< 3) + , TechnoMode = (1<< 4) + , RegisterMode = (1<< 5) + , RegisterStatus = (1<< 6) + , RegisterType = (1<< 7) + , UnregisterType = (1<< 8) + , CellObject = (1<< 9) + , DBoObject = (1<<10) + }; + public: + JsonWriter ( std::string fileName ); + ~JsonWriter (); + void key ( const char* ); + void key ( std::string ); + void startObject (); + void startArray (); + void endObject (); + void endArray (); + void write (); + void write ( const char* ); + void write ( std::string ); + void write ( const std::string* ); + void write ( bool ); + void write ( const bool* ); + void write ( int ); + void write ( const int* ); + void write ( long ); + void write ( const long* ); + void write ( unsigned int ); + void write ( const unsigned int* ); + void write ( unsigned long ); + void write ( const unsigned long* ); + void write ( float ); + void write ( const float* ); + void write ( double ); + void write ( const double* ); + void close (); + JsonWriter* setFlags ( unsigned long mask ); + JsonWriter* resetFlags ( unsigned long mask ); + bool issetFlags ( unsigned long mask ) const; + unsigned long getFlags () const; + private: + JsonWriter ( const JsonWriter& ); + JsonWriter& operator= ( const JsonWriter& ) const; + private: + unsigned long _flags; + size_t _bufferSize; + char* _buffer; + FILE* _file; + //rapidjson::FileWriteStream* _stream; + Hurricane::FileWriteGzStream* _stream; + void* _writer; + }; + + +//} // Hurricane namespace. + + +// All jsonWrite() overload are put in the top level namespace, +// in order to facilitate additions from other tools. + +inline void jsonWrite ( JsonWriter* w ) { w->write( ); } +inline void jsonWrite ( JsonWriter* w, const char* s ) { w->write(s); } +inline void jsonWrite ( JsonWriter* w, const std::string* s ) { w->write(s); } +inline void jsonWrite ( JsonWriter* w, std::string s ) { w->write(s); } +inline void jsonWrite ( JsonWriter* w, const bool* v ) { w->write(v); } +inline void jsonWrite ( JsonWriter* w, bool v ) { w->write(v); } +inline void jsonWrite ( JsonWriter* w, const int* v ) { w->write(v); } +inline void jsonWrite ( JsonWriter* w, int v ) { w->write(v); } +inline void jsonWrite ( JsonWriter* w, const long* v ) { w->write(v); } +inline void jsonWrite ( JsonWriter* w, long v ) { w->write(v); } +inline void jsonWrite ( JsonWriter* w, const unsigned int* v ) { w->write(v); } +inline void jsonWrite ( JsonWriter* w, unsigned int v ) { w->write(v); } +inline void jsonWrite ( JsonWriter* w, const unsigned long* v ) { w->write(v); } +inline void jsonWrite ( JsonWriter* w, unsigned long v ) { w->write(v); } +inline void jsonWrite ( JsonWriter* w, const float* v ) { w->write(v); } +inline void jsonWrite ( JsonWriter* w, float v ) { w->write(v); } +inline void jsonWrite ( JsonWriter* w, const double* v ) { w->write(v); } +inline void jsonWrite ( JsonWriter* w, double v ) { w->write(v); } + + +//template +//inline void jsonWrite ( JsonWriter* w, const std::string& key, const Type value ) +//{ w->key( key ); w->write( getString(value).c_str() ); } + + +inline void jsonWrite ( JsonWriter* w, const std::string& key, const bool* value ) +{ w->key( key ); w->write( value ); } + + +inline void jsonWrite ( JsonWriter* w, const std::string& key, bool value ) +{ w->key( key ); w->write( value ); } + + +inline void jsonWrite ( JsonWriter* w, const std::string& key, const int* value ) +{ w->key( key ); w->write( value ); } + + +inline void jsonWrite ( JsonWriter* w, const std::string& key, int value ) +{ w->key( key ); w->write( value ); } + + +inline void jsonWrite ( JsonWriter* w, const std::string& key, const long* value ) +{ w->key( key ); w->write( value ); } + + +inline void jsonWrite ( JsonWriter* w, const std::string& key, long value ) +{ w->key( key ); w->write( value ); } + + +inline void jsonWrite ( JsonWriter* w, const std::string& key, const unsigned int* value ) +{ w->key( key ); w->write( value ); } + + +inline void jsonWrite ( JsonWriter* w, const std::string& key, unsigned int value ) +{ w->key( key ); w->write( value ); } + + +inline void jsonWrite ( JsonWriter* w, const std::string& key, const unsigned long* value ) +{ w->key( key ); w->write( value ); } + + +inline void jsonWrite ( JsonWriter* w, const std::string& key, unsigned long value ) +{ w->key( key ); w->write( value ); } + + +inline void jsonWrite ( JsonWriter* w, const std::string& key, const char* value ) +{ w->key( key ); w->write( value ); } + + +inline void jsonWrite ( JsonWriter* w, const std::string& key, const std::string& value ) +{ w->key( key ); w->write( value ); } + + +inline void jsonWrite ( JsonWriter* w, const std::string& key, const float* value ) +{ w->key( key ); w->write( value ); } + + +inline void jsonWrite ( JsonWriter* w, const std::string& key, float value ) +{ w->key( key ); w->write( value ); } + + +inline void jsonWrite ( JsonWriter* w, const std::string& key, const double* value ) +{ w->key( key ); w->write( value ); } + + +inline void jsonWrite ( JsonWriter* w, const std::string& key, double value ) +{ w->key( key ); w->write( value ); } + + +template +inline void jsonWrite ( JsonWriter* w, const std::string& key, const C& ) +{ + w->key( key ); + std::string message = "JSON unsupported type " + Hurricane::demangle(typeid(C).name()); + w->write( message.c_str() ); +} + + +template +inline void jsonWrite ( JsonWriter* w, const C* object ) +{ + cdebug.log(19,1) << "jsonWrite<" << Hurricane::demangle(typeid(C).name()) << "*>(w,object)" << std::endl; + + if (object) object->toJson( w ); + else jsonWrite(w); + + cdebug.tabw(19,-1); +} + + +template +inline void jsonWrite ( JsonWriter* w, const std::string& key, C* object ) +{ + jsonWrite( w, key, const_cast(object) ); +} + + +template +inline void jsonWrite ( JsonWriter* w, const std::string& key, const C* object ) +{ + cdebug.log(19,1) << "jsonWrite<" << Hurricane::demangle(typeid(C).name()) << "*>(w,key,object)" + << " key:\"" << key << "\"" << std::endl; + + w->key( key ); + if (object) jsonWrite( w, object ); + else jsonWrite(w); + + cdebug.tabw(19,-1); +} + + +template +inline void jsonWrite ( JsonWriter* w, const std::string& key, const std::vector& v ) +{ + cdebug.log(19,1) << "jsonWrite< vector<" << Hurricane::demangle(typeid(Element).name()) + << "> >(w,key,v)" << " key:\"" << key << "\"" << std::endl; + + w->key( key ); + w->startArray(); + for ( Element element : v ) jsonWrite( w, element ); + w->endArray(); + + cdebug.tabw(19,-1); +} + + +template +inline void jsonWrite ( JsonWriter* w + , const std::string& key + , const std::map& m ) +{ + cdebug.log(19,1) << "jsonWrite< map<" + << Hurricane::demangle(typeid(Key ).name()) << "," + << Hurricane::demangle(typeid(Element).name()) << "," + << Hurricane::demangle(typeid(Compare).name()) + << "> >(w,key,m)" << " key:\"" << key << "\"" << std::endl; + + w->key( key ); + w->startArray(); + for ( auto mapElement : m ) jsonWrite( w, mapElement.second ); + w->endArray(); + + cdebug.tabw(19,-1); +} + + +#endif // HURRICANE_JSON_WRITER_H diff --git a/hurricane/src/hurricane/hurricane/Layer.h b/hurricane/src/hurricane/hurricane/Layer.h index a32b7372..5fa0fdca 100644 --- a/hurricane/src/hurricane/hurricane/Layer.h +++ b/hurricane/src/hurricane/hurricane/Layer.h @@ -1,7 +1,7 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -30,8 +30,8 @@ // +-----------------------------------------------------------------+ -#ifndef __HURRICANE_LAYER__ -#define __HURRICANE_LAYER__ +#ifndef HURRICANE_LAYER_H +#define HURRICANE_LAYER_H #include "hurricane/Mask.h" #include "hurricane/DBo.h" @@ -46,7 +46,12 @@ namespace Hurricane { class Technology; +// ------------------------------------------------------------------- +// Class : "Hurricane::Layer". + class Layer : public DBo { + public: + typedef DBo Super; public: // Types. @@ -88,6 +93,7 @@ namespace Hurricane { virtual void setExtentionCap ( const BasicLayer* layer, DbU::Unit ); virtual void setExtentionWidth ( const BasicLayer* layer, DbU::Unit ); // Hurricane Managment. + virtual void _toJson ( JsonWriter* ) const; virtual string _getString () const; virtual Record* _getRecord () const; inline Layer* _getNextOfTechnologyLayerMap () const; @@ -95,6 +101,7 @@ namespace Hurricane { inline void _setExtractMask ( const Mask& extractMask ); inline void _setNextOfTechnologyLayerMap ( Layer* layer ); virtual void _onDbuChange ( float scale ); + static const Name& _sgetName ( const Layer* ); private: // Internal: Attributes @@ -109,14 +116,14 @@ namespace Hurricane { protected: // Internal: Constructors & Destructors. - Layer ( Technology* technology - , const Name& name - , const DbU::Unit& minimalSize = 0 - , const DbU::Unit& minimalSpacing = 0 - , const DbU::Unit& pitch = 0 - ); - virtual void _postCreate (); - virtual void _preDestroy (); + Layer ( Technology* technology + , const Name& name + , const DbU::Unit& minimalSize = 0 + , const DbU::Unit& minimalSpacing = 0 + , const DbU::Unit& pitch = 0 + ); + virtual void _postCreate (); + virtual void _preDestroy (); public: struct CompareByMask : public binary_function { @@ -145,12 +152,21 @@ namespace Hurricane { { return (lhs?lhs->getMask():Layer::Mask()) < (rhs?rhs->getMask():Layer::Mask()); } +// ------------------------------------------------------------------- +// Class : "Hurricane::JsonLayer". -} // End of Hurricane namespace. + class JsonLayer : public JsonDBo { + public: + JsonLayer ( unsigned long flags ); + Technology* lookupTechnology ( JsonStack&, const string& fname ) const; + }; + + +} // Hurricane namespace. INSPECTOR_P_SUPPORT(Hurricane::Layer); INSPECTOR_PV_SUPPORT(Hurricane::Layer::Mask); -# endif +#endif // HURRICANE_LAYER_H diff --git a/hurricane/src/hurricane/hurricane/Layers.h b/hurricane/src/hurricane/hurricane/Layers.h index 3df69361..f000c678 100644 --- a/hurricane/src/hurricane/hurricane/Layers.h +++ b/hurricane/src/hurricane/hurricane/Layers.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Layers.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -72,5 +72,5 @@ typedef GenericFilter LayerFilter; // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Libraries.h b/hurricane/src/hurricane/hurricane/Libraries.h index f4bade25..e4ca84d3 100644 --- a/hurricane/src/hurricane/hurricane/Libraries.h +++ b/hurricane/src/hurricane/hurricane/Libraries.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Libraries.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -72,5 +72,5 @@ typedef GenericFilter LibraryFilter; // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Library.h b/hurricane/src/hurricane/hurricane/Library.h index dbfa24f6..5f61f080 100644 --- a/hurricane/src/hurricane/hurricane/Library.h +++ b/hurricane/src/hurricane/hurricane/Library.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Library.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -95,6 +95,7 @@ class Library : public DBo { public: DataBase* getDataBase() const {return _dataBase;}; public: Library* getLibrary() const {return _library;}; public: const Name& getName() const {return _name;}; + public: string getHierarchicalName () const; public: Library* getLibrary(const Name& name) const {return _libraryMap.getElement(name);}; public: Libraries getLibraries() const {return _libraryMap.getElements();}; public: Cell* getCell(const Name& name) const {return _cellMap.getElement(name);}; @@ -115,6 +116,7 @@ class Library : public DBo { public: virtual string _getTypeName() const {return _TName("Library");}; public: virtual string _getString() const; public: virtual Record* _getRecord() const; + public: virtual void _toJson( JsonWriter* ) const; public: LibraryMap& _getLibraryMap() {return _libraryMap;}; public: CellMap& _getCellMap() {return _cellMap;}; public: Library* _getNextOfLibraryLibraryMap() const {return _nextOfLibraryLibraryMap;}; @@ -124,6 +126,17 @@ class Library : public DBo { }; +class JsonLibrary : public JsonDBo { +// ******************************* + + public: static void initialize(); + public: JsonLibrary(unsigned long flags); + public: virtual string getTypeName() const; + public: virtual JsonLibrary* clone(unsigned long) const; + public: virtual void toData(JsonStack&); +}; + + } // End of Hurricane namespace. @@ -135,5 +148,5 @@ INSPECTOR_P_SUPPORT(Hurricane::Library::CellMap); // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/ListCollection.h b/hurricane/src/hurricane/hurricane/ListCollection.h index 5239477b..3bef58bd 100644 --- a/hurricane/src/hurricane/hurricane/ListCollection.h +++ b/hurricane/src/hurricane/hurricane/ListCollection.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/ListCollection.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -215,5 +215,5 @@ template // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Locator.h b/hurricane/src/hurricane/hurricane/Locator.h index 3dda8565..cd653d15 100644 --- a/hurricane/src/hurricane/hurricane/Locator.h +++ b/hurricane/src/hurricane/hurricane/Locator.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Locator.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -268,5 +268,5 @@ template class GenericLocator : public Locator { // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/MapCollection.h b/hurricane/src/hurricane/hurricane/MapCollection.h index 37c0cf4c..d911fcaa 100644 --- a/hurricane/src/hurricane/hurricane/MapCollection.h +++ b/hurricane/src/hurricane/hurricane/MapCollection.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/MapCollection.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -213,5 +213,5 @@ template // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Marker.h b/hurricane/src/hurricane/hurricane/Marker.h index db4eeb8a..eca06b09 100644 --- a/hurricane/src/hurricane/hurricane/Marker.h +++ b/hurricane/src/hurricane/hurricane/Marker.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Marker.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -85,5 +85,5 @@ class Marker : public Go { // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Markers.h b/hurricane/src/hurricane/hurricane/Markers.h index b73f035e..d8cfe62e 100644 --- a/hurricane/src/hurricane/hurricane/Markers.h +++ b/hurricane/src/hurricane/hurricane/Markers.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Markers.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -72,5 +72,5 @@ typedef GenericFilter MarkerFilter; // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Mask.h b/hurricane/src/hurricane/hurricane/Mask.h index b1f9690d..1401d6a3 100644 --- a/hurricane/src/hurricane/hurricane/Mask.h +++ b/hurricane/src/hurricane/hurricane/Mask.h @@ -1,6 +1,6 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -33,6 +33,7 @@ #define HURRICANE_MASK_H #include +#include #include "hurricane/Commons.h" @@ -43,31 +44,33 @@ namespace Hurricane { class Mask { public: // Methods. - inline Mask ( IntType mask=0 ); - inline bool zero () const; - inline Mask& set ( const Mask mask ); - inline Mask& unset ( const Mask mask ); - inline bool isSet ( const Mask mask ) const; - inline bool contains ( const Mask mask ) const; - inline bool intersect ( const Mask mask ) const; - inline Mask nthbit ( unsigned int ) const; - inline Mask operator compl () const; - inline Mask operator bitand ( const Mask mask ) const; - inline Mask operator bitor ( const Mask mask ) const; - inline Mask operator xor ( const Mask mask ) const; - inline Mask lshift ( unsigned int ) const; - inline Mask rshift ( unsigned int ) const; - inline Mask& operator |= ( const Mask mask ); - inline Mask& operator &= ( const Mask mask ); - inline bool operator == ( const Mask mask ) const; - inline bool operator != ( const Mask mask ) const; - inline bool operator < ( const Mask mask ) const; - inline bool operator > ( const Mask mask ) const; - inline operator IntType () const; + inline Mask ( IntType mask=0 ); + inline bool zero () const; + inline Mask& set ( const Mask mask ); + inline Mask& unset ( const Mask mask ); + inline bool isSet ( const Mask mask ) const; + inline bool contains ( const Mask mask ) const; + inline bool intersect ( const Mask mask ) const; + inline Mask nthbit ( unsigned int ) const; + inline Mask operator compl () const; + inline Mask operator bitand ( const Mask mask ) const; + inline Mask operator bitor ( const Mask mask ) const; + inline Mask operator xor ( const Mask mask ) const; + inline Mask lshift ( unsigned int ) const; + inline Mask rshift ( unsigned int ) const; + inline Mask& operator += ( unsigned int ); + inline Mask& operator |= ( const Mask mask ); + inline Mask& operator &= ( const Mask mask ); + inline bool operator == ( const Mask mask ) const; + inline bool operator != ( const Mask mask ) const; + inline bool operator < ( const Mask mask ) const; + inline bool operator > ( const Mask mask ) const; + inline operator IntType () const; + static inline Mask fromString ( const string& ); // Hurricane Managment. - inline string _getTypeName () const; - inline string _getString () const; - inline Record* _getRecord () const; + inline string _getTypeName () const; + inline string _getString () const; + inline Record* _getRecord () const; protected: // Internal: Attributes. static size_t _width; @@ -138,6 +141,10 @@ namespace Hurricane { inline Mask Mask::rshift ( unsigned int s ) const { return _mask >> s; } + template + inline Mask& Mask::operator += ( unsigned int v ) + { _mask += v; return *this; } + template inline Mask& Mask::operator |= ( const Mask mask ) { _mask |= mask._mask; return *this; } @@ -189,6 +196,58 @@ namespace Hurricane { size_t Mask::_width = sizeof(IntType)<<2; + template + inline Mask Mask::fromString ( const string& s ) + { + IntType value; + istringstream iss ( s ); + + iss >> hex >> value; + Mask mask ( value ); + + +#if NO_ISTRINGSTREAM + if ( (s.size() > 2) and (s.size() <= _width+2) and (s.substr(0,2) == "0x") ) { + for ( size_t i=2 ; i // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Name.h b/hurricane/src/hurricane/hurricane/Name.h index 0d7452f1..0c2424ef 100644 --- a/hurricane/src/hurricane/hurricane/Name.h +++ b/hurricane/src/hurricane/hurricane/Name.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Name.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -95,10 +95,16 @@ class Name { INSPECTOR_PV_SUPPORT(Hurricane::Name); +inline void jsonWrite ( JsonWriter* w, Hurricane::Name name ) +{ w->write( getString(name).c_str() ); } + +inline void jsonWrite ( JsonWriter* w, const std::string& key, Hurricane::Name name ) +{ w->key( key ); w->write( getString(name).c_str() ); } + #endif // HURRICANE_NAME // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Names.h b/hurricane/src/hurricane/hurricane/Names.h index add93c1c..a8972dfa 100644 --- a/hurricane/src/hurricane/hurricane/Names.h +++ b/hurricane/src/hurricane/hurricane/Names.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Names.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -69,5 +69,5 @@ typedef GenericFilter NameFilter; #endif // HURRICANE_NAMES // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Net.h b/hurricane/src/hurricane/hurricane/Net.h index 195b3302..7eddc371 100644 --- a/hurricane/src/hurricane/hurricane/Net.h +++ b/hurricane/src/hurricane/hurricane/Net.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Net.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -41,7 +41,6 @@ namespace Hurricane { - // **************************************************************************************************** // Net declaration // **************************************************************************************************** @@ -59,12 +58,13 @@ class Net : public Entity { public: class Type { // *************** - public: enum Code {UNDEFINED=0, LOGICAL=1, CLOCK=2, POWER=3, GROUND=4}; + public: enum Code {UNDEFINED=0, LOGICAL=1, CLOCK=2, POWER=3, GROUND=4, BLOCKAGE=5}; private: Code _code; public: Type(const Code& code = UNDEFINED); public: Type(const Type& type); + public: Type(string); public: Type& operator=(const Type& type); @@ -101,6 +101,7 @@ class Net : public Entity { public: Direction(const Code& code = UNDEFINED); public: Direction(const Direction& direction); + public: Direction(string); public: Direction& operator =(const Direction& direction); public: Direction& operator|=(const Direction& direction); @@ -213,16 +214,18 @@ class Net : public Entity { public: bool isGlobal () const {return _isGlobal;}; public: bool isExternal () const {return _isExternal;}; public: bool isAutomatic() const {return _isAutomatic;}; + public: bool isBlockage () const {return (_type == Type::BLOCKAGE);}; public: bool isLogical () const {return (_type == Type::LOGICAL);}; public: bool isClock () const {return (_type == Type::CLOCK);}; public: bool isPower () const {return (_type == Type::POWER);}; public: bool isGround () const {return (_type == Type::GROUND);}; public: bool isSupply () const {return (isPower() || isGround());}; + public: bool hasAlias (const Name& name) const; // Updators // ******** - public: void setName(const Name& name); + public: void setName(Name name); public: void setArity(const Arity& arity); public: void setGlobal(bool isGlobal); public: void setExternal(bool isExternal); @@ -241,9 +244,11 @@ class Net : public Entity { // ****** protected: virtual void _postCreate(); - protected: virtual void _preDestroy(); + public: virtual void _toJson(JsonWriter*) const; + public: virtual void _toJsonSignature(JsonWriter*) const; + public: virtual void _toJsonCollections(JsonWriter*) const; public: virtual string _getTypeName() const {return _TName("Net");}; public: virtual string _getString() const; public: virtual Record* _getRecord() const; @@ -257,7 +262,98 @@ class Net : public Entity { }; -} // End of Hurricane namespace. +// ------------------------------------------------------------------- +// Class : "HookKey". + + class HookKey { + public: + inline HookKey ( unsigned int id, const std::string& tname ); + inline unsigned int id () const; + inline std::string tname () const; + private: + unsigned int _id; + std::string _tname; + }; + + + inline HookKey::HookKey ( unsigned int id, const std::string& tname ) : _id(id), _tname(tname) { } + inline unsigned int HookKey::id () const { return _id; } + inline std::string HookKey::tname () const { return _tname; } + + inline bool operator< ( const HookKey& lhs, const HookKey& rhs ) + { + if (lhs.id() != rhs.id()) return lhs.id() < rhs.id(); + return lhs.tname() < rhs.tname(); + } + + +// ------------------------------------------------------------------- +// Class : "HookElement". + + class HookElement { + public: + enum Flags { OpenRingStart = (1<<0) + , ClosedRing = (1<<1) + }; + public: + inline HookElement ( Hook*, unsigned long flags=0 ); + inline Hook* hook () const; + inline HookElement* next () const; + inline void setHook ( Hook* ); + inline void setNext ( HookElement* ); + inline unsigned long flags () const; + inline HookElement& setFlags ( unsigned long mask ); + inline HookElement& resetFlags ( unsigned long mask ); + inline bool issetFlags ( unsigned long mask ) const; + private: + Hook* _hook; + HookElement* _next; + unsigned long _flags; + }; + + + inline HookElement::HookElement ( Hook* hook, unsigned long flags ) : _hook(hook), _next(NULL), _flags(flags) { } + inline Hook* HookElement::hook () const { return _hook; } + inline HookElement* HookElement::next () const { return _next; } + inline void HookElement::setHook ( Hook* hook ) { _hook = hook; } + inline void HookElement::setNext ( HookElement* element ) { _next = element; } + inline unsigned long HookElement::flags () const { return _flags; } + inline HookElement& HookElement::setFlags ( unsigned long mask ) { _flags |= mask; return *this; } + inline HookElement& HookElement::resetFlags ( unsigned long mask ) { _flags &= ~mask; return *this; } + inline bool HookElement::issetFlags ( unsigned long mask ) const { return _flags & mask; } + + + typedef map HookLut; + + +// ------------------------------------------------------------------- +// Class : "JsonNet". + + class JsonNet : public JsonEntity { + public: + static bool hookFromString ( std::string s, unsigned int& id, std::string& tname ); + static void initialize (); + JsonNet ( unsigned long flags ); + virtual ~JsonNet (); + virtual string getTypeName () const; + virtual JsonNet* clone ( unsigned long ) const; + virtual void toData ( JsonStack& ); + void addHookLink ( Hook*, unsigned int jsonId, const std::string& jsonNext ); + Hook* getHook ( unsigned int jsonId, const std::string& tname ) const; + bool checkRings () const; + void buildRings () const; + inline void clearHookLinks (); + protected: + bool _autoMaterialize; + Net* _net; + HookLut _hooks; + }; + + + inline void JsonNet::clearHookLinks () { _hooks.clear(); } + + +} // Hurricane namespace. // ------------------------------------------------------------------- @@ -273,6 +369,7 @@ inline std::string getString case Hurricane::Net::Type::CLOCK: return "CLOCK"; case Hurricane::Net::Type::POWER: return "POWER"; case Hurricane::Net::Type::GROUND: return "GROUND"; + case Hurricane::Net::Type::BLOCKAGE: return "BLOCKAGE"; } return "ABNORMAL"; } @@ -346,5 +443,5 @@ namespace Hurricane { // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/NetAlias.h b/hurricane/src/hurricane/hurricane/NetAlias.h index 655239d8..cc094354 100644 --- a/hurricane/src/hurricane/hurricane/NetAlias.h +++ b/hurricane/src/hurricane/hurricane/NetAlias.h @@ -1,6 +1,6 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2015-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2015-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -60,6 +60,7 @@ namespace Hurricane { void attach ( NetAliasHook* ); void detach (); void detachAll (); + inline void toJson ( JsonWriter* ) const; virtual std::string _getString () const = 0; virtual Record* _getRecord () const; public: @@ -109,6 +110,7 @@ namespace Hurricane { virtual bool isSlave () const; virtual Name getName () const; virtual Net* getNet () const; + virtual void toJson ( JsonWriter* ) const; virtual std::string _getString () const; virtual Record* _getRecord () const; public: @@ -181,11 +183,30 @@ namespace Hurricane { { } +// ------------------------------------------------------------------- +// Class : "JsonNetAlias". + + class JsonNetAlias : public JsonObject { + public: + static void initialize (); + JsonNetAlias ( unsigned long flags ); + virtual string getTypeName () const; + virtual JsonNetAlias* clone ( unsigned long ) const; + virtual void toData ( JsonStack& ); + }; + + } // Namespace Hurricane. INSPECTOR_P_SUPPORT(Hurricane::NetAliasHook); INSPECTOR_P_SUPPORT(Hurricane::NetMainName); INSPECTOR_P_SUPPORT(Hurricane::NetAliasName); + +inline void jsonWrite ( JsonWriter* w, const Hurricane::NetAliasHook* alias ) +{ + const Hurricane::NetAliasName* aliasName = dynamic_cast( alias ); + if (aliasName) jsonWrite(w,aliasName); +} #endif // HURRICANE_NET_ALIAS_H diff --git a/hurricane/src/hurricane/hurricane/NetExternalComponents.h b/hurricane/src/hurricane/hurricane/NetExternalComponents.h index 5836812a..c876bea6 100644 --- a/hurricane/src/hurricane/hurricane/NetExternalComponents.h +++ b/hurricane/src/hurricane/hurricane/NetExternalComponents.h @@ -1,6 +1,6 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -38,12 +38,15 @@ namespace Hurricane { +// ------------------------------------------------------------------- +// Class : "NetExternalComponents". class NetExternalComponents { public: static Components get ( const Net* ); static void setExternal ( Component* ); static bool isExternal ( Component* ); + static void toJson ( JsonWriter*, const Net* ); protected: static StandardRelation* getRelation ( const Net* ); private: @@ -51,6 +54,20 @@ namespace Hurricane { }; +// ------------------------------------------------------------------- +// Class : "JsonNetExternalComponents". + + class JsonNetExternalComponents : public JsonBaseArray { + public: + static void initialize (); + JsonNetExternalComponents ( unsigned long flags ); + virtual ~JsonNetExternalComponents (); + virtual string getTypeName () const; + virtual JsonNetExternalComponents* clone ( unsigned long ) const; + virtual void toData ( JsonStack& ); + }; + + } // Hurricane namespace. #endif // HURRICANE_NET_EXTERNAL_COMPONENTS_H diff --git a/hurricane/src/hurricane/hurricane/NetRoutingProperty.h b/hurricane/src/hurricane/hurricane/NetRoutingProperty.h index 3635ec4f..6af5ea89 100644 --- a/hurricane/src/hurricane/hurricane/NetRoutingProperty.h +++ b/hurricane/src/hurricane/hurricane/NetRoutingProperty.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2014-2015, All Rights Reserved +// Copyright (c) UPMC 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -46,8 +46,9 @@ namespace Hurricane { , MixedPreRoute = Fixed|ManualGlobalRoute }; public: - inline bool isUnconnected () const; + inline bool isExcluded () const; inline bool isFixed () const; + inline bool isUnconnected () const; inline bool isManualGlobalRoute () const; inline bool isAutomaticGlobalRoute () const; inline bool isMixedPreRoute () const; @@ -69,8 +70,9 @@ namespace Hurricane { inline NetRoutingState::NetRoutingState ( Net* net, unsigned int flags ) : _net(net), _flags(flags) { } - inline bool NetRoutingState::isUnconnected () const { return _flags & Unconnected; }; + inline bool NetRoutingState::isExcluded () const { return _flags & Excluded; }; inline bool NetRoutingState::isFixed () const { return _flags & Fixed; }; + inline bool NetRoutingState::isUnconnected () const { return _flags & Unconnected; }; inline bool NetRoutingState::isManualGlobalRoute () const { return _flags & ManualGlobalRoute; }; inline bool NetRoutingState::isAutomaticGlobalRoute () const { return _flags & AutomaticGlobalRoute; }; inline bool NetRoutingState::isMixedPreRoute () const { return _flags & MixedPreRoute; }; @@ -94,6 +96,8 @@ namespace Hurricane { virtual Name getName () const; inline NetRoutingState* getState (); virtual void onReleasedBy ( DBo* owner ); + virtual bool hasJson () const; + virtual void toJson ( JsonWriter*, const DBo* ) const; virtual std::string _getTypeName () const; virtual std::string _getString () const; virtual Record* _getRecord () const; @@ -111,6 +115,19 @@ namespace Hurricane { inline NetRoutingState* NetRoutingProperty::getState () { return &_state; } +// ------------------------------------------------------------------- +// Class : "Hurricane::JsonNetRoutingProperty". + + class JsonNetRoutingProperty : public JsonObject { + public: + static void initialize (); + JsonNetRoutingProperty ( unsigned long ); + virtual std::string getTypeName () const; + virtual JsonNetRoutingProperty* clone ( unsigned long ) const; + virtual void toData ( JsonStack& ); + }; + + // ------------------------------------------------------------------- // Class : "Hurricane::NetRoutingExtension". diff --git a/hurricane/src/hurricane/hurricane/Nets.h b/hurricane/src/hurricane/hurricane/Nets.h index 0aa91532..e583887e 100644 --- a/hurricane/src/hurricane/hurricane/Nets.h +++ b/hurricane/src/hurricane/hurricane/Nets.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Nets.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -75,5 +75,5 @@ typedef GenericFilter NetFilter; // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Observer.h b/hurricane/src/hurricane/hurricane/Observer.h index 00bdad09..86190807 100644 --- a/hurricane/src/hurricane/hurricane/Observer.h +++ b/hurricane/src/hurricane/hurricane/Observer.h @@ -1,7 +1,7 @@ // -*- mode: C++; explicit-buffer-name: "Observer.h" -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/hurricane/src/hurricane/hurricane/Occurrence.h b/hurricane/src/hurricane/hurricane/Occurrence.h index 0a477269..7834c4b9 100644 --- a/hurricane/src/hurricane/hurricane/Occurrence.h +++ b/hurricane/src/hurricane/hurricane/Occurrence.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Occurrence.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -32,9 +32,8 @@ class Quark; class BasicLayer; - // **************************************************************************************************** -// Occurente declaration +// Occurrence declaration // **************************************************************************************************** class Occurrence { @@ -98,6 +97,7 @@ class Occurrence { public: string _getTypeName() const { return _TName("Occurrence"); }; public: string _getString() const; public: string getCompactString() const; + public: void toJson(JsonWriter*) const; public: Record* _getRecord() const; public: SharedPath* _getSharedPath() const {return _sharedPath;}; public: Quark* _getQuark() const; @@ -105,6 +105,20 @@ class Occurrence { }; +// **************************************************************************************************** +// JsonOccurrence declaration +// **************************************************************************************************** + + +class JsonOccurrence : public JsonObject { +// ********************************** + + public: static void initialize(); + public: JsonOccurrence(unsigned long); + public: virtual string getTypeName() const; + public: virtual JsonOccurrence* clone(unsigned long) const; + public: virtual void toData(JsonStack&); +}; } // End of Hurricane namespace. @@ -116,5 +130,5 @@ INSPECTOR_PV_SUPPORT(Hurricane::Occurrence); // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Occurrences.h b/hurricane/src/hurricane/hurricane/Occurrences.h index 63066de3..bd81d5d9 100644 --- a/hurricane/src/hurricane/hurricane/Occurrences.h +++ b/hurricane/src/hurricane/hurricane/Occurrences.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Occurrences.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -72,5 +72,5 @@ typedef GenericFilter OccurrenceFilter; // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Pad.h b/hurricane/src/hurricane/hurricane/Pad.h index 0a72e0f5..f639eb7e 100644 --- a/hurricane/src/hurricane/hurricane/Pad.h +++ b/hurricane/src/hurricane/hurricane/Pad.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Pad.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -73,6 +73,8 @@ class Pad : public Component { // Others // ****** + public: virtual void _toJson(JsonWriter*) const; + public: static JsonObject* getJsonObject(unsigned long flags); public: virtual string _getTypeName() const {return _TName("Pad");}; public: virtual string _getString() const; public: virtual Record* _getRecord() const; @@ -80,6 +82,16 @@ class Pad : public Component { }; +class JsonPad : public JsonComponent { +// *********************************** + + public: static void initialize(); + public: JsonPad(unsigned long flags); + public: virtual string getTypeName() const; + public: virtual JsonPad* clone(unsigned long) const; + public: virtual void toData(JsonStack&); +}; + } // End of Hurricane namespace. @@ -90,5 +102,5 @@ INSPECTOR_P_SUPPORT(Hurricane::Pad); // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Pads.h b/hurricane/src/hurricane/hurricane/Pads.h index 771bb312..8fcffd43 100644 --- a/hurricane/src/hurricane/hurricane/Pads.h +++ b/hurricane/src/hurricane/hurricane/Pads.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Pads.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -72,5 +72,5 @@ typedef GenericFilter PadFilter; // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Path.h b/hurricane/src/hurricane/hurricane/Path.h index 80dca474..c8667cc2 100644 --- a/hurricane/src/hurricane/hurricane/Path.h +++ b/hurricane/src/hurricane/hurricane/Path.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Path.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -97,6 +97,8 @@ class Path { // Others // ****** + public: string getCompactString() const; + public: string getJsonString(unsigned long flags) const; public: string _getTypeName() const { return _TName("Occurrence"); }; public: string _getString() const; public: Record* _getRecord() const; @@ -117,5 +119,5 @@ INSPECTOR_PV_SUPPORT(Hurricane::Path); // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Pathes.h b/hurricane/src/hurricane/hurricane/Pathes.h index 4b2824f2..1afbb199 100644 --- a/hurricane/src/hurricane/hurricane/Pathes.h +++ b/hurricane/src/hurricane/hurricane/Pathes.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Pathes.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -71,5 +71,5 @@ typedef GenericFilter PathFilter; // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Pin.h b/hurricane/src/hurricane/hurricane/Pin.h index 291dd0f7..49ba71b8 100644 --- a/hurricane/src/hurricane/hurricane/Pin.h +++ b/hurricane/src/hurricane/hurricane/Pin.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Pin.h // Authors: C. Alexandre -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -163,5 +163,5 @@ INSPECTOR_PV_SUPPORT(Hurricane::Pin::PlacementStatus); #endif // HURRICANE_PIN // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Pins.h b/hurricane/src/hurricane/hurricane/Pins.h index 37093859..c2e2f6f2 100644 --- a/hurricane/src/hurricane/hurricane/Pins.h +++ b/hurricane/src/hurricane/hurricane/Pins.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Pins.h // Authors: Christophe Alexandre. -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -71,5 +71,5 @@ typedef GenericFilter PinFilter; #endif // HURRICANE_PINS // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Plug.h b/hurricane/src/hurricane/hurricane/Plug.h index 0fac5488..b737e33a 100644 --- a/hurricane/src/hurricane/hurricane/Plug.h +++ b/hurricane/src/hurricane/hurricane/Plug.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Plug.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -103,6 +103,7 @@ class Plug : public Component { protected: virtual void _preDestroy(); public: virtual string getName() const; + public: virtual void _toJson(JsonWriter*) const; public: virtual string _getTypeName() const {return _TName("Plug");}; public: virtual string _getString() const; public: virtual Record* _getRecord() const; @@ -114,6 +115,27 @@ class Plug : public Component { }; +class JsonPlug : public JsonComponent { +// ************************************ + + public: static void initialize(); + public: JsonPlug(unsigned long flags); + public: virtual string getTypeName() const; + public: virtual JsonPlug* clone(unsigned long) const; + public: virtual void toData(JsonStack&); +}; + + +class JsonPlugRef : public JsonObject { +// ************************************ + + public: static void initialize(); + public: JsonPlugRef(unsigned long flags); + public: virtual string getTypeName() const; + public: virtual JsonPlugRef* clone(unsigned long) const; + public: virtual void toData(JsonStack&); +}; + } // End of Hurricane namespace. @@ -124,5 +146,5 @@ INSPECTOR_P_SUPPORT(Hurricane::Plug); // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Plugs.h b/hurricane/src/hurricane/hurricane/Plugs.h index 55e48ff7..574d5023 100644 --- a/hurricane/src/hurricane/hurricane/Plugs.h +++ b/hurricane/src/hurricane/hurricane/Plugs.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Plugs.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -72,5 +72,5 @@ typedef GenericFilter PlugFilter; // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Point.h b/hurricane/src/hurricane/hurricane/Point.h index 72e8f532..ab21bce4 100644 --- a/hurricane/src/hurricane/hurricane/Point.h +++ b/hurricane/src/hurricane/hurricane/Point.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Point.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -25,7 +25,6 @@ namespace Hurricane { - // **************************************************************************************************** // Point declaration // **************************************************************************************************** @@ -83,14 +82,24 @@ class Point { public: string _getTypeName() const { return _TName("Point"); }; public: string _getString() const; public: Record* _getRecord() const; + public: void toJson(JsonWriter*) const; }; +class JsonPoint : public JsonObject { +// ********************************** + + public: static void initialize(); + public: JsonPoint(unsigned long); + public: virtual string getTypeName() const; + public: virtual JsonPoint* clone(unsigned long) const; + public: virtual void toData(JsonStack&); +}; + } // End of Hurricane namespace. - INSPECTOR_PV_SUPPORT(Hurricane::Point); @@ -98,5 +107,5 @@ INSPECTOR_PV_SUPPORT(Hurricane::Point); // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Points.h b/hurricane/src/hurricane/hurricane/Points.h index 31039261..daa8ffea 100644 --- a/hurricane/src/hurricane/hurricane/Points.h +++ b/hurricane/src/hurricane/hurricane/Points.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Points.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -71,5 +71,5 @@ typedef GenericFilter PointFilter; // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Primitives.h b/hurricane/src/hurricane/hurricane/Primitives.h index fb51455a..9405018e 100644 --- a/hurricane/src/hurricane/hurricane/Primitives.h +++ b/hurricane/src/hurricane/hurricane/Primitives.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Primitives.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -72,5 +72,5 @@ typedef GenericFilter PrimitiveFilter; // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Properties.h b/hurricane/src/hurricane/hurricane/Properties.h index b7b9386e..e55bb951 100644 --- a/hurricane/src/hurricane/hurricane/Properties.h +++ b/hurricane/src/hurricane/hurricane/Properties.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Properties.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -72,5 +72,5 @@ typedef GenericFilter PropertyFilter; // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Property.h b/hurricane/src/hurricane/hurricane/Property.h index 97468d50..da90d18a 100644 --- a/hurricane/src/hurricane/hurricane/Property.h +++ b/hurricane/src/hurricane/hurricane/Property.h @@ -1,7 +1,6 @@ - // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -19,12 +18,7 @@ // License along with Hurricane. If not, see // . // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | H U R R I C A N E | // | V L S I B a c k e n d D a t a - B a s e | // | | @@ -32,14 +26,11 @@ // | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Header : "./hurricane/Property.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ -#ifndef __HURRICANE_PROPERTY__ -#define __HURRICANE_PROPERTY__ +#ifndef HURRICANE_PROPERTY_H +#define HURRICANE_PROPERTY_H #include "hurricane/Name.h" #include "hurricane/Properties.h" @@ -53,6 +44,13 @@ namespace Hurricane { extern const char* propertyTypeNameError; +// ------------------------------------------------------------------- +// Classes : template enable/disable Json support. + + struct JsonEnabled { enum State { enabled=1 }; }; + struct JsonDisabled { enum State { enabled=0 }; }; + + // ------------------------------------------------------------------- // Class : "Hurricane::Property". @@ -76,6 +74,8 @@ namespace Hurricane { virtual void onCapturedBy ( DBo* owner ) = 0; virtual void onReleasedBy ( DBo* owner ) = 0; // Hurricane Managment. + virtual bool hasJson () const; + virtual void toJson ( JsonWriter*, const DBo* ) const; virtual string _getTypeName () const = 0; virtual string _getString () const; virtual Record* _getRecord () const; @@ -160,8 +160,8 @@ namespace Hurricane { // Template Class : "Hurricane::StandardPrivateProperty". - template class StandardPrivateProperty : public PrivateProperty { - + template + class StandardPrivateProperty : public PrivateProperty { public: static Name staticGetName (); static Value* staticGetValue ( const DBo* ); @@ -173,49 +173,99 @@ namespace Hurricane { virtual Name getName () const; Value& getValue () const; void setValue ( const Value& ); + virtual bool hasJson () const; + virtual void toJson ( JsonWriter*, const DBo* ) const; virtual string _getTypeName () const; virtual string _getString () const; virtual Record* _getRecord () const; - private: // Internal: Attributes. static Name _name; static DBo* _owner; static StandardPrivateProperty* _cache; mutable Value _value; - protected: // Internal: Constructor. StandardPrivateProperty (); StandardPrivateProperty ( const Value& ); + public: + class JsonProperty : public JsonObject { + public: + static void initialize (); + JsonProperty ( unsigned long flags ); + virtual string getTypeName () const; + virtual JsonProperty* clone ( unsigned long ) const; + virtual void toData ( JsonStack& ); + }; }; - template - DBo* StandardPrivateProperty::_owner = NULL; + template + StandardPrivateProperty::JsonProperty::JsonProperty ( unsigned long flags ) + : JsonObject(flags) + { + if (flags & JsonWriter::RegisterMode) + cerr << "Registering JsonProperty" << endl; + add( "_value", typeid(Value) ); + } - template - StandardPrivateProperty* StandardPrivateProperty::_cache = NULL; + template + string StandardPrivateProperty::JsonProperty::getTypeName () const + { return getString(StandardPrivateProperty::staticGetName()); } - template - Name StandardPrivateProperty::staticGetName () + template + void StandardPrivateProperty::JsonProperty::initialize () + { JsonTypes::registerType( new JsonProperty (JsonWriter::RegisterMode) ); } + + + template + typename StandardPrivateProperty::JsonProperty* + StandardPrivateProperty::JsonProperty::clone ( unsigned long flags ) const + { return new JsonProperty ( flags ); } + + + template + void StandardPrivateProperty::JsonProperty::toData ( JsonStack& stack ) + { + check( stack, "JsonProperty::toData" ); + + DBo* dbo = stack.back_dbo(); + Value value = get(stack,"_value"); + StandardPrivateProperty* property + = StandardPrivateProperty::create(value); + if (dbo) dbo->put( property ); + + update( stack, property ); + } + + + template + DBo* StandardPrivateProperty::_owner = NULL; + + + template + StandardPrivateProperty* StandardPrivateProperty::_cache = NULL; + + + template + Name StandardPrivateProperty::staticGetName () { return _name; } - template - Value* StandardPrivateProperty::staticGetValue ( const DBo* object ) + template + Value* StandardPrivateProperty::staticGetValue ( const DBo* object ) { if ( ( object == _owner ) || get(object) ) return _cache->getValue(); return NULL; } - template - StandardPrivateProperty* StandardPrivateProperty::create () + template + StandardPrivateProperty* StandardPrivateProperty::create () { _cache = new StandardPrivateProperty(); _cache->_postCreate(); @@ -223,8 +273,8 @@ namespace Hurricane { } - template - StandardPrivateProperty* StandardPrivateProperty::create ( const Value& value ) + template + StandardPrivateProperty* StandardPrivateProperty::create ( const Value& value ) { _cache = new StandardPrivateProperty(value); _cache->_postCreate(); @@ -232,8 +282,8 @@ namespace Hurricane { } - template - StandardPrivateProperty* StandardPrivateProperty::get ( const DBo* object, bool create ) + template + StandardPrivateProperty* StandardPrivateProperty::get ( const DBo* object, bool create ) { if ( object == _owner ) return _cache; @@ -253,60 +303,79 @@ namespace Hurricane { } - template - StandardPrivateProperty::StandardPrivateProperty () + template + StandardPrivateProperty::StandardPrivateProperty () : PrivateProperty(), _value() { } - template - StandardPrivateProperty::StandardPrivateProperty ( const Value& value ) + template + StandardPrivateProperty::StandardPrivateProperty ( const Value& value ) : PrivateProperty(), _value(value) { } - template - Name StandardPrivateProperty::getName() const + template + Name StandardPrivateProperty::getName() const { return staticGetName(); } - template - Value& StandardPrivateProperty::getValue () const + template + Value& StandardPrivateProperty::getValue () const { return _value; } - template - void StandardPrivateProperty::setValue ( const Value& value ) + template + void StandardPrivateProperty::setValue ( const Value& value ) { _value = value; } - template - string StandardPrivateProperty::_getTypeName () const + template + bool StandardPrivateProperty::hasJson () const + { + return JsonState::enabled; + } + + + template + void StandardPrivateProperty::toJson ( JsonWriter* w, const DBo* ) const + { + w->startObject(); + std::string tname = getString(staticGetName()); + jsonWrite( w, "@typename", tname ); + jsonWrite( w, "_value", _value ); + w->endObject(); + } + + + template + string StandardPrivateProperty::_getTypeName () const { return _TName("StandardPrivateProperty"); } - template - string StandardPrivateProperty::_getString () const + template + string StandardPrivateProperty::_getString () const { string s = PrivateProperty::_getString(); s.insert(s.length() - 1, " " + getString(_value)); return s; } - template - Record* StandardPrivateProperty::_getRecord () const + template + Record* StandardPrivateProperty::_getRecord () const { Record* record = PrivateProperty::_getRecord(); if (record) { - record->add ( getSlot("Name" , staticGetName()) ); - record->add ( getSlot("Value",&_value) ); + record->add ( getSlot("_name" , staticGetName()) ); + record->add ( getSlot("_value" ,&_value) ); + record->add ( getSlot("JSON support", JsonState::enabled) ); } return record; } @@ -317,33 +386,51 @@ namespace Hurricane { class SharedProperty : public Property { - - public: - // Types. - typedef set DBoSet; - // Methods. - inline DBos getOwners () const; - virtual void onCapturedBy ( DBo* owner ); - virtual void onReleasedBy ( DBo* owner ); - virtual void onNotOwned (); - inline DBoSet& _getOwnerSet (); - virtual string _getString () const; - virtual Record* _getRecord () const; - private: - // Internal: Attributes. - DBoSet _ownerSet; - + class Orphaned { + public: + inline Orphaned ( SharedProperty* ); + public: + SharedProperty* _property; + unsigned int _refcount; + unsigned int _count; + }; + public: + typedef set DBoSet; + typedef map OrphanedMap; + public: + static const OrphanedMap& getOrphaneds (); + static SharedProperty* getOrphaned ( const string& ); + static void addOrphaned ( const string&, SharedProperty* ); + static void refOrphaned ( const string& ); + static void countOrphaned ( const string&, unsigned int ); + static void removeOrphaned ( const string& ); + static void clearOrphaneds (); + public: + inline DBos getOwners () const; + virtual void onCapturedBy ( DBo* owner ); + virtual void onReleasedBy ( DBo* owner ); + virtual void onNotOwned (); + inline DBoSet& _getOwnerSet (); + virtual string _getString () const; + virtual Record* _getRecord () const; + private: + static OrphanedMap _orphaneds; + private: + DBoSet _ownerSet; protected: - // Internal: Constructor & Destructor. SharedProperty (); virtual void _preDestroy (); }; // Inline Functions. - DBos SharedProperty::getOwners () const { return getCollection(_ownerSet); } - SharedProperty::DBoSet& SharedProperty::_getOwnerSet () { return _ownerSet; } + inline SharedProperty::Orphaned::Orphaned ( SharedProperty* property ) + : _property(property), _refcount(0), _count(0) + { } + + inline DBos SharedProperty::getOwners () const { return getCollection(_ownerSet); } + inline SharedProperty::DBoSet& SharedProperty::_getOwnerSet () { return _ownerSet; } // ------------------------------------------------------------------- @@ -505,10 +592,10 @@ namespace Hurricane { } -} // End of Hurricane namespace. +} // Hurricane namespace. INSPECTOR_P_SUPPORT(Hurricane::Property); -#endif // __HURRICANE_PROPERTY__ +#endif // HURRICANE_PROPERTY_H diff --git a/hurricane/src/hurricane/hurricane/QuadTree.h b/hurricane/src/hurricane/hurricane/QuadTree.h index 75ba623d..2dd513f9 100644 --- a/hurricane/src/hurricane/hurricane/QuadTree.h +++ b/hurricane/src/hurricane/hurricane/QuadTree.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/QuadTree.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -134,5 +134,5 @@ INSPECTOR_P_SUPPORT(Hurricane::QuadTree::GoSet); // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Quark.h b/hurricane/src/hurricane/hurricane/Quark.h index 5e6736a5..01145880 100644 --- a/hurricane/src/hurricane/hurricane/Quark.h +++ b/hurricane/src/hurricane/hurricane/Quark.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Quark.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -84,5 +84,5 @@ INSPECTOR_P_SUPPORT(Hurricane::Quark); // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Quarks.h b/hurricane/src/hurricane/hurricane/Quarks.h index 5bf5c4d0..30eed780 100644 --- a/hurricane/src/hurricane/hurricane/Quarks.h +++ b/hurricane/src/hurricane/hurricane/Quarks.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Quarks.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -72,5 +72,5 @@ typedef GenericFilter QuarkFilter; // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Query.h b/hurricane/src/hurricane/hurricane/Query.h index 5cac52d8..135dca32 100644 --- a/hurricane/src/hurricane/hurricane/Query.h +++ b/hurricane/src/hurricane/hurricane/Query.h @@ -1,6 +1,6 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -210,7 +210,8 @@ namespace Hurricane { instance->getTransformation().getInvert().applyOn ( child->_area ); parent->_transformation.applyOn ( child->_transformation ); - child->_path = Path ( Path(parent->_path,instance->getCell()->getShuntedPath()) , instance ); + //child->_path = Path ( Path(parent->_path,instance->getCell()->getShuntedPath()) , instance ); + child->_path = Path ( parent->_path, instance ); } diff --git a/hurricane/src/hurricane/hurricane/Record.h b/hurricane/src/hurricane/hurricane/Record.h index 7b9446a4..94d29590 100644 --- a/hurricane/src/hurricane/hurricane/Record.h +++ b/hurricane/src/hurricane/hurricane/Record.h @@ -1,6 +1,6 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // diff --git a/hurricane/src/hurricane/hurricane/Reference.h b/hurricane/src/hurricane/hurricane/Reference.h index af04e533..edaf069d 100644 --- a/hurricane/src/hurricane/hurricane/Reference.h +++ b/hurricane/src/hurricane/hurricane/Reference.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Reference.h // Authors: J.-P. Chaput -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -87,5 +87,5 @@ class Reference : public Marker { // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/References.h b/hurricane/src/hurricane/hurricane/References.h index 4c2477cc..822233d4 100644 --- a/hurricane/src/hurricane/hurricane/References.h +++ b/hurricane/src/hurricane/hurricane/References.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/References.h // Authors: J.-P. Chaput -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -72,5 +72,5 @@ typedef GenericFilter ReferenceFilter; // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Region.h b/hurricane/src/hurricane/hurricane/Region.h index a411ed23..681fbd15 100644 --- a/hurricane/src/hurricane/hurricane/Region.h +++ b/hurricane/src/hurricane/hurricane/Region.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Region.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -239,5 +239,5 @@ class Region { // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/RegularLayer.h b/hurricane/src/hurricane/hurricane/RegularLayer.h index 3cfe256e..cea1a2d1 100644 --- a/hurricane/src/hurricane/hurricane/RegularLayer.h +++ b/hurricane/src/hurricane/hurricane/RegularLayer.h @@ -1,7 +1,7 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -39,8 +39,12 @@ namespace Hurricane { +// ------------------------------------------------------------------- +// Class : "Hurricane::RegularLayer". class RegularLayer : public Layer { + public: + typedef Layer Super; public: // Constructor. @@ -66,6 +70,7 @@ namespace Hurricane { virtual void setExtentionCap ( const BasicLayer* layer, DbU::Unit cap ); virtual void setExtentionWidth ( const BasicLayer* layer, DbU::Unit width ); // Hurricane Managment. + virtual void _toJson ( JsonWriter* ) const; virtual void _onDbuChange ( float scale ); virtual string _getTypeName () const; virtual string _getString () const; @@ -90,6 +95,20 @@ namespace Hurricane { inline BasicLayer* RegularLayer::getBasicLayer () const { return _basicLayer; } +// ------------------------------------------------------------------- +// Class : "Hurricane::JsonRegularLayer". + + class JsonRegularLayer : public JsonLayer { + public: + static void initialize (); + JsonRegularLayer ( unsigned long flags ); + ~JsonRegularLayer (); + virtual string getTypeName () const; + virtual JsonRegularLayer* clone ( unsigned long ) const; + virtual void toData ( JsonStack& ); + }; + + } // Hurricane namespace. INSPECTOR_P_SUPPORT(Hurricane::RegularLayer); diff --git a/hurricane/src/hurricane/hurricane/RegularLayers.h b/hurricane/src/hurricane/hurricane/RegularLayers.h index e908b226..1f0fb142 100644 --- a/hurricane/src/hurricane/hurricane/RegularLayers.h +++ b/hurricane/src/hurricane/hurricane/RegularLayers.h @@ -1,7 +1,7 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // diff --git a/hurricane/src/hurricane/hurricane/Relation.h b/hurricane/src/hurricane/hurricane/Relation.h index cfe4623b..871a68bf 100644 --- a/hurricane/src/hurricane/hurricane/Relation.h +++ b/hurricane/src/hurricane/hurricane/Relation.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Relation.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -62,6 +62,7 @@ class Relation : public SharedProperty { // Others // ****** + public: void _setMasterOwner(DBo* owner) {_masterOwner=owner; } protected: virtual void _postCreate(); public: virtual string _getTypeName() const {return _TName("Relation");}; @@ -118,5 +119,5 @@ class StandardRelation : public Relation { // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/RoutingPad.h b/hurricane/src/hurricane/hurricane/RoutingPad.h index 9c54bc32..5be79d4b 100644 --- a/hurricane/src/hurricane/hurricane/RoutingPad.h +++ b/hurricane/src/hurricane/hurricane/RoutingPad.h @@ -1,7 +1,6 @@ - // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2013, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -19,10 +18,6 @@ // License along with Hurricane. If not, see // . // -// =================================================================== -// -// $Id$ -// // +-----------------------------------------------------------------+ // | H U R R I C A N E | // | V L S I B a c k e n d D a t a - B a s e | @@ -47,6 +42,9 @@ namespace Hurricane { class Segment; +// ------------------------------------------------------------------- +// Class : "RoutingPad". + class RoutingPad : public Component { public: typedef Component Inherit; @@ -85,6 +83,7 @@ namespace Hurricane { // Miscellaeous. Component* _getEntityAsComponent () const; Segment* _getEntityAsSegment () const; + virtual void _toJson ( JsonWriter* ) const; virtual std::string _getTypeName () const {return _TName("RoutingPad");}; virtual std::string _getString () const; virtual Record* _getRecord () const; @@ -99,6 +98,18 @@ namespace Hurricane { }; +// ------------------------------------------------------------------- +// Class : "JsonRoutingPad". + + class JsonRoutingPad : public JsonComponent { + public: + static void initialize (); + JsonRoutingPad ( unsigned long flags ); + virtual std::string getTypeName () const; + virtual JsonRoutingPad* clone ( unsigned long flags ) const; + virtual void toData ( JsonStack& ); + }; + } // End of Hurricane namespace. diff --git a/hurricane/src/hurricane/hurricane/RoutingPads.h b/hurricane/src/hurricane/hurricane/RoutingPads.h index daca738c..13e80d7d 100644 --- a/hurricane/src/hurricane/hurricane/RoutingPads.h +++ b/hurricane/src/hurricane/hurricane/RoutingPads.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/RoutingPads.h // Authors: H.Clement M.Sroka -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -72,5 +72,5 @@ typedef GenericFilter RoutingPadFilter; // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Rubber.h b/hurricane/src/hurricane/hurricane/Rubber.h index 53b1007a..fb91454c 100644 --- a/hurricane/src/hurricane/hurricane/Rubber.h +++ b/hurricane/src/hurricane/hurricane/Rubber.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Rubber.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -115,5 +115,5 @@ INSPECTOR_P_SUPPORT(Hurricane::Rubber); // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Rubbers.h b/hurricane/src/hurricane/hurricane/Rubbers.h index bb17f9f4..b1fa36b9 100644 --- a/hurricane/src/hurricane/hurricane/Rubbers.h +++ b/hurricane/src/hurricane/hurricane/Rubbers.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Rubbers.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -72,5 +72,5 @@ typedef GenericFilter RubberFilter; // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Segment.h b/hurricane/src/hurricane/hurricane/Segment.h index 9632fa3c..6223db13 100644 --- a/hurricane/src/hurricane/hurricane/Segment.h +++ b/hurricane/src/hurricane/hurricane/Segment.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Segment.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -26,7 +26,6 @@ namespace Hurricane { - // **************************************************************************************************** // Segment declaration // **************************************************************************************************** @@ -52,8 +51,9 @@ class Segment : public Component { public: virtual bool isMaster() const {return false;}; - public: virtual string _getTypeName() const { return _TName("Segment::SourceHook"); }; + public: virtual string _getTypeName() const { return "Segment::SourceHook"; }; public: virtual string _getString() const; + public: static Hook* _compToHook(Component*); }; public: class TargetHook : public Hook { @@ -69,8 +69,9 @@ class Segment : public Component { public: virtual bool isMaster() const {return false;}; - public: virtual string _getTypeName() const { return _TName("Segment::TargetHook"); }; + public: virtual string _getTypeName() const { return "Segment::TargetHook"; }; public: virtual string _getString() const; + public: static Hook* _compToHook(Component*); }; // Attributes @@ -127,12 +128,24 @@ class Segment : public Component { protected: virtual void _preDestroy(); + public: virtual void _toJson(JsonWriter*) const; public: virtual string _getString() const; public: virtual Record* _getRecord() const; }; +// **************************************************************************************************** +// JsonSegment declaration +// **************************************************************************************************** + +class JsonSegment : public JsonComponent { +// *************************************** + + public: JsonSegment(unsigned long flags); +}; + + } // End of Hurricane namespace. @@ -145,5 +158,5 @@ INSPECTOR_P_SUPPORT(Hurricane::Segment::TargetHook); // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Segments.h b/hurricane/src/hurricane/hurricane/Segments.h index f7343ae9..ae67752c 100644 --- a/hurricane/src/hurricane/hurricane/Segments.h +++ b/hurricane/src/hurricane/hurricane/Segments.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Segments.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -72,5 +72,5 @@ typedef GenericFilter SegmentFilter; // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Selectors.h b/hurricane/src/hurricane/hurricane/Selectors.h index 56de3727..cdfeb8e0 100644 --- a/hurricane/src/hurricane/hurricane/Selectors.h +++ b/hurricane/src/hurricane/hurricane/Selectors.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Selectors.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -72,5 +72,5 @@ typedef GenericFilter SelectorFilter; // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/SetCollection.h b/hurricane/src/hurricane/hurricane/SetCollection.h index 47137174..241d03ab 100644 --- a/hurricane/src/hurricane/hurricane/SetCollection.h +++ b/hurricane/src/hurricane/hurricane/SetCollection.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/SetCollection.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -223,5 +223,5 @@ template // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/SharedName.h b/hurricane/src/hurricane/hurricane/SharedName.h index 9eaf5f1f..0d8d14cd 100644 --- a/hurricane/src/hurricane/hurricane/SharedName.h +++ b/hurricane/src/hurricane/hurricane/SharedName.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/SharedName.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -74,5 +74,5 @@ INSPECTOR_P_SUPPORT(Hurricane::SharedName); // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/SharedPath.h b/hurricane/src/hurricane/hurricane/SharedPath.h index 3f2619a2..84770b50 100644 --- a/hurricane/src/hurricane/hurricane/SharedPath.h +++ b/hurricane/src/hurricane/hurricane/SharedPath.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/SharedPath.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -97,6 +97,7 @@ class SharedPath { public: SharedPath* getHeadSharedPath() const; public: Instance* getTailInstance() const; public: string getName() const; + public: string getJsonString(unsigned long flags) const; public: Cell* getOwnerCell() const; public: Cell* getMasterCell() const; public: Instances getInstances() const; @@ -136,5 +137,5 @@ INSPECTOR_P_SUPPORT(Hurricane::SharedPath); // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/SharedPathes.h b/hurricane/src/hurricane/hurricane/SharedPathes.h index 2de17773..90237fc7 100644 --- a/hurricane/src/hurricane/hurricane/SharedPathes.h +++ b/hurricane/src/hurricane/hurricane/SharedPathes.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/SharedPathes.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -72,5 +72,5 @@ typedef GenericFilter SharedPathFilter; // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Signature.h b/hurricane/src/hurricane/hurricane/Signature.h new file mode 100644 index 00000000..e4c1140c --- /dev/null +++ b/hurricane/src/hurricane/hurricane/Signature.h @@ -0,0 +1,150 @@ +// -*- C++ -*- +// +// Copyright (c) BULL S.A. 2015-2016, All Rights Reserved +// +// This file is part of Hurricane. +// +// Hurricane is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// Hurricane is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- +// TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU +// General Public License for more details. +// +// You should have received a copy of the Lesser GNU General Public +// License along with Hurricane. If not, see +// . +// +// +-----------------------------------------------------------------+ +// | H U R R I C A N E | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Authors : Jean-Paul Chaput | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./hurricane/Signature.h" | +// +-----------------------------------------------------------------+ + + +#ifndef HURRICANE_SIGNATURE_H +#define HURRICANE_SIGNATURE_H + +#include "hurricane/DbU.h" + + +namespace Hurricane { + + class Layer; + + +// ------------------------------------------------------------------- +// Class : "Signature". + + class Signature { + public: + enum Type { TypeContact = 1 + , TypeVertical = 2 + , TypeHorizontal = 3 + , TypePad = 4 + , TypePlug = 5 + , TypeNet = 6 + , TypeInstance = 7 + }; + enum DimContacts { ContactDx = 0 + , ContactDy = 1 + , ContactWidth = 2 + , ContactHeight = 3 + }; + enum DimVertical { VerticalWidth = 0 + , VerticalX = 1 + , VerticalDySource = 2 + , VerticalDyTarget = 3 + }; + enum DimHorizontal { HorizontalWidth = 0 + , HorizontalY = 1 + , HorizontalDxSource = 2 + , HorizontalDxTarget = 3 + }; + enum DimPad { PadXMin = 0 + , PadYMin = 1 + , PadXMax = 2 + , PadYMax = 3 + }; + public: + inline Signature (); + inline Signature ( const Signature& ); + inline Type getType () const; + inline std::string getName () const; + inline std::string getMasterNet () const; + inline const Layer* getLayer () const; + inline DbU::Unit getDim ( size_t index ) const; + inline void setType ( Type ); + inline void setName ( const std::string& ); + inline void setMasterNet ( const std::string& ); + void setLayer ( const std::string& ); + inline void setDim ( size_t index, DbU::Unit ); + private: + // Attributes. + Type _type; + std::string _name; // For Cell, Instance & Net. + std::string _masterNet; // For Plug. + const Layer* _layer; // For Components (save Plug). + DbU::Unit _dims[4]; // Dimensions. + }; + + + inline Signature::Signature () + : _type () + , _name () + , _masterNet() + , _layer (NULL) + { + for ( size_t i=0 ; i<4 ; ++i ) _dims[i] = 0; + } + + + inline Signature::Signature ( const Signature& other ) + : _type (other._type ) + , _name (other._name ) + , _masterNet(other._masterNet) + , _layer (other._layer ) + { + for ( size_t i=0 ; i<4 ; ++i ) _dims[i] = other._dims[i]; + } + + + inline Signature::Type Signature::getType () const { return _type; } + inline std::string Signature::getName () const { return _name; } + inline std::string Signature::getMasterNet () const { return _masterNet; } + inline const Layer* Signature::getLayer () const { return _layer; } + inline DbU::Unit Signature::getDim ( size_t index ) const { return _dims[index]; } + inline void Signature::setType ( Signature::Type type ) { _type=type; } + inline void Signature::setName ( const std::string& name ) { _name=name; } + inline void Signature::setMasterNet ( const std::string& masterNet ) { _masterNet=masterNet; } + inline void Signature::setDim ( size_t index, DbU::Unit u ) { _dims[index]=u; } + + +// ------------------------------------------------------------------- +// Class : "Signature". + + class JsonSignature : public JsonObject { + public: + static void initialize (); + JsonSignature ( unsigned long flags ); + void setSubType ( const std::string& ); + virtual std::string getTypeName () const; + virtual JsonSignature* clone ( unsigned long flags ) const; + virtual void toData ( JsonStack& ); + private: + JsonSignature ( const JsonSignature& ); + JsonSignature& operator= ( const JsonSignature& ) const; + private: + std::string _subTypeName; + }; + +} // End of Hurricane namespace. + +#endif // HURRICANE_SIGNATURE_H diff --git a/hurricane/src/hurricane/hurricane/Slice.h b/hurricane/src/hurricane/hurricane/Slice.h index 5a698dac..a2854509 100644 --- a/hurricane/src/hurricane/hurricane/Slice.h +++ b/hurricane/src/hurricane/hurricane/Slice.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Slice.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -111,5 +111,5 @@ INSPECTOR_P_SUPPORT(Hurricane::Slice); // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Slices.h b/hurricane/src/hurricane/hurricane/Slices.h index fd75944d..a318f8da 100644 --- a/hurricane/src/hurricane/hurricane/Slices.h +++ b/hurricane/src/hurricane/hurricane/Slices.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Slices.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -72,5 +72,5 @@ typedef GenericFilter SliceFilter; // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Slot.h b/hurricane/src/hurricane/hurricane/Slot.h index d3ff29b8..4349d0d1 100644 --- a/hurricane/src/hurricane/hurricane/Slot.h +++ b/hurricane/src/hurricane/hurricane/Slot.h @@ -1,6 +1,6 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // diff --git a/hurricane/src/hurricane/hurricane/Symbols.h b/hurricane/src/hurricane/hurricane/Symbols.h index 4c10d444..105e3c78 100644 --- a/hurricane/src/hurricane/hurricane/Symbols.h +++ b/hurricane/src/hurricane/hurricane/Symbols.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Symbols.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -72,5 +72,5 @@ typedef GenericFilter SymbolFilter; // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Tabulation.h b/hurricane/src/hurricane/hurricane/Tabulation.h index b3163116..f9df076e 100644 --- a/hurricane/src/hurricane/hurricane/Tabulation.h +++ b/hurricane/src/hurricane/hurricane/Tabulation.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Tabulation.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -20,10 +20,8 @@ #ifndef HURRICANE_TABULATION_H #define HURRICANE_TABULATION_H -#include "hurricane/Commons.h" - -#ifndef HURRICANE_SLOT_H -#error "Tabulation.h must be included after Commons.h" +#ifndef HURRICANE_COMMONS_H +#error "Tabulation.h must be included through Commons.h" #endif namespace Hurricane { @@ -101,5 +99,5 @@ INSPECTOR_PV_SUPPORT(Hurricane::Tabulation); // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Technology.h b/hurricane/src/hurricane/hurricane/Technology.h index 442bd8f1..53313504 100644 --- a/hurricane/src/hurricane/hurricane/Technology.h +++ b/hurricane/src/hurricane/hurricane/Technology.h @@ -1,7 +1,6 @@ - // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -19,12 +18,7 @@ // License along with Hurricane. If not, see // . // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | H U R R I C A N E | // | V L S I B a c k e n d D a t a - B a s e | // | | @@ -32,14 +26,11 @@ // | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Header : "./hurricane/Technology.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ -#ifndef __HURRICANE_TECHNOLOGY__ -#define __HURRICANE_TECHNOLOGY__ +#ifndef HURRICANE_TECHNOLOGY_H +#define HURRICANE_TECHNOLOGY_H #include #include "hurricane/Mask.h" @@ -64,7 +55,6 @@ namespace Hurricane { // ------------------------------------------------------------------- // Class : "Hurricane::Technology". - class Technology : public DBo { public: @@ -120,6 +110,8 @@ namespace Hurricane { inline Layer::Mask& _getMetalMask (); void _onDbuChange ( float scale ); // Hurricane Managment. + virtual void _toJson ( JsonWriter* ) const; + virtual void _toJsonCollections ( JsonWriter* ) const; virtual string _getTypeName () const; virtual string _getString () const; virtual Record* _getRecord () const; @@ -153,10 +145,27 @@ namespace Hurricane { inline Layer::Mask& Technology::_getMetalMask () { return _metalMask; } -} // End of Hurricane namespace. +// ------------------------------------------------------------------- +// Class : "Hurricane::JsonTechnology". + + class JsonTechnology : public JsonDBo { + public: + static void initialize (); + JsonTechnology ( unsigned long flags ); + virtual ~JsonTechnology (); + virtual string getTypeName () const; + virtual JsonTechnology* clone ( unsigned long ) const; + virtual void toData ( JsonStack& ); + void addBlockageRef ( const std::string&, BasicLayer* ); + private: + std::map< string, vector > _blockagesMap; + }; + + +} // Hurricane namespace. INSPECTOR_P_SUPPORT(Hurricane::Technology); -#endif // __HURRICANE_TECHNOLOGY__ +#endif // HURRICANE_TECHNOLOGY_H diff --git a/hurricane/src/hurricane/hurricane/Torus.h b/hurricane/src/hurricane/hurricane/Torus.h index 3a05a74a..f48f0012 100644 --- a/hurricane/src/hurricane/hurricane/Torus.h +++ b/hurricane/src/hurricane/hurricane/Torus.h @@ -1,6 +1,6 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // diff --git a/hurricane/src/hurricane/hurricane/Transformation.h b/hurricane/src/hurricane/hurricane/Transformation.h index 67c8b5bb..2fc58f6f 100644 --- a/hurricane/src/hurricane/hurricane/Transformation.h +++ b/hurricane/src/hurricane/hurricane/Transformation.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Transformation.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -25,7 +25,6 @@ namespace Hurricane { - // **************************************************************************************************** // Transformation declaration // **************************************************************************************************** @@ -45,6 +44,7 @@ class Transformation { public: Orientation(const Code& code = ID); public: Orientation(const Orientation& orientation); + public: Orientation(const string& ); public: Orientation& operator=(const Orientation& orientation); @@ -135,9 +135,19 @@ class Transformation { public: string _getTypeName() const { return _TName("Transformation"); }; public: string _getString() const; public: Record* _getRecord() const; + public: void toJson(JsonWriter*) const; }; +class JsonTransformation : public JsonObject { +// ******************************************* + + public: static void initialize(); + public: JsonTransformation(unsigned long); + public: virtual string getTypeName() const; + public: virtual JsonTransformation* clone(unsigned long) const; + public: virtual void toData(JsonStack&); +}; } // End of Hurricane namespace. @@ -203,10 +213,9 @@ INSPECTOR_PV_SUPPORT(Hurricane::Transformation); INSPECTOR_PV_SUPPORT(Hurricane::Transformation::Orientation); IOSTREAM_POINTER_SUPPORT(Hurricane::Transformation::Orientation::Code); - #endif // HURRICANE_TRANSFORMATION // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/TransistorLayer.h b/hurricane/src/hurricane/hurricane/TransistorLayer.h index 39b9f5fb..6b8361ef 100644 --- a/hurricane/src/hurricane/hurricane/TransistorLayer.h +++ b/hurricane/src/hurricane/hurricane/TransistorLayer.h @@ -1,7 +1,6 @@ - // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -19,27 +18,19 @@ // License along with Hurricane. If not, see // . // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | H U R R I C A N E | // | V L S I B a c k e n d D a t a - B a s e | // | | // | Author : Jean-Paul Chaput | // | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | -// | C++ Header : "./hurricane/TransistorLayer.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// | C++ Header : "./hurricane/TransistorLayer.h" | +// +-----------------------------------------------------------------+ -#ifndef __HURRICANE_TRANSISTOR_LAYER__ -#define __HURRICANE_TRANSISTOR_LAYER__ +#ifndef HURRICANE_TRANSISTOR_LAYER_H +#define HURRICANE_TRANSISTOR_LAYER_H #include @@ -49,8 +40,12 @@ namespace Hurricane { +// ------------------------------------------------------------------- +// Class : "Hurricane::TransistorLayer". class TransistorLayer : public Layer { + public: + typedef Layer Super; public: // Constructor. @@ -71,6 +66,7 @@ namespace Hurricane { virtual void setExtentionCap ( const BasicLayer* layer, DbU::Unit cap ); virtual void setExtentionWidth ( const BasicLayer* layer, DbU::Unit width ); // Hurricane Managment. + virtual void _toJson ( JsonWriter* ) const; virtual void _onDbuChange ( float scale ); virtual string _getTypeName () const; virtual string _getString () const; @@ -96,6 +92,20 @@ namespace Hurricane { }; +// ------------------------------------------------------------------- +// Class : "Hurricane::JsonTransistorLayer". + + class JsonTransistorLayer : public JsonLayer { + public: + static void initialize (); + JsonTransistorLayer ( unsigned long flags ); + ~JsonTransistorLayer (); + virtual string getTypeName () const; + virtual JsonTransistorLayer* clone ( unsigned long ) const; + virtual void toData ( JsonStack& ); + }; + + } // End of Hurricane namespace. diff --git a/hurricane/src/hurricane/hurricane/TransistorLayers.h b/hurricane/src/hurricane/hurricane/TransistorLayers.h index 330ce57e..43549356 100644 --- a/hurricane/src/hurricane/hurricane/TransistorLayers.h +++ b/hurricane/src/hurricane/hurricane/TransistorLayers.h @@ -1,7 +1,7 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // diff --git a/hurricane/src/hurricane/hurricane/UpdateSession.h b/hurricane/src/hurricane/hurricane/UpdateSession.h index da975a4e..d5f159c6 100644 --- a/hurricane/src/hurricane/hurricane/UpdateSession.h +++ b/hurricane/src/hurricane/hurricane/UpdateSession.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/UpdateSession.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -96,5 +96,5 @@ class UpdateSession : public SharedProperty { // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/VectorCollection.h b/hurricane/src/hurricane/hurricane/VectorCollection.h index b2afd38c..3cc3a8d4 100644 --- a/hurricane/src/hurricane/hurricane/VectorCollection.h +++ b/hurricane/src/hurricane/hurricane/VectorCollection.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/VectorCollection.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -213,5 +213,5 @@ template // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Vertical.h b/hurricane/src/hurricane/hurricane/Vertical.h index bb3d6c28..4cc6e222 100644 --- a/hurricane/src/hurricane/hurricane/Vertical.h +++ b/hurricane/src/hurricane/hurricane/Vertical.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Vertical.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -105,6 +105,8 @@ class Vertical : public Segment { // Others // ****** + public: virtual void _toJson(JsonWriter*) const; + public: static JsonObject* getJsonObject(unsigned long flags); public: virtual string _getTypeName() const {return _TName("Vertical");}; public: virtual string _getString() const; public: virtual Record* _getRecord() const; @@ -112,6 +114,16 @@ class Vertical : public Segment { }; +class JsonVertical : public JsonSegment { +// ************************************** + + public: static void initialize(); + public: JsonVertical(unsigned long flags); + public: virtual string getTypeName() const; + public: virtual JsonVertical* clone(unsigned long) const; + public: virtual void toData(JsonStack&); +}; + } // End of Hurricane namespace. @@ -122,5 +134,5 @@ INSPECTOR_P_SUPPORT(Hurricane::Vertical); // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Verticals.h b/hurricane/src/hurricane/hurricane/Verticals.h index af759e07..44fa0ddb 100644 --- a/hurricane/src/hurricane/hurricane/Verticals.h +++ b/hurricane/src/hurricane/hurricane/Verticals.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Verticals.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -72,5 +72,5 @@ typedef GenericFilter VerticalFilter; // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/ViaLayer.h b/hurricane/src/hurricane/hurricane/ViaLayer.h index ff088632..bc643afb 100644 --- a/hurricane/src/hurricane/hurricane/ViaLayer.h +++ b/hurricane/src/hurricane/hurricane/ViaLayer.h @@ -1,7 +1,6 @@ - // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -19,12 +18,7 @@ // License along with Hurricane. If not, see // . // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | H U R R I C A N E | // | V L S I B a c k e n d D a t a - B a s e | // | | @@ -32,14 +26,11 @@ // | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Header : "./hurricane/ViaLayer.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ -#ifndef __HURRICANE_VIA_LAYER__ -#define __HURRICANE_VIA_LAYER__ +#ifndef HURRICANE_VIA_LAYER_H +#define HURRICANE_VIA_LAYER_H #include @@ -49,8 +40,12 @@ namespace Hurricane { +// ------------------------------------------------------------------- +// Class : "Hurricane::ViaLayer". class ViaLayer : public Layer { + public: + typedef Layer Super; public: // Constructor. @@ -70,6 +65,7 @@ namespace Hurricane { // Updators. virtual void setEnclosure ( const BasicLayer* layer, DbU::Unit enclosure ); // Hurricane Managment. + virtual void _toJson ( JsonWriter* ) const; virtual void _onDbuChange ( float scale ); virtual string _getTypeName () const; virtual string _getString () const; @@ -92,6 +88,20 @@ namespace Hurricane { }; +// ------------------------------------------------------------------- +// Class : "Hurricane::JsonViaLayer". + + class JsonViaLayer : public JsonLayer { + public: + static void initialize (); + JsonViaLayer ( unsigned long flags ); + ~JsonViaLayer (); + virtual string getTypeName () const; + virtual JsonViaLayer* clone ( unsigned long ) const; + virtual void toData ( JsonStack& ); + }; + + } // End of Hurricane namespace. diff --git a/hurricane/src/hurricane/hurricane/ViaLayers.h b/hurricane/src/hurricane/hurricane/ViaLayers.h index b9644499..37bfe29a 100644 --- a/hurricane/src/hurricane/hurricane/ViaLayers.h +++ b/hurricane/src/hurricane/hurricane/ViaLayers.h @@ -1,7 +1,7 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // diff --git a/hurricane/src/hurricane/hurricane/Views.h b/hurricane/src/hurricane/hurricane/Views.h index 9cc73ba4..a788c0fc 100644 --- a/hurricane/src/hurricane/hurricane/Views.h +++ b/hurricane/src/hurricane/hurricane/Views.h @@ -1,7 +1,7 @@ // **************************************************************************************************** // File: ./hurricane/Views.h // Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -72,5 +72,5 @@ typedef GenericFilter ViewFilter; // **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Warning.h b/hurricane/src/hurricane/hurricane/Warning.h index 7bac22a7..677826db 100644 --- a/hurricane/src/hurricane/hurricane/Warning.h +++ b/hurricane/src/hurricane/hurricane/Warning.h @@ -1,7 +1,7 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // This file is part of Hurricane. // @@ -19,12 +19,7 @@ // License along with Hurricane. If not, see // . // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | H U R R I C A N E | // | V L S I B a c k e n d D a t a - B a s e | // | | @@ -32,14 +27,11 @@ // | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Header : "./hurricane/Warning.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ -# ifndef __HURRICANE_WARNING__ -# define __HURRICANE_WARNING__ +# ifndef HURRICANE_WARNING_H +# define HURRICANE_WARNING_H #include "hurricane/Exception.h" @@ -76,7 +68,7 @@ namespace Hurricane { inline int Warning::getCode () const { return _code; } -} // End of Hurricane namespace. +} // Hurricane namespace. GETSTRING_POINTER_SUPPORT(Hurricane::Warning); @@ -85,4 +77,4 @@ IOSTREAM_POINTER_SUPPORT(Hurricane::Warning); IOSTREAM_VALUE_SUPPORT(Hurricane::Warning); -# endif // __HURRICANE_WARNING__ +#endif // HURRICANE_WARNING_H diff --git a/hurricane/src/isobar/CMakeLists.txt b/hurricane/src/isobar/CMakeLists.txt index 66ea5835..43ae1e09 100644 --- a/hurricane/src/isobar/CMakeLists.txt +++ b/hurricane/src/isobar/CMakeLists.txt @@ -4,6 +4,7 @@ include_directories( ${HURRICANE_SOURCE_DIR}/src/hurricane ${HURRICANE_SOURCE_DIR}/src/viewer ${HURRICANE_SOURCE_DIR}/src/isobar + ${CONFIGURATION_INCLUDE_DIR} ${PYTHON_INCLUDE_PATH} ) set( pyCpps ProxyProperty.cpp diff --git a/hurricane/src/isobar/ProxyProperty.cpp b/hurricane/src/isobar/ProxyProperty.cpp index d89594ce..e525118a 100644 --- a/hurricane/src/isobar/ProxyProperty.cpp +++ b/hurricane/src/isobar/ProxyProperty.cpp @@ -80,12 +80,12 @@ ProxyProperty* ProxyProperty::create ( void* shadow ) { void ProxyProperty::_preDestroy () { if ( _owner ) _owner->_onDestroyed ( this ); - trace << "ProxyProperty::_owner := " << hex << (void*)_owner << endl; + cdebug.log(20) << "ProxyProperty::_owner := " << hex << (void*)_owner << endl; if ( _offset > 0 ) { void** shadowMember = ( (void**)( (unsigned long)_shadow + _offset ) ); - trace << "ProxyProperty::_shadowMember := " << hex << *shadowMember << endl; + cdebug.log(20) << "ProxyProperty::_shadowMember := " << hex << *shadowMember << endl; *shadowMember = NULL; } diff --git a/hurricane/src/isobar/PyBasicLayer.cpp b/hurricane/src/isobar/PyBasicLayer.cpp index 9137afe1..87011753 100644 --- a/hurricane/src/isobar/PyBasicLayer.cpp +++ b/hurricane/src/isobar/PyBasicLayer.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -47,7 +47,7 @@ extern "C" { static PyObject* PyBasicLayer_create ( PyObject*, PyObject* args ) { - trace << "PyBasicLayer_create()" << endl; + cdebug.log(20) << "PyBasicLayer_create()" << endl; BasicLayer* basicLayer = NULL; @@ -96,7 +96,7 @@ extern "C" { static PyObject* PyBasicLayer_getMaterial ( PyBasicLayer *self ) { - trace << "PyBasicLayer_getMaterial ()" << endl; + cdebug.log(20) << "PyBasicLayer_getMaterial ()" << endl; METHOD_HEAD ( "BasicLayer.getMaterial()" ) BasicLayer::Material* material = NULL; @@ -110,8 +110,8 @@ extern "C" { updatorFromBasicLayer (setBlockageLayer,PyBasicLayer,BasicLayer) accessorLayerFromVoid (getBlockageLayer,PyBasicLayer,BasicLayer) - DirectSetLongAttribute (PyBasicLayer_setExtractNumber,setExtractNumber,"BasicLayer.setExtractNumber",PyBasicLayer,BasicLayer) - DirectSetCStringAttribute(PyBasicLayer_setRealName ,setRealName ,"BasicLayer.setRealName" ,PyBasicLayer,BasicLayer) + DirectSetLongAttribute (PyBasicLayer_setExtractNumber,setExtractNumber,PyBasicLayer,BasicLayer) + DirectSetCStringAttribute(PyBasicLayer_setRealName ,setRealName ,PyBasicLayer,BasicLayer) // Standart destroy (Attribute). diff --git a/hurricane/src/isobar/PyBox.cpp b/hurricane/src/isobar/PyBox.cpp index 983b02ac..bb7bcf08 100644 --- a/hurricane/src/isobar/PyBox.cpp +++ b/hurricane/src/isobar/PyBox.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -62,7 +62,7 @@ extern "C" { // Class Method : "PyBox_NEW ()" static PyObject* PyBox_NEW (PyObject *module, PyObject *args) { - trace << "PyBox_NEW()" << endl; + cdebug.log(20) << "PyBox_NEW()" << endl; Box* box = NULL; PyBox* pyBox = NULL; @@ -106,13 +106,13 @@ extern "C" { static int PyBox_Init ( PyBox* self, PyObject* args, PyObject* kwargs ) { - trace << "PyBox_Init(): " << (void*)self << endl; + cdebug.log(20) << "PyBox_Init(): " << (void*)self << endl; return 0; } static PyObject* PyBox_getCenter ( PyBox *self ) { - trace << "PyBox_getCenter()" << endl; + cdebug.log(20) << "PyBox_getCenter()" << endl; METHOD_HEAD ( "Box.Center()" ) @@ -128,7 +128,7 @@ extern "C" { static PyObject* PyBox_getUnion ( PyBox *self, PyObject* args ) { - trace << "PyBox_getUnion()" << endl; + cdebug.log(20) << "PyBox_getUnion()" << endl; METHOD_HEAD ( "Box.getUnion()" ) @@ -154,7 +154,7 @@ extern "C" { // Attribute Method : "PyBox_getIntersection ()" static PyObject* PyBox_getIntersection ( PyBox *self, PyObject* args ) { - trace << "PyBox_getIntersection()" << endl; + cdebug.log(20) << "PyBox_getIntersection()" << endl; METHOD_HEAD ( "Box.getIntersection()" ) @@ -179,7 +179,7 @@ extern "C" { // Attribute Method : "PyBox_contains ()" static PyObject* PyBox_contains ( PyBox *self, PyObject* args ) { - trace << "PyBox_contains ()" << endl; + cdebug.log(20) << "PyBox_contains ()" << endl; METHOD_HEAD ( "Box.contains()" ) @@ -214,7 +214,7 @@ extern "C" { // Attribute Method : "PyBox_intersect ()" static PyObject* PyBox_intersect ( PyBox *self, PyObject* args ) { - trace << "PyBox_intersect ()" << endl; + cdebug.log(20) << "PyBox_intersect ()" << endl; bool result = false; HTRY @@ -244,7 +244,7 @@ extern "C" { // Attribute Method : "PyBox_isConstrainedBy ()" static PyObject* PyBox_isConstrainedBy ( PyBox *self, PyObject* args ) { - trace << "PyBox_isConstrainedBy ()" << endl; + cdebug.log(20) << "PyBox_isConstrainedBy ()" << endl; bool result = false; HTRY @@ -273,7 +273,7 @@ extern "C" { // Attribute Method : "PyBox_makeEmpty ()" static PyObject* PyBox_makeEmpty ( PyBox *self, PyObject* args ) { - trace << "PyBox_makeEmpty ()" << endl; + cdebug.log(20) << "PyBox_makeEmpty ()" << endl; HTRY METHOD_HEAD ( "Box.makeEmpty()" ) @@ -289,7 +289,7 @@ extern "C" { // Attribute Method : "PyBox_inflate ()" static PyObject* PyBox_inflate ( PyBox *self, PyObject* args ) { - trace << "PyBox_inflate ()" << endl; + cdebug.log(20) << "PyBox_inflate ()" << endl; METHOD_HEAD ( "Box.inflate()" ) @@ -326,7 +326,7 @@ extern "C" { // Attribute Method : "PyBox_merge ()" static PyObject* PyBox_merge ( PyBox *self, PyObject* args ) { - trace << "Box_merge()" << endl; + cdebug.log(20) << "Box_merge()" << endl; METHOD_HEAD ( "Box.merge()" ) @@ -364,7 +364,7 @@ extern "C" { // Attribute Method : "PyBox_translate ()" static PyObject* PyBox_translate ( PyBox *self, PyObject* args ) { - trace << "PyBox_translate ()" << endl; + cdebug.log(20) << "PyBox_translate ()" << endl; HTRY METHOD_HEAD ( "Box.translate()" ) diff --git a/hurricane/src/isobar/PyBreakpoint.cpp b/hurricane/src/isobar/PyBreakpoint.cpp index 47e5f94a..6bc70edb 100644 --- a/hurricane/src/isobar/PyBreakpoint.cpp +++ b/hurricane/src/isobar/PyBreakpoint.cpp @@ -44,13 +44,13 @@ extern "C" { static void PyBreakpoint_DeAlloc ( PyBreakpoint* self ) { - trace << "PySingletonObject_DeAlloc(" << hex << self << ")" << endl; + cdebug.log(20) << "PySingletonObject_DeAlloc(" << hex << self << ")" << endl; } static PyObject* PyBreakpoint_stop ( PyObject*, PyObject *args ) { - trace << "PyBreakpoint_stop()" << endl; + cdebug.log(20) << "PyBreakpoint_stop()" << endl; bool result = false; @@ -71,7 +71,7 @@ extern "C" { static PyObject* PyBreakpoint_setStopLevel ( PyObject*, PyObject* args ) { - trace << "PyBreakpoint_setStopLevel()" << endl; + cdebug.log(20) << "PyBreakpoint_setStopLevel()" << endl; HTRY @@ -89,7 +89,7 @@ extern "C" { static PyObject* PyBreakpoint_getStopLevel ( PyObject* ) { - trace << "PyBreakpoint_getStopLevel()" << endl; + cdebug.log(20) << "PyBreakpoint_getStopLevel()" << endl; return Py_BuildValue ( "i", Breakpoint::getStopLevel() ); @@ -112,7 +112,7 @@ extern "C" { // extern void PyBreakpoint_LinkPyType() // { - // trace << "PyBreakpoint_LinkType()" << endl; + // cdebug.log(20) << "PyBreakpoint_LinkType()" << endl; // PyTypeBreakpoint.tp_new = (newfunc) PyType_GenericNew; // PyTypeBreakpoint.tp_dealloc = (destructor)PyBreakpoint_DeAlloc; diff --git a/hurricane/src/isobar/PyCell.cpp b/hurricane/src/isobar/PyCell.cpp index dc846f25..801dadf6 100644 --- a/hurricane/src/isobar/PyCell.cpp +++ b/hurricane/src/isobar/PyCell.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2006-2015, All Rights Reserved +// Copyright (c) UPMC 2006-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -65,7 +65,7 @@ extern "C" { // Attribute Method : "PyCell_create ()" PyObject* PyCell_create ( PyObject*, PyObject *args ) { - trace << "PyCell_create()" << endl; + cdebug.log(20) << "PyCell_create()" << endl; char* name = NULL; PyLibrary* pyLibrary = NULL; @@ -88,7 +88,7 @@ extern "C" { // Attribute Method : "PyCell_getLibrary ()" static PyObject* PyCell_getLibrary ( PyCell *self ) { - trace << "PyCell_getLibrary ()" << endl; + cdebug.log(20) << "PyCell_getLibrary ()" << endl; Library* library = NULL; @@ -110,7 +110,7 @@ extern "C" { // Attribute Method : "PyCell_getInstance ()" static PyObject* PyCell_getInstance ( PyCell *self, PyObject* args ) { - trace << "PyCell_getInstance ()" << endl; + cdebug.log(20) << "PyCell_getInstance ()" << endl; METHOD_HEAD("Cell.getInstance()") Instance* instance = NULL; @@ -133,7 +133,7 @@ extern "C" { // Attribute Method : "PyCell_getInstances()" static PyObject* PyCell_getInstances( PyCell *self ) { - trace << "PyCell_getInstances()" << endl; + cdebug.log(20) << "PyCell_getInstances()" << endl; METHOD_HEAD ( "Cell.getInstances()" ) @@ -158,7 +158,7 @@ extern "C" { // Attribute Method : "PyCell_getInstancesUnder()" static PyObject* PyCell_getInstancesUnder(PyCell *self, PyObject* args) { - trace << "PyCell_getInstancesUnder()" << endl; + cdebug.log(20) << "PyCell_getInstancesUnder()" << endl; METHOD_HEAD("Cell.getInstancesUnder()") @@ -188,7 +188,7 @@ extern "C" { // Attribute Method : "PyCell_getSlaveInstances()" static PyObject* PyCell_getSlaveInstances(PyCell *self) { - trace << "PyCell_getSlaveInstances()" << endl; + cdebug.log(20) << "PyCell_getSlaveInstances()" << endl; METHOD_HEAD("Cell.getSlaveInstances()") @@ -213,7 +213,7 @@ extern "C" { // Attribute Method : "PyCell_getComponents()" static PyObject* PyCell_getComponents(PyCell *self) { - trace << "PyCell_getComponents()" << endl; + cdebug.log(20) << "PyCell_getComponents()" << endl; METHOD_HEAD("Cell.getComponents()") @@ -239,7 +239,7 @@ extern "C" { // Attribute Method : "PyCell_getComponentsUnder()" static PyObject* PyCell_getComponentsUnder(PyCell *self, PyObject* args) { - trace << "PyCell_getComponentsUnder()" << endl; + cdebug.log(20) << "PyCell_getComponentsUnder()" << endl; METHOD_HEAD("Cell.getComponentsUnder()") @@ -268,7 +268,7 @@ extern "C" { // Attribute Method : "PyCell_getOccurrences()" static PyObject* PyCell_getOccurrences(PyCell *self) { - trace << "PyCell_getOccurrences()" << endl; + cdebug.log(20) << "PyCell_getOccurrences()" << endl; METHOD_HEAD("Cell.getOccurrences()") @@ -294,7 +294,7 @@ extern "C" { // Attribute Method : "PyCell_getOccurrencesUnder()" static PyObject* PyCell_getOccurrencesUnder(PyCell *self, PyObject* args) { - trace << "PyCell_getOccurrencesUnder()" << endl; + cdebug.log(20) << "PyCell_getOccurrencesUnder()" << endl; METHOD_HEAD("Cell.getOccurrencesUnder()") @@ -323,7 +323,7 @@ extern "C" { // Attribute Method : "PyCell_getLeafInstanceOccurrences()" static PyObject* PyCell_getLeafInstanceOccurrences(PyCell *self) { - trace << "PyCell_getLeafInstanceOccurrences()" << endl; + cdebug.log(20) << "PyCell_getLeafInstanceOccurrences()" << endl; METHOD_HEAD ( "Cell.getLeafInstanceOccurrences()" ) @@ -348,7 +348,7 @@ extern "C" { // Attribute Method : "PyCell_getLeafInstanceOccurrencesUnder()" static PyObject* PyCell_getLeafInstanceOccurrencesUnder(PyCell *self, PyObject* args) { - trace << "PyCell_getLeafInstanceOccurrencesUnder()" << endl; + cdebug.log(20) << "PyCell_getLeafInstanceOccurrencesUnder()" << endl; METHOD_HEAD ( "Cell.getLeafInstanceOccurrencesUnder()" ) @@ -378,7 +378,7 @@ extern "C" { // Attribute Method : "PyCell_getReferences()" static PyObject* PyCell_getReferences(PyCell *self) { - trace << "PyCell_getReferences()" << endl; + cdebug.log(20) << "PyCell_getReferences()" << endl; METHOD_HEAD("Cell.getReferences()") @@ -403,7 +403,7 @@ extern "C" { // Attribute Method : "PyCell_getHyperNets()" static PyObject* PyCell_getHyperNets(PyCell *self) { - trace << "PyCell_getHyperNets()" << endl; + cdebug.log(20) << "PyCell_getHyperNets()" << endl; METHOD_HEAD ( "Cell.getHyperNets()" ) @@ -428,7 +428,7 @@ extern "C" { // Attribute Method : "PyCell_getNet ()" static PyObject* PyCell_getNet(PyCell *self, PyObject* args) { - trace << "PyCell_getNet ()" << endl; + cdebug.log(20) << "PyCell_getNet ()" << endl; METHOD_HEAD ( "Cell.getNet()" ) Net* net = NULL; @@ -449,7 +449,7 @@ extern "C" { // Attribute Method : "PyCell_getNets ()" static PyObject* PyCell_getNets ( PyCell *self ) { - trace << "PyCell_getNets()" << endl; + cdebug.log(20) << "PyCell_getNets()" << endl; METHOD_HEAD("Cell.getNets()") @@ -474,7 +474,7 @@ extern "C" { // Attribute Method : "PyCell_getExternalNets()" static PyObject* PyCell_getExternalNets(PyCell *self) { - trace << "PyCell_getExternalNets()" << endl; + cdebug.log(20) << "PyCell_getExternalNets()" << endl; METHOD_HEAD("Cell.getExternalNets()") @@ -498,7 +498,7 @@ extern "C" { // Attribute Method : "PyCell_getClockNets()" static PyObject* PyCell_getClockNets(PyCell *self) { - trace << "PyCell_getClockNets()" << endl; + cdebug.log(20) << "PyCell_getClockNets()" << endl; METHOD_HEAD("Cell.getClockNets") @@ -522,7 +522,7 @@ extern "C" { // Attribute Method : "PyCell_getSupplyNets()" static PyObject* PyCell_getSupplyNets(PyCell *self) { - trace << "PyCell_getSupplyNets()" << endl; + cdebug.log(20) << "PyCell_getSupplyNets()" << endl; METHOD_HEAD ( "Cell.getSupplyNets()" ) @@ -547,7 +547,7 @@ extern "C" { // Attribute Method : "PyCell_getPowerNets()" static PyObject* PyCell_getPowerNets(PyCell *self) { - trace << "PyCell_getPowerNets()" << endl; + cdebug.log(20) << "PyCell_getPowerNets()" << endl; METHOD_HEAD ( "Cell.getPowerNets()" ) @@ -572,7 +572,7 @@ extern "C" { // Attribute Method : "PyCell_getGroundNets()" static PyObject* PyCell_getGroundNets(PyCell *self) { - trace << "PyCell_getGroundNets()" << endl; + cdebug.log(20) << "PyCell_getGroundNets()" << endl; METHOD_HEAD ( "Cell.getGroundNets()" ) @@ -596,7 +596,7 @@ extern "C" { // Attribute Method : "PyCell_getAbutmentBox ()" static PyObject* PyCell_getAbutmentBox ( PyCell *self ) { - trace << "PyCell_getAbutmentBox()" << endl; + cdebug.log(20) << "PyCell_getAbutmentBox()" << endl; METHOD_HEAD ( "Cell.getAbutmentBox()" ) @@ -620,7 +620,7 @@ extern "C" { // Attribute Method : "PyCell_setAbutmentBox ()" static PyObject* PyCell_setAbutmentBox ( PyCell *self, PyObject* args ) { - trace << "Cell.setAbutmentBox()" << endl; + cdebug.log(20) << "Cell.setAbutmentBox()" << endl; HTRY METHOD_HEAD ( "Cell.setAbutmentBox()" ) @@ -640,7 +640,7 @@ extern "C" { // Attribute Method : "PyCell_setTerminal ()" static PyObject* PyCell_setTerminal ( PyCell *self, PyObject* args ) { - trace << "PyCell_setTerminal ()" << endl; + cdebug.log(20) << "PyCell_setTerminal ()" << endl; HTRY METHOD_HEAD ( "Cell.setTerminal()" ) @@ -658,7 +658,7 @@ extern "C" { // Attribute Method : "PyCell_uniquify ()" static PyObject* PyCell_uniquify ( PyCell *self, PyObject* args ) { - trace << "PyCell_uniquify ()" << endl; + cdebug.log(20) << "PyCell_uniquify ()" << endl; HTRY METHOD_HEAD ( "Cell.uniquify()" ) @@ -677,7 +677,7 @@ extern "C" { // Attribute Method : "PyCell_getClone ()" static PyObject* PyCell_getClone ( PyCell *self ) { - trace << "PyCell_getClone ()" << endl; + cdebug.log(20) << "PyCell_getClone ()" << endl; Cell* cloneCell = NULL; HTRY diff --git a/hurricane/src/isobar/PyComponent.cpp b/hurricane/src/isobar/PyComponent.cpp index 880bfa71..366bc790 100644 --- a/hurricane/src/isobar/PyComponent.cpp +++ b/hurricane/src/isobar/PyComponent.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -61,7 +61,7 @@ extern "C" { static PyObject* PyComponent_getPosition ( PyComponent *self ) { - trace << "PyComponent_getPosition ()" << endl; + cdebug.log(20) << "PyComponent_getPosition ()" << endl; METHOD_HEAD ( "Component.getPosition()" ) PyPoint* pyPoint = PyObject_NEW ( PyPoint, &PyTypePoint ); @@ -77,7 +77,7 @@ extern "C" { static PyObject* PyComponent_getNet ( PyComponent *self ) { - trace << "PyComponent_getNet ()" << endl; + cdebug.log(20) << "PyComponent_getNet ()" << endl; Net* net = NULL; @@ -93,7 +93,7 @@ extern "C" { static PyObject* PyComponent_getLayer ( PyComponent *self ) { - trace << "PyComponent_getLayer ()" << endl; + cdebug.log(20) << "PyComponent_getLayer ()" << endl; METHOD_HEAD ( "Component.getLayer()" ) Layer* layer = NULL; @@ -108,7 +108,7 @@ extern "C" { static PyObject* PyComponent_getCenter ( PyComponent *self ) { - trace << "PyComponent_getCenter ()" << endl; + cdebug.log(20) << "PyComponent_getCenter ()" << endl; METHOD_HEAD( "Component.getCenter()" ) PyPoint* pyPoint = PyObject_NEW( PyPoint, &PyTypePoint ); @@ -124,7 +124,7 @@ extern "C" { static PyObject* PyComponent_getBoundingBox ( PyComponent *self, PyObject* args ) { - trace << "PyComponent_getBoundingBox ()" << endl; + cdebug.log(20) << "PyComponent_getBoundingBox ()" << endl; METHOD_HEAD ( "Component.getBoundingBox()" ) PyBox* pyBox = PyObject_NEW ( PyBox, &PyTypeBox ); @@ -154,7 +154,7 @@ extern "C" { static PyObject* PyComponent_getConnexComponents ( PyComponent *self ) { - trace << "PyComponent_getConnexComponents()" << endl; + cdebug.log(20) << "PyComponent_getConnexComponents()" << endl; METHOD_HEAD( "PyComponent.getConnexComponents()" ) PyComponentCollection* pyComponentCollection = NULL; @@ -176,7 +176,7 @@ extern "C" { static PyObject* PyComponent_getSlaveComponents ( PyComponent *self ) { - trace << "PyComponent_getSlaveComponents()" << endl; + cdebug.log(20) << "PyComponent_getSlaveComponents()" << endl; METHOD_HEAD( "PyComponent.getSlaveComponents()" ) PyComponentCollection* pyComponentCollection = NULL; diff --git a/hurricane/src/isobar/PyContact.cpp b/hurricane/src/isobar/PyContact.cpp index d3abac24..22b53f51 100644 --- a/hurricane/src/isobar/PyContact.cpp +++ b/hurricane/src/isobar/PyContact.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -52,12 +52,12 @@ extern "C" { DirectGetLongAttribute(PyContact_getDx, getDx, PyContact,Contact) DirectGetLongAttribute(PyContact_getDy, getDy, PyContact,Contact) - DirectSetLongAttribute(PyContact_setX ,setX ,"Contact.setX" ,PyContact,Contact) - DirectSetLongAttribute(PyContact_setY ,setY ,"Contact.setY" ,PyContact,Contact) - DirectSetLongAttribute(PyContact_setDx ,setDx ,"Contact.setDx" ,PyContact,Contact) - DirectSetLongAttribute(PyContact_setDy ,setDy ,"Contact.setDy" ,PyContact,Contact) - DirectSetLongAttribute(PyContact_setWidth ,setWidth ,"Contact.setWidth" ,PyContact,Contact) - DirectSetLongAttribute(PyContact_setHeight,setHeight,"Contact.setHeight",PyContact,Contact) + DirectSetLongAttribute(PyContact_setX ,setX ,PyContact,Contact) + DirectSetLongAttribute(PyContact_setY ,setY ,PyContact,Contact) + DirectSetLongAttribute(PyContact_setDx ,setDx ,PyContact,Contact) + DirectSetLongAttribute(PyContact_setDy ,setDy ,PyContact,Contact) + DirectSetLongAttribute(PyContact_setWidth ,setWidth ,PyContact,Contact) + DirectSetLongAttribute(PyContact_setHeight,setHeight,PyContact,Contact) accessorHook(getAnchorHook,PyContact,Contact) @@ -66,7 +66,7 @@ extern "C" { static PyObject* PyContact_create ( PyObject*, PyObject *args ) { - trace << "PyContact_create()" << endl; + cdebug.log(20) << "PyContact_create()" << endl; Contact* contact = NULL; @@ -99,7 +99,7 @@ extern "C" { static PyObject* PyContact_translate ( PyContact *self, PyObject* args ) { - trace << "PyContact_translate ()" << endl; + cdebug.log(20) << "PyContact_translate ()" << endl; HTRY METHOD_HEAD ( "Contact.translate()" ) diff --git a/hurricane/src/isobar/PyContactLayer.cpp b/hurricane/src/isobar/PyContactLayer.cpp index 312bde71..030ec2b0 100644 --- a/hurricane/src/isobar/PyContactLayer.cpp +++ b/hurricane/src/isobar/PyContactLayer.cpp @@ -76,7 +76,7 @@ extern "C" { static PyObject* PyContactLayer_create ( PyObject*, PyObject* args ) { - trace << "PyContactLayer_create()" << endl; + cdebug.log(20) << "PyContactLayer_create()" << endl; ContactLayer* contactLayer = NULL; diff --git a/hurricane/src/isobar/PyDataBase.cpp b/hurricane/src/isobar/PyDataBase.cpp index 3a50e86b..491da1ba 100644 --- a/hurricane/src/isobar/PyDataBase.cpp +++ b/hurricane/src/isobar/PyDataBase.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -38,7 +38,7 @@ extern "C" { static PyObject* PyDataBase_create ( PyObject* ) { - trace << "PyDataBase_create()" << endl; + cdebug.log(20) << "PyDataBase_create()" << endl; DataBase* db = NULL; @@ -51,7 +51,7 @@ extern "C" { static PyObject* PyDataBase_getDB ( PyObject* ) { - trace << "PyDataBase_getDB()" << endl; + cdebug.log(20) << "PyDataBase_getDB()" << endl; DataBase* db = NULL; @@ -66,7 +66,7 @@ extern "C" { PyObject* PyDataBase_getTechnology ( PyDataBase* self ) { - trace << "PyDataBase_getTechnology()" << endl; + cdebug.log(20) << "PyDataBase_getTechnology()" << endl; Technology* techno = NULL; @@ -84,7 +84,7 @@ extern "C" { static PyObject* PyDataBase_getRootLibrary ( PyDataBase *self ) { - trace << "PyDataBase_getRootLibrary ()" << endl; + cdebug.log(20) << "PyDataBase_getRootLibrary ()" << endl; Library* library = NULL; diff --git a/hurricane/src/isobar/PyDbU.cpp b/hurricane/src/isobar/PyDbU.cpp index fede5724..b4bf5e83 100644 --- a/hurricane/src/isobar/PyDbU.cpp +++ b/hurricane/src/isobar/PyDbU.cpp @@ -531,7 +531,7 @@ extern "C" { extern void PyDbU_LinkPyType() { - trace << "PyDbU_LinkType()" << endl; + cdebug.log(20) << "PyDbU_LinkType()" << endl; PyTypeDbU.tp_methods = PyDbU_Methods; } diff --git a/hurricane/src/isobar/PyDebugSession.cpp b/hurricane/src/isobar/PyDebugSession.cpp index 5d4cc080..92735105 100644 --- a/hurricane/src/isobar/PyDebugSession.cpp +++ b/hurricane/src/isobar/PyDebugSession.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2014-2015, All Rights Reserved +// Copyright (c) UPMC 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -44,29 +44,37 @@ extern "C" { static void PyDebugSession_DeAlloc ( PyDebugSession* self ) { - trace << "PyDebugSession_DeAlloc(" << hex << self << ")" << endl; + cdebug.log(20) << "PyDebugSession_DeAlloc(" << hex << self << ")" << endl; } static PyObject* PyDebugSession_open ( PyObject*, PyObject* args ) { - trace << "PyDebugSession_open()" << endl; + cdebug.log(20) << "PyDebugSession_open()" << endl; HTRY - PyObject* pySymbol = NULL; - unsigned int traceLevel = 10000; - if (PyArg_ParseTuple( args - , "OI:DebugSession.open" - , &pySymbol - , &traceLevel - )) { - void* symbol = PyObject_AsHurricaneSymbol( pySymbol ); + PyObject* arg0; + PyObject* arg1; + PyObject* arg2; + __cs.init ("DebugSession.open"); + + if (not PyArg_ParseTuple(args,"|O&O&O&:DebugSession.open", + Converter, &arg0, + Converter, &arg1, + Converter, &arg2)) { + return NULL; + } + + if (__cs.getObjectIds() == ":int:int" ) { + DebugSession::open( PyAny_AsLong(arg0), PyAny_AsLong(arg1) ); + } else if (__cs.getObjectIds() == ":ent:int:int") { + void* symbol = PyObject_AsHurricaneSymbol( arg0 ); if (not symbol) { Py_RETURN_NONE; } - DebugSession::open( symbol, traceLevel ); + DebugSession::open( symbol, PyAny_AsLong(arg1), PyAny_AsLong(arg2) ); } else { - PyErr_SetString( ConstructorError, "Bad parameters given to DebugSession.open()." ); + PyErr_SetString(ConstructorError, "invalid number of parameters for DebugSession::open()." ); return NULL; } HCATCH @@ -77,7 +85,7 @@ extern "C" { static PyObject* PyDebugSession_close ( PyObject* ) { - trace << "PyDebugSession_close()" << endl; + cdebug.log(20) << "PyDebugSession_close()" << endl; HTRY DebugSession::close (); @@ -89,7 +97,7 @@ extern "C" { static PyObject* PyDebugSession_addToTrace ( PyObject*, PyObject* args ) { - trace << "PyDebugSession_addToTrace()" << endl; + cdebug.log(20) << "PyDebugSession_addToTrace()" << endl; HTRY PyObject* pySymbol = NULL; diff --git a/hurricane/src/isobar/PyDiffusionLayer.cpp b/hurricane/src/isobar/PyDiffusionLayer.cpp index fab985fd..007b6d27 100644 --- a/hurricane/src/isobar/PyDiffusionLayer.cpp +++ b/hurricane/src/isobar/PyDiffusionLayer.cpp @@ -76,7 +76,7 @@ extern "C" { static PyObject* PyDiffusionLayer_create ( PyObject*, PyObject* args ) { - trace << "PyDiffusionLayer_create()" << endl; + cdebug.log(20) << "PyDiffusionLayer_create()" << endl; DiffusionLayer* diffusionLayer = NULL; diff --git a/hurricane/src/isobar/PyEntity.cpp b/hurricane/src/isobar/PyEntity.cpp index 832a1c2b..14c85bbc 100644 --- a/hurricane/src/isobar/PyEntity.cpp +++ b/hurricane/src/isobar/PyEntity.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2010-2015, All Rights Reserved +// Copyright (c) UPMC 2010-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -59,7 +59,7 @@ extern "C" { // Attribute Method : "PyEntity_getCell ()" static PyObject* PyEntity_getCell ( PyEntity *self ) { - trace << "PyEntity_getCell ()" << endl; + cdebug.log(20) << "PyEntity_getCell ()" << endl; Cell* cell = NULL; diff --git a/hurricane/src/isobar/PyHook.cpp b/hurricane/src/isobar/PyHook.cpp index f172bac2..2f429fe5 100644 --- a/hurricane/src/isobar/PyHook.cpp +++ b/hurricane/src/isobar/PyHook.cpp @@ -48,7 +48,7 @@ extern "C" { static PyObject* PyHook_getComponent ( PyHook *self ) { - trace << "PyHook_getComponent()" << endl; + cdebug.log(20) << "PyHook_getComponent()" << endl; METHOD_HEAD ( "Hook.getComponent()" ) Component* component = NULL; @@ -62,7 +62,7 @@ extern "C" { static PyObject* PyHook_getHooks ( PyHook *self ) { - trace << "PyHook_getHooks()" << endl; + cdebug.log(20) << "PyHook_getHooks()" << endl; METHOD_HEAD( "Hook.getHooks()" ) @@ -83,7 +83,7 @@ extern "C" { static PyObject* PyHook_getSlaveHooks ( PyHook *self ) { - trace << "PyHook_getSlaveHooks()" << endl; + cdebug.log(20) << "PyHook_getSlaveHooks()" << endl; METHOD_HEAD( "Hook.getSlaveHooks()" ) @@ -104,7 +104,7 @@ extern "C" { static PyObject* PyHook_detach ( PyHook *self ) { - trace << "PyHook_detach()" << endl; + cdebug.log(20) << "PyHook_detach()" << endl; METHOD_HEAD ( "Hook.detach()" ) PyHook* pyReturnHook = PyObject_NEW ( PyHook, &PyTypeHook ); @@ -120,7 +120,7 @@ extern "C" { static PyObject* PyHook_attach ( PyHook *self, PyObject* args ) { - trace << "PyHook_attach()" << endl; + cdebug.log(20) << "PyHook_attach()" << endl; METHOD_HEAD ( "Hook.attach()" ) PyHook* pyReturnHook = PyObject_NEW ( PyHook, &PyTypeHook ); @@ -147,7 +147,7 @@ extern "C" { static PyObject* PyHook_merge ( PyHook *self, PyObject* args ) { - trace << "PyHook_merge()" << endl; + cdebug.log(20) << "PyHook_merge()" << endl; METHOD_HEAD ( "Hook.merge()" ) PyHook* pyReturnHook = PyObject_NEW ( PyHook, &PyTypeHook ); diff --git a/hurricane/src/isobar/PyHorizontal.cpp b/hurricane/src/isobar/PyHorizontal.cpp index fd36fd36..0fb44240 100644 --- a/hurricane/src/isobar/PyHorizontal.cpp +++ b/hurricane/src/isobar/PyHorizontal.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2007-2015, All Rights Reserved +// Copyright (c) UPMC 2007-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -49,9 +49,9 @@ extern "C" { DirectGetLongAttribute(PyHorizontal_getY ,getY ,PyHorizontal,Horizontal) DirectGetLongAttribute(PyHorizontal_getDxSource,getDxSource,PyHorizontal,Horizontal) DirectGetLongAttribute(PyHorizontal_getDxTarget,getDxTarget,PyHorizontal,Horizontal) - DirectSetLongAttribute(PyHorizontal_setY ,setY ,"Horizontal.setY",PyHorizontal,Horizontal) - DirectSetLongAttribute(PyHorizontal_setDxSource,setDxSource,"Horizontal.setDxSource",PyHorizontal,Horizontal) - DirectSetLongAttribute(PyHorizontal_setDxTarget,setDxTarget,"Horizontal.setDxTarget",PyHorizontal,Horizontal) + DirectSetLongAttribute(PyHorizontal_setY ,setY ,PyHorizontal,Horizontal) + DirectSetLongAttribute(PyHorizontal_setDxSource,setDxSource,PyHorizontal,Horizontal) + DirectSetLongAttribute(PyHorizontal_setDxTarget,setDxTarget,PyHorizontal,Horizontal) // Standart destroy (Attribute). DBoDestroyAttribute(PyHorizontal_destroy, PyHorizontal) @@ -61,7 +61,7 @@ extern "C" { // Attribute Method : "PyHorizontal_create ()" static PyObject* PyHorizontal_create ( PyObject*, PyObject *args ) { - trace << "PyHorizontal_create()" << endl; + cdebug.log(20) << "PyHorizontal_create()" << endl; PyObject* arg0; PyObject* arg1; @@ -152,7 +152,7 @@ extern "C" { // Attribute Method : "PyHorizontal_translate ()" static PyObject* PyHorizontal_translate ( PyHorizontal *self, PyObject* args ) { - trace << "PyHorizontal_translate ()" << endl; + cdebug.log(20) << "PyHorizontal_translate ()" << endl; HTRY METHOD_HEAD ( "Horizontal.translate()" ) diff --git a/hurricane/src/isobar/PyHurricane.cpp b/hurricane/src/isobar/PyHurricane.cpp index fe134354..f7b8a31f 100644 --- a/hurricane/src/isobar/PyHurricane.cpp +++ b/hurricane/src/isobar/PyHurricane.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -129,6 +129,16 @@ using namespace Hurricane; // +-----------------------------------------------------------------+ + int PyAny_AsInt ( PyObject* object ) + { + long value = 0; + + if (PyObject_IsInstance(object,(PyObject*)&PyInt_Type )) value = PyInt_AsLong ( object ); + else if (PyObject_IsInstance(object,(PyObject*)&PyLong_Type)) value = PyLong_AsLong( object ); + return (int)value; + } + + long PyAny_AsLong ( PyObject* object ) { long value = 0; @@ -199,7 +209,7 @@ using namespace Hurricane; for ( unsigned i=0 ; i < _types.size() ; i++ ) { if ( ! strcmp ( _types[i]->_id, id ) ) { //throw Error ( objectTypeRedefinition ); // 04.09.2009 d2 modification so Pharos can run several scripts during one execution - trace << objectTypeRedefinition << endl; + cdebug.log(20) << objectTypeRedefinition << endl; return; } } @@ -486,8 +496,8 @@ extern "C" { HTRY PyObject* state = NULL; if (PyArg_ParseTuple(args , "O:Hurricane.trace()", &state)) { - if (PyObject_IsTrue(state)) trace_on (); - else trace_off(); + if (PyObject_IsTrue(state)) { } /*trace_on ();*/ + else { } /*trace_off();*/ } else { PyErr_SetString ( ConstructorError, "Bad parameters given to BasicLayer.create()." ); return NULL; @@ -516,7 +526,7 @@ extern "C" { DL_EXPORT(void) initHurricane () { //trace_on(); - trace << "initHurricane()" << endl; + cdebug.log(20) << "initHurricane()" << endl; PyDebugSession_LinkPyType (); PyUpdateSession_LinkPyType (); @@ -826,7 +836,7 @@ extern "C" { PyInstance_postModuleInit(); PyQuery_postModuleInit(); - trace << "Hurricane.so loaded " << (void*)&typeid(string) << endl; + cdebug.log(20) << "Hurricane.so loaded " << (void*)&typeid(string) << endl; } diff --git a/hurricane/src/isobar/PyHyperNet.cpp b/hurricane/src/isobar/PyHyperNet.cpp index 4e68a5d7..9f6cf7ee 100644 --- a/hurricane/src/isobar/PyHyperNet.cpp +++ b/hurricane/src/isobar/PyHyperNet.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2007-2015, All Rights Reserved +// Copyright (c) UPMC 2007-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -43,7 +43,7 @@ extern "C" { static PyObject* PyHyperNet_create ( PyObject*, PyObject *args ) { - trace << "PyHyperNet_create()" << endl; + cdebug.log(20) << "PyHyperNet_create()" << endl; HyperNet* hyperNet = NULL; PyObject* arg0; @@ -69,7 +69,7 @@ extern "C" { static PyObject* PyHyperNet_getNetOccurrences(PyHyperNet *self) { - trace << "PyHyperNet_getNetOccurrences()" << endl; + cdebug.log(20) << "PyHyperNet_getNetOccurrences()" << endl; METHOD_HEAD ( "HyperNet.getNetOccurrences()" ) @@ -92,7 +92,7 @@ extern "C" { static PyObject* PyHyperNet_getLeafPlugOccurrences(PyHyperNet *self) { - trace << "PyHyperNet_getLeafPlugOccurrences()" << endl; + cdebug.log(20) << "PyHyperNet_getLeafPlugOccurrences()" << endl; METHOD_HEAD ( "HyperNet.getLeafPlugOccurrences()" ) @@ -115,7 +115,7 @@ extern "C" { static PyObject* PyHyperNet_getCell ( PyHyperNet *self ) { - trace << "PyHyperNet_getCell ()" << endl; + cdebug.log(20) << "PyHyperNet_getCell ()" << endl; Cell* cell = NULL; diff --git a/hurricane/src/isobar/PyInstance.cpp b/hurricane/src/isobar/PyInstance.cpp index 7f2fdf67..734859e7 100644 --- a/hurricane/src/isobar/PyInstance.cpp +++ b/hurricane/src/isobar/PyInstance.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2006-2015, All Rights Reserved +// Copyright (c) UPMC 2006-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -73,51 +73,51 @@ extern "C" { static PyObject* PyInstance_create ( PyObject*, PyObject *args ) { - trace << "PyInstance_create ()" << endl; + cdebug.log(20) << "PyInstance_create()" << endl; Instance* instance = NULL; - PyObject* arg0; - PyObject* arg1; - PyObject* arg2; - PyObject* arg3; + PyObject* arg0 = NULL; + PyObject* arg1 = NULL; + PyObject* arg2 = NULL; + PyObject* arg3 = NULL; HTRY - __cs.init ("Instance.create"); - if ( ! PyArg_ParseTuple(args,"O&O&O&|O&:Instance.new" - ,Converter,&arg0 - ,Converter,&arg1 - ,Converter,&arg2 - ,Converter,&arg3 - )) { - PyErr_SetString ( ConstructorError, "invalid number of parameters for Instance constructor." ); + __cs.init( "Instance.create" ); + if (not PyArg_ParseTuple(args,"O&O&O&|O&:Instance.create" + ,Converter,&arg0 + ,Converter,&arg1 + ,Converter,&arg2 + ,Converter,&arg3 + )) { + PyErr_SetString( ConstructorError, "Instance.create(): Invalid number of parameters." ); return NULL; } - if ( __cs.getObjectIds() == ":ent:string:ent") { - instance = Instance::create( - PYCELL_O(arg0), - Name(PyString_AsString(arg1)), - PYCELL_O(arg2) ); - } else if ( __cs.getObjectIds() == ":ent:string:ent:transfo") { - instance = Instance::create( - PYCELL_O(arg0), - Name(PyString_AsString(arg1)), - PYCELL_O(arg2), - *PYTRANSFORMATION_O(arg3), - Instance::PlacementStatus::PLACED); + if (__cs.getObjectIds() == ":ent:string:ent") { + instance = Instance::create( PYCELL_O(arg0) + , Name(PyString_AsString(arg1)) + , PYCELL_O(arg2) + ); + } else if (__cs.getObjectIds() == ":ent:string:ent:transfo") { + instance = Instance::create( PYCELL_O(arg0) + , Name(PyString_AsString(arg1)) + , PYCELL_O(arg2) + , *PYTRANSFORMATION_O(arg3) + , Instance::PlacementStatus::PLACED + ); } else { - PyErr_SetString ( ConstructorError, "invalid number of parameters for Instance constructor." ); + PyErr_SetString( ConstructorError, "Instance.create(): Bad type of parameter(s)." ); return NULL; } HCATCH - return PyInstance_Link ( instance ); + return PyInstance_Link( instance ); } static PyObject* PyInstance_getMasterCell ( PyInstance *self ) { - trace << "PyInstance_getMasterCell ()" << endl; + cdebug.log(20) << "PyInstance_getMasterCell ()" << endl; Cell* cell = NULL; @@ -132,7 +132,7 @@ extern "C" { static PyObject* PyInstance_getPlacementStatus ( PyInstance *self ) { - trace << "PyInstance_getPlacementStatus ()" << endl; + cdebug.log(20) << "PyInstance_getPlacementStatus ()" << endl; METHOD_HEAD ( "Instance.getPlacementStatus()" ); @@ -147,7 +147,7 @@ extern "C" { static PyObject* PyInstance_setPlacementStatus ( PyInstance *self, PyObject* args ) { - trace << "PyInstance_setPlacementStatus()" << endl; + cdebug.log(20) << "PyInstance_setPlacementStatus()" << endl; METHOD_HEAD ( "Instance.setPlacementStatus()" ) HTRY @@ -163,7 +163,7 @@ extern "C" { static PyObject* PyInstance_getTransformation ( PyInstance *self ) { - trace << "PyInstance_getTransformation ()" << endl; + cdebug.log(20) << "PyInstance_getTransformation ()" << endl; METHOD_HEAD ( "Instance.getTransformation()" ); PyTransformation* resultPyTransf = PyObject_NEW ( PyTransformation, &PyTypeTransformation ); @@ -179,7 +179,7 @@ extern "C" { static PyObject* PyInstance_getPlug ( PyInstance *self, PyObject* args ) { - trace << "PyInstance_getPlug ()" << endl; + cdebug.log(20) << "PyInstance_getPlug ()" << endl; Plug* plug = NULL; @@ -198,7 +198,7 @@ extern "C" { static PyObject* PyInstance_getPlugs(PyInstance *self ) { - trace << "PyInstance_getPlugs()" << endl; + cdebug.log(20) << "PyInstance_getPlugs()" << endl; METHOD_HEAD ( "Instance.getPlugs()" ) @@ -221,7 +221,7 @@ extern "C" { static PyObject* PyInstance_getConnectedPlugs(PyInstance *self) { - trace << "PyInstance_getConnectedPlugs ()" << endl; + cdebug.log(20) << "PyInstance_getConnectedPlugs ()" << endl; METHOD_HEAD ( "Instance.getConnectedPlugs()") @@ -244,7 +244,7 @@ extern "C" { static PyObject* PyInstance_getUnconnectedPlugs(PyInstance *self) { - trace << "PyInstance_getUnconnectedPlugs ()" << endl; + cdebug.log(20) << "PyInstance_getUnconnectedPlugs ()" << endl; METHOD_HEAD ( "Instance.getUnconnectedPlugs()") @@ -267,7 +267,7 @@ extern "C" { static PyObject* PyInstance_getAbutmentBox ( PyInstance *self ) { - trace << "PyInstance_getAbutmentBox ()" << endl; + cdebug.log(20) << "PyInstance_getAbutmentBox ()" << endl; METHOD_HEAD ( "Instance.getAbutmentBox()" ) PyBox* pyBox = PyObject_NEW ( PyBox, &PyTypeBox ); @@ -283,7 +283,7 @@ extern "C" { static PyObject* PyInstance_uniquify ( PyInstance *self ) { - trace << "PyInstance_uniquify ()" << endl; + cdebug.log(20) << "PyInstance_uniquify ()" << endl; HTRY METHOD_HEAD ( "Instance.uniquify()" ) @@ -295,7 +295,7 @@ extern "C" { static PyObject* PyInstance_slaveAbutmentBox ( PyInstance *self ) { - trace << "PyInstance_slaveAbutmentBox ()" << endl; + cdebug.log(20) << "PyInstance_slaveAbutmentBox ()" << endl; METHOD_HEAD ( "Instance.slaveAbutmentBox()" ) HTRY @@ -309,7 +309,7 @@ extern "C" { static PyObject* PyInstance_getClone ( PyInstance *self, PyObject* args ) { - trace << "PyInstance_getClone ()" << endl; + cdebug.log(20) << "PyInstance_getClone ()" << endl; Instance* cloneInstance = NULL; HTRY @@ -332,7 +332,7 @@ extern "C" { static PyObject* PyInstance_setTransformation ( PyInstance *self, PyObject* args ) { - trace << "PyInstance_setTransformation()" << endl; + cdebug.log(20) << "PyInstance_setTransformation()" << endl; METHOD_HEAD ( "Instance.setTransformation()" ) HTRY @@ -348,7 +348,7 @@ extern "C" { static PyObject* PyInstance_setMasterCell ( PyInstance *self, PyObject* args ) { - trace << "Instance.setMasterCell()" << endl; + cdebug.log(20) << "Instance.setMasterCell()" << endl; METHOD_HEAD ( "Instance.setMasterCell()" ) HTRY diff --git a/hurricane/src/isobar/PyInterval.cpp b/hurricane/src/isobar/PyInterval.cpp index 7252dc53..cb9edc56 100644 --- a/hurricane/src/isobar/PyInterval.cpp +++ b/hurricane/src/isobar/PyInterval.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2014-2015, All Rights Reserved +// Copyright (c) UPMC 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -54,7 +54,7 @@ extern "C" { // Class Method : "PyInterval_NEW ()" static PyObject* PyInterval_NEW (PyObject *module, PyObject *args) { - trace << "PyInterval_NEW()" << endl; + cdebug.log(20) << "PyInterval_NEW()" << endl; Interval* interval = NULL; @@ -85,13 +85,13 @@ extern "C" { static int PyInterval_Init ( PyInterval* self, PyObject* args, PyObject* kwargs ) { - trace << "PyInterval_Init(): " << (void*)self << endl; + cdebug.log(20) << "PyInterval_Init(): " << (void*)self << endl; return 0; } static PyObject* PyInterval_getUnion ( PyInterval *self, PyObject* args ) { - trace << "PyInterval_getUnion()" << endl; + cdebug.log(20) << "PyInterval_getUnion()" << endl; METHOD_HEAD ( "Interval.getUnion()" ) @@ -110,7 +110,7 @@ extern "C" { static PyObject* PyInterval_getIntersection ( PyInterval *self, PyObject* args ) { - trace << "PyInterval_getIntersection()" << endl; + cdebug.log(20) << "PyInterval_getIntersection()" << endl; METHOD_HEAD ( "Interval.getIntersection()" ) @@ -129,7 +129,7 @@ extern "C" { static PyObject* PyInterval_contains ( PyInterval *self, PyObject* args ) { - trace << "PyInterval_contains ()" << endl; + cdebug.log(20) << "PyInterval_contains ()" << endl; METHOD_HEAD( "Interval.contains()" ) @@ -155,7 +155,7 @@ extern "C" { static PyObject* PyInterval_intersect ( PyInterval *self, PyObject* args ) { - trace << "PyInterval_intersect ()" << endl; + cdebug.log(20) << "PyInterval_intersect ()" << endl; bool result = false; HTRY @@ -176,7 +176,7 @@ extern "C" { static PyObject* PyInterval_makeEmpty ( PyInterval *self, PyObject* args ) { - trace << "PyInterval_makeEmpty ()" << endl; + cdebug.log(20) << "PyInterval_makeEmpty ()" << endl; METHOD_HEAD( "Interval.makeEmpty()" ) interval->makeEmpty(); @@ -187,7 +187,7 @@ extern "C" { static PyObject* PyInterval_inflate ( PyInterval *self, PyObject* args ) { - trace << "PyInterval_inflate ()" << endl; + cdebug.log(20) << "PyInterval_inflate ()" << endl; METHOD_HEAD( "Interval.inflate()" ) @@ -213,7 +213,7 @@ extern "C" { static PyObject* PyInterval_merge ( PyInterval *self, PyObject* args ) { - trace << "PyInterval_merge ()" << endl; + cdebug.log(20) << "PyInterval_merge ()" << endl; METHOD_HEAD( "Interval.merge()" ) @@ -239,7 +239,7 @@ extern "C" { static PyObject* PyInterval_intersection ( PyInterval *self, PyObject* args ) { - trace << "PyInterval_intersection ()" << endl; + cdebug.log(20) << "PyInterval_intersection ()" << endl; METHOD_HEAD( "Interval.intersection()" ) @@ -265,7 +265,7 @@ extern "C" { static PyObject* PyInterval_translate ( PyInterval *self, PyObject* args ) { - trace << "PyInterval_translate ()" << endl; + cdebug.log(20) << "PyInterval_translate ()" << endl; HTRY METHOD_HEAD( "Interval.translate()" ) diff --git a/hurricane/src/isobar/PyLayer.cpp b/hurricane/src/isobar/PyLayer.cpp index 15d9ac77..eeb06238 100644 --- a/hurricane/src/isobar/PyLayer.cpp +++ b/hurricane/src/isobar/PyLayer.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2006-2015, All Rights Reserved +// Copyright (c) UPMC 2006-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -51,7 +51,7 @@ extern "C" { # define accessorDbuFromOptBasicLayer(FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ static PyObject* PY_SELF_TYPE##_##FUNC_NAME ( PY_SELF_TYPE* self, PyObject* args ) \ { \ - trace << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ + cdebug.log(20) << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ \ DbU::Unit rvalue = 0; \ \ @@ -85,7 +85,7 @@ extern "C" { # define accessorLayerFromLayer(FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ static PyObject* PY_SELF_TYPE##_##FUNC_NAME ( PY_SELF_TYPE* self, PyObject* args ) \ { \ - trace << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ + cdebug.log(20) << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ \ Layer* rlayer = 0; \ \ @@ -116,7 +116,7 @@ extern "C" { # define accessorMaskFromVoid(FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ static PyObject* PY_SELF_TYPE##_##FUNC_NAME ( PY_SELF_TYPE* self ) \ { \ - trace << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ + cdebug.log(20) << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ \ Layer::Mask mask = 0; \ \ @@ -132,7 +132,7 @@ extern "C" { # define accessorLayerFromOptBool(FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ static PyObject* PY_SELF_TYPE##_##FUNC_NAME ( PY_SELF_TYPE* self, PyObject* args ) \ { \ - trace << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ + cdebug.log(20) << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ \ Layer* rlayer = NULL; \ \ @@ -162,7 +162,7 @@ extern "C" { # define predicateFromVoid(FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ static PyObject* PY_SELF_TYPE##_##FUNC_NAME ( PY_SELF_TYPE* self ) \ { \ - trace << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ + cdebug.log(20) << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ \ HTRY \ GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#SELF_TYPE"."#FUNC_NAME"()") \ @@ -176,7 +176,7 @@ extern "C" { # define updatorFromDbu(FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ static PyObject* PY_SELF_TYPE##_##FUNC_NAME ( PY_SELF_TYPE* self, PyObject* args ) \ { \ - trace << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ + cdebug.log(20) << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ \ HTRY \ GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#SELF_TYPE"."#FUNC_NAME"()") \ @@ -199,7 +199,7 @@ extern "C" { # define updatorFromBasicLayerDbu(FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ static PyObject* PY_SELF_TYPE##_##FUNC_NAME ( PY_SELF_TYPE* self, PyObject* args ) \ { \ - trace << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ + cdebug.log(20) << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ \ HTRY \ GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#SELF_TYPE"."#FUNC_NAME"()") \ @@ -227,7 +227,7 @@ extern "C" { static PyObject* PyLayer_getTechnology ( PyLayer *self ) { - trace << "PyLayer_getTechnology ()" << endl; + cdebug.log(20) << "PyLayer_getTechnology ()" << endl; Technology* techno = NULL; diff --git a/hurricane/src/isobar/PyLayerMask.cpp b/hurricane/src/isobar/PyLayerMask.cpp index 1de221f0..f0006768 100644 --- a/hurricane/src/isobar/PyLayerMask.cpp +++ b/hurricane/src/isobar/PyLayerMask.cpp @@ -106,7 +106,7 @@ extern "C" { static PyObject* PyLayerMask_new ( PyTypeObject* type, PyObject* args, PyObject* kwds ) { - trace << "PyLayerMask_new()" << endl; + cdebug.log(20) << "PyLayerMask_new()" << endl; PyLayerMask* pyMask = (PyLayerMask*)type->tp_alloc(type,0); @@ -287,7 +287,7 @@ extern "C" { static void PyLayerMask_DeAlloc ( PyLayerMask *self ) { - trace << "PyLayerMask_DeAlloc(" << hex << self << ") " << self->_object << endl; + cdebug.log(20) << "PyLayerMask_DeAlloc(" << hex << self << ") " << self->_object << endl; PyObject_DEL ( self ); } @@ -312,7 +312,7 @@ extern "C" { extern void PyLayerMask_LinkPyType() { - trace << "PyLayerMask_LinkType()" << endl; + cdebug.log(20) << "PyLayerMask_LinkType()" << endl; PyTypeLayerMask.tp_new = PyLayerMask_new; PyTypeLayerMask.tp_dealloc = (destructor) PyLayerMask_DeAlloc; diff --git a/hurricane/src/isobar/PyLibrary.cpp b/hurricane/src/isobar/PyLibrary.cpp index 006b5702..f172767b 100644 --- a/hurricane/src/isobar/PyLibrary.cpp +++ b/hurricane/src/isobar/PyLibrary.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -40,7 +40,7 @@ extern "C" { static PyObject* PyLibrary_create ( PyObject *, PyObject *args ) { - trace << "PyLibrary_create()" << endl; + cdebug.log(20) << "PyLibrary_create()" << endl; PyObject* arg0; PyObject* arg1; @@ -69,7 +69,7 @@ extern "C" { static PyObject* PyLibrary_getSubLibrary ( PyLibrary *self, PyObject* args ) { - trace << "PyLibrary_getLibrary ()" << endl; + cdebug.log(20) << "PyLibrary_getLibrary ()" << endl; Library* subLibrary = NULL; @@ -89,7 +89,7 @@ extern "C" { static PyObject* PyLibrary_getCell ( PyLibrary* self, PyObject* args ) { - trace << "PyLibrary_getCell ()" << endl; + cdebug.log(20) << "PyLibrary_getCell ()" << endl; Cell* cell = NULL; @@ -109,7 +109,7 @@ extern "C" { static PyObject* PyLibrary_getCells(PyLibrary *self) { - trace << "PyLibrary_getCells()" << endl; + cdebug.log(20) << "PyLibrary_getCells()" << endl; METHOD_HEAD ( "Library.getCells()" ) @@ -135,7 +135,7 @@ extern "C" { PyMethodDef PyLibrary_Methods[] = - { { "create" , (PyCFunction)PyLibrary_create , METH_NOARGS|METH_STATIC + { { "create" , (PyCFunction)PyLibrary_create , METH_VARARGS|METH_STATIC , "Creates a new library." } , { "getName" , (PyCFunction)PyLibrary_getName , METH_NOARGS , "Returns the name of the library." } , { "getLibrary", (PyCFunction)PyLibrary_getSubLibrary, METH_VARARGS, "Get the sub-library named " } diff --git a/hurricane/src/isobar/PyMaterial.cpp b/hurricane/src/isobar/PyMaterial.cpp index d938341a..98f0e563 100644 --- a/hurricane/src/isobar/PyMaterial.cpp +++ b/hurricane/src/isobar/PyMaterial.cpp @@ -71,7 +71,7 @@ extern "C" { static PyObject* PyMaterial_new ( PyTypeObject* type, PyObject* args, PyObject* kwds ) { - trace << "PyMaterial_new()" << endl; + cdebug.log(20) << "PyMaterial_new()" << endl; BasicLayer::Material* material = NULL; PyMaterial* pyMaterial = (PyMaterial*)type->tp_alloc(type,0); @@ -101,7 +101,7 @@ extern "C" { PyObject* PyMaterial_getCode ( PyMaterial* self ) { - trace << "PyMaterial_getCode()" << endl; + cdebug.log(20) << "PyMaterial_getCode()" << endl; int code = 0; @@ -146,7 +146,7 @@ extern "C" { DirectDeleteMethod(PyMaterial_DeAlloc, PyMaterial) extern void PyMaterial_LinkPyType() { - trace << "PyMaterial_LinkType()" << endl; + cdebug.log(20) << "PyMaterial_LinkType()" << endl; PyTypeMaterial.tp_new = PyMaterial_new; PyTypeMaterial.tp_dealloc = (destructor) PyMaterial_DeAlloc; diff --git a/hurricane/src/isobar/PyNet.cpp b/hurricane/src/isobar/PyNet.cpp index 921a7595..b1b08d5a 100644 --- a/hurricane/src/isobar/PyNet.cpp +++ b/hurricane/src/isobar/PyNet.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2006-2015, All Rights Reserved +// Copyright (c) UPMC 2006-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -68,6 +68,7 @@ extern "C" { case Net::Type::CLOCK : return ( Net::Type(Net::Type::CLOCK) ); case Net::Type::POWER : return ( Net::Type(Net::Type::POWER) ); case Net::Type::GROUND : return ( Net::Type(Net::Type::GROUND) ); + case Net::Type::BLOCKAGE : return ( Net::Type(Net::Type::BLOCKAGE) ); } return ( Net::Type(Net::Type::UNDEFINED) ); @@ -126,7 +127,7 @@ extern "C" { // Attribute Method : "PyNet_create ()" static PyObject* PyNet_create ( PyObject*, PyObject *args ) { - trace << "PyNet_create()" << endl; + cdebug.log(20) << "PyNet_create()" << endl; char* name = NULL; PyCell* pyCell = NULL; @@ -150,7 +151,7 @@ extern "C" { static PyObject* PyNet_getType ( PyNet *self ) { - trace << "PyNet_getType ()" << endl; + cdebug.log(20) << "PyNet_getType ()" << endl; METHOD_HEAD ( "Net.getType()" ) @@ -164,7 +165,7 @@ extern "C" { static PyObject* PyNet_getDirection ( PyNet *self ) { - trace << "PyNet_getDirection ()" << endl; + cdebug.log(20) << "PyNet_getDirection ()" << endl; METHOD_HEAD ( "Net.getDirection()" ) @@ -176,7 +177,7 @@ extern "C" { // Attribute Method : "PyNet_getPlugs()" static PyObject* PyNet_getPlugs(PyNet *self) { - trace << "PyNet_getPlugs()" << endl; + cdebug.log(20) << "PyNet_getPlugs()" << endl; METHOD_HEAD("Net.getPlugs()") @@ -201,7 +202,7 @@ extern "C" { // Attribute Method : "PyNet_getSegments()" static PyObject* PyNet_getSegments(PyNet *self) { - trace << "PyNet_getSegments()" << endl; + cdebug.log(20) << "PyNet_getSegments()" << endl; METHOD_HEAD ("Net.getSegments()") @@ -226,7 +227,7 @@ extern "C" { // Attribute Method : "PyNet_getPins()" static PyObject* PyNet_getPins(PyNet *self) { - trace << "PyNet_getPins()" << endl; + cdebug.log(20) << "PyNet_getPins()" << endl; METHOD_HEAD ("Net.getPins()") @@ -251,7 +252,7 @@ extern "C" { // Attribute Method : "PyNet_getComponents()" static PyObject* PyNet_getComponents(PyNet *self) { - trace << "PyNet_getComponents()" << endl; + cdebug.log(20) << "PyNet_getComponents()" << endl; METHOD_HEAD ( "Net.getComponents()" ) @@ -274,7 +275,7 @@ extern "C" { // Attribute Method : "PyNet_getExternalComponents()" static PyObject* PyNet_getExternalComponents(PyNet *self) { - trace << "PyNet_getExternalComponents()" << endl; + cdebug.log(20) << "PyNet_getExternalComponents()" << endl; METHOD_HEAD ( "Net.getExternalcomponents()" ) @@ -303,7 +304,7 @@ extern "C" { // Attribute Method : "PyNet_setGlobal ()" static PyObject* PyNet_setGlobal ( PyNet *self, PyObject* args ) { - trace << "PyNet_setGlobal()" << endl; + cdebug.log(20) << "PyNet_setGlobal()" << endl; HTRY METHOD_HEAD ( "Net.setGlobal()" ) @@ -325,7 +326,7 @@ extern "C" { // Attribute Method : "PyNet_setExternal ()" static PyObject* PyNet_setExternal ( PyNet *self, PyObject* args ) { - trace << "PyNet_setExternal()" << endl; + cdebug.log(20) << "PyNet_setExternal()" << endl; HTRY METHOD_HEAD ( "Net.setExternal()" ) @@ -348,7 +349,7 @@ extern "C" { static PyObject* PyNet_setType ( PyNet *self, PyObject* args ) { - trace << "PyNet_setType()" << endl; + cdebug.log(20) << "PyNet_setType()" << endl; HTRY @@ -374,7 +375,7 @@ extern "C" { static PyObject* PyNet_setDirection ( PyNet *self, PyObject* args ) { - trace << "PyNet_setDirection()" << endl; + cdebug.log(20) << "PyNet_setDirection()" << endl; HTRY @@ -396,7 +397,7 @@ extern "C" { static PyObject* PyNet_addAlias ( PyNet *self, PyObject* args ) { - trace << "PyNet_addAlias()" << endl; + cdebug.log(20) << "PyNet_addAlias()" << endl; HTRY METHOD_HEAD ( "Net.addAlias()" ) @@ -420,7 +421,7 @@ extern "C" { static PyObject* PyNet_removeAlias ( PyNet *self, PyObject* args ) { - trace << "PyNet_removeAlias()" << endl; + cdebug.log(20) << "PyNet_removeAlias()" << endl; HTRY METHOD_HEAD ( "Net.removeAlias()" ) @@ -444,7 +445,7 @@ extern "C" { static PyObject* PyNet_setPosition ( PyNet *self, PyObject* args ) { - trace << "PyNet_setPosition()" << endl; + cdebug.log(20) << "PyNet_setPosition()" << endl; HTRY @@ -465,7 +466,7 @@ extern "C" { // Attribute Method : "PyNet_merge ()" static PyObject* PyNet_merge ( PyNet *self, PyObject* args ) { - trace << "PyNet_merge()" << endl; + cdebug.log(20) << "PyNet_merge()" << endl; HTRY PyNet* pyNetToMerge; @@ -485,7 +486,7 @@ extern "C" { // Attribute Method : "PyNet_merge ()" static PyObject* PyNet_getClone ( PyNet *self, PyObject* args ) { - trace << "PyNet_getClone()" << endl; + cdebug.log(20) << "PyNet_getClone()" << endl; Net* cloneNet = NULL; HTRY diff --git a/hurricane/src/isobar/PyNetDirection.cpp b/hurricane/src/isobar/PyNetDirection.cpp index e1913b42..062eef15 100644 --- a/hurricane/src/isobar/PyNetDirection.cpp +++ b/hurricane/src/isobar/PyNetDirection.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2014-2015, All Rights Reserved +// Copyright (c) UPMC 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -24,7 +24,6 @@ namespace Isobar { using std::hex; using std::ostringstream; using Hurricane::tab; - using Hurricane::in_trace; using Hurricane::Error; using Hurricane::Warning; using Isobar::ProxyProperty; @@ -69,7 +68,7 @@ extern "C" { DirectHashMethod(PyNetDirection_Hash, PyNetDirection) extern void PyNetDirection_LinkPyType() { - trace << "PyNetDirection_LinkType()" << endl; + cdebug.log(20) << "PyNetDirection_LinkType()" << endl; PyTypeNetDirection.tp_dealloc = (destructor) PyNetDirection_DeAlloc; PyTypeNetDirection.tp_compare = (cmpfunc) PyNetDirection_Cmp; PyTypeNetDirection.tp_repr = (reprfunc) PyNetDirection_Repr; diff --git a/hurricane/src/isobar/PyNetExternalComponents.cpp b/hurricane/src/isobar/PyNetExternalComponents.cpp index ce160931..6ef26487 100644 --- a/hurricane/src/isobar/PyNetExternalComponents.cpp +++ b/hurricane/src/isobar/PyNetExternalComponents.cpp @@ -1,8 +1,7 @@ - // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2013, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -40,13 +39,13 @@ extern "C" { static void PyNetExternalComponents_DeAlloc ( PyNetExternalComponents* self ) { - trace << "PySingletonObject_DeAlloc(" << hex << self << ")" << endl; + cdebug.log(20) << "PySingletonObject_DeAlloc(" << hex << self << ")" << endl; } static PyObject* PyNetExternalComponents_isExternal ( PyObject*, PyObject *args ) { - trace << "PyNetExternalComponents_isExternal()" << endl; + cdebug.log(20) << "PyNetExternalComponents_isExternal()" << endl; bool isExternal = false; @@ -64,7 +63,7 @@ extern "C" { static PyObject* PyNetExternalComponents_setExternal ( PyObject*, PyObject *args ) { - trace << "PyNetExternalComponents_setExternal()" << endl; + cdebug.log(20) << "PyNetExternalComponents_setExternal()" << endl; HTRY PyObject* pyComponent; @@ -86,7 +85,7 @@ extern "C" { static PyObject* PyNetExternalComponents_get ( PyObject*, PyObject* args ) { - trace << "PyNetExternalComponents_getExternalComponents()" << endl; + cdebug.log(20) << "PyNetExternalComponents_getExternalComponents()" << endl; PyObject* arg0; @@ -124,7 +123,7 @@ extern "C" { // extern void PyNetExternalComponents_LinkPyType() // { - // trace << "PyNetExternalComponents_LinkType()" << endl; + // cdebug.log(20) << "PyNetExternalComponents_LinkType()" << endl; // PyTypeNetExternalComponents.tp_new = (newfunc) PyType_GenericNew; // PyTypeNetExternalComponents.tp_dealloc = (destructor)PyNetExternalComponents_DeAlloc; @@ -149,5 +148,5 @@ extern "C" { } // End of extern "C". -} // End of Isobar namespace. +} // Isobar namespace. diff --git a/hurricane/src/isobar/PyNetType.cpp b/hurricane/src/isobar/PyNetType.cpp index e6846da3..6d181d5d 100644 --- a/hurricane/src/isobar/PyNetType.cpp +++ b/hurricane/src/isobar/PyNetType.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2014-2015, All Rights Reserved +// Copyright (c) UPMC 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -24,7 +24,6 @@ namespace Isobar { using std::hex; using std::ostringstream; using Hurricane::tab; - using Hurricane::in_trace; using Hurricane::Error; using Hurricane::Warning; using Isobar::ProxyProperty; @@ -68,7 +67,7 @@ extern "C" { DirectHashMethod(PyNetType_Hash, PyNetType) extern void PyNetType_LinkPyType() { - trace << "PyNetType_LinkType()" << endl; + cdebug.log(20) << "PyNetType_LinkType()" << endl; PyTypeNetType.tp_dealloc = (destructor) PyNetType_DeAlloc; PyTypeNetType.tp_compare = (cmpfunc) PyNetType_Cmp; PyTypeNetType.tp_repr = (reprfunc) PyNetType_Repr; @@ -98,6 +97,7 @@ extern "C" { LoadObjectConstant(PyTypeNetType.tp_dict,Net::Type::CLOCK ,"CLOCK" ); LoadObjectConstant(PyTypeNetType.tp_dict,Net::Type::POWER ,"POWER" ); LoadObjectConstant(PyTypeNetType.tp_dict,Net::Type::GROUND ,"GROUND" ); + LoadObjectConstant(PyTypeNetType.tp_dict,Net::Type::BLOCKAGE ,"BLOCKAGE" ); } diff --git a/hurricane/src/isobar/PyOccurrence.cpp b/hurricane/src/isobar/PyOccurrence.cpp index c2b21c4a..df0393f5 100644 --- a/hurricane/src/isobar/PyOccurrence.cpp +++ b/hurricane/src/isobar/PyOccurrence.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2013-2015, All Rights Reserved +// Copyright (c) UPMC 2013-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -62,7 +62,7 @@ extern "C" { // Attribute Method : "PyOccurrence_NEW ()" PyObject* PyOccurrence_NEW ( PyObject *module, PyObject *args ) { - trace << "PyOccurrence_NEW()" << endl; + cdebug.log(20) << "PyOccurrence_NEW()" << endl; Occurrence* occurrence; PyObject* arg0; @@ -102,7 +102,7 @@ extern "C" { static int PyOccurrence_Init ( PyOccurrence* self, PyObject* args, PyObject* kwargs ) { - trace << "PyOccurrence_Init(): " << (void*)self << endl; + cdebug.log(20) << "PyOccurrence_Init(): " << (void*)self << endl; return 0; } @@ -111,7 +111,7 @@ extern "C" { // Attribute Method : "PyOccurrence_getEntity ()" static PyObject* PyOccurrence_getEntity ( PyOccurrence *self ) { - trace << "PyOccurrence_getEntity()" << endl; + cdebug.log(20) << "PyOccurrence_getEntity()" << endl; METHOD_HEAD ( "Occurrence.getEntity()" ) @@ -133,7 +133,7 @@ extern "C" { // Attribute Method : "PyOccurrence_getOwnerCell ()" static PyObject* PyOccurrence_getOwnerCell ( PyOccurrence *self ) { - trace << "PyOccurrence_getOwnerCell()" << endl; + cdebug.log(20) << "PyOccurrence_getOwnerCell()" << endl; METHOD_HEAD ( "Occurernce.getOwnerCell()" ) @@ -152,7 +152,7 @@ extern "C" { static PyObject* PyOccurrence_getMasterCell ( PyOccurrence *self ) { - trace << "PyOccurrence_getMasterCell()" << endl; + cdebug.log(20) << "PyOccurrence_getMasterCell()" << endl; METHOD_HEAD ( "Occurrence.getMasterCell()" ) @@ -171,7 +171,7 @@ extern "C" { static PyObject* PyOccurrence_getPath ( PyOccurrence *self ) { - trace << "PyOccurrence_getPath ()" << endl; + cdebug.log(20) << "PyOccurrence_getPath ()" << endl; METHOD_HEAD ( "Occurrence.getPath()" ) @@ -197,7 +197,7 @@ extern "C" { static PyObject* PyOccurrence_getBoundingBox ( PyOccurrence *self ) { - trace << "PyOccurrence_getBoundingBox ()" << endl; + cdebug.log(20) << "PyOccurrence_getBoundingBox ()" << endl; METHOD_HEAD ( "Occurrence.getBoundingBox()" ) diff --git a/hurricane/src/isobar/PyOrientation.cpp b/hurricane/src/isobar/PyOrientation.cpp index 45d4330c..b9f05dc0 100644 --- a/hurricane/src/isobar/PyOrientation.cpp +++ b/hurricane/src/isobar/PyOrientation.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2014-2015, All Rights Reserved +// Copyright (c) UPMC 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -24,7 +24,6 @@ namespace Isobar { using std::hex; using std::ostringstream; using Hurricane::tab; - using Hurricane::in_trace; using Hurricane::Error; using Hurricane::Warning; using Isobar::ProxyProperty; @@ -73,7 +72,7 @@ extern "C" { DirectHashMethod(PyOrientation_Hash, PyOrientation) extern void PyOrientation_LinkPyType() { - trace << "PyOrientation_LinkType()" << endl; + cdebug.log(20) << "PyOrientation_LinkType()" << endl; PyTypeOrientation.tp_dealloc = (destructor) PyOrientation_DeAlloc; PyTypeOrientation.tp_compare = (cmpfunc) PyOrientation_Cmp; PyTypeOrientation.tp_repr = (reprfunc) PyOrientation_Repr; diff --git a/hurricane/src/isobar/PyPad.cpp b/hurricane/src/isobar/PyPad.cpp index e4c75b06..8306686e 100644 --- a/hurricane/src/isobar/PyPad.cpp +++ b/hurricane/src/isobar/PyPad.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2006-2015, All Rights Reserved +// Copyright (c) UPMC 2006-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -57,7 +57,7 @@ extern "C" { // Attribute Method : "PyPad_create ()" static PyObject* PyPad_create ( PyObject*, PyObject *args ) { - trace << "PyPad_create()" << endl; + cdebug.log(20) << "PyPad_create()" << endl; PyObject* arg0; PyObject* arg1; @@ -91,7 +91,7 @@ extern "C" { // Attribute Method : "PyPad_getBoundingBox ()" static PyObject* PyPad_getBoundingBox( PyPad *self ) { - trace << "PyPad_getBoundingBox()" << endl; + cdebug.log(20) << "PyPad_getBoundingBox()" << endl; METHOD_HEAD ( "Pad.BoundingBox()" ) @@ -109,7 +109,7 @@ extern "C" { // Attribute Method : "PyPad_setBoudingBox()" static PyObject* PyPad_setBoundingBox(PyPad *self, PyObject* args) { - trace << "Pad.setBoudingBox()" << endl; + cdebug.log(20) << "Pad.setBoudingBox()" << endl; HTRY METHOD_HEAD ( "Pad.setBoudingBox()" ) @@ -129,7 +129,7 @@ extern "C" { // Attribute Method : "PyPad_translate ()" static PyObject* PyPad_translate ( PyPad *self, PyObject* args ) { - trace << "PyPad_translate ()" << endl; + cdebug.log(20) << "PyPad_translate ()" << endl; HTRY METHOD_HEAD ( "Pad.translate()" ) diff --git a/hurricane/src/isobar/PyPath.cpp b/hurricane/src/isobar/PyPath.cpp index b218e51b..f7ba620b 100644 --- a/hurricane/src/isobar/PyPath.cpp +++ b/hurricane/src/isobar/PyPath.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2006-2015, All Rights Reserved +// Copyright (c) UPMC 2006-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -58,7 +58,7 @@ extern "C" { // Attribute Method : "PyPath_NEW ()" static PyObject* PyPath_NEW ( PyObject *module, PyObject *args ) { - trace << "PyPath_NEW()" << endl; + cdebug.log(20) << "PyPath_NEW()" << endl; Path* path = NULL; PyObject* arg0 = NULL; @@ -102,7 +102,7 @@ extern "C" { static int PyPath_Init ( PyPath* self, PyObject* args, PyObject* kwargs ) { - trace << "PyPath_Init(): " << (void*)self << endl; + cdebug.log(20) << "PyPath_Init(): " << (void*)self << endl; return 0; } @@ -111,7 +111,7 @@ extern "C" { // Attribute Method : "PyPath_getHeadInstance ()" static PyObject* PyPath_getHeadInstance ( PyPath *self ) { - trace << "PyPath_getHeadInstance()" << endl; + cdebug.log(20) << "PyPath_getHeadInstance()" << endl; METHOD_HEAD ( "Path.getHeadInstance()" ) @@ -129,7 +129,7 @@ extern "C" { // Attribute Method : "PyPath_getTailInstance ()" static PyObject* PyPath_getTailInstance ( PyPath *self ) { - trace << "PyPath_getTailInstance()" << endl; + cdebug.log(20) << "PyPath_getTailInstance()" << endl; METHOD_HEAD ( "Path.getTailInstance()" ) @@ -147,7 +147,7 @@ extern "C" { // Attribute Method : "PyPath_getOwnerCell ()" static PyObject* PyPath_getOwnerCell ( PyPath *self ) { - trace << "PyPath_getOwnerCell()" << endl; + cdebug.log(20) << "PyPath_getOwnerCell()" << endl; METHOD_HEAD ( "Path.getOwnerCell()" ) @@ -165,7 +165,7 @@ extern "C" { // Attribute Method : "PyPath_getMasterCell ()" static PyObject* PyPath_getMasterCell ( PyPath *self ) { - trace << "PyPath_getMasterCell()" << endl; + cdebug.log(20) << "PyPath_getMasterCell()" << endl; METHOD_HEAD ( "Path.getMasterCell()" ) @@ -190,7 +190,7 @@ extern "C" { static PyObject* PyPath_getHeadPath ( PyPath *self ) { - trace << "PyPath_getHeadPath ()" << endl; + cdebug.log(20) << "PyPath_getHeadPath ()" << endl; METHOD_HEAD ( "Path.getHeadPath()" ) @@ -211,7 +211,7 @@ extern "C" { static PyObject* PyPath_getTailPath ( PyPath *self ) { - trace << "PyPath_getTailPath ()" << endl; + cdebug.log(20) << "PyPath_getTailPath ()" << endl; METHOD_HEAD ( "Path.getTailPath()" ) @@ -231,7 +231,7 @@ extern "C" { static PyObject* PyPath_getTransformation ( PyPath *self, PyObject* args ) { - trace << "PyPath_getTransformation ()" << endl; + cdebug.log(20) << "PyPath_getTransformation ()" << endl; METHOD_HEAD ( "Instance.getTransformation()" ); @@ -263,7 +263,7 @@ extern "C" { static PyObject* PyPath_getInstances(PyPath *self) { - trace << "PyPath_getInstances()" << endl; + cdebug.log(20) << "PyPath_getInstances()" << endl; METHOD_HEAD ( "Path.getInstances()" ) diff --git a/hurricane/src/isobar/PyPin.cpp b/hurricane/src/isobar/PyPin.cpp index eb8cb947..6cfe21b6 100644 --- a/hurricane/src/isobar/PyPin.cpp +++ b/hurricane/src/isobar/PyPin.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2006-2015, All Rights Reserved +// Copyright (c) UPMC 2006-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -79,7 +79,7 @@ extern "C" { HTRY - trace << "PyPin_create()" << endl; + cdebug.log(20) << "PyPin_create()" << endl; PyObject* arg0; PyObject* arg1; PyObject* arg2; @@ -152,7 +152,7 @@ extern "C" { // Standart Accessors (Attributes). PyObject* PyPin_getAccessDirection( PyPin* self ) { - trace << "PyNet_getAccessDirection ()" << endl; + cdebug.log(20) << "PyNet_getAccessDirection ()" << endl; METHOD_HEAD ( "Net.getAccessDirection()" ) diff --git a/hurricane/src/isobar/PyPinDirection.cpp b/hurricane/src/isobar/PyPinDirection.cpp index ee4d3ee8..dbc59023 100644 --- a/hurricane/src/isobar/PyPinDirection.cpp +++ b/hurricane/src/isobar/PyPinDirection.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2014-2015, All Rights Reserved +// Copyright (c) UPMC 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -24,7 +24,6 @@ namespace Isobar { using std::hex; using std::ostringstream; using Hurricane::tab; - using Hurricane::in_trace; using Hurricane::Error; using Hurricane::Warning; using Isobar::ProxyProperty; @@ -69,7 +68,7 @@ extern "C" { DirectHashMethod(PyPinDirection_Hash, PyPinDirection) extern void PyPinDirection_LinkPyType() { - trace << "PyPinDirection_LinkType()" << endl; + cdebug.log(20) << "PyPinDirection_LinkType()" << endl; PyTypePinDirection.tp_dealloc = (destructor) PyPinDirection_DeAlloc; PyTypePinDirection.tp_compare = (cmpfunc) PyPinDirection_Cmp; PyTypePinDirection.tp_repr = (reprfunc) PyPinDirection_Repr; diff --git a/hurricane/src/isobar/PyPinPlacementStatus.cpp b/hurricane/src/isobar/PyPinPlacementStatus.cpp index a9b5092a..a4e10380 100644 --- a/hurricane/src/isobar/PyPinPlacementStatus.cpp +++ b/hurricane/src/isobar/PyPinPlacementStatus.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2014-2015, All Rights Reserved +// Copyright (c) UPMC 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -24,7 +24,6 @@ namespace Isobar { using std::hex; using std::ostringstream; using Hurricane::tab; - using Hurricane::in_trace; using Hurricane::Error; using Hurricane::Warning; using Isobar::ProxyProperty; @@ -69,7 +68,7 @@ extern "C" { DirectHashMethod(PyPinPlacementStatus_Hash, PyPinPlacementStatus) extern void PyPinPlacementStatus_LinkPyType() { - trace << "PyPinPlacementStatus_LinkType()" << endl; + cdebug.log(20) << "PyPinPlacementStatus_LinkType()" << endl; PyTypePinPlacementStatus.tp_dealloc = (destructor) PyPinPlacementStatus_DeAlloc; PyTypePinPlacementStatus.tp_compare = (cmpfunc) PyPinPlacementStatus_Cmp; PyTypePinPlacementStatus.tp_repr = (reprfunc) PyPinPlacementStatus_Repr; diff --git a/hurricane/src/isobar/PyPlacementStatus.cpp b/hurricane/src/isobar/PyPlacementStatus.cpp index 3afea02f..ced50c59 100644 --- a/hurricane/src/isobar/PyPlacementStatus.cpp +++ b/hurricane/src/isobar/PyPlacementStatus.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2014-2015, All Rights Reserved +// Copyright (c) UPMC 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -24,7 +24,6 @@ namespace Isobar { using std::hex; using std::ostringstream; using Hurricane::tab; - using Hurricane::in_trace; using Hurricane::Error; using Hurricane::Warning; using Isobar::ProxyProperty; @@ -73,7 +72,7 @@ extern "C" { DirectHashMethod(PyPlacementStatus_Hash, PyPlacementStatus) extern void PyPlacementStatus_LinkPyType() { - trace << "PyPlacementStatus_LinkType()" << endl; + cdebug.log(20) << "PyPlacementStatus_LinkType()" << endl; PyTypePlacementStatus.tp_dealloc = (destructor) PyPlacementStatus_DeAlloc; PyTypePlacementStatus.tp_compare = (cmpfunc) PyPlacementStatus_Cmp; PyTypePlacementStatus.tp_repr = (reprfunc) PyPlacementStatus_Repr; diff --git a/hurricane/src/isobar/PyPlug.cpp b/hurricane/src/isobar/PyPlug.cpp index 9b1f0bbb..9644571c 100644 --- a/hurricane/src/isobar/PyPlug.cpp +++ b/hurricane/src/isobar/PyPlug.cpp @@ -94,7 +94,7 @@ extern "C" { static PyObject* PyPlug_getInstance ( PyPlug *self ) { - trace << "PyPlug_getInstance ()" << endl; + cdebug.log(20) << "PyPlug_getInstance ()" << endl; Instance* instance = NULL; @@ -112,7 +112,7 @@ extern "C" { static PyObject* PyPlug_getMasterNet ( PyPlug *self ) { - trace << "PyPlug_getMasterNet ()" << endl; + cdebug.log(20) << "PyPlug_getMasterNet ()" << endl; Net* net = NULL; @@ -130,7 +130,7 @@ extern "C" { // Attribute Method : "PyPlug_getNet ()" static PyObject* PyPlug_getNet ( PyPlug *self ) { - trace << "PyPlug_getNet ()" << endl; + cdebug.log(20) << "PyPlug_getNet ()" << endl; Net* net = NULL; @@ -149,7 +149,7 @@ extern "C" { // Attribute Method : "PyPlug_setNet ()" static PyObject* PyPlug_setNet ( PyPlug *self, PyObject* args ) { - trace << "PyPlug_setNet()" << endl; + cdebug.log(20) << "PyPlug_setNet()" << endl; HTRY diff --git a/hurricane/src/isobar/PyPoint.cpp b/hurricane/src/isobar/PyPoint.cpp index b5eb3440..9cb8cf62 100644 --- a/hurricane/src/isobar/PyPoint.cpp +++ b/hurricane/src/isobar/PyPoint.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2006-2015, All Rights Reserved +// Copyright (c) UPMC 2006-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -44,7 +44,7 @@ extern "C" { static PyObject* PyPoint_NEW ( PyObject* module, PyObject *args ) { - trace << "PyPoint_NEW()" << endl; + cdebug.log(20) << "PyPoint_NEW()" << endl; Point* point; PyObject* arg0; @@ -81,7 +81,7 @@ extern "C" { static int PyPoint_Init ( PyPoint* self, PyObject* args, PyObject* kwargs ) { - trace << "PyPoint_Init(): " << (void*)self << endl; + cdebug.log(20) << "PyPoint_Init(): " << (void*)self << endl; return 0; } @@ -91,7 +91,7 @@ extern "C" { static PyObject* PyPoint_Translate ( PyPoint *self, PyObject* args ) { - trace << "PyPoint_Translate()" << endl; + cdebug.log(20) << "PyPoint_Translate()" << endl; HTRY @@ -114,8 +114,8 @@ extern "C" { // Standart Accessors (Attributes). DirectGetLongAttribute(PyPoint_getX,getX,PyPoint,Point) DirectGetLongAttribute(PyPoint_getY,getY,PyPoint,Point) - DirectSetLongAttribute(PyPoint_SetX,setX,"Point.setX",PyPoint,Point) - DirectSetLongAttribute(PyPoint_SetY,setY,"Point.setY",PyPoint,Point) + DirectSetLongAttribute(PyPoint_SetX,setX,PyPoint,Point) + DirectSetLongAttribute(PyPoint_SetY,setY,PyPoint,Point) // Standart destroy (Attribute). diff --git a/hurricane/src/isobar/PyQuery.cpp b/hurricane/src/isobar/PyQuery.cpp index 37b10c7f..5ccd5dbd 100644 --- a/hurricane/src/isobar/PyQuery.cpp +++ b/hurricane/src/isobar/PyQuery.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2010-2015, All Rights Reserved +// Copyright (c) UPMC 2010-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -131,7 +131,7 @@ extern "C" { static PyObject* PyQuery_getMasterCell ( PyQuery *self ) { - trace << "PyQuery.getMasterCell()" << endl; + cdebug.log(20) << "PyQuery.getMasterCell()" << endl; Cell* cell = NULL; @@ -145,7 +145,7 @@ extern "C" { static PyObject* PyQuery_getInstance ( PyQuery *self ) { - trace << "PyQuery.getInstance()" << endl; + cdebug.log(20) << "PyQuery.getInstance()" << endl; Instance* instance = NULL; @@ -160,7 +160,7 @@ extern "C" { static PyObject* PyQuery_getPath ( PyQuery *self ) { - trace << "PyQuery_getPath ()" << endl; + cdebug.log(20) << "PyQuery_getPath ()" << endl; METHOD_HEAD( "PyQuery.getPath()" ) @@ -177,7 +177,7 @@ extern "C" { static PyObject* PyQuery_getTransformation ( PyQuery *self ) { - trace << "PyQuery_getTransformation ()" << endl; + cdebug.log(20) << "PyQuery_getTransformation ()" << endl; METHOD_HEAD( "PyQuery.getTransformation()" ) @@ -194,7 +194,7 @@ extern "C" { static PyObject* PyQuery_setCell ( PyQuery* self, PyObject* args ) { - trace << "PyQuery.setCell()" << endl; + cdebug.log(20) << "PyQuery.setCell()" << endl; METHOD_HEAD("PyQuery.setCell()") HTRY @@ -217,7 +217,7 @@ extern "C" { static PyObject* PyQuery_setFilter ( PyQuery* self, PyObject* args ) { - trace << "PyQuery.setFilter()" << endl; + cdebug.log(20) << "PyQuery.setFilter()" << endl; METHOD_HEAD("PyQuery.setFilter()") HTRY @@ -235,7 +235,7 @@ extern "C" { static PyObject* PyQuery_setArea ( PyQuery* self, PyObject* args ) { - trace << "PyQuery.setArea()" << endl; + cdebug.log(20) << "PyQuery.setArea()" << endl; METHOD_HEAD("PyQuery.setArea()") HTRY @@ -258,7 +258,7 @@ extern "C" { static PyObject* PyQuery_setTransformation ( PyQuery* self, PyObject* args ) { - trace << "PyQuery.setTransformation()" << endl; + cdebug.log(20) << "PyQuery.setTransformation()" << endl; METHOD_HEAD("PyQuery.setTransformation()") HTRY @@ -281,7 +281,7 @@ extern "C" { static PyObject* PyQuery_setBasicLayer ( PyQuery* self, PyObject* args ) { - trace << "PyQuery.setBasicLayer()" << endl; + cdebug.log(20) << "PyQuery.setBasicLayer()" << endl; METHOD_HEAD("PyQuery.setBasicLayer()") HTRY @@ -304,7 +304,7 @@ extern "C" { static PyObject* PyQuery_setMasterCellCallback ( PyQuery* self, PyObject* args ) { - trace << "PyQuery.setMasterCellCallback()" << endl; + cdebug.log(20) << "PyQuery.setMasterCellCallback()" << endl; METHOD_HEAD("PyQuery.setMasterCellCallback()") HTRY @@ -327,7 +327,7 @@ extern "C" { static PyObject* PyQuery_setGoCallback ( PyQuery* self, PyObject* args ) { - trace << "PyQuery.setGoCallback()" << endl; + cdebug.log(20) << "PyQuery.setGoCallback()" << endl; METHOD_HEAD("PyQuery.setGoCallback()") HTRY @@ -350,7 +350,7 @@ extern "C" { static PyObject* PyQuery_setMarkerCallback ( PyQuery* self, PyObject* args ) { - trace << "PyQuery.setMarkerCallback()" << endl; + cdebug.log(20) << "PyQuery.setMarkerCallback()" << endl; METHOD_HEAD("PyQuery.setMarkerCallback()") HTRY @@ -373,7 +373,7 @@ extern "C" { static PyObject* PyQuery_setRubberCallback ( PyQuery* self, PyObject* args ) { - trace << "PyQuery.setRubberCallback()" << endl; + cdebug.log(20) << "PyQuery.setRubberCallback()" << endl; METHOD_HEAD("PyQuery.setRubberCallback()") HTRY @@ -396,7 +396,7 @@ extern "C" { static PyObject* PyQuery_setExtensionGoCallback ( PyQuery* self, PyObject* args ) { - trace << "PyQuery.setExtensionGoCallback()" << endl; + cdebug.log(20) << "PyQuery.setExtensionGoCallback()" << endl; METHOD_HEAD("PyQuery.setExtensionGoCallback()") HTRY @@ -419,7 +419,7 @@ extern "C" { PyObject* PyQuery_NEW ( PyObject* module, PyObject* args ) { - trace << "PyQuery.new()" << endl; + cdebug.log(20) << "PyQuery.new()" << endl; BaseQuery* query = NULL; PyQuery* pyQuery = NULL; diff --git a/hurricane/src/isobar/PyQueryMask.cpp b/hurricane/src/isobar/PyQueryMask.cpp index a8c6eb5a..cca05c8e 100644 --- a/hurricane/src/isobar/PyQueryMask.cpp +++ b/hurricane/src/isobar/PyQueryMask.cpp @@ -106,7 +106,7 @@ extern "C" { static PyObject* PyQueryMask_new ( PyTypeObject* type, PyObject* args, PyObject* kwds ) { - trace << "PyQueryMask_new()" << endl; + cdebug.log(20) << "PyQueryMask_new()" << endl; PyQueryMask* pyMask = (PyQueryMask*)type->tp_alloc(type,0); @@ -287,7 +287,7 @@ extern "C" { static void PyQueryMask_DeAlloc ( PyQueryMask *self ) { - trace << "PyQueryMask_DeAlloc(" << hex << self << ") " << self->_object << endl; + cdebug.log(20) << "PyQueryMask_DeAlloc(" << hex << self << ") " << self->_object << endl; PyObject_DEL ( self ); } @@ -312,7 +312,7 @@ extern "C" { extern void PyQueryMask_LinkPyType() { - trace << "PyQueryMask_LinkType()" << endl; + cdebug.log(20) << "PyQueryMask_LinkType()" << endl; PyTypeQueryMask.tp_new = PyQueryMask_new; PyTypeQueryMask.tp_dealloc = (destructor) PyQueryMask_DeAlloc; diff --git a/hurricane/src/isobar/PyReference.cpp b/hurricane/src/isobar/PyReference.cpp index fc5a3082..6f0bc833 100644 --- a/hurricane/src/isobar/PyReference.cpp +++ b/hurricane/src/isobar/PyReference.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -55,7 +55,7 @@ extern "C" { // Attribute Method : "PyReference_create ()" PyObject* PyReference_create ( PyObject*, PyObject *args ) { - trace << "PyReference_create()" << endl; + cdebug.log(20) << "PyReference_create()" << endl; Reference* reference = NULL; PyObject* arg0; @@ -99,7 +99,7 @@ extern "C" { static PyObject* PyReference_getPoint ( PyReference *self ) { - trace << "PyReference_getPoint()" << endl; + cdebug.log(20) << "PyReference_getPoint()" << endl; METHOD_HEAD ( "Reference.getPoint()" ) @@ -118,7 +118,7 @@ extern "C" { // Attribute Method : "PyReference_getBoundingBox ()" static PyObject* PyReference_getBoundingBox( PyReference *self ) { - trace << "PyReference_getBoundingBox()" << endl; + cdebug.log(20) << "PyReference_getBoundingBox()" << endl; METHOD_HEAD ( "Reference.BoundingBox()" ) @@ -138,7 +138,7 @@ extern "C" { // Attribute Method : "PyReference_translate ()" static PyObject* PyReference_translate ( PyReference *self, PyObject* args ) { - trace << "PyReference_translate ()" << endl; + cdebug.log(20) << "PyReference_translate ()" << endl; METHOD_HEAD ( "Reference.translate()" ) diff --git a/hurricane/src/isobar/PyRegularLayer.cpp b/hurricane/src/isobar/PyRegularLayer.cpp index f4de6424..da658866 100644 --- a/hurricane/src/isobar/PyRegularLayer.cpp +++ b/hurricane/src/isobar/PyRegularLayer.cpp @@ -77,7 +77,7 @@ extern "C" { static PyObject* PyRegularLayer_create ( PyObject*, PyObject* args ) { - trace << "PyRegularLayer_create()" << endl; + cdebug.log(20) << "PyRegularLayer_create()" << endl; RegularLayer* regularLayer = NULL; diff --git a/hurricane/src/isobar/PyRoutingPad.cpp b/hurricane/src/isobar/PyRoutingPad.cpp index 94bddb82..10be82a4 100644 --- a/hurricane/src/isobar/PyRoutingPad.cpp +++ b/hurricane/src/isobar/PyRoutingPad.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2013-2015, All Rights Reserved +// Copyright (c) UPMC 2013-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -53,8 +53,8 @@ extern "C" { DirectGetLongAttribute(PyRoutingPad_getSourceY ,getSourceY ,PyRoutingPad,RoutingPad) DirectGetLongAttribute(PyRoutingPad_getTargetX ,getTargetX ,PyRoutingPad,RoutingPad) DirectGetLongAttribute(PyRoutingPad_getTargetY ,getTargetY ,PyRoutingPad,RoutingPad) - // DirectSetLongAttribute(PyRoutingPad_setX ,setX ,"RoutingPad.setX",PyRoutingPad,RoutingPad) - // DirectSetLongAttribute(PyRoutingPad_setY ,setY ,"RoutingPad.setY",PyRoutingPad,RoutingPad) + //DirectSetLongAttribute(PyRoutingPad_setX ,setX ,PyRoutingPad,RoutingPad) + //DirectSetLongAttribute(PyRoutingPad_setY ,setY ,PyRoutingPad,RoutingPad) // Standart destroy (Attribute). DBoDestroyAttribute(PyRoutingPad_destroy, PyRoutingPad) @@ -62,7 +62,7 @@ extern "C" { static PyObject* PyRoutingPad_create ( PyObject*, PyObject* args ) { - trace << "PyRoutingPad_create()" << endl; + cdebug.log(20) << "PyRoutingPad_create()" << endl; PyObject* arg0 = NULL; PyObject* arg1 = NULL; @@ -96,7 +96,7 @@ extern "C" { static PyObject* PyRoutingPad_getOccurrence ( PyRoutingPad *self ) { - trace << "PyRoutingPad_getOccurrence ()" << endl; + cdebug.log(20) << "PyRoutingPad_getOccurrence ()" << endl; METHOD_HEAD( "Component.getOccurrence()" ) PyOccurrence* pyOccurrence = PyObject_NEW(PyOccurrence, &PyTypeOccurrence); @@ -112,7 +112,7 @@ extern "C" { static PyObject* PyRoutingPad_getPlugOccurrence ( PyRoutingPad *self ) { - trace << "PyRoutingPad_getPlugOccurrence ()" << endl; + cdebug.log(20) << "PyRoutingPad_getPlugOccurrence ()" << endl; METHOD_HEAD( "Component.getPlugOccurrence()" ) PyOccurrence* pyOccurrence = PyObject_NEW(PyOccurrence, &PyTypeOccurrence); @@ -128,7 +128,7 @@ extern "C" { static PyObject* PyRoutingPad_getSourcePosition ( PyRoutingPad *self ) { - trace << "PyRoutingPad_getSourcePosition ()" << endl; + cdebug.log(20) << "PyRoutingPad_getSourcePosition ()" << endl; METHOD_HEAD( "Component.getSourcePosition()" ) PyPoint* pyPoint = PyObject_NEW( PyPoint, &PyTypePoint ); @@ -144,7 +144,7 @@ extern "C" { static PyObject* PyRoutingPad_getTargetPosition ( PyRoutingPad *self ) { - trace << "PyRoutingPad_getTargetPosition ()" << endl; + cdebug.log(20) << "PyRoutingPad_getTargetPosition ()" << endl; METHOD_HEAD( "Component.getTargetPosition()" ) PyPoint* pyPoint = PyObject_NEW( PyPoint, &PyTypePoint ); @@ -160,7 +160,7 @@ extern "C" { static PyObject* PyRoutingPad_translate ( PyRoutingPad *self, PyObject* args ) { - trace << "PyRoutingPad_translate ()" << endl; + cdebug.log(20) << "PyRoutingPad_translate ()" << endl; HTRY METHOD_HEAD ( "RoutingPad.translate()" ) @@ -181,7 +181,7 @@ extern "C" { #if THIS_IS_DEPRECATED static PyObject* PyRoutingPad_setPosition ( PyRoutingPad *self, PyObject* args ) { - trace << "PyRoutingPad_setPosition ()" << endl; + cdebug.log(20) << "PyRoutingPad_setPosition ()" << endl; HTRY METHOD_HEAD ( "RoutingPad.setPosition()" ) @@ -213,7 +213,7 @@ extern "C" { static PyObject* PyRoutingPad_setOffset ( PyRoutingPad *self, PyObject* args ) { - trace << "PyRoutingPad_setOffset ()" << endl; + cdebug.log(20) << "PyRoutingPad_setOffset ()" << endl; HTRY METHOD_HEAD ( "RoutingPad.setOffset()" ) @@ -234,7 +234,7 @@ extern "C" { static PyObject* PyRoutingPad_setExternalComponent ( PyRoutingPad *self, PyObject* args ) { - trace << "PyRoutingPad_setExternalComponent ()" << endl; + cdebug.log(20) << "PyRoutingPad_setExternalComponent ()" << endl; HTRY METHOD_HEAD ( "RoutingPad.setExternalComponent()" ) @@ -257,7 +257,7 @@ extern "C" { static PyObject* PyRoutingPad_setOnBestComponent ( PyRoutingPad *self, PyObject* args ) { - trace << "PyRoutingPad_setOnBestComponent ()" << endl; + cdebug.log(20) << "PyRoutingPad_setOnBestComponent ()" << endl; Component* selected = NULL; @@ -278,7 +278,7 @@ extern "C" { static PyObject* PyRoutingPad_restorePlugOccurrence ( PyRoutingPad *self, PyObject* args ) { - trace << "PyRoutingPad_restorePlugOccurrence ()" << endl; + cdebug.log(20) << "PyRoutingPad_restorePlugOccurrence ()" << endl; HTRY METHOD_HEAD ( "RoutingPad.restorePlugOccurrence()" ) diff --git a/hurricane/src/isobar/PySegment.cpp b/hurricane/src/isobar/PySegment.cpp index c4f5755d..eee727c3 100644 --- a/hurricane/src/isobar/PySegment.cpp +++ b/hurricane/src/isobar/PySegment.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -55,7 +55,7 @@ extern "C" { DirectGetLongAttribute(PySegment_getTargetX,getTargetX,PySegment,Segment) DirectGetLongAttribute(PySegment_getTargetY,getTargetY,PySegment,Segment) DirectGetLongAttribute(PySegment_getWidth ,getWidth ,PySegment,Segment) - DirectSetLongAttribute(PySegment_setWidth ,setWidth ,"Segment.setWidth",PySegment,Segment) + DirectSetLongAttribute(PySegment_setWidth ,setWidth ,PySegment,Segment) DirectVoidMethod(Segment,segment,invert) accessorHook(getSourceHook,PySegment,Segment) accessorHook(getTargetHook,PySegment,Segment) @@ -66,7 +66,7 @@ extern "C" { static PyObject* PySegment_getOppositeHook ( PySegment *self, PyObject* args ) { - trace << "PySegment_getOppositeHook()" << endl; + cdebug.log(20) << "PySegment_getOppositeHook()" << endl; METHOD_HEAD ( "Segment.getOppositeHook()" ) PyHook* pyReturnHook = PyObject_NEW( PyHook, &PyTypeHook ); @@ -87,7 +87,7 @@ extern "C" { static PyObject* PySegment_getSource ( PySegment *self ) { - trace << "PySegment_getSource()" << endl; + cdebug.log(20) << "PySegment_getSource()" << endl; METHOD_HEAD( "Segment.Source()" ) @@ -106,7 +106,7 @@ extern "C" { static PyObject* PySegment_getTarget ( PySegment *self ) { - trace << "PySegment_getTarget()" << endl; + cdebug.log(20) << "PySegment_getTarget()" << endl; METHOD_HEAD( "Segment.Target()" ) @@ -125,7 +125,7 @@ extern "C" { static PyObject* PySegment_getSourcePosition ( PySegment *self ) { - trace << "PySegment_getSourcePosition()" << endl; + cdebug.log(20) << "PySegment_getSourcePosition()" << endl; METHOD_HEAD ( "Segment.SourcePosition()" ) @@ -142,7 +142,7 @@ extern "C" { static PyObject* PySegment_getTargetPosition ( PySegment *self ) { - trace << "PySegment_getTargetPosition()" << endl; + cdebug.log(20) << "PySegment_getTargetPosition()" << endl; METHOD_HEAD ( "Segment.TargetPosition()" ) diff --git a/hurricane/src/isobar/PyTechnology.cpp b/hurricane/src/isobar/PyTechnology.cpp index 774da9ea..c617acae 100644 --- a/hurricane/src/isobar/PyTechnology.cpp +++ b/hurricane/src/isobar/PyTechnology.cpp @@ -80,7 +80,7 @@ extern "C" { static PyObject* PyTechnology_create ( PyTechnology*, PyObject* args ) { - trace << "Technology.create()" << endl; + cdebug.log(20) << "Technology.create()" << endl; Technology* technology = NULL; @@ -105,7 +105,7 @@ extern "C" { static PyObject* PyTechnology_getDataBase ( PyTechnology* self ) { - trace << "PyTechnology_getDataBase()" << endl; + cdebug.log(20) << "PyTechnology_getDataBase()" << endl; DataBase* db = NULL; @@ -121,7 +121,7 @@ extern "C" { static PyObject* PyTechnology_getLayer ( PyTechnology *self, PyObject* args ) { - trace << "Technology.getLayer()" << endl; + cdebug.log(20) << "Technology.getLayer()" << endl; METHOD_HEAD("Technology.getLayer()") @@ -152,7 +152,7 @@ extern "C" { static PyObject* PyTechnology_getBasicLayers ( PyTechnology* self, PyObject* args ) { - trace << "PyTechnology_getBasicLayers()" << endl; + cdebug.log(20) << "PyTechnology_getBasicLayers()" << endl; PyBasicLayerCollection* pyObjects = NULL; @@ -189,7 +189,7 @@ extern "C" { static PyObject* PyTechnology_setWorkingLayer ( PyTechnology *self, PyObject* args ) { - trace << "Technology.setWorkingLayer()" << endl; + cdebug.log(20) << "Technology.setWorkingLayer()" << endl; METHOD_HEAD("Technology.setWorkingLayer()") diff --git a/hurricane/src/isobar/PyTransformation.cpp b/hurricane/src/isobar/PyTransformation.cpp index 246da1e1..0c5465e1 100644 --- a/hurricane/src/isobar/PyTransformation.cpp +++ b/hurricane/src/isobar/PyTransformation.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2006-2015, All Rights Reserved +// Copyright (c) UPMC 2006-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -71,7 +71,7 @@ extern "C" { // Attribute Method : "PyTransformation_NEW ()" static PyObject* PyTransformation_NEW (PyObject *module, PyObject *args) { - trace << "PyTransformation_NEW()" << endl; + cdebug.log(20) << "PyTransformation_NEW()" << endl; Transformation* transf; PyObject* arg0; @@ -106,9 +106,7 @@ extern "C" { PyTransformation* pyTransformation = PyObject_NEW(PyTransformation, &PyTypeTransformation); if (pyTransformation == NULL) { return NULL; } - trace_in (); - trace << "new PyTransformation [" << hex << pyTransformation << "]" << endl; - trace_out (); + cdebug.log(20) << "new PyTransformation [" << hex << pyTransformation << "]" << endl; HTRY @@ -122,7 +120,7 @@ extern "C" { static int PyTransformation_Init ( PyTransformation* self, PyObject* args, PyObject* kwargs ) { - trace << "PyTransformation_Init(): " << (void*)self << endl; + cdebug.log(20) << "PyTransformation_Init(): " << (void*)self << endl; return 0; } @@ -131,16 +129,14 @@ extern "C" { // Attribute Method : "PyBox_getTranslation ()" static PyObject* PyTransformation_getTranslation ( PyTransformation *self ) { - trace << "PyBox_getTranslation ()" << endl; + cdebug.log(20) << "PyBox_getTranslation ()" << endl; METHOD_HEAD ( "Translation.getTranslation()" ) PyPoint* pyPoint = PyObject_NEW ( PyPoint, &PyTypePoint ); if (pyPoint == NULL) { return NULL; } - trace_in (); - trace << "new PyPoint [" << hex << pyPoint << "]" << endl; - trace_out (); + cdebug.log(20) << "new PyPoint [" << hex << pyPoint << "]" << endl; HTRY @@ -158,7 +154,7 @@ extern "C" { // Attribute Method : "PyTransformation_getOrientation ()" static PyObject* PyTransformation_getOrientation ( PyTransformation *self ) { - trace << "PyTransformation_getOrientation ()" << endl; + cdebug.log(20) << "PyTransformation_getOrientation ()" << endl; METHOD_HEAD ( "Translation.getOrientation()" ) @@ -173,7 +169,7 @@ extern "C" { static PyObject* PyTransformation_getX ( PyTransformation *self, PyObject* args ) { - trace << "PyTransformation_getX ()" << endl; + cdebug.log(20) << "PyTransformation_getX ()" << endl; METHOD_HEAD ( "Transformation.getX()" ) @@ -208,7 +204,7 @@ extern "C" { static PyObject* PyTransformation_getY ( PyTransformation *self, PyObject* args ) { - trace << "PyTransformation_getY ()" << endl; + cdebug.log(20) << "PyTransformation_getY ()" << endl; METHOD_HEAD ( "Transformation.getY()" ) @@ -243,7 +239,7 @@ extern "C" { static PyObject* PyTransformation_getDx ( PyTransformation *self, PyObject* args ) { - trace << "PyTransformation_getDx ()" << endl; + cdebug.log(20) << "PyTransformation_getDx ()" << endl; METHOD_HEAD ( "Transformation.getDx()" ) @@ -269,7 +265,7 @@ extern "C" { static PyObject* PyTransformation_getDy ( PyTransformation *self, PyObject* args ) { - trace << "PyTransformation_getDy ()" << endl; + cdebug.log(20) << "PyTransformation_getDy ()" << endl; METHOD_HEAD ( "Transformation.getDy()" ) @@ -295,7 +291,7 @@ extern "C" { static PyObject* PyTransformation_getTransformation ( PyTransformation *self, PyObject* args ) { - trace << "PyTransformation_getTransformation ()" << endl; + cdebug.log(20) << "PyTransformation_getTransformation ()" << endl; METHOD_HEAD ( "Transformation.getTransformation()" ) @@ -308,9 +304,7 @@ extern "C" { PyTransformation* resultPyTransf = PyObject_NEW ( PyTransformation, &PyTypeTransformation ); if ( resultPyTransf == NULL ) { return NULL; } - trace_in (); - trace << "new PyTransformation [" << hex << resultPyTransf << "]" << endl; - trace_out (); + cdebug.log(20) << "new PyTransformation [" << hex << resultPyTransf << "]" << endl; HTRY @@ -329,7 +323,7 @@ extern "C" { static PyObject* PyTransformation_getPoint ( PyTransformation *self, PyObject* args ) { - trace << "PyTransformation_getPoint ()" << endl; + cdebug.log(20) << "PyTransformation_getPoint ()" << endl; METHOD_HEAD ( "Transformation.getPoint()" ) @@ -352,9 +346,7 @@ extern "C" { PyPoint* resultPyPoint = PyObject_NEW ( PyPoint, &PyTypePoint ); if ( resultPyPoint == NULL ) { return NULL; } - trace_in (); - trace << "new PyPoint [" << hex << resultPyPoint << "]" << endl; - trace_out (); + cdebug.log(20) << "new PyPoint [" << hex << resultPyPoint << "]" << endl; HTRY @@ -373,7 +365,7 @@ extern "C" { static PyObject* PyTransformation_getBox ( PyTransformation *self, PyObject* args ) { - trace << "PyTransformation_getBox ()" << endl; + cdebug.log(20) << "PyTransformation_getBox ()" << endl; METHOD_HEAD ( "Transformation.getBox()" ) @@ -406,9 +398,7 @@ extern "C" { PyBox* resultPyBox = PyObject_NEW ( PyBox, &PyTypeBox ); if ( resultPyBox == NULL ) { return NULL; } - trace_in (); - trace << "new PyBox [" << hex << resultPyBox << "]" << endl; - trace_out (); + cdebug.log(20) << "new PyBox [" << hex << resultPyBox << "]" << endl; HTRY @@ -427,7 +417,7 @@ extern "C" { static PyObject* PyTransformation_getInvert ( PyTransformation *self ) { - trace << "PyTransformation_getInvert ()" << endl; + cdebug.log(20) << "PyTransformation_getInvert ()" << endl; METHOD_HEAD ( "Transformation.getInvert()" ) @@ -436,9 +426,7 @@ extern "C" { PyTransformation* resultPyTransf = PyObject_NEW ( PyTransformation, &PyTypeTransformation ); if ( resultPyTransf == NULL ) { return NULL; } - trace_in (); - trace << "new PyTransformation [" << hex << resultPyTransf << "]" << endl; - trace_out (); + cdebug.log(20) << "new PyTransformation [" << hex << resultPyTransf << "]" << endl; HTRY @@ -457,7 +445,7 @@ extern "C" { static PyObject* PyTransformation_Invert ( PyTransformation *self ) { - trace << "PyTransformation_Invert ()" << endl; + cdebug.log(20) << "PyTransformation_Invert ()" << endl; METHOD_HEAD ( "Transformation.Invert()" ) @@ -479,7 +467,7 @@ extern "C" { static PyObject* PyTransformation_ApplyOn ( PyTransformation *self, PyObject* args ) { - trace << "PyTransformation_ApplyOn ()" << endl; + cdebug.log(20) << "PyTransformation_ApplyOn ()" << endl; METHOD_HEAD ( "Transformation.ApplyOn()" ) diff --git a/hurricane/src/isobar/PyTransistorLayer.cpp b/hurricane/src/isobar/PyTransistorLayer.cpp index 89f56a28..19f80f2d 100644 --- a/hurricane/src/isobar/PyTransistorLayer.cpp +++ b/hurricane/src/isobar/PyTransistorLayer.cpp @@ -76,7 +76,7 @@ extern "C" { static PyObject* PyTransistorLayer_create ( PyObject*, PyObject* args ) { - trace << "PyTransistorLayer_create()" << endl; + cdebug.log(20) << "PyTransistorLayer_create()" << endl; TransistorLayer* transistorLayer = NULL; diff --git a/hurricane/src/isobar/PyUpdateSession.cpp b/hurricane/src/isobar/PyUpdateSession.cpp index db5e0da4..987514cc 100644 --- a/hurricane/src/isobar/PyUpdateSession.cpp +++ b/hurricane/src/isobar/PyUpdateSession.cpp @@ -41,13 +41,13 @@ extern "C" { static void PyUpdateSession_DeAlloc ( PyUpdateSession* self ) { - trace << "PyUpdateSession_DeAlloc(" << hex << self << ")" << endl; + cdebug.log(20) << "PyUpdateSession_DeAlloc(" << hex << self << ")" << endl; } static PyObject* PyUpdateSession_open ( PyObject* ) { - trace << "PyUpdateSession_open()" << endl; + cdebug.log(20) << "PyUpdateSession_open()" << endl; HTRY UpdateSession::open (); @@ -59,7 +59,7 @@ extern "C" { static PyObject* PyUpdateSession_close ( PyObject* ) { - trace << "PyUpdateSession_close()" << endl; + cdebug.log(20) << "PyUpdateSession_close()" << endl; HTRY UpdateSession::close (); diff --git a/hurricane/src/isobar/PyVertical.cpp b/hurricane/src/isobar/PyVertical.cpp index 45fd29c4..13530a3c 100644 --- a/hurricane/src/isobar/PyVertical.cpp +++ b/hurricane/src/isobar/PyVertical.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2007-2015, All Rights Reserved +// Copyright (c) UPMC 2007-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -47,9 +47,9 @@ extern "C" { DirectGetLongAttribute(PyVertical_getX ,getX ,PyVertical,Vertical) DirectGetLongAttribute(PyVertical_getDySource,getDySource,PyVertical,Vertical) DirectGetLongAttribute(PyVertical_getDyTarget,getDyTarget,PyVertical,Vertical) - DirectSetLongAttribute(PyVertical_setX,setX,"Vertical.setX",PyVertical,Vertical) - DirectSetLongAttribute(PyVertical_setDySource,setDySource,"Vertical.setDySource",PyVertical,Vertical) - DirectSetLongAttribute(PyVertical_setDyTarget,setDyTarget,"Vertical.setDyTarget",PyVertical,Vertical) + DirectSetLongAttribute(PyVertical_setX ,setX ,PyVertical,Vertical) + DirectSetLongAttribute(PyVertical_setDySource,setDySource,PyVertical,Vertical) + DirectSetLongAttribute(PyVertical_setDyTarget,setDyTarget,PyVertical,Vertical) // Standard destroy (Attribute). DBoDestroyAttribute(PyVertical_destroy, PyVertical) @@ -59,7 +59,7 @@ extern "C" { // Attribute Method : "PyVertical_create ()" static PyObject* PyVertical_create ( PyObject*, PyObject *args ) { - trace << "PyVertical_create()" << endl; + cdebug.log(20) << "PyVertical_create()" << endl; PyObject* arg0; PyObject* arg1; @@ -149,7 +149,7 @@ extern "C" { // Attribute Method : "PyVertical_translate ()" static PyObject* PyVertical_translate ( PyVertical *self, PyObject* args ) { - trace << "PyVertical_translate ()" << endl; + cdebug.log(20) << "PyVertical_translate ()" << endl; HTRY METHOD_HEAD ( "Vertical.translate()" ) diff --git a/hurricane/src/isobar/PyViaLayer.cpp b/hurricane/src/isobar/PyViaLayer.cpp index 02c2f14d..b55ea7f0 100644 --- a/hurricane/src/isobar/PyViaLayer.cpp +++ b/hurricane/src/isobar/PyViaLayer.cpp @@ -76,7 +76,7 @@ extern "C" { static PyObject* PyViaLayer_create ( PyObject*, PyObject* args ) { - trace << "PyViaLayer_create()" << endl; + cdebug.log(20) << "PyViaLayer_create()" << endl; ViaLayer* viaLayer = NULL; diff --git a/hurricane/src/isobar/hurricane/isobar/PyBox.h b/hurricane/src/isobar/hurricane/isobar/PyBox.h index 1e7750a0..3dc7f948 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyBox.h +++ b/hurricane/src/isobar/hurricane/isobar/PyBox.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2006-2015, All Rights Reserved +// Copyright (c) UPMC 2006-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/hurricane/src/isobar/hurricane/isobar/PyCell.h b/hurricane/src/isobar/hurricane/isobar/PyCell.h index 6a574c97..f5fed64a 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyCell.h +++ b/hurricane/src/isobar/hurricane/isobar/PyCell.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2006-2015, All Rights Reserved +// Copyright (c) UPMC 2006-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/hurricane/src/isobar/hurricane/isobar/PyContact.h b/hurricane/src/isobar/hurricane/isobar/PyContact.h index 2ef4c4d8..3308b579 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyContact.h +++ b/hurricane/src/isobar/hurricane/isobar/PyContact.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2006-2015, All Rights Reserved +// Copyright (c) UPMC 2006-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/hurricane/src/isobar/hurricane/isobar/PyDataBase.h b/hurricane/src/isobar/hurricane/isobar/PyDataBase.h index 268c98a2..df5718ba 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyDataBase.h +++ b/hurricane/src/isobar/hurricane/isobar/PyDataBase.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/hurricane/src/isobar/hurricane/isobar/PyDebugSession.h b/hurricane/src/isobar/hurricane/isobar/PyDebugSession.h index eee35776..023b2846 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyDebugSession.h +++ b/hurricane/src/isobar/hurricane/isobar/PyDebugSession.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2014-2015, All Rights Reserved +// Copyright (c) UPMC 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/hurricane/src/isobar/hurricane/isobar/PyEntity.h b/hurricane/src/isobar/hurricane/isobar/PyEntity.h index dcd89252..def7b492 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyEntity.h +++ b/hurricane/src/isobar/hurricane/isobar/PyEntity.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2010-2015, All Rights Reserved +// Copyright (c) UPMC 2010-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/hurricane/src/isobar/hurricane/isobar/PyHorizontal.h b/hurricane/src/isobar/hurricane/isobar/PyHorizontal.h index 1c087e0e..7bd7bd5f 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyHorizontal.h +++ b/hurricane/src/isobar/hurricane/isobar/PyHorizontal.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2007-2015, All Rights Reserved +// Copyright (c) UPMC 2007-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/hurricane/src/isobar/hurricane/isobar/PyHurricane.h b/hurricane/src/isobar/hurricane/isobar/PyHurricane.h index abac6419..5ff9a836 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyHurricane.h +++ b/hurricane/src/isobar/hurricane/isobar/PyHurricane.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -28,6 +28,7 @@ #include #include #include +#include "hurricane/Bug.h" #include "hurricane/Error.h" #include "hurricane/Warning.h" #include "hurricane/isobar/ProxyProperty.h" @@ -106,6 +107,7 @@ using namespace std; extern ConverterState __cs; extern int __objectOffset; + int PyAny_AsInt ( PyObject* object ); long PyAny_AsLong ( PyObject* object ); @@ -193,13 +195,13 @@ extern "C" { #define GENERIC_METHOD_HEAD(SELF_TYPE,SELF_OBJECT,function) \ if ( self->ACCESS_OBJECT == NULL ) { \ - PyErr_SetString ( ProxyError, "Attempt to call " function " on an unbound hurricane object" ); \ - return ( NULL ); \ + PyErr_SetString( ProxyError, "Attempt to call " function " on an unbound hurricane object" ); \ + return NULL; \ } \ SELF_TYPE* SELF_OBJECT = dynamic_cast(self->ACCESS_OBJECT);\ - if ( self->ACCESS_OBJECT == NULL ) { \ - PyErr_SetString ( ProxyError, "Invalid dynamic_cast while calling " function "" ); \ - return ( NULL ); \ + if ( SELF_OBJECT == NULL ) { \ + PyErr_SetString( ProxyError, "Invalid dynamic_cast<> while calling " function "" ); \ + return NULL; \ } @@ -221,7 +223,7 @@ extern "C" { # define predicateFromLayer(FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ static PyObject* PY_SELF_TYPE##_##FUNC_NAME ( PY_SELF_TYPE* self, PyObject* args ) \ { \ - trace << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ + cdebug.log(20) << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ \ HTRY \ GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#SELF_TYPE"."#FUNC_NAME"()") \ @@ -256,7 +258,7 @@ extern "C" { # define DirectGetBoolAttribute(PY_FUNC_NAME,FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* args ) \ { \ - GENERIC_METHOD_HEAD(SELF_TYPE,cobject,"DirectGetBoolAttribute()") \ + GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#FUNC_NAME"()") \ if (cobject->FUNC_NAME()) \ Py_RETURN_TRUE; \ Py_RETURN_FALSE; \ @@ -271,7 +273,7 @@ extern "C" { # define DirectIsAFromCStringAttribute(PY_FUNC_NAME,FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* args ) \ { \ - GENERIC_METHOD_HEAD(SELF_TYPE,cobject,"DirectIsAFromCStringAttribute()") \ + GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#FUNC_NAME"()") \ HTRY \ char* value = NULL; \ if ( !PyArg_ParseTuple(args, "s:", &value) ) \ @@ -286,13 +288,13 @@ extern "C" { // ------------------------------------------------------------------- -// Attribute Method Macro For Long. +// Attribute Method Macro For Int. -# define DirectGetLongAttribute(PY_FUNC_NAME,FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ +# define DirectGetIntAttribute(PY_FUNC_NAME,FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* args ) \ { \ - GENERIC_METHOD_HEAD(SELF_TYPE,cobject,"DirectGetLongAttribute()") \ - return ( PyLong_FromLong(cobject->FUNC_NAME()) ); \ + GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#FUNC_NAME"()") \ + return Py_BuildValue("i", cobject->FUNC_NAME()); \ } @@ -302,8 +304,19 @@ extern "C" { # define DirectGetUIntAttribute(PY_FUNC_NAME,FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* args ) \ { \ - GENERIC_METHOD_HEAD(SELF_TYPE,cobject,"DirectGetUIntAttribute()") \ - return ( Py_BuildValue ("I",cobject->FUNC_NAME()) ); \ + GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#FUNC_NAME"()") \ + return Py_BuildValue ("I",cobject->FUNC_NAME()); \ + } + + +// ------------------------------------------------------------------- +// Attribute Method Macro For Long. + +# define DirectGetLongAttribute(PY_FUNC_NAME,FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ + static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* args ) \ + { \ + GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#FUNC_NAME"()") \ + return Py_BuildValue("l", cobject->FUNC_NAME()); \ } @@ -313,8 +326,8 @@ extern "C" { # define DirectGetDoubleAttribute(PY_FUNC_NAME,FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* args ) \ { \ - GENERIC_METHOD_HEAD(SELF_TYPE,cobject,"DirectGetDoubleAttribute()") \ - return ( Py_BuildValue ("d",cobject->FUNC_NAME()) ); \ + GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#FUNC_NAME"()") \ + return Py_BuildValue ("d",cobject->FUNC_NAME()); \ } @@ -324,15 +337,26 @@ extern "C" { # define DirectGetStringAttribute(PY_FUNC_NAME,FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self ) \ { \ - GENERIC_METHOD_HEAD(SELF_TYPE,cobject,"DirectGetStringAttribute()") \ - return ( Py_BuildValue ("s",cobject->FUNC_NAME().c_str()) ); \ + GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#FUNC_NAME"()") \ + return Py_BuildValue ("s",cobject->FUNC_NAME().c_str()); \ + } + + +// ------------------------------------------------------------------- +// Attribute Method Macro For Name. + +# define DirectGetNameAttribute(PY_FUNC_NAME,FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ + static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self ) \ + { \ + GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#FUNC_NAME"()") \ + return Py_BuildValue ("s",getString(cobject->FUNC_NAME()).c_str()); \ } # define accessorLayerFromVoid(FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ static PyObject* PY_SELF_TYPE##_##FUNC_NAME ( PY_SELF_TYPE* self ) \ { \ - trace << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ + cdebug.log(20) << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ \ Layer* rlayer = NULL; \ \ @@ -349,7 +373,7 @@ extern "C" { # define accessorAnyLayerFromName(FUNC_NAME,PY_SELF_TYPE,SELF_TYPE,LAYER_TYPE) \ static PyObject* PY_SELF_TYPE##_##FUNC_NAME ( PY_SELF_TYPE* self, PyObject* args ) \ { \ - trace << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ + cdebug.log(20) << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ \ LAYER_TYPE * rlayer = NULL; \ \ @@ -375,7 +399,7 @@ extern "C" { # define accessorLayerFromLayerOptBool(FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ static PyObject* PY_SELF_TYPE##_##FUNC_NAME ( PY_SELF_TYPE* self, PyObject* args ) \ { \ - trace << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ + cdebug.log(20) << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ \ Layer* rlayer = NULL; \ \ @@ -411,7 +435,7 @@ extern "C" { # define accessorLayerFromLayerLayer(FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ static PyObject* PY_SELF_TYPE##_##FUNC_NAME ( PY_SELF_TYPE* self, PyObject* args ) \ { \ - trace << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ + cdebug.log(20) << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ \ Layer* rlayer = NULL; \ \ @@ -443,7 +467,7 @@ extern "C" { # define accessorLayerFromInt(FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ static PyObject* PY_SELF_TYPE##_##FUNC_NAME ( PY_SELF_TYPE* self, PyObject* args ) \ { \ - trace << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ + cdebug.log(20) << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ \ Layer* rlayer = NULL; \ int value = 0; \ @@ -468,7 +492,7 @@ extern "C" { # define updatorFromBasicLayer(FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ static PyObject* PY_SELF_TYPE##_##FUNC_NAME ( PY_SELF_TYPE* self, PyObject* args ) \ { \ - trace << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ + cdebug.log(20) << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ \ HTRY \ GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#SELF_TYPE"."#FUNC_NAME"()") \ @@ -497,7 +521,7 @@ extern "C" { #define accessorHook(FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ static PyObject* PY_SELF_TYPE##_##FUNC_NAME( PY_SELF_TYPE *self ) \ { \ - trace << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ + cdebug.log(20) << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ \ PyHook* pyHook = PyObject_NEW( PyHook, &PyTypeHook ); \ if (pyHook == NULL) return NULL; \ @@ -514,15 +538,17 @@ extern "C" { // ------------------------------------------------------------------- // Attribute Method Macro For Booleans. -#define DirectSetBoolAttribute(PY_FUNC_NAME,FUNC_NAME,STR_FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ +#define DirectSetBoolAttribute(PY_FUNC_NAME,FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* args ) \ { \ - GENERIC_METHOD_HEAD(SELF_TYPE,cobject,STR_FUNC_NAME "()") \ + GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#FUNC_NAME "()") \ \ HTRY \ PyObject* arg0; \ - if ( not PyArg_ParseTuple ( args, "O:" STR_FUNC_NAME, &arg0 ) or PyBool_Check(arg0) ) \ + if (not PyArg_ParseTuple( args, "O:" #FUNC_NAME, &arg0 ) or not PyBool_Check(arg0) ) { \ + PyErr_SetString(ConstructorError, #SELF_TYPE"."#FUNC_NAME"(): Argument is not a boolean."); \ return NULL; \ + } \ \ (PyObject_IsTrue(arg0)) ? cobject->FUNC_NAME (true) : cobject->FUNC_NAME (false); \ HCATCH \ @@ -532,35 +558,54 @@ extern "C" { // ------------------------------------------------------------------- -// Attribute Method Macro For Long. +// Attribute Method Macro For Int. -#define DirectSetLongAttribute(PY_FUNC_NAME,FUNC_NAME,PY_FORMAT,PY_SELF_TYPE,SELF_TYPE) \ +#define DirectSetIntAttribute(PY_FUNC_NAME,FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* args ) \ { \ - GENERIC_METHOD_HEAD(SELF_TYPE,cobject,"DirectSetLongAttribute()") \ + GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#FUNC_NAME"()") \ \ HTRY \ PyObject* arg0; \ - if ( ! PyArg_ParseTuple ( args, "O:" PY_FORMAT, &arg0 ) ) \ + if ( ! PyArg_ParseTuple ( args, "O:" #SELF_TYPE"."#FUNC_NAME"()", &arg0 ) ) \ return ( NULL ); \ - cobject->FUNC_NAME ( Isobar::PyAny_AsLong(arg0) ); \ + cobject->FUNC_NAME ( Isobar::PyAny_AsInt(arg0) ); \ HCATCH \ \ Py_RETURN_NONE; \ } +// ------------------------------------------------------------------- +// Attribute Method Macro For Long. + +#define DirectSetLongAttribute(PY_FUNC_NAME,FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ + static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* args ) \ + { \ + GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#FUNC_NAME"()") \ + \ + HTRY \ + PyObject* arg0; \ + if ( ! PyArg_ParseTuple ( args, "O:" #SELF_TYPE"."#FUNC_NAME"()", &arg0 ) ) \ + return ( NULL ); \ + cobject->FUNC_NAME ( Isobar::PyAny_AsLong(arg0) ); \ + HCATCH \ + \ + Py_RETURN_NONE; \ + } + + // ------------------------------------------------------------------- // Attribute Method Macro For Double. -#define DirectSetDoubleAttribute(PY_FUNC_NAME,FUNC_NAME,PY_FORMAT,PY_SELF_TYPE,SELF_TYPE) \ +#define DirectSetDoubleAttribute(PY_FUNC_NAME,FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* args ) \ { \ - GENERIC_METHOD_HEAD(SELF_TYPE,cobject,"DirectSetDoubleAttribute()") \ + GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#FUNC_NAME"()") \ \ HTRY \ PyObject* arg0; \ - if ( ! PyArg_ParseTuple ( args, "O:" PY_FORMAT, &arg0 ) ) \ + if ( ! PyArg_ParseTuple ( args, "O:" #SELF_TYPE"."#FUNC_NAME"()", &arg0 ) ) \ return ( NULL ); \ cobject->FUNC_NAME ( PyFloat_AsDouble(arg0) ); \ HCATCH \ @@ -572,14 +617,14 @@ extern "C" { // ------------------------------------------------------------------- // Attribute Method Macro For C String (char*). -#define DirectSetCStringAttribute(PY_FUNC_NAME,FUNC_NAME,PY_FORMAT,PY_SELF_TYPE,SELF_TYPE) \ +#define DirectSetCStringAttribute(PY_FUNC_NAME,FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \ static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* args ) \ { \ - GENERIC_METHOD_HEAD(SELF_TYPE,cobject,"DirectSetCStringAttribute()") \ + GENERIC_METHOD_HEAD(SELF_TYPE,cobject,#FUNC_NAME"()") \ \ HTRY \ char* value = NULL; \ - if ( !PyArg_ParseTuple(args, "s:" PY_FORMAT, &value) ) \ + if ( !PyArg_ParseTuple(args, "s:" #SELF_TYPE"."#FUNC_NAME"()", &value) ) \ return NULL; \ cobject->FUNC_NAME ( value ); \ HCATCH \ @@ -593,7 +638,7 @@ extern "C" { #define GetNameMethod(SELF_TYPE, SELF) \ static PyObject* Py##SELF_TYPE##_getName(Py##SELF_TYPE* self) { \ - trace << "Py"#SELF_TYPE"_getName()" << endl; \ + cdebug.log(20) << "Py"#SELF_TYPE"_getName()" << endl; \ HTRY \ METHOD_HEAD (#SELF_TYPE".getName()") \ return PyString_FromString(getString(SELF->getName()).c_str()); \ @@ -603,7 +648,7 @@ extern "C" { #define SetNameMethod(SELF_TYPE, SELF) \ static PyObject* Py##SELF_TYPE##_setName(Py##SELF_TYPE* self, PyObject* args) { \ - trace << "Py"#SELF_TYPE"_setName()" << endl; \ + cdebug.log(20) << "Py"#SELF_TYPE"_setName()" << endl; \ HTRY \ METHOD_HEAD (#SELF_TYPE".setName()") \ char* name = NULL; \ @@ -640,12 +685,12 @@ extern "C" { #define DirectDeleteMethod(PY_FUNC_NAME, PY_SELF_TYPE) \ static void PY_FUNC_NAME ( PY_SELF_TYPE *self ) \ { \ - trace << #PY_SELF_TYPE"_DeAlloc(" << hex << self << ") " \ + cdebug.log(20) << #PY_SELF_TYPE"_DeAlloc(" << hex << self << ") " \ << hex << (void*)(self->ACCESS_OBJECT) \ << ":" << self->ACCESS_OBJECT << endl; \ \ if ( self->ACCESS_OBJECT ) { \ - trace << "C++ object := " << hex \ + cdebug.log(20) << "C++ object := " << hex \ << &(self->ACCESS_OBJECT) << endl; \ delete self->ACCESS_OBJECT; \ } \ @@ -657,13 +702,13 @@ extern "C" { // ------------------------------------------------------------------- // Attribute Method For Deletion. -#define PlugDeleteMethod(PY_FUNC_NAME,PY_SELF_TYPE) \ - static void PY_FUNC_NAME ( PY_SELF_TYPE *self ) \ - { \ - trace << "PyHObject_DeAlloc(" << hex << self << ") " \ - << self->ACCESS_OBJECT << endl; \ - \ - PyObject_DEL ( self ); \ +#define PlugDeleteMethod(PY_FUNC_NAME,PY_SELF_TYPE) \ + static void PY_FUNC_NAME ( PY_SELF_TYPE *self ) \ + { \ + cdebug.log(20) << "PyHObject_DeAlloc(" << hex << self << ") " \ + << self->ACCESS_OBJECT << endl; \ + \ + PyObject_DEL ( self ); \ } @@ -685,12 +730,12 @@ extern "C" { #define DirectVoidMethod(SELF_TYPE, SELF_OBJECT, FUNC_NAME) \ static PyObject* Py##SELF_TYPE##_##FUNC_NAME(Py##SELF_TYPE* self) \ { \ - trace << "Py" #SELF_TYPE "_" #FUNC_NAME "()" << endl; \ - HTRY \ + cdebug.log(20) << "Py" #SELF_TYPE "_" #FUNC_NAME "()" << endl; \ + HTRY \ METHOD_HEAD(#SELF_TYPE "." #FUNC_NAME "()") \ SELF_OBJECT->FUNC_NAME(); \ - HCATCH \ - Py_RETURN_NONE; \ + HCATCH \ + Py_RETURN_NONE; \ } @@ -719,7 +764,7 @@ extern "C" { \ extern void Py##TYPE##Collection_LinkPyType () \ { \ - trace << "Py"#TYPE"Collection_LinkType()" << endl; \ + cdebug.log(20) << "Py"#TYPE"Collection_LinkType()" << endl; \ PyType##TYPE##Collection.tp_iter = (getiterfunc)GetLocator; \ PyType##TYPE##Collection.tp_dealloc = (destructor)Py##TYPE##Collection_DeAlloc; \ PyType##TYPE##CollectionLocator.tp_dealloc = (destructor)Py##TYPE##CollectionLocatorDeAlloc; \ @@ -775,7 +820,7 @@ extern "C" { # define accessorCollectionFromVoid(FUNC_NAME,PY_SELF_TYPE,SELF_TYPE,COLL_TYPE) \ static PyObject* PY_SELF_TYPE##_##FUNC_NAME ( PY_SELF_TYPE* self ) \ { \ - trace << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ + cdebug.log(20) << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ \ Py##COLL_TYPE##Collection* pyObjects = NULL; \ \ @@ -838,7 +883,7 @@ extern "C" { \ extern void Py##TYPE##Vector_LinkPyType () \ { \ - trace << "Py"#TYPE"Vector_LinkType()" << endl; \ + cdebug.log(20) << "Py"#TYPE"Vector_LinkType()" << endl; \ \ PyType##TYPE##Vector.tp_iter = (getiterfunc)Py##TYPE##Vector_GetIterator; \ PyType##TYPE##Vector.tp_dealloc = (destructor)Py##TYPE##Vector_DeAlloc; \ @@ -864,7 +909,7 @@ extern "C" { # define accessorVectorFromVoid(FUNC_NAME,PY_SELF_TYPE,SELF_TYPE,TYPE) \ static PyObject* PY_SELF_TYPE##_##FUNC_NAME ( PY_SELF_TYPE* self ) \ { \ - trace << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ + cdebug.log(20) << #PY_SELF_TYPE "_" #FUNC_NAME "()" << endl; \ \ Py##TYPE##Vector* pyVector = NULL; \ \ @@ -995,8 +1040,8 @@ extern "C" { if (pyObject == NULL) { return NULL; } \ \ pyObject->ACCESS_OBJECT = object; \ - trace << "Py" #SELF_TYPE "_Link(" << hex << pyObject << ") " \ - << hex << (void*)object << ":" << object << endl; \ + cdebug.log(20) << "Py" #SELF_TYPE "_Link(" << hex << pyObject << ") " \ + << hex << (void*)object << ":" << object << endl; \ HCATCH \ \ return ( (PyObject*)pyObject ); \ @@ -1057,8 +1102,8 @@ extern "C" { pyObject = (Py##SELF_TYPE*)proxy->getShadow (); \ Py_INCREF ( ACCESS_CLASS(pyObject) ); \ } \ - trace << "PyDbo" #SELF_TYPE "_Link(" << hex << pyObject << ") " \ - << hex << (void*)object << ":" << object << endl; \ + cdebug.log(20) << "PyDbo" #SELF_TYPE "_Link(" << hex << pyObject << ") " \ + << hex << (void*)object << ":" << object << endl; \ HCATCH \ \ return ( (PyObject*)pyObject ); \ @@ -1070,8 +1115,8 @@ extern "C" { # define DBoDeleteMethod(SELF_TYPE) \ static void Py##SELF_TYPE##_DeAlloc ( Py##SELF_TYPE *self ) \ { \ - trace << "PyDbObject_DeAlloc(" << hex << self << ") " \ - << hex << (void*)(self->ACCESS_OBJECT) << ":" << self->ACCESS_OBJECT << endl; \ + cdebug.log(20) << "PyDbObject_DeAlloc(" << hex << self << ") " \ + << hex << (void*)(self->ACCESS_OBJECT) << ":" << self->ACCESS_OBJECT << endl; \ \ if ( self->ACCESS_OBJECT != NULL ) { \ ProxyProperty* proxy = static_cast \ @@ -1095,8 +1140,8 @@ extern "C" { # define PythonOnlyDeleteMethod(SELF_TYPE) \ static void Py##SELF_TYPE##_DeAlloc ( Py##SELF_TYPE *self ) \ { \ - trace << "PythonOnlyObject_DeAlloc(" << hex << self << ") " \ - << hex << (void*)(self->ACCESS_OBJECT) \ + cdebug.log(20) << "PythonOnlyObject_DeAlloc(" << hex << self << ") " \ + << hex << (void*)(self->ACCESS_OBJECT) \ << ":" << self->ACCESS_OBJECT << endl; \ PyObject_DEL ( self ); \ } @@ -1110,8 +1155,8 @@ extern "C" { # define NoObjectDeleteMethod(SELF_TYPE) \ static void Py##SELF_TYPE##_DeAlloc ( Py##SELF_TYPE *self ) \ { \ - trace << "PythonOnlyObject_DeAlloc(" << hex << self << ") " \ - << "[no object]" << endl; \ + cdebug.log(20) << "PythonOnlyObject_DeAlloc(" << hex << self << ") " \ + << "[no object]" << endl; \ PyObject_DEL ( self ); \ } @@ -1123,7 +1168,7 @@ extern "C" { #define PyTypeObjectLinkPyTypeWithoutObject(PY_SELF_TYPE,SELF_TYPE) \ extern void Py##PY_SELF_TYPE##_LinkPyType() { \ - trace << "Py" #PY_SELF_TYPE "_LinkType()" << endl; \ + cdebug.log(20) << "Py" #PY_SELF_TYPE "_LinkType()" << endl; \ \ PyType##PY_SELF_TYPE.tp_dealloc = (destructor) Py##PY_SELF_TYPE##_DeAlloc; \ PyType##PY_SELF_TYPE.tp_methods = Py##PY_SELF_TYPE##_Methods; \ @@ -1141,7 +1186,7 @@ extern "C" { DirectCmpMethod (Py##PY_SELF_TYPE##_Cmp, IsPy##PY_SELF_TYPE, Py##PY_SELF_TYPE) \ DirectHashMethod(Py##PY_SELF_TYPE##_Hash, Py##SELF_TYPE) \ extern void Py##PY_SELF_TYPE##_LinkPyType() { \ - trace << "Py" #PY_SELF_TYPE "_LinkType()" << endl; \ + cdebug.log(20) << "Py" #PY_SELF_TYPE "_LinkType()" << endl; \ \ PyType##PY_SELF_TYPE.tp_dealloc = (destructor) Py##PY_SELF_TYPE##_DeAlloc; \ PyType##PY_SELF_TYPE.tp_compare = (cmpfunc) Py##PY_SELF_TYPE##_Cmp; \ @@ -1158,7 +1203,7 @@ extern "C" { DirectCmpMethod (Py##PY_SELF_TYPE##_Cmp, IsPy##PY_SELF_TYPE, Py##PY_SELF_TYPE) \ DirectHashMethod(Py##PY_SELF_TYPE##_Hash, Py##SELF_TYPE) \ extern void Py##PY_SELF_TYPE##_LinkPyType() { \ - trace << "Py" #PY_SELF_TYPE "_LinkType()" << endl; \ + cdebug.log(20) << "Py" #PY_SELF_TYPE "_LinkType()" << endl; \ \ PyType##PY_SELF_TYPE.tp_dealloc = (destructor) Py##PY_SELF_TYPE##_DeAlloc; \ PyType##PY_SELF_TYPE.tp_compare = (cmpfunc) Py##PY_SELF_TYPE##_Cmp; \ @@ -1185,7 +1230,7 @@ extern "C" { DirectCmpMethod (Py##PY_SELF_TYPE##Locator_Cmp, IsPy##PY_SELF_TYPE##Locator, Py##PY_SELF_TYPE##Locator) \ extern void Py##PY_SELF_TYPE##Locator_LinkPyType () \ { \ - trace << "Py" #PY_SELF_TYPE "Locator_LinkType()" << endl; \ + cdebug.log(20) << "Py" #PY_SELF_TYPE "Locator_LinkType()" << endl; \ \ PyType##PY_SELF_TYPE##Locator.tp_dealloc = (destructor)Py##PY_SELF_TYPE##Locator_DeAlloc; \ PyType##PY_SELF_TYPE##Locator.tp_compare = (cmpfunc) Py##PY_SELF_TYPE##Locator_Cmp; \ @@ -1399,16 +1444,26 @@ extern "C" { # define HCATCH \ } \ - catch ( Warning& w ) { \ + catch ( const Warning& w ) { \ std::string message = "\n" + getString(w); \ PyErr_Warn ( HurricaneWarning, const_cast(message.c_str()) ); \ } \ - catch ( Error& e ) { \ + catch ( const Error& e ) { \ std::string message = "\n" + getString(e); \ PyErr_SetString ( HurricaneError, message.c_str() ); \ return NULL; \ } \ - catch ( std::exception& e ) { \ + catch ( const Bug& e ) { \ + std::string message = "\n" + getString(e); \ + PyErr_SetString ( HurricaneError, message.c_str() ); \ + return NULL; \ + } \ + catch ( const Exception& e ) { \ + std::string message = "\nUnknown Hurricane::Exception"; \ + PyErr_SetString ( HurricaneError, message.c_str() ); \ + return NULL; \ + } \ + catch ( const std::exception& e ) { \ std::string message = "\n" + std::string(e.what()); \ PyErr_SetString ( HurricaneError, message.c_str() ); \ return NULL; \ @@ -1416,7 +1471,7 @@ extern "C" { catch ( ... ) { \ std::string message = \ "\nUnmanaged exception, neither a Hurricane::Error nor" \ - "std::exception."; \ + " a std::exception."; \ PyErr_SetString ( HurricaneError, message.c_str() ); \ return NULL; \ } \ diff --git a/hurricane/src/isobar/hurricane/isobar/PyHyperNet.h b/hurricane/src/isobar/hurricane/isobar/PyHyperNet.h index f67bdea4..cad0ad9c 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyHyperNet.h +++ b/hurricane/src/isobar/hurricane/isobar/PyHyperNet.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2007-2015, All Rights Reserved +// Copyright (c) UPMC 2007-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/hurricane/src/isobar/hurricane/isobar/PyInstance.h b/hurricane/src/isobar/hurricane/isobar/PyInstance.h index da9bfc30..cbdc63c7 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyInstance.h +++ b/hurricane/src/isobar/hurricane/isobar/PyInstance.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2006-2015, All Rights Reserved +// Copyright (c) UPMC 2006-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/hurricane/src/isobar/hurricane/isobar/PyInterval.h b/hurricane/src/isobar/hurricane/isobar/PyInterval.h index 00c7bb45..74cbf65c 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyInterval.h +++ b/hurricane/src/isobar/hurricane/isobar/PyInterval.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2014-2015, All Rights Reserved +// Copyright (c) UPMC 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/hurricane/src/isobar/hurricane/isobar/PyLayer.h b/hurricane/src/isobar/hurricane/isobar/PyLayer.h index 10e10d74..5698c870 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyLayer.h +++ b/hurricane/src/isobar/hurricane/isobar/PyLayer.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2006-2015, All Rights Reserved +// Copyright (c) UPMC 2006-2016, All Rights Reserved // // // +-----------------------------------------------------------------+ diff --git a/hurricane/src/isobar/hurricane/isobar/PyLibrary.h b/hurricane/src/isobar/hurricane/isobar/PyLibrary.h index 48dcc432..67e56a5c 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyLibrary.h +++ b/hurricane/src/isobar/hurricane/isobar/PyLibrary.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/hurricane/src/isobar/hurricane/isobar/PyNet.h b/hurricane/src/isobar/hurricane/isobar/PyNet.h index 25415e4e..ed2c1271 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyNet.h +++ b/hurricane/src/isobar/hurricane/isobar/PyNet.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2006-2015, All Rights Reserved +// Copyright (c) UPMC 2006-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/hurricane/src/isobar/hurricane/isobar/PyNetDirection.h b/hurricane/src/isobar/hurricane/isobar/PyNetDirection.h index ebbf4dca..69e0bac0 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyNetDirection.h +++ b/hurricane/src/isobar/hurricane/isobar/PyNetDirection.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2014-2015, All Rights Reserved +// Copyright (c) UPMC 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/hurricane/src/isobar/hurricane/isobar/PyNetExternalComponents.h b/hurricane/src/isobar/hurricane/isobar/PyNetExternalComponents.h index d00a8205..046d53a4 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyNetExternalComponents.h +++ b/hurricane/src/isobar/hurricane/isobar/PyNetExternalComponents.h @@ -1,11 +1,9 @@ - // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2010-2010, All Rights Reserved +// Copyright (c) UPMC 2010-2016, All Rights Reserved // -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | C O R I O L I S | // | I s o b a r - Hurricane / Python Interface | // | | @@ -13,18 +11,11 @@ // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | // | C++ Header : "./PyNetExternalComponents.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ - - - -# ifndef __PY_NET_EXTERNAL_COMPONENTS__ -# define __PY_NET_EXTERNAL_COMPONENTS__ - +#ifndef PY_NET_EXTERNAL_COMPONENTS_H +#define PY_NET_EXTERNAL_COMPONENTS_H #include "hurricane/isobar/PyHurricane.h" #include "hurricane/NetExternalComponents.h" @@ -43,8 +34,6 @@ extern "C" { } PyNetExternalComponents; - - // ------------------------------------------------------------------- // Functions & Types exported to "PyHurricane.cpp". @@ -59,13 +48,9 @@ extern "C" { #define PYNETEXTERNALCOMPONENTS_O(v) ( PY_NET_EXTERNAL_COMPONENTS(v)->_object ) -} // End of extern "C". +} // extern "C". +} // Isobar namespace. -} // End of Isobar namespace. - - - - -# endif +#endif // PY_NET_EXTERNAL_COMPONENTS_H diff --git a/hurricane/src/isobar/hurricane/isobar/PyNetType.h b/hurricane/src/isobar/hurricane/isobar/PyNetType.h index e6fd9e0f..0d768f99 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyNetType.h +++ b/hurricane/src/isobar/hurricane/isobar/PyNetType.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2014-2015, All Rights Reserved +// Copyright (c) UPMC 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/hurricane/src/isobar/hurricane/isobar/PyOccurrence.h b/hurricane/src/isobar/hurricane/isobar/PyOccurrence.h index c326b3ba..5ad2be66 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyOccurrence.h +++ b/hurricane/src/isobar/hurricane/isobar/PyOccurrence.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2006-2015, All Rights Reserved +// Copyright (c) UPMC 2006-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/hurricane/src/isobar/hurricane/isobar/PyOrientation.h b/hurricane/src/isobar/hurricane/isobar/PyOrientation.h index 92cfa335..43b484dd 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyOrientation.h +++ b/hurricane/src/isobar/hurricane/isobar/PyOrientation.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2014-2015, All Rights Reserved +// Copyright (c) UPMC 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/hurricane/src/isobar/hurricane/isobar/PyPad.h b/hurricane/src/isobar/hurricane/isobar/PyPad.h index 1ff2a89d..9b6045d4 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyPad.h +++ b/hurricane/src/isobar/hurricane/isobar/PyPad.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2006-2015, All Rights Reserved +// Copyright (c) UPMC 2006-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/hurricane/src/isobar/hurricane/isobar/PyPath.h b/hurricane/src/isobar/hurricane/isobar/PyPath.h index e9a56ae1..6684b5d8 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyPath.h +++ b/hurricane/src/isobar/hurricane/isobar/PyPath.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2006-2015, All Rights Reserved +// Copyright (c) UPMC 2006-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/hurricane/src/isobar/hurricane/isobar/PyPin.h b/hurricane/src/isobar/hurricane/isobar/PyPin.h index e675838b..0021d1ef 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyPin.h +++ b/hurricane/src/isobar/hurricane/isobar/PyPin.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2006-2015, All Rights Reserved +// Copyright (c) UPMC 2006-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/hurricane/src/isobar/hurricane/isobar/PyPinDirection.h b/hurricane/src/isobar/hurricane/isobar/PyPinDirection.h index d33743a5..78385ac6 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyPinDirection.h +++ b/hurricane/src/isobar/hurricane/isobar/PyPinDirection.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2014-2015, All Rights Reserved +// Copyright (c) UPMC 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/hurricane/src/isobar/hurricane/isobar/PyPinPlacementStatus.h b/hurricane/src/isobar/hurricane/isobar/PyPinPlacementStatus.h index a2f1aa28..69a81691 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyPinPlacementStatus.h +++ b/hurricane/src/isobar/hurricane/isobar/PyPinPlacementStatus.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2014-2015, All Rights Reserved +// Copyright (c) UPMC 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/hurricane/src/isobar/hurricane/isobar/PyPlacementStatus.h b/hurricane/src/isobar/hurricane/isobar/PyPlacementStatus.h index 96a62865..7f3c99be 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyPlacementStatus.h +++ b/hurricane/src/isobar/hurricane/isobar/PyPlacementStatus.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2014-2015, All Rights Reserved +// Copyright (c) UPMC 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/hurricane/src/isobar/hurricane/isobar/PyPoint.h b/hurricane/src/isobar/hurricane/isobar/PyPoint.h index d4e527eb..f43593e3 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyPoint.h +++ b/hurricane/src/isobar/hurricane/isobar/PyPoint.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2006-2015, All Rights Reserved +// Copyright (c) UPMC 2006-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/hurricane/src/isobar/hurricane/isobar/PyQuery.h b/hurricane/src/isobar/hurricane/isobar/PyQuery.h index 9d687ab4..d59b4e26 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyQuery.h +++ b/hurricane/src/isobar/hurricane/isobar/PyQuery.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2010-2015, All Rights Reserved +// Copyright (c) UPMC 2010-2016, All Rights Reserved // // // +-----------------------------------------------------------------+ diff --git a/hurricane/src/isobar/hurricane/isobar/PyReference.h b/hurricane/src/isobar/hurricane/isobar/PyReference.h index 195012f8..d80e0dcb 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyReference.h +++ b/hurricane/src/isobar/hurricane/isobar/PyReference.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/hurricane/src/isobar/hurricane/isobar/PyTransformation.h b/hurricane/src/isobar/hurricane/isobar/PyTransformation.h index d0fac1a1..6cf30c8e 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyTransformation.h +++ b/hurricane/src/isobar/hurricane/isobar/PyTransformation.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2006-2015, All Rights Reserved +// Copyright (c) UPMC 2006-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/hurricane/src/isobar/hurricane/isobar/PyUpdateSession.h b/hurricane/src/isobar/hurricane/isobar/PyUpdateSession.h index b7a899a1..b4b583f9 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyUpdateSession.h +++ b/hurricane/src/isobar/hurricane/isobar/PyUpdateSession.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2010-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2010-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/hurricane/src/isobar/hurricane/isobar/PyVertical.h b/hurricane/src/isobar/hurricane/isobar/PyVertical.h index 09e14e64..494355a4 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyVertical.h +++ b/hurricane/src/isobar/hurricane/isobar/PyVertical.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2007-2015, All Rights Reserved +// Copyright (c) UPMC 2007-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/hurricane/src/viewer/AreaCommand.cpp b/hurricane/src/viewer/AreaCommand.cpp index 85230785..ef74e52a 100644 --- a/hurricane/src/viewer/AreaCommand.cpp +++ b/hurricane/src/viewer/AreaCommand.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | diff --git a/hurricane/src/viewer/BreakpointWidget.cpp b/hurricane/src/viewer/BreakpointWidget.cpp index e0e6eb07..058d30ad 100644 --- a/hurricane/src/viewer/BreakpointWidget.cpp +++ b/hurricane/src/viewer/BreakpointWidget.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/hurricane/src/viewer/CMakeLists.txt b/hurricane/src/viewer/CMakeLists.txt index 25aed97f..79b996d6 100644 --- a/hurricane/src/viewer/CMakeLists.txt +++ b/hurricane/src/viewer/CMakeLists.txt @@ -28,6 +28,7 @@ hurricane/viewer/CellViewer.h hurricane/viewer/CellPrinter.h hurricane/viewer/CellImage.h + hurricane/viewer/OpenBlobDialog.h hurricane/viewer/RecordModel.h hurricane/viewer/InspectorWidget.h hurricane/viewer/SelectionPopupModel.h @@ -36,6 +37,8 @@ hurricane/viewer/SelectionWidget.h hurricane/viewer/NetlistModel.h hurricane/viewer/NetlistWidget.h + hurricane/viewer/HierarchyModel.h + hurricane/viewer/HierarchyWidget.h hurricane/viewer/DisplayFilterWidget.h hurricane/viewer/ControllerWidget.h hurricane/viewer/ScriptWidget.h @@ -55,6 +58,8 @@ hurricane/viewer/HierarchyCommand.h hurricane/viewer/SelectorCriterion.h hurricane/viewer/CellWidgets.h + hurricane/viewer/DesignBlob.h + hurricane/viewer/JsonConfiguration.h ) set( pyIncludes hurricane/viewer/PyHSVr.h hurricane/viewer/PyDrawingStyle.h @@ -94,6 +99,7 @@ CellViewer.cpp CellPrinter.cpp CellImage.cpp + OpenBlobDialog.cpp RecordModel.cpp InspectorWidget.cpp SelectionPopupModel.cpp @@ -104,9 +110,14 @@ NetInformations.cpp NetlistModel.cpp NetlistWidget.cpp + HierarchyInformations.cpp + HierarchyModel.cpp + HierarchyWidget.cpp DisplayFilterWidget.cpp ControllerWidget.cpp ScriptWidget.cpp + DesignBlob.cpp + JsonConfiguration.cpp ) set( pyCpps PyHSVr.cpp PyDrawingStyle.cpp diff --git a/hurricane/src/viewer/CellImage.cpp b/hurricane/src/viewer/CellImage.cpp index f2cdd794..5c037d57 100644 --- a/hurricane/src/viewer/CellImage.cpp +++ b/hurricane/src/viewer/CellImage.cpp @@ -69,7 +69,7 @@ namespace Hurricane { setCorner( Qt::BottomRightCorner, Qt::RightDockWidgetArea ); setCentralWidget( _cellWidget ); - _palette->build (); + _palette->readGraphics (); _cellWidget->bindToPalette( _palette ); _cellWidget->refresh(); diff --git a/hurricane/src/viewer/CellPrinter.cpp b/hurricane/src/viewer/CellPrinter.cpp index 53ef93a3..898517e6 100644 --- a/hurricane/src/viewer/CellPrinter.cpp +++ b/hurricane/src/viewer/CellPrinter.cpp @@ -1,8 +1,7 @@ - // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2012-2012, All Rights Reserved +// Copyright (c) UPMC 2012-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | @@ -76,7 +75,7 @@ namespace Hurricane { setCorner( Qt::BottomRightCorner, Qt::RightDockWidgetArea ); setCentralWidget( _cellWidget ); - _palette->build (); + _palette->readGraphics (); _cellWidget->bindToPalette( _palette ); _cellWidget->refresh(); @@ -294,13 +293,15 @@ namespace Hurricane { _paperWidth = _printer->width (); _paperHeight = _printer->height (); + //_drawingWidth = _paperWidth /4 - (frameMargin()<<1); + //_drawingHeight = _paperHeight/4 - (frameMargin()<<1); _drawingWidth = _paperWidth - (frameMargin()<<1); _drawingHeight = _paperHeight - (frameMargin()<<1); _xpaper = (imageOnly) ? 0 : frameMargin(); _ypaper = (imageOnly) ? 0 : frameMargin(); // Substract the cartouche size only for A4 format. - cerr << _printer->paperSize() << endl; + //cerr << _printer->paperSize() << endl; if ( _printer->orientation() == QPrinter::Landscape ) { _drawingWidth -= cartoucheHeight(); } else { @@ -308,12 +309,13 @@ namespace Hurricane { } // Compute the delta size between CellPrinter and CellWidget. - cerr << "(paperw,paperh) = (" << _paperWidth << "," << _paperHeight << ")" << endl; - cerr << "CellPrinter:" << geometry().width() << "x" << geometry().height() << endl; - cerr << "CellWidget: " << _cellWidget->geometry().width() << "x" << _cellWidget->geometry().height() << endl; - cerr << "resize: " << _drawingWidth << "x" << _drawingHeight << endl; - cerr << "AbutmentBox:" << _cellWidget->getCell()->getAbutmentBox() << endl; - cerr << "visibleArea:" << _cellWidget->getVisibleArea() << endl; + // cerr << "(paperw,paperh) = (" << _paperWidth << "," << _paperHeight << ")" << endl; + // cerr << "CellPrinter: " << geometry().width() << "x" << geometry().height() << endl; + // cerr << "CellWidget: " << _cellWidget->geometry().width() << "x" << _cellWidget->geometry().height() << endl; + // cerr << "ScreenCellWidget: " << _screenCellWidget->geometry().width() << "x" << _screenCellWidget->geometry().height() << endl; + // cerr << "resize: " << _drawingWidth << "x" << _drawingHeight << endl; + // cerr << "AbutmentBox: " << _cellWidget->getCell()->getAbutmentBox() << endl; + // cerr << "visibleArea: " << _cellWidget->getVisibleArea() << endl; // Resize the pixel window to the size of the paper usable area. // Then redraw the same visible area (in Hurricane coordinates). @@ -326,15 +328,17 @@ namespace Hurricane { Box visibleArea = _screenCellWidget->getVisibleArea(); if ( visibleArea.contains(_screenCellWidget->getCell()->getAbutmentBox()) ) { + //cerr << "fit to AB" << endl; setFitOnAbutmentBox( true ); _cellWidget->fitToContents(); } else { + //cerr << "reframe" << endl; _cellWidget->reframe( _screenCellWidget->getVisibleArea() ); } - cerr << "After resize CellWidget: " << _cellWidget->geometry().width() << "x" << _cellWidget->geometry().height() << endl; - cerr << "visibleArea(printer):" << _cellWidget->getVisibleArea() << endl; - cerr << "visibleArea(screen): " << _screenCellWidget->getVisibleArea() << endl; + // cerr << "After resize CellWidget: " << _cellWidget->geometry().width() << "x" << _cellWidget->geometry().height() << endl; + // cerr << "visibleArea(printer): " << _cellWidget->getVisibleArea() << endl; + // cerr << "visibleArea(screen): " << _screenCellWidget->getVisibleArea() << endl; //cerr << "(xpaper,ypaper) = (" << xpaper << "," << ypaper << ")" << endl; //cerr << "(w,h) = (" << w << "," << h << ")" << endl; diff --git a/hurricane/src/viewer/CellViewer.cpp b/hurricane/src/viewer/CellViewer.cpp index 226af418..1934e3c9 100644 --- a/hurricane/src/viewer/CellViewer.cpp +++ b/hurricane/src/viewer/CellViewer.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | @@ -32,7 +32,9 @@ #include "vlsisapd/utilities/Path.h" #include "vlsisapd/configuration/Configuration.h" +#include "hurricane/DebugSession.h" #include "hurricane/DataBase.h" +#include "hurricane/Library.h" #include "hurricane/Cell.h" //#include "MapView.h" #include "hurricane/isobar/PyCell.h" @@ -46,6 +48,8 @@ #include "hurricane/viewer/ScriptWidget.h" #include "hurricane/viewer/ExceptionWidget.h" #include "hurricane/viewer/GotoWidget.h" +#include "hurricane/viewer/DesignBlob.h" +#include "hurricane/viewer/OpenBlobDialog.h" #include "hurricane/viewer/SelectCommand.h" #include "hurricane/viewer/PyCellViewer.h" @@ -61,13 +65,21 @@ namespace Hurricane { void CellObserver::notify ( unsigned int flags ) { CellViewer* viewer = getOwner(); - switch ( flags & (Cell::Flags::CellAboutToChange|Cell::Flags::CellChanged) ) { + switch ( flags & (Cell::Flags::CellAboutToChange + |Cell::Flags::CellChanged + |Cell::Flags::CellDestroyed) ) { case Cell::Flags::CellAboutToChange: viewer->emitCellAboutToChange(); break; case Cell::Flags::CellChanged: viewer->emitCellChanged(); break; + case Cell::Flags::CellDestroyed: + viewer->emitCellAboutToChange(); + viewer->removeHistory( viewer->getCell() ); + viewer->setCell( NULL ); + viewer->emitCellChanged(); + break; } } @@ -100,6 +112,7 @@ namespace Hurricane { , _toolInterrupt (false) , _flags (0) , _updateState (ExternalEmit) + , _pyScriptName () { setObjectName( "viewer" ); menuBar()->setObjectName ( _getAbsWidgetPath("") ); @@ -393,6 +406,22 @@ namespace Hurricane { action->setVisible( false ); addToMenu( "file.========" ); + action = addToMenu( "file.openDesignBlob" + , tr("&Open Design Blob") + , tr("Reload (restore) the whole Hurricane DataBase state") + , QKeySequence() + , QIcon(":/images/stock_open.png") + ); + connect( action, SIGNAL(triggered()), this, SLOT(openDesignBlob()) ); + action = addToMenu( "file.saveDesignBlob" + , tr("&Save Design Blob") + , tr("Save (dump) the whole Hurricane DataBase state") + , QKeySequence() + , QIcon(":/images/stock_save.png") + ); + connect( action, SIGNAL(triggered()), this, SLOT(saveDesignBlob()) ); + addToMenu( "file.========" ); + action = addToMenu( "file.importCell" , tr("&Import Cell") , tr("Import (convert) a new Cell") @@ -547,10 +576,19 @@ namespace Hurricane { _cellHistory.pop_front (); _cellHistory.push_back ( activeState ); + rebuildHistory (); + } + + + void CellViewer::rebuildHistory () + { list< shared_ptr >::iterator istate = _cellHistory.begin(); for ( size_t i=0 ; igetName()).c_str() ); + QString entry = tr("&%1: %2 %3") + .arg(i+1) + .arg( getString((*istate)->getName()).c_str() ) + .arg( (*istate)->getTopPath().getCompactString().c_str() ); _cellHistoryAction[i]->setText ( entry ); _cellHistoryAction[i]->setVisible ( true ); istate++; @@ -561,6 +599,20 @@ namespace Hurricane { } + void CellViewer::removeHistory ( Cell* cell ) + { + Name cellName = (cell) ? cell->getName() : "empty"; + + list< shared_ptr >::iterator istate + = find_if( _cellHistory.begin(), _cellHistory.end(), CellWidget::FindStateName(cellName) ); + + if (istate != _cellHistory.end()) { + _cellHistory.remove ( *istate ); + rebuildHistory (); + } + } + + void CellViewer::setState ( shared_ptr& state ) { static bool isEmitter = false; @@ -593,12 +645,14 @@ namespace Hurricane { = find_if( _cellHistory.begin(), _cellHistory.end(), CellWidget::FindStateName(cellName) ); if (istate != _cellHistory.end()) { + cerr << "CellViewer::setCell() " << (*istate)->getCell() << endl; + (*istate)->getCell()->addObserver( getCellObserver() ); emit stateChanged ( *istate ); return; } - cell->addObserver( getCellObserver() ); + if (cell) cell->addObserver( getCellObserver() ); _cellWidget->setCell( cell ); } @@ -689,17 +743,53 @@ namespace Hurricane { void CellViewer::openHistoryCell () { - QAction* historyAction = qobject_cast ( sender() ); - if ( historyAction ) { + QAction* historyAction = qobject_cast( sender() ); + if (historyAction) { list< shared_ptr >::iterator istate = _cellHistory.begin(); - //size_t index = historyAction->data().toUInt(); - //for ( ; index>0 ; index--, istate++ ) - // cerr << "History: " << (*istate)->getName() << endl; + size_t index = historyAction->data().toUInt(); + for ( ; index>0 ; index--, ++istate ); emit stateChanged ( *istate ); } } + void CellViewer::openDesignBlob () + { + QString blobName; + if (OpenBlobDialog::runDialog(this,blobName)) { + string fileName = blobName.toStdString() + ".blob"; + //DebugSession::open( 0, 500 ); + + Cell* topCell = NULL; + DesignBlob* blob = DesignBlob::fromJson( fileName ); + + if (blob) topCell = blob->getTopCell(); + delete blob; + + //DebugSession::close(); + + setCell ( topCell ); + emit cellLoadedFromDisk( topCell ); + } + } + + + void CellViewer::saveDesignBlob () + { + Cell* cell = getCell(); + if (not cell) return; + + string blobName = getString(cell->getName()) + ".blob.json.bz2"; + DesignBlob blob ( cell ); + + //DebugSession::open( 0, 500 ); + JsonWriter writer ( blobName ); + writer.setFlags( JsonWriter::DesignBlobMode ); + jsonWrite( &writer, &blob ); + //DebugSession::close(); + } + + void CellViewer::select ( Occurrence& occurrence ) { if ( _cellWidget ) _cellWidget->select ( occurrence ); } @@ -804,7 +894,7 @@ namespace Hurricane { void CellViewer::runScriptWidget () - { ScriptWidget::runScript( this, getCell() ); } + { ScriptWidget::runScript( this, _pyScriptName, getCell() ); } string CellViewer::_getString () const diff --git a/hurricane/src/viewer/CellWidget.cpp b/hurricane/src/viewer/CellWidget.cpp index 8981c15e..9930c223 100644 --- a/hurricane/src/viewer/CellWidget.cpp +++ b/hurricane/src/viewer/CellWidget.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -977,6 +977,7 @@ namespace Hurricane { State* clone = new State(); clone->setCell ( getCell() ); + clone->setTopPath ( getTopPath() ); clone->setCursorStep ( getCursorStep() ); clone->setUnitPower ( getUnitPower() ); clone->setDbuMode ( getDbuMode() ); @@ -1041,7 +1042,7 @@ namespace Hurricane { // Class : "Hurricane::CellWidget". - int CellWidget::_initialSide = 400; + int CellWidget::_initialSide = 250; CellWidget::CellWidget ( QWidget* parent ) @@ -1079,15 +1080,12 @@ namespace Hurricane { setMouseTracking ( true ); //_mapView = new MapView ( this ); - DataBase* database = DataBase::getDB(); - if ( database ) - _technology = database->getTechnology (); QFont font = Graphics::getNormalFont(); _textFontHeight = QFontMetrics(font).ascent(); - _initialSide = Graphics::toHighDpi( _initialSide ); - if (Graphics::isHighDpi()) resize( _initialSide, _initialSide ); + if (Graphics::isHighDpi()) resize( Graphics::toHighDpi(_initialSide) + , Graphics::toHighDpi(_initialSide) ); } @@ -1173,6 +1171,12 @@ namespace Hurricane { } + void CellWidget::resetCommands () + { + for ( size_t i=0 ; i<_commands.size() ; ++i ) _commands[i]->reset(); + } + + void CellWidget::pushCursor ( Qt::CursorShape cursor ) { setCursor ( cursor ); @@ -1192,7 +1196,7 @@ namespace Hurricane { QSize CellWidget::minimumSizeHint () const { - return QSize(_initialSide,_initialSide); + return QSize(Graphics::toHighDpi(_initialSide),Graphics::toHighDpi(_initialSide)); } @@ -1263,17 +1267,21 @@ namespace Hurricane { void CellWidget::_redraw ( QRect redrawArea ) { - // cerr << "CellWidget::redraw() - start " - // << _selectionHasChanged << " filter:" - // << _state->getQueryFilter() << endl; + //cerr << "CellWidget::redraw() - start " + // << _selectionHasChanged << " filter:" + // << _state->getQueryFilter() << endl; -// static bool timedout; -// static Timer timer; + //static bool timedout; + //static Timer timer; if ( not isVisible() ) return; -// timer.start (); -// timedout = false; + DataBase* database = DataBase::getDB(); + if ( database ) _technology = database->getTechnology (); + + //timer.start (); + //timedout = false; + _cellChanged = false; _redrawRectCount = 0; @@ -1402,26 +1410,26 @@ namespace Hurricane { popCursor (); repaint (); -// timer.stop (); -// cerr << "CellWidget::redraw() - " << _redrawRectCount -// << " in " << timer.getCombTime() << "s (" -// << setprecision(3) << (timer.getCombTime()/_redrawRectCount) << " s/r)"; -// if ( _drawingQuery.getGoCount() ) -// cerr << " " << _drawingQuery.getGoCount() -// << " (" << setprecision(3) << (timer.getCombTime()/_drawingQuery.getGoCount()) << " s/go)"; -// else -// cerr << " 0 Gos"; -// if ( _drawingQuery.getExtensionGoCount() ) -// cerr << " " << _drawingQuery.getExtensionGoCount() -// << " (" << setprecision(3) << (timer.getCombTime()/_drawingQuery.getExtensionGoCount()) << " s/ego)"; -// else -// cerr << " 0 eGos"; -// if ( _drawingQuery.getInstanceCount() ) -// cerr << " " << _drawingQuery.getInstanceCount() -// << " (" << setprecision(3) << (timer.getCombTime()/_drawingQuery.getInstanceCount()) << " s/inst)"; -// else -// cerr << " 0 Instances"; -// cerr << endl; + //timer.stop (); + //cerr << "CellWidget::redraw() - " << _redrawRectCount + // << " in " << timer.getCombTime() << "s (" + // << setprecision(3) << (timer.getCombTime()/_redrawRectCount) << " s/r)"; + //if ( _drawingQuery.getGoCount() ) + // cerr << " " << _drawingQuery.getGoCount() + // << " (" << setprecision(3) << (timer.getCombTime()/_drawingQuery.getGoCount()) << " s/go)"; + //else + // cerr << " 0 Gos"; + //if ( _drawingQuery.getExtensionGoCount() ) + // cerr << " " << _drawingQuery.getExtensionGoCount() + // << " (" << setprecision(3) << (timer.getCombTime()/_drawingQuery.getExtensionGoCount()) << " s/ego)"; + //else + // cerr << " 0 eGos"; + //if ( _drawingQuery.getInstanceCount() ) + // cerr << " " << _drawingQuery.getInstanceCount() + // << " (" << setprecision(3) << (timer.getCombTime()/_drawingQuery.getInstanceCount()) << " s/inst)"; + //else + // cerr << " 0 Instances"; + //cerr << endl; } @@ -1607,7 +1615,7 @@ namespace Hurricane { { QFont font = Graphics::getNormalFont(flags&Bold); - if ( flags & BigFont ) font.setPointSize ( 18 ); + if ( flags & BigFont ) font.setPointSize ( Graphics::isHighDpi() ? 7 : 18 ); QFontMetrics metrics = QFontMetrics(font); int width = metrics.width ( text ); @@ -1631,7 +1639,7 @@ namespace Hurricane { painter.save(); if ( flags & Reverse ) painter.setPen ( Graphics::getPen("background") ); if ( flags & Reverse ) painter.setBackgroundMode ( Qt::OpaqueMode ); - if ( flags & BigFont ) font.setPointSize ( 18 ); + if ( flags & BigFont ) font.setPointSize ( Graphics::isHighDpi() ? 7 : 18 ); QFontMetrics metrics = QFontMetrics(font); int width = metrics.width ( text ); @@ -2410,39 +2418,46 @@ namespace Hurricane { } - void CellWidget::setCell ( Cell* cell ) + void CellWidget::setCell ( Cell* cell, Path topPath, unsigned int flags ) { //cerr << "CellWidget::setCell() - " << cell << endl; - if ( cell == getCell() ) return; + if (cell == getCell()) return; - openRefreshSession (); + if (not topPath.isEmpty() and (topPath.getTailInstance()->getMasterCell() != cell)) { + cerr << Warning( "CellWidget::setCell(): Incompatible Path %s with %s." + , topPath.getCompactString().c_str() + , getString(cell->getName()).c_str() ) << endl; + topPath = Path(); + } - shared_ptr state ( new State(cell) ); - setState ( state ); - if ( cell and cell->isTerminal() ) setQueryFilter ( ~0 ); + openRefreshSession(); + + shared_ptr state ( new State(cell,topPath) ); + setState( state, flags ); + if ( cell and cell->isTerminal() ) setQueryFilter( ~0 ); //setRealMode (); - fitToContents ( false ); + fitToContents( false ); - _state->setHistoryEnable ( true ); + _state->setHistoryEnable( true ); - closeRefreshSession (); + closeRefreshSession(); } - void CellWidget::setState ( shared_ptr& state ) + void CellWidget::setState ( shared_ptr& state, unsigned int flags ) { //cerr << "CellWidget::setState() - " << state->getName() << endl; - if ( state == _state ) return; + if (state == _state) return; - openRefreshSession (); - - cellPreModificate (); - _state->getSelection ().clear (); - _state->setCellWidget ( NULL ); - _state->setTopLeft ( getTopLeft() ); + openRefreshSession(); + cellPreModificate(); + if (not (flags & NoResetCommands)) resetCommands(); + _state->getSelection ().clear (); + _state->setCellWidget( NULL ); + _state->setTopLeft ( getTopLeft() ); _cellChanged = true; _state = state; @@ -2453,23 +2468,22 @@ namespace Hurricane { // << DbU::getValueString(_state->getTopLeft().getX()) << "," // << DbU::getValueString(_state->getTopLeft().getY()) << ")" << endl; - _state->setHistoryEnable ( false ); - _state->setCellWidget ( this ); - _drawingQuery .setCell ( getCell() ); - _drawingQuery .setStartLevel ( _state->getStartLevel() ); - _drawingQuery .setStopLevel ( _state->getStopLevel() ); - _textDrawingQuery.setCell ( getCell() ); + _state->setHistoryEnable( false ); + _state->setCellWidget ( this ); + _drawingQuery .setCell ( getCell() ); + _drawingQuery .setStartLevel( _state->getStartLevel() ); + _drawingQuery .setStopLevel ( _state->getStopLevel() ); + _textDrawingQuery.setCell ( getCell() ); - reframe (); - _state->setHistoryEnable ( true ); + reframe(); + _state->setHistoryEnable( true ); - emit cellChanged ( getCell() ); - emit stateChanged ( _state ); - emit queryFilterChanged (); + emit cellChanged ( getCell() ); + emit stateChanged ( _state ); + emit queryFilterChanged(); - cellPostModificate (); - - closeRefreshSession (); + cellPostModificate(); + closeRefreshSession(); } @@ -2485,8 +2499,8 @@ namespace Hurricane { throw Error ( "Can't select occurrence : invalid occurrence" ); if ( occurrence.getOwnerCell() != getCell() ) { - string s1 = Graphics::toHtml ( getString(occurrence.getOwnerCell()) ); - string s2 = Graphics::toHtml ( getString(getCell()) ); + string s1 = Graphics::toHtml ( getString(getCell()) ); + string s2 = Graphics::toHtml ( getString(occurrence.getOwnerCell()) ); throw Error ( "Can't select occurrence : incompatible occurrence %s vs. %s" , s1.c_str(), s2.c_str() ); } @@ -2530,6 +2544,10 @@ namespace Hurricane { if ( criterion and (not criterion->isEnabled()) ) { criterion->enable(); + //for ( Occurrence occurrence : getOccurrencesUnder(selectArea) ) { + // cerr << "Selecting: " << occurrence << endl; + //} + forEach ( Occurrence, ioccurrence, getOccurrencesUnder(selectArea) ) select ( *ioccurrence ); } else @@ -2551,8 +2569,8 @@ namespace Hurricane { throw Error ( "Can't select occurrence : invalid occurrence" ); if ( occurrence.getOwnerCell() != getCell() ) { - string s1 = Graphics::toHtml ( getString(occurrence.getOwnerCell()) ); - string s2 = Graphics::toHtml ( getString(getCell()) ); + string s1 = Graphics::toHtml ( getString(getCell()) ); + string s2 = Graphics::toHtml ( getString(occurrence.getOwnerCell()) ); throw Error ( "Can't select occurrence : incompatible occurrence %s vs. %s" , s1.c_str(), s2.c_str() ); } diff --git a/hurricane/src/viewer/ColorScale.cpp b/hurricane/src/viewer/ColorScale.cpp index 8e30ea06..9b23e1a7 100644 --- a/hurricane/src/viewer/ColorScale.cpp +++ b/hurricane/src/viewer/ColorScale.cpp @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // =================================================================== // diff --git a/hurricane/src/viewer/Command.cpp b/hurricane/src/viewer/Command.cpp index f7949edb..addd5f36 100644 --- a/hurricane/src/viewer/Command.cpp +++ b/hurricane/src/viewer/Command.cpp @@ -1,32 +1,22 @@ - // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | H U R R I C A N E | // | V L S I B a c k e n d D a t a - B a s e | // | | // | Author : Jean-Paul CHAPUT | -// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Module : "./Command.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ #include #include #include - #include #include @@ -68,6 +58,7 @@ namespace Hurricane { void Command::mousePressEvent ( QMouseEvent* ) { } void Command::mouseReleaseEvent ( QMouseEvent* ) { } void Command::draw () { } + void Command::reset () { } } // End of Hurricane namespace. diff --git a/hurricane/src/viewer/ControllerWidget.cpp b/hurricane/src/viewer/ControllerWidget.cpp index ad15f900..203d0d2a 100644 --- a/hurricane/src/viewer/ControllerWidget.cpp +++ b/hurricane/src/viewer/ControllerWidget.cpp @@ -1,14 +1,14 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | // | V L S I B a c k e n d D a t a - B a s e | // | | // | Author : Jean-Paul CHAPUT | -// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Module : "./ControllerWidget.cpp" | // +-----------------------------------------------------------------+ @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -72,6 +73,10 @@ namespace Hurricane { { } + void ControllerTab::graphicsUpdated () + { } + + // ------------------------------------------------------------------- // Class : "Hurricane::TabGraphics". @@ -98,6 +103,10 @@ namespace Hurricane { } + void TabGraphics::graphicsUpdated () + { _graphics->rereadGraphics(); } + + // ------------------------------------------------------------------- // Class : "Hurricane::TabDisplayFilter". @@ -134,7 +143,6 @@ namespace Hurricane { { //_palette->setOneColumn (); _palette->setObjectName ( "controller.tabPalette.palette" ); - _palette->build (); //_palette->setSectionVisible ( "Viewer", false ); QVBoxLayout* wLayout = new QVBoxLayout (); @@ -158,6 +166,10 @@ namespace Hurricane { } + void TabPalette::graphicsUpdated () + { _palette->rereadGraphics(); } + + // ------------------------------------------------------------------- // Class : "Hurricane::TabNetlist". @@ -267,6 +279,62 @@ namespace Hurricane { } +// ------------------------------------------------------------------- +// Class : "Hurricane::TabNetlist". + + + TabHierarchy::TabHierarchy ( QWidget* parent ) + : ControllerTab (parent) + , _hierarchyBrowser (new HierarchyWidget()) + { + _hierarchyBrowser->setObjectName ( "controller.tabHierarchy.hierarchyBrowser" ); + + QVBoxLayout* wLayout = new QVBoxLayout (); + wLayout->setContentsMargins ( 10, 0, 10, 0 ); + wLayout->setSpacing ( 0 ); + + QFrame* separator = new QFrame (); + separator->setFrameShape ( QFrame::HLine ); + separator->setFrameShadow ( QFrame::Sunken ); + wLayout->addWidget ( separator ); + wLayout->addWidget ( _hierarchyBrowser ); + + setLayout ( wLayout ); + } + + + void TabHierarchy::setCell ( Cell* cell ) + { } + + + void TabHierarchy::setCellWidget ( CellWidget* cellWidget ) + { + if (getCellWidget() != cellWidget) { + ControllerTab::setCellWidget( cellWidget ); + _hierarchyBrowser->setCellWidget( cellWidget ); + if (getCellWidget()) { + connect( getCellWidget(), SIGNAL(cellChanged(Cell*)), this, SLOT(setCell(Cell*)) ); + } + } + } + + + void TabHierarchy::cellPreModificate () + { } + + + void TabHierarchy::cellPostModificate () + { + CellWidget* cw = getCellWidget(); + Cell* topCell = cw->getTopCell(); + if (not topCell) topCell = cw->getCell(); + _hierarchyBrowser->setCell( topCell ); + + if (not cw->getTopPath().isEmpty()) + _hierarchyBrowser->rexpand( cw->getTopPath() ); + } + + // ------------------------------------------------------------------- // Class : "Hurricane::TabSelection". @@ -432,8 +500,9 @@ namespace Hurricane { TabSettings::TabSettings ( QWidget* parent ) : ControllerTab (parent) + , _timestamp (0) , _configuration(Configuration::get()->buildWidget(ConfigurationWidget::Embedded)) - { + { setContentsMargins ( 5, 0, 5, 5 ); _configuration->setObjectName ( "controller.tabSettings.settings" ); @@ -449,6 +518,25 @@ namespace Hurricane { { } + void TabSettings::showEvent ( QShowEvent* ) + { + Configuration* conf = Configuration::get(); + + if (_timestamp < conf->getLayout().getTimestamp()) { + _timestamp = conf->getLayout().getTimestamp(); + + QLayoutItem* child = NULL; + while ( (child = layout()->takeAt(0)) != 0 ) { + layout()->removeWidget( child->widget() ); + delete child->widget(); + } + + _configuration = conf->buildWidget( ConfigurationWidget::Embedded ); + layout()->addWidget ( _configuration ); + } + } + + // TabSettings::TabSettings ( QWidget* parent ) // : ControllerTab(parent) // , _settings(new QTabWidget()) @@ -470,53 +558,59 @@ namespace Hurricane { ControllerWidget::ControllerWidget ( QWidget* parent ) : QTabWidget (parent) + , _observer (this) , _cellWidget (NULL) , _tabGraphics (new TabGraphics()) , _tabPalette (new TabPalette()) , _tabDisplayFilter(new TabDisplayFilter()) , _tabNetlist (new TabNetlist()) + , _tabHierarchy (new TabHierarchy()) , _tabSelection (new TabSelection()) , _tabInspector (new TabInspector()) , _tabSettings (new TabSettings()) { - setObjectName ( "controller" ); - setAttribute ( Qt::WA_QuitOnClose, false ); - setWindowTitle ( tr("Controller") ); + setObjectName ( "controller" ); + setAttribute ( Qt::WA_QuitOnClose, false ); + setWindowTitle( tr("Controller") ); //connect ( _netlistBrowser, SIGNAL(destroyed()), this, SLOT(netlistBrowserDestroyed()) ); - _tabGraphics ->setObjectName ( "controller.graphics" ); - _tabPalette ->setObjectName ( "controller.palette" ); - _tabDisplayFilter->setObjectName ( "controller.displayFilter" ); - _tabNetlist ->setObjectName ( "controller.tabNetlist" ); - _tabSelection ->setObjectName ( "controller.tabSelection" ); - _tabInspector ->setObjectName ( "controller.tabInspector" ); - _tabSettings ->setObjectName ( "controller.tabSettings" ); + _tabGraphics ->setObjectName( "controller.graphics" ); + _tabPalette ->setObjectName( "controller.palette" ); + _tabDisplayFilter->setObjectName( "controller.displayFilter" ); + _tabNetlist ->setObjectName( "controller.tabNetlist" ); + _tabHierarchy ->setObjectName( "controller.tabHierarchy" ); + _tabSelection ->setObjectName( "controller.tabSelection" ); + _tabInspector ->setObjectName( "controller.tabInspector" ); + _tabSettings ->setObjectName( "controller.tabSettings" ); - addTab ( _tabGraphics , "Look" ); - addTab ( _tabDisplayFilter , "Filter" ); - addTab ( _tabPalette , "Layers&&Gos" ); - addTab ( _tabNetlist , "Netlist" ); - addTab ( _tabSelection , "Selection" ); - addTab ( _tabInspector , "Inspector" ); - addTab ( _tabSettings , "Settings" ); + addTab( _tabGraphics , "Look" ); + addTab( _tabDisplayFilter , "Filter" ); + addTab( _tabPalette , "Layers&&Gos" ); + addTab( _tabHierarchy , "Hierarchy" ); + addTab( _tabNetlist , "Netlist" ); + addTab( _tabSelection , "Selection" ); + addTab( _tabInspector , "Inspector" ); + addTab( _tabSettings , "Settings" ); QAction* toggleShow = new QAction ( tr("Controller"), this ); - toggleShow->setObjectName ( "controller.action.hideShow" ); - toggleShow->setShortcut ( QKeySequence(tr("CTRL+I")) ); - addAction ( toggleShow ); + toggleShow->setObjectName( "controller.action.hideShow" ); + toggleShow->setShortcut ( QKeySequence(tr("CTRL+I")) ); + addAction( toggleShow ); - connect ( toggleShow, SIGNAL(triggered()) , this, SLOT(toggleShow()) ); - connect ( this , SIGNAL(currentChanged(int)), this, SLOT(updateTab(int)) ); - connect ( _tabSelection->getSelection(), SIGNAL(inspect(Occurrence&)) - , _tabInspector , SLOT (setSelectionOccurrence(Occurrence&)) ); + connect( toggleShow, SIGNAL(triggered()) , this, SLOT(toggleShow()) ); + connect( this , SIGNAL(currentChanged(int)), this, SLOT(updateTab(int)) ); + connect( _tabSelection->getSelection(), SIGNAL(inspect(Occurrence&)) + , _tabInspector , SLOT (setSelectionOccurrence(Occurrence&)) ); + + Graphics::getGraphics()->addObserver( &_observer ); - resize ( Graphics::toHighDpi(600), Graphics::toHighDpi(500) ); + resize( Graphics::toHighDpi(600), Graphics::toHighDpi(500) ); } void ControllerWidget::toggleShow () - { setVisible ( !isVisible() ); } + { setVisible( !isVisible() ); } void ControllerWidget::setCellWidget ( CellWidget* cellWidget ) @@ -557,4 +651,22 @@ namespace Hurricane { } + void ControllerWidget::graphicsUpdated () + { + for ( int i=0 ; i(widget(i)))->graphicsUpdated (); + } + + +// ------------------------------------------------------------------- +// Class : "ControllerWidget::GraphicsObserver". + + void ControllerWidget::GraphicsObserver::notify ( unsigned int flags ) + { + ControllerWidget* controller = getOwner(); + if (flags & Graphics::ChangedDisplayStyles) { + controller->graphicsUpdated(); + } + } + } // End of Hurricane namespace. diff --git a/hurricane/src/viewer/DesignBlob.cpp b/hurricane/src/viewer/DesignBlob.cpp new file mode 100644 index 00000000..7adc51e8 --- /dev/null +++ b/hurricane/src/viewer/DesignBlob.cpp @@ -0,0 +1,102 @@ +// -*- mode: C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC 2016-2016, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./DesignBlob.cpp" | +// +-----------------------------------------------------------------+ + + +#include +#include "hurricane/JsonReader.h" +#include "hurricane/UpdateSession.h" +#include "hurricane/DataBase.h" +#include "hurricane/Cell.h" +#include "hurricane/viewer/Graphics.h" +#include "hurricane/viewer/DesignBlob.h" +#include "hurricane/viewer/JsonParameter.h" + + +namespace Hurricane { + + using std::cerr; + using std::endl; + + +// ------------------------------------------------------------------- +// Class : "DesignBlob". + + void DesignBlob::toJson( JsonWriter* w ) const + { + w->startObject(); + jsonWrite( w, "@typename" , _getTypeName() ); + jsonWrite( w, "_topCell" , getTopCell()->getHierarchicalName() ); + jsonWrite( w, "_database" , DataBase::getDB() ); + jsonWrite( w, "_graphics" , Graphics::getGraphics() ); + jsonWrite( w, "_configuration", Cfg::Configuration::get() ); + w->endObject(); + } + + + DesignBlob* DesignBlob::fromJson ( const string& filename ) + { + UpdateSession::open(); + + JsonReader reader ( JsonWriter::DesignBlobMode ); + reader.parse( filename ); + + UpdateSession::close(); + + const JsonStack& stack = reader.getStack(); + if (stack.rhas(".DesignBlob")) return stack.as(".DesignBlob"); + + return NULL; + } + +// ------------------------------------------------------------------- +// Class : "JsonDesignBlob". + + Initializer jsonDesignBlobInit ( 0 ); + + + void JsonDesignBlob::initialize () + { JsonTypes::registerType( new JsonDesignBlob (JsonWriter::RegisterMode) ); } + + + JsonDesignBlob::JsonDesignBlob ( unsigned long flags ) + : JsonObject(flags) + { + add( "_topCell" , typeid(string) ); + add( "_database" , typeid(DataBase*) ); + add( "_graphics" , typeid(Graphics*) ); + add( "_configuration", typeid(Cfg::Configuration*) ); + } + + + string JsonDesignBlob::getTypeName () const + { return "DesignBlob"; } + + + JsonDesignBlob* JsonDesignBlob::clone ( unsigned long flags ) const + { return new JsonDesignBlob ( flags ); } + + + void JsonDesignBlob::toData ( JsonStack& stack ) + { + check( stack, "JsonDesignBlob::toData" ); + + DesignBlob* designBlob = new DesignBlob + ( DataBase::getDB()->getCell( get(stack,"_topCell"), DataBase::NoFlags ) ); + + update( stack, designBlob ); + } + + +} // Hurricane namespace. diff --git a/hurricane/src/viewer/DisplayFilterWidget.cpp b/hurricane/src/viewer/DisplayFilterWidget.cpp index 5987665b..0d139af6 100644 --- a/hurricane/src/viewer/DisplayFilterWidget.cpp +++ b/hurricane/src/viewer/DisplayFilterWidget.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | diff --git a/hurricane/src/viewer/DisplayStyle.cpp b/hurricane/src/viewer/DisplayStyle.cpp index 012366aa..f829a69e 100644 --- a/hurricane/src/viewer/DisplayStyle.cpp +++ b/hurricane/src/viewer/DisplayStyle.cpp @@ -1,8 +1,7 @@ - // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2012, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | @@ -49,6 +48,8 @@ namespace Hurricane { const Name DisplayStyle::Undef = "undef"; +// ------------------------------------------------------------------- +// Class : "RawDrawingStyle". RawDrawingStyle::RawDrawingStyle ( const Name& name , const string& pattern @@ -73,6 +74,15 @@ namespace Hurricane { { } + RawDrawingStyle::~RawDrawingStyle () + { + if ( _color ) { + delete _color; + delete _pen; + delete _brush; + } + } + DrawingStyle RawDrawingStyle::create ( const Name& name , const string& pattern @@ -149,16 +159,114 @@ namespace Hurricane { } - RawDrawingStyle::~RawDrawingStyle () + void RawDrawingStyle::toJson ( JsonWriter* w ) const { - if ( _color ) { - delete _color; - delete _pen; - delete _brush; - } + w->startObject(); + jsonWrite( w, "@typename", "DrawingStyle" ); + jsonWrite( w, "_name" , _name ); + jsonWrite( w, "_red" , _red ); + jsonWrite( w, "_green" , _green ); + jsonWrite( w, "_blue" , _blue ); + jsonWrite( w, "_borderWidth", _borderWidth ); + jsonWrite( w, "_pattern" , _pattern ); + jsonWrite( w, "_threshold" , _threshold ); + jsonWrite( w, "_goMatched" , _goMatched ); + w->endObject(); } +// ------------------------------------------------------------------- +// Class : "JsonDrawingStyle". + + Initializer jsonDrawingStyleInit ( 0 ); + + + void JsonDrawingStyle::initialize () + { JsonTypes::registerType( new JsonDrawingStyle (JsonWriter::RegisterMode) ); } + + + JsonDrawingStyle::JsonDrawingStyle ( unsigned long flags ) + : JsonObject(flags) + { + if (flags & JsonWriter::RegisterMode) return; + + add( ".DrawingGroup", typeid(DrawingGroup) ); + add( "_name" , typeid(string) ); + add( "_red" , typeid(int64_t) ); + add( "_green" , typeid(int64_t) ); + add( "_blue" , typeid(int64_t) ); + add( "_borderWidth" , typeid(int64_t) ); + add( "_pattern" , typeid(string) ); + add( "_threshold" , typeid(double) ); + add( "_goMatched" , typeid(bool) ); + } + + + JsonDrawingStyle::~JsonDrawingStyle () + { } + + + string JsonDrawingStyle::getTypeName () const + { return "DrawingStyle"; } + + + JsonDrawingStyle* JsonDrawingStyle::clone ( unsigned long flags ) const + { return new JsonDrawingStyle ( flags ); } + + + void JsonDrawingStyle::toData(JsonStack& stack) + { + cdebug.log(19,1); + + check( stack, "JsonDrawingStyle::toData" ); + + DrawingGroup* dg = get( stack, ".DrawingGroup" ); + DrawingStyle ds; + + if (not dg) return; + + string name = get ( stack, "_name" ); + int red = get( stack, "_red" ); + int green = get( stack, "_green" ); + int blue = get( stack, "_blue" ); + int borderWidth = get( stack, "_borderWidth" ); + string pattern = get ( stack, "_pattern" ); + float threshold = get ( stack, "_threshold" ); + bool goMatched = get ( stack, "_goMatched" ); + + if (stack.issetFlags(JsonWriter::TechnoMode)) { + // Actual creation. + ds = RawDrawingStyle::create( name + , pattern + , red + , green + , blue + , borderWidth + , threshold + , goMatched + ); + dg->addDrawingStyle( ds ); + + if (Graphics::isEnabled()) dg->qtAllocate(); + } else { + // Check coherency with existing DrawingStyle. + ds = dg->find( name ); + if (ds == nullptr) { + cerr << Error( "JsonDrawingStyle::toData(): No DrawingStyle \"%s\" in the existing DisplayStyle." + , name.c_str() + ) << endl; + } + } + + update( stack, NULL ); + + cdebug.tabw(19,-1); + } + + +// ------------------------------------------------------------------- +// Class : "DrawingGroup". + DrawingGroup::DrawingGroup ( const Name& name ) : _name (name) , _drawingStyles() @@ -208,6 +316,17 @@ namespace Hurricane { } + void DrawingGroup::addDrawingStyle ( DrawingStyle ds ) + { + size_t i = findIndex ( ds->getName() ); + if ( i != InvalidIndex ) { + _drawingStyles[i] = ds; + } else { + _drawingStyles.push_back ( ds ); + } + } + + DrawingStyle DrawingGroup::addDrawingStyle ( const Name& key , const string& pattern , int red @@ -230,6 +349,91 @@ namespace Hurricane { } + void DrawingGroup::toJson ( JsonWriter* w ) const + { + w->startObject(); + jsonWrite( w, "@typename", "DrawingGroup" ); + jsonWrite( w, "_name", _name ); + + w->key( "+drawingStyles" ); + w->startArray(); + for ( DrawingStyle ds : _drawingStyles ) ds->toJson( w ); + w->endArray(); + + w->endObject(); + } + + +// ------------------------------------------------------------------- +// Class : "JsonDrawingGroup". + + Initializer jsonDrawingGroupInit ( 0 ); + + + void JsonDrawingGroup::initialize () + { JsonTypes::registerType( new JsonDrawingGroup (JsonWriter::RegisterMode) ); } + + + JsonDrawingGroup::JsonDrawingGroup ( unsigned long flags ) + : JsonObject(flags) + { + if (flags & JsonWriter::RegisterMode) return; + + add( ".DisplayStyle" , typeid(DisplayStyle*) ); + add( "_name" , typeid(string) ); + add( "+drawingStyles", typeid(JsonArray) ); + } + + + JsonDrawingGroup::~JsonDrawingGroup () + { } + + + string JsonDrawingGroup::getTypeName () const + { return "DrawingGroup"; } + + + JsonDrawingGroup* JsonDrawingGroup::clone ( unsigned long flags ) const + { return new JsonDrawingGroup ( flags ); } + + + void JsonDrawingGroup::toData(JsonStack& stack) + { + cdebug.log(19,1); + + check( stack, "JsonDrawingGroup::toData" ); + + DisplayStyle* ds = get( stack, ".DisplayStyle" ); + DrawingGroup* dg = NULL; + + if (not ds) return; + + string name = get( stack, "_name" ); + + if (stack.issetFlags(JsonWriter::TechnoMode)) { + // Actual creation. + size_t gi = 0; + ds->findOrCreate( name, gi ); + dg = ds->findGroup( name ); + } else { + // Check coherency with existing DrawingGroup. + dg = ds->findGroup( name ); + if (dg == NULL) { + cerr << Error( "JsonDrawingGroup::toData(): No DrawingGroup \"%s\" in the existing DisplayStyle." + , name.c_str() + ) << endl; + } + } + + update( stack, dg ); + + cdebug.tabw(19,-1); + } + + +// ------------------------------------------------------------------- +// Class : "DisplayStyle". + QColor DisplayStyle::darken ( const QColor& color, const DisplayStyle::HSVr& darkening ) { QColor hsvColor = color.toHsv(); @@ -332,6 +536,16 @@ namespace Hurricane { } + DrawingGroup* DisplayStyle::findGroup ( const Name& groupKey ) + { + for ( size_t gi=0 ; gi < _groups.size() ; gi++ ) { + if ( _groups[gi]->getName() == groupKey ) + return _groups[gi]; + } + return NULL; + } + + void DisplayStyle::findOrCreate ( const Name& groupKey, size_t& gi ) { for ( gi=0 ; gi < _groups.size() ; gi++ ) { @@ -428,4 +642,143 @@ namespace Hurricane { } -} + void DisplayStyle::toJson ( JsonWriter* w ) const + { + w->startObject(); + jsonWrite( w, "@typename", "DisplayStyle" ); + jsonWrite( w, "_name" , _name ); + jsonWrite( w, "_description", _description ); + jsonWrite( w, "_darkening" , &_darkening ); + + w->key( "+groups" ); + w->startArray(); + for ( DrawingGroup* dg : _groups ) dg->toJson( w ); + w->endArray(); + + w->endObject(); + } + + +// ------------------------------------------------------------------- +// Class : "JsonDisplayStyle". + + Initializer jsonDisplayStyleInit ( 0 ); + + + void JsonDisplayStyle::initialize () + { JsonTypes::registerType( new JsonDisplayStyle (JsonWriter::RegisterMode) ); } + + + JsonDisplayStyle::JsonDisplayStyle ( unsigned long flags ) + : JsonObject(flags) + { + if (flags & JsonWriter::RegisterMode) return; + + add( "_name" , typeid(string) ); + add( "_description", typeid(string) ); + add( "_darkening" , typeid(DisplayStyle::HSVr) ); + add( "+groups" , typeid(JsonArray) ); + } + + + JsonDisplayStyle::~JsonDisplayStyle () + { } + + + string JsonDisplayStyle::getTypeName () const + { return "DisplayStyle"; } + + + JsonDisplayStyle* JsonDisplayStyle::clone ( unsigned long flags ) const + { return new JsonDisplayStyle ( flags ); } + + + void JsonDisplayStyle::toData(JsonStack& stack) + { + cdebug.log(19,1); + + check( stack, "JsonDisplayStyle::toData" ); + + Graphics* graphics = get( stack, "_graphics" ); + DisplayStyle* ds = NULL; + + if (not graphics) return; + + string name = get ( stack, "_name" ); + string description = get ( stack, "_description" ); + DisplayStyle::HSVr* darkening = get( stack, "_darkening" ); + + if (stack.issetFlags(JsonWriter::TechnoMode)) { + // Actual creation. + ds = new DisplayStyle ( name ); + ds->setDescription( description ); + ds->setDarkening ( *darkening ); + graphics->addStyle( ds ); + } else { + // Check coherency with existing DisplayStyle. + ds = Graphics::getStyle( name ); + if (ds == NULL) { + cerr << Error( "JsonDisplayStyle::toData(): No DisplayStyle \"%s\" in the existing DisplayStyle." + , name.c_str() + ) << endl; + } + } + + update( stack, ds ); + + cdebug.tabw(19,-1); + } + + +// ------------------------------------------------------------------- +// Class : "JsonHSVr". + + Initializer jsonHSVrInit ( 0 ); + + + void JsonHSVr::initialize () + { JsonTypes::registerType( new JsonHSVr (JsonWriter::RegisterMode) ); } + + + JsonHSVr::JsonHSVr ( unsigned long flags ) + : JsonObject(flags) + { + if (flags & JsonWriter::RegisterMode) return; + + add( "_hue" , typeid(double) ); + add( "_saturation", typeid(double) ); + add( "_value" , typeid(double) ); + } + + + JsonHSVr::~JsonHSVr () + { } + + + string JsonHSVr::getTypeName () const + { return "HSVr"; } + + + JsonHSVr* JsonHSVr::clone ( unsigned long flags ) const + { return new JsonHSVr ( flags ); } + + + void JsonHSVr::toData(JsonStack& stack) + { + cdebug.log(19,1); + + check( stack, "JsonHSVr::toData" ); + + double hue = get( stack, "_hue" ); + double saturation = get( stack, "_saturation" ); + double value = get( stack, "_value" ); + + DisplayStyle::HSVr* hsvr = new DisplayStyle::HSVr(hue,saturation,value); + + update( stack, hsvr ); + + cdebug.tabw(19,-1); + } + + +} // Hurricane namespace. diff --git a/hurricane/src/viewer/ExceptionWidget.cpp b/hurricane/src/viewer/ExceptionWidget.cpp index d136bc7a..a29d70b7 100644 --- a/hurricane/src/viewer/ExceptionWidget.cpp +++ b/hurricane/src/viewer/ExceptionWidget.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -28,6 +28,7 @@ #include #include #include +#include "hurricane/Bug.h" #include "hurricane/Error.h" #include "hurricane/Exception.h" #include "hurricane/viewer/Graphics.h" @@ -71,6 +72,9 @@ namespace Hurricane { method(); failure = false; } + catch ( Bug& e ) { + ExceptionWidget::run( e ); + } catch ( Error& e ) { ExceptionWidget::run( e ); } diff --git a/hurricane/src/viewer/Graphics.cpp b/hurricane/src/viewer/Graphics.cpp index 92cc4575..4b2b63e3 100644 --- a/hurricane/src/viewer/Graphics.cpp +++ b/hurricane/src/viewer/Graphics.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | @@ -34,7 +34,8 @@ namespace Hurricane { Graphics::Graphics () - : _htmlTranslator () + : _observers () + , _htmlTranslator () , _styles () , _active (NULL) , _fireColorScale () @@ -70,6 +71,18 @@ namespace Hurricane { } + void Graphics::addObserver ( BaseObserver* observer ) + { getGraphics()->_observers.addObserver( observer ); } + + + void Graphics::removeObserver ( BaseObserver* observer ) + { getGraphics()->_observers.removeObserver( observer ); } + + + void Graphics::notify ( unsigned flags ) + { getGraphics()->_observers.notify( flags ); } + + Graphics* Graphics::getGraphics () { if (not _singleton) { @@ -351,6 +364,70 @@ namespace Hurricane { } + void Graphics::toJson ( JsonWriter* w ) const + { + w->startObject(); + jsonWrite( w, "@typename", "Graphics" ); + jsonWrite( w, "_active" , _active->getName() ); + + w->key( "+styles" ); + w->startArray(); + for ( DisplayStyle* ds : _styles ) ds->toJson( w ); + w->endArray(); + + w->endObject(); + } + + +// ------------------------------------------------------------------- +// Class : "JsonGraphics". + + Initializer jsonGraphicsInit ( 0 ); + + + void JsonGraphics::initialize () + { JsonTypes::registerType( new JsonGraphics (JsonWriter::RegisterMode) ); } + + + JsonGraphics::JsonGraphics ( unsigned long flags ) + : JsonObject(flags) + , _active () + { + if (flags & JsonWriter::RegisterMode) return; + + add( "_active", typeid(string) ); + add( "+groups", typeid(JsonArray) ); + } + + + JsonGraphics::~JsonGraphics () + { + Graphics* graphics = Graphics::getGraphics(); + graphics->setStyle( _active ); + graphics->notify ( Graphics::ChangedDisplayStyles ); + } + + + string JsonGraphics::getTypeName () const + { return "Graphics"; } + + + JsonGraphics* JsonGraphics::clone ( unsigned long flags ) const + { return new JsonGraphics ( flags ); } + + + void JsonGraphics::toData(JsonStack& stack) + { + cdebug.tabw(19,1); + + check( stack, "JsonGraphics::toData" ); + + _active = get( stack, "_active" ); + + update( stack, Graphics::getGraphics() ); + + cdebug.tabw(19,-1); + } } // End of Hurricane namespace. diff --git a/hurricane/src/viewer/GraphicsWidget.cpp b/hurricane/src/viewer/GraphicsWidget.cpp index 24582a40..6f58f58c 100644 --- a/hurricane/src/viewer/GraphicsWidget.cpp +++ b/hurricane/src/viewer/GraphicsWidget.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | @@ -35,19 +35,34 @@ namespace Hurricane { GraphicsWidget::GraphicsWidget ( QWidget* parent ) : QWidget (parent) , _cellWidget (NULL) + , _stylesGrid (new QGridLayout()) + , _stylesGroup(new QButtonGroup()) , _updateState(ExternalEmit) { setAttribute ( Qt::WA_QuitOnClose, false ); setWindowTitle ( tr("Display Styles") ); setFont ( Graphics::getNormalFont(true) ); - QButtonGroup* group = new QButtonGroup (); QGroupBox* groupBox = new QGroupBox ( tr("Display Styles") ); - QGridLayout* gLayout = new QGridLayout (); QVBoxLayout* wLayout = new QVBoxLayout (); - const vector& styles = Graphics::getStyles (); - DisplayStyle* activeStyle = Graphics::getStyle (); + if (Graphics::isHighDpi()) _stylesGrid->setContentsMargins( 30, 30, 30, 30 ); + + groupBox->setLayout ( _stylesGrid ); + wLayout->addWidget ( groupBox ); + wLayout->addStretch (); + setLayout ( wLayout ); + + connect ( _stylesGroup, SIGNAL(buttonClicked(int)), this, SLOT(setStyle(int)) ); + + readGraphics (); + } + + + void GraphicsWidget::readGraphics () + { + const vector& styles = Graphics::getStyles (); + DisplayStyle* activeStyle = Graphics::getStyle (); size_t hideFallback = (styles.size() > 1) ? 1 : 0; for ( size_t istyle=hideFallback ; istyle < styles.size() ; istyle++ ) { @@ -59,18 +74,10 @@ namespace Hurricane { label->setText ( styles[istyle]->getDescription().c_str() ); label->setFont ( Graphics::getNormalFont() ); - gLayout->addWidget ( button, istyle-hideFallback, 0 ); - gLayout->addWidget ( label , istyle-hideFallback, 1 ); - group->addButton ( button, istyle ); + _stylesGrid ->addWidget ( button, istyle-hideFallback, 0 ); + _stylesGrid ->addWidget ( label , istyle-hideFallback, 1 ); + _stylesGroup->addButton ( button, istyle ); } - if (Graphics::isHighDpi()) gLayout->setContentsMargins( 30, 30, 30, 30 ); - - groupBox->setLayout ( gLayout ); - wLayout->addWidget ( groupBox ); - wLayout->addStretch (); - setLayout ( wLayout ); - - connect ( group, SIGNAL(buttonClicked(int)), this, SLOT(setStyle(int)) ); } @@ -109,5 +116,22 @@ namespace Hurricane { } + void GraphicsWidget::resetGraphics () + { + QLayoutItem* child = NULL; + while ( (child = _stylesGrid->takeAt(0)) != 0 ) { + _stylesGrid->removeWidget( child->widget() ); + delete child->widget(); + } + } -} + + void GraphicsWidget::rereadGraphics () + { + resetGraphics(); + readGraphics(); + //setStyle( 0 ); + } + + +} // Hurricane namespace. diff --git a/hurricane/src/viewer/HApplication.cpp b/hurricane/src/viewer/HApplication.cpp index b4492f6e..bdd5bf8f 100644 --- a/hurricane/src/viewer/HApplication.cpp +++ b/hurricane/src/viewer/HApplication.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -16,6 +16,7 @@ #include #include +#include "hurricane/Bug.h" #include "hurricane/Error.h" #include "hurricane/viewer/Graphics.h" #include "hurricane/viewer/ExceptionWidget.h" @@ -67,6 +68,9 @@ namespace Hurricane { try { return QApplication::notify( object, event ); } + catch ( Bug& e ) { + ExceptionWidget::run( e ); + } catch ( Error& e ) { ExceptionWidget::run( e ); } diff --git a/hurricane/src/viewer/HierarchyCommand.cpp b/hurricane/src/viewer/HierarchyCommand.cpp index bc66dfa2..7f5a79b6 100644 --- a/hurricane/src/viewer/HierarchyCommand.cpp +++ b/hurricane/src/viewer/HierarchyCommand.cpp @@ -1,26 +1,17 @@ - // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | H U R R I C A N E | // | V L S I B a c k e n d D a t a - B a s e | // | | // | Author : Jean-Paul CHAPUT | -// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Module : "./HierarchyCommand.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ # include @@ -58,41 +49,53 @@ namespace Hurricane { { return _name; } + void HierarchyCommand::reset () + { + _history.clear(); + _historyIndex = 0; + } + + void HierarchyCommand::keyReleaseEvent ( QKeyEvent* event ) { bool control = (event->modifiers() & Qt::ControlModifier); bool shift = (event->modifiers() & Qt::ShiftModifier ); - if ( !shift && !control ) return; - if ( !_cellWidget->getCell() ) return; + if (not shift and not control) return; + if (not _cellWidget->getCell()) return; QPoint position ( _cellWidget->mapFromGlobal(QCursor::pos()) ); Box pointBox ( _cellWidget->screenToDbuBox(QRect(position,QSize(1,1))) ); switch ( event->key() ) { case Qt::Key_Up: - if ( ( _historyIndex > 0 ) && (shift || control) ) { - _cellWidget->setState ( _history[--_historyIndex]._state ); + if ( (_historyIndex > 0) and (shift or control) ) { + _cellWidget->setState ( _history[--_historyIndex], CellWidget::NoResetCommands ); } break; case Qt::Key_Down: { - if ( control ) { - if ( _history.empty() ) - _history.push_back ( HistoryEntry ( NULL, _cellWidget->getState() ) ); + if (control) { + Path topPath; + if (_history.empty()) { + _history.push_back( _cellWidget->getState() ); + topPath = _cellWidget->getState()->getTopPath(); + } else if (_historyIndex > 0) { + topPath = _history[_historyIndex-1]->getTopPath(); + } - Instances instances = _cellWidget->getCell()->getInstancesUnder ( pointBox ); - if ( !instances.isEmpty() ) { - _history.erase ( _history.begin()+_historyIndex+1, _history.end() ); + Instances instances = _cellWidget->getCell()->getInstancesUnder( pointBox ); + if (not instances.isEmpty()) { + _history.erase( _history.begin()+_historyIndex+1, _history.end() ); - Instance* instance = instances.getFirst (); - _cellWidget->setCell ( instance->getMasterCell() ); - _history.push_back ( HistoryEntry ( instance, _cellWidget->getState() ) ); + topPath = Path( topPath, instances.getFirst() ); + _cellWidget->setCell( topPath.getMasterCell(), topPath, CellWidget::NoResetCommands ); + _history.push_back( _cellWidget->getState() ); _historyIndex++; } - } else if ( shift ) { - if ( _historyIndex+1 < _history.size() ) { - _cellWidget->setState ( _history[++_historyIndex]._state ); + } else if (shift) { + if (_historyIndex+1 < _history.size()) { + _cellWidget->setState( _history[++_historyIndex], CellWidget::NoResetCommands ); } } } diff --git a/hurricane/src/viewer/HierarchyInformations.cpp b/hurricane/src/viewer/HierarchyInformations.cpp new file mode 100644 index 00000000..4733d80e --- /dev/null +++ b/hurricane/src/viewer/HierarchyInformations.cpp @@ -0,0 +1,288 @@ +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC 2015-2016, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | H U R R I C A N E | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./HierarchyInformations.cpp" | +// +-----------------------------------------------------------------+ + + +#include +#include "hurricane/Name.h" +#include "hurricane/Cell.h" +#include "hurricane/Instance.h" +#include "hurricane/viewer/HierarchyInformations.h" + + +namespace Hurricane { + + +// ------------------------------------------------------------------- +// Class : "HierarchyInfos" + + HierarchyInfos::HierarchyInfos ( HierarchyInfos* parent, size_t rowInParent ) + : _parent (parent) + , _rowInParent(rowInParent) + { } + + + HierarchyInfos::~HierarchyInfos () + { } + + + int HierarchyInfos::getColumnCount () + { return 2; } + + + QVariant HierarchyInfos::getColumnName ( int column ) + { + switch ( column ) { + case 0: return QVariant(QObject::tr("Instance")); + case 1: return QVariant(QObject::tr("Model/Cell")); + } + return QVariant(QObject::tr("Column Out of Bound")); + } + + + QVariant HierarchyInfos::getColumn ( int column ) const + { + if (isRoot()) return QVariant(QObject::tr("RootItem")); + + const Instance* instance = getInstance(); + if (instance) { + switch ( column ) { + case 0: return getString(instance->getName()).c_str(); + case 1: return getString(instance->getMasterCell()->getName()).c_str(); + } + } else { + switch ( column ) { + case 0: return ""; + case 1: return getString(getMasterCell()->getName()).c_str(); + } + } + + return QVariant(QObject::tr("Column Out of Bound")); + } + + + Path HierarchyInfos::getPath () const + { + if (isRoot() or not getInstance()) return Path(); + + return Path( getParent()->getPath(), const_cast(getInstance()) ); + } + + +// ------------------------------------------------------------------- +// Class : "LeafHierarchyInfos" + + + const vector LeafHierarchyInfos::_instances; + + + LeafHierarchyInfos::LeafHierarchyInfos ( const Instance* instance + , HierarchyInfos* parent + , size_t rowInParent ) + : HierarchyInfos(parent,rowInParent) + , _instance(instance) + { } + + + LeafHierarchyInfos::~LeafHierarchyInfos () + { } + + + bool LeafHierarchyInfos::isRoot () const { return false; } + bool LeafHierarchyInfos::isLeaf () const { return true; } + bool LeafHierarchyInfos::isCollapsed () const { return true; } + const HierarchyInfos* LeafHierarchyInfos::getRow ( int row ) const { return NULL; } + int LeafHierarchyInfos::size () const { return 0; } + Cell* LeafHierarchyInfos::getMasterCell () const { return _instance->getMasterCell(); } + const Instance* LeafHierarchyInfos::getInstance () const { return _instance; } + const std::vector& LeafHierarchyInfos::getInstances () const { return _instances; } + QString LeafHierarchyInfos::getFilterPattern () const { return ""; } + void LeafHierarchyInfos::setFilterPattern ( const QString& ) { } + void LeafHierarchyInfos::expand () { } + void LeafHierarchyInfos::collapse () { } + + +// ------------------------------------------------------------------- +// Class : "InstHierarchyInfos" + + InstHierarchyInfos::InstHierarchyInfos ( const Instance* instance + , HierarchyInfos* parent + , size_t rowInParent ) + : HierarchyInfos(parent,rowInParent) + , _flags (HierarchyInfos::Collapsed) + , _instance (instance) + , _instances() + { } + + + InstHierarchyInfos::~InstHierarchyInfos () + { + collapse(); + } + + + bool InstHierarchyInfos::isRoot () const { return false; } + bool InstHierarchyInfos::isLeaf () const { return false; } + bool InstHierarchyInfos::isCollapsed () const { return _flags & HierarchyInfos::Collapsed; } + Cell* InstHierarchyInfos::getMasterCell () const { return _instance->getMasterCell(); } + const Instance* InstHierarchyInfos::getInstance () const { return _instance; } + const std::vector& InstHierarchyInfos::getInstances () const { return _instances; } + QString InstHierarchyInfos::getFilterPattern () const { return _filter.pattern(); } + + + int InstHierarchyInfos::size () const + { + if (_flags & HierarchyInfos::Collapsed) { + const_cast(this)->expand(); + } + return _instances.size(); + } + + + void InstHierarchyInfos::setFilterPattern ( const QString& pattern ) + { + _filter.setPattern( pattern ); + + if (_flags & HierarchyInfos::Collapsed) return; + + size_t i = 0; + for ( Instance* instance : getMasterCell()->getInstances() ) { + if (instance->getMasterCell()->isFeed()) continue; + + if ( (i < _instances.size()) and (instance == _instances[i]->getInstance()) ) { + // The instance *is already* in the list. + if ( not _filter.isEmpty() and (_filter.indexIn(getString(instance->getName()).c_str()) < 0) ) { + delete _instances[i]; + _instances.erase( _instances.begin()+i ); + } else { + ++i; + } + } else { + // The instance *is not* in the list. + if (_filter.isEmpty() or (_filter.indexIn(getString(instance->getName()).c_str()) >= 0) ) { + HierarchyInfos* infos = NULL; + if (instance->isLeaf()) infos = new LeafHierarchyInfos( instance, this, 0 ); + else infos = new InstHierarchyInfos( instance, this, 0 ); + + _instances.insert( _instances.begin()+i, infos ); + ++i; + } + } + } + + for ( size_t i=0 ; i<_instances.size() ; ++i ) _instances[i]->setRowInParent( i ); + } + + + void InstHierarchyInfos::expand () + { + if (not (_flags & HierarchyInfos::Collapsed)) return; + _flags &= ~HierarchyInfos::Collapsed; + + if (not getMasterCell()) return; + + for ( Instance* instance : getMasterCell()->getInstances() ) { + if (instance->getMasterCell()->isFeed()) continue; + if (not _filter.isEmpty()) { + if (_filter.indexIn(getString(instance->getName()).c_str()) < 0) continue; + } + + HierarchyInfos* infos = NULL; + if (instance->isLeaf()) infos = new LeafHierarchyInfos( instance, this, _instances.size() ); + else infos = new InstHierarchyInfos( instance, this, _instances.size() ); + + _instances.push_back( infos ); + } + } + + + void InstHierarchyInfos::collapse () + { + if (_flags & HierarchyInfos::Collapsed) return; + _flags |= HierarchyInfos::Collapsed; + + for ( HierarchyInfos* info : _instances ) delete info; + + vector().swap( _instances ); + } + + + const HierarchyInfos* InstHierarchyInfos::getRow ( int row ) const + { + if (_flags & HierarchyInfos::Collapsed) { + const_cast(this)->expand(); + } + + if (row >= (int)_instances.size()) return NULL; + return _instances[row]; + } + + +// ------------------------------------------------------------------- +// Class : "TopCellHierarchyInfos" + + TopCellHierarchyInfos::TopCellHierarchyInfos ( Cell* cell, HierarchyInfos* parent ) + : InstHierarchyInfos(NULL,parent,0) + , _rootCell(cell) + { expand(); } + + + TopCellHierarchyInfos::~TopCellHierarchyInfos () + { collapse(); } + + + bool TopCellHierarchyInfos::isRoot () const { return false; } + Cell* TopCellHierarchyInfos::getMasterCell () const { return _rootCell; } + const Instance* TopCellHierarchyInfos::getInstance () const { return NULL; } + + + void TopCellHierarchyInfos::setCell ( Cell* rootCell ) + { + collapse(); + _rootCell = rootCell; + expand(); + } + + +// ------------------------------------------------------------------- +// Class : "RootHierarchyInfos" + + + RootHierarchyInfos::RootHierarchyInfos ( Cell* cell ) + : HierarchyInfos(NULL,0) + , _instances() + { + _instances.push_back( new TopCellHierarchyInfos(cell,this) ); + } + + + RootHierarchyInfos::~RootHierarchyInfos () + { delete _instances[0]; } + + + bool RootHierarchyInfos::isRoot () const { return true; } + bool RootHierarchyInfos::isLeaf () const { return false; } + bool RootHierarchyInfos::isCollapsed () const { return false; } + int RootHierarchyInfos::size () const { return _instances.size(); } + const HierarchyInfos* RootHierarchyInfos::getRow ( int row ) const { return (row==0) ? _instances[0] : NULL; } + Cell* RootHierarchyInfos::getMasterCell () const { return _instances[0]->getMasterCell(); } + const Instance* RootHierarchyInfos::getInstance () const { return NULL; } + const std::vector& RootHierarchyInfos::getInstances () const { return _instances; } + QString RootHierarchyInfos::getFilterPattern () const { return ""; } + void RootHierarchyInfos::setFilterPattern ( const QString& ) { } + void RootHierarchyInfos::expand () { } + void RootHierarchyInfos::collapse () { } + void RootHierarchyInfos::setCell ( Cell* topCell ) { dynamic_cast(_instances[0])->setCell(topCell); } + +} // End of Hurricane namespace. diff --git a/hurricane/src/viewer/HierarchyModel.cpp b/hurricane/src/viewer/HierarchyModel.cpp new file mode 100644 index 00000000..ea942cfc --- /dev/null +++ b/hurricane/src/viewer/HierarchyModel.cpp @@ -0,0 +1,146 @@ +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC 2015-2016, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | H U R R I C A N E | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./HierarchyModel.cpp" | +// +-----------------------------------------------------------------+ + + +#include +#include +#include "hurricane/Name.h" +#include "hurricane/Net.h" +#include "hurricane/Cell.h" +#include "hurricane/viewer/Graphics.h" +#include "hurricane/viewer/HierarchyInformations.h" +#include "hurricane/viewer/HierarchyModel.h" + + +namespace Hurricane { + + + HierarchyModel::HierarchyModel ( QObject* parent ) + : QAbstractItemModel(parent) + , _root (NULL) + { } + + + HierarchyModel::~HierarchyModel () + { } + + + bool HierarchyModel::hasChildren ( const QModelIndex& parent ) const + { + if (not parent.isValid()) return true; + + const HierarchyInfos* infos = infosFromIndex(parent); + if (not infos) return true; + + return not infos->isLeaf(); + } + + + QVariant HierarchyModel::data ( const QModelIndex& index, int role ) const + { + static QFont nameFont = Graphics::getFixedFont( QFont::Bold ); + static QFont valueFont = Graphics::getFixedFont( QFont::Normal, true ); + + if (role == Qt::FontRole) { + switch (index.column()) { + case 0: return nameFont; + default: return valueFont; + } + return QVariant(); + } + + if (not index.isValid()) return QVariant(); + + if (role == Qt::DisplayRole) { + const HierarchyInfos* infos = infosFromIndex( index ); + if (infos) + return infos->getColumn( index.column() ); + } + return QVariant(); + } + + + QVariant HierarchyModel::headerData ( int section + , Qt::Orientation orientation + , int role ) const + { + if (orientation == Qt::Vertical) return QVariant(); + + static QFont headerFont = Graphics::getFixedFont( QFont::Bold, false, false, +0 ); + + if (role == Qt::FontRole ) return headerFont; + if (role != Qt::DisplayRole ) return QVariant(); + if (role == Qt::SizeHintRole) return (Graphics::isHighDpi()) ? 600 : 300; + + return HierarchyInfos::getColumnName( section ); + } + + + int HierarchyModel::rowCount ( const QModelIndex& parent ) const + { + const HierarchyInfos* infos = infosFromIndex( parent ); + if (not infos) return 0; + + if (infos->isCollapsed()) { + cerr << "HierarchyModel::rowCount(): collapsed " << infos->size() << " " << infos->getInstance() << endl; + } + + return infos->size(); + } + + + int HierarchyModel::columnCount ( const QModelIndex& parent ) const + { return _root.getColumnCount(); } + + + QModelIndex HierarchyModel::index ( int row, int column, const QModelIndex& parent ) const + { + if (not _root.getMasterCell() or (row < 0) or (column < 0)) return QModelIndex(); + + const HierarchyInfos* parentInfos = infosFromIndex( parent ); + const HierarchyInfos* childInfos = parentInfos->getRow( row ); + + if (not childInfos) return QModelIndex(); + + QModelIndex index = createIndex( row, column, (void*)childInfos ); + // cerr << "HierarchyModel::index(): " << index.row() << "+" << index.column() + // << ":" << index.internalPointer() + // << " " << childInfos->getMasterCell() << endl; + + return index; + } + + + QModelIndex HierarchyModel::parent ( const QModelIndex& child ) const + { + const HierarchyInfos* childInfos = infosFromIndex( child ); + if (not childInfos) return QModelIndex(); + + const HierarchyInfos* parentInfos = childInfos->getParent(); + if (not parentInfos) return QModelIndex(); + + const HierarchyInfos* grandParentInfos = parentInfos->getParent(); + if (not grandParentInfos) return QModelIndex(); + + QModelIndex index = createIndex( parentInfos->getRowInParent(), 0, (void*)parentInfos ); + // cerr << "HierarchyModel::index(): " << index.row() << "+" << index.column() + // << ":" << index.internalPointer() + // << " " << childInfos->getMasterCell() << endl; + + return index; + } + + +} // Hurricane namespace. diff --git a/hurricane/src/viewer/HierarchyWidget.cpp b/hurricane/src/viewer/HierarchyWidget.cpp new file mode 100644 index 00000000..32218e31 --- /dev/null +++ b/hurricane/src/viewer/HierarchyWidget.cpp @@ -0,0 +1,265 @@ +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2015-2016, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | H U R R I C A N E | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./HierarchyWidget.cpp" | +// +-----------------------------------------------------------------+ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "hurricane/Commons.h" +#include "hurricane/Warning.h" +#include "hurricane/Net.h" +#include "hurricane/viewer/Graphics.h" +#include "hurricane/viewer/HierarchyModel.h" +#include "hurricane/viewer/HierarchyWidget.h" + + +namespace Hurricane { + + +// ------------------------------------------------------------------- +// Class : "HierarchyWidget". + + + HierarchyWidget::HierarchyWidget ( QWidget* parent ) + : QWidget (parent) + , _cellWidget (NULL) + , _cell (NULL) + , _baseModel (new HierarchyModel(this)) + , _view (new QTreeView(this)) + , _filterPatternLineEdit(new QLineEdit(this)) + , _rowHeight (20) + { + setAttribute( Qt::WA_DeleteOnClose ); + setAttribute( Qt::WA_QuitOnClose, false ); + setContextMenuPolicy( Qt::ActionsContextMenu ); + + _rowHeight = QFontMetrics( Graphics::getFixedFont() ).height() + 4; + + //_view->setShowGrid ( false ); + _view->setAlternatingRowColors( true ); + _view->setSelectionBehavior ( QAbstractItemView::SelectRows ); + _view->setSelectionMode ( QAbstractItemView::SingleSelection ); + _view->setSortingEnabled ( true ); + _view->setModel ( _baseModel ); + //_view->resizeColumnToContents ( 1 ); + + QHeaderView* horizontalHeader = _view->header(); + horizontalHeader->setDefaultAlignment ( Qt::AlignHCenter ); + horizontalHeader->setMinimumSectionSize( (Graphics::isHighDpi()) ? 600 : 300 ); + horizontalHeader->setResizeMode ( 0, QHeaderView::Interactive ); + horizontalHeader->setResizeMode ( 1, QHeaderView::Interactive ); + horizontalHeader->setStretchLastSection( true ); + + QLabel* filterPatternLabel = new QLabel(tr("&Filter pattern:"), this); + filterPatternLabel->setBuddy( _filterPatternLineEdit ); + + QGridLayout* gLayout = new QGridLayout(); + gLayout->addWidget( _view , 1, 0, 1, 2 ); + gLayout->addWidget( filterPatternLabel , 2, 0 ); + gLayout->addWidget(_filterPatternLineEdit, 2, 1); + + setLayout( gLayout ); + + connect ( _view, SIGNAL(collapsed (const QModelIndex&)) + , this , SLOT (collapseHook(const QModelIndex& )) ); + connect ( _filterPatternLineEdit , SIGNAL(returnPressed ()) + , this , SLOT (textFilterChanged()) ); + connect ( _view->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&,const QItemSelection&)) + , this , SLOT (followSelected (const QItemSelection&,const QItemSelection&)) ); + + TreeKeyFilter* filter = new TreeKeyFilter( this ); + _view->installEventFilter( filter ); + + resize(300, 300); + } + + + void HierarchyWidget::setCell ( Cell* cell ) + { + if (_cell == cell) return; + + _cell = cell; + _view->setVisible( false ); + _view->selectionModel()->clear(); + _baseModel->setCell( cell ); + + string windowTitle = "Hierarchy" + getString(cell); + setWindowTitle( tr(windowTitle.c_str()) ); + + _view->selectionModel()->select( _baseModel->index(0,0,_view->rootIndex()) + , QItemSelectionModel::Select|QItemSelectionModel::Rows ); + _view->resizeColumnToContents( 0 ); + _view->setVisible( true ); + } + + + bool HierarchyWidget::isRSelected ( const QModelIndex& index ) const + { + HierarchyInfos* infos = const_cast(_baseModel->infosFromIndex(index)); + for ( size_t row=0 ; row < infos->getInstances().size() ; ++row ) { + QModelIndex childIndex = _baseModel->index( row, 0, index ); + if (_view->selectionModel()->isSelected(childIndex)) + return true; + + if (not infos->isCollapsed() and isRSelected(childIndex)) return true; + } + + return false; + } + + + void HierarchyWidget::rexpand ( Path path ) + { + if (path.isEmpty()) return; + + QModelIndex index = _baseModel->index( 0, 0, QModelIndex() ); + do { + Instance* head = path.getHeadInstance(); + path = path.getTailPath(); + + _view->expand( index ); + HierarchyInfos* parentInfos = const_cast( _baseModel->infosFromIndex(index) ); + HierarchyInfos* childInfos = NULL; + + for ( HierarchyInfos* child : parentInfos->getInstances() ) { + if (child->getInstance() == head) { + childInfos = child; + break; + } + } + if (not childInfos) { + cerr << Warning("HierarchyWidget::rexpand(): discrepency between Path and Hierarchy.") << endl; + return; + } + + index = _baseModel->index( childInfos->getRowInParent(), 0, index ); + } while (not path.isEmpty()); + + _view->selectionModel()->clear(); + _view->selectionModel()->select( index, QItemSelectionModel::Select|QItemSelectionModel::Rows ); + _view->setCurrentIndex( index ); + } + + + void HierarchyWidget::rexpand ( const QModelIndex& index ) + { + HierarchyInfos* infos = const_cast(_baseModel->infosFromIndex(index)); + if (infos) { + if (not infos->isCollapsed()) { + _view->expand( index ); + for ( HierarchyInfos* child : infos->getInstances() ) { + rexpand( _baseModel->index( child->getRowInParent(), 0, index ) ); + } + } + } + } + + + void HierarchyWidget::collapseHook ( const QModelIndex& index ) + { + if (isRSelected(index)) { + _view->selectionModel()->clear(); + _view->selectionModel()->select( index, QItemSelectionModel::Select|QItemSelectionModel::Rows ); + } + + HierarchyInfos* infos = const_cast(_baseModel->infosFromIndex(index)); + infos->collapse(); + } + + + void HierarchyWidget::textFilterChanged () + { + QModelIndexList selecteds = _view->selectionModel()->selectedIndexes(); + + if (not selecteds.isEmpty()) { + QModelIndex index = selecteds[0]; + HierarchyInfos* infos = const_cast(_baseModel->infosFromIndex(index)); + infos->setFilterPattern( _filterPatternLineEdit->text() ); + _view->reset(); + rexpand( _view->rootIndex() ); + _view->selectionModel()->select( index, QItemSelectionModel::Select|QItemSelectionModel::Rows ); + _view->setCurrentIndex( index ); + } + } + + + void HierarchyWidget::followSelected ( const QItemSelection& selecteds, const QItemSelection& deselecteds ) + { + if (selecteds.indexes().isEmpty()) { + //cerr << Warning("HierarchyWidget::followSelected(): Selection should never be empty.") << endl; + return; + } + + QModelIndex index = selecteds.indexes()[0]; + HierarchyInfos* infos = const_cast(_baseModel->infosFromIndex(index)); + _filterPatternLineEdit->setText( infos->getFilterPattern() ); + } + + + void HierarchyWidget::goTo ( int delta ) + { + if (delta == 0) return; + + QModelIndex newIndex = _baseModel->index( _view->currentIndex().row()+delta, 0, QModelIndex() ); + + //if (newIndex.isValid()) + // _view->selectRow( newIndex.row() ); + } + + +// ------------------------------------------------------------------- +// Class : "TreeKeyFilter". + + + TreeKeyFilter::TreeKeyFilter ( QObject* parent ) + : QObject(parent) + { } + + + bool TreeKeyFilter::eventFilter ( QObject* object, QEvent* event ) + { + if (event->type() == QEvent::KeyPress) { + HierarchyWidget* owner = qobject_cast( parent() ); + if (not owner) return false; + + QKeyEvent* keyEvent = static_cast(event); + + if (keyEvent->key() == Qt::Key_Return) { + QModelIndexList selecteds = owner->_view->selectionModel()->selectedIndexes(); + + if (not selecteds.isEmpty()) { + QModelIndex index = selecteds[0]; + HierarchyInfos* infos = const_cast(owner->_baseModel->infosFromIndex(index)); + if (infos) { + if (owner->getCellWidget()) { + owner->getCellWidget()->setCell( infos->getMasterCell(), infos->getPath() ); + } + } + } + } + } + + return QObject::eventFilter( object, event ); + } + + +} // Hurricane namespace. diff --git a/hurricane/src/viewer/InspectorWidget.cpp b/hurricane/src/viewer/InspectorWidget.cpp index 7e016de8..5caa0752 100644 --- a/hurricane/src/viewer/InspectorWidget.cpp +++ b/hurricane/src/viewer/InspectorWidget.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | diff --git a/hurricane/src/viewer/JsonConfiguration.cpp b/hurricane/src/viewer/JsonConfiguration.cpp new file mode 100644 index 00000000..092c8cf0 --- /dev/null +++ b/hurricane/src/viewer/JsonConfiguration.cpp @@ -0,0 +1,523 @@ +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC 2016-2016, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./JsonConfiguration.cpp" | +// +-----------------------------------------------------------------+ + + +#include "vlsisapd/configuration/LayoutDescription.h" +#include "hurricane/Error.h" +#include "hurricane/viewer/JsonConfiguration.h" + + +void jsonWrite ( JsonWriter* w, const Cfg::Parameter* p ) +{ + w->startObject(); + jsonWrite( w, "@typename", "Cfg::Parameter" ); + jsonWrite( w, "_id" , p->getId() ); + jsonWrite( w, "_type" , Cfg::Parameter::typeToString(p->getType()) ); + jsonWrite( w, "_priority", Cfg::Parameter::priorityToString(p->getPriority()) ); + jsonWrite( w, "_value" , p->asString() ); + jsonWrite( w, "_flags" , p->getFlags() ); + + if (p->getType() == Cfg::Parameter::Int) { + if (p->hasMin()) jsonWrite( w, "_minInt", p->getMinInt() ); + if (p->hasMax()) jsonWrite( w, "_maxInt", p->getMaxInt() ); + } + if (p->getType() == Cfg::Parameter::Double) { + if (p->hasMin()) jsonWrite( w, "_minDouble", p->getMinDouble() ); + if (p->hasMax()) jsonWrite( w, "_maxDouble", p->getMaxDouble() ); + } + + jsonWrite( w, "+values", p->getValues() ); + + w->key( "+slaves" ); + w->startArray(); + for ( std::string slave : p->getSlaves() ) { + w->startObject(); + jsonWrite( w, "@typename", "Cfg::Parameter::Slave" ); + jsonWrite( w, "_id" , slave ); + w->endObject(); + } + w->endArray(); + + w->endObject(); +} + + +void jsonWrite ( JsonWriter* w, const Cfg::Parameter::EnumValue v ) +{ + w->startObject(); + jsonWrite( w, "@typename", "Cfg::Parameter::EnumValue" ); + jsonWrite( w, "_label" , v._label ); + jsonWrite( w, "_value" , v._value ); + w->endObject(); +} + + +void jsonWrite ( JsonWriter* w, const Cfg::Configuration* cfg ) +{ + w->startObject(); + jsonWrite( w, "@typename" , "Cfg::Configuration" ); + jsonWrite( w, "+parameters", cfg->getParameters() ); + jsonWrite( w, "+layout" , &cfg->getLayout () ); + w->endObject(); +} + + +void jsonWrite ( JsonWriter* w, const Cfg::WidgetDescription* widget ) +{ + w->startObject(); + jsonWrite( w, "@typename", "Cfg::WidgetDescription" ); + jsonWrite( w, "_type" , Cfg::WidgetDescription::typeToString(widget->getType()) ); + jsonWrite( w, "_id" , widget->getId () ); + jsonWrite( w, "_label" , widget->getLabel () ); + jsonWrite( w, "_column" , widget->getColumn() ); + jsonWrite( w, "_span" , widget->getSpan () ); + jsonWrite( w, "_flags" , widget->getFlags () ); + w->endObject(); +} + + +void jsonWrite ( JsonWriter* w, const Cfg::TabDescription* tab ) +{ + w->startObject(); + jsonWrite( w, "@typename", "Cfg::TabDescription" ); + jsonWrite( w, "_name" , tab->getName() ); + jsonWrite( w, "_id" , tab->getId() ); + jsonWrite( w, "+widgets" , tab->getWidgets() ); + w->endObject(); +} + + +void jsonWrite ( JsonWriter* w, const Cfg::LayoutDescription* layout ) +{ + w->startObject(); + jsonWrite( w, "@typename", "Cfg::LayoutDescription" ); + jsonWrite( w, "+tabs" , layout->getTabs() ); + w->endObject(); +} + + +namespace Hurricane { + + using Cfg::Parameter; + using Cfg::Configuration; + using Cfg::LayoutDescription; + using Cfg::TabDescription; + using Cfg::WidgetDescription; + + +// ------------------------------------------------------------------- +// Class : "JsonConfiguration" + + Initializer jsonConfigurationInit ( 0 ); + + + void JsonConfiguration::initialize () + { JsonTypes::registerType( new JsonConfiguration (JsonWriter::RegisterMode) ); } + + + JsonConfiguration::JsonConfiguration( unsigned long flags ) + : JsonObject(flags) + { + add( "+parameters", typeid(JsonArray) ); + } + + + string JsonConfiguration::getTypeName () const + { return "Cfg::Configuration"; } + + + JsonConfiguration* JsonConfiguration::clone ( unsigned long flags ) const + { return new JsonConfiguration ( flags ); } + + + void JsonConfiguration::toData ( JsonStack& stack ) + { + check( stack, "JsonConfiguration::toData" ); + + Configuration* cfg = Configuration::get(); + + update( stack, cfg ); + } + + +// ------------------------------------------------------------------- +// Class : "JsonParameter" + + Initializer jsonParameterInit ( 0 ); + + + void JsonParameter::initialize () + { JsonTypes::registerType( new JsonParameter (JsonWriter::RegisterMode) ); } + + + JsonParameter::JsonParameter ( unsigned long flags ) + : JsonObject(flags) + { + add( "_id" , typeid(string) ); + add( "_type" , typeid(string) ); + add( "_priority", typeid(string) ); + add( "_value" , typeid(string) ); + add( "_flags" , typeid(int64_t) ); + add( "+values" , typeid(JsonArray) ); + add( "+slaves" , typeid(JsonArray) ); + } + + + string JsonParameter::getTypeName () const + { return "Cfg::Parameter"; } + + + JsonParameter* JsonParameter::clone ( unsigned long flags ) const + { return new JsonParameter ( flags ); } + + + void JsonParameter::toData ( JsonStack& stack ) + { + check( stack, "JsonParameter::toData" ); + + Configuration* cfg = get( stack, "_configuration" ); + + Parameter* param = NULL; + string id = get ( stack, "_id" ); + string stype = get ( stack, "_type" ); + string spriority = get ( stack, "_priority" ); + string value = get ( stack, "_value" ); + int flags = get( stack, "_flags" ); + + Parameter::Type type = Parameter::stringToType (stype); + Parameter::Priority priority = Parameter::stringToPriority(spriority); + + param = cfg->getParameter( id ); + if (not param) { + param = cfg->addParameter( id, type, value, priority ); + } else { + if (param->getType() != type) { + cerr << Error( "JsonParameter::toData(): Type incoherency on parameter \"%s\", not restored." + , id.c_str() ) << endl; + } + param->setRawString( value, Parameter::Interactive ); + param->setPriority( priority ); + } + + if (type == Parameter::Int) { + if (flags & Parameter::HasMin) { + add( "_minInt", typeid(int64_t) ); + param->setMin( (int)get( stack, "_minInt" ), Parameter::Interactive ); + } + if (flags & Parameter::HasMax) { + add( "_maxInt", typeid(int64_t) ); + param->setMax( (int)get( stack, "_maxInt" ), Parameter::Interactive ); + } + } + + if (type == Parameter::Double) { + if (flags & Parameter::HasMin) { + add( "_minDouble", typeid(int64_t) ); + param->setMin( (double)get( stack, "_minDouble" ), Parameter::Interactive ); + } + if (flags & Parameter::HasMax) { + add( "_maxDouble", typeid(int64_t) ); + param->setMax( (double)get( stack, "_maxDouble" ), Parameter::Interactive ); + } + } + + if (param) param->valueChanged(); + + update( stack, param ); + } + + +// ------------------------------------------------------------------- +// Class : "JsonParamEnumValue" + + Initializer jsonParamEnumValueInit ( 0 ); + + + void JsonParamEnumValue::initialize () + { JsonTypes::registerType( new JsonParamEnumValue (JsonWriter::RegisterMode) ); } + + + JsonParamEnumValue::JsonParamEnumValue ( unsigned long flags ) + : JsonObject(flags) + { + add( "_label", typeid(string) ); + add( "_value", typeid(int64_t) ); + } + + + string JsonParamEnumValue::getTypeName () const + { return "Cfg::Parameter::EnumValue"; } + + + JsonParamEnumValue* JsonParamEnumValue::clone ( unsigned long flags ) const + { return new JsonParamEnumValue ( flags ); } + + + void JsonParamEnumValue::toData ( JsonStack& stack ) + { + check( stack, "JsonParamEnumValue::toData" ); + + Parameter* param = get( stack, ".Cfg::Parameter" ); + string label = get ( stack, "_label" ); + int value = get ( stack, "_value" ); + + if (not param) { + cerr << Error( "JsonParamEnumValue::toData(): Missing \".Cfg::Parameter\" in stack context.\n" + " (while reading Cfg::Parameter::EnumValue \"%s\")" + , label.c_str() + ) << endl; + } else { + if (stack.issetFlags(JsonWriter::TechnoMode)) { + param->addValue( label, value ); + } + } + + update( stack, NULL ); + } + + +// ------------------------------------------------------------------- +// Class : "JsonParamSlave" + + Initializer jsonParamSlaveInit ( 0 ); + + + void JsonParamSlave::initialize () + { JsonTypes::registerType( new JsonParamSlave (JsonWriter::RegisterMode) ); } + + + JsonParamSlave::JsonParamSlave ( unsigned long flags ) + : JsonObject(flags) + { + add( "_id", typeid(string) ); + } + + + string JsonParamSlave::getTypeName () const + { return "Cfg::Parameter::Slave"; } + + + JsonParamSlave* JsonParamSlave::clone ( unsigned long flags ) const + { return new JsonParamSlave ( flags ); } + + + void JsonParamSlave::toData ( JsonStack& stack ) + { + check( stack, "JsonParamSlave::toData" ); + + Parameter* param = get( stack, ".Cfg::Parameter" ); + string id = get ( stack, "_id " ); + + if (not param) { + cerr << Error( "JsonParamSlave::toData(): Missing \".Cfg::Parameter\" in stack context.\n" + " (while reading Cfg::Parameter::Slave \"%s\")" + , id.c_str() + ) << endl; + } else { + if (stack.issetFlags(JsonWriter::TechnoMode)) { + param->addSlave( id ); + } + } + + update( stack, NULL ); + } + + +// ------------------------------------------------------------------- +// Class : "JsonWidgetDescription" + + Initializer jsonWidgetDescriptionInit ( 0 ); + + + void JsonWidgetDescription::initialize () + { JsonTypes::registerType( new JsonWidgetDescription (JsonWriter::RegisterMode) ); } + + + JsonWidgetDescription::JsonWidgetDescription ( unsigned long flags ) + : JsonObject(flags) + { + add( ".Cfg::TabDescription", typeid(Cfg::TabDescription*) ); + add( "_type" , typeid(string) ); + add( "_id" , typeid(string) ); + add( "_label" , typeid(string) ); + add( "_column" , typeid(int64_t) ); + add( "_span" , typeid(int64_t) ); + add( "_flags" , typeid(int64_t) ); + } + + + string JsonWidgetDescription::getTypeName () const + { return "Cfg::WidgetDescription"; } + + + JsonWidgetDescription* JsonWidgetDescription::clone ( unsigned long flags ) const + { return new JsonWidgetDescription ( flags ); } + + + void JsonWidgetDescription::toData ( JsonStack& stack ) + { + check( stack, "JsonWidgetDescription::toData" ); + + LayoutDescription* layout = get( stack, "+layout" ); + TabDescription* tab = get ( stack, ".Cfg::TabDescription" ); + + WidgetDescription* widget = NULL; + string stype = get ( stack, "_type" ); + string id = get ( stack, "_id" ); + string label = get ( stack, "_label" ); + int column = get( stack, "_column" ); + int span = get( stack, "_span" ); + int flags = get( stack, "_flags" ); + + WidgetDescription::Type type = WidgetDescription::stringToType(stype); + + if (not layout) { + cerr << Error( "JsonWidgetDescription::toData(): Missing \"+layout\" in stack context.\n" + " (while reading \"%s\")" + , id.c_str() + ) << endl; + } else if (not tab) { + cerr << Error( "JsonWidgetDescription::toData(): Missing \".Cfg::TabDescription\" in stack context.\n" + " (while reading \"%s\")" + , id.c_str() + ) << endl; + } else { + if (stack.issetFlags(JsonWriter::TechnoMode)) { + switch ( type ) { + case WidgetDescription::Rule: layout->addRule ( tab->getName() ); break; + case WidgetDescription::Title: layout->addTitle ( tab->getName(), label ); break; + case WidgetDescription::Section: layout->addSection( tab->getName(), label, column ); break; + case WidgetDescription::Parameter: + layout->addParameter( tab->getName(), id, label, column, span, flags ); + widget = layout->getWidget( id ); + break; + } + } else { + // Coherency checking only. + if (type == WidgetDescription::Parameter) { + widget = layout->getWidget( id ); + if (not widget) { + cerr << Error( "JsonWidgetDescription::toData(): Parameter id=\"%s\" has no layout." + , id.c_str() ) << endl; + } + } + } + } + + update( stack, widget ); + } + + +// ------------------------------------------------------------------- +// Class : "JsonTabDescription" + + Initializer jsonTabDescriptionInit ( 0 ); + + + void JsonTabDescription::initialize () + { JsonTypes::registerType( new JsonTabDescription (JsonWriter::RegisterMode) ); } + + + JsonTabDescription::JsonTabDescription ( unsigned long flags ) + : JsonObject(flags) + { + add( "_name" , typeid(string) ); + add( "_id" , typeid(string) ); + add( "+widgets", typeid(JsonArray) ); + } + + + string JsonTabDescription::getTypeName () const + { return "Cfg::TabDescription"; } + + + JsonTabDescription* JsonTabDescription::clone ( unsigned long flags ) const + { return new JsonTabDescription ( flags ); } + + + void JsonTabDescription::toData ( JsonStack& stack ) + { + check( stack, "JsonTabDescription::toData" ); + + LayoutDescription* layout = get( stack, "+layout" ); + + TabDescription* tab = NULL; + string id = get( stack, "_id" ); + string name = get( stack, "_name" ); + + if (not layout) { + cerr << Error( "JsonTabDescription::toData(): Missing \"+layout\" in stack context.\n" + " (while reading TabDescription \"%s\")" + , id.c_str() + ) << endl; + } else { + if (stack.issetFlags(JsonWriter::TechnoMode)) { + layout->addTab( name, id ); + tab = layout->getTab( name, id ); + } else { + // Coherency checking only. + tab = layout->getTab( name, id ); + if (not tab) { + cerr << Error( "JsonTabDescription::toData(): Tab name=\"%s\", id=\"%s\" has no layout." + , name.c_str(), id.c_str() ) << endl; + } + } + } + + update( stack, tab ); + } + + +// ------------------------------------------------------------------- +// Class : "JsonLayoutDescription" + + Initializer jsonLayoutDescriptionInit ( 0 ); + + + void JsonLayoutDescription::initialize () + { JsonTypes::registerType( new JsonLayoutDescription (JsonWriter::RegisterMode) ); } + + + JsonLayoutDescription::JsonLayoutDescription ( unsigned long flags ) + : JsonObject(flags) + { + add( "+tabs", typeid(JsonArray) ); + } + + + JsonLayoutDescription::~JsonLayoutDescription () + { + } + + + string JsonLayoutDescription::getTypeName () const + { return "Cfg::LayoutDescription"; } + + + JsonLayoutDescription* JsonLayoutDescription::clone ( unsigned long flags ) const + { return new JsonLayoutDescription ( flags ); } + + + void JsonLayoutDescription::toData ( JsonStack& stack ) + { + check( stack, "JsonLayoutDescription::toData" ); + + LayoutDescription* layout = &Configuration::get()->getLayout(); + + update( stack, layout ); + } + + +} // Hurricane namespace. diff --git a/hurricane/src/viewer/JsonParameter.cpp b/hurricane/src/viewer/JsonParameter.cpp new file mode 100644 index 00000000..32f2f00e --- /dev/null +++ b/hurricane/src/viewer/JsonParameter.cpp @@ -0,0 +1,185 @@ +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC 2016-2016, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./JsonParameter.cpp" | +// +-----------------------------------------------------------------+ + + +#include "hurricane/Error.h" +#include "hurricane/viewer/JsonParameter.h" + + +void jsonWrite ( JsonWriter* w, const Cfg::Configuration* cfg ) +{ + w->startObject(); + jsonWrite( w, "@typename" , "Cfg::Configuration" ); + jsonWrite( w, "+parameters", cfg->getParameters() ); + + // w->key( "+parameters" ); + // w->startArray(); + // for ( auto mapElement : cfg->getParameters() ) jsonWrite( w, mapElement.second ); + // w->endArray(); + + w->endObject(); +} + + +void jsonWrite ( JsonWriter* w, const Cfg::Parameter* p ) +{ + w->startObject(); + jsonWrite( w, "@typename", "Cfg::Parameter" ); + jsonWrite( w, "_id" , p->getId() ); + jsonWrite( w, "_type" , Cfg::Parameter::typeToString(p->getType()) ); + jsonWrite( w, "_priority", Cfg::Parameter::priorityToString(p->getPriority()) ); + jsonWrite( w, "_value" , p->asString() ); + jsonWrite( w, "_flags" , p->getFlags() ); + + if (p->getType() == Cfg::Parameter::Int) { + if (p->hasMin()) jsonWrite( w, "_minInt", p->getMinInt() ); + if (p->hasMax()) jsonWrite( w, "_maxInt", p->getMaxInt() ); + } + if (p->getType() == Cfg::Parameter::Double) { + if (p->hasMin()) jsonWrite( w, "_minDouble", p->getMinDouble() ); + if (p->hasMax()) jsonWrite( w, "_maxDouble", p->getMaxDouble() ); + } + + w->endObject(); +} + + + +namespace Hurricane { + + using Cfg::Parameter; + using Cfg::Configuration; + + +// ------------------------------------------------------------------- +// Class : "JsonConfiguration" + + Initializer jsonConfigurationInit ( 0 ); + + + void JsonConfiguration::initialize () + { JsonTypes::registerType( new JsonConfiguration (JsonWriter::RegisterMode) ); } + + + JsonConfiguration::JsonConfiguration( unsigned long flags ) + : JsonObject(flags) + { + add( "+parameters", typeid(JsonArray) ); + } + + + string JsonConfiguration::getTypeName () const + { return "Cfg::Configuration"; } + + + JsonConfiguration* JsonConfiguration::clone ( unsigned long flags ) const + { return new JsonConfiguration ( flags ); } + + + void JsonConfiguration::toData ( JsonStack& stack ) + { + check( stack, "JsonConfiguration::toData" ); + + Configuration* cfg = Configuration::get(); + + update( stack, cfg ); + } + + +// ------------------------------------------------------------------- +// Class : "JsonParameter" + + Initializer jsonParameterInit ( 0 ); + + + void JsonParameter::initialize () + { JsonTypes::registerType( new JsonParameter (JsonWriter::RegisterMode) ); } + + + JsonParameter::JsonParameter( unsigned long flags ) + : JsonObject(flags) + { + add( "_id" , typeid(string) ); + add( "_type" , typeid(string) ); + add( "_priority", typeid(string) ); + add( "_value" , typeid(string) ); + add( "_flags" , typeid(int64_t) ); + } + + + string JsonParameter::getTypeName () const + { return "Cfg::Parameter"; } + + + JsonParameter* JsonParameter::clone ( unsigned long flags ) const + { return new JsonParameter ( flags ); } + + + void JsonParameter::toData ( JsonStack& stack ) + { + check( stack, "JsonParameter::toData" ); + + Configuration* cfg = get( stack, "_configuration" ); + + Parameter* param = NULL; + string id = get ( stack, "_id" ); + string stype = get ( stack, "_type" ); + string spriority = get ( stack, "_priority" ); + string value = get ( stack, "_value" ); + int flags = get( stack, "_flags" ); + + Parameter::Type type = Parameter::stringToType (stype); + Parameter::Priority priority = Parameter::stringToPriority(spriority); + + param = cfg->getParameter( id ); + if (not param) { + param = cfg->addParameter( id, type, value, priority ); + } else { + if (param->getType() != type) { + cerr << Error( "JsonParameter::toData(): Type incoherency on parameter \"%s\", not restored." + , id.c_str() ) << endl; + } + param->setRawString( value, Parameter::Interactive ); + param->setPriority( priority ); + } + + if (type == Parameter::Int) { + if (flags & Parameter::HasMin) { + add( "_minInt", typeid(int64_t) ); + param->setMin( (int)get( stack, "_minInt" ), Parameter::Interactive ); + } + if (flags & Parameter::HasMax) { + add( "_maxInt", typeid(int64_t) ); + param->setMax( (int)get( stack, "_maxInt" ), Parameter::Interactive ); + } + } + + if (type == Parameter::Double) { + if (flags & Parameter::HasMin) { + add( "_minDouble", typeid(int64_t) ); + param->setMin( (double)get( stack, "_minDouble" ), Parameter::Interactive ); + } + if (flags & Parameter::HasMax) { + add( "_maxDouble", typeid(int64_t) ); + param->setMax( (double)get( stack, "_maxDouble" ), Parameter::Interactive ); + } + } + + update( stack, param ); + } + + + +} // Hurricane namespace. diff --git a/hurricane/src/viewer/MousePositionWidget.cpp b/hurricane/src/viewer/MousePositionWidget.cpp index 3930223f..f289c819 100644 --- a/hurricane/src/viewer/MousePositionWidget.cpp +++ b/hurricane/src/viewer/MousePositionWidget.cpp @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // =================================================================== // diff --git a/hurricane/src/viewer/MoveCommand.cpp b/hurricane/src/viewer/MoveCommand.cpp index 7b59501d..fe9e53d4 100644 --- a/hurricane/src/viewer/MoveCommand.cpp +++ b/hurricane/src/viewer/MoveCommand.cpp @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // =================================================================== // diff --git a/hurricane/src/viewer/NetInformations.cpp b/hurricane/src/viewer/NetInformations.cpp index 750a8557..6f9bab09 100644 --- a/hurricane/src/viewer/NetInformations.cpp +++ b/hurricane/src/viewer/NetInformations.cpp @@ -1,60 +1,23 @@ - // -*- C++ -*- // -// This file is part of the Coriolis Project. -// Copyright (C) Laboratoire LIP6 - Departement ASIM -// Universite Pierre et Marie Curie +// This file is part of the Coriolis Software. +// Copyright (c) UPMC 2008-2016, All Rights Reserved // -// Main contributors : -// Christophe Alexandre -// Sophie Belloeil -// Hugo Clément -// Jean-Paul Chaput -// Damien Dupuis -// Christian Masson -// Marek Sroka -// -// The Coriolis Project is free software; you can redistribute it -// and/or modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// The Coriolis Project is distributed in the hope that it will be -// useful, but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with the Coriolis Project; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -// USA -// -// License-Tag -// Authors-Tag -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | H U R R I C A N E | // | V L S I B a c k e n d D a t a - B a s e | // | | // | Author : Jean-Paul CHAPUT | -// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Module : "./NetInformations.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ -#include - -#include "hurricane/Name.h" -#include "hurricane/Net.h" -#include "hurricane/viewer/NetInformations.h" +#include +#include "hurricane/Name.h" +#include "hurricane/Net.h" +#include "hurricane/viewer/NetInformations.h" namespace Hurricane { @@ -100,7 +63,7 @@ namespace Hurricane { int SimpleNetInformations::getColumnCount () - { return 2; } + { return 3; } QVariant SimpleNetInformations::getColumnName ( int column ) @@ -108,6 +71,7 @@ namespace Hurricane { switch ( column ) { case 0: return QVariant(QObject::tr("Net")); case 1: return QVariant(QObject::tr("Plugs")); + case 2: return QVariant(QObject::tr("RoutingPads")); } return QVariant(QObject::tr("Column Out of Bound")); } @@ -116,8 +80,15 @@ namespace Hurricane { QVariant SimpleNetInformations::getColumn ( int column ) { switch ( column ) { - case 0: return _columnNet; - case 1: return _columnPlug; + case 0: return _netName; + case 1: return (unsigned int)_plugsCount; + case 2: + if (_net->isGlobal()) { + if (not _rpsCount) return "N/A (global)"; + string s = getString(_rpsCount) + " (global)"; + return s.c_str(); + } + return (unsigned int)_rpsCount; } return QVariant(QObject::tr("Column Out of Bound")); } @@ -125,9 +96,9 @@ namespace Hurricane { SimpleNetInformations::SimpleNetInformations ( const Net* net ) : NetInformations(net) + , _netName (getString(getName()).c_str()) , _plugsCount (_net->getPlugs().getSize()) - , _columnNet (getString(getName()).c_str()) - , _columnPlug ((unsigned int)_plugsCount) + , _rpsCount (_net->getRoutingPads().getSize()) { } diff --git a/hurricane/src/viewer/NetlistModel.cpp b/hurricane/src/viewer/NetlistModel.cpp index de7e8fab..92e28596 100644 --- a/hurricane/src/viewer/NetlistModel.cpp +++ b/hurricane/src/viewer/NetlistModel.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | diff --git a/hurricane/src/viewer/NetlistWidget.cpp b/hurricane/src/viewer/NetlistWidget.cpp index 4696df5a..b45efaf0 100644 --- a/hurricane/src/viewer/NetlistWidget.cpp +++ b/hurricane/src/viewer/NetlistWidget.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | @@ -58,22 +58,27 @@ namespace Hurricane { _rowHeight = QFontMetrics(Graphics::getFixedFont()).height() + 4; - _sortModel->setSourceModel ( _baseModel ); - _sortModel->setDynamicSortFilter ( true ); - _sortModel->setFilterKeyColumn ( 0 ); + _sortModel->setSourceModel ( _baseModel ); + _sortModel->setDynamicSortFilter( true ); + _sortModel->setFilterKeyColumn ( 0 ); - _view->setShowGrid ( false ); - _view->setAlternatingRowColors ( true ); - _view->setSelectionBehavior ( QAbstractItemView::SelectRows ); - _view->setSortingEnabled ( true ); - _view->setModel ( _sortModel ); + _view->setShowGrid ( false ); + _view->setAlternatingRowColors( true ); + _view->setSelectionBehavior ( QAbstractItemView::SelectRows ); + _view->setSortingEnabled ( true ); + _view->setModel ( _sortModel ); - QHeaderView* horizontalHeader = _view->horizontalHeader (); - horizontalHeader->setStretchLastSection ( true ); + QHeaderView* horizontalHeader = _view->horizontalHeader(); + horizontalHeader->setDefaultAlignment ( Qt::AlignHCenter ); + horizontalHeader->setMinimumSectionSize( (Graphics::isHighDpi()) ? 300 : 150 ); + horizontalHeader->setResizeMode ( 0, QHeaderView::Interactive ); + horizontalHeader->setResizeMode ( 1, QHeaderView::Interactive ); + horizontalHeader->setResizeMode ( 2, QHeaderView::Interactive ); + horizontalHeader->setStretchLastSection( true ); - QHeaderView* verticalHeader = _view->verticalHeader (); - verticalHeader->setVisible ( false ); - verticalHeader->setDefaultSectionSize ( _rowHeight ); + QHeaderView* verticalHeader = _view->verticalHeader(); + verticalHeader->setVisible( false ); + verticalHeader->setDefaultSectionSize( _rowHeight ); // verticalHeader->setStyleSheet( "QHeaderView::section {" // "padding-bottom: 0px;" @@ -84,29 +89,29 @@ namespace Hurricane { // "}" // ); - _filterPatternLineEdit = new QLineEdit(this); - QLabel* filterPatternLabel = new QLabel(tr("&Filter pattern:"), this); - filterPatternLabel->setBuddy(_filterPatternLineEdit); + _filterPatternLineEdit = new QLineEdit( this ); + QLabel* filterPatternLabel = new QLabel( tr("&Filter pattern:"), this ); + filterPatternLabel->setBuddy( _filterPatternLineEdit ); QGridLayout* gLayout = new QGridLayout(); - gLayout->addWidget(_view , 1, 0, 1, 2); - gLayout->addWidget(filterPatternLabel , 2, 0); - gLayout->addWidget(_filterPatternLineEdit, 2, 1); + gLayout->addWidget( _view , 1, 0, 1, 2 ); + gLayout->addWidget( filterPatternLabel , 2, 0 ); + gLayout->addWidget( _filterPatternLineEdit, 2, 1 ); - setLayout ( gLayout ); + setLayout( gLayout ); - QAction* fitAction = new QAction ( tr("&Fit to Net"), this ); - fitAction->setShortcut ( QKeySequence(tr("CTRL+F")) ); - fitAction->setStatusTip ( tr("Fit the view to the Net's bounding box") ); - addAction ( fitAction ); + QAction* fitAction = new QAction( tr("&Fit to Net"), this ); + fitAction->setShortcut ( QKeySequence(tr("CTRL+F")) ); + fitAction->setStatusTip( tr("Fit the view to the Net's bounding box") ); + addAction( fitAction ); - connect ( _filterPatternLineEdit , SIGNAL(textChanged(const QString &)) - , this , SLOT (textFilterChanged()) ); - connect ( _view->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&,const QItemSelection&)) - , this , SLOT (updateSelecteds (const QItemSelection&,const QItemSelection&)) ); - connect ( fitAction , SIGNAL(triggered ()), this, SLOT(fitToNet ()) ); + connect( _filterPatternLineEdit , SIGNAL(textChanged(const QString &)) + , this , SLOT (textFilterChanged()) ); + connect( _view->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&,const QItemSelection&)) + , this , SLOT (updateSelecteds (const QItemSelection&,const QItemSelection&)) ); + connect( fitAction , SIGNAL(triggered ()), this, SLOT(fitToNet ()) ); - resize(300, 300); + resize( 300, 300 ); } diff --git a/hurricane/src/viewer/OpenBlobDialog.cpp b/hurricane/src/viewer/OpenBlobDialog.cpp new file mode 100644 index 00000000..3f7fdfbc --- /dev/null +++ b/hurricane/src/viewer/OpenBlobDialog.cpp @@ -0,0 +1,97 @@ +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC 2015-2016, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | H U R R I C A N E | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Module : "./OpenBlobDialog.cpp" | +// +-----------------------------------------------------------------+ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "hurricane/Warning.h" +#include "hurricane/viewer/Graphics.h" +#include "hurricane/viewer/OpenBlobDialog.h" + + +namespace Hurricane { + + using namespace std; + + +// ------------------------------------------------------------------- +// Class : "OpenBlobDialog". + + + OpenBlobDialog::OpenBlobDialog ( QWidget* parent ) + : QDialog (parent) + , _lineEdit(NULL) + { + setWindowTitle( tr("Open Design Blob") ); + + QLabel* label = new QLabel (); + label->setText( tr("Enter the Blob name (without extention \".blob.json.bz2\")") ); + label->setFont( Graphics::getNormalFont(true) ); + + _lineEdit = new QLineEdit (); + _lineEdit->setMinimumWidth( 400 ); + + QPushButton* okButton = new QPushButton (); + okButton->setText ( "OK" ); + okButton->setDefault( true ); + + QPushButton* cancelButton = new QPushButton (); + cancelButton->setText( "Cancel" ); + + QHBoxLayout* hLayout1 = new QHBoxLayout (); + hLayout1->addStretch(); + hLayout1->addWidget ( okButton ); + hLayout1->addStretch(); + hLayout1->addWidget ( cancelButton ); + hLayout1->addStretch(); + + QVBoxLayout* vLayout = new QVBoxLayout (); + vLayout->setSizeConstraint ( QLayout::SetFixedSize ); + vLayout->addWidget( label ); + vLayout->addWidget( _lineEdit ); + vLayout->addLayout( hLayout1 ); + + setLayout ( vLayout ); + + connect ( okButton, SIGNAL(clicked()), this, SLOT(accept()) ); + connect ( cancelButton, SIGNAL(clicked()), this, SLOT(reject()) ); + } + + + const QString OpenBlobDialog::getBlobName () const + { return _lineEdit->text(); } + + + bool OpenBlobDialog::runDialog ( QWidget* parent, QString& name ) + { + OpenBlobDialog* dialog = new OpenBlobDialog ( parent ); + bool dialogResult = (dialog->exec() == Accepted); + + name = dialog->getBlobName(); + + delete dialog; + + return dialogResult; + } + + +} // Hurricane namespace. diff --git a/hurricane/src/viewer/PaletteExtensionGoItem.cpp b/hurricane/src/viewer/PaletteExtensionGoItem.cpp index c5947c98..b1d69f04 100644 --- a/hurricane/src/viewer/PaletteExtensionGoItem.cpp +++ b/hurricane/src/viewer/PaletteExtensionGoItem.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | diff --git a/hurricane/src/viewer/PaletteItem.cpp b/hurricane/src/viewer/PaletteItem.cpp index 9282258e..03558291 100644 --- a/hurricane/src/viewer/PaletteItem.cpp +++ b/hurricane/src/viewer/PaletteItem.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | diff --git a/hurricane/src/viewer/PaletteLayerItem.cpp b/hurricane/src/viewer/PaletteLayerItem.cpp index 02ecc039..d5653b00 100644 --- a/hurricane/src/viewer/PaletteLayerItem.cpp +++ b/hurricane/src/viewer/PaletteLayerItem.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | diff --git a/hurricane/src/viewer/PaletteNamedItem.cpp b/hurricane/src/viewer/PaletteNamedItem.cpp index 7c2c6954..d7bde314 100644 --- a/hurricane/src/viewer/PaletteNamedItem.cpp +++ b/hurricane/src/viewer/PaletteNamedItem.cpp @@ -1,15 +1,9 @@ - // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | H U R R I C A N E | // | V L S I B a c k e n d D a t a - B a s e | // | | @@ -17,10 +11,7 @@ // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | // | C++ Module : "./PaletteNamedItem.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ #include diff --git a/hurricane/src/viewer/PaletteWidget.cpp b/hurricane/src/viewer/PaletteWidget.cpp index 7d2e5aa4..2091161f 100644 --- a/hurricane/src/viewer/PaletteWidget.cpp +++ b/hurricane/src/viewer/PaletteWidget.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | @@ -62,13 +62,16 @@ namespace { }; - GridBuffer::GridBuffer ( QGridLayout* grid, size_t maxRow, size_t startRow, size_t startColumn ) - : _grid (grid) - , _rowMax (maxRow) - , _row (startRow) - , _column (startColumn) - , _widgets() - , _aligns () + GridBuffer::GridBuffer ( QGridLayout* grid + , size_t maxRow + , size_t startRow + , size_t startColumn ) + : _grid (grid) + , _rowMax (maxRow) + , _row (startRow) + , _column (startColumn) + , _widgets () + , _aligns () { } @@ -123,6 +126,9 @@ namespace { namespace Hurricane { +// ------------------------------------------------------------------- +// Class : "PaletteWidget". + QWidget* PaletteWidget::_createGroupItem ( const Name& name ) { QLabel* groupLabel = new QLabel (); @@ -218,10 +224,12 @@ namespace Hurricane { vLayout->addWidget ( _scrollArea ); setLayout ( vLayout ); + + readGraphics (); } - void PaletteWidget::build () + void PaletteWidget::readGraphics () { GridBuffer gridBuffer ( _grid, _columnHeight ); @@ -299,19 +307,20 @@ namespace Hurricane { void PaletteWidget::updateExtensions ( Cell* cell ) { - _grid->removeWidget ( _extensionGroup ); - //_extensionGroup->deleteLater (); - delete _extensionGroup; - _extensionGroup = NULL; + if (_extensionGroup) { + _grid->removeWidget ( _extensionGroup ); + //_extensionGroup->deleteLater (); + delete _extensionGroup; + _extensionGroup = NULL; - PaletteItems::iterator iextension = _extensionGoItems.begin(); - for ( ; iextension != _extensionGoItems.end() ; ++iextension ) { - _grid->removeWidget ( iextension->second ); - //iextension->second->deleteLater (); - delete iextension->second; + PaletteItems::iterator iextension = _extensionGoItems.begin(); + for ( ; iextension != _extensionGoItems.end() ; ++iextension ) { + _grid->removeWidget ( iextension->second ); + //iextension->second->deleteLater (); + delete iextension->second; + } + _extensionGoItems.clear (); } - _extensionGoItems.clear (); - GridBuffer gridBuffer ( _grid, _columnHeight, _extensionRow, _extensionColumn ); _extensionGroup = _createGroupItem ( "Extensions" ); @@ -328,6 +337,28 @@ namespace Hurricane { } + void PaletteWidget::resetGraphics () + { + QLayoutItem* child = NULL; + while ( (child = _grid->takeAt(0)) != 0 ) { + _grid->removeWidget( child->widget() ); + delete child->widget(); + } + + _layerItems.clear(); + _extensionGroup = NULL; + _extensionGoItems.clear(); + + } + + + void PaletteWidget::rereadGraphics () + { + resetGraphics(); + readGraphics(); + } + + void PaletteWidget::_getSection ( const QString section, QLabel*& label, vector& items ) const { label = NULL; diff --git a/hurricane/src/viewer/PyCellViewer.cpp b/hurricane/src/viewer/PyCellViewer.cpp index a1ab06b0..407e929b 100644 --- a/hurricane/src/viewer/PyCellViewer.cpp +++ b/hurricane/src/viewer/PyCellViewer.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2010-2015, All Rights Reserved +// Copyright (c) UPMC 2010-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -42,7 +42,7 @@ extern "C" { static PyObject* PyCellViewer_hasMenu ( PyCellViewer* self, PyObject* args ) { - trace << "PyCellViewer_hasMenu()" << endl; + cdebug.log(20) << "PyCellViewer_hasMenu()" << endl; HTRY METHOD_HEAD("CellViewer.hasMenu()") @@ -62,7 +62,7 @@ extern "C" { static PyObject* PyCellViewer_hasMenuAction ( PyCellViewer* self, PyObject* args ) { - trace << "PyCellViewer_hasMenuAction()" << endl; + cdebug.log(20) << "PyCellViewer_hasMenuAction()" << endl; HTRY METHOD_HEAD("CellViewer.hasMenuAction()") @@ -82,7 +82,7 @@ extern "C" { static PyObject* PyCellViewer_addMenu ( PyCellViewer* self, PyObject* args ) { - trace << "PyCellViewer_addMenu()" << endl; + cdebug.log(20) << "PyCellViewer_addMenu()" << endl; HTRY METHOD_HEAD("CellViewer.addMenu()") @@ -104,7 +104,7 @@ extern "C" { static PyObject* PyCellViewer_addToMenu ( PyCellViewer* self, PyObject* args ) { - trace << "PyCellViewer_addToMenu()" << endl; + cdebug.log(20) << "PyCellViewer_addToMenu()" << endl; HTRY METHOD_HEAD("CellViewer.addToMenu()") @@ -131,7 +131,7 @@ extern "C" { static PyObject* PyCellViewer_getCell ( PyCellViewer* self ) { - trace << "PyCellViewer_getCell ()" << endl; + cdebug.log(20) << "PyCellViewer_getCell ()" << endl; Cell* cell = NULL; @@ -149,7 +149,7 @@ extern "C" { static PyObject* PyCellViewer_setCell ( PyCellViewer* self, PyObject* args ) { - trace << "PyCellViewer_setCell ()" << endl; + cdebug.log(20) << "PyCellViewer_setCell ()" << endl; HTRY METHOD_HEAD("CellViewer.setCell()") @@ -168,7 +168,7 @@ extern "C" { static PyObject* PyCellViewer_setApplicationName ( PyCellViewer* self, PyObject* args ) { - trace << "PyCellViewer_setApplicationName ()" << endl; + cdebug.log(20) << "PyCellViewer_setApplicationName ()" << endl; HTRY METHOD_HEAD("CellViewer.setApplicationName()") @@ -188,7 +188,7 @@ extern "C" { static PyObject* PyCellViewer_setLayerVisible ( PyCellViewer* self, PyObject* args ) { - trace << "PyCellViewer_setLayerVisible ()" << endl; + cdebug.log(20) << "PyCellViewer_setLayerVisible ()" << endl; HTRY METHOD_HEAD("CellViewer.setLayerVisible()") @@ -209,7 +209,7 @@ extern "C" { static PyObject* PyCellViewer_setAnonNetSelectable ( PyCellViewer* self, PyObject* args ) { - trace << "PyCellViewer_setAnonNetSelectable ()" << endl; + cdebug.log(20) << "PyCellViewer_setAnonNetSelectable ()" << endl; HTRY METHOD_HEAD("CellViewer.setAnonNetSelectable()") @@ -230,7 +230,7 @@ extern "C" { static PyObject* PyCellViewer_fit ( PyCellViewer* self ) { - trace << "PyCellViewer_fit()" << endl; + cdebug.log(20) << "PyCellViewer_fit()" << endl; HTRY METHOD_HEAD("CellViewer.fit()") @@ -243,7 +243,7 @@ extern "C" { static PyObject* PyCellViewer_refresh ( PyCellViewer* self ) { - trace << "PyCellViewer_refresh()" << endl; + cdebug.log(20) << "PyCellViewer_refresh()" << endl; HTRY METHOD_HEAD("CellViewer.refresh()") diff --git a/hurricane/src/viewer/PyDisplayStyle.cpp b/hurricane/src/viewer/PyDisplayStyle.cpp index 1fdcfdd6..d854c3ee 100644 --- a/hurricane/src/viewer/PyDisplayStyle.cpp +++ b/hurricane/src/viewer/PyDisplayStyle.cpp @@ -79,7 +79,7 @@ extern "C" { static PyObject* PyDisplayStyle_new ( PyTypeObject* type, PyObject* args, PyObject* kwds ) { - trace << "PyDisplayStyle_new()" << endl; + cdebug.log(20) << "PyDisplayStyle_new()" << endl; DisplayStyle* ds = NULL; PyDisplayStyle* pyDs = (PyDisplayStyle*)type->tp_alloc(type,0); @@ -103,7 +103,7 @@ extern "C" { PyObject* PyDisplayStyle_getDarkening ( PyDisplayStyle* self, PyObject* args ) { - trace << "PyDisplayStyle_getDarkening()" << endl; + cdebug.log(20) << "PyDisplayStyle_getDarkening()" << endl; DisplayStyle::HSVr* darkening = new DisplayStyle::HSVr(); @@ -118,7 +118,7 @@ extern "C" { PyObject* PyDisplayStyle_getGroup ( PyDisplayStyle* self, PyObject* args ) { - trace << "PyDisplayStyle_getGroup()" << endl; + cdebug.log(20) << "PyDisplayStyle_getGroup()" << endl; const char* group = NULL; @@ -139,7 +139,7 @@ extern "C" { PyObject* PyDisplayStyle_getPattern ( PyDisplayStyle* self, PyObject* args ) { - trace << "PyDisplayStyle_getPattern()" << endl; + cdebug.log(20) << "PyDisplayStyle_getPattern()" << endl; const char* pattern = NULL; @@ -160,7 +160,7 @@ extern "C" { PyObject* PyDisplayStyle_getThreshold ( PyDisplayStyle* self, PyObject* args ) { - trace << "PyDisplayStyle_getThreshold()" << endl; + cdebug.log(20) << "PyDisplayStyle_getThreshold()" << endl; float threshold = 0.0; @@ -181,7 +181,7 @@ extern "C" { PyObject* PyDisplayStyle_find ( PyDisplayStyle* self, PyObject* args ) { - trace << "PyDisplayStyle_find()" << endl; + cdebug.log(20) << "PyDisplayStyle_find()" << endl; DrawingStyle drawingStyle; @@ -202,7 +202,7 @@ extern "C" { PyObject* PyDisplayStyle_setDescription ( PyDisplayStyle* self, PyObject* args ) { - trace << "PyDisplayStyle_setDescription()" << endl; + cdebug.log(20) << "PyDisplayStyle_setDescription()" << endl; HTRY METHOD_HEAD("DisplayStyle.setDescription()") @@ -221,7 +221,7 @@ extern "C" { PyObject* PyDisplayStyle_setDarkening ( PyDisplayStyle* self, PyObject* args ) { - trace << "PyDisplayStyle_setDarkening()" << endl; + cdebug.log(20) << "PyDisplayStyle_setDarkening()" << endl; HTRY METHOD_HEAD("DisplayStyle.setDarkening()") @@ -240,7 +240,7 @@ extern "C" { PyObject* PyDisplayStyle_inheritFrom ( PyDisplayStyle* self, PyObject* args ) { - trace << "PyDisplayStyle_inheritFrom()" << endl; + cdebug.log(20) << "PyDisplayStyle_inheritFrom()" << endl; HTRY METHOD_HEAD("DisplayStyle.inheritFrom()") @@ -266,7 +266,7 @@ extern "C" { PyObject* PyDisplayStyle_addDrawingStyle ( PyDisplayStyle* self, PyObject* args, PyObject* kwArgs ) { - trace << "PyDisplayStyle_addDrawingStyle()" << endl; + cdebug.log(20) << "PyDisplayStyle_addDrawingStyle()" << endl; HTRY METHOD_HEAD("DisplayStyle.addDrawingStyle()") @@ -381,7 +381,7 @@ extern "C" { DirectHashMethod(PyDisplayStyle_Hash, PyDisplayStyle) extern void PyDisplayStyle_LinkPyType() { - trace << "PyDisplayStyle_LinkType()" << endl; + cdebug.log(20) << "PyDisplayStyle_LinkType()" << endl; PyTypeDisplayStyle.tp_new = PyDisplayStyle_new; PyTypeDisplayStyle.tp_dealloc = (destructor) PyDisplayStyle_DeAlloc; diff --git a/hurricane/src/viewer/PyDrawingGroup.cpp b/hurricane/src/viewer/PyDrawingGroup.cpp index 3904e092..fb999eea 100644 --- a/hurricane/src/viewer/PyDrawingGroup.cpp +++ b/hurricane/src/viewer/PyDrawingGroup.cpp @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2012-2015, All Rights Reserved +// Copyright (c) UPMC 2012-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -77,7 +77,7 @@ extern "C" { PyObject* PyDrawingGroup_find ( PyDrawingGroup* self, PyObject* args ) { - trace << "PyDrawingGroup_find()" << endl; + cdebug.log(20) << "PyDrawingGroup_find()" << endl; DrawingStyle drawingStyle; @@ -98,7 +98,7 @@ extern "C" { PyObject* PyDrawingGroup_addDrawingStyle ( PyDrawingGroup* self, PyObject* args, PyObject* kwArgs ) { - trace << "PyDrawingGroup_addDrawingStyle()" << endl; + cdebug.log(20) << "PyDrawingGroup_addDrawingStyle()" << endl; HTRY METHOD_HEAD("DrawingGroup.addDrawingStyle()") @@ -192,7 +192,7 @@ extern "C" { DirectHashMethod(PyDrawingGroup_Hash, PyDrawingGroup) extern void PyDrawingGroup_LinkPyType() { - trace << "PyDrawingGroup_LinkType()" << endl; + cdebug.log(20) << "PyDrawingGroup_LinkType()" << endl; PyTypeDrawingGroup.tp_dealloc = (destructor) PyDrawingGroup_DeAlloc; PyTypeDrawingGroup.tp_repr = (reprfunc) PyDrawingGroup_Repr; diff --git a/hurricane/src/viewer/PyDrawingStyle.cpp b/hurricane/src/viewer/PyDrawingStyle.cpp index 75ab58a8..a2cd7ad5 100644 --- a/hurricane/src/viewer/PyDrawingStyle.cpp +++ b/hurricane/src/viewer/PyDrawingStyle.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2012-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2012-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -57,7 +57,7 @@ extern "C" { PyObject* PyRawDrawingStyle_getPattern ( PyRawDrawingStyle* self, PyObject* args ) { - trace << "PyDrawingStyle_getPattern()" << endl; + cdebug.log(20) << "PyDrawingStyle_getPattern()" << endl; const char* pattern = NULL; @@ -72,7 +72,7 @@ extern "C" { PyObject* PyRawDrawingStyle_getThreshold ( PyRawDrawingStyle* self, PyObject* args ) { - trace << "PyRawDrawingStyle_getThreshold()" << endl; + cdebug.log(20) << "PyRawDrawingStyle_getThreshold()" << endl; float threshold = 0.0; diff --git a/hurricane/src/viewer/PyGraphics.cpp b/hurricane/src/viewer/PyGraphics.cpp index 02583bbd..091e379a 100644 --- a/hurricane/src/viewer/PyGraphics.cpp +++ b/hurricane/src/viewer/PyGraphics.cpp @@ -50,7 +50,7 @@ extern "C" { static PyObject* PyGraphics_get ( PyObject* ) { - trace << "PyGraphics_get()" << endl; + cdebug.log(20) << "PyGraphics_get()" << endl; Graphics* graphics = NULL; PyGraphics* pyGraphics = NULL; @@ -70,7 +70,7 @@ extern "C" { static PyObject* PyGraphics_setStyle ( PyObject*, PyObject* args ) { - trace << "PyGraphics_setStyle()" << endl; + cdebug.log(20) << "PyGraphics_setStyle()" << endl; HTRY Graphics* graphics = Graphics::getGraphics (); @@ -90,7 +90,7 @@ extern "C" { PyObject* PyGraphics_getPattern ( PyGraphics* , PyObject* args ) { - trace << "PyGraphics_getPattern()" << endl; + cdebug.log(20) << "PyGraphics_getPattern()" << endl; const char* pattern = NULL; @@ -111,7 +111,7 @@ extern "C" { PyObject* PyGraphics_getStyle ( PyGraphics* , PyObject* args ) { - trace << "PyGraphics_getStyle()" << endl; + cdebug.log(20) << "PyGraphics_getStyle()" << endl; DisplayStyle* style = NULL; @@ -133,7 +133,7 @@ extern "C" { PyObject* PyGraphics_getGroup ( PyGraphics* , PyObject* args ) { - trace << "PyGraphics_getGroup()" << endl; + cdebug.log(20) << "PyGraphics_getGroup()" << endl; const char* group = "NoGroup"; @@ -154,7 +154,7 @@ extern "C" { PyObject* PyGraphics_getThreshold ( PyGraphics* , PyObject* args ) { - trace << "PyGraphics_getThreshold()" << endl; + cdebug.log(20) << "PyGraphics_getThreshold()" << endl; float threshold = 0.0; @@ -175,7 +175,7 @@ extern "C" { PyObject* PyGraphics_getDarkening ( PyGraphics* , PyObject* args ) { - trace << "PyGraphics_getDarkening()" << endl; + cdebug.log(20) << "PyGraphics_getDarkening()" << endl; DisplayStyle::HSVr* darkening = new DisplayStyle::HSVr(); @@ -190,7 +190,7 @@ extern "C" { PyObject* PyGraphics_toHtml ( PyGraphics* , PyObject* args ) { - trace << "PyGraphics_toHtml()" << endl; + cdebug.log(20) << "PyGraphics_toHtml()" << endl; string htmlText = ""; @@ -211,7 +211,7 @@ extern "C" { PyObject* PyGraphics_breakpointStopCb ( PyGraphics* , PyObject* args ) { - trace << "PyGraphics_breakpointStopCb()" << endl; + cdebug.log(20) << "PyGraphics_breakpointStopCb()" << endl; bool rvalue = false; @@ -233,7 +233,7 @@ extern "C" { static PyObject* PyGraphics_addStyle ( PyObject*, PyObject* args ) { - trace << "PyGraphics_addStyle()" << endl; + cdebug.log(20) << "PyGraphics_addStyle()" << endl; HTRY Graphics* graphics = Graphics::getGraphics (); @@ -252,7 +252,7 @@ extern "C" { static PyObject* PyGraphics_enable ( PyObject*, PyObject* args ) { - trace << "PyGraphics_enable()" << endl; + cdebug.log(20) << "PyGraphics_enable()" << endl; HTRY Graphics::getGraphics()->enable(); @@ -268,7 +268,7 @@ extern "C" { static PyObject* PyGraphics_getStyles ( PyObject* ) { - trace << "PyGraphics_getStyles()" << endl; + cdebug.log(20) << "PyGraphics_getStyles()" << endl; PyDisplayStyleVector* pyVector = NULL; diff --git a/hurricane/src/viewer/PyHApplication.cpp b/hurricane/src/viewer/PyHApplication.cpp index f60b0ee4..99c47dda 100644 --- a/hurricane/src/viewer/PyHApplication.cpp +++ b/hurricane/src/viewer/PyHApplication.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2012-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2012-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -57,7 +57,7 @@ extern "C" { static char** argv = NULL; vector vargv; - trace << "PyHApplication_create()" << endl; + cdebug.log(20) << "PyHApplication_create()" << endl; HApplication* ha = NULL; PyHApplication* pyHApplication = NULL; @@ -116,7 +116,7 @@ extern "C" { static PyObject* PyHApplication_qtExec ( PyHApplication* self, PyObject* args ) { - trace << "PyHApplication_qtExec()" << endl; + cdebug.log(20) << "PyHApplication_qtExec()" << endl; int returnCode = 0; diff --git a/hurricane/src/viewer/PyHSVr.cpp b/hurricane/src/viewer/PyHSVr.cpp index ccb65e0e..8e3036b3 100644 --- a/hurricane/src/viewer/PyHSVr.cpp +++ b/hurricane/src/viewer/PyHSVr.cpp @@ -51,7 +51,7 @@ extern "C" { static PyObject* PyHSVr_new ( PyTypeObject* type, PyObject* args, PyObject* kwds ) { - trace << "PyHSVr_new()" << endl; + cdebug.log(20) << "PyHSVr_new()" << endl; DisplayStyle::HSVr* hsvr = NULL; PyHSVr* pyHSVr = (PyHSVr*)type->tp_alloc(type,0); @@ -95,9 +95,9 @@ extern "C" { DirectGetDoubleAttribute(PyHSVr_GetHue ,getHue ,PyHSVr,DisplayStyle::HSVr) DirectGetDoubleAttribute(PyHSVr_GetSaturation,getSaturation,PyHSVr,DisplayStyle::HSVr) DirectGetDoubleAttribute(PyHSVr_GetValue ,getValue ,PyHSVr,DisplayStyle::HSVr) - DirectSetDoubleAttribute(PyHSVr_SetHue ,setHue ,"HSVr.setHue" ,PyHSVr,DisplayStyle::HSVr) - DirectSetDoubleAttribute(PyHSVr_SetSaturation,setSaturation,"HSVr.setSaturation",PyHSVr,DisplayStyle::HSVr) - DirectSetDoubleAttribute(PyHSVr_SetValue ,setValue ,"HSVr.setValue" ,PyHSVr,DisplayStyle::HSVr) + DirectSetDoubleAttribute(PyHSVr_SetHue ,setHue ,PyHSVr,DisplayStyle::HSVr) + DirectSetDoubleAttribute(PyHSVr_SetSaturation,setSaturation,PyHSVr,DisplayStyle::HSVr) + DirectSetDoubleAttribute(PyHSVr_SetValue ,setValue ,PyHSVr,DisplayStyle::HSVr) // Standart Predicates (Attributes). DirectGetBoolAttribute(PyHSVr_IsId,isId,PyHSVr,DisplayStyle::HSVr) @@ -119,7 +119,7 @@ extern "C" { DirectHashMethod(PyHSVr_Hash, PyHSVr) extern void PyHSVr_LinkPyType() { - trace << "PyHSVr_LinkType()" << endl; + cdebug.log(20) << "PyHSVr_LinkType()" << endl; PyTypeHSVr.tp_new = PyHSVr_new; PyTypeHSVr.tp_dealloc = (destructor) PyHSVr_DeAlloc; diff --git a/hurricane/src/viewer/PyViewer.cpp b/hurricane/src/viewer/PyViewer.cpp index c3b62e7d..6c8ff810 100644 --- a/hurricane/src/viewer/PyViewer.cpp +++ b/hurricane/src/viewer/PyViewer.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2010-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2010-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -62,7 +62,7 @@ extern "C" { // Module Initialization : "initViewer ()" DL_EXPORT(void) initViewer () { - trace << "initViewer()" << endl; + cdebug.log(20) << "initViewer()" << endl; PyHSVr_LinkPyType (); PyRawDrawingStyle_LinkPyType (); @@ -114,7 +114,7 @@ extern "C" { PyDisplayStyle_postModuleInit(); PyCellViewer_postModuleInit(); - trace << "Viewer.so loaded " << (void*)&typeid(string) << endl; + cdebug.log(20) << "Viewer.so loaded " << (void*)&typeid(string) << endl; } diff --git a/hurricane/src/viewer/RecordModel.cpp b/hurricane/src/viewer/RecordModel.cpp index 75505b52..9c20b394 100644 --- a/hurricane/src/viewer/RecordModel.cpp +++ b/hurricane/src/viewer/RecordModel.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | @@ -112,7 +112,6 @@ namespace Hurricane { } if ( role == Qt::FontRole ) { - //if ( index.row() == 0 ) return QVariant(); switch (index.column()) { case 0: return nameFont; case 1: return valueFont; diff --git a/hurricane/src/viewer/Ruler.cpp b/hurricane/src/viewer/Ruler.cpp index 10d323d1..27c96ad1 100644 --- a/hurricane/src/viewer/Ruler.cpp +++ b/hurricane/src/viewer/Ruler.cpp @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // =================================================================== // diff --git a/hurricane/src/viewer/RulerCommand.cpp b/hurricane/src/viewer/RulerCommand.cpp index 60c799c9..faf53709 100644 --- a/hurricane/src/viewer/RulerCommand.cpp +++ b/hurricane/src/viewer/RulerCommand.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | diff --git a/hurricane/src/viewer/Script.cpp b/hurricane/src/viewer/Script.cpp index 9f9038f5..460b0b69 100644 --- a/hurricane/src/viewer/Script.cpp +++ b/hurricane/src/viewer/Script.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/hurricane/src/viewer/ScriptWidget.cpp b/hurricane/src/viewer/ScriptWidget.cpp index 116c9cc1..f916611a 100644 --- a/hurricane/src/viewer/ScriptWidget.cpp +++ b/hurricane/src/viewer/ScriptWidget.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -91,11 +91,19 @@ namespace Hurricane { } - void ScriptWidget::runScript ( QWidget* parent, Cell* cell ) + void ScriptWidget::setScriptName ( QString scriptName ) + { + return _lineEdit->setText( scriptName ); + } + + + void ScriptWidget::runScript ( QWidget* parent, QString& scriptName, Cell* cell ) { ScriptWidget* dialog = new ScriptWidget ( parent ); - bool doRunScript = (dialog->exec() == Accepted); - QString scriptName = dialog->getScriptName (); + dialog->setScriptName( scriptName ); + + bool doRunScript = (dialog->exec() == Accepted); + scriptName = dialog->getScriptName (); delete dialog; if (not doRunScript) return; diff --git a/hurricane/src/viewer/SelectCommand.cpp b/hurricane/src/viewer/SelectCommand.cpp index a2399eb6..e8c28d9e 100644 --- a/hurricane/src/viewer/SelectCommand.cpp +++ b/hurricane/src/viewer/SelectCommand.cpp @@ -1,26 +1,17 @@ - // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | H U R R I C A N E | // | V L S I B a c k e n d D a t a - B a s e | // | | // | Author : Jean-Paul CHAPUT | -// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Module : "./SelectCommand.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ #include @@ -139,7 +130,7 @@ namespace Hurricane { void Occurrences_GetNets::Locator::progress () { - ltrace(80) << "Occurrences_GetNets::Locator::progress()" << endl; + cdebug.log(18) << "Occurrences_GetNets::Locator::progress()" << endl; //boost::regex pattern ( "onymous" ); //boost::smatch match; diff --git a/hurricane/src/viewer/SelectionModel.cpp b/hurricane/src/viewer/SelectionModel.cpp index ff2302b4..1adb9a09 100644 --- a/hurricane/src/viewer/SelectionModel.cpp +++ b/hurricane/src/viewer/SelectionModel.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | @@ -176,7 +176,6 @@ namespace Hurricane { if ( !index.isValid() ) return QVariant (); if ( role == Qt::SizeHintRole ) { - if ( index.row() == 0 ) return QVariant(); switch (index.column()) { case 0: return 200; default: diff --git a/hurricane/src/viewer/SelectionPopup.cpp b/hurricane/src/viewer/SelectionPopup.cpp index 92488e14..7ff95319 100644 --- a/hurricane/src/viewer/SelectionPopup.cpp +++ b/hurricane/src/viewer/SelectionPopup.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | diff --git a/hurricane/src/viewer/SelectionPopupModel.cpp b/hurricane/src/viewer/SelectionPopupModel.cpp index d9effafa..e6fc70fc 100644 --- a/hurricane/src/viewer/SelectionPopupModel.cpp +++ b/hurricane/src/viewer/SelectionPopupModel.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | @@ -117,7 +117,6 @@ namespace Hurricane { } if ( role == Qt::FontRole ) { - if ( index.row() == 0 ) return QVariant(); switch (index.column()) { default: return entityFont; } diff --git a/hurricane/src/viewer/SelectionWidget.cpp b/hurricane/src/viewer/SelectionWidget.cpp index 5f06687c..9d8891d1 100644 --- a/hurricane/src/viewer/SelectionWidget.cpp +++ b/hurricane/src/viewer/SelectionWidget.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | diff --git a/hurricane/src/viewer/Selector.cpp b/hurricane/src/viewer/Selector.cpp index 3239e1f5..12880122 100644 --- a/hurricane/src/viewer/Selector.cpp +++ b/hurricane/src/viewer/Selector.cpp @@ -3,7 +3,7 @@ // -*- C++ -*- // // This file is part of the Hurricane Software. -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // =================================================================== // diff --git a/hurricane/src/viewer/SelectorCriterion.cpp b/hurricane/src/viewer/SelectorCriterion.cpp index d99872b2..f98b0453 100644 --- a/hurricane/src/viewer/SelectorCriterion.cpp +++ b/hurricane/src/viewer/SelectorCriterion.cpp @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // =================================================================== // diff --git a/hurricane/src/viewer/ZoomCommand.cpp b/hurricane/src/viewer/ZoomCommand.cpp index ff966c23..3257096d 100644 --- a/hurricane/src/viewer/ZoomCommand.cpp +++ b/hurricane/src/viewer/ZoomCommand.cpp @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | diff --git a/hurricane/src/viewer/hurricane/viewer/AreaCommand.h b/hurricane/src/viewer/hurricane/viewer/AreaCommand.h index df372709..9a0ac4b7 100644 --- a/hurricane/src/viewer/hurricane/viewer/AreaCommand.h +++ b/hurricane/src/viewer/hurricane/viewer/AreaCommand.h @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // =================================================================== // diff --git a/hurricane/src/viewer/hurricane/viewer/BreakpointWidget.h b/hurricane/src/viewer/hurricane/viewer/BreakpointWidget.h index 006d6d4a..e2ca33a8 100644 --- a/hurricane/src/viewer/hurricane/viewer/BreakpointWidget.h +++ b/hurricane/src/viewer/hurricane/viewer/BreakpointWidget.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/hurricane/src/viewer/hurricane/viewer/CellViewer.h b/hurricane/src/viewer/hurricane/viewer/CellViewer.h index 15705490..ec067f3c 100644 --- a/hurricane/src/viewer/hurricane/viewer/CellViewer.h +++ b/hurricane/src/viewer/hurricane/viewer/CellViewer.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | @@ -135,7 +135,10 @@ namespace Hurricane { void changeSelectionMode (); void setShowSelection ( bool ); void setState ( shared_ptr& ); + void removeHistory ( Cell* ); void openHistoryCell (); + void openDesignBlob (); + void saveDesignBlob (); void printDisplay (); void print ( QPrinter* ); void imageDisplay (); @@ -148,6 +151,7 @@ namespace Hurricane { inline void emitCellPreModificated (); inline void emitCellPostModificated (); signals: + void cellLoadedFromDisk ( Cell* ); void showSelectionToggled ( bool ); void stateChanged ( shared_ptr& ); void redrawCellWidget (); @@ -157,6 +161,7 @@ namespace Hurricane { void createMenus (); void refreshTitle (); void refreshHistory (); + void rebuildHistory (); private: QString _getAbsWidgetPath ( const QString& relPath ) const; QMenu* _getParentMenu ( const QString& ) const; @@ -188,7 +193,7 @@ namespace Hurricane { bool _toolInterrupt; unsigned int _flags; UpdateState _updateState; - + QString _pyScriptName; }; diff --git a/hurricane/src/viewer/hurricane/viewer/CellWidget.h b/hurricane/src/viewer/hurricane/viewer/CellWidget.h index 2be1da63..4e9e92f9 100644 --- a/hurricane/src/viewer/hurricane/viewer/CellWidget.h +++ b/hurricane/src/viewer/hurricane/viewer/CellWidget.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -97,15 +97,18 @@ namespace Hurricane { typedef void ( InitExtensionGo_t )( CellWidget* ); typedef boost::function< void(QPainter&) > PainterCb_t; enum RubberShape { Centric=1, Barycentric, Steiner }; - enum TextFlag { Bold =0x001 - , BigFont =0x002 - , Reverse =0x004 - , Frame =0x008 - , Rounded =0x010 - , Center =0x020 - , Left =0x040 - , Right =0x080 - , Top =0x100 + enum TextFlag { Bold =0x0001 + , BigFont =0x0002 + , Reverse =0x0004 + , Frame =0x0008 + , Rounded =0x0010 + , Center =0x0020 + , Left =0x0040 + , Right =0x0080 + , Top =0x0100 + }; + enum Flag { NoFlags =0x0000 + , NoResetCommands=0x0001 }; public: enum ResolutionMode { Res_CellMode=1, Res_DesignMode=2 }; @@ -115,8 +118,10 @@ namespace Hurricane { virtual ~CellWidget (); // Accessors. // MapView* getMapView () { return _mapView; }; - void setCell ( Cell* ); + void setCell ( Cell*, Path topPath=Path(), unsigned int flags=NoFlags ); inline Cell* getCell () const; + inline Cell* getTopCell () const; + inline Path getTopPath () const; inline shared_ptr& getState (); inline shared_ptr getStateClone (); inline PaletteWidget* getPalette (); @@ -132,6 +137,7 @@ namespace Hurricane { void detachFromPalette (); void bindCommand ( Command* ); void unbindCommand ( Command* ); + void resetCommands (); inline void setActiveCommand ( Command* ); inline Command* getActiveCommand () const; Command* getCommand ( const std::string& ) const; @@ -245,7 +251,8 @@ namespace Hurricane { virtual void paintEvent ( QPaintEvent* ); public slots: // Qt QWidget Slots Overload & CellWidget Specifics. - void setState ( shared_ptr& ); + void setState ( shared_ptr& + , unsigned int flags=NoFlags ); inline void openRefreshSession (); inline void closeRefreshSession (); inline DrawingPlanes& getDrawingPlanes (); @@ -534,9 +541,10 @@ namespace Hurricane { public: class State { public: - inline State ( Cell* cell=NULL ); + inline State ( Cell* cell=NULL, Path topPath=Path() ); State* clone () const; inline void setCell ( Cell* ); + inline void setTopPath ( Path ); inline void setCellWidget ( CellWidget* ); inline void setCursorStep ( DbU::Unit ); inline DbU::Unit getCursorStep () const; @@ -557,6 +565,8 @@ namespace Hurricane { bool scaleHistoryUp (); bool scaleHistoryDown (); inline Cell* getCell () const; + inline Cell* getTopCell () const; + inline Path getTopPath () const; const Name& getName () const; inline SelectorCriterions& getSelection (); inline RulerSet& getRulers (); @@ -590,6 +600,7 @@ namespace Hurricane { private: Cell* _cell; + Path _topPath; CellWidget* _cellWidget; SelectorCriterions _selection; RulerSet _rulers; @@ -879,8 +890,9 @@ namespace Hurricane { { } - inline CellWidget::State::State ( Cell* cell ) + inline CellWidget::State::State ( Cell* cell, Path topPath ) : _cell (cell) + , _topPath (topPath) , _cellWidget (NULL) , _selection () , _rulers () @@ -922,6 +934,10 @@ namespace Hurricane { { _cell = cell; } + inline void CellWidget::State::setTopPath ( Path topPath ) + { _topPath = topPath; } + + inline void CellWidget::State::setCellWidget ( CellWidget* cw ) { _cellWidget = cw; @@ -1002,6 +1018,14 @@ namespace Hurricane { { return _cell; } + inline Path CellWidget::State::getTopPath () const + { return _topPath; } + + + inline Cell* CellWidget::State::getTopCell () const + { return (_topPath.isEmpty()) ? _cell : _topPath.getOwnerCell(); } + + inline DbU::Unit CellWidget::State::cursorStep () const { return _cursorStep; } @@ -1255,6 +1279,14 @@ namespace Hurricane { { return _state->getCell(); } + inline Cell* CellWidget::getTopCell () const + { return _state->getTopCell(); } + + + inline Path CellWidget::getTopPath () const + { return _state->getTopPath(); } + + inline PaletteWidget* CellWidget::getPalette () { return _palette; } diff --git a/hurricane/src/viewer/hurricane/viewer/ColorScale.h b/hurricane/src/viewer/hurricane/viewer/ColorScale.h index e6e417d0..af443622 100644 --- a/hurricane/src/viewer/hurricane/viewer/ColorScale.h +++ b/hurricane/src/viewer/hurricane/viewer/ColorScale.h @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // =================================================================== // diff --git a/hurricane/src/viewer/hurricane/viewer/Command.h b/hurricane/src/viewer/hurricane/viewer/Command.h index eef67714..f81e39df 100644 --- a/hurricane/src/viewer/hurricane/viewer/Command.h +++ b/hurricane/src/viewer/hurricane/viewer/Command.h @@ -1,27 +1,24 @@ - // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2012, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | // | V L S I B a c k e n d D a t a - B a s e | // | | // | Author : Jean-Paul CHAPUT | -// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Header : "./hurricane/viewer/Command.h" | // +-----------------------------------------------------------------+ -#ifndef __HURRICANE_COMMAND_H__ -#define __HURRICANE_COMMAND_H__ - - -#include -#include +#ifndef HURRICANE_COMMAND_H +#define HURRICANE_COMMAND_H +#include +#include class QKeyEvent; class QMouseEvent; @@ -54,6 +51,7 @@ namespace Hurricane { virtual void mousePressEvent ( QMouseEvent* ); virtual void mouseReleaseEvent ( QMouseEvent* ); virtual void draw (); + virtual void reset (); private: Command ( const Command& ); Command& operator= ( const Command& ); diff --git a/hurricane/src/viewer/hurricane/viewer/ControllerWidget.h b/hurricane/src/viewer/hurricane/viewer/ControllerWidget.h index be9f7873..c611055d 100644 --- a/hurricane/src/viewer/hurricane/viewer/ControllerWidget.h +++ b/hurricane/src/viewer/hurricane/viewer/ControllerWidget.h @@ -1,15 +1,14 @@ - // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | // | V L S I B a c k e n d D a t a - B a s e | // | | // | Author : Jean-Paul CHAPUT | -// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Header : "./hurricane/viewer/ControllerWidget.h" | // +-----------------------------------------------------------------+ @@ -19,7 +18,7 @@ #define HURRICANE_CONTROLLER_WIDGET_H -#include +#include class QCheckBox; class QComboBox; @@ -27,7 +26,8 @@ namespace Cfg { class ConfigurationWidget; } -#include "hurricane/Occurrence.h" +#include "hurricane/Observer.h" +#include "hurricane/Occurrence.h" namespace Hurricane { @@ -42,6 +42,7 @@ namespace Hurricane { class GraphicsWidget; class DisplayFilterWidget; class NetlistWidget; + class HierarchyWidget; class SelectionWidget; class InspectorWidget; @@ -62,6 +63,7 @@ namespace Hurricane { virtual void updateTab (); virtual void cellPreModificate (); virtual void cellPostModificate (); + virtual void graphicsUpdated (); protected: CellWidget* _cellWidget; @@ -79,10 +81,11 @@ namespace Hurricane { Q_OBJECT; public: - TabGraphics ( QWidget* parent=NULL ); - inline GraphicsWidget* getGraphics (); + TabGraphics ( QWidget* parent=NULL ); + inline GraphicsWidget* getGraphics (); public slots: - void setCellWidget ( CellWidget* ); + void setCellWidget ( CellWidget* ); + virtual void graphicsUpdated (); protected: GraphicsWidget* _graphics; @@ -121,10 +124,11 @@ namespace Hurricane { Q_OBJECT; public: - TabPalette ( QWidget* parent=NULL ); - inline PaletteWidget* getPalette (); + TabPalette ( QWidget* parent=NULL ); + inline PaletteWidget* getPalette (); public slots: - virtual void setCellWidget ( CellWidget* ); + virtual void setCellWidget ( CellWidget* ); + virtual void graphicsUpdated (); protected: PaletteWidget* _palette; @@ -167,6 +171,30 @@ namespace Hurricane { inline QCheckBox* TabNetlist::getSyncSelection () { return _syncSelection; } +// ------------------------------------------------------------------- +// Class : "Hurricane::TabHierarchy". + + + class TabHierarchy : public ControllerTab { + Q_OBJECT; + + public: + TabHierarchy ( QWidget* parent=NULL ); + inline HierarchyWidget* getHierarchyBrowser (); + virtual void cellPreModificate (); + virtual void cellPostModificate (); + public slots: + virtual void setCell ( Cell* ); + virtual void setCellWidget ( CellWidget* ); + + protected: + HierarchyWidget* _hierarchyBrowser; + }; + + + inline HierarchyWidget* TabHierarchy::getHierarchyBrowser () { return _hierarchyBrowser; } + + // ------------------------------------------------------------------- // Class : "Hurricane::TabSelection". @@ -231,13 +259,15 @@ namespace Hurricane { class TabSettings : public ControllerTab { Q_OBJECT; public: - TabSettings ( QWidget* parent=NULL ); - inline ConfigurationWidget* getSettings (); + TabSettings ( QWidget* parent=NULL ); + inline ConfigurationWidget* getSettings (); public slots: - void setCellWidget ( CellWidget* ); + void setCellWidget ( CellWidget* ); + protected: + virtual void showEvent ( QShowEvent* ); private: + size_t _timestamp; ConfigurationWidget* _configuration; - }; @@ -266,47 +296,66 @@ namespace Hurricane { class ControllerWidget : public QTabWidget { Q_OBJECT; + + public: + class GraphicsObserver : public Observer { + public: + inline GraphicsObserver ( ControllerWidget* ); + virtual void notify ( unsigned int flags ); + private: + GraphicsObserver ( const GraphicsObserver& ); + }; public: - ControllerWidget ( QWidget* parent=NULL ); - inline CellWidget* getCellWidget (); - inline GraphicsWidget* getGraphics (); - inline PaletteWidget* getPalette (); - inline DisplayFilterWidget* getDisplayFilter (); - inline NetlistWidget* getNetlistBrowser (); - inline SelectionWidget* getSelection (); - inline InspectorWidget* getInspectorWidget (); - inline TabSettings* getSettings (); - void setCellWidget ( CellWidget* ); - //inline int addSetting ( QWidget* page, const QString& label ); - public slots: - void cellPreModificate (); - void cellPostModificate (); - void cellChanged ( Cell* ); - void updateTab ( int index ); - void toggleShow (); + ControllerWidget ( QWidget* parent=NULL ); + inline CellWidget* getCellWidget (); + inline GraphicsWidget* getGraphics (); + inline PaletteWidget* getPalette (); + inline DisplayFilterWidget* getDisplayFilter (); + inline NetlistWidget* getNetlistBrowser (); + inline HierarchyWidget* getHierarchyBrowser (); + inline SelectionWidget* getSelection (); + inline InspectorWidget* getInspectorWidget (); + inline TabSettings* getSettings (); + void setCellWidget ( CellWidget* ); + //inline int addSetting ( QWidget* page, const QString& label ); + public slots: + void graphicsUpdated (); + void cellPreModificate (); + void cellPostModificate (); + void cellChanged ( Cell* ); + void updateTab ( int index ); + void toggleShow (); protected: + GraphicsObserver _observer; CellWidget* _cellWidget; TabGraphics* _tabGraphics; TabPalette* _tabPalette; TabDisplayFilter* _tabDisplayFilter; TabNetlist* _tabNetlist; + TabHierarchy* _tabHierarchy; TabSelection* _tabSelection; TabInspector* _tabInspector; TabSettings* _tabSettings; }; - inline CellWidget* ControllerWidget::getCellWidget () { return _cellWidget; } - inline GraphicsWidget* ControllerWidget::getGraphics () { return _tabGraphics->getGraphics(); } - inline PaletteWidget* ControllerWidget::getPalette () { return _tabPalette->getPalette(); } - inline DisplayFilterWidget* ControllerWidget::getDisplayFilter () { return _tabDisplayFilter->getDisplayFilter(); } - inline NetlistWidget* ControllerWidget::getNetlistBrowser () { return _tabNetlist->getNetlistBrowser(); } - inline SelectionWidget* ControllerWidget::getSelection () { return _tabSelection->getSelection(); } - inline InspectorWidget* ControllerWidget::getInspectorWidget () { return _tabInspector->getInspectorWidget(); } - inline TabSettings* ControllerWidget::getSettings () { return _tabSettings; } -//inline int ControllerWidget::addSetting ( QWidget* page, const QString& label ) { return _tabSettings->addSetting(page,label); } + inline CellWidget* ControllerWidget::getCellWidget () { return _cellWidget; } + inline GraphicsWidget* ControllerWidget::getGraphics () { return _tabGraphics->getGraphics(); } + inline PaletteWidget* ControllerWidget::getPalette () { return _tabPalette->getPalette(); } + inline DisplayFilterWidget* ControllerWidget::getDisplayFilter () { return _tabDisplayFilter->getDisplayFilter(); } + inline NetlistWidget* ControllerWidget::getNetlistBrowser () { return _tabNetlist->getNetlistBrowser(); } + inline HierarchyWidget* ControllerWidget::getHierarchyBrowser () { return _tabHierarchy->getHierarchyBrowser(); } + inline SelectionWidget* ControllerWidget::getSelection () { return _tabSelection->getSelection(); } + inline InspectorWidget* ControllerWidget::getInspectorWidget () { return _tabInspector->getInspectorWidget(); } + inline TabSettings* ControllerWidget::getSettings () { return _tabSettings; } +//inline int ControllerWidget::addSetting ( QWidget* page, const QString& label ) { return _tabSettings->addSetting(page,label); } + + + inline ControllerWidget::GraphicsObserver::GraphicsObserver ( ControllerWidget* owner ) + : Observer(owner) + { } } // End of Hurricane namespace. diff --git a/hurricane/src/viewer/hurricane/viewer/DesignBlob.h b/hurricane/src/viewer/hurricane/viewer/DesignBlob.h new file mode 100644 index 00000000..bc90a400 --- /dev/null +++ b/hurricane/src/viewer/hurricane/viewer/DesignBlob.h @@ -0,0 +1,62 @@ +// -*- mode: C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC 2016-2016, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./hurricane/DesignBlob.h" | +// +-----------------------------------------------------------------+ + + +#ifndef HURRICANE_DESIGN_BLOB_H +#define HURRICANE_DESIGN_BLOB_H + +#include "hurricane/Commons.h" + + +namespace Hurricane { + + class Cell; + +// ------------------------------------------------------------------- +// Classes : "DesignBlob". + + class DesignBlob { + public: + inline DesignBlob ( Cell* ); + inline Cell* getTopCell () const; + void toJson ( JsonWriter* ) const; + static DesignBlob* fromJson ( const std::string& filename ); + inline std::string _getTypeName () const; + private: + Cell* _topCell; + }; + + + inline DesignBlob::DesignBlob ( Cell* topCell ) : _topCell(topCell) { } + inline Cell* DesignBlob::getTopCell () const { return _topCell; } + inline std::string DesignBlob::_getTypeName () const { return "DesignBlob"; } + + +// ------------------------------------------------------------------- +// Class : "Hurricane::JsonDesignBlob". + + class JsonDesignBlob : public JsonObject { + public: + static void initialize (); + JsonDesignBlob ( unsigned long flags ); + virtual std::string getTypeName () const; + virtual JsonDesignBlob* clone ( unsigned long ) const; + virtual void toData ( JsonStack& ); +}; + + +} // Hurricane namespace. + +#endif diff --git a/hurricane/src/viewer/hurricane/viewer/DisplayFilterWidget.h b/hurricane/src/viewer/hurricane/viewer/DisplayFilterWidget.h index 025a2f1c..301505ef 100644 --- a/hurricane/src/viewer/hurricane/viewer/DisplayFilterWidget.h +++ b/hurricane/src/viewer/hurricane/viewer/DisplayFilterWidget.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | diff --git a/hurricane/src/viewer/hurricane/viewer/DisplayStyle.h b/hurricane/src/viewer/hurricane/viewer/DisplayStyle.h index b838d7e8..766c6735 100644 --- a/hurricane/src/viewer/hurricane/viewer/DisplayStyle.h +++ b/hurricane/src/viewer/hurricane/viewer/DisplayStyle.h @@ -1,8 +1,7 @@ - // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2012, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | @@ -15,9 +14,8 @@ // +-----------------------------------------------------------------+ -#ifndef __HURRICANE_DISPLAYSTYLE_H__ -#define __HURRICANE_DISPLAYSTYLE_H__ - +#ifndef HURRICANE_DISPLAYSTYLE_H +#define HURRICANE_DISPLAYSTYLE_H #include #include @@ -36,10 +34,13 @@ namespace Hurricane { typedef std::vector DrawingStyles; +// ------------------------------------------------------------------- +// Class : "DrawingGroup". + class DrawingGroup { public: // Constructors & Destructors. - DrawingGroup ( const Name& name ); + DrawingGroup ( const Name& name ); ~DrawingGroup (); DrawingGroup* getClone (); void qtAllocate (); @@ -57,6 +58,8 @@ namespace Hurricane { , float threshold , bool goMatched ); + void addDrawingStyle ( DrawingStyle ); + void toJson ( JsonWriter* ) const; protected: const Name _name; DrawingStyles _drawingStyles; @@ -67,18 +70,37 @@ namespace Hurricane { }; +// ------------------------------------------------------------------- +// Class : "JsonDrawingGroup". + + class JsonDrawingGroup : public JsonObject { + public: + static void initialize (); + JsonDrawingGroup ( unsigned long flags ); + ~JsonDrawingGroup (); + virtual string getTypeName () const; + virtual JsonDrawingGroup* clone ( unsigned long ) const; + virtual void toData ( JsonStack& ); + }; + + +// ------------------------------------------------------------------- +// Class : "DisplayStyle". + class DisplayStyle { public: class HSVr { public: - inline HSVr ( float hue=1.0, float saturation=1.0, float value=1.0 ); - inline bool isId () const; - inline float getHue () const; - inline float getSaturation () const; - inline float getValue () const; - inline void setHue ( float ); - inline void setSaturation ( float ); - inline void setValue ( float ); + inline HSVr ( float hue=1.0, float saturation=1.0, float value=1.0 ); + inline bool isId () const; + inline float getHue () const; + inline float getSaturation () const; + inline float getValue () const; + inline void setHue ( float ); + inline void setSaturation ( float ); + inline void setValue ( float ); + inline void toJson ( JsonWriter* ) const; + inline std::string _getString () const; private: float _hue; float _saturation; @@ -142,6 +164,9 @@ namespace Hurricane { , float threshold , bool goMatched =true ); + DrawingGroup* findGroup ( const Name& groupKey ); + void findOrCreate ( const Name& groupKey, size_t& gi ); + void toJson ( JsonWriter* ) const; protected: // Internals - Attributes. @@ -151,8 +176,6 @@ namespace Hurricane { HSVr _darkening; // Internals - Methods. - void findOrCreate ( const Name& groupKey - , size_t& gi ); void find ( const Name& groupKey , const Name& key , size_t& gi @@ -161,6 +184,37 @@ namespace Hurricane { }; +// ------------------------------------------------------------------- +// Class : "JsonDisplayStyle". + + class JsonDisplayStyle : public JsonObject { + public: + static void initialize (); + JsonDisplayStyle ( unsigned long flags ); + ~JsonDisplayStyle (); + virtual string getTypeName () const; + virtual JsonDisplayStyle* clone ( unsigned long ) const; + virtual void toData ( JsonStack& ); + }; + + +// ------------------------------------------------------------------- +// Class : "JsonHSVr". + + class JsonHSVr : public JsonObject { + public: + static void initialize (); + JsonHSVr ( unsigned long flags ); + ~JsonHSVr (); + virtual string getTypeName () const; + virtual JsonHSVr* clone ( unsigned long ) const; + virtual void toData ( JsonStack& ); + }; + + +// ------------------------------------------------------------------- +// Class : "RawDrawingStyle". + class RawDrawingStyle { public: // Constructors & Destructors. @@ -183,6 +237,7 @@ namespace Hurricane { QPen getPen ( const DisplayStyle::HSVr& ) const; QBrush getBrush ( const DisplayStyle::HSVr& ) const; inline float getThreshold () const; + void toJson ( JsonWriter* ) const; private: // Internal - Attributes. const Name _name; @@ -214,7 +269,23 @@ namespace Hurricane { }; - // Functions. +// ------------------------------------------------------------------- +// Class : "JsonDrawingStyle". + + class JsonDrawingStyle : public JsonObject { + public: + static void initialize (); + JsonDrawingStyle ( unsigned long flags ); + ~JsonDrawingStyle (); + virtual string getTypeName () const; + virtual JsonDrawingStyle* clone ( unsigned long ) const; + virtual void toData ( JsonStack& ); + }; + + +// ------------------------------------------------------------------- +// Inline Functions. + inline bool RawDrawingStyle::isGoMatched () const { return _goMatched; } inline const Name& RawDrawingStyle::getName () const { return _name; } inline const std::string& RawDrawingStyle::getPattern () const { return _pattern; } @@ -241,8 +312,28 @@ namespace Hurricane { inline void DisplayStyle::HSVr::setSaturation ( float saturation ) { _saturation=saturation; } inline void DisplayStyle::HSVr::setValue ( float value ) { _value=value; } + inline std::string DisplayStyle::HSVr::_getString () const + { + std::string s = ""; + return s; + } -} // End of Hurricane namespace. + inline void DisplayStyle::HSVr::toJson ( JsonWriter* w ) const + { + w->startObject(); + jsonWrite( w, "@typename", "HSVr" ); + jsonWrite( w, "_hue" , _hue ); + jsonWrite( w, "_saturation", _saturation ); + jsonWrite( w, "_value" , _value ); + w->endObject(); + } + +} // Hurricane namespace. -#endif // __HURRICANE_DISPLAYSTYLE__ +GETSTRING_VALUE_SUPPORT(Hurricane::DisplayStyle::HSVr); + + +#endif // HURRICANE_DISPLAYSTYLE_H diff --git a/hurricane/src/viewer/hurricane/viewer/ExceptionWidget.h b/hurricane/src/viewer/hurricane/viewer/ExceptionWidget.h index f18aac6d..c21d7cc6 100644 --- a/hurricane/src/viewer/hurricane/viewer/ExceptionWidget.h +++ b/hurricane/src/viewer/hurricane/viewer/ExceptionWidget.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/hurricane/src/viewer/hurricane/viewer/Graphics.h b/hurricane/src/viewer/hurricane/viewer/Graphics.h index fdc392aa..e2f0addf 100644 --- a/hurricane/src/viewer/hurricane/viewer/Graphics.h +++ b/hurricane/src/viewer/hurricane/viewer/Graphics.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | @@ -21,6 +21,7 @@ #include #include #include +#include "hurricane/Observer.h" #include "hurricane/Breakpoint.h" #include "hurricane/TextTranslator.h" #include "hurricane/viewer/DisplayStyle.h" @@ -37,11 +38,18 @@ namespace Hurricane { class Name; - class Graphics { +// ------------------------------------------------------------------- +// Class : "Graphics". + class Graphics { + public: + enum NotifyFlags { ChangedDisplayStyles = (1<<0) }; public: // Accessors. static Graphics* getGraphics (); + static void addObserver ( BaseObserver* ); + static void removeObserver ( BaseObserver* ); + static void notify ( unsigned int flags ); static bool isEnabled (); static bool isHighDpi (); static const QFont getFixedFont ( int weight=QFont::Normal, bool italic=false, bool underline=false, int scale=0 ); @@ -59,7 +67,6 @@ namespace Hurricane { static string toHtml ( const string& ); static int toHighDpi ( int ); static bool breakpointStopCb ( const string& message ); - // Modifiers. static void addStyle ( DisplayStyle* displayStyle ); static void setStyle ( const Name& key ); @@ -68,10 +75,11 @@ namespace Hurricane { static DisplayStyle* getStyle (); static const vector& getStyles (); static void enable (); - + void toJson ( JsonWriter* ) const; // Internals - Attributes. protected: static Graphics* _singleton; + Observable _observers; TextTranslator _htmlTranslator; vector _styles; DisplayStyle* _active; @@ -86,7 +94,6 @@ namespace Hurricane { Graphics ( const Graphics& ); Graphics& operator= ( const Graphics& ); ~Graphics (); - // Internals - Methods. size_t _findStyle ( const Name& key ) const; void _addStyle ( DisplayStyle* displayStyle ); @@ -105,7 +112,6 @@ namespace Hurricane { inline const ColorScale& _getColorScale ( ColorScale::ScaleType ) const; inline void _enable (); inline const TextTranslator& _getHtmlTranslator () const; - }; @@ -157,6 +163,20 @@ namespace Hurricane { { return _htmlTranslator; } +// ------------------------------------------------------------------- +// Class : "JsonGraphics". + + class JsonGraphics : public JsonObject { + public: + static void initialize (); + JsonGraphics ( unsigned long flags ); + ~JsonGraphics (); + virtual string getTypeName () const; + virtual JsonGraphics* clone ( unsigned long ) const; + virtual void toData ( JsonStack& ); + private: + std::string _active; + }; } // End of Hurricane namespace. diff --git a/hurricane/src/viewer/hurricane/viewer/GraphicsWidget.h b/hurricane/src/viewer/hurricane/viewer/GraphicsWidget.h index 206dc73a..5de2d491 100644 --- a/hurricane/src/viewer/hurricane/viewer/GraphicsWidget.h +++ b/hurricane/src/viewer/hurricane/viewer/GraphicsWidget.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | @@ -19,6 +19,8 @@ #include +class QGridLayout; +class QButtonGroup; #include "hurricane/viewer/CellWidget.h" @@ -32,17 +34,21 @@ namespace Hurricane { public: GraphicsWidget ( QWidget* parent=NULL ); void setCellWidget ( CellWidget* ); + void readGraphics (); + void resetGraphics (); + void rereadGraphics (); public slots: void changeStyle (); void setStyle ( int id ); protected: - CellWidget* _cellWidget; - UpdateState _updateState; + CellWidget* _cellWidget; + QGridLayout* _stylesGrid; + QButtonGroup* _stylesGroup; + UpdateState _updateState; }; -} // End of Hurricane namespace. - +} // Hurricane namespace. #endif diff --git a/hurricane/src/viewer/hurricane/viewer/HApplication.h b/hurricane/src/viewer/hurricane/viewer/HApplication.h index 01c49585..46506432 100644 --- a/hurricane/src/viewer/hurricane/viewer/HApplication.h +++ b/hurricane/src/viewer/hurricane/viewer/HApplication.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/hurricane/src/viewer/hurricane/viewer/HierarchyCommand.h b/hurricane/src/viewer/hurricane/viewer/HierarchyCommand.h index db74882b..d8c45e64 100644 --- a/hurricane/src/viewer/hurricane/viewer/HierarchyCommand.h +++ b/hurricane/src/viewer/hurricane/viewer/HierarchyCommand.h @@ -1,87 +1,55 @@ - // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | H U R R I C A N E | // | V L S I B a c k e n d D a t a - B a s e | // | | // | Author : Jean-Paul CHAPUT | -// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Header : "./HierarchyCommand.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ -#ifndef __HURRICANE_HIERARCHY_COMMAND__ -#define __HURRICANE_HIERARCHY_COMMAND__ - -#include - -#include -#include +#ifndef HURRICANE_HIERARCHY_COMMAND_H +#define HURRICANE_HIERARCHY_COMMAND_H +#include +#include +#include class QAction; -#include "hurricane/Occurrence.h" -#include "hurricane/viewer/Command.h" -#include "hurricane/viewer/CellWidget.h" - - -using namespace std; +#include "hurricane/Occurrence.h" +#include "hurricane/viewer/Command.h" +#include "hurricane/viewer/CellWidget.h" namespace Hurricane { - class Cell; class HierarchyCommand : public Command { public: - HierarchyCommand (); - virtual ~HierarchyCommand (); - virtual const string& getName () const; - virtual void keyReleaseEvent ( QKeyEvent* ); + HierarchyCommand (); + virtual ~HierarchyCommand (); + virtual const std::string& getName () const; + virtual void reset (); + virtual void keyReleaseEvent ( QKeyEvent* ); private: - HierarchyCommand ( const HierarchyCommand& ); - HierarchyCommand& operator= ( const HierarchyCommand& ); + HierarchyCommand ( const HierarchyCommand& ); + HierarchyCommand& operator= ( const HierarchyCommand& ); private: - class HistoryEntry { - public: - inline HistoryEntry ( Instance*, shared_ptr ); - public: - Instance* _instance; - shared_ptr _state; - }; - private: - static string _name; - vector _history; - size_t _historyIndex; + static std::string _name; + std::vector< std::shared_ptr > _history; + size_t _historyIndex; }; -// Inline Functions. - inline HierarchyCommand::HistoryEntry::HistoryEntry ( Instance* instance - , shared_ptr state - ) - : _instance(instance) - , _state (state) - { } +} // Hurricane namespace. - -} // End of Hurricane namespace. - - -#endif +#endif // HURRICANE_HIERARCHY_COMMAND_H diff --git a/hurricane/src/viewer/hurricane/viewer/HierarchyInformations.h b/hurricane/src/viewer/hurricane/viewer/HierarchyInformations.h new file mode 100644 index 00000000..f399505e --- /dev/null +++ b/hurricane/src/viewer/hurricane/viewer/HierarchyInformations.h @@ -0,0 +1,178 @@ +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC 2015-2016, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | H U R R I C A N E | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./hurricane/viewer/HierarchyInformations.h" | +// +-----------------------------------------------------------------+ + + +#ifndef HURRICANE_HIERARCHY_INFORMATIONS_H +#define HURRICANE_HIERARCHY_INFORMATIONS_H + +#include +#include +#include +#include "hurricane/Commons.h" +#include "hurricane/Path.h" + + +namespace Hurricane { + + class Instance; + class Cell; + + +// ------------------------------------------------------------------- +// Class : "HierarchyInfos" + + + class HierarchyInfos { + public: + enum Flags { NoFlags=0x0000, Collapsed=0x0001 }; + public: + HierarchyInfos ( HierarchyInfos* parent, size_t rowInParent ); + virtual ~HierarchyInfos (); + virtual bool isRoot () const = 0; + virtual bool isLeaf () const = 0; + virtual bool isCollapsed () const = 0; + static int getColumnCount (); + static QVariant getColumnName ( int column ); + QVariant getColumn ( int column ) const; + virtual const HierarchyInfos* getRow ( int row ) const = 0; + inline const HierarchyInfos* getParent () const; + inline size_t getRowInParent () const; + virtual int size () const = 0; + virtual Cell* getMasterCell () const = 0; + virtual const Instance* getInstance () const = 0; + virtual const std::vector& getInstances () const = 0; + inline const Name getName () const; + virtual Path getPath () const; + virtual QString getFilterPattern () const = 0; + virtual void setFilterPattern ( const QString& ) = 0; + inline void setRowInParent ( size_t ); + virtual void expand () = 0; + virtual void collapse () = 0; + protected: + HierarchyInfos* _parent; + size_t _rowInParent; + }; + + + inline size_t HierarchyInfos::getRowInParent () const { return _rowInParent; } + inline const HierarchyInfos* HierarchyInfos::getParent () const { return _parent; } + inline const Name HierarchyInfos::getName () const { return isRoot() ? Name("Root") : getInstance()->getName(); } + inline void HierarchyInfos::setRowInParent ( size_t rowInParent ) { _rowInParent=rowInParent; } + + +// ------------------------------------------------------------------- +// Class : "LeafHierarchyInfos" + + + class LeafHierarchyInfos : public HierarchyInfos { + public: + LeafHierarchyInfos ( const Instance* + , HierarchyInfos* parent + , size_t rowInParent ); + virtual ~LeafHierarchyInfos (); + virtual bool isRoot () const; + virtual bool isLeaf () const; + virtual bool isCollapsed () const; + virtual const HierarchyInfos* getRow ( int row ) const; + virtual int size () const; + virtual Cell* getMasterCell () const; + virtual const Instance* getInstance () const; + virtual const std::vector& getInstances () const; + virtual void setFilterPattern ( const QString& ); + virtual QString getFilterPattern () const; + virtual void expand (); + virtual void collapse (); + protected: + const Instance* _instance; + static const std::vector _instances; + }; + + +// ------------------------------------------------------------------- +// Class : "InstHierarchyInfos" + + + class InstHierarchyInfos : public HierarchyInfos { + public: + InstHierarchyInfos ( const Instance* + , HierarchyInfos* parent + , size_t rowInParent ); + virtual ~InstHierarchyInfos (); + virtual bool isRoot () const; + virtual bool isLeaf () const; + virtual bool isCollapsed () const; + virtual const HierarchyInfos* getRow ( int row ) const; + virtual int size () const; + virtual Cell* getMasterCell () const; + virtual const Instance* getInstance () const; + virtual const std::vector& getInstances () const; + virtual void setFilterPattern ( const QString& ); + virtual QString getFilterPattern () const; + virtual void expand (); + virtual void collapse (); + protected: + unsigned int _flags; + const Instance* _instance; + std::vector _instances; + QRegExp _filter; + }; + + +// ------------------------------------------------------------------- +// Class : "TopCellHierarchyInfos" + + + class TopCellHierarchyInfos : public InstHierarchyInfos { + public: + TopCellHierarchyInfos ( Cell*, HierarchyInfos* parent ); + virtual ~TopCellHierarchyInfos (); + virtual bool isRoot () const; + virtual Cell* getMasterCell () const; + virtual const Instance* getInstance () const; + void setCell ( Cell* ); + protected: + Cell* _rootCell; + }; + + +// ------------------------------------------------------------------- +// Class : "RootHierarchyInfos" + + + class RootHierarchyInfos : public HierarchyInfos { + public: + RootHierarchyInfos ( Cell* ); + virtual ~RootHierarchyInfos (); + virtual bool isRoot () const; + virtual bool isLeaf () const; + virtual bool isCollapsed () const; + virtual const HierarchyInfos* getRow ( int row ) const; + virtual int size () const; + virtual Cell* getMasterCell () const; + virtual const Instance* getInstance () const; + virtual const std::vector& getInstances () const; + virtual void setFilterPattern ( const QString& ); + virtual QString getFilterPattern () const; + virtual void expand (); + virtual void collapse (); + void setCell ( Cell* ); + protected: + std::vector _instances; + }; + + +} // Hurricane namespace. + +#endif // HURRICANE_HIERARCHY_INFORMATIONS_H diff --git a/hurricane/src/viewer/hurricane/viewer/HierarchyModel.h b/hurricane/src/viewer/hurricane/viewer/HierarchyModel.h new file mode 100644 index 00000000..175642d3 --- /dev/null +++ b/hurricane/src/viewer/hurricane/viewer/HierarchyModel.h @@ -0,0 +1,85 @@ +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC 2015-2016, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | H U R R I C A N E | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./hurricane/viewer/HierarchyModel.h" | +// +-----------------------------------------------------------------+ + + +#ifndef HURRICANE_HIERARCHY_MODEL_H +#define HURRICANE_HIERARCHY_MODEL_H + +#include +#include +#include +#include +#include "hurricane/Commons.h" +#include "hurricane/Name.h" +#include "hurricane/Net.h" +#include "hurricane/Cell.h" +#include "hurricane/viewer/Graphics.h" +#include "hurricane/viewer/HierarchyInformations.h" + + +namespace Hurricane { + + class Net; + class Cell; + + + class HierarchyModel : public QAbstractItemModel { + Q_OBJECT; + + public: + HierarchyModel ( QObject* parent=NULL ); + ~HierarchyModel (); + inline void setRootCell ( Cell* cell ); + virtual bool hasChildren ( const QModelIndex& parent=QModelIndex() ) const; + QModelIndex index ( int row, int column, const QModelIndex& parent ) const; + QModelIndex parent ( const QModelIndex& child ) const; + int rowCount ( const QModelIndex& parent=QModelIndex() ) const; + int columnCount ( const QModelIndex& parent=QModelIndex() ) const; + QVariant data ( const QModelIndex& index, int role=Qt::DisplayRole ) const; + QVariant headerData ( int section, Qt::Orientation orientation, int role=Qt::DisplayRole ) const; + inline Cell* getCell (); + inline HierarchyInfos* getRoot (); + inline void setCell ( Cell* ); + inline const HierarchyInfos* infosFromIndex ( const QModelIndex& ) const; + private: + RootHierarchyInfos _root; + }; + + +// Inline Functions. + + inline Cell* HierarchyModel::getCell () { return _root.getMasterCell(); } + inline HierarchyInfos* HierarchyModel::getRoot () { return &_root; } + + + inline void HierarchyModel::setCell ( Cell* cell ) + { + _root.setCell( cell ); + reset(); + } + + + inline const HierarchyInfos* HierarchyModel::infosFromIndex ( const QModelIndex& index ) const + { + if (index.isValid()) + return static_cast(index.internalPointer()); + return &_root; + } + + +} // End of Hurricane namespace. + + +#endif // HURRICANE_HIERARCHY_MODEL_H diff --git a/hurricane/src/viewer/hurricane/viewer/HierarchyWidget.h b/hurricane/src/viewer/hurricane/viewer/HierarchyWidget.h new file mode 100644 index 00000000..101376f3 --- /dev/null +++ b/hurricane/src/viewer/hurricane/viewer/HierarchyWidget.h @@ -0,0 +1,111 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC 2015-2016, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | H U R R I C A N E | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./hurricane/viewer/HierarchyWidget.h" | +// +-----------------------------------------------------------------+ + + +#ifndef HURRICANE_HIERARCHY_WIDGET_H +#define HURRICANE_HIERARCHY_WIDGET_H + +#include +#include +#include +#include +#include "hurricane/Commons.h" +#include "hurricane/Bug.h" +#include "hurricane/viewer/HierarchyModel.h" +#include "hurricane/viewer/CellWidget.h" + + +class QModelIndex; +class QItemSelection; +class QLineEdit; +class QComboBox; +class QHeaderView; + + +namespace Hurricane { + + using std::set; + class Net; + class Cell; + + +// ------------------------------------------------------------------- +// Class : "TreeKeyFilter". + + + class TreeKeyFilter : public QObject { + Q_OBJECT; + + public: + TreeKeyFilter ( QObject* parent ); + bool eventFilter ( QObject*, QEvent* ); + }; + + +// ------------------------------------------------------------------- +// Class : "HierarchyWidget". + + + class HierarchyWidget : public QWidget { + Q_OBJECT; + + friend class TreeKeyFilter; + public: + HierarchyWidget ( QWidget* parent=NULL ); + bool isRSelected ( const QModelIndex& index ) const; + inline CellWidget* getCellWidget (); + void rexpand ( Path path ); + void rexpand ( const QModelIndex& index ); + inline Cell* getCell (); + inline void setCellWidget ( CellWidget* ); + void setCell ( Cell* ); + void goTo ( int ); + private slots: + void collapseHook ( const QModelIndex& ); + void textFilterChanged (); + void followSelected ( const QItemSelection&, const QItemSelection& ); + private: + CellWidget* _cellWidget; + Cell* _cell; + HierarchyModel* _baseModel; + QTreeView* _view; + QLineEdit* _filterPatternLineEdit; + int _rowHeight; + }; + + + inline Cell* HierarchyWidget::getCell () { return _cell; } + inline CellWidget* HierarchyWidget::getCellWidget () { return _cellWidget; } + + + inline void HierarchyWidget::setCellWidget ( CellWidget* cw ) + { + if (_cellWidget) { + disconnect( this, 0, _cellWidget, 0 ); + } + + _cellWidget = cw; + if (_cellWidget) { + if (_cellWidget->getTopCell()) setCell( _cellWidget->getTopCell() ); + else setCell( _cellWidget->getCell() ); + } else + setCell( NULL ); + } + + +} // Hurricane namespace. + +#endif // HURRICANE_HIERARCHY_WIDGET_H diff --git a/hurricane/src/viewer/hurricane/viewer/InspectorWidget.h b/hurricane/src/viewer/hurricane/viewer/InspectorWidget.h index 84e1e7ff..99a69325 100644 --- a/hurricane/src/viewer/hurricane/viewer/InspectorWidget.h +++ b/hurricane/src/viewer/hurricane/viewer/InspectorWidget.h @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | diff --git a/hurricane/src/viewer/hurricane/viewer/JsonConfiguration.h b/hurricane/src/viewer/hurricane/viewer/JsonConfiguration.h new file mode 100644 index 00000000..2e9357a8 --- /dev/null +++ b/hurricane/src/viewer/hurricane/viewer/JsonConfiguration.h @@ -0,0 +1,130 @@ +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC 2016-2016, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./hurricane/viewer/JsonConfiguration.h" | +// +-----------------------------------------------------------------+ + + +#ifndef HURRICANE_JSON_CONFIGURATION_H +#define HURRICANE_JSON_CONFIGURATION_H + +#include "vlsisapd/configuration/Parameter.h" +#include "vlsisapd/configuration/Configuration.h" +#include "hurricane/Commons.h" + + +void jsonWrite ( JsonWriter*, const Cfg::Parameter* ); +void jsonWrite ( JsonWriter*, const Cfg::Parameter::EnumValue ); +void jsonWrite ( JsonWriter*, const Cfg::Configuration* ); +void jsonWrite ( JsonWriter*, const Cfg::WidgetDescription* ); +void jsonWrite ( JsonWriter*, const Cfg::TabDescription* ); +void jsonWrite ( JsonWriter*, const Cfg::LayoutDescription* ); + + +namespace Hurricane { + + +// ------------------------------------------------------------------- +// Class : "JsonParameter". + + class JsonParameter : public JsonObject { + public: + static void initialize (); + JsonParameter ( unsigned long ); + virtual string getTypeName () const; + virtual JsonParameter* clone ( unsigned long ) const; + virtual void toData ( JsonStack& ); + }; + + +// ------------------------------------------------------------------- +// Class : "JsonParamEnumValue". + + class JsonParamEnumValue : public JsonObject { + public: + static void initialize (); + JsonParamEnumValue ( unsigned long ); + virtual string getTypeName () const; + virtual JsonParamEnumValue* clone ( unsigned long ) const; + virtual void toData ( JsonStack& ); + }; + + +// ------------------------------------------------------------------- +// Class : "JsonParamSlave". + + class JsonParamSlave : public JsonObject { + public: + static void initialize (); + JsonParamSlave ( unsigned long ); + virtual string getTypeName () const; + virtual JsonParamSlave* clone ( unsigned long ) const; + virtual void toData ( JsonStack& ); + }; + + +// ------------------------------------------------------------------- +// Class : "JsonConfiguration". + + class JsonConfiguration : public JsonObject { + public: + static void initialize (); + JsonConfiguration ( unsigned long ); + virtual string getTypeName () const; + virtual JsonConfiguration* clone ( unsigned long ) const; + virtual void toData ( JsonStack& ); + }; + + +// ------------------------------------------------------------------- +// Class : "JsonWidgetDescription". + + class JsonWidgetDescription : public JsonObject { + public: + static void initialize (); + JsonWidgetDescription ( unsigned long ); + virtual string getTypeName () const; + virtual JsonWidgetDescription* clone ( unsigned long ) const; + virtual void toData ( JsonStack& ); + }; + + +// ------------------------------------------------------------------- +// Class : "JsonTabDescription". + + class JsonTabDescription : public JsonObject { + public: + static void initialize (); + JsonTabDescription ( unsigned long ); + virtual string getTypeName () const; + virtual JsonTabDescription* clone ( unsigned long ) const; + virtual void toData ( JsonStack& ); + }; + + +// ------------------------------------------------------------------- +// Class : "JsonLayoutDescription". + + class JsonLayoutDescription : public JsonObject { + public: + static void initialize (); + JsonLayoutDescription ( unsigned long ); + virtual ~JsonLayoutDescription (); + virtual string getTypeName () const; + virtual JsonLayoutDescription* clone ( unsigned long ) const; + virtual void toData ( JsonStack& ); + }; + + +} // Hurricane namespace. + +#endif // HURRICANE_JSON_CONFIGURATION_H diff --git a/hurricane/src/viewer/hurricane/viewer/JsonParameter.h b/hurricane/src/viewer/hurricane/viewer/JsonParameter.h new file mode 100644 index 00000000..23d6d8f2 --- /dev/null +++ b/hurricane/src/viewer/hurricane/viewer/JsonParameter.h @@ -0,0 +1,66 @@ +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC 2016-2016, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./hurricane/viewer/JsonParameter.h" | +// +-----------------------------------------------------------------+ + + +#ifndef HURRICANE_JSON_PARAMETER_H +#define HURRICANE_JSON_PARAMETER_H + +#include "vlsisapd/configuration/Parameter.h" +#include "vlsisapd/configuration/Configuration.h" +#include "hurricane/Commons.h" + + +void jsonWrite ( JsonWriter*, const Cfg::Parameter* ); +void jsonWrite ( JsonWriter*, const Cfg::Configuration* ); + +inline void jsonWrite ( JsonWriter* w, const std::string& key, const Cfg::Parameter* p ) +{ w->key(key); jsonWrite( w, p ); } + +inline void jsonWrite ( JsonWriter* w, const std::string& key, const Cfg::Configuration* cfg ) +{ w->key(key); jsonWrite( w, cfg ); } + + +namespace Hurricane { + + +// ------------------------------------------------------------------- +// Class : "JsonParameter". + + class JsonParameter : public JsonObject { + public: + static void initialize (); + JsonParameter ( unsigned long ); + virtual string getTypeName () const; + virtual JsonParameter* clone ( unsigned long ) const; + virtual void toData ( JsonStack& ); + }; + + +// ------------------------------------------------------------------- +// Class : "JsonConfiguration". + + class JsonConfiguration : public JsonObject { + public: + static void initialize (); + JsonConfiguration ( unsigned long ); + virtual string getTypeName () const; + virtual JsonConfiguration* clone ( unsigned long ) const; + virtual void toData ( JsonStack& ); + }; + + +} // Hurricane namespace. + +#endif // HURRICANE_JSON_PARAMETER_H diff --git a/hurricane/src/viewer/hurricane/viewer/MousePositionWidget.h b/hurricane/src/viewer/hurricane/viewer/MousePositionWidget.h index 6ec7385f..f665b4ea 100644 --- a/hurricane/src/viewer/hurricane/viewer/MousePositionWidget.h +++ b/hurricane/src/viewer/hurricane/viewer/MousePositionWidget.h @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // =================================================================== // diff --git a/hurricane/src/viewer/hurricane/viewer/MoveCommand.h b/hurricane/src/viewer/hurricane/viewer/MoveCommand.h index bcbe6887..8b64785a 100644 --- a/hurricane/src/viewer/hurricane/viewer/MoveCommand.h +++ b/hurricane/src/viewer/hurricane/viewer/MoveCommand.h @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // =================================================================== // diff --git a/hurricane/src/viewer/hurricane/viewer/NetInformations.h b/hurricane/src/viewer/hurricane/viewer/NetInformations.h index 599caa31..6db74a26 100644 --- a/hurricane/src/viewer/hurricane/viewer/NetInformations.h +++ b/hurricane/src/viewer/hurricane/viewer/NetInformations.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | @@ -67,16 +67,17 @@ namespace Hurricane { static QVariant getColumnName ( int column ); virtual QVariant getColumn ( int column ); inline size_t getPlugsCount () const; + inline size_t getRpsCount () const; protected: + QVariant _netName; size_t _plugsCount; - QVariant _columnNet; - QVariant _columnPlug; + size_t _rpsCount; }; - inline size_t SimpleNetInformations::getPlugsCount () const - { return _plugsCount; } + inline size_t SimpleNetInformations::getPlugsCount () const { return _plugsCount; } + inline size_t SimpleNetInformations::getRpsCount () const { return _rpsCount; } // ------------------------------------------------------------------- diff --git a/hurricane/src/viewer/hurricane/viewer/NetlistModel.h b/hurricane/src/viewer/hurricane/viewer/NetlistModel.h index 5f107013..27e76d51 100644 --- a/hurricane/src/viewer/hurricane/viewer/NetlistModel.h +++ b/hurricane/src/viewer/hurricane/viewer/NetlistModel.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | diff --git a/hurricane/src/viewer/hurricane/viewer/NetlistWidget.h b/hurricane/src/viewer/hurricane/viewer/NetlistWidget.h index 1558bb8c..9456d5ca 100644 --- a/hurricane/src/viewer/hurricane/viewer/NetlistWidget.h +++ b/hurricane/src/viewer/hurricane/viewer/NetlistWidget.h @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | @@ -180,14 +180,17 @@ namespace Hurricane { void NetlistWidget::setCell ( Cell* cell ) { _cell = cell; - _view->selectionModel()->clear (); - _baseModel->setCell ( cell ); + _view->setVisible( false ); + _view->selectionModel()->clear(); + _baseModel->setCell( cell ); string windowTitle = "Netlist" + getString(cell); - setWindowTitle ( tr(windowTitle.c_str()) ); + setWindowTitle( tr(windowTitle.c_str()) ); - _view->selectRow ( 0 ); - _view->resizeColumnToContents ( 0 ); + _view->selectRow( 0 ); + for ( int i=0 ; i<_baseModel->columnCount() ; ++i ) + _view->resizeColumnToContents( i ); + _view->setVisible( true ); } diff --git a/hurricane/src/viewer/hurricane/viewer/OpenBlobDialog.h b/hurricane/src/viewer/hurricane/viewer/OpenBlobDialog.h new file mode 100644 index 00000000..1404763f --- /dev/null +++ b/hurricane/src/viewer/hurricane/viewer/OpenBlobDialog.h @@ -0,0 +1,42 @@ +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC 2015-2016, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | H U R R I C A N E | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Header : "./hurricane/viewer/OpenBlobDialog.h" | +// +-----------------------------------------------------------------+ + + +#ifndef HURRICANE_OPEN_BLOB_DIALOG_H +#define HURRICANE_OPEN_BLOB_DIALOG_H + +#include + +class QLineEdit; + + +namespace Hurricane { + + + class OpenBlobDialog : public QDialog { + Q_OBJECT; + public: + static bool runDialog ( QWidget* parent, QString& name ); + const QString getBlobName () const; + protected: + OpenBlobDialog ( QWidget* parent=NULL ); + protected: + QLineEdit* _lineEdit; + }; + + +} // Hurricane namespace. + +#endif // HURRICANE_OPEN_BLOB_DIALOG_H diff --git a/hurricane/src/viewer/hurricane/viewer/PaletteExtensionGoItem.h b/hurricane/src/viewer/hurricane/viewer/PaletteExtensionGoItem.h index bdf3e125..061e6cd6 100644 --- a/hurricane/src/viewer/hurricane/viewer/PaletteExtensionGoItem.h +++ b/hurricane/src/viewer/hurricane/viewer/PaletteExtensionGoItem.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | diff --git a/hurricane/src/viewer/hurricane/viewer/PaletteItem.h b/hurricane/src/viewer/hurricane/viewer/PaletteItem.h index 0e516154..7975eefa 100644 --- a/hurricane/src/viewer/hurricane/viewer/PaletteItem.h +++ b/hurricane/src/viewer/hurricane/viewer/PaletteItem.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | diff --git a/hurricane/src/viewer/hurricane/viewer/PaletteLayerItem.h b/hurricane/src/viewer/hurricane/viewer/PaletteLayerItem.h index 6b9ad913..807a9e07 100644 --- a/hurricane/src/viewer/hurricane/viewer/PaletteLayerItem.h +++ b/hurricane/src/viewer/hurricane/viewer/PaletteLayerItem.h @@ -1,30 +1,21 @@ - // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | H U R R I C A N E | // | V L S I B a c k e n d D a t a - B a s e | // | | // | Author : Jean-Paul CHAPUT | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | -// | C++ Header : "./PaletteLayerItem.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// | C++ Header : "./hurricane/viewer/PaletteLayerItem.h" | +// +-----------------------------------------------------------------+ -#ifndef __HURRICANE_PALETTE_LAYER_ITEM__ -#define __HURRICANE_PALETTE_LAYER_ITEM__ +#ifndef HURRICANE_PALETTE_LAYER_ITEM_H +#define HURRICANE_PALETTE_LAYER_ITEM_H class QCheckBox; @@ -64,7 +55,6 @@ namespace Hurricane { }; -} // End of Hurricane namespace. +} // Hurricane namespace. - -#endif // __HURRICANE_PALETTE_LAYER_ITEM__ +#endif // HURRICANE_PALETTE_LAYER_ITEM_H diff --git a/hurricane/src/viewer/hurricane/viewer/PaletteNamedItem.h b/hurricane/src/viewer/hurricane/viewer/PaletteNamedItem.h index 64edce1e..06227a77 100644 --- a/hurricane/src/viewer/hurricane/viewer/PaletteNamedItem.h +++ b/hurricane/src/viewer/hurricane/viewer/PaletteNamedItem.h @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // =================================================================== // diff --git a/hurricane/src/viewer/hurricane/viewer/PaletteWidget.h b/hurricane/src/viewer/hurricane/viewer/PaletteWidget.h index 4ec64e1a..24cbfc03 100644 --- a/hurricane/src/viewer/hurricane/viewer/PaletteWidget.h +++ b/hurricane/src/viewer/hurricane/viewer/PaletteWidget.h @@ -1,37 +1,28 @@ - // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | H U R R I C A N E | // | V L S I B a c k e n d D a t a - B a s e | // | | // | Author : Jean-Paul CHAPUT | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | -// | C++ Header : "./PaletteWidget.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// | C++ Header : "./hurricane/viewer/PaletteWidget.h" | +// +-----------------------------------------------------------------+ -#ifndef __HURRICANE_PALETTE_WIDGET__ -#define __HURRICANE_PALETTE_WIDGET__ +#ifndef HURRICANE_PALETTE_WIDGET_H +#define HURRICANE_PALETTE_WIDGET_H -#include -#include -#include +#include +#include +#include -#include "hurricane/Commons.h" -#include "hurricane/Name.h" +#include "hurricane/Commons.h" +#include "hurricane/Name.h" class QLabel; @@ -52,8 +43,12 @@ namespace Hurricane { class PaletteNamedItem; class PaletteLayerItem; class PaletteExtensionGoItem; + class PaletteWidget; +// ------------------------------------------------------------------- +// Class : "PaletteWidget". + class PaletteWidget : public QWidget { Q_OBJECT; @@ -66,7 +61,9 @@ namespace Hurricane { bool isSelectable ( const Name& name ) const; inline void setOneColumn (); inline void setColumnHeight ( size_t height=std::numeric_limits::max() ); - void build (); + void readGraphics (); + void resetGraphics (); + void rereadGraphics (); signals: void paletteChanged (); public slots: @@ -80,16 +77,16 @@ namespace Hurricane { void setItemVisible ( const Name& name, bool visible ); protected: - QScrollArea* _scrollArea; - PaletteItems _layerItems; - PaletteItems _extensionGoItems; - QPushButton* _showAll; - QPushButton* _hideAll; - QGridLayout* _grid; - size_t _columnHeight; - int _extensionRow; - int _extensionColumn; - QWidget* _extensionGroup; + QScrollArea* _scrollArea; + PaletteItems _layerItems; + PaletteItems _extensionGoItems; + QPushButton* _showAll; + QPushButton* _hideAll; + QGridLayout* _grid; + size_t _columnHeight; + int _extensionRow; + int _extensionColumn; + QWidget* _extensionGroup; private: PaletteWidget ( const PaletteWidget& ); @@ -108,7 +105,6 @@ namespace Hurricane { inline void PaletteWidget::setColumnHeight ( size_t height ) { _columnHeight = height; } -} // End of Hurricane namespace. +} // Hurricane namespace. - -#endif // __HURRICANE_PALETTE_WIDGET__ +#endif // HURRICANE_PALETTE_WIDGET_H diff --git a/hurricane/src/viewer/hurricane/viewer/PyCellViewer.h b/hurricane/src/viewer/hurricane/viewer/PyCellViewer.h index e70fdd5c..b18c341b 100644 --- a/hurricane/src/viewer/hurricane/viewer/PyCellViewer.h +++ b/hurricane/src/viewer/hurricane/viewer/PyCellViewer.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2010-2015, All Rights Reserved +// Copyright (c) UPMC 2010-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/hurricane/src/viewer/hurricane/viewer/Ruler.h b/hurricane/src/viewer/hurricane/viewer/Ruler.h index d45f4a36..fd50d2b5 100644 --- a/hurricane/src/viewer/hurricane/viewer/Ruler.h +++ b/hurricane/src/viewer/hurricane/viewer/Ruler.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/hurricane/src/viewer/hurricane/viewer/RulerCommand.h b/hurricane/src/viewer/hurricane/viewer/RulerCommand.h index f834b265..66e3dd65 100644 --- a/hurricane/src/viewer/hurricane/viewer/RulerCommand.h +++ b/hurricane/src/viewer/hurricane/viewer/RulerCommand.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | diff --git a/hurricane/src/viewer/hurricane/viewer/Script.h b/hurricane/src/viewer/hurricane/viewer/Script.h index e771a121..757539bd 100644 --- a/hurricane/src/viewer/hurricane/viewer/Script.h +++ b/hurricane/src/viewer/hurricane/viewer/Script.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | diff --git a/hurricane/src/viewer/hurricane/viewer/ScriptWidget.h b/hurricane/src/viewer/hurricane/viewer/ScriptWidget.h index 1742c76b..86c974f8 100644 --- a/hurricane/src/viewer/hurricane/viewer/ScriptWidget.h +++ b/hurricane/src/viewer/hurricane/viewer/ScriptWidget.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -30,8 +30,9 @@ namespace Hurricane { class ScriptWidget : public QDialog { Q_OBJECT; public: - static void runScript ( QWidget* parent, Cell* ); + static void runScript ( QWidget* parent, QString& scriptName, Cell* ); const QString getScriptName () const; + void setScriptName ( QString scriptName ); protected: ScriptWidget ( QWidget* parent=NULL ); protected: diff --git a/hurricane/src/viewer/hurricane/viewer/SelectCommand.h b/hurricane/src/viewer/hurricane/viewer/SelectCommand.h index 56a46f39..e165a441 100644 --- a/hurricane/src/viewer/hurricane/viewer/SelectCommand.h +++ b/hurricane/src/viewer/hurricane/viewer/SelectCommand.h @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // =================================================================== // diff --git a/hurricane/src/viewer/hurricane/viewer/SelectionModel.h b/hurricane/src/viewer/hurricane/viewer/SelectionModel.h index 5260fc7d..762c0709 100644 --- a/hurricane/src/viewer/hurricane/viewer/SelectionModel.h +++ b/hurricane/src/viewer/hurricane/viewer/SelectionModel.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | diff --git a/hurricane/src/viewer/hurricane/viewer/SelectionPopup.h b/hurricane/src/viewer/hurricane/viewer/SelectionPopup.h index 4be63cea..588ede2c 100644 --- a/hurricane/src/viewer/hurricane/viewer/SelectionPopup.h +++ b/hurricane/src/viewer/hurricane/viewer/SelectionPopup.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | diff --git a/hurricane/src/viewer/hurricane/viewer/SelectionPopupModel.h b/hurricane/src/viewer/hurricane/viewer/SelectionPopupModel.h index 2d39ec17..88ce542c 100644 --- a/hurricane/src/viewer/hurricane/viewer/SelectionPopupModel.h +++ b/hurricane/src/viewer/hurricane/viewer/SelectionPopupModel.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | H U R R I C A N E | diff --git a/hurricane/src/viewer/hurricane/viewer/SelectionWidget.h b/hurricane/src/viewer/hurricane/viewer/SelectionWidget.h index 8e357ffe..e200cfda 100644 --- a/hurricane/src/viewer/hurricane/viewer/SelectionWidget.h +++ b/hurricane/src/viewer/hurricane/viewer/SelectionWidget.h @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // =================================================================== // diff --git a/hurricane/src/viewer/hurricane/viewer/Selector.h b/hurricane/src/viewer/hurricane/viewer/Selector.h index 475c1ae7..416ceece 100644 --- a/hurricane/src/viewer/hurricane/viewer/Selector.h +++ b/hurricane/src/viewer/hurricane/viewer/Selector.h @@ -3,7 +3,7 @@ // -*- C++ -*- // // This file is part of the Hurricane Software. -// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved // // =================================================================== // diff --git a/hurricane/src/viewer/hurricane/viewer/SelectorCriterion.h b/hurricane/src/viewer/hurricane/viewer/SelectorCriterion.h index 7d2f23f9..5282d72d 100644 --- a/hurricane/src/viewer/hurricane/viewer/SelectorCriterion.h +++ b/hurricane/src/viewer/hurricane/viewer/SelectorCriterion.h @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // =================================================================== // diff --git a/hurricane/src/viewer/hurricane/viewer/ZoomCommand.h b/hurricane/src/viewer/hurricane/viewer/ZoomCommand.h index d4b64489..d20650f9 100644 --- a/hurricane/src/viewer/hurricane/viewer/ZoomCommand.h +++ b/hurricane/src/viewer/hurricane/viewer/ZoomCommand.h @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // =================================================================== // diff --git a/katabatic/doc/AutoContact.dox b/katabatic/doc/AutoContact.dox index 142ab2af..b4f2831d 100644 --- a/katabatic/doc/AutoContact.dox +++ b/katabatic/doc/AutoContact.dox @@ -236,11 +236,16 @@ //! \function GCell* AutoContact::getGCell () const; //! \sreturn The GCell into which the AutoContact is located. - //! \function AutoSegment* AutoContact::getOpposite ( const AutoSegment* segment ) const; - //! \sreturn The AutoSegment other the same direction as \c segment, this is - //! only meaningful on AutoContactHTee or AutoContactVTee. It there is + //! \function AutoSegment* AutoContact::getOpposite ( const AutoSegment* reference ) const; + //! \sreturn The other AutoSegment the \e same direction as \c reference, this is + //! only meaningful on AutoContactHTee or AutoContactVTee. If there is //! no opposite, \c NULL is returned. + //! \function AutoSegment* AutoContact::getPerpandicular ( const AutoSegment* reference ) const; + //! \sreturn The AutoSegment in the \e perpandicular direction to \c reference, this is + //! only meaningful on AutoContacTurn. It there is no unique perpandicular, + //! \c NULL is returned. + //! \function AutoSegment* AutoContact::getSegment ( unsigned int index ) const; //! \sreturn The nth anchored AutoSegment. The index is significant: //! - \b 0 : first horizontal (\b h1). @@ -375,6 +380,12 @@ //! will not lead to an empty interval, in that case, do nothing and //! return \false. + //! \function void AutoContact::migrateConstraintBox ( AutoContact* other ); + //! Transfer the user constraint box from \c other to the current + //! object \c this. The constraints of \c other are restored to their + //! native values. The two contacts must belong to the same GCell for + //! this method to take effect. + /*! \class LocatorHelper * diff --git a/katabatic/doc/AutoSegment.dox b/katabatic/doc/AutoSegment.dox index 3e6daeaa..26d61c44 100644 --- a/katabatic/doc/AutoSegment.dox +++ b/katabatic/doc/AutoSegment.dox @@ -68,6 +68,9 @@ * This operation is used to slacken the constraints on a segment * or restore connexity on source/target contact after a layer * change. The new segment is always created on the source. + *
                • Reduction/Raising. When a segment is a short dogleg, + * no greater than one picth, it can use the layer of the + * perpandiculars. *
                * * @@ -97,6 +100,8 @@ *
              • The interval giving the complete length of the AutoSegment, * that is, with all extentions cap taken into account. * This interval is refered as the \e span. + *
              • A small counter, of the number of reduced neighbors (never + * exceed two). *
              * * @@ -197,6 +202,10 @@ //! \var AutoSegmentFlag::SegTargetBottom //! The target contact of this segment is connected to the bottom layer. + //! \var AutoSegmentFlag::SegIsReduced + //! This segment is the perpandicular part of a dogleg which will use the + //! same layer as the parallels. + //! \var AutoSegmentFlag::SegLayerChange //! This AutoSegment has been created to to reconnect parts of an AutoSegment //! after a layer change. @@ -273,10 +282,11 @@ //! \c source or \c target are not the one decorating the anchors, an //! exception is thrown. - //! \function AutoSegment* AutoSegment::create ( AutoContact* source, AutoContact* target, unsigned int flags ); + //! \function AutoSegment* AutoSegment::create ( AutoContact* source, AutoContact* target, unsigned int dir, size_t depth ); //! \param source The source AutoContact. //! \param target The target AutoContact. - //! \param flags Specify the constructor behavior. + //! \param dir Specify the segment direction. + //! \param depth The layer, given by it's depth in the RoutingGauge. //! \return The AutoHorizontal/AutoVertical. //! //! Factory method to create AutoHorizontal or AutoVertical. @@ -391,6 +401,22 @@ //! \sreturn \true if segment is a strap used only to connect between two different //! metal layers on the way up or down. + //! \function bool AutoSegment::isSpinTop() const; + //! \sreturn \true if segment is connected to turns and both perpandiculars segments + //! are in the \e top layer (candidate for reduction). + + //! \function bool AutoSegment::isSpinBottom() const; + //! \sreturn \true if segment is connected to turns and both perpandiculars segments + //! are in the \e bottom layer (candidate for reduction). + + //! \function bool AutoSegment::isSpinTopOrBottom() const; + //! \sreturn \true if segment is either spin top or spin bottom + //! (candidate for reduction). + + //! \function bool AutoSegment::isReduced() const; + //! \sreturn \true if segment is actually in a reduced state: it's effective layer + //! will be the one of it's perpandiculars. + //! \function bool AutoSegment::isStrap() const; //! \sreturn \true if segment has been created from a slackening operation to //! restore the slack of another segment. @@ -427,6 +453,20 @@ // \function bool AutoSegment::canDesalignate( AutoContact* contact ) const; // \sreturn \true if \c contact restrict the slack of the segment. + //! \function bool AutoSegment::canReduce() const; + //! \sreturn \true if the segment can be reduced. That is: + //! - Source & target are AutoContactTurn. + //! - It is either spin top or spin bottom, that is + //! connecting perpandiculars both in the same layer. + //! - Has a length less or equal one pitch in the perpandicular direction. + //! - Neither of the perpandicular are also reduceds. + + //! \function bool AutoSegment::mustRaise() const; + //! \sreturn \true if the segment must \e be reduced. That is: + //! - It is in reduced state... + //! - It is no longer spin top or spin bottom. + //! - It's length exceed one pitch in the perpandicular direction. + //! \function bool AutoSegment::canSlacken( unsigned int flags=0 ) const; //! \sreturn \true if the segment can be slackened. That is, source or target constraints //! are less than three pitches. @@ -806,6 +846,40 @@ //! Perform operations that must be done before the actual destructor is //! called. Merely whidrawn the AutoSegment from the lookup/Session mechanism. + //! \function bool AutoSegment::reduce (); + //! Sets the segment into reduced state. + //! + //! \sreturn \true if the operation did succeed. The layer will not be actually changed + //! until the Katabatic database is saved/destroyed. + //! + //! A segment can be reduced if: + //! - Source & target are AutoContactTurn. + //! - It is either spin top or spin bottom, that is + //! connecting perpandiculars both in the same layer. + //! - Has a length less or equal one pitch in the perpandicular direction. + //! - Neither of the perpandicular are also reduceds. + //! + //! \image html reduce-1.png "Reduce Example" + //! + //! If segment \c id:12 is reduced, it prevents \c id:10 & \c id:14 to + //! be also reduced, by increasing the \c _reduced counter. In this + //! example \c id:14 is spin top and \c id:12 is spin bottom. + //! + //! If we reduce two adjacent segments, one will go up while the other + //! will go down (they will actually exchange their layers), it will + //! thus defeat the purpose of creating a same layer dogleg. + //! Besides, the turn contact between them will be changed into a pure + //! metal one, generating a disconnexion... + //! + //! \see AutoSegment::raise() + + //! \function bool AutoSegment::raise (); + //! Get a segment out of \e reduced state. + //! + //! \sreturn \true if a state change did really take place. + //! + //! \see AutoSegment::reduce() + //! \function AutoSegment* AutoSegment::makeDogleg ( AutoContact* from ); //! \param from The AutoContact \e from which we want to make a dogleg. //! @@ -969,4 +1043,11 @@ //! //! \image html _slacken-2.png "slacken() for an Horizontal (special cases)" + //! \function bool AutoSegment::reduceDoglegLayer (); + //! + //! Perform the actual layer change on a reduced segment. This method is to + //! be called juste before destroying the Katabatic database. + //! + //! \sreturn \true if a change occurs. + } diff --git a/katabatic/doc/footer.html b/katabatic/doc/footer.html index 278fc286..370bdc83 100644 --- a/katabatic/doc/footer.html +++ b/katabatic/doc/footer.html @@ -9,7 +9,7 @@ - +
              Katabatic - Routing ToolboxCopyright © 2008-2015 UPMC. All rights reservedCopyright © 2008-2016 UPMC. All rights reserved
              diff --git a/katabatic/doc/images/reduce-1.fig b/katabatic/doc/images/reduce-1.fig new file mode 100644 index 00000000..c378c196 --- /dev/null +++ b/katabatic/doc/images/reduce-1.fig @@ -0,0 +1,108 @@ +#FIG 3.2 Produced by xfig version 3.2.5c +Landscape +Center +Inches +Letter +100.00 +Single +-2 +1200 2 +0 32 #ffffde +6 450 900 750 2250 +2 1 0 1 1 32 50 -1 -1 4.000 0 0 -1 0 0 2 + 525 1125 675 975 +2 1 0 1 1 32 50 -1 -1 4.000 0 0 -1 0 0 2 + 525 1200 675 1050 +2 1 0 1 1 32 50 -1 -1 4.000 0 0 -1 0 0 2 + 525 1275 675 1125 +2 1 0 1 1 32 50 -1 -1 4.000 0 0 -1 0 0 2 + 525 1350 675 1200 +2 1 0 1 1 32 50 -1 -1 4.000 0 0 -1 0 0 2 + 525 1425 675 1275 +2 1 0 1 1 32 50 -1 -1 4.000 0 0 -1 0 0 2 + 525 1500 675 1350 +2 1 0 1 1 32 50 -1 -1 4.000 0 0 -1 0 0 2 + 525 1575 675 1425 +2 1 0 1 1 32 50 -1 -1 4.000 0 0 -1 0 0 2 + 525 1650 675 1500 +2 1 0 1 1 32 50 -1 -1 4.000 0 0 -1 0 0 2 + 525 1725 675 1575 +2 1 0 1 1 32 50 -1 -1 4.000 0 0 -1 0 0 2 + 525 1800 675 1650 +2 1 0 1 1 32 50 -1 -1 4.000 0 0 -1 0 0 2 + 525 1875 675 1725 +2 1 0 1 1 32 50 -1 -1 4.000 0 0 -1 0 0 2 + 525 1950 675 1800 +2 1 0 1 1 32 50 -1 -1 4.000 0 0 -1 0 0 2 + 525 2025 675 1875 +2 1 0 1 1 32 50 -1 -1 4.000 0 0 -1 0 0 2 + 525 2100 675 1950 +2 1 0 1 1 32 50 -1 -1 4.000 0 0 -1 0 0 2 + 525 2175 675 2025 +2 1 0 1 1 32 50 -1 -1 4.000 0 0 -1 0 0 2 + 525 1050 600 975 +2 1 0 1 1 32 50 -1 -1 4.000 0 0 -1 0 0 2 + 600 2175 675 2100 +2 2 0 2 1 32 50 -1 -1 6.000 0 0 -1 0 0 5 + 525 975 675 975 675 2175 525 2175 525 975 +-6 +1 2 3 1 4 7 40 -1 -1 4.000 1 0.0000 1800 1800 375 900 1425 1800 2175 1800 +2 2 0 4 0 32 40 -1 -1 10.000 0 0 -1 0 0 5 + 525 1125 675 1125 675 1275 525 1275 525 1125 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 4 + 1050 1200 1050 900 1350 900 1350 1200 +2 1 0 2 1 7 50 -1 -1 0.000 0 0 -1 0 0 2 + 675 1200 1800 1200 +2 1 0 4 0 32 40 -1 -1 0.000 0 0 -1 0 0 3 + 1650 1200 1800 1200 1800 1350 +2 1 0 2 4 7 50 -1 -1 0.000 0 0 -1 0 0 2 + 1800 1200 1800 2400 +2 1 0 4 0 32 40 -1 -1 0.000 0 0 -1 0 0 3 + 1950 2400 1800 2400 1800 2250 +2 1 0 2 1 7 50 -1 -1 0.000 0 0 -1 0 0 2 + 1875 2400 3000 2400 +2 1 0 4 0 32 40 -1 -1 0.000 0 0 -1 0 0 3 + 2850 2400 3000 2400 3000 2550 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 4 + 1800 1650 2100 1650 2100 1950 1800 1950 +2 1 0 2 4 7 50 -1 -1 0.000 0 0 -1 0 0 2 + 3000 2400 3000 3600 +2 1 0 2 1 7 50 -1 -1 0.000 0 0 -1 0 0 2 + 3000 3600 4125 3600 +2 1 0 4 0 32 40 -1 -1 0.000 0 0 -1 0 0 3 + 3150 3600 3000 3600 3000 3450 +2 1 0 4 0 32 40 -1 -1 0.000 0 0 -1 0 0 3 + 4050 3600 4200 3600 4200 3750 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 4 + 3000 2850 3300 2850 3300 3150 3000 3150 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 4 + 2250 2400 2250 2100 2550 2100 2550 2400 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 4 + 3450 3600 3450 3300 3750 3300 3750 3600 +2 1 0 1 4 7 40 -1 -1 4.000 0 0 -1 0 0 2 + 2025 1050 2400 900 +2 1 1 1 0 7 40 -1 -1 4.000 0 0 -1 0 0 2 + 1875 1200 4200 1200 +2 1 1 1 0 7 40 -1 -1 4.000 0 0 -1 0 0 2 + 3075 2400 4200 2400 +2 1 0 1 0 7 40 -1 -1 4.000 0 0 -1 1 1 2 + 0 0 1.00 60.00 120.00 + 0 0 1.00 60.00 120.00 + 4125 1200 4125 2400 +2 2 0 0 0 32 70 -1 21 2.000 0 0 -1 0 0 5 + 0 600 5700 600 5700 5100 0 5100 0 600 +4 1 0 50 -1 14 12 0.0000 4 120 240 1950 1875 12\001 +4 1 0 50 -1 14 12 0.0000 4 120 240 2400 2325 14\001 +4 1 0 50 -1 14 12 0.0000 4 120 240 3150 3075 16\001 +4 1 0 50 -1 14 12 0.0000 4 120 240 3600 3525 18\001 +4 1 0 50 -1 14 12 0.0000 4 120 240 1200 1125 10\001 +4 1 0 50 -1 14 12 0.0000 4 120 360 1200 1425 r:1\001 +4 1 0 50 -1 14 12 1.5708 4 120 360 1725 1800 r:0\001 +4 1 0 50 -1 14 12 1.5708 4 120 360 2925 3000 r:0\001 +4 1 0 50 -1 14 12 0.0000 4 120 360 3600 3825 r:0\001 +4 1 0 50 -1 14 12 0.0000 4 120 360 2400 2625 r:1\001 +4 1 0 50 -1 14 12 0.0000 4 120 120 2250 1875 R\001 +4 0 4 40 -1 16 12 0.0000 4 195 2280 2475 900 Segment id:12 is reduced.\001 +4 0 0 40 -1 16 12 0.0000 4 195 4950 300 4500 As segment id:12 is reduced, reduced count is increased\001 +4 0 0 40 -1 16 12 0.0000 4 195 5175 300 4800 on segments id:10 and id:14 which then cannot be reduced.\001 +4 1 0 40 -1 16 12 1.5708 4 195 915 4050 1800 1 M2 pitch\001 diff --git a/katabatic/doc/images/reduce-1.pdf b/katabatic/doc/images/reduce-1.pdf new file mode 100644 index 00000000..60749cee Binary files /dev/null and b/katabatic/doc/images/reduce-1.pdf differ diff --git a/katabatic/doc/images/reduce-1.png b/katabatic/doc/images/reduce-1.png new file mode 100644 index 00000000..6b5f757e Binary files /dev/null and b/katabatic/doc/images/reduce-1.png differ diff --git a/katabatic/src/AutoContact.cpp b/katabatic/src/AutoContact.cpp index fd8cf99e..b7542078 100644 --- a/katabatic/src/AutoContact.cpp +++ b/katabatic/src/AutoContact.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -89,7 +89,7 @@ namespace Katabatic { { restoreNativeConstraintBox(); - ltrace(90) << "Native CBox: " << this + cdebug.log(145) << "Native CBox: " << this << " <" << DbU::toLambda(getCBXMin()) << " " << DbU::toLambda(getCBYMin()) << " " << DbU::toLambda(getCBXMax()) @@ -98,7 +98,7 @@ namespace Katabatic { Session::link( this ); invalidate( KbTopology ); - ltrace(90) << "AutoContact::_postCreate() - " << this << " in " << _gcell << endl; + cdebug.log(145) << "AutoContact::_postCreate() - " << this << " in " << _gcell << endl; } @@ -111,9 +111,9 @@ namespace Katabatic { void AutoContact::_preDestroy () { - DebugSession::open( _contact->getNet() ); + DebugSession::open( _contact->getNet(), 140, 150 ); - ltrace(90) << "AutoContact::_preDestroy() - " << endl; + cdebug.log(145) << "AutoContact::_preDestroy() - " << endl; #if 0 bool canDestroyBase = true; @@ -180,18 +180,22 @@ namespace Katabatic { { return new AutoSegments_CachedOnContact(this); } + AutoSegment* AutoContact::getPerpandicular ( const AutoSegment* ) const + { return NULL; } + + unsigned int AutoContact::getMinDepth () const { size_t minDepth = (size_t)-1; Component* anchor = getAnchor (); if (anchor) { minDepth = std::min( minDepth, Session::getRoutingGauge()->getLayerDepth(anchor->getLayer()) ); - //ltrace(200) << "Anchor:" << anchor << endl; + //cdebug.log(149) << "Anchor:" << anchor << endl; } forEach ( AutoSegment*, isegment, const_cast(this)->getAutoSegments() ) { minDepth = std::min( minDepth, Session::getRoutingGauge()->getLayerDepth(isegment->getLayer()) ); - //ltrace(200) << "Slave:" << *icomponent << endl; + //cdebug.log(149) << "Slave:" << *icomponent << endl; } return (unsigned int)minDepth; @@ -204,12 +208,12 @@ namespace Katabatic { Component* anchor = getAnchor (); if ( anchor ) { maxDepth = std::max ( maxDepth, Session::getRoutingGauge()->getLayerDepth(anchor->getLayer()) ); - //ltrace(200) << "Anchor:" << anchor << endl; + //cdebug.log(149) << "Anchor:" << anchor << endl; } forEach ( AutoSegment*, isegment, const_cast(this)->getAutoSegments() ) { maxDepth = std::max ( maxDepth, Session::getRoutingGauge()->getLayerDepth(isegment->getLayer()) ); - //ltrace(200) << "Slave:" << *icomponent << endl; + //cdebug.log(149) << "Slave:" << *icomponent << endl; } return (unsigned int)maxDepth; @@ -255,7 +259,11 @@ namespace Katabatic { Box AutoContact::getNativeConstraintBox () const - { return isFixed() ? Box(_contact->getPosition()) : _gcell->getBoundingBox(); } + { + if (isUserNativeConstraints()) return getConstraintBox(); + if (isFixed()) return Box(_contact->getPosition()); + return _gcell->getBoundingBox(); + } Interval AutoContact::getNativeUConstraints ( unsigned int direction ) const @@ -288,8 +296,7 @@ namespace Katabatic { void AutoContact::invalidate ( unsigned int flags ) { if (not isInvalidated()) { - ltrace(110) << "AutoContact::invalidate() - " << this << endl; - ltracein(110); + cdebug.log(145,1) << "AutoContact::invalidate() - " << this << endl; setFlags( CntInvalidated ); if (flags & KbTopology ) setFlags( CntInvalidatedCache ); Session::invalidate( this ); @@ -299,7 +306,7 @@ namespace Katabatic { // isegment->invalidate(); getGCell()->invalidate(); - ltraceout(110); + cdebug.tabw(145,-1); } } @@ -311,14 +318,14 @@ namespace Katabatic { _gcell = gcell; if (_gcell) { - ltrace(110) << "AutoContact::setGCell() " << gcell << endl; + cdebug.log(145) << "AutoContact::setGCell() " << gcell << endl; _gcell->addContact( this ); _contact->setPosition( _gcell->getCenter() ); _dxMin = 0; _dyMin = 0; _dxMax = (int)DbU::toLambda( _gcell->getXMax()-_gcell->getX() ); _dyMax = (int)DbU::toLambda( _gcell->getYMax()-_gcell->getY() ); - ltrace(110) << "* deltas: [" << _dxMin << " " << _dyMin << " " << _dxMax << " " << _dyMax << "]" << endl; + cdebug.log(145) << "* deltas: [" << _dxMin << " " << _dyMin << " " << _dxMax << " " << _dyMax << "]" << endl; } else { cerr << Bug( "NULL GCell for %s.", _getString().c_str() ) << endl; } @@ -388,7 +395,7 @@ namespace Katabatic { void AutoContact::checkTopology () { - //ltrace(110) << "checkTopology() NOT RE-IMPLEMENTED YET " << this << endl; + //cdebug.log(145) << "checkTopology() NOT RE-IMPLEMENTED YET " << this << endl; } @@ -401,7 +408,7 @@ namespace Katabatic { bool AutoContact::canMoveUp ( const AutoSegment* moved ) const { - ltrace(200) << "AutoContact::canMoveUp() " << this << endl; + cdebug.log(149) << "AutoContact::canMoveUp() " << this << endl; size_t viaDepth = 100; RoutingGauge* rg = Session::getRoutingGauge(); @@ -410,7 +417,7 @@ namespace Katabatic { Component* anchor = getAnchor(); if (anchor) { viaDepth = rg->getLayerDepth( anchor->getLayer() ); - ltrace(200) << "| Anchor depth: " << viaDepth << endl; + cdebug.log(149) << "| Anchor depth: " << viaDepth << endl; } forEach ( AutoSegment*, isegment, const_cast(this)->getAutoSegments() ) { @@ -421,7 +428,7 @@ namespace Katabatic { else if (viaDepth != depth) return false; - ltrace(200) << "| Segment depth: " << depth << endl; + cdebug.log(149) << "| Segment depth: " << depth << endl; } return (movedDepth+1 == viaDepth); @@ -434,8 +441,8 @@ namespace Katabatic { setCBXMax ( box.getXMax() ); setCBYMin ( box.getYMin() ); setCBYMax ( box.getYMax() ); - ltrace(110) << "setConstraintBox() - " << this << " " << getConstraintBox() << endl; - ltrace(110) << "* " << _gcell << endl; + cdebug.log(149) << "setConstraintBox() - " << this << " " << getConstraintBox() << endl; + cdebug.log(149) << "* " << _gcell << endl; } @@ -444,6 +451,7 @@ namespace Katabatic { , unsigned int flags ) { + cdebug.log(149) << "restrictConstraintBox() - " << this << " " << getConstraintBox() << endl; if (flags & KbHorizontal) { if ( (constraintMin > getCBYMax()) or (constraintMax < getCBYMin()) ) { if ( Session::isInDemoMode() or not (flags & KbWarnOnError) ) return false; @@ -483,7 +491,7 @@ namespace Katabatic { setCBXMin ( std::max(getCBXMin(),constraintMin) ); setCBXMax ( std::min(getCBXMax(),constraintMax) ); } - ltrace(110) << "restrictConstraintBox() - " << this << " " << getConstraintBox() << endl; + cdebug.log(149) << "restrictConstraintBox() - " << this << " " << getConstraintBox() << endl; return true; } @@ -496,6 +504,23 @@ namespace Katabatic { { return box = box.getIntersection ( getConstraintBox() ); } + void AutoContact::migrateConstraintBox ( AutoContact* other ) + { + if (_gcell != other->_gcell) { + cerr << Error( "AutoContact::migrateConstraintBox(): AutoContacts do not belongs to the same GCell:\n" + " from: %s\n" + " to: %s" + , getString(other).c_str() + , getString(this ).c_str() + ) << endl; + return; + } + + setConstraintBox( other->getConstraintBox() ); + other->restoreNativeConstraintBox(); + } + + Box AutoContact::getBoundingBox () const { return _gcell->getBoundingBox (); } @@ -588,6 +613,8 @@ namespace Katabatic { s.insert( s.size()-1, (isVTee ())? "v": "-" ); s.insert( s.size()-1, (isInvalidated ())? "i": "-" ); s.insert( s.size()-1, (isInvalidatedCache())? "c": "-" ); + + //s.insert( s.size()-1, getString(getConstraintBox())); return s; } diff --git a/katabatic/src/AutoContactHTee.cpp b/katabatic/src/AutoContactHTee.cpp index a10959a7..8c73d090 100644 --- a/katabatic/src/AutoContactHTee.cpp +++ b/katabatic/src/AutoContactHTee.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2012-2015, All Rights Reserved +// Copyright (c) UPMC 2012-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -41,8 +41,6 @@ namespace Katabatic { using Hurricane::Bug; using Hurricane::Error; using Hurricane::DebugSession; - using Hurricane::ltracein; - using Hurricane::ltraceout; // ------------------------------------------------------------------- @@ -64,7 +62,7 @@ namespace Katabatic { autoContact->_postCreate(); autoContact->unsetFlags( CntInCreationStage ); - ltrace(90) << "create(net*) " << autoContact << endl; + cdebug.log(145) << "create(net*) " << autoContact << endl; return autoContact; } @@ -91,6 +89,10 @@ namespace Katabatic { } + AutoSegment* AutoContactHTee::getPerpandicular ( const AutoSegment* ) const + { return NULL; } + + AutoSegment* AutoContactHTee::getSegment ( unsigned int index ) const { AutoSegment* segment = NULL; @@ -122,12 +124,25 @@ namespace Katabatic { void AutoContactHTee::cacheDetach ( AutoSegment* segment ) { - ltrace(110) << _getTypeName() << "::_cacheDetach() " << this << endl; + cdebug.log(145) << _getTypeName() << "::cacheDetach() " << this << endl; + cdebug.log(145) << "| h1:" << _horizontal1 << endl; + cdebug.log(145) << "| h2:" << _horizontal2 << endl; + cdebug.log(145) << "| v1:" << _vertical1 << endl; if (segment == _horizontal1) _horizontal1 = NULL; else if (segment == _horizontal2) _horizontal2 = NULL; else if (segment == _vertical1) _vertical1 = NULL; - else return; + else { + if (_horizontal1 or _horizontal2 or _vertical1) + cerr << Bug( "%s::cacheDetach() On %s,\n" + " Cannot detach %s\n" + " because it *not* attached to this contact." + , _getTypeName().c_str() + , getString(this).c_str() + , getString(segment).c_str() + ) << endl; + return; + } setFlags( CntInvalidatedCache ); } @@ -135,9 +150,8 @@ namespace Katabatic { void AutoContactHTee::cacheAttach ( AutoSegment* segment ) { - ltrace(110) << _getTypeName() << "::cacheAttach() " << this << endl; - ltracein(110); - ltrace(110) << "Attaching: " << segment << endl; + cdebug.log(145,1) << _getTypeName() << "::cacheAttach() " << this << endl; + cdebug.log(145) << "Attaching: " << segment << endl; if (segment->getDirection() == KbHorizontal) { if (not _horizontal1) _horizontal1 = static_cast(segment); @@ -147,7 +161,7 @@ namespace Katabatic { " h1 & h2 cache have not been cleared first, cancelled." , _getTypeName().c_str(), getString(this).c_str() ) << endl; - ltraceout(110); + cdebug.tabw(145,-1); return; } } else if (segment->getDirection() == KbVertical) { @@ -156,7 +170,7 @@ namespace Katabatic { " v1 cache has not been cleared first, cancelled." , _getTypeName().c_str(), getString(this).c_str() ) << endl; - ltraceout(110); + cdebug.tabw(145,-1); return; } _vertical1 = static_cast(segment); @@ -165,16 +179,19 @@ namespace Katabatic { if (_horizontal1 and _horizontal2 and _vertical1) unsetFlags( CntInvalidatedCache ); - ltraceout(110); + cdebug.log(145) << "| h1:" << _horizontal1 << endl; + cdebug.log(145) << "| h2:" << _horizontal2 << endl; + cdebug.log(145) << "| v1:" << _vertical1 << endl; + + cdebug.tabw(145,-1); } void AutoContactHTee::updateCache () { - DebugSession::open( getNet(), 80 ); + DebugSession::open( getNet(), 140, 150 ); - ltrace(110) << _getTypeName() << "::updateCache() " << this << endl; - ltracein(110); + cdebug.log(145,1) << _getTypeName() << "::updateCache() " << this << endl; Component* anchor; Horizontal** horizontals = new Horizontal* [3]; @@ -207,30 +224,29 @@ namespace Katabatic { } unsetFlags( CntInvalidatedCache ); - ltrace(110) << "h1:" << _horizontal1 << endl; - ltrace(110) << "h2:" << _horizontal2 << endl; - ltrace(110) << "v1:" << _vertical1 << endl; + cdebug.log(145) << "h1:" << _horizontal1 << endl; + cdebug.log(145) << "h2:" << _horizontal2 << endl; + cdebug.log(145) << "v1:" << _vertical1 << endl; delete [] horizontals; delete [] verticals; - ltraceout(110); + cdebug.tabw(145,-1); DebugSession::close(); } void AutoContactHTee::updateGeometry () { - DebugSession::open( getNet(), 80 ); + DebugSession::open( getNet(), 140, 150 ); - ltrace(110) << _getTypeName() << "::updateGeometry() " << this << endl; - ltracein(110); + cdebug.log(145,1) << _getTypeName() << "::updateGeometry() " << this << endl; if (isInvalidatedCache()) updateCache(); if (isInvalidatedCache()) { cerr << Error( "%s::updateGeometry() %s: Unable to restore cache." , _getTypeName().c_str(), getString(this).c_str() ) << endl; - ltraceout(110); + cdebug.tabw(145,-1); return; } @@ -242,23 +258,22 @@ namespace Katabatic { setY( getHorizontal1()->getY() ); } - ltraceout(110); + cdebug.tabw(145,-1); DebugSession::close(); } void AutoContactHTee::updateTopology () { - DebugSession::open( getNet(), 80 ); + DebugSession::open( getNet(), 140, 150 ); - ltrace(110) << _getTypeName() << "::updateTopology() " << this << endl; - ltracein(110); + cdebug.log(145,1) << _getTypeName() << "::updateTopology() " << this << endl; if (isInvalidatedCache()) updateCache(); if (isInvalidatedCache()) { cerr << Error( "%s::updateGeometry() %s: Unable to restore cache." , _getTypeName().c_str(), getString(this).c_str() ) << endl; - ltraceout(110); + cdebug.tabw(145,-1); return; } @@ -271,7 +286,9 @@ namespace Katabatic { size_t maxDepth = std::max( depthV1, std::max(depthH1,depthH2) ); size_t delta = maxDepth - minDepth; - ltrace(110) << "delta:" << delta << endl; + cdebug.log(145) << "delta:" << delta << endl; + + unsetFlags( CntWeakTerminal ); if (maxDepth - minDepth > 3) { showTopologyError( "Sheared HTee, layer delta exceed 3." ); @@ -296,12 +313,12 @@ namespace Katabatic { setLayer( rg->getContactLayer( depthH2 + ((depthH2( _horizontal1->makeDogleg(this) ); _horizontal1->makeDogleg(this); - ltrace(110) << "New h1:" << _horizontal1 << endl; + cdebug.log(145) << "New h1:" << _horizontal1 << endl; } else { setLayer( rg->getContactLayer( depthH1 + ((depthH1( _horizontal2->makeDogleg(this) ); _horizontal2->makeDogleg(this); - ltrace(110) << "New h2:" << _horizontal2 << endl; + cdebug.log(145) << "New h2:" << _horizontal2 << endl; } } } @@ -311,7 +328,7 @@ namespace Katabatic { _vertical1 ->invalidate( this ); } - ltraceout(110); + cdebug.tabw(145,-1); DebugSession::close(); } diff --git a/katabatic/src/AutoContactTerminal.cpp b/katabatic/src/AutoContactTerminal.cpp index c693fa88..c79d8e83 100644 --- a/katabatic/src/AutoContactTerminal.cpp +++ b/katabatic/src/AutoContactTerminal.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2012-2015, All Rights Reserved +// Copyright (c) UPMC 2012-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -44,9 +44,8 @@ namespace Katabatic { using Hurricane::Bug; using Hurricane::Error; using Hurricane::DebugSession; + using Hurricane::Transformation; using Hurricane::Entity; - using Hurricane::ltracein; - using Hurricane::ltraceout; // ------------------------------------------------------------------- @@ -61,9 +60,8 @@ namespace Katabatic { , DbU::Unit height ) { - ltrace(90) << "AutoContactTerminal::create(... Point, ...)" << endl; - ltracein(90); - ltrace(90) << "@" << point << endl; + cdebug.log(145,1) << "AutoContactTerminal::create(... Point, ...)" << endl; + cdebug.log(145) << "@" << point << endl; anchor->getBodyHook()->detach(); @@ -73,7 +71,7 @@ namespace Katabatic { , point.getX(), point.getY() , width, height ); - ltraceout(90); + cdebug.tabw(145,-1); return autoContact; } @@ -87,8 +85,8 @@ namespace Katabatic { , const DbU::Unit height ) { - ltrace(90) << "AutoContactTerminal::create(... x, y, ...)" << endl; - ltrace(90) << "@ x:" << DbU::getValueString(x) << " y:" << DbU::getValueString(y) << endl; + cdebug.log(145) << "AutoContactTerminal::create(... x, y, ...)" << endl; + cdebug.log(145) << "@ x:" << DbU::getValueString(x) << " y:" << DbU::getValueString(y) << endl; Point anchorPosition = anchor->getPosition(); @@ -104,7 +102,7 @@ namespace Katabatic { autoContact->_postCreate(); autoContact->unsetFlags( CntInCreationStage ); - ltrace(90) << "create(Component*) " << autoContact << endl; + cdebug.log(145) << "create(Component*) " << autoContact << endl; return autoContact; } @@ -125,6 +123,10 @@ namespace Katabatic { { return NULL; } + AutoSegment* AutoContactTerminal::getPerpandicular ( const AutoSegment* ) const + { return NULL; } + + AutoSegment* AutoContactTerminal::getSegment ( unsigned int index ) const { if (_segment) { @@ -139,9 +141,12 @@ namespace Katabatic { Box AutoContactTerminal::getNativeConstraintBox () const { + cdebug.log(145,1) << "AutoContactTerminal::getNativeConstraintBox()" << endl; + Component* component = getAnchor(); if (component == NULL) { cerr << Error( "%s is not anchored.", getString(this).c_str() ) << endl; + cdebug.tabw(145,-1); return _gcell->getBoundingBox (); } @@ -154,32 +159,60 @@ namespace Katabatic { RoutingPad* routingPad; if ( (horizontal = dynamic_cast(component)) ) { + cdebug.log(145) << "Anchor: " << horizontal << "@" << horizontal->getSourcePosition() << endl; xMin = horizontal->getSourcePosition().getX(); xMax = horizontal->getTargetPosition().getX(); yMin = yMax = horizontal->getTargetPosition().getY(); } else if ( (vertical = dynamic_cast(component)) ) { + cdebug.log(145) << "Anchor: " << vertical << "@" << vertical->getSourcePosition() << endl; yMin = vertical->getSourcePosition().getY(); yMax = vertical->getTargetPosition().getY(); xMin = xMax = vertical->getTargetPosition().getX(); } else if ( (routingPad = dynamic_cast(component)) ) { - Entity* entity = routingPad->getOccurrence().getEntity(); + Entity* entity = routingPad->getOccurrence().getEntity(); + Transformation transf = routingPad->getOccurrence().getPath().getTransformation(); + cdebug.log(145) << "Anchor: " << routingPad << endl; - // Assumes there is no rotation in the Transformation. - if ( dynamic_cast(entity) ) { - xMin = routingPad->getSourcePosition().getX(); - xMax = routingPad->getTargetPosition().getX(); - yMin = yMax - = routingPad->getTargetPosition().getY(); + int rpOrient = 1; + switch ( transf.getOrientation() ) { + case Transformation::Orientation::R1: + case Transformation::Orientation::R3: + case Transformation::Orientation::XR: + case Transformation::Orientation::YR: + rpOrient = 2; + break; + default: + break; + } + + if (dynamic_cast(entity)) { + // rpOrient *is* the rotation. } else if ( dynamic_cast(entity) ) { - yMin = routingPad->getSourcePosition().getY(); - yMax = routingPad->getTargetPosition().getY(); - xMin = xMax - = routingPad->getTargetPosition().getX(); + // rpOrient is the inverse rotation. + rpOrient = (rpOrient == 1) ? 2 : 1; } else { - xMin = xMax = routingPad->getPosition().getX(); - yMin = yMax = routingPad->getPosition().getY(); + rpOrient = 0; + } + + switch ( rpOrient ) { + case 1: + xMin = routingPad->getSourcePosition().getX(); + xMax = routingPad->getTargetPosition().getX(); + yMin = yMax + = routingPad->getTargetPosition().getY(); + break; + case 2: + yMin = routingPad->getSourcePosition().getY(); + yMax = routingPad->getTargetPosition().getY(); + xMin = xMax + = routingPad->getTargetPosition().getX(); + break; + default: + xMin = xMax = routingPad->getPosition().getX(); + yMin = yMax = routingPad->getPosition().getY(); + break; } } else { xMin = xMax = component->getPosition().getX(); @@ -189,6 +222,10 @@ namespace Katabatic { order( xMin, xMax ); order( yMin, yMax ); + cdebug.log(145) << "| Using (y): " << DbU::getValueString(yMin) << " " + << DbU::getValueString(yMax) << endl; + + cdebug.tabw(145,-1); return Box( xMin, yMin, xMax, yMax ); } @@ -224,10 +261,9 @@ namespace Katabatic { void AutoContactTerminal::updateCache () { - DebugSession::open( getNet(), 80 ); + DebugSession::open( getNet(), 140, 150 ); - ltrace(110) << _getTypeName() << "::updateCache() " << this << endl; - ltracein(110); + cdebug.log(145,1) << _getTypeName() << "::updateCache() " << this << endl; Component* anchor; Horizontal** horizontals = new Horizontal* [2]; @@ -264,28 +300,27 @@ namespace Katabatic { throw Error( os.str() ); } unsetFlags( CntInvalidatedCache ); - ltrace(110) << "seg:" << _segment << endl; + cdebug.log(145) << "seg:" << _segment << endl; delete [] horizontals; delete [] verticals; - ltraceout(110); + cdebug.tabw(145,-1); DebugSession::close(); } void AutoContactTerminal::updateGeometry () { - DebugSession::open( getNet(), 80 ); + DebugSession::open( getNet(), 140, 150 ); - ltrace(110) << _getTypeName() << "::updateGeometry() " << this << endl; - ltracein(110); + cdebug.log(145,1) << _getTypeName() << "::updateGeometry() " << this << endl; if (isInvalidatedCache()) updateCache(); if (isInvalidatedCache()) { cerr << Error( "%s::updateGeometry() %s: Unable to restore cache." , _getTypeName().c_str(), getString(this).c_str() ) << endl; - ltraceout(110); + cdebug.tabw(145,-1); return; } @@ -296,7 +331,7 @@ namespace Katabatic { if (not hasBadTopology()) { if (_segment->isHorizontal()) { if (not getUConstraints(KbVertical).contains(_segment->getY())) { - ltrace(110) << "Cached: " << _segment << endl; + cdebug.log(145) << "Cached: " << _segment << endl; message << "Terminal horizontal segment Y " << DbU::getValueString(_segment->getY()) << " axis is outside RoutingPad " << getUConstraints(KbVertical) << "."; @@ -307,7 +342,7 @@ namespace Katabatic { setY( _segment->getY() ); } else { if (not getUConstraints(KbHorizontal).contains(_segment->getX())) { - ltrace(110) << "Cached: " << _segment << endl; + cdebug.log(145) << "Cached: " << _segment << endl; message << "Terminal vertical segment X" << DbU::getValueString(_segment->getX()) << " axis is outside RoutingPad " << getUConstraints(KbHorizontal) << "."; @@ -319,23 +354,22 @@ namespace Katabatic { } } - ltraceout(110); + cdebug.tabw(145,-1); DebugSession::close(); } void AutoContactTerminal::updateTopology () { - DebugSession::open( getNet(), 80 ); + DebugSession::open( getNet(), 140, 150 ); - ltrace(110) << _getTypeName() << "::updateTopology() " << this << endl; - ltracein(110); + cdebug.log(145,1) << _getTypeName() << "::updateTopology() " << this << endl; if (isInvalidatedCache()) updateCache(); if (isInvalidatedCache()) { cerr << Error( "%s::updateGeometry() %s: Unable to restore cache." , _getTypeName().c_str(), getString(this).c_str() ) << endl; - ltraceout(110); + cdebug.tabw(145,-1); return; } @@ -352,7 +386,7 @@ namespace Katabatic { if (delta > 1) { //_segment = _segment->makeDogleg( this ); _segment->makeDogleg( this ); - ltrace(110) << "Update seg: " << _segment << endl; + cdebug.log(145) << "Update seg: " << _segment << endl; delta = abssub( anchorDepth, rg->getLayerDepth( _segment->getLayer() ) ); } else if (delta == 0) setLayer( rg->getRoutingLayer(anchorDepth) ); @@ -360,7 +394,7 @@ namespace Katabatic { } _segment->invalidate( this ); - ltraceout(110); + cdebug.tabw(145,-1); DebugSession::close(); } diff --git a/katabatic/src/AutoContactTurn.cpp b/katabatic/src/AutoContactTurn.cpp index f38fbe5f..1c5d7b06 100644 --- a/katabatic/src/AutoContactTurn.cpp +++ b/katabatic/src/AutoContactTurn.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2012-2015, All Rights Reserved +// Copyright (c) UPMC 2012-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -41,8 +41,6 @@ namespace Katabatic { using Hurricane::Bug; using Hurricane::Error; using Hurricane::DebugSession; - using Hurricane::ltracein; - using Hurricane::ltraceout; // ------------------------------------------------------------------- @@ -66,7 +64,7 @@ namespace Katabatic { autoContact->_postCreate(); autoContact->unsetFlags( CntInCreationStage ); - ltrace(90) << "create(net*) " << autoContact << endl; + cdebug.log(145) << "create(net*) " << autoContact << endl; return autoContact; } @@ -88,6 +86,14 @@ namespace Katabatic { { return NULL; } + AutoSegment* AutoContactTurn::getPerpandicular ( const AutoSegment* reference ) const + { + if (reference == _horizontal1) return _vertical1; + if (reference == _vertical1 ) return _horizontal1; + return NULL; + } + + AutoSegment* AutoContactTurn::getSegment ( unsigned int index ) const { switch ( index ) { @@ -143,10 +149,9 @@ namespace Katabatic { void AutoContactTurn::updateCache () { - DebugSession::open( getNet(), 80 ); + DebugSession::open( getNet(), 140, 150 ); - ltrace(110) << _getTypeName() << "::updateCache() " << this << endl; - ltracein(110); + cdebug.log(145,1) << _getTypeName() << "::updateCache() " << this << endl; Component* anchor; Horizontal** horizontals = new Horizontal* [2]; @@ -170,29 +175,28 @@ namespace Katabatic { } else unsetFlags( CntInvalidatedCache ); - ltrace(110) << "h1:" << _horizontal1 << endl; - ltrace(110) << "v1:" << _vertical1 << endl; + cdebug.log(145) << "h1:" << _horizontal1 << endl; + cdebug.log(145) << "v1:" << _vertical1 << endl; delete [] horizontals; delete [] verticals; - ltraceout(110); + cdebug.tabw(145,-1); DebugSession::close(); } void AutoContactTurn::updateGeometry () { - DebugSession::open( getNet(), 80 ); + DebugSession::open( getNet(), 140, 150 ); - ltrace(110) << _getTypeName() << "::updateGeometry() " << this << endl; - ltracein(110); + cdebug.log(145,1) << _getTypeName() << "::updateGeometry() " << this << endl; if (isInvalidatedCache()) updateCache(); if (isInvalidatedCache()) { cerr << Error( "%s::updateGeometry() %s: Unable to restore cache." , _getTypeName().c_str(), getString(this).c_str() ) << endl; - ltraceout(110); + cdebug.tabw(145,-1); return; } @@ -204,23 +208,22 @@ namespace Katabatic { setY( getHorizontal1()->getY() ); } - ltraceout(110); + cdebug.tabw(145,-1); DebugSession::close(); } void AutoContactTurn::updateTopology () { - DebugSession::open ( getNet(), 80 ); + DebugSession::open ( getNet(), 140, 150 ); - ltrace(110) << _getTypeName() << "::updateTopology() " << this << endl; - ltracein(110); + cdebug.log(145,1) << _getTypeName() << "::updateTopology() " << this << endl; if (isInvalidatedCache()) updateCache(); if (isInvalidatedCache()) { cerr << Error( "%s::updateGeometry() %s: Unable to restore cache." , _getTypeName().c_str(), getString(this).c_str() ) << endl; - ltraceout(110); + cdebug.tabw(145,-1); return; } @@ -231,6 +234,7 @@ namespace Katabatic { size_t depthContact = (depthH1 < depthV1) ? depthH1 : depthH1-1; size_t delta = abssub ( depthH1, depthV1 ); + unsetFlags( CntWeakTerminal ); if (delta > 3) { showTopologyError( "Sheared Turn, layer delta exceed 3." ); setFlags( CntBadTopology ); @@ -240,12 +244,12 @@ namespace Katabatic { //_horizontal1 = static_cast( _horizontal1->makeDogleg(this) ); _horizontal1->makeDogleg(this); depthH1 = rg->getLayerDepth( _horizontal1->getLayer() ); - ltrace(110) << "Update h1: " << _horizontal1 << endl; + cdebug.log(145) << "Update h1: " << _horizontal1 << endl; } else /*if (_vertical1->isInvalidatedLayer())*/ { //_vertical1 = static_cast( _vertical1->makeDogleg(this) ); _vertical1->makeDogleg(this); depthV1 = rg->getLayerDepth( _vertical1->getLayer() ); - ltrace(110) << "Update v1: " << _vertical1 << endl; + cdebug.log(145) << "Update v1: " << _vertical1 << endl; } delta = abssub ( depthH1, depthV1 ); } @@ -257,7 +261,7 @@ namespace Katabatic { _vertical1 ->invalidate( this ); } - ltraceout(110); + cdebug.tabw(145,-1); DebugSession::close (); } diff --git a/katabatic/src/AutoContactVTee.cpp b/katabatic/src/AutoContactVTee.cpp index c355b2e5..5fd4e280 100644 --- a/katabatic/src/AutoContactVTee.cpp +++ b/katabatic/src/AutoContactVTee.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2012-2015, All Rights Reserved +// Copyright (c) UPMC 2012-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -41,8 +41,6 @@ namespace Katabatic { using Hurricane::Bug; using Hurricane::Error; using Hurricane::DebugSession; - using Hurricane::ltracein; - using Hurricane::ltraceout; // ------------------------------------------------------------------- @@ -64,7 +62,7 @@ namespace Katabatic { autoContact->_postCreate(); autoContact->unsetFlags( CntInCreationStage ); - ltrace(90) << "create(net*) " << autoContact << endl; + cdebug.log(145) << "create(net*) " << autoContact << endl; return autoContact; } @@ -91,6 +89,10 @@ namespace Katabatic { } + AutoSegment* AutoContactVTee::getPerpandicular ( const AutoSegment* ) const + { return NULL; } + + AutoSegment* AutoContactVTee::getSegment ( unsigned int index ) const { switch ( index ) { @@ -157,10 +159,9 @@ namespace Katabatic { void AutoContactVTee::updateCache () { - DebugSession::open( getNet(), 80 ); + DebugSession::open( getNet(), 140, 150 ); - ltrace(110) << "AutoContactVTee::updateCache() " << this << endl; - ltracein(110); + cdebug.log(145,1) << "AutoContactVTee::updateCache() " << this << endl; Component* anchor; Horizontal** horizontals = new Horizontal* [3]; @@ -190,30 +191,29 @@ namespace Katabatic { } unsetFlags( CntInvalidatedCache ); - ltrace(110) << "h1:" << _horizontal1 << endl; - ltrace(110) << "v1:" << _vertical1 << endl; - ltrace(110) << "v2:" << _vertical2 << endl; + cdebug.log(145) << "h1:" << _horizontal1 << endl; + cdebug.log(145) << "v1:" << _vertical1 << endl; + cdebug.log(145) << "v2:" << _vertical2 << endl; delete [] horizontals; delete [] verticals; - ltraceout(110); + cdebug.tabw(145,-1); DebugSession::close(); } void AutoContactVTee::updateGeometry () { - DebugSession::open( getNet(), 80 ); + DebugSession::open( getNet(), 140, 150 ); - ltrace(110) << "AutoContactVTee::updateGeometry() " << this << endl; - ltracein(110); + cdebug.log(145,1) << "AutoContactVTee::updateGeometry() " << this << endl; if (isInvalidatedCache()) updateCache(); if (isInvalidatedCache()) { cerr << Error( "%s::updateGeometry() %s: Unable to restore cache." , _getTypeName().c_str(), getString(this).c_str() ) << endl; - ltraceout(110); + cdebug.tabw(145,-1); return; } @@ -225,23 +225,22 @@ namespace Katabatic { setY( getHorizontal1()->getY() ); } - ltraceout(110); + cdebug.tabw(145,-1); DebugSession::close(); } void AutoContactVTee::updateTopology () { - DebugSession::open ( getNet(), 80 ); + DebugSession::open ( getNet(), 140, 150 ); - ltrace(110) << "AutoContactVTee::updateTopology() " << this << endl; - ltracein(110); + cdebug.log(145,1) << "AutoContactVTee::updateTopology() " << this << endl; if (isInvalidatedCache()) updateCache(); if (isInvalidatedCache()) { cerr << Error( "%s::updateGeometry() %s: Unable to restore cache." , _getTypeName().c_str(), getString(this).c_str() ) << endl; - ltraceout(110); + cdebug.tabw(145,-1); return; } @@ -254,22 +253,24 @@ namespace Katabatic { size_t maxDepth = std::max( depthH1, std::max(depthV1,depthV2) ); size_t delta = maxDepth - minDepth; - ltrace(110) << "minDepth:" << minDepth << endl; - ltrace(110) << "maxDepth:" << maxDepth << endl; - ltrace(110) << "delta:" << delta << endl; + cdebug.log(145) << "minDepth:" << minDepth << endl; + cdebug.log(145) << "maxDepth:" << maxDepth << endl; + cdebug.log(145) << "delta:" << delta << endl; + + unsetFlags( CntWeakTerminal ); if ( maxDepth - minDepth > 3 ) { showTopologyError( "Sheared VTee, layer delta exceed 3." ); setFlags( CntBadTopology ); } else { if (depthV1 == depthV2) { - ltrace(110) << "depthV1 == depthV2 (" << depthV1 << ")" << endl; + cdebug.log(145) << "depthV1 == depthV2 (" << depthV1 << ")" << endl; // Dogleg on the horizontal. switch ( delta ) { case 0: setLayer( rg->getRoutingLayer(minDepth) ); break; case 1: setLayer( rg->getContactLayer(minDepth) ); break; default: - ltrace(110) << "Restore connectivity: dogleg on h1." << endl; + cdebug.log(145) << "Restore connectivity: dogleg on h1." << endl; setLayer( rg->getContactLayer( depthV1 + ((depthV1==minDepth)?0:-1) ) ); _horizontal1 = static_cast( _horizontal1->makeDogleg(this) ); break; @@ -296,7 +297,7 @@ namespace Katabatic { _vertical2 ->invalidate( this ); } - ltraceout(110); + cdebug.tabw(145,-1); DebugSession::close (); } diff --git a/katabatic/src/AutoHorizontal.cpp b/katabatic/src/AutoHorizontal.cpp index 8dede65c..2ca1438e 100644 --- a/katabatic/src/AutoHorizontal.cpp +++ b/katabatic/src/AutoHorizontal.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -32,8 +32,6 @@ namespace Katabatic { using std::min; using std::max; - using Hurricane::ltracein; - using Hurricane::ltraceout; using Hurricane::Error; using Hurricane::Bug; using Hurricane::DebugSession; @@ -61,8 +59,8 @@ namespace Katabatic { : AutoSegment(horizontal) , _horizontal(horizontal) { - ltrace(99) << "CTOR AutoHorizontal " << this << endl; - ltrace(99) << " over " << horizontal << endl; + cdebug.log(145) << "CTOR AutoHorizontal " << this << endl; + cdebug.log(145) << " over " << horizontal << endl; } @@ -92,7 +90,13 @@ namespace Katabatic { for ( ; gcell != end ; gcell = gcell->getRight() ) { if ( !gcell ) { - cerr << Error("AutoHorizontal::create() : NULL GCell.") << endl; + cerr << Error( "AutoHorizontal::create() : NULL GCell under %s\n" + " begin:%s\n" + " end: %s" + , getString(this).c_str() + , getString(source->getGCell()).c_str() + , getString(target->getGCell()).c_str() + ) << endl; break; } gcell->addHSegment ( this ); @@ -103,9 +107,9 @@ namespace Katabatic { void AutoHorizontal::_preDestroy () { - ltrace(200) << "AutoHorizontal::_preDestroy() - " << endl; - ltrace(200) << " " << _getString() << endl; - ltracein(90); + cdebug.log(149) << "AutoHorizontal::_preDestroy() - " << endl; + cdebug.log(149) << " " << _getString() << endl; + cdebug.tabw(145,1); if ( not Session::doDestroyTool() ) { AutoContact* source = getAutoSource(); @@ -134,14 +138,14 @@ namespace Katabatic { } AutoSegment::_preDestroy (); - ltraceout(90); + cdebug.tabw(145,-1); } AutoHorizontal::~AutoHorizontal () { if ( Session::doDestroyBaseSegment() and not Session::doDestroyTool() ) { - ltrace(200) << "~AutoHorizontal() - " << endl; + cdebug.log(149) << "~AutoHorizontal() - " << endl; _horizontal->destroy (); } } @@ -173,7 +177,7 @@ namespace Katabatic { constraintMin = contact->getCBYMin(); constraintMax = contact->getCBYMax(); - ltrace(148) << "Source constraints: " << contact << " [" + cdebug.log(149) << "Source constraints: " << contact << " [" << DbU::getValueString(constraintMin) << ":" << DbU::getValueString(constraintMax) << "]" << endl; @@ -182,15 +186,20 @@ namespace Katabatic { constraintMin = max ( constraintMin, contact->getCBYMin() ); constraintMax = min ( constraintMax, contact->getCBYMax() ); - ltrace(148) << "Merge with target constraints: " << contact << " [" - << DbU::getValueString(constraintMin) << ":" - << DbU::getValueString(constraintMax) << "]" + cdebug.log(149) << "Merge with target constraints: " << contact << " [" + << DbU::getValueString(contact->getCBYMin()) << ":" + << DbU::getValueString(contact->getCBYMax()) << "]" << endl; constraintMin = max ( constraintMin, getUserConstraints().getVMin() ); constraintMax = min ( constraintMax, getUserConstraints().getVMax() ); - ltrace(148) << "Merge with user constraints: " << getUserConstraints() << " [" + cdebug.log(149) << "Merge with user constraints: " << getUserConstraints() << " [" + << DbU::getValueString(getUserConstraints().getVMin()) << ":" + << DbU::getValueString(getUserConstraints().getVMax()) << "]" + << endl; + + cdebug.log(149) << "Resulting constraints: " << " [" << DbU::getValueString(constraintMin) << ":" << DbU::getValueString(constraintMax) << "]" << endl; @@ -224,7 +233,7 @@ namespace Katabatic { bool AutoHorizontal::_canSlacken () const { - ltracein(200); + cdebug.tabw(149,1); Interval sourceSide = getAutoSource()->getGCell()->getSide( KbVertical ); Interval targetSide = getAutoTarget()->getGCell()->getSide( KbVertical ); @@ -235,24 +244,24 @@ namespace Katabatic { sourceConstraints.inflate( 1 ); targetConstraints.inflate( 1 ); - ltrace(200) << "source " << getAutoSource() << endl; - ltrace(200) << "source constraints: " << sourceConstraints + cdebug.log(149) << "source " << getAutoSource() << endl; + cdebug.log(149) << "source constraints: " << sourceConstraints << " " << DbU::getValueString(sourceConstraints.getSize()) << endl; - ltrace(200) << "target " << getAutoTarget() << endl; - ltrace(200) << "target constraints: " << targetConstraints + cdebug.log(149) << "target " << getAutoTarget() << endl; + cdebug.log(149) << "target constraints: " << targetConstraints << " " << DbU::getValueString(targetConstraints.getSize()) << endl; - if (not sourceConstraints.contains(sourceSide)) { ltraceout(200); return true; } - if (not targetConstraints.contains(targetSide)) { ltraceout(200); return true; } + if (not sourceConstraints.contains(sourceSide)) { cdebug.tabw(149,-1); return true; } + if (not targetConstraints.contains(targetSide)) { cdebug.tabw(149,-1); return true; } - ltraceout(200); + cdebug.tabw(149,-1); return false; } bool AutoHorizontal::_slacken ( unsigned int flags ) { - ltrace(200) << "AutoHorizontal::_slacken() " << this << endl; + cdebug.log(149) << "AutoHorizontal::_slacken() " << this << endl; if (not isStrongTerminal()) return false; @@ -279,10 +288,10 @@ namespace Katabatic { return false; } - ltracein(200); - ltrace(200) << "_flags:" << (_flags & (SegGlobal|SegWeakGlobal)) << endl; - ltrace(200) << "test:" << (getLength() < 5*getPitch()) << endl; - ltrace(200) << "length:" << DbU::getValueString(getLength()) << endl; + cdebug.tabw(149,1); + cdebug.log(149) << "_flags:" << (_flags & (SegGlobal|SegWeakGlobal)) << endl; + cdebug.log(149) << "test:" << (getLength() < 5*getPitch()) << endl; + cdebug.log(149) << "length:" << DbU::getValueString(getLength()) << endl; int lowSlack = (flags & KbHalfSlacken) ? 3 : 10; bool slackened = false; @@ -297,13 +306,13 @@ namespace Katabatic { int slack = constraints.getSize() / getPitch(); int nativeSlack = nativeConstraints.getSize() / getPitch(); - ltrace(200) << "Source constraint: " << constraints + cdebug.log(149) << "Source constraint: " << constraints << " slack:" << slack << " native slack:" << nativeSlack << endl; - ltrace(200) << "Perpand constraints on target: " << perpandConstraints << endl; + cdebug.log(149) << "Perpand constraints on target: " << perpandConstraints << endl; // Ugly: GCell's track number is hardwired. if ((nativeSlack < lowSlack) or (nativeSlack - slack < 3)) { - ltrace(200) << "Slackening from Source: " << source << endl; + cdebug.log(149) << "Slackening from Source: " << source << endl; _makeDogleg( source->getGCell(), KbNoFlags ); slackened = true; } else if (slack < 10) { @@ -312,13 +321,16 @@ namespace Katabatic { const vector& doglegs = Session::getDoglegs(); if (doglegs.size() >= 2) { - ltrace(200) << "AutoSegment::_slaken(): Source @" << DbU::getValueString(getSourcePosition()) << endl; + cdebug.log(149) << "AutoSegment::_slaken(): Source @" << DbU::getValueString(getSourcePosition()) << endl; doglegs[doglegs.size()-2]->setAxis( getSourcePosition() ); success = true; if (isMetal2Source) { - ltrace(200) << "Fixing on source terminal contact." << endl; - doglegs[doglegs.size()-2]->getAutoSource()->setFlags( CntFixed ); + cdebug.log(149) << "Fixing on source terminal contact." + << doglegs[doglegs.size()-2]->getAutoSource() << endl; + //doglegs[doglegs.size()-2]->getAutoSource()->setFlags( CntFixed ); + doglegs[doglegs.size()-2]->getAutoSource()->setConstraintBox( source->getConstraintBox() ); + doglegs[doglegs.size()-2]->getAutoSource()->setFlags( CntUserNativeConstraints ); } parallel = doglegs[ doglegs.size()-1 ]; @@ -334,11 +346,11 @@ namespace Katabatic { int nativeSlack = nativeConstraints.getSize() / getPitch(); // Ugly: GCell's track number is hardwired. - ltrace(200) << "Target constraint: " << constraints + cdebug.log(149) << "Target constraint: " << constraints << " slack:" << slack << " native slack:" << nativeSlack << endl; if ((nativeSlack < lowSlack) or (nativeSlack - slack < 3)) { - ltrace(200) << "Slackening from Target: " << target << endl; + cdebug.log(149) << "Slackening from Target: " << target << endl; parallel->_makeDogleg( target->getGCell(), KbNoFlags ); slackened = true; } else if (slack < 10) { @@ -354,17 +366,20 @@ namespace Katabatic { const vector& doglegs = Session::getDoglegs(); if (doglegs.size() >= 2) { - ltrace(200) << "AutoSegment::_slaken(): Target @" << DbU::getValueString(targetPosition) << endl; + cdebug.log(149) << "AutoSegment::_slaken(): Target @" << DbU::getValueString(targetPosition) << endl; doglegs[doglegs.size()-2]->setAxis( targetPosition ); success = true; if (isMetal2Target) { - ltrace(200) << "Fixing on target terminal contact." << endl; - doglegs[doglegs.size()-2]->getAutoTarget()->setFlags( CntFixed ); + cdebug.log(149) << "Fixing on target terminal contact: " + << doglegs[doglegs.size()-2]->getAutoTarget() << endl; + //doglegs[doglegs.size()-2]->getAutoTarget()->setFlags( CntFixed ); + doglegs[doglegs.size()-2]->getAutoTarget()->setConstraintBox( target->getConstraintBox() ); + doglegs[doglegs.size()-2]->getAutoTarget()->setFlags( CntUserNativeConstraints ); } } } - ltraceout(200); + cdebug.tabw(149,-1); return success; } @@ -384,7 +399,7 @@ namespace Katabatic { if (_horizontal->getY() == axis) return; - ltrace(80) << "_setAxis() @Y " << DbU::toLambda(axis) << " " << this << endl; + cdebug.log(145) << "_setAxis() @Y " << DbU::toLambda(axis) << " " << this << endl; _horizontal->setY( axis ); invalidate(); @@ -402,7 +417,7 @@ namespace Katabatic { void AutoHorizontal::updateOrient () { if (_horizontal->getTargetX() < _horizontal->getSourceX()) { - ltrace(80) << "updateOrient() " << this << " (before S/T swap)" << endl; + cdebug.log(145) << "updateOrient() " << this << " (before S/T swap)" << endl; _horizontal->invert(); unsigned int spinFlags = _flags & SegDepthSpin; @@ -689,10 +704,9 @@ namespace Katabatic { unsigned int AutoHorizontal::_makeDogleg ( GCell* doglegGCell, unsigned int flags ) { - ltrace(200) << "AutoHorizontal::_makeDogleg(GCell*)" << endl; - - DebugSession::open( getNet(), 80 ); - ltracein(159); + DebugSession::open( getNet(), 140, 150 ); + cdebug.log(149) << "AutoHorizontal::_makeDogleg(GCell*)" << endl; + cdebug.tabw(149,1); //Session::doglegReset(); @@ -705,7 +719,7 @@ namespace Katabatic { if (isLocal()) doglegAxis = (getSourceX() + getTargetX()) / 2; - ltrace(159) << "Detaching from Target AutoContact " << autoTarget << "." << endl; + cdebug.log(149) << "Detaching from Target AutoContact " << autoTarget << "." << endl; if (doglegGCell == begin) unsetFlags( SegGlobal ); if (doglegGCell != end) { @@ -733,8 +747,8 @@ namespace Katabatic { segment1->_setAxis( doglegAxis ); segment1->setFlags( SegDogleg|SegSlackened|SegCanonical|SegNotAligned ); - ltrace(200) << "New " << dlContact1 << endl; - ltrace(200) << "New " << dlContact2 << endl; + cdebug.log(149) << "New " << dlContact1 << endl; + cdebug.log(149) << "New " << dlContact2 << endl; Session::dogleg( segment1 ); targetAttach( dlContact1 ); @@ -745,22 +759,30 @@ namespace Katabatic { segment2->setFlags( (isSlackened()?SegSlackened:0) ); Session::dogleg( segment2 ); - if (isSourceTerminal()) { + if (autoSource->isTerminal()) { segment1->setFlags( SegWeakTerminal1 ); segment2->setFlags( SegWeakTerminal1 ); - } else if (isTargetTerminal()) { + autoTarget->unsetFlags( CntWeakTerminal ); + dlContact1->setFlags ( CntWeakTerminal ); + if (autoTarget->getGCell() == doglegGCell) + dlContact1->migrateConstraintBox( autoTarget ); + } else if (autoTarget->isTerminal()) { unsetFlags( SegTargetTerminal ); setFlags( SegWeakTerminal1 ); segment1->setFlags( SegWeakTerminal1 ); segment2->setFlags( SegTargetTerminal ); + autoSource->unsetFlags( CntWeakTerminal ); + dlContact2->setFlags ( CntWeakTerminal ); + if (autoSource->getGCell() == doglegGCell) + dlContact2->migrateConstraintBox( autoSource ); } else if (isWeakTerminal()) { segment1->setFlags( SegWeakTerminal1 ); segment2->setFlags( SegWeakTerminal1 ); } - ltrace(200) << "Session::dogleg[x+1] perpand: " << segment1 << endl; - ltrace(200) << "Session::dogleg[x+2] new paral: " << segment2 << endl; - ltrace(200) << "Session::dogleg[x+0] original: " << this << endl; + cdebug.log(149) << "Session::dogleg[x+1] perpand: " << segment1 << endl; + cdebug.log(149) << "Session::dogleg[x+2] new paral: " << segment2 << endl; + cdebug.log(149) << "Session::dogleg[x+0] original: " << this << endl; dlContact1->updateCache(); dlContact2->updateCache(); @@ -769,7 +791,7 @@ namespace Katabatic { segment2->canonize( flags ); if (not isCanonical()) canonize( flags ); - ltraceout(159); + cdebug.tabw(149,-1); DebugSession::close(); return (upLayer) ? KbUseAboveLayer : KbUseBelowLayer; diff --git a/katabatic/src/AutoSegment.cpp b/katabatic/src/AutoSegment.cpp index 43d03c2c..853ebe7b 100644 --- a/katabatic/src/AutoSegment.cpp +++ b/katabatic/src/AutoSegment.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -111,7 +111,7 @@ namespace { } else { if ( autoSegment->isGlobal() ) return false; - ltrace(88) << "Examining " << autoSegment << " " << fromContact << endl; + cdebug.log(145) << "Examining " << autoSegment << " " << fromContact << endl; if ( autoSegment->getSource() == autoSegment->getTarget() ) { cerr << Error("Source & Target are the same :\n" @@ -146,7 +146,7 @@ namespace { return false; } } else { - ltrace(88) << "Terminal is " << terminalContact << endl; + cdebug.log(145) << "Terminal is " << terminalContact << endl; Box constraintBox = terminalContact->getConstraintBox(); if ( isHorizontal ) { @@ -198,7 +198,7 @@ namespace { _attractors[position]++; _attractorsCount++; - ltrace(88) << "add Attractor @" << DbU::toLambda(position) + cdebug.log(145) << "add Attractor @" << DbU::toLambda(position) << " [" << _attractors[position] << "]" << endl; } @@ -313,6 +313,8 @@ namespace Katabatic { , _flags (SegCreated) , _depth (Session::getLayerDepth(segment->getLayer())) , _optimalMin (0) + , _optimalMax (0) + , _reduceds (0) , _sourcePosition (0) , _targetPosition (0) , _userConstraints(false) @@ -365,13 +367,13 @@ namespace Katabatic { void AutoSegment::_preDestroy () { - ltrace(200) << "AutoSegment::_preDestroy() - " << (void*)this << endl; - ltracein(90); + cdebug.log(149) << "AutoSegment::_preDestroy() - " << (void*)this << endl; + cdebug.tabw(145,1); _observers.notify( Destroy ); Session::unlink( this ); - ltraceout(90); + cdebug.tabw(145,-1); } @@ -418,8 +420,8 @@ namespace Katabatic { if (flags & KbTarget) setFlags( SegInvalidatedTarget ); if (isInvalidated()) return; - ltrace(200) << "AutoSegment::invalidate() " << flags << " " << this << endl; - ltracein(200); + cdebug.log(149) << "AutoSegment::invalidate() " << flags << " " << this << endl; + cdebug.tabw(149,1); _invalidate(); @@ -428,14 +430,14 @@ namespace Katabatic { isegment->_invalidate(); } } - ltraceout(200); + cdebug.tabw(149,-1); } void AutoSegment::_invalidate () { if (isInvalidated()) return; - ltrace(110) << "AutoSegment::_invalidate() " << this << endl; + cdebug.log(145) << "AutoSegment::_invalidate() " << this << endl; setFlags( SegInvalidated ); Session::invalidate( this ); @@ -454,10 +456,10 @@ namespace Katabatic { void AutoSegment::revalidate () { - ltrace(200) << "AutoSegment::revalidate() " << this << endl; + cdebug.log(149) << "AutoSegment::revalidate() " << this << endl; if (not isInvalidated()) return; - ltracein(200); + cdebug.tabw(149,1); updateOrient (); updatePositions(); @@ -465,25 +467,29 @@ namespace Katabatic { unsigned int oldSpinFlags = _flags & SegDepthSpin; if (_flags & (SegInvalidatedSource|SegCreated)) { - const Layer* contactLayer = getAutoSource()->getLayer(); + AutoContact* source = getAutoSource(); + const Layer* contactLayer = source->getLayer(); const Layer* segmentLayer = getLayer(); - ltrace(200) << "Changed source: " << getAutoSource() << endl; + cdebug.log(149) << "Changed source: " << source << endl; unsetFlags( SegSourceTop|SegSourceBottom ); - if (contactLayer != segmentLayer) { + if (contactLayer != segmentLayer) setFlags( (segmentLayer == contactLayer->getTop()) ? SegSourceBottom : SegSourceTop ); - } + if (source->isTurn() and source->getPerpandicular(this)->isReduced()) + incReduceds(); } if (_flags & (SegInvalidatedTarget|SegCreated)) { - const Layer* contactLayer = getAutoTarget()->getLayer(); + AutoContact* target = getAutoTarget(); + const Layer* contactLayer = target->getLayer(); const Layer* segmentLayer = getLayer(); - ltrace(200) << "Changed target: " << getAutoTarget() << endl; + cdebug.log(149) << "Changed target: " << target << endl; unsetFlags( SegTargetTop|SegTargetBottom ); - if (contactLayer != segmentLayer) { + if (contactLayer != segmentLayer) setFlags( (segmentLayer == contactLayer->getTop()) ? SegTargetBottom : SegTargetTop ); - } + if (target->isTurn() and target->getPerpandicular(this)->isReduced()) + incReduceds(); } unsigned int observerFlags = Revalidate; @@ -499,8 +505,8 @@ namespace Katabatic { _observers.notify( observerFlags ); - ltrace(200) << "Updated: " << this << endl; - ltraceout(200); + cdebug.log(149) << "Updated: " << this << endl; + cdebug.tabw(149,-1); } @@ -517,21 +523,6 @@ namespace Katabatic { } - bool AutoSegment::isSameLayerDogleg () const - { - if (not isSpinTopOrBottom()) return false; - - unsigned int perpandicularDepth = getDepth() + (isSpinTop() ? 1 : -1); - if (perpandicularDepth >= Session::getDepth()) { - cerr << this << " isSpinTop too high." << endl; - } - perpandicularDepth = Session::getDepth() - 1; - - return (getLength() > (Session::getPitch(perpandicularDepth))) - and (getLength() < (Session::getPitch(perpandicularDepth) * 3)); - } - - DbU::Unit AutoSegment::getPPitch () const { unsigned int depth = getDepth(); @@ -567,14 +558,14 @@ namespace Katabatic { AutoSegment* AutoSegment::getCanonical ( DbU::Unit& min, DbU::Unit& max ) { - ltrace(89) << "AutoSegment::getCanonical() - " << this << endl; + cdebug.log(145) << "AutoSegment::getCanonical() - " << this << endl; min = getSourcePosition (); max = getTargetPosition (); if (max < min) swap( min, max ); - //ltrace(89) << "[" << DbU::getValueString(min) << " " << DbU::getValueString(max) << "]" << endl; + //cdebug.log(145) << "[" << DbU::getValueString(min) << " " << DbU::getValueString(max) << "]" << endl; AutoSegment* canonical = this; size_t canonicals = isCanonical(); @@ -597,8 +588,8 @@ namespace Katabatic { aligneds++; } - //ltrace(89) << "[" << DbU::getValueString(min) << " " << DbU::getValueString(max) << "]" << endl; - ltrace(89) << "Canonical: " << canonical << endl; + //cdebug.log(145) << "[" << DbU::getValueString(min) << " " << DbU::getValueString(max) << "]" << endl; + cdebug.log(145) << "Canonical: " << canonical << endl; if ( (canonicals > 1) or ( not canonicals and (aligneds > 2) ) ) { cerr << Bug("AutoSegment::getCanonical(): %p:%s" @@ -640,7 +631,7 @@ namespace Katabatic { AutoSegments AutoSegment::getAligneds ( unsigned int flags ) { - ltrace(89) << "AutoSegment::getAligneds() - flags:" << flags << endl; + cdebug.log(145) << "AutoSegment::getAligneds() - flags:" << flags << endl; return AutoSegments_Aligneds( this, flags ); } @@ -706,6 +697,11 @@ namespace Katabatic { { AutoContact* source = getAutoSource(); if (source) { + if (source->isTurn()) { + AutoSegment* perpandicular = source->getPerpandicular(this); + if (perpandicular and perpandicular->isReduced()) + decReduceds(); + } base()->getSourceHook()->detach(); source->cacheDetach( this ); unsetFlags( SegNotSourceAligned ); @@ -718,6 +714,11 @@ namespace Katabatic { { AutoContact* target = getAutoTarget(); if (target) { + if (target->isTurn()) { + AutoSegment* perpandicular = target->getPerpandicular(this); + if (perpandicular and perpandicular->isReduced()) + decReduceds(); + } base()->getTargetHook()->detach(); target->cacheDetach( this ); unsetFlags( SegNotTargetAligned ); @@ -756,18 +757,17 @@ namespace Katabatic { void AutoSegment::mergeUserConstraints ( const Interval& constraints ) { - ltrace(200) << "mergeUserConstraints() " << this << endl; - ltrace(200) << "| " << constraints << " merged with " << _userConstraints << endl; + cdebug.log(149) << "mergeUserConstraints() " << this << endl; + cdebug.log(149) << "| " << constraints << " merged with " << _userConstraints << endl; _userConstraints.intersection(constraints); } bool AutoSegment::toConstraintAxis ( unsigned int flags ) { - ltrace(200) << "toConstraintAxis() " << this << endl; - ltracein(200); + cdebug.log(149,1) << "toConstraintAxis() " << this << endl; - if (not isCanonical()) { ltraceout(200); return false; } + if (not isCanonical()) { cdebug.tabw(149,-1); return false; } DbU::Unit constraintMin; DbU::Unit constraintMax; @@ -775,7 +775,7 @@ namespace Katabatic { getConstraints( constraintMin, constraintMax ); // Empty constraint interval: ignore. - if (constraintMin > constraintMax) { ltraceout(200); return false; } + if (constraintMin > constraintMax) { cdebug.tabw(149,-1); return false; } if (isDogleg()) { DbU::Unit halfSideLength = getAutoSource()->getGCell()->getSide @@ -786,27 +786,26 @@ namespace Katabatic { if (getAxis() < constraintMin) { setAxis( constraintMin, flags ); - ltraceout(200); + cdebug.tabw(149,-1); return true; } if (getAxis() > constraintMax) { setAxis( constraintMax, flags ); - ltraceout(200); + cdebug.tabw(149,-1); return true; } - ltraceout(200); + cdebug.tabw(149,-1); return false; } bool AutoSegment::toOptimalAxis ( unsigned int flags ) { - ltrace(200) << "toOptimalAxis() " << this << endl; - ltracein(200); + cdebug.log(149,1) << "toOptimalAxis() " << this << endl; - if (not isCanonical()) { ltraceout(200); return false; } + if (not isCanonical()) { cdebug.tabw(149,-1); return false; } DbU::Unit constraintMin; DbU::Unit constraintMax; @@ -818,19 +817,19 @@ namespace Katabatic { if (getAxis() < optimalMin) { setAxis( optimalMin, flags ); - ltraceout(200); + cdebug.tabw(149,-1); return true; } if (getAxis() > optimalMax) { setAxis( optimalMax, flags ); - ltraceout(200); + cdebug.tabw(149,-1); return true; } if (flags & KbRealignate) setAxis( getAxis(), flags ); - ltraceout(200); + cdebug.tabw(149,-1); return false; } @@ -841,10 +840,10 @@ namespace Katabatic { if ( (axis == getAxis()) and not (flags & KbRealignate) ) return; - ltrace(200) << "setAxis() @" + cdebug.log(149) << "setAxis() @" << ((isHorizontal())?"Y ":"X ") << DbU::toLambda(getAxis()) << " to " << DbU::toLambda(axis) << " on " << this << endl; - ltracein(80); + cdebug.tabw(145,1); _setAxis( axis ); @@ -853,10 +852,10 @@ namespace Katabatic { isegment->_setAxis( getAxis() ); } } else { - ltrace(200) << "No need to process parallels." << endl; + cdebug.log(149) << "No need to process parallels." << endl; } - ltraceout(80); + cdebug.tabw(145,-1); } @@ -865,16 +864,20 @@ namespace Katabatic { AutoContact* source = getAutoSource(); AutoContact* target = getAutoTarget(); - ltrace(99) << "computeTerminal() S:" << source->isTerminal() + cdebug.log(145) << "computeTerminal() S:" << source->isTerminal() << " T:" << target->isTerminal() << " " << this << endl; if (source->isTerminal()) { unsetFlags( SegWeakTerminal ); setFlags ( SegSourceTerminal ); + if (not target->isTerminal()) + target->setFlags( CntWeakTerminal ); } else if (target->isTerminal()) { unsetFlags( SegWeakTerminal ); setFlags ( SegTargetTerminal ); + if (not source->isTerminal()) + source->setFlags( CntWeakTerminal ); } else { unsigned int terminalFlag = 0; switch ( _getFlags() & SegWeakTerminal ) { @@ -899,8 +902,7 @@ namespace Katabatic { void AutoSegment::computeOptimal ( set& processeds ) { - ltrace(89) << "computeOptimal() - " << this << endl; - ltracein(89); + cdebug.log(145,1) << "computeOptimal() - " << this << endl; DbU::Unit optimalMin; DbU::Unit optimalMax; @@ -951,10 +953,9 @@ namespace Katabatic { } forEach( AutoSegment*, autoSegment, getPerpandiculars() ) { - ltrace(89) << "Perpandicular " << *autoSegment << endl; - ltracein(89); + cdebug.log(145,1) << "Perpandicular " << *autoSegment << endl; if (autoSegment->isLocal()) { - if (not autoSegment->isStrongTerminal()) { ltraceout(89); continue; } + if (not autoSegment->isStrongTerminal()) { cdebug.tabw(145,-1); continue; } DbU::Unit terminalMin; DbU::Unit terminalMax; @@ -978,12 +979,12 @@ namespace Katabatic { isMin = false; attractors.addAttractor( (isMin) ? minGCell : maxGCell ); } - ltraceout(89); + cdebug.tabw(145,-1); } if (attractors.getAttractorsCount()) { - ltrace(89) << "Lower Median " << DbU::toLambda(attractors.getLowerMedian()) << endl; - ltrace(89) << "Upper Median " << DbU::toLambda(attractors.getUpperMedian()) << endl; + cdebug.log(145) << "Lower Median " << DbU::toLambda(attractors.getLowerMedian()) << endl; + cdebug.log(145) << "Upper Median " << DbU::toLambda(attractors.getUpperMedian()) << endl; optimalMin = attractors.getLowerMedian(); optimalMax = attractors.getUpperMedian(); @@ -997,29 +998,29 @@ namespace Katabatic { setInBound( constraintMin, constraintMax, optimalMin ); setInBound( constraintMin, constraintMax, optimalMax ); - ltrace(89) << "Applying constraint on: " << this << endl; + cdebug.log(145) << "Applying constraint on: " << this << endl; setOptimalMin( optimalMin ); setOptimalMax( optimalMax ); processeds.insert( this ); if (not isNotAligned()) { forEach ( AutoSegment*, autoSegment, getAligneds() ) { - ltrace(89) << "Applying constraint on: " << *autoSegment << endl; + cdebug.log(145) << "Applying constraint on: " << *autoSegment << endl; autoSegment->setOptimalMin( optimalMin ); autoSegment->setOptimalMax( optimalMax ); processeds.insert( (*autoSegment) ); } } - ltraceout(89); + cdebug.tabw(145,-1); } AutoSegment* AutoSegment::canonize ( unsigned int flags ) { - ltrace(159) << "canonize() - " << this << endl; + cdebug.log(149) << "canonize() - " << this << endl; // if (isCanonical() and isGlobal()) { - // ltrace(159) << "* " << this << " canonical" << endl; + // cdebug.log(149) << "* " << this << " canonical" << endl; // return this; // } @@ -1037,7 +1038,7 @@ namespace Katabatic { if (not hasCanonical) { if (isegment->isCanonical()) { - ltrace(159) << "* " << *isegment << " canonical already set" << endl; + cdebug.log(149) << "* " << *isegment << " canonical already set" << endl; canonical = *isegment; hasCanonical = true; } @@ -1058,10 +1059,10 @@ namespace Katabatic { } if (segments.empty()) setFlags( SegNotAligned ); - if (isCanonical()) { ltrace(159) << "* " << this << " canonical" << endl; } + if (isCanonical()) { cdebug.log(149) << "* " << this << " canonical" << endl; } else { - ltrace(159) << "* " << this << " not canonical" << endl; - ltrace(159) << "* " << canonical << " *is* the canonical" << endl; + cdebug.log(149) << "* " << this << " not canonical" << endl; + cdebug.log(149) << "* " << canonical << " *is* the canonical" << endl; } } else { setFlags ( SegCanonical ); @@ -1149,10 +1150,117 @@ namespace Katabatic { } + bool AutoSegment::isUTurn () const + { + if (isGlobal()) return false; + + AutoContact* source = getAutoSource(); + AutoContact* target = getAutoTarget(); + + cerr << "AutoSegment::isUTurn():" << endl; + + if (not source->isTurn() or not target->isTurn()) return false; + + cerr << " Turn connected" << endl; + + AutoSegment* perpandicular = source->getPerpandicular( this ); + bool onPSourceSource = (perpandicular->getAutoSource() == source); + + perpandicular = target->getPerpandicular( this ); + bool onPTargetSource = (perpandicular->getAutoSource() == target); + + cerr << " PSource:" << onPSourceSource << " PTarget:" << onPTargetSource << endl; + + return not (onPSourceSource xor onPTargetSource); + } + + + bool AutoSegment::isReduceCandidate () const + { + if (isGlobal()) return false; + if (not isSpinTopOrBottom()) return false; + if (_reduceds) return false; + + AutoContact* source = getAutoSource(); + AutoContact* target = getAutoTarget(); + + if (not source->isTurn() or not target->isTurn()) return false; + + return true; + } + + + bool AutoSegment::canReduce () const + { + if (isGlobal()) return false; + if (not isSpinTopOrBottom()) return false; + if (_reduceds) return false; + + AutoContact* source = getAutoSource(); + AutoContact* target = getAutoTarget(); + + if (not source->isTurn() or not target->isTurn()) return false; + + unsigned int perpandicularDepth = getDepth(); + if (isSpinBottom()) --perpandicularDepth; + else if (isSpinTop()) { + ++perpandicularDepth; + if (perpandicularDepth >= Session::getDepth()) return false; + } else + return false; + + if (getLength() >= (Session::getPitch(perpandicularDepth) * 2)) return false; + + return true; + } + + + bool AutoSegment::reduce () + { + if (not canReduce()) return false; + + AutoContact* source = getAutoSource(); + AutoContact* target = getAutoTarget(); + + _flags |= SegIsReduced; + source->getPerpandicular( this )->incReduceds(); + target->getPerpandicular( this )->incReduceds(); + + return true; + } + + + bool AutoSegment::mustRaise () const + { + if (not (_flags & SegIsReduced)) return false; + + unsigned int perpandicularDepth = getDepth(); + if (isSpinBottom()) --perpandicularDepth; + else if (isSpinTop ()) ++perpandicularDepth; + else return true; + + return (getLength() >= (Session::getPitch(perpandicularDepth) * 2)); + } + + + bool AutoSegment::raise () + { + if (not (_flags & SegIsReduced)) return false; + + AutoContact* source = getAutoSource(); + AutoContact* target = getAutoTarget(); + + _flags &= ~SegIsReduced; + source->getPerpandicular( this )->decReduceds(); + target->getPerpandicular( this )->decReduceds(); + + return true; + } + + void AutoSegment::changeDepth ( unsigned int depth, unsigned int flags ) { - ltrace(200) << "changeDepth() " << depth << " - " << this << endl; - ltracein(200); + cdebug.log(149,1) << "changeDepth() " << depth << " - " << this << endl; Session::invalidate( getNet() ); _changeDepth( depth, flags & ~KbPropagate ); @@ -1163,14 +1271,13 @@ namespace Katabatic { } } - ltraceout(200); + cdebug.tabw(149,-1); } void AutoSegment::_changeDepth ( unsigned int depth, unsigned int flags ) { - ltrace(200) << "_changeDepth() - " << this << endl; - ltracein(200); + cdebug.log(149,1) << "_changeDepth() - " << this << endl; invalidate( KbNoFlags ); setFlags( SegInvalidatedLayer|SegInvalidatedSource|SegInvalidatedTarget ); @@ -1184,7 +1291,7 @@ namespace Katabatic { } if (not (flags & KbWithNeighbors)) { - ltraceout(200); + cdebug.tabw(149,-1); return; } @@ -1215,13 +1322,13 @@ namespace Katabatic { for ( size_t i=0 ; iinvalidate(); - ltraceout(200); + cdebug.tabw(149,-1); } bool AutoSegment::canSlacken ( unsigned int flags ) const { - ltrace(200) << "AutoSegment::canSlacken()" << endl; + cdebug.log(149) << "AutoSegment::canSlacken()" << endl; if (not isGlobal() and not (flags & KbPropagate)) return false; @@ -1254,7 +1361,7 @@ namespace Katabatic { float AutoSegment::getMaxUnderDensity ( unsigned int flags ) { - ltrace(200) << "AutoSegment::getMaxUnderDensity() " << endl; + cdebug.log(149) << "AutoSegment::getMaxUnderDensity() " << endl; GCell* begin = NULL; GCell* end = NULL; @@ -1290,7 +1397,7 @@ namespace Katabatic { bool AutoSegment::canPivotUp ( float reserve, unsigned int flags ) const { - ltrace(200) << "AutoSegment::canPivotUp() - " << flags + cdebug.log(149) << "AutoSegment::canPivotUp() - " << flags << " (reserve:" << reserve << ")" << endl; if ( isLayerChange() or isFixed() ) return false; @@ -1306,9 +1413,9 @@ namespace Katabatic { } if ( not (flags&KbIgnoreContacts) ) { - ltrace(200) << getAutoSource() << endl; - ltrace(200) << getAutoTarget() << endl; - ltrace(200) << "min depths, Segment:" << depth + cdebug.log(149) << getAutoSource() << endl; + cdebug.log(149) << getAutoTarget() << endl; + cdebug.log(149) << "min depths, Segment:" << depth << " S:" << getAutoSource()->getMinDepth() << " T:" << getAutoTarget()->getMinDepth() << endl; @@ -1326,11 +1433,11 @@ namespace Katabatic { if (isegment->getAutoTarget()->getMinDepth() < depth) return false; } } else { - ltrace(200) << "AutoSegment::canPivotUp() - true [no propagate]" << endl; + cdebug.log(149) << "AutoSegment::canPivotUp() - true [no propagate]" << endl; return true; } - ltrace(200) << "AutoSegment::canPivotUp() - true [propagate]" << endl; + cdebug.log(149) << "AutoSegment::canPivotUp() - true [propagate]" << endl; return true; } @@ -1338,7 +1445,7 @@ namespace Katabatic { bool AutoSegment::canPivotDown ( float reserve, unsigned int flags ) const { - ltrace(200) << "AutoSegment::canPivotDown()" + cdebug.log(149) << "AutoSegment::canPivotDown()" << " (reserve:" << reserve << ")" << endl; if ( isLayerChange() or isFixed() ) return false; @@ -1353,16 +1460,16 @@ namespace Katabatic { if (not gcells[i]->hasFreeTrack(depth-2,reserve)) return false; } - ltrace(200) << getAutoSource() << endl; - ltrace(200) << getAutoTarget() << endl; - ltrace(200) << "max depths, Segment:" << depth + cdebug.log(149) << getAutoSource() << endl; + cdebug.log(149) << getAutoTarget() << endl; + cdebug.log(149) << "max depths, Segment:" << depth << " S:" << getAutoSource()->getMaxDepth() << " T:" << getAutoTarget()->getMaxDepth() << endl; if (getAutoSource()->getMaxDepth() > depth) return false; if (getAutoTarget()->getMaxDepth() > depth) return false; if (not (flags & KbPropagate)) { - ltrace(200) << "AutoSegment::canPivotDown() - true [no propagate]" << endl; + cdebug.log(149) << "AutoSegment::canPivotDown() - true [no propagate]" << endl; return true; } @@ -1377,7 +1484,7 @@ namespace Katabatic { } } - ltrace(200) << "AutoSegment::canPivotDown() - true [propagate]" << endl; + cdebug.log(149) << "AutoSegment::canPivotDown() - true [propagate]" << endl; return true; } @@ -1385,11 +1492,12 @@ namespace Katabatic { bool AutoSegment::canMoveUp ( float reserve, unsigned int flags ) const { - ltrace(200) << "AutoSegment::canMoveUp() " << flags + cdebug.log(149) << "AutoSegment::canMoveUp() " << flags << " (reserve:" << reserve << ")" << endl; - GCell* begin = NULL; - GCell* end = NULL; + bool lowDensity = true; + GCell* begin = NULL; + GCell* end = NULL; if ( isLayerChange() or isFixed() ) return false; if ( isStrongTerminal() and (not (flags & KbAllowTerminal)) ) return false; @@ -1404,13 +1512,14 @@ namespace Katabatic { end = *gcells.rbegin(); for ( size_t i=0 ; igetWDensity(depth-2) > 0.5) ) lowDensity = false; if (not gcells[i]->hasFreeTrack(depth,reserve)) { - ltrace(200) << "Not enough free track in " << gcells[i] << endl; + cdebug.log(149) << "Not enough free track in " << gcells[i] << endl; return false; } } - ltrace(200) << "Enough free track under canonical segment." << endl; + cdebug.log(149) << "Enough free track under canonical segment." << endl; if ( isLocal() and not (flags & KbPropagate) ) { if (not getAutoSource()->canMoveUp(this)) return false; @@ -1429,30 +1538,33 @@ namespace Katabatic { if ( (*gcells.rbegin())->getIndex() > end ->getIndex() ) end = *gcells.rbegin(); for ( size_t i=0 ; igetWDensity(depth-2) > 0.6) ) lowDensity = false; if (not gcells[i]->hasFreeTrack(depth,reserve)) { - ltrace(200) << "Not enough free track in " << gcells[i] << endl; + cdebug.log(149) << "Not enough free track in " << gcells[i] << endl; return false; } } } } + if (lowDensity and (flags & KbCheckLowDensity)) return false; + if ( (depth >= 4) and (flags & KbWithPerpands) ) { float fragmentation = begin->getFragmentation( depth-1 ); - ltrace(200) << "Check begin GCell perpandicular fragmentation: " << fragmentation << endl; + cdebug.log(149) << "Check begin GCell perpandicular fragmentation: " << fragmentation << endl; if (fragmentation < 0.5) { - ltrace(200) << "Not enough free track for perpandicular in begin GCell " + cdebug.log(149) << "Not enough free track for perpandicular in begin GCell " << "(frag:" << fragmentation << ")." << endl; return false; } fragmentation = end->getFragmentation( depth-1 ); - ltrace(200) << "Check end GCell perpandicular fragmentation: " << fragmentation << endl; + cdebug.log(149) << "Check end GCell perpandicular fragmentation: " << fragmentation << endl; if (fragmentation < 0.5) { - ltrace(200) << "Not enough free track for perpandicular in end GCell " + cdebug.log(149) << "Not enough free track for perpandicular in end GCell " << "(frag:" << fragmentation << ")." << endl; return false; @@ -1481,12 +1593,38 @@ namespace Katabatic { } + bool AutoSegment::reduceDoglegLayer () + { + if (not isReduced()) return true; + + AutoContact* source = getAutoSource(); + AutoContact* target = getAutoTarget(); + + unsigned int perpandicularDepth = getDepth(); + if (isSpinBottom()) --perpandicularDepth; + if (isSpinTop ()) ++perpandicularDepth; + + if (perpandicularDepth == getDepth()) { + cerr << Bug( "AutoSegment::reduceDoglegLayer(): Reduced segment spin is neither top (TT) nor bottom (BB).\n" + " %s" + , getString(this).c_str() ) << endl; + return false; + } + + source->setLayer( Session::getRoutingLayer(perpandicularDepth) ); + target->setLayer( Session::getRoutingLayer(perpandicularDepth) ); + setLayer( Session::getRoutingLayer(perpandicularDepth) ); + + return true; + } + + #if THIS_IS_DISABLED bool AutoSegment::shearUp ( GCell* upGCell, AutoSegment*& movedUp, float reserve, unsigned int flags ) { - ltrace(200) << "AutoSegment::shearUp() " << this << endl; + cdebug.log(149) << "AutoSegment::shearUp() " << this << endl; movedUp = NULL; @@ -1513,7 +1651,7 @@ namespace Katabatic { GCell* rightShear = NULL; for ( size_t i=iupGCell ; ihasFreeTrack(upDepth,reserve) ) { - ltrace(200) << "Right shearing @ " << gcells[i] << endl; + cdebug.log(149) << "Right shearing @ " << gcells[i] << endl; rightShear = gcells[i]; } } @@ -1524,7 +1662,7 @@ namespace Katabatic { do { --i; if ( not gcells[i]->hasFreeTrack(upDepth,reserve) ) { - ltrace(200) << "Left shearing @ " << gcells[i] << endl; + cdebug.log(149) << "Left shearing @ " << gcells[i] << endl; leftShear = gcells[i]; } } while (i > 0); @@ -1557,7 +1695,7 @@ namespace Katabatic { unsigned int AutoSegment::canDogleg ( Interval interval ) { - ltrace(200) << "AutoSegment::canDogleg(Interval) " << interval << endl; + cdebug.log(149) << "AutoSegment::canDogleg(Interval) " << interval << endl; size_t leftDogleg = 0; size_t rightDogleg = 0; @@ -1580,7 +1718,7 @@ namespace Katabatic { if ( (leftDogleg == 1) and (rightDogleg <= 1) ) return KbDoglegOnLeft; if ( (leftDogleg <= 1) and (rightDogleg == 1) ) return KbDoglegOnRight; - ltrace(200) << "leftCount:" << leftDogleg << " rightCount:" << rightDogleg << endl; + cdebug.log(149) << "leftCount:" << leftDogleg << " rightCount:" << rightDogleg << endl; return 0; } @@ -1588,9 +1726,8 @@ namespace Katabatic { AutoSegment* AutoSegment::makeDogleg ( AutoContact* from ) { - ltrace(200) << "AutoSegment::makeDogleg(AutoContact*) " << from << endl; - ltracein(200); - ltrace(200) << this << endl; + cdebug.log(149,1) << "AutoSegment::makeDogleg(AutoContact*) " << from << endl; + cdebug.log(149) << this << endl; RoutingGauge* rg = Session::getRoutingGauge(); size_t segmentDepth = rg->getLayerDepth( getLayer() ); @@ -1598,72 +1735,71 @@ namespace Katabatic { size_t index = doglegs.size(); bool isSource = (getAutoSource() == from); - ltrace(200) << "isSource:" << isSource << endl; + cdebug.log(149) << "isSource:" << isSource << endl; makeDogleg( from->getGCell(), KbNoCheckLayer ); if (doglegs.size() == index) { - ltraceout(200); + cdebug.tabw(149,-1); return NULL; } doglegs[ index+1 ]->setAxis( isHorizontal() ? from->getX() : from->getY() ); if (not from->getLayer()->contains(getLayer())) { - ltrace(200) << "Contact layer do not contains Segment layer, adjust layers" << endl; + cdebug.log(149) << "Contact layer do not contains Segment layer, adjust layers" << endl; if (getLayer()->above(from->getLayer())) { - ltrace(200) << "Go Down from depth " << segmentDepth << endl; + cdebug.log(149) << "Go Down from depth " << segmentDepth << endl; doglegs[ index + 1 ]->setLayer( rg->getRoutingLayer(segmentDepth-1) ); - ltrace(200) << "doglegs[i+1]: " << doglegs[index+1] << endl; + cdebug.log(149) << "doglegs[i+1]: " << doglegs[index+1] << endl; if (isSource) { doglegs[ index + 0 ]->setLayer( rg->getRoutingLayer(segmentDepth-2) ); doglegs[ index + 1 ]->getAutoSource()->setLayer( rg->getContactLayer(segmentDepth-2) ); doglegs[ index + 1 ]->getAutoTarget()->setLayer( rg->getContactLayer(segmentDepth-1) ); - ltrace(200) << "doglegs[i+0]: " << doglegs[index+0] << endl; - ltrace(200) << "doglegs[i+1]: " << doglegs[index+1]->getAutoSource() << endl; - ltrace(200) << "doglegs[i+1]: " << doglegs[index+1]->getAutoTarget() << endl; + cdebug.log(149) << "doglegs[i+0]: " << doglegs[index+0] << endl; + cdebug.log(149) << "doglegs[i+1]: " << doglegs[index+1]->getAutoSource() << endl; + cdebug.log(149) << "doglegs[i+1]: " << doglegs[index+1]->getAutoTarget() << endl; } else { doglegs[ index + 2 ]->setLayer( rg->getRoutingLayer(segmentDepth-2) ); doglegs[ index + 1 ]->getAutoTarget()->setLayer( rg->getContactLayer(segmentDepth-2) ); doglegs[ index + 1 ]->getAutoSource()->setLayer( rg->getContactLayer(segmentDepth-1) ); - ltrace(200) << "doglegs[i+2]: " << doglegs[index+2] << endl; - ltrace(200) << "doglegs[i+1]: " << doglegs[index+1]->getAutoTarget() << endl; - ltrace(200) << "doglegs[i+1]: " << doglegs[index+1]->getAutoSource() << endl; + cdebug.log(149) << "doglegs[i+2]: " << doglegs[index+2] << endl; + cdebug.log(149) << "doglegs[i+1]: " << doglegs[index+1]->getAutoTarget() << endl; + cdebug.log(149) << "doglegs[i+1]: " << doglegs[index+1]->getAutoSource() << endl; } } else { - ltrace(200) << "Go Up from depth " << segmentDepth << endl; + cdebug.log(149) << "Go Up from depth " << segmentDepth << endl; doglegs[ index + 1 ]->setLayer( rg->getRoutingLayer(segmentDepth+1) ); - ltrace(200) << "doglegs[i+1]: " << doglegs[index+1] << endl; + cdebug.log(149) << "doglegs[i+1]: " << doglegs[index+1] << endl; if (isSource) { doglegs[ index + 0 ]->setLayer( rg->getRoutingLayer(segmentDepth+2) ); doglegs[ index + 1 ]->getAutoSource()->setLayer( rg->getContactLayer(segmentDepth+1) ); doglegs[ index + 1 ]->getAutoTarget()->setLayer( rg->getContactLayer(segmentDepth ) ); - ltrace(200) << "doglegs[i+0]: " << doglegs[index+0] << endl; - ltrace(200) << "doglegs[i+1]: " << doglegs[index+1]->getAutoSource() << endl; - ltrace(200) << "doglegs[i+1]: " << doglegs[index+1]->getAutoTarget() << endl; + cdebug.log(149) << "doglegs[i+0]: " << doglegs[index+0] << endl; + cdebug.log(149) << "doglegs[i+1]: " << doglegs[index+1]->getAutoSource() << endl; + cdebug.log(149) << "doglegs[i+1]: " << doglegs[index+1]->getAutoTarget() << endl; } else { doglegs[ index + 2 ]->setLayer( rg->getRoutingLayer(segmentDepth+2) ); doglegs[ index + 1 ]->getAutoTarget()->setLayer( rg->getContactLayer(segmentDepth+1) ); doglegs[ index + 1 ]->getAutoSource()->setLayer( rg->getContactLayer(segmentDepth ) ); - ltrace(200) << "doglegs[i+2]: " << doglegs[index+2] << endl; - ltrace(200) << "doglegs[i+1]: " << doglegs[index+1]->getAutoTarget() << endl; - ltrace(200) << "doglegs[i+1]: " << doglegs[index+1]->getAutoSource() << endl; + cdebug.log(149) << "doglegs[i+2]: " << doglegs[index+2] << endl; + cdebug.log(149) << "doglegs[i+1]: " << doglegs[index+1]->getAutoTarget() << endl; + cdebug.log(149) << "doglegs[i+1]: " << doglegs[index+1]->getAutoSource() << endl; } } } - ltraceout(200); + cdebug.tabw(149,-1); return doglegs[ index + (isSource?0:2) ]; } unsigned int AutoSegment::makeDogleg ( Interval interval, unsigned int flags ) { - ltrace(200) << "AutoSegment::makeDogleg(Interval) - " << interval << endl; - ltracein(200); + cdebug.log(149,1) << "AutoSegment::makeDogleg(Interval) - " << interval << endl; bool leftDogleg = true; unsigned int rflags = 0; @@ -1682,7 +1818,7 @@ namespace Katabatic { } } - if ( (leftDoglegCount != 1) and (rightDoglegCount != 1) ) { ltraceout(200); return 0; } + if ( (leftDoglegCount != 1) and (rightDoglegCount != 1) ) { cdebug.tabw(149,-1); return 0; } if (not leftDoglegCount) { leftDogleg = false; leftCandidate = rightCandidate; @@ -1690,8 +1826,8 @@ namespace Katabatic { } if (leftCandidate and rightCandidate) { - ltrace(200) << "Left Constraint: " << leftCandidate->getSourceConstraints(KbNativeConstraints) << endl; - ltrace(200) << "Right Constraint: " << rightCandidate->getTargetConstraints(KbNativeConstraints) << endl; + cdebug.log(149) << "Left Constraint: " << leftCandidate->getSourceConstraints(KbNativeConstraints) << endl; + cdebug.log(149) << "Right Constraint: " << rightCandidate->getTargetConstraints(KbNativeConstraints) << endl; if ( leftCandidate ->getTargetConstraints(KbNativeConstraints).getSize() < rightCandidate->getSourceConstraints(KbNativeConstraints).getSize() ) { @@ -1711,7 +1847,7 @@ namespace Katabatic { if (leftDogleg) axis = interval.getVMin() - getPitch(); else axis = interval.getVMax() + getPitch(); - ltrace(200) << "Break @" << DbU::getValueString(axis) << " " << leftCandidate << endl; + cdebug.log(149) << "Break @" << DbU::getValueString(axis) << " " << leftCandidate << endl; unsigned int direction = getDirection(); GCell* gcell = leftCandidate->getAutoSource()->getGCell(); @@ -1721,26 +1857,26 @@ namespace Katabatic { gcell = (direction == KbHorizontal) ? gcell->getRight() : gcell->getUp(); } - ltrace(200) << "In " << gcell << endl; + cdebug.log(149) << "In " << gcell << endl; rflags = leftCandidate->_makeDogleg( gcell, flags ); const vector& doglegs = Session::getDoglegs(); if (doglegs.size() >= 2) { - ltrace(200) << "AutoSegment::makeDogleg(): @" << DbU::getValueString(axis) << endl; + cdebug.log(149) << "AutoSegment::makeDogleg(): @" << DbU::getValueString(axis) << endl; doglegs[1]->setAxis( axis ); } } - ltraceout(200); + cdebug.tabw(149,-1); return rflags | (leftDogleg ? KbDoglegOnLeft : KbDoglegOnRight); } unsigned int AutoSegment::makeDogleg ( GCell* doglegGCell, unsigned int flags ) { - ltrace(500) << "Deter| AutoSegment::makeDogleg(GCell*) " << doglegGCell << endl; - ltrace(500) << "Deter| in " << this << endl; - ltracein(160); + cdebug.log(9000) << "Deter| AutoSegment::makeDogleg(GCell*) " << doglegGCell << endl; + cdebug.log(9000) << "Deter| in " << this << endl; + cdebug.tabw(149,1); unsigned int rflags = 0; @@ -1760,17 +1896,17 @@ namespace Katabatic { } if (doglegGCell->getSide(getDirection()).intersect(getSpanU())) { - ltrace(159) << "Dogleg in " << this << endl; + cdebug.log(149) << "Dogleg in " << this << endl; rflags = _makeDogleg( doglegGCell, flags ); } else { - ltrace(159) << "Looking in aligneds." << endl; + cdebug.log(149) << "Looking in aligneds." << endl; if (not isNotAligned()) { forEach ( AutoSegment*, aligned, getAligneds(flags) ) { - ltrace(159) << "| Try in " << *aligned << endl; + cdebug.log(149) << "| Try in " << *aligned << endl; if (doglegGCell->getSide(getDirection()).intersect(aligned->getSpanU())) { - ltrace(159) << "Dogleg in " << *aligned << endl; + cdebug.log(149) << "Dogleg in " << *aligned << endl; rflags = aligned->_makeDogleg( doglegGCell, flags ); - ltraceout(160); + cdebug.tabw(149,-1); return 0; } } @@ -1778,7 +1914,7 @@ namespace Katabatic { cerr << Bug("Cannot make a dogleg in %s at %s" ,_getString().c_str(), getString(doglegGCell).c_str()) << endl; } - ltraceout(160); + cdebug.tabw(149,-1); return rflags; } @@ -1811,6 +1947,7 @@ namespace Katabatic { state += isWeakTerminal2 () ? "w": "-"; state += isNotAligned () ? "A": "-"; state += isSlackened () ? "S": "-"; + state += isReduced () ? "r": "-"; state += isInvalidated () ? "i": "-"; if (_flags & SegSourceTop) state += 'T'; @@ -1865,8 +2002,8 @@ namespace Katabatic { Vertical* vertical = dynamic_cast( hurricaneSegment ); AutoContact* reference = source; - ltrace(159) << "Source:" << source << endl; - ltrace(159) << "Target:" << target << endl; + cdebug.log(149) << "Source:" << source << endl; + cdebug.log(149) << "Target:" << target << endl; if (target->isFixed()) { if (source->isFixed()) { @@ -1968,18 +2105,34 @@ namespace Katabatic { AutoSegment* AutoSegment::create ( AutoContact* source , AutoContact* target , unsigned int dir + , size_t depth ) { - static const Layer* horizontalLayer = Session::getRoutingLayer( 1 ); - static DbU::Unit horizontalWidth = Session::getWireWidth ( 1 ); - static const Layer* verticalLayer = Session::getRoutingLayer( 2 ); - static DbU::Unit verticalWidth = Session::getWireWidth ( 2 ); + // Hardcoded: make the assumption that, + // depth=0 is terminal reserved | METAL1 + // depth=1 is horizontal | METAL2 + // depth=2 is vertical | METAL3 + // Should be based on gauge informations. + static const Layer* hLayer = Session::getRoutingLayer( 1 ); + static DbU::Unit hWidth = Session::getWireWidth ( 1 ); + static const Layer* vLayer = Session::getRoutingLayer( 2 ); + static DbU::Unit vWidth = Session::getWireWidth ( 2 ); + + const Layer* horizontalLayer = hLayer; + DbU::Unit horizontalWidth = hWidth; + const Layer* verticalLayer = vLayer; + DbU::Unit verticalWidth = vWidth; + + if (depth != RoutingGauge::nlayerdepth) { + horizontalLayer = verticalLayer = Session::getRoutingLayer( depth ); + horizontalWidth = verticalWidth = Session::getWireWidth ( depth ); + } AutoSegment* segment; AutoContact* reference = source; - ltrace(159) << "Source:" << source << endl; - ltrace(159) << "Target:" << target << endl; + cdebug.log(149) << "Source:" << source << endl; + cdebug.log(149) << "Target:" << target << endl; if (target->isFixed()) { if (source->isFixed()) { @@ -2034,8 +2187,7 @@ namespace Katabatic { bool AutoSegment::isTopologicalBound ( AutoSegment* seed, unsigned int flags ) { - ltrace(80) << "isTopologicalBound() - " << seed << endl; - ltracein(80); + cdebug.log(145,1) << "isTopologicalBound() - " << seed << endl; set exploreds; vector stack; @@ -2044,7 +2196,7 @@ namespace Katabatic { if (flags & KbSuperior) axis = seed->getTargetU(); else axis = seed->getSourceU(); - ltrace(80) << "check for bound " << DbU::getValueString(axis) << endl; + cdebug.log(145) << "check for bound " << DbU::getValueString(axis) << endl; exploreds.insert( seed->getAutoSource() ); exploreds.insert( seed->getAutoTarget() ); @@ -2061,11 +2213,11 @@ namespace Katabatic { AutoContact* currentContact = stack.back(); stack.pop_back(); - ltrace(80) << "Exploring: " << (void*)currentContact << " " << currentContact << endl; + cdebug.log(145) << "Exploring: " << (void*)currentContact << " " << currentContact << endl; exploreds.insert( currentContact ); - if (currentContact->getAnchor()) { ltraceout(80); return true; } + if (currentContact->getAnchor()) { cdebug.tabw(145,-1); return true; } forEach ( Component*, component, currentContact->getSlaveComponents() ) { Segment* segment = dynamic_cast( *component ); @@ -2092,17 +2244,17 @@ namespace Katabatic { if (autoSegment->isHorizontal() xor (flags & KbHorizontal)) continue; - ltrace(80) << "| " << autoSegment << endl; + cdebug.log(145) << "| " << autoSegment << endl; if (flags & KbSuperior) { - if (autoSegment->getTargetU() > axis) { ltraceout(80); return true; } + if (autoSegment->getTargetU() > axis) { cdebug.tabw(145,-1); return true; } } else { - if (autoSegment->getSourceU() < axis) { ltraceout(80); return true; } + if (autoSegment->getSourceU() < axis) { cdebug.tabw(145,-1); return true; } } } } - ltraceout(80); + cdebug.tabw(145,-1); return false; } @@ -2152,8 +2304,7 @@ namespace Katabatic { , DbU::Unit& rightBound ) { - ltrace(80) << "getTopologicalInfos() - " << seed << endl; - ltracein(80); + cdebug.log(145,1) << "getTopologicalInfos() - " << seed << endl; leftBound = DbU::Max; rightBound = DbU::Min; @@ -2179,11 +2330,11 @@ namespace Katabatic { else constraint = sourceContact->getCBYMin(); if (constraint > rightBound) rightBound = constraint; - ltrace(200) << "Segments of: " << sourceContact << endl; + cdebug.log(149) << "Segments of: " << sourceContact << endl; LocatorHelper helper (sourceContact, KbHorizontal|KbWithPerpands); for ( ; helper.isValid() ; helper.progress() ) { AutoSegment* currentSegment = helper.getSegment(); - ltrace(200) << "Looking for: " << currentSegment << endl; + cdebug.log(149) << "Looking for: " << currentSegment << endl; if (currentSegment == sourceSegment) continue; if (AutoSegment::areAlignedsAndDiffLayer(currentSegment,seed)) { @@ -2199,28 +2350,28 @@ namespace Katabatic { aligneds.push_back( currentSegment ); AutoContact* targetContact = currentSegment->getOppositeAnchor( sourceContact ); - ltrace(200) << "Target: " << targetContact << endl; + cdebug.log(149) << "Target: " << targetContact << endl; if (targetContact) { if ( (seed->isHorizontal() and sourceContact->isHTee()) or (seed->isVertical () and sourceContact->isVTee()) ) { - ltrace(200) << "Stacking target. " << endl; + cdebug.log(149) << "Stacking target. " << endl; stack.push( targetContact, currentSegment ); } } } else { - ltrace(200) << "| perpandicular " << currentSegment << endl; + cdebug.log(149) << "| perpandicular " << currentSegment << endl; perpandiculars.push_back( currentSegment ); } } } - ltraceout(80); + cdebug.tabw(145,-1); } int AutoSegment::getTerminalCount ( AutoSegment* seed, vector& collapseds ) { - ltrace(80) << "getTerminalCount() - " << seed << " (+collapseds)" << endl; + cdebug.log(145) << "getTerminalCount() - " << seed << " (+collapseds)" << endl; int count = 0; for ( size_t i=0 ; i < collapseds.size() ; i++ ) { diff --git a/katabatic/src/AutoSegments.cpp b/katabatic/src/AutoSegments.cpp index f6f61d82..afebaa64 100644 --- a/katabatic/src/AutoSegments.cpp +++ b/katabatic/src/AutoSegments.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -24,9 +24,6 @@ namespace Katabatic { using namespace std; using Hurricane::tab; - using Hurricane::inltrace; - using Hurricane::ltracein; - using Hurricane::ltraceout; using Hurricane::_TName; using Hurricane::Error; using Hurricane::ForEachIterator; @@ -39,7 +36,7 @@ namespace Katabatic { void AutoSegmentStack::push ( AutoContact* contact, AutoSegment* segment ) { - ltrace(80) << "Stacking " << contact << " + " << segment << endl; + cdebug.log(145) << "Stacking " << contact << " + " << segment << endl; push_back( make_pair(contact,segment) ); } @@ -71,7 +68,7 @@ namespace Katabatic { void AutoSegments_OnContact::Locator::progress () { - ltrace(80) << "AutoSegments_OnContact::Locator::progress()" << endl; + cdebug.log(145) << "AutoSegments_OnContact::Locator::progress()" << endl; while (_hook and not _hook->isMaster()) { _hook = _hook->getNextHook(); @@ -127,7 +124,7 @@ namespace Katabatic { if (not _master) return; _flags |= (_master->isHorizontal()) ? KbHorizontal : KbVertical; - ltrace(80) << "AutoSegments_Aligneds::Locator::Locator() - _flags:" << _flags << endl; + cdebug.log(145) << "AutoSegments_Aligneds::Locator::Locator() - _flags:" << _flags << endl; AutoContact* contact = segment->getAutoSource(); if (contact) _stack.push( contact, segment ); @@ -149,7 +146,7 @@ namespace Katabatic { void AutoSegments_Aligneds::Locator::progress () { - ltrace(80) << "AutoSegments_Aligneds::Locator::progress()" << endl; + cdebug.log(145) << "AutoSegments_Aligneds::Locator::progress()" << endl; while (not _stack.isEmpty()) { AutoContact* sourceContact = _stack.getAutoContact (); @@ -160,7 +157,7 @@ namespace Katabatic { LocatorHelper helper (sourceContact, _flags); for ( ; helper.isValid() ; helper.progress() ) { AutoSegment* currentSegment = helper.getSegment(); - ltrace(80) << "Looking at: " << currentSegment << endl; + cdebug.log(145) << "Looking at: " << currentSegment << endl; if (currentSegment == sourceSegment) continue; @@ -222,8 +219,8 @@ namespace Katabatic { , _stack () , _perpandiculars() { - ltrace(80) << "AutoSegments_Perpandiculars::Locator::Locator()" << endl; - ltrace(80) << " " << _master << endl; + cdebug.log(145) << "AutoSegments_Perpandiculars::Locator::Locator()" << endl; + cdebug.log(145) << " " << _master << endl; if (not _master) return; if (_master->isHorizontal()) _flags |= KbHorizontal; @@ -248,7 +245,7 @@ namespace Katabatic { void AutoSegments_Perpandiculars::Locator::progress () { - ltrace(80) << "AutoSegments_Perpandiculars::Locator::progress()" << endl; + cdebug.log(145) << "AutoSegments_Perpandiculars::Locator::progress()" << endl; if (not _perpandiculars.empty()) _perpandiculars.pop_back(); if (not _perpandiculars.empty()) return; @@ -278,7 +275,7 @@ namespace Katabatic { continue; } - ltrace(80) << "Stacking target. " << endl; + cdebug.log(145) << "Stacking target. " << endl; _stack.push( targetContact, currentSegment ); } } @@ -357,18 +354,17 @@ namespace Katabatic { void AutoSegments_AnchorOnGCell::Locator::progress () { - ltrace(80) << "AutoSegments_AnchorOnGCell::Locator::progress()" << endl; - ltracein(79); + cdebug.log(145,1) << "AutoSegments_AnchorOnGCell::Locator::progress()" << endl; while ( true ) { if (_hookLocator == NULL) { if (_itContact == _itEnd) { - ltrace(79) << "No more AutoContacts" << endl; - ltraceout(79); + cdebug.log(145) << "No more AutoContacts" << endl; + cdebug.tabw(145,-1); return; } - ltrace(79) << *_itContact << endl; + cdebug.log(145) << *_itContact << endl; _hookLocator = (*_itContact)->getBodyHook()->getSlaveHooks().getLocator(); _itContact++; @@ -377,7 +373,7 @@ namespace Katabatic { } while ( _hookLocator->isValid() ) { - ltrace(79) << _hookLocator->getElement() << endl; + cdebug.log(145) << _hookLocator->getElement() << endl; Hook* hook = dynamic_cast(_hookLocator->getElement()); if (hook) { if ( ((_flags & KbSource) and (dynamic_cast(hook))) @@ -385,9 +381,9 @@ namespace Katabatic { _element = Session::lookup( static_cast(hook->getComponent()) ); if (_element->isHorizontal()) { - if (_flags & KbHorizontal) { ltraceout(79); return; } + if (_flags & KbHorizontal) { cdebug.tabw(145,-1); return; } } else - if (_flags & KbVertical) { ltraceout(79); return; } + if (_flags & KbVertical) { cdebug.tabw(145,-1); return; } } } _hookLocator->progress(); @@ -396,7 +392,7 @@ namespace Katabatic { _element = NULL; } - ltraceout(79); + cdebug.tabw(145,-1); } @@ -451,7 +447,7 @@ namespace Katabatic { void AutoSegments_CachedOnContact::Locator::progress () { - ltrace(80) << "AutoSegments_CachedOnContact::Locator::progress()" << endl; + cdebug.log(145) << "AutoSegments_CachedOnContact::Locator::progress()" << endl; _helper->progress(); } diff --git a/katabatic/src/AutoVertical.cpp b/katabatic/src/AutoVertical.cpp index ac3da7dc..14b33e13 100644 --- a/katabatic/src/AutoVertical.cpp +++ b/katabatic/src/AutoVertical.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -29,8 +29,6 @@ namespace Katabatic { using std::min; using std::max; - using Hurricane::ltracein; - using Hurricane::ltraceout; using Hurricane::Error; using Hurricane::Bug; @@ -56,8 +54,8 @@ namespace Katabatic { : AutoSegment(vertical) , _vertical(vertical) { - ltrace(99) << "CTOR AutoVertical " << this << endl; - ltrace(99) << " over " << vertical << endl; + cdebug.log(145) << "CTOR AutoVertical " << this << endl; + cdebug.log(145) << " over " << vertical << endl; } @@ -97,9 +95,8 @@ namespace Katabatic { void AutoVertical::_preDestroy () { - ltrace(200) << "AutoVertical::_preDestroy() - " << endl; - ltrace(200) << " " << _getString() << endl; - ltracein(90); + cdebug.log(149,1) << "AutoVertical::_preDestroy() - " << endl; + cdebug.log(149) << _getString() << endl; if ( not Session::doDestroyTool() ) { AutoContact* source = getAutoSource(); @@ -127,14 +124,14 @@ namespace Katabatic { } AutoSegment::_preDestroy (); - ltraceout(90); + cdebug.tabw(145,-1); } AutoVertical::~AutoVertical () { if ( Session::doDestroyBaseSegment() and not Session::doDestroyTool() ) { - ltrace(200) << "~AutoVertical() - " << endl; + cdebug.log(149) << "~AutoVertical() - " << endl; _vertical->destroy (); } } @@ -166,7 +163,7 @@ namespace Katabatic { constraintMin = contact->getCBXMin(); constraintMax = contact->getCBXMax(); - ltrace(148) << "Source constraints: " << contact << " [" + cdebug.log(149) << "Source constraints: " << contact << " [" << DbU::getValueString(constraintMin) << ":" << DbU::getValueString(constraintMax) << "]" << endl; @@ -175,7 +172,7 @@ namespace Katabatic { constraintMin = max ( constraintMin, contact->getCBXMin() ); constraintMax = min ( constraintMax, contact->getCBXMax() ); - ltrace(148) << "Merge with target constraints: " << contact << " [" + cdebug.log(149) << "Merge with target constraints: " << contact << " [" << DbU::getValueString(constraintMin) << ":" << DbU::getValueString(constraintMax) << "]" << endl; @@ -183,7 +180,7 @@ namespace Katabatic { constraintMin = max ( constraintMin, getUserConstraints().getVMin() ); constraintMax = min ( constraintMax, getUserConstraints().getVMax() ); - ltrace(148) << "Merge with user constraints: " << getUserConstraints() << " [" + cdebug.log(149) << "Merge with user constraints: " << getUserConstraints() << " [" << DbU::getValueString(constraintMin) << ":" << DbU::getValueString(constraintMax) << "]" << endl; @@ -217,7 +214,7 @@ namespace Katabatic { bool AutoVertical::_canSlacken () const { - ltraceout(200); + cdebug.tabw(149,-1); Interval sourceSide = getAutoSource()->getGCell()->getSide( KbHorizontal ); Interval targetSide = getAutoTarget()->getGCell()->getSide( KbHorizontal ); @@ -228,26 +225,25 @@ namespace Katabatic { sourceConstraints.inflate( 1 ); targetConstraints.inflate( 1 ); - if (not sourceConstraints.contains(sourceSide)) { ltraceout(200); return true; } - if (not targetConstraints.contains(targetSide)) { ltraceout(200); return true; } + if (not sourceConstraints.contains(sourceSide)) { cdebug.tabw(149,-1); return true; } + if (not targetConstraints.contains(targetSide)) { cdebug.tabw(149,-1); return true; } - ltraceout(200); + cdebug.tabw(149,-1); return false; } bool AutoVertical::_slacken ( unsigned int flags ) { - ltrace(200) << "AutoVertical::_slacken() " << this << endl; - ltracein(200); + cdebug.log(149,1) << "AutoVertical::_slacken() " << this << endl; if ( not isStrongTerminal() or (not (_flags & (SegGlobal|SegWeakGlobal)) and (getLength() < getPitch()*5)) ) - { ltraceout(200); return false; } + { cdebug.tabw(149,-1); return false; } - ltrace(200) << "_flags:" << (_flags & (SegGlobal|SegWeakGlobal)) << endl; - ltrace(200) << "test:" << (getLength() < getPitch()*5) << endl; - ltrace(200) << "length:" << DbU::getValueString(getLength()) << endl; + cdebug.log(149) << "_flags:" << (_flags & (SegGlobal|SegWeakGlobal)) << endl; + cdebug.log(149) << "test:" << (getLength() < getPitch()*5) << endl; + cdebug.log(149) << "length:" << DbU::getValueString(getLength()) << endl; bool success = false; bool slackened = false; @@ -272,7 +268,7 @@ namespace Katabatic { const vector& doglegs = Session::getDoglegs(); if (doglegs.size() >= 2) { - ltrace(200) << "AutoSegment::_slaken(): Source @" << DbU::getValueString(getSourcePosition()) << endl; + cdebug.log(149) << "AutoSegment::_slaken(): Source @" << DbU::getValueString(getSourcePosition()) << endl; doglegs[doglegs.size()-2]->_setAxis( getSourcePosition() ); success = true; @@ -303,7 +299,7 @@ namespace Katabatic { const vector& doglegs = Session::getDoglegs(); if (doglegs.size() >= 2) { - ltrace(200) << "AutoSegment::_slaken(): Source @" << DbU::getValueString(getTargetPosition()) << endl; + cdebug.log(149) << "AutoSegment::_slaken(): Source @" << DbU::getValueString(getTargetPosition()) << endl; doglegs[doglegs.size()-2]->_setAxis( getTargetPosition() ); success = true; } @@ -315,7 +311,7 @@ namespace Katabatic { setFlags ( SegSlackened ); unsetFlags( SegHalfSlackened ); } - ltraceout(200); + cdebug.tabw(149,-1); return success; } @@ -327,7 +323,7 @@ namespace Katabatic { if (_vertical->getX() == axis) return; - ltrace(159) << "_setAxis() @X " << DbU::toLambda(axis) << " " << this << endl; + cdebug.log(149) << "_setAxis() @X " << DbU::toLambda(axis) << " " << this << endl; _vertical->setX( axis ); invalidate(); @@ -345,7 +341,7 @@ namespace Katabatic { void AutoVertical::updateOrient () { if (_vertical->getTargetY() < _vertical->getSourceY()) { - ltrace(80) << "updateOrient() " << this << " (before S/T swap)" << endl; + cdebug.log(145) << "updateOrient() " << this << " (before S/T swap)" << endl; _vertical->invert(); unsigned int spinFlags = _flags & SegDepthSpin; @@ -549,7 +545,7 @@ namespace Katabatic { bool AutoVertical::moveURight () { - ltrace(200) << "AutoVertical::moveURight()" << endl; + cdebug.log(149) << "AutoVertical::moveURight()" << endl; if (not getAutoSource()->isTurn() or not getAutoTarget()->isTurn()) return true; if (not getAutoSource()->getGCell()->getRight()) return true; @@ -604,7 +600,7 @@ namespace Katabatic { DbU::Unit x = begin->getSide( KbHorizontal ).getVMin(); setAxis( x ); - ltrace(200) << "Moved to axis: " << DbU::getValueString(x) << endl; + cdebug.log(149) << "Moved to axis: " << DbU::getValueString(x) << endl; return true; } @@ -612,7 +608,7 @@ namespace Katabatic { unsigned int AutoVertical::_makeDogleg ( GCell* doglegGCell, unsigned int flags ) { - ltrace(200) << "AutoVertical::_makeDogleg(GCell*)" << endl; + cdebug.log(149) << "AutoVertical::_makeDogleg(GCell*)" << endl; AutoContact* autoSource = getAutoSource(); AutoContact* autoTarget = getAutoTarget(); @@ -645,16 +641,16 @@ namespace Katabatic { invalidate( KbTopology ); autoTarget->invalidate( KbTopology ); AutoContact* dlContact1 = AutoContactTurn::create( doglegGCell, _vertical->getNet(), contactLayer ); - ltrace(200) << dlContact1 << endl; + cdebug.log(149) << dlContact1 << endl; AutoContact* dlContact2 = AutoContactTurn::create( doglegGCell, _vertical->getNet(), contactLayer ); - ltrace(200) << dlContact2 << endl; + cdebug.log(149) << dlContact2 << endl; AutoSegment* segment1 = AutoSegment::create( dlContact1 , dlContact2, KbHorizontal ); - ltrace(200) << segment1 << endl; + cdebug.log(149) << segment1 << endl; segment1->setLayer( doglegLayer ); segment1->_setAxis( doglegAxis ); segment1->setFlags( SegDogleg|SegSlackened|SegCanonical|SegNotAligned ); - ltrace(200) << "New " << dlContact1->base() << "." << endl; - ltrace(200) << "New " << dlContact2->base() << "." << endl; + cdebug.log(149) << "New " << dlContact1->base() << "." << endl; + cdebug.log(149) << "New " << dlContact2->base() << "." << endl; Session::dogleg( segment1 ); targetAttach( dlContact1 ); @@ -668,19 +664,27 @@ namespace Katabatic { if (isSourceTerminal()) { segment1->setFlags( SegWeakTerminal1 ); segment2->setFlags( SegWeakTerminal1 ); + autoTarget->unsetFlags( CntWeakTerminal ); + dlContact1->setFlags ( CntWeakTerminal ); + if (autoTarget->getGCell() == doglegGCell) + dlContact1->migrateConstraintBox( autoTarget ); } else if (isTargetTerminal()) { unsetFlags( SegTargetTerminal ); setFlags( SegWeakTerminal1 ); segment1->setFlags( SegWeakTerminal1 ); segment2->setFlags( SegTargetTerminal ); + autoSource->unsetFlags( CntWeakTerminal ); + dlContact2->setFlags ( CntWeakTerminal ); + if (autoSource->getGCell() == doglegGCell) + dlContact2->migrateConstraintBox( autoSource ); } else if (isWeakTerminal()) { segment1->setFlags( SegWeakTerminal1 ); segment2->setFlags( SegWeakTerminal1 ); } - ltrace(200) << "Session::dogleg[x+1] perpand: " << segment1 << endl; - ltrace(200) << "Session::dogleg[x+2] new paral: " << segment2 << endl; - ltrace(200) << "Session::dogleg[x+0] original: " << this << endl; + cdebug.log(149) << "Session::dogleg[x+1] perpand: " << segment1 << endl; + cdebug.log(149) << "Session::dogleg[x+2] new paral: " << segment2 << endl; + cdebug.log(149) << "Session::dogleg[x+0] original: " << this << endl; dlContact1->updateCache(); dlContact2->updateCache(); diff --git a/katabatic/src/ChipTools.cpp b/katabatic/src/ChipTools.cpp index 937b7991..110b13ad 100644 --- a/katabatic/src/ChipTools.cpp +++ b/katabatic/src/ChipTools.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -74,14 +74,14 @@ namespace { void breakSegments ( GCell* begin, GCell* end, Layer::Mask mask, unsigned int flags ) { for ( GCell* gcell=begin ; gcell != NULL ; ) { - ltrace(200) << "Pre-break in " << gcell << endl; + cdebug.log(149) << "Pre-break in " << gcell << endl; if ( (flags & KbHorizontal) and (flags & KbGlobalSegment) ) { const vector& hsegments = gcell->getHSegments(); for ( size_t i=0 ; igetLayer()->getMask() & mask) ) continue; - ltrace(200) << "Pre-break: " << hsegments[i] << " @" << gcell << endl; + cdebug.log(149) << "Pre-break: " << hsegments[i] << " @" << gcell << endl; #ifdef THIS_IS_DISABLED hsegments[i]->makeDogLeg ( gcell, true ); #endif @@ -96,7 +96,7 @@ namespace { for ( size_t i=0 ; igetLayer()->getMask() & mask) ) continue; - ltrace(200) << "Pre-break: " << vsegments[i] << " @" << gcell << endl; + cdebug.log(149) << "Pre-break: " << vsegments[i] << " @" << gcell << endl; #if THIS_IS_DISABLED vsegments[i]->makeDogLeg ( gcell, true ); #endif @@ -120,7 +120,7 @@ namespace { } for ( size_t i=0 ; igetDirection() << "&" << flags << " " << segments[i] << endl; #if THIS_IS_DISABLED diff --git a/katabatic/src/Configuration.cpp b/katabatic/src/Configuration.cpp index 1461576d..91d9fc96 100644 --- a/katabatic/src/Configuration.cpp +++ b/katabatic/src/Configuration.cpp @@ -1,7 +1,7 @@ // -*- mode: C++; explicit-buffer-name: "Configuration.cpp" -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -43,7 +43,6 @@ namespace Katabatic { using std::ostringstream; using std::vector; using Hurricane::tab; - using Hurricane::inltrace; using Hurricane::Warning; using Hurricane::Error; using Hurricane::Technology; @@ -144,7 +143,7 @@ namespace Katabatic { ConfigurationConcrete::~ConfigurationConcrete () { - ltrace(89) << "About to delete attribute _rg (RoutingGauge)." << endl; + cdebug.log(145) << "About to delete attribute _rg (RoutingGauge)." << endl; _cg->destroy (); _rg->destroy (); } diff --git a/katabatic/src/GCell.cpp b/katabatic/src/GCell.cpp index 5b9b510d..a296200c 100644 --- a/katabatic/src/GCell.cpp +++ b/katabatic/src/GCell.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -256,9 +256,6 @@ namespace Katabatic { using namespace std; using Hurricane::roundfp; using Hurricane::tab; - using Hurricane::ltracein; - using Hurricane::ltraceout; - using Hurricane::inltrace; using Hurricane::ForEachIterator; using Hurricane::Warning; using Hurricane::Bug; @@ -350,12 +347,11 @@ namespace Katabatic { void GCell::_postCreate () { - ltrace(90) << "GCell::_postCreate() - " << (void*)this << " " << this << endl; - ltracein(90); + cdebug.log(145,1) << "GCell::_postCreate() - " << (void*)this << " " << this << endl; ExtensionGo::_postCreate (); - ltraceout(90); + cdebug.tabw(145,-1); } @@ -366,7 +362,7 @@ namespace Katabatic { DbU::Unit trShrink = ( gcellGrid->isOnTopBorder (index) or gcellGrid->isOnRightBorder(index)) ? 0 : _topRightShrink; - ltrace(90) << "Gcell::create()" << endl; + cdebug.log(145) << "Gcell::create()" << endl; GCell* gcell = new GCell ( gcellGrid, index, box.inflate( 0 ,0 ,-trShrink ,-trShrink ) ); gcell->_postCreate (); @@ -377,7 +373,7 @@ namespace Katabatic { GCell::~GCell () { - ltrace(90) << "GCell::~GCell()" << endl; + cdebug.log(145) << "GCell::~GCell()" << endl; delete [] _blockages; delete [] _densities; @@ -392,7 +388,7 @@ namespace Katabatic { void GCell::_preDestroy () { - ltrace(90) << "GCell::_preDestroy() - " << (void*)this << " " << this << endl; + cdebug.log(145) << "GCell::_preDestroy() - " << (void*)this << " " << this << endl; ExtensionGo::_preDestroy (); } @@ -407,14 +403,14 @@ namespace Katabatic { float difference = roundfp ( getDensity() - threshold ); //int difference = floatDifference(getDensity(),threshold,10000); - ltrace(190) << "GCell:isAboveDensity() " << threshold << " diff:" << difference << endl; + cdebug.log(149) << "GCell:isAboveDensity() " << threshold << " diff:" << difference << endl; return (difference >= 0.0); } bool GCell::areDensityConnex ( GCell* a, GCell* b ) { - ltrace(190) << "GCell:areDensityConnex()" << endl; + cdebug.log(149) << "GCell:areDensityConnex()" << endl; for ( unsigned int i=1 ; igetDepth() ; i++ ) { // Ugly: hard-coded skip METAL1. //int highDiffa = floatDifference(a->_densities[i],0.6,10000); @@ -422,12 +418,12 @@ namespace Katabatic { float highDiffa = roundfp ( a->_densities[i] - 0.6 ); float highDiffb = roundfp ( b->_densities[i] - 0.6 ); - ltrace(190) << "Compare depth " << i + cdebug.log(149) << "Compare depth " << i << " " << a->_densities[i] << "," << highDiffa << " & " << b->_densities[i] << "," << highDiffb << endl; if ( (highDiffa > 0) and (highDiffb > 0) ) { - ltrace(190) << "GCell::areDensityConnex() Neighboring high saturated GCell (depth:" << i + cdebug.log(149) << "GCell::areDensityConnex() Neighboring high saturated GCell (depth:" << i << " " << a->_densities[i] << " & " << b->_densities[i] << ")" << endl; return true; } @@ -653,7 +649,7 @@ namespace Katabatic { // } // } - ltrace(300) << "GCell:addBlockage() " << this << " " + cdebug.log(149) << "GCell:addBlockage() " << this << " " << depth << ":" << DbU::getValueString(_blockages[depth]) << endl; } @@ -672,7 +668,7 @@ namespace Katabatic { } if (found) { - ltrace(200) << "remove " << ac << " from " << this << endl; + cdebug.log(149) << "remove " << ac << " from " << this << endl; _contacts.pop_back(); } else { cerr << Bug("%p:%s do not belong to %s." @@ -910,7 +906,7 @@ namespace Katabatic { //for ( size_t i=0 ; i<_depth ; i++ ) { _densities[i] = roundfp ( _densities[i] ); } //_cDensity = roundfp (_cDensity ); - //ltrace(190) << "updateDensity: " << this << endl; + //cdebug.log(149) << "updateDensity: " << this << endl; checkDensity(); @@ -1024,7 +1020,7 @@ namespace Katabatic { case KbVertical: capacity = getVCapacity(); break; } - ltrace(200) << " | hasFreeTrack [" << getIndex() << "] depth:" << depth << " " + cdebug.log(149) << " | hasFreeTrack [" << getIndex() << "] depth:" << depth << " " << Session::getRoutingGauge()->getRoutingLayer(depth)->getName() //<< " " << (_densities[depth]*capacity) << " vs. " << capacity << " " << _feedthroughs[depth] << " vs. " << capacity @@ -1126,7 +1122,7 @@ namespace Katabatic { AutoSegment* segment; while ( (_densities[1] > 0.5) and stepDesaturate(1,globalNets,segment,KbForceMove) ) { - ltrace(200) << "Moved up: " << segment << endl; + cdebug.log(149) << "Moved up: " << segment << endl; } } @@ -1137,7 +1133,7 @@ namespace Katabatic { , unsigned int flags ) { - ltrace(500) << "Deter| GCell::stepDesaturate() [" << getIndex() << "] depth:" << depth << endl; + cdebug.log(9000) << "Deter| GCell::stepDesaturate() [" << getIndex() << "] depth:" << depth << endl; updateDensity (); moved = NULL; @@ -1168,7 +1164,7 @@ namespace Katabatic { if ( segmentDepth > depth ) break; globalNets.insert ( (*isegment)->getNet() ); - ltrace(500) << "Deter| Move up " << (*isegment) << endl; + cdebug.log(9000) << "Deter| Move up " << (*isegment) << endl; #if THIS_IS_DISABLED (*isegment)->changeDepth ( depth+2, false, false ); @@ -1184,7 +1180,7 @@ namespace Katabatic { bool GCell::stepBalance ( unsigned int depth, GCell::SetIndex& invalidateds ) { - ltrace(200) << "stepBalance() - " << this << endl; + cdebug.log(149) << "stepBalance() - " << this << endl; updateDensity (); @@ -1229,8 +1225,8 @@ namespace Katabatic { bool GCell::stepNetDesaturate ( unsigned int depth, set& globalNets, GCell::SetIndex& invalidateds ) { - ltrace(500) << "Deter| GCell::stepNetDesaturate() depth:" << depth << endl; - ltrace(500) << "Deter| " << this << endl; + cdebug.log(9000) << "Deter| GCell::stepNetDesaturate() depth:" << depth << endl; + cdebug.log(9000) << "Deter| " << this << endl; updateDensity (); @@ -1257,9 +1253,9 @@ namespace Katabatic { if ( segmentDepth < depth ) continue; if ( segmentDepth > depth ) break; - ltrace(500) << "Deter| Move up " << (*isegment) << endl; + cdebug.log(9000) << "Deter| Move up " << (*isegment) << endl; - if ( getGCellGrid()->getKatabatic()->moveUpNetTrunk(*isegment,globalNets,invalidateds) ) + if ( getGCellGrid()->getKatabatic()->moveUpNetTrunk2(*isegment,globalNets,invalidateds) ) return true; } @@ -1393,7 +1389,7 @@ namespace Katabatic { void GCellDensitySet::requeue () { - ltrace(190) << "GCellDensitySet::requeue()" << endl; + cdebug.log(149) << "GCellDensitySet::requeue()" << endl; std::set::iterator iinserted; GCell::SetIndex::iterator igcell = _requests.begin(); diff --git a/katabatic/src/GCellGrid.cpp b/katabatic/src/GCellGrid.cpp index 0c985680..61da3aa1 100644 --- a/katabatic/src/GCellGrid.cpp +++ b/katabatic/src/GCellGrid.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -27,9 +27,6 @@ namespace Katabatic { using namespace std; using Hurricane::tab; - using Hurricane::ltracein; - using Hurricane::ltraceout; - using Hurricane::inltrace; using Hurricane::Error; using Hurricane::ForEachIterator; using Knik::KnikEngine; @@ -76,10 +73,9 @@ namespace Katabatic { _rawSize = _columns * _rows; - ltrace(80) << "Katabatic GCell Matrix [" << getColumns() << "x" << getRows() << "]" << endl; - ltracein(80); - ltrace(80) << "_xGraduations := " << _xGraduations._print() << endl; - ltrace(80) << "_yGraduations := " << _yGraduations._print() << endl; + cdebug.log(145,1) << "Katabatic GCell Matrix [" << getColumns() << "x" << getRows() << "]" << endl; + cdebug.log(145) << "_xGraduations := " << _xGraduations._print() << endl; + cdebug.log(145) << "_yGraduations := " << _yGraduations._print() << endl; for ( unsigned int row=0 ; row < getRows() ; row++ ) { for ( unsigned int column=0; column::iterator it = _gcells.begin(); vector::iterator end = _gcells.end (); for ( ; it != end ; it++ ) (*it)->destroy (); - ltraceout(90); + cdebug.tabw(145,-1); } @@ -140,8 +135,10 @@ namespace Katabatic { Interval side; switch ( direction ) { default: - case Constant::Horizontal: side = Interval(_boundingBox.getXMin(),_boundingBox.getXMax()); break; - case Constant::Vertical: side = Interval(_boundingBox.getYMin(),_boundingBox.getYMax()); break; + cerr << Error( "GCellGrid::getUSide(): Unknown direction flag \"%i\"" + , direction ) << endl; + case KbHorizontal: side = Interval(_boundingBox.getXMin(),_boundingBox.getXMax()); break; + case KbVertical: side = Interval(_boundingBox.getYMin(),_boundingBox.getYMax()); break; } return side; } diff --git a/katabatic/src/Grid.cpp b/katabatic/src/Grid.cpp index e62d5e03..f0e176e5 100644 --- a/katabatic/src/Grid.cpp +++ b/katabatic/src/Grid.cpp @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/katabatic/src/KatabaticEngine.cpp b/katabatic/src/KatabaticEngine.cpp index 208e5fe6..310bb667 100644 --- a/katabatic/src/KatabaticEngine.cpp +++ b/katabatic/src/KatabaticEngine.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -46,8 +46,7 @@ namespace { #if 0 bool isTopAndBottomConnected ( Segment* segment, set& layers ) { - ltrace(88) << "* Potential Null Length: " << segment << endl; - ltracein(88); + cdebug.log(145,1) << "* Potential Null Length: " << segment << endl; Contact* source = dynamic_cast(segment->getSource()); Contact* target = dynamic_cast(segment->getTarget()); @@ -56,7 +55,7 @@ namespace { if (source != NULL) { forEach ( Hook*, ihook, source->getBodyHook()->getSlaveHooks() ) { - ltrace(88) << "* Slave: " << (*ihook)->getComponent() << endl; + cdebug.log(145) << "* Slave: " << (*ihook)->getComponent() << endl; if ((*ihook)->getComponent() == segment) continue; layers.insert( (*ihook)->getComponent()->getLayer() ); } @@ -64,7 +63,7 @@ namespace { if (target != NULL) { forEach ( Hook*, ihook, target->getBodyHook()->getSlaveHooks() ) { - ltrace(88) << "* Slave: " << (*ihook)->getComponent() << endl; + cdebug.log(145) << "* Slave: " << (*ihook)->getComponent() << endl; if ((*ihook)->getComponent() == segment) continue; layers.insert( (*ihook)->getComponent()->getLayer() ); } @@ -74,7 +73,7 @@ namespace { if ( (source->getAnchor() != NULL) or (target->getAnchor() != NULL) ) supplemental++; - ltraceout(88); + cdebug.tabw(145,-1); return layers.size()+supplemental > 2; } @@ -90,9 +89,6 @@ namespace Katabatic { using namespace std; using Hurricane::tab; - using Hurricane::ltracein; - using Hurricane::ltraceout; - using Hurricane::inltrace; using Hurricane::DebugSession; using Hurricane::ForEachIterator; using Hurricane::Bug; @@ -183,22 +179,22 @@ namespace Katabatic { for ( unsigned int depth=0 ; depth<8 ; ++depth ) { // West. forEach( GCell*, igcell, _gcellGrid->getGCellsColumn(depth,0,rows-1)) { - ltrace(89) << "Setting as West Pad:" << (*igcell) << endl; + cdebug.log(145) << "Setting as West Pad:" << (*igcell) << endl; igcell->setUnderIoPad(); } // East. forEach( GCell*, igcell, _gcellGrid->getGCellsColumn(columns-1-depth,0,rows-1)) { - ltrace(89) << "Setting as East Pad:" << (*igcell) << endl; + cdebug.log(145) << "Setting as East Pad:" << (*igcell) << endl; igcell->setUnderIoPad(); } // South. forEach( GCell*, igcell, _gcellGrid->getGCellsRow(depth,0,columns-1)) { - ltrace(89) << "Setting as South Pad:" << (*igcell) << endl; + cdebug.log(145) << "Setting as South Pad:" << (*igcell) << endl; igcell->setUnderIoPad(); } // North. forEach( GCell*, igcell, _gcellGrid->getGCellsRow(rows-1-depth,0,columns-1)) { - ltrace(89) << "Setting as North Pad:" << (*igcell) << endl; + cdebug.log(145) << "Setting as North Pad:" << (*igcell) << endl; igcell->setUnderIoPad(); } } @@ -208,7 +204,7 @@ namespace Katabatic { KatabaticEngine* KatabaticEngine::create ( Cell* cell ) { - ltrace(90) << "KatabaticEngine::create() - " << cell << endl; + cdebug.log(145) << "KatabaticEngine::create() - " << cell << endl; KatabaticEngine* katabatic = new KatabaticEngine( cell ); @@ -224,8 +220,7 @@ namespace Katabatic { void KatabaticEngine::_preDestroy () { - ltrace(90) << "Katabatic::_preDestroy ()" << endl; - ltracein(90); + cdebug.log(145,1) << "Katabatic::_preDestroy ()" << endl; if (getState() < Katabatic::EngineGutted) setState( Katabatic::EnginePreDestroying ); @@ -233,11 +228,11 @@ namespace Katabatic { _gutKatabatic(); _state = EngineGutted; - ltrace(89) << "About to delete base class ToolEngine." << endl; + cdebug.log(145) << "About to delete base class ToolEngine." << endl; ToolEngine::_preDestroy(); - ltrace(89) << "Exiting Katabatic::_preDestroy()." << endl; - ltraceout(90); + cdebug.log(145) << "Exiting Katabatic::_preDestroy()." << endl; + cdebug.tabw(145,-1); cmess2 << " - GCells := " << GCell::getAllocateds() << endl; cmess2 << " - AutoContacts := " << AutoContact::getAllocateds() << endl; @@ -252,13 +247,14 @@ namespace Katabatic { unsetFlags( EngineDestroyBaseContact|EngineDestroyBaseSegment ); if (_state == EngineDriving) { - ltracein(90); - ltrace(90) << "Saving AutoContacts/AutoSegments." << endl; + cdebug.log(145,1) << "Saving AutoContacts/AutoSegments." << endl; - size_t fixedSegments = 0; + size_t fixedSegments = 0; + size_t sameLayerDoglegs = 0; AutoSegmentLut::const_iterator isegment = _autoSegmentLut.begin(); for ( ; isegment != _autoSegmentLut.end() ; ++isegment ) { - if ((*isegment).second->isFixed()) fixedSegments++; + if ((*isegment).second->isFixed()) ++fixedSegments; + if ((*isegment).second->reduceDoglegLayer()) ++sameLayerDoglegs; } cmess1 << " o Driving Hurricane data-base." << endl; @@ -266,17 +262,18 @@ namespace Katabatic { cmess1 << Dots::asSizet(" - Active AutoContacts",AutoContact::getAllocateds()-fixedSegments*2) << endl; cmess1 << Dots::asSizet(" - AutoSegments" ,AutoSegment::getAllocateds()) << endl; cmess1 << Dots::asSizet(" - AutoContacts" ,AutoContact::getAllocateds()) << endl; + cmess1 << Dots::asSizet(" - Same Layer doglegs" ,sameLayerDoglegs) << endl; forEach ( Net*, inet, _cell->getNets() ) _saveNet( *inet ); //_autoContactLut.clear (); - ltraceout(90); + cdebug.tabw(145,-1); } if (_state < EngineGutted ) { - ltrace(90) << "Gutting Katabatic." << endl; + cdebug.log(145) << "Gutting Katabatic." << endl; _state = EngineGutted; setFlags( EngineDestroyBaseContact ); @@ -429,7 +426,7 @@ namespace Katabatic { void KatabaticEngine::_destroyAutoSegments () { - ltrace(90) << "Katabatic::_destroyAutoSegments ()" << endl; + cdebug.log(145) << "Katabatic::_destroyAutoSegments ()" << endl; size_t expandeds = 0; @@ -448,7 +445,7 @@ namespace Katabatic { void KatabaticEngine::_destroyAutoContacts () { - ltrace(90) << "Katabatic::_destroyAutoContacts ()" << endl; + cdebug.log(145) << "Katabatic::_destroyAutoContacts ()" << endl; AutoContactLut::iterator it = _autoContactLut.begin(); AutoContactLut::iterator end = _autoContactLut.end (); @@ -538,7 +535,7 @@ namespace Katabatic { void KatabaticEngine::finalizeLayout () { - ltrace(90) << "Katabatic::finalizeLayout()" << endl; + cdebug.log(145) << "Katabatic::finalizeLayout()" << endl; if (_state > EngineDriving) return; _state = EngineDriving; @@ -554,10 +551,10 @@ namespace Katabatic { void KatabaticEngine::_alignate ( Net* net ) { - DebugSession::open( net, 99 ); + DebugSession::open( net, 140, 150 ); - ltrace(100) << "Katabatic::_alignate( " << net << " )" << endl; - ltracein(99); + cdebug.log(149) << "Katabatic::_alignate( " << net << " )" << endl; + cdebug.tabw(145,1); //cmess2 << " - " << getString(net) << endl; @@ -578,33 +575,33 @@ namespace Katabatic { AutoSegment* seedSegment = unexploreds[i]; if (exploredSegments.find(seedSegment->base()) == exploredSegments.end()) { - ltrace(99) << "New chunk from: " << seedSegment << endl; + cdebug.log(145) << "New chunk from: " << seedSegment << endl; aligneds.push_back( seedSegment ); forEach ( AutoSegment*, collapsed, seedSegment->getAligneds() ) { - ltrace(99) << "Aligned: " << *collapsed << endl; + cdebug.log(145) << "Aligned: " << *collapsed << endl; aligneds.push_back( *collapsed ); exploredSegments.insert( collapsed->base() ); } - ltracein(99); + cdebug.tabw(145,1); sort( aligneds.begin(), aligneds.end(), AutoSegment::CompareId() ); - ltrace(99) << "Seed: " << (void*)aligneds[0]->base() << " " << aligneds[0] << endl; + cdebug.log(145) << "Seed: " << (void*)aligneds[0]->base() << " " << aligneds[0] << endl; for ( size_t j=1 ; jbase()) << " " << aligneds[j] << endl; + cdebug.log(145) << "Secondary: " << (void*)(aligneds[j]->base()) << " " << aligneds[j] << endl; } - ltrace(159) << "Align on " << aligneds[0] + cdebug.log(149) << "Align on " << aligneds[0] << " " << DbU::toLambda(aligneds[0]->getAxis()) << endl; aligneds[0]->setAxis( aligneds[0]->getAxis(), KbRealignate ); aligneds.clear(); - ltraceout(99); + cdebug.tabw(145,-1); } } - ltraceout(99); + cdebug.tabw(145,-1); DebugSession::close(); } @@ -612,10 +609,10 @@ namespace Katabatic { void KatabaticEngine::updateNetTopology ( Net* net ) { - DebugSession::open( net ); + DebugSession::open( net, 140, 150 ); - ltrace(100) << "Katabatic::updateNetTopology( " << net << " )" << endl; - ltracein(99); + cdebug.log(149) << "Katabatic::updateNetTopology( " << net << " )" << endl; + cdebug.tabw(145,1); vector contacts; forEach ( Component*, icomponent, net->getComponents() ) { @@ -630,17 +627,17 @@ namespace Katabatic { for ( size_t i=0 ; iupdateTopology(); - ltraceout(99); + cdebug.tabw(145,-1); DebugSession::close(); } void KatabaticEngine::_computeNetTerminals ( Net* net ) { - DebugSession::open( net, 88 ); + DebugSession::open( net, 140, 150 ); - ltrace(100) << "Katabatic::_computeNetTerminals( " << net << " )" << endl; - ltracein(99); + cdebug.log(149) << "Katabatic::_computeNetTerminals( " << net << " )" << endl; + cdebug.tabw(145,1); vector segments; forEach ( Segment*, segment, net->getSegments() ) { @@ -649,7 +646,7 @@ namespace Katabatic { if (autoSegment->isInvalidated()) autoSegment->computeTerminal(); } - ltraceout(99); + cdebug.tabw(145,-1); DebugSession::close(); } @@ -657,13 +654,13 @@ namespace Katabatic { void KatabaticEngine::_saveNet ( Net* net ) { - DebugSession::open( net, 88 ); + DebugSession::open( net, 140, 150 ); - ltrace(90) << "Katabatic::_saveNet() " << net << endl; - ltracein(90); + cdebug.log(145) << "Katabatic::_saveNet() " << net << endl; + cdebug.tabw(145,1); #if 0 - ltrace(90) << "Deleting zero-length segments." << endl; + cdebug.log(145) << "Deleting zero-length segments." << endl; vector nullSegments; set connectedLayers; @@ -677,13 +674,13 @@ namespace Katabatic { } if (Session::lookup(*segment) == NULL) { - ltrace(90) << "* Not associated to an AutoSegment: " << *segment << endl; + cdebug.log(145) << "* Not associated to an AutoSegment: " << *segment << endl; continue; } if (not isTopAndBottomConnected(*segment,connectedLayers)) { nullSegments.push_back( *segment ); - ltrace(90) << "* Null Length: " << *segment << endl; + cdebug.log(145) << "* Null Length: " << *segment << endl; } } @@ -706,20 +703,20 @@ namespace Katabatic { swap( source, target ); } - ltrace(90) << "Deleting: " << nullSegments[i] << endl; + cdebug.log(145) << "Deleting: " << nullSegments[i] << endl; if (isTopAndBottomConnected(nullSegments[i],connectedLayers)) { - ltrace(90) << "Deletion cancelled, no longer top or bottom connected." << endl; + cdebug.log(145) << "Deletion cancelled, no longer top or bottom connected." << endl; continue; } - ltrace(90) << "* Source: " << (void*)source << " " << source << endl; - ltrace(90) << "* Target: " << (void*)target << " " << target << endl; + cdebug.log(145) << "* Source: " << (void*)source << " " << source << endl; + cdebug.log(145) << "* Target: " << (void*)target << " " << target << endl; const Layer* layer = DataBase::getDB()->getTechnology() ->getViaBetween( *connectedLayers.begin(), *connectedLayers.rbegin() ); - ltrace(90) << *connectedLayers.begin() << " + " << *connectedLayers.rbegin() << endl; - ltrace(90) << "* Shrink layer: " << layer << endl; + cdebug.log(145) << *connectedLayers.begin() << " + " << *connectedLayers.rbegin() << endl; + cdebug.log(145) << "* Shrink layer: " << layer << endl; if ( !layer ) { cerr << Error("NULL contact layer while deleting %s." ,getString(nullSegments[i]).c_str()) << endl; @@ -733,7 +730,7 @@ namespace Katabatic { while ( masterHook->getNextHook() != source->getBodyHook() ) { slaveHooks.push_back( masterHook->getNextHook() ); - ltrace(90) << "* detach: " + cdebug.log(145) << "* detach: " << (void*)masterHook->getNextHook()->getComponent() << " " << masterHook->getNextHook()->getComponent() << endl; masterHook->getNextHook()->detach(); @@ -745,35 +742,34 @@ namespace Katabatic { slaveHooks[j]->attach( masterHook ); } - ltrace(90) << (void*)target << " " << target << " setLayer: " << layer << endl; + cdebug.log(145) << (void*)target << " " << target << " setLayer: " << layer << endl; target->setLayer( layer ); } unsetFlags( EngineDestroyBaseSegment ); #endif - ltraceout(90); + cdebug.tabw(145,-1); DebugSession::close(); } void KatabaticEngine::_check ( Net* net ) const { - ltrace(200) << "Checking " << net << endl; - ltracein(200); + cdebug.log(149,1) << "Checking " << net << endl; forEach ( Segment*, isegment, net->getComponents().getSubSet() ) { AutoSegment* autoSegment = _lookup ( *isegment ); - ltrace(200) << autoSegment << endl; + cdebug.log(149) << autoSegment << endl; if ( autoSegment ) { AutoContact* autoContact = autoSegment->getAutoSource(); - ltrace(200) << autoContact << endl; + cdebug.log(149) << autoContact << endl; if ( autoContact ) autoContact->checkTopology (); autoContact = autoSegment->getAutoTarget(); - ltrace(200) << autoContact << endl; + cdebug.log(149) << autoContact << endl; if ( autoContact ) autoContact->checkTopology (); } } - ltraceout(200); + cdebug.tabw(149,-1); } diff --git a/katabatic/src/LayerAssign.cpp b/katabatic/src/LayerAssign.cpp index 10760474..e9d5a3c4 100644 --- a/katabatic/src/LayerAssign.cpp +++ b/katabatic/src/LayerAssign.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -39,8 +39,6 @@ namespace Katabatic { using Hurricane::DebugSession; - using Hurricane::ltracein; - using Hurricane::ltraceout; using Hurricane::ForEachIterator; using Hurricane::Warning; @@ -72,11 +70,11 @@ namespace Katabatic { std::set::const_iterator igcell = queue.getGCells().begin(); size_t i = 0; for ( ; igcell!=queue.getGCells().end() ; ++igcell, ++i ) { - ltrace(400) << "_desaturate: [" << depth << "]:" + cdebug.log(149) << "_desaturate: [" << depth << "]:" << (*igcell)->getDensity(depth) << " " << *igcell << endl; if (not (*igcell)->isSaturated(depth)) { - ltrace(400) << "STOP desaturated: @" << i << " " << *igcell << endl; + cdebug.log(149) << "STOP desaturated: @" << i << " " << *igcell << endl; for ( ; igcell!=queue.getGCells().end() ; ++igcell ) { if ( (*igcell)->isSaturated( depth ) ) { cparanoid << "[ERROR] Still saturated: @" << i << " " << *igcell << endl; @@ -100,10 +98,10 @@ namespace Katabatic { void KatabaticEngine::_layerAssignByLength ( Net* net, unsigned long& total, unsigned long& global, set& globalNets ) { - DebugSession::open ( net, 90 ); + DebugSession::open ( net, 140, 150 ); - ltrace(100) << "Katabatic::_layerAssignByLength( " << net << " )" << endl; - ltracein(99); + cdebug.log(149) << "Katabatic::_layerAssignByLength( " << net << " )" << endl; + cdebug.tabw(145,1); bool isGlobal = false; set globalContacts; @@ -122,7 +120,7 @@ namespace Katabatic { } } - ltraceout(99); + cdebug.tabw(145,-1); DebugSession::close(); } @@ -142,10 +140,10 @@ namespace Katabatic { void KatabaticEngine::_layerAssignByTrunk ( Net* net, set& globalNets, unsigned long& total, unsigned long& global ) { - DebugSession::open( net, 90 ); + DebugSession::open( net, 140, 150 ); - ltrace(100) << "Katabatic::_layerAssignByTrunk ( " << net << " )" << endl; - ltracein(99); + cdebug.log(149) << "Katabatic::_layerAssignByTrunk ( " << net << " )" << endl; + cdebug.tabw(145,1); bool isGlobal = false; unsigned long netGlobal = 0; @@ -171,7 +169,7 @@ namespace Katabatic { if ( autoSegment and not autoSegment->isStrongTerminal() ) { netGlobal++; - ltrace(99) << "Migrate to M4/M5: " << autoSegment << endl; + cdebug.log(145) << "Migrate to M4/M5: " << autoSegment << endl; if (autoSegment->isHorizontal()) autoSegment->setLayer( Session::getRoutingLayer(3) ); if (autoSegment->isVertical ()) autoSegment->setLayer( Session::getRoutingLayer(4) ); } @@ -181,7 +179,7 @@ namespace Katabatic { total += netTotal; global += netGlobal; - ltraceout(99); + cdebug.tabw(145,-1); DebugSession::close(); } @@ -202,9 +200,9 @@ namespace Katabatic { void KatabaticEngine::moveULeft ( AutoSegment* seed, set& globalNets, GCell::SetIndex& invalidateds ) { Net* net = seed->getNet(); - DebugSession::open( net, 90 ); + DebugSession::open( net, 140, 150 ); - ltrace(500) << "Deter| Move left: " << seed << endl; + cdebug.log(9000) << "Deter| Move left: " << seed << endl; seed->moveULeft(); globalNets.insert( net ); @@ -239,9 +237,9 @@ namespace Katabatic { void KatabaticEngine::moveURight ( AutoSegment* seed, set& globalNets, GCell::SetIndex& invalidateds ) { Net* net = seed->getNet(); - DebugSession::open( net, 90 ); + DebugSession::open( net, 140, 150 ); - ltrace(500) << "Deter| Move right: " << seed << endl; + cdebug.log(9000) << "Deter| Move right: " << seed << endl; seed->moveURight(); globalNets.insert( net ); @@ -273,20 +271,114 @@ namespace Katabatic { } + bool KatabaticEngine::moveUpNetTrunk2 ( AutoSegment* seed, set& globalNets, GCell::SetIndex& invalidateds ) + { + Net* net = seed->getNet(); + unsigned int seedDepth = Session::getRoutingGauge()->getLayerDepth(seed->getLayer()); + + DebugSession::open( net, 140, 150 ); + cdebug.log(9000) << "Deter| moveUpNetTrunk() depth:" << seedDepth << " " << seed << endl; + + if (not seed->canMoveUp( 1.0, KbPropagate|KbAllowTerminal|KbNoCheckLayer) ) { + cdebug.log(9000) << "Deter| Reject seed move up, cannot move up." << endl; + DebugSession::close(); + return false; + } + cdebug.tabw(149,1); + + globalNets.insert( net ); + + vector< pair > stack; + vector globals; + vector locals; + + stack.push_back( pair(NULL,seed) ); + while ( not stack.empty() ) { + AutoContact* from = stack.back().first; + AutoSegment* segment = stack.back().second; + stack.pop_back(); + + if (segment->isLocal()) { + if (not segment->isStrongTerminal()) locals.push_back( segment ); + continue; + } + if ( (segment->getLength() < 3*Session::getSliceHeight()) and (segment != seed) ) { + locals.push_back( segment ); + continue; + } + + // Do something here. + if (not segment->canMoveUp(1.0,KbPropagate|KbAllowTerminal|KbNoCheckLayer|KbCheckLowDensity) ) + continue; + + globals.push_back( segment ); + + AutoContact* source = segment->getAutoSource(); + if (source != from) { + for ( AutoSegment* connected : source->getAutoSegments() ) { + if (connected != segment) { stack.push_back( make_pair(source,connected) ); } + } + } + AutoContact* target = segment->getAutoTarget(); + if (target != from) { + for ( AutoSegment* connected : target->getAutoSegments() ) { + if (connected != segment) { stack.push_back( make_pair(target,connected) ); } + } + } + } + + for ( size_t i=0 ; igetLayerDepth( globals[i]->getLayer() ); + globals[i]->changeDepth( depth+2, KbWithNeighbors ); + + vector gcells; + globals[i]->getGCells( gcells ); + for ( size_t j=0 ; jgetLayerDepth(locals[i]->getLayer()); + if (depth > seedDepth+1) continue; + + if (locals[i]->canPivotUp(2.0,KbPropagate|KbNoCheckLayer)) { + locals[i]->changeDepth( depth+2, KbWithNeighbors ); + + //cdebug.log(9000) << "Deter| Trunk move up L:" << locals[i] << endl; + + vector gcells; + locals[i]->getGCells( gcells ); + for ( size_t j=0 ; j& globalNets, GCell::SetIndex& invalidateds ) { Net* net = seed->getNet(); unsigned int seedDepth = Session::getRoutingGauge()->getLayerDepth(seed->getLayer()); - DebugSession::open( net, 90 ); - ltrace(500) << "Deter| moveUpNetTrunk() depth:" << seedDepth << " " << seed << endl; + DebugSession::open( net, 140, 150 ); + cdebug.log(9000) << "Deter| moveUpNetTrunk() depth:" << seedDepth << " " << seed << endl; if (not seed->canMoveUp( 1.0, KbPropagate|KbAllowTerminal|KbNoCheckLayer) ) { - ltrace(500) << "Deter| Reject seed move up, cannot move up." << endl; + cdebug.log(9000) << "Deter| Reject seed move up, cannot move up." << endl; DebugSession::close(); return false; } - ltracein(400); + cdebug.tabw(149,1); globalNets.insert( net ); @@ -296,7 +388,7 @@ namespace Katabatic { forEach ( Segment*, isegment, net->getSegments() ) { AutoSegment* autoSegment = Session::lookup( *isegment ); - //ltrace(500) << "Deter| Loop " << autoSegment << endl; + //cdebug.log(9000) << "Deter| Loop " << autoSegment << endl; if (not autoSegment) continue; if (autoSegment->isLocal()) { @@ -315,7 +407,7 @@ namespace Katabatic { sort( locals.begin(), locals.end(), AutoSegment::CompareId() ); for ( size_t i=0 ; igetLayerDepth( globals[i]->getLayer() ); if (depth > seedDepth+1) continue; @@ -325,7 +417,7 @@ namespace Katabatic { if ( globals[i]->canMoveUp(1.0,KbPropagate|KbAllowTerminal|KbNoCheckLayer) ) { globals[i]->changeDepth( depth+2, KbWithNeighbors ); - //ltrace(500) << "Deter| Trunk move up G:" << globals[i] << endl; + //cdebug.log(9000) << "Deter| Trunk move up G:" << globals[i] << endl; vector gcells; globals[i]->getGCells( gcells ); @@ -333,12 +425,12 @@ namespace Katabatic { invalidateds.insert( gcells[j] ); } } else { - //ltrace(500) << "Deter| Reject Trunk move up G:" << globals[i] << endl; + //cdebug.log(9000) << "Deter| Reject Trunk move up G:" << globals[i] << endl; } } for ( size_t i=0 ; igetLayerDepth(locals[i]->getLayer()); if (depth > seedDepth+1) continue; @@ -346,7 +438,7 @@ namespace Katabatic { if (locals[i]->canPivotUp(2.0,KbPropagate|KbNoCheckLayer)) { locals[i]->changeDepth( depth+2, KbWithNeighbors ); - //ltrace(500) << "Deter| Trunk move up L:" << locals[i] << endl; + //cdebug.log(9000) << "Deter| Trunk move up L:" << locals[i] << endl; vector gcells; locals[i]->getGCells( gcells ); @@ -356,7 +448,7 @@ namespace Katabatic { } } - ltraceout(400); + cdebug.tabw(149,-1); DebugSession::close(); return true; @@ -383,11 +475,11 @@ namespace Katabatic { std::set::const_iterator igcell = queue.getGCells().begin(); size_t i = 0; for ( ; igcell!=queue.getGCells().end() ; ++igcell, ++i ) { - ltrace(400) << "_balance: [" << depth << "]:" + cdebug.log(149) << "_balance: [" << depth << "]:" << (*igcell)->getDensity(depth) << " " << *igcell << endl; if (not (*igcell)->isSaturated(depth)) { - ltrace(400) << "STOP desaturated: @" << i << " " << *igcell << endl; + cdebug.log(149) << "STOP desaturated: @" << i << " " << *igcell << endl; for ( ; igcell!=queue.getGCells().end() ; ++igcell ) { if ((*igcell)->isSaturated(depth)) { cparanoid << Error( "Still saturated: @%d %s", i, getString(*igcell).c_str() ) << endl; @@ -416,7 +508,7 @@ namespace Katabatic { void KatabaticEngine::balanceGlobalDensity () { - ltrace(500) << "Deter| Balance Global Density" << endl; + cdebug.log(9000) << "Deter| Balance Global Density" << endl; //_balanceGlobalDensity( 1 ); // metal2 //_balanceGlobalDensity( 2 ); // metal3 @@ -462,7 +554,7 @@ namespace Katabatic { void KatabaticEngine::layerAssign ( unsigned int method ) { - ltrace(500) << "Deter| Layer Assignment" << endl; + cdebug.log(9000) << "Deter| Layer Assignment" << endl; set globalNets; diff --git a/katabatic/src/LoadGrByNet.cpp b/katabatic/src/LoadGrByNet.cpp index c08f1909..da45b2dc 100644 --- a/katabatic/src/LoadGrByNet.cpp +++ b/katabatic/src/LoadGrByNet.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -21,6 +21,8 @@ #include "hurricane/Warning.h" #include "hurricane/DebugSession.h" #include "hurricane/Layer.h" +#include "hurricane/BasicLayer.h" +#include "hurricane/RegularLayer.h" #include "hurricane/Technology.h" #include "hurricane/DataBase.h" #include "hurricane/Net.h" @@ -47,6 +49,9 @@ namespace { + using Katabatic::AutoContactTerminal; + + /*! \defgroup LoadGlobalRouting Global Routing Loading * \brief Translation rules to build detailed routing from global * @@ -111,6 +116,12 @@ namespace { * * \brief Build the wiring for a Net inside a GCell (\b internal). * + * As this class is called to initially construct the Katabatic wiring, + * it must build a \b connex wiring. That is without gaps in layer depth, + * because the topology restauration mechanism (AutoContact::updateTopology()) + * of the AutoContact cannot work until all AutoSegments are revalidated at + * least once. The topology restauration work by creating doglegs which in turn, + * call the canonization, which needs all the caches to be up to date. */ //! \function void GCellTopology::doRp_AutoContacts ( GCell* gcell, Component* rp, AutoContact*& source, AutoContact*& target, unsigned int flags ); @@ -171,6 +182,33 @@ namespace { //! //! \image html doRp_Access.png "doRp_Access()" +//! \function AutoContact* GCellTopology::doRp_AccessPad ( RoutingPad* rp, unsigned int flags ); +//! \param rp The Component onto which anchor the access contact. +//! \param flags Relevant flags are: +//! - HAccess, the terminal is to be accessed through an horizontal +//! segment. +//! - VSmall, force the terminal to be considered as small in the +//! vertical direction. +//! \return A Katabatic::AutoContactTerminal . +//! +//! The Component \c rp is a RoutingPad which belongs to a pad cell. This case +//! occurs when we are routing a complete chip. This method build, from the +//! \c rp a stack of articulated punctual segments and contacts to reach the +//! default H/V routing layers (usually \c METAL2 & \c METAL3). This may be +//! needed when the pad terminal is in \c METAL5, for instance. +//! +//! The returned AutoContactTerminal is anchored on the last punctual segment +//! build. +//! +//! The GCell into which the AutoContactTerminal is created may be under the +//! pads area. However, it will be right on the border of the GCell. +//! The global router vertexes of GCell under the pad area are marked as +//! blocked so will never be used for routing. +//! +//! \remark The segments and contacts added to ensure the layer connexity are not +//! put into the Katabatic database. They are plain Hurricane objects, invisibles +//! from it. + //! \function void GCellTopology::doRp_StairCaseH ( GCell* gcell, Component* rp1, Component* rp2 ); //! //! Build the wiring to connect to horizontal Component. Two cases: @@ -187,7 +225,17 @@ namespace { //! //! \image html doRp_StairCaseV.png "doRp_StairCaseV()" -//! \function GCellTopology::_do_xG (); +//! \function void GCellTopology::_do_xG_1Pad (); +//! +//! Construct the topology, when there is only global wires and one local +//! terminal, but coming from a Pad. As thoses connectors will always be +//! on one border of the GCell they can be considered as a kind of global. +//! +//! So this method mostly calls GCellTopology::doRp_AccessPad() to create +//! the AutoContactTerminal, then calls GCellTopology::_do_xG(), except +//! for straight lines which are managed directly. + +//! \function void GCellTopology::_do_xG (); //! //! Construct the topology, when there is only global wires (no local terminals). //! @@ -450,7 +498,7 @@ namespace { flags |= (height < 3*Session::getPitch(anchorDepth)) ? VSmall : 0; flags |= ((width == 0) && (height == 0)) ? Punctual : 0; - ltrace(99) << "::checkRoutingPadSize(): pitch[" << anchorDepth << "]:" + cdebug.log(145) << "::checkRoutingPadSize(): pitch[" << anchorDepth << "]:" << DbU::toLambda(Session::getPitch(anchorDepth)) << " " << ((flags & HSmall) ? "HSmall " : " ") << ((flags & VSmall) ? "VSmall " : " ") @@ -575,7 +623,7 @@ namespace { inline void ForkStack::push ( Hook* from, AutoContact* contact ) { - ltrace(80) << " Stacking " << from << " + " << contact << endl; + cdebug.log(145) << " Stacking " << from << " + " << contact << endl; _stack.push_back( Element(from,contact) ); } @@ -594,6 +642,7 @@ namespace { inline GCell* getGCell () const; static void doRp_AutoContacts ( GCell*, Component*, AutoContact*& source, AutoContact*& target, unsigned int flags ); static AutoContact* doRp_Access ( GCell*, Component*, unsigned int flags ); + static AutoContact* doRp_AccessPad ( RoutingPad*, unsigned int flags ); static void doRp_StairCaseH ( GCell*, Component* rp1, Component* rp2 ); static void doRp_StairCaseV ( GCell*, Component* rp1, Component* rp2 ); private: @@ -604,17 +653,18 @@ namespace { void _do_1G_xM1 (); void _do_xG_xM1_xM3 (); void _do_xG_1M1_1M2 (); + void _do_4G_1M2 (); void _do_xG_xM2 (); void _do_1G_1M3 (); void _do_xG_xM3 (); private: - enum ConnexityBits { GlobalBSize = 3 - , Metal1BSize = 3 - , Metal2BSize = 3 - , Metal3BSize = 3 - , PadsBSize = 3 - , PinsBSize = 3 + enum ConnexityBits { GlobalBSize = 4 + , Metal1BSize = 4 + , Metal2BSize = 4 + , Metal3BSize = 4 + , PadsBSize = 4 + , PinsBSize = 4 }; #define CONNEXITY_VALUE( Gs, M1s, M2s, M3s, pads, pins ) \ @@ -634,6 +684,7 @@ namespace { , Conn_1G_2M1 = CONNEXITY_VALUE( 1, 2, 0, 0, 0 , 0 ) , Conn_1G_3M1 = CONNEXITY_VALUE( 1, 3, 0, 0, 0 , 0 ) , Conn_1G_4M1 = CONNEXITY_VALUE( 1, 4, 0, 0, 0 , 0 ) + , Conn_1G_5M1 = CONNEXITY_VALUE( 1, 5, 0, 0, 0 , 0 ) , Conn_1G_1M2 = CONNEXITY_VALUE( 1, 0, 1, 0, 0 , 0 ) , Conn_1G_2M2 = CONNEXITY_VALUE( 1, 0, 2, 0, 0 , 0 ) , Conn_1G_3M2 = CONNEXITY_VALUE( 1, 0, 3, 0, 0 , 0 ) @@ -649,6 +700,7 @@ namespace { , Conn_2G_2M1 = CONNEXITY_VALUE( 2, 2, 0, 0, 0 , 0 ) , Conn_2G_3M1 = CONNEXITY_VALUE( 2, 3, 0, 0, 0 , 0 ) , Conn_2G_4M1 = CONNEXITY_VALUE( 2, 4, 0, 0, 0 , 0 ) + , Conn_2G_5M1 = CONNEXITY_VALUE( 2, 5, 0, 0, 0 , 0 ) , Conn_2G_1M2 = CONNEXITY_VALUE( 2, 0, 1, 0, 0 , 0 ) , Conn_2G_2M2 = CONNEXITY_VALUE( 2, 0, 2, 0, 0 , 0 ) , Conn_2G_3M2 = CONNEXITY_VALUE( 2, 0, 3, 0, 0 , 0 ) @@ -664,6 +716,7 @@ namespace { , Conn_3G_3M1 = CONNEXITY_VALUE( 3, 3, 0, 0, 0 , 0 ) , Conn_3G_4M1 = CONNEXITY_VALUE( 3, 4, 0, 0, 0 , 0 ) , Conn_3G_1M2 = CONNEXITY_VALUE( 3, 0, 1, 0, 0 , 0 ) + , Conn_3G_2M2 = CONNEXITY_VALUE( 3, 0, 2, 0, 0 , 0 ) , Conn_3G_1M3 = CONNEXITY_VALUE( 3, 0, 0, 1, 0 , 0 ) , Conn_3G_2M3 = CONNEXITY_VALUE( 3, 0, 0, 2, 0 , 0 ) , Conn_3G_3M3 = CONNEXITY_VALUE( 3, 0, 0, 3, 0 , 0 ) @@ -673,6 +726,7 @@ namespace { , Conn_4G_2M1 = CONNEXITY_VALUE( 4, 2, 0, 0, 0 , 0 ) , Conn_4G_3M1 = CONNEXITY_VALUE( 4, 3, 0, 0, 0 , 0 ) , Conn_4G_4M1 = CONNEXITY_VALUE( 4, 4, 0, 0, 0 , 0 ) + , Conn_4G_1M2 = CONNEXITY_VALUE( 4, 0, 1, 0, 0 , 0 ) , Conn_4G_1M3 = CONNEXITY_VALUE( 4, 0, 0, 1, 0 , 0 ) , Conn_1G_1Pad = CONNEXITY_VALUE( 1, 0, 0, 0, 1 , 0 ) , Conn_2G_1Pad = CONNEXITY_VALUE( 2, 0, 0, 0, 1 , 0 ) @@ -720,7 +774,7 @@ namespace { Hook* _west; Hook* _north; Hook* _south; - vector _routingPads; + vector _routingPads; }; @@ -765,15 +819,24 @@ namespace { { _connexity.connexity = 0; - ltrace(99) << "GCellTopology::GCellTopology()" << endl; - ltracein(99); - ltrace(99) << getString(fromHook) << endl; - ltrace(99) << sourceContact << endl; + cdebug.log(145,1) << "GCellTopology::GCellTopology()" << endl; + cdebug.log(145) << getString(fromHook) << endl; + cdebug.log(145) << sourceContact << endl; Segment* fromSegment = static_cast( _fromHook->getComponent() ); _net = fromSegment->getNet(); forEach ( Hook*, hook, fromHook->getHooks() ) { + cdebug.log(145) << "Topology [" << _connexity.connexity << "] = " + << "[" << _connexity.fields.globals + << "+" << _connexity.fields.M1 + << "+" << _connexity.fields.M2 + << "+" << _connexity.fields.M3 + << "+" << _connexity.fields.Pin + << "+" << _connexity.fields.Pad + << "] " << _gcell + << endl; + Segment* toSegment = dynamic_cast( hook->getComponent() ); if (toSegment) { @@ -789,7 +852,7 @@ namespace { Component* anchor = hook->getComponent(); RoutingPad* rp = dynamic_cast( anchor ); - ltrace(99) << "| Looking for Anchor:" << anchor << " rp:" << rp << endl; + cdebug.log(145) << "| Looking for Anchor:" << anchor << " rp:" << rp << endl; if (anchor) { Contact* contact = dynamic_cast( anchor ); @@ -798,8 +861,8 @@ namespace { or Session::getKatabatic()->isGMetal ( anchor->getLayer() )) ) { // Global routing articulation contact are in not ? GCell* gcell = gcellGrid->getGCell( contact->getCenter() ); - ltrace(99) << "* Global Routing Articulation: " << contact << endl; - ltrace(99) << "| " << gcell << endl; + cdebug.log(145) << "* Global Routing Articulation: " << contact << endl; + cdebug.log(145) << "| " << gcell << endl; if (gcell == NULL) throw Error( invalidGCell ); if (_gcell == NULL) _gcell = gcell; @@ -828,16 +891,16 @@ namespace { if (dynamic_cast(rp->getOccurrence().getEntity())) _connexity.fields.Pin++; } - ltrace(99) << "| Component to connect: " << anchor << endl; - _routingPads.push_back( anchor ); + cdebug.log(145) << "| Component to connect: " << anchor << endl; + _routingPads.push_back( rp ); } } } } - ltrace(99) << "east: " << _east << endl; - ltrace(99) << "west: " << _west << endl; - ltrace(99) << "north:" << _north << endl; - ltrace(99) << "south:" << _south << endl; + cdebug.log(145) << "east: " << _east << endl; + cdebug.log(145) << "west: " << _west << endl; + cdebug.log(145) << "north:" << _north << endl; + cdebug.log(145) << "south:" << _south << endl; if (_connexity.fields.globals == 1) { if ( _north or _south ) _topology |= Global_Vertical_End; @@ -850,7 +913,7 @@ namespace { _topology |= Global_Fork; } - ltraceout(99); + cdebug.tabw(145,-1); if (_gcell == NULL) throw Error( missingGCell ); } @@ -858,8 +921,7 @@ namespace { void GCellTopology::construct ( ForkStack& forks ) { - ltrace(99) << "GCellTopology::construct() [" << _connexity.connexity << "] in " << _gcell << endl; - ltracein(99); + cdebug.log(145,1) << "GCellTopology::construct() [" << _connexity.connexity << "] in " << _gcell << endl; _southWestContact = NULL; _northEastContact = NULL; @@ -874,7 +936,8 @@ namespace { case Conn_1G_1M1: _do_1G_1M1(); break; case Conn_1G_2M1: case Conn_1G_3M1: - case Conn_1G_4M1: _do_1G_xM1(); break; + case Conn_1G_4M1: + case Conn_1G_5M1: _do_1G_xM1(); break; case Conn_1G_1M2: case Conn_1G_2M2: case Conn_1G_3M2: @@ -889,6 +952,7 @@ namespace { case Conn_2G_2M1: case Conn_2G_3M1: case Conn_2G_4M1: + case Conn_2G_5M1: case Conn_3G_1M1: case Conn_3G_2M1: case Conn_3G_3M1: @@ -900,11 +964,13 @@ namespace { case Conn_4G_2M1: case Conn_4G_3M1: case Conn_4G_4M1: _do_xG_xM1_xM3(); break; + case Conn_4G_1M2: _do_4G_1M2(); break; case Conn_2G_1M2: case Conn_2G_2M2: case Conn_2G_3M2: case Conn_2G_4M2: - case Conn_3G_1M2: _do_xG_xM2(); break; + case Conn_3G_1M2: + case Conn_3G_2M2: _do_xG_xM2(); break; case Conn_2G_1M3: case Conn_2G_2M3: case Conn_2G_3M3: @@ -954,16 +1020,16 @@ namespace { ); globalSegment->setFlags( (_degree == 2) ? SegBipoint : 0 ); - ltrace(99) << "Create global segment: " << globalSegment << endl; + cdebug.log(145) << "Create global segment: " << globalSegment << endl; #if THIS_IS_DEPRECATED if ( globalSegment->isHorizontal() and ( (Session::getRoutingGauge()->getLayerDepth(_sourceContact->getLayer()->getBottom()) > 1) or (Session::getRoutingGauge()->getLayerDepth(targetContact ->getLayer()->getBottom()) > 1)) ) { globalSegment->setLayer ( Session::getRoutingLayer(3) ); - ltrace(99) << "Source:" << _sourceContact << endl; - ltrace(99) << "Target:" << targetContact << endl; - ltrace(99) << "Moving up global:" << globalSegment << endl; + cdebug.log(145) << "Source:" << _sourceContact << endl; + cdebug.log(145) << "Target:" << targetContact << endl; + cdebug.log(145) << "Moving up global:" << globalSegment << endl; } #endif // HARDCODED VALUE. @@ -971,7 +1037,7 @@ namespace { _toFixSegments.push_back( globalSegment ); if (_connexity.fields.globals < 2) { - ltraceout(99); + cdebug.tabw(145,-1); return; } } else @@ -980,30 +1046,30 @@ namespace { if ( _east and (_fromHook != _east) ) { Hook* toHook = getSegmentOppositeHook( _east ); - ltrace(99) << "Pushing East (to) " << getString(toHook) << endl; - ltrace(99) << "Pushing East (from) " << _northEastContact << endl; + cdebug.log(145) << "Pushing East (to) " << getString(toHook) << endl; + cdebug.log(145) << "Pushing East (from) " << _northEastContact << endl; forks.push( toHook, _northEastContact ); } if ( _west and (_fromHook != _west) ) { Hook* toHook = getSegmentOppositeHook( _west ); - ltrace(99) << "Pushing West (to) " << getString(toHook) << endl; - ltrace(99) << "Pushing West (from) " << _southWestContact << endl; + cdebug.log(145) << "Pushing West (to) " << getString(toHook) << endl; + cdebug.log(145) << "Pushing West (from) " << _southWestContact << endl; forks.push( toHook, _southWestContact ); } if ( _north and (_fromHook != _north) ) { Hook* toHook = getSegmentOppositeHook( _north ); - ltrace(99) << "Pushing North (to) " << getString(toHook) << endl; - ltrace(99) << "Pushing North (from) " << _northEastContact << endl; + cdebug.log(145) << "Pushing North (to) " << getString(toHook) << endl; + cdebug.log(145) << "Pushing North (from) " << _northEastContact << endl; forks.push( toHook, _northEastContact ); } if ( _south and (_fromHook != _south) ) { Hook* toHook = getSegmentOppositeHook( _south ); - ltrace(99) << "Pushing South (to) " << getString(toHook) << endl; - ltrace(99) << "Pushing South (from) " << _southWestContact << endl; + cdebug.log(145) << "Pushing South (to) " << getString(toHook) << endl; + cdebug.log(145) << "Pushing South (from) " << _southWestContact << endl; forks.push( toHook, _southWestContact ); } - ltraceout(99); + cdebug.tabw(145,-1); } @@ -1014,9 +1080,8 @@ namespace { , unsigned int flags ) { - ltrace(99) << "doRp_AutoContacts()" << endl; - ltracein(99); - ltrace(99) << rp << endl; + cdebug.log(145,1) << "doRp_AutoContacts()" << endl; + cdebug.log(145) << rp << endl; source = target = NULL; @@ -1093,15 +1158,14 @@ namespace { ); } - ltraceout(99); + cdebug.tabw(145,-1); return; } AutoContact* GCellTopology::doRp_Access ( GCell* gcell, Component* rp, unsigned int flags ) { - ltrace(99) << "doRp_Access() - flags:" << flags << endl; - ltracein(99); + cdebug.log(145,1) << "doRp_Access() - flags:" << flags << endl; AutoContact* rpContactSource; AutoContact* rpContactTarget; @@ -1126,15 +1190,162 @@ namespace { } } - ltraceout(99); + cdebug.tabw(145,-1); return rpContactSource; } + AutoContact* GCellTopology::doRp_AccessPad ( RoutingPad* rp, unsigned int flags ) + { + cdebug.log(145,1) << "doRp_AccessPad()" << endl; + cdebug.log(145) << rp << endl; + + // Hardcoded: H access is METAL2 (depth=1), V access is METAL3 (depth=2). + size_t accessDepth = (flags & HAccess) ? 1 : 2 ; + size_t padDepth = Session::getLayerDepth(rp->getLayer()); + if (padDepth > Session::getAllowedDepth()) { + cerr << Error( "GCellTopology::doRp_AccessPad(): Pad RoutingPad %s\n" + " has a layer unreachable by the router (top layer is: %s)" + , getString(rp).c_str() + , getString(Session::getRoutingLayer(Session::getAllowedDepth())).c_str() + ) << endl; + padDepth = Session::getAllowedDepth(); + } + + rp->getBodyHook()->detach(); + + Point rpPosition = rp->getCenter(); + Point position = rp->getCenter(); + Box rpbb = rp->getBoundingBox(); + if ( (rpbb.getWidth () > 2*Session::getWireWidth(padDepth)) + or (rpbb.getHeight() > 2*Session::getWireWidth(padDepth)) ) { + //cerr << "doRp_AccessPad(): connecting to non-punctual connector (RoutingPad).\n" + // << " " << rp->getNet() << "pad:" << rp->getOccurrence().getMasterCell() << endl; + + Transformation transf = rp->getOccurrence().getPath().getTransformation(); + switch ( transf.getOrientation() ) { + case Transformation::Orientation::ID: position.setY( rpbb.getYMin() ); break; + case Transformation::Orientation::MY: position.setY( rpbb.getYMax() ); break; + case Transformation::Orientation::YR: + case Transformation::Orientation::R3: position.setX( rpbb.getXMin() ); break; + case Transformation::Orientation::R1: position.setX( rpbb.getXMax() ); break; + default: + break; + } + } + + GCell* gcell = Session::getKatabatic()->getGCellGrid()->getGCell(position); + Component* anchor = rp; + + if (padDepth != accessDepth) { + if (padDepth > accessDepth) { + // Go *down* from the pad's RoutingPad. + --padDepth; + + Contact* target = NULL; + Contact* source = Contact::create ( rp + , Session::getContactLayer(padDepth) + , position.getX() - rpPosition.getX() + , position.getY() - rpPosition.getY() + , Session::getViaWidth(padDepth) + , Session::getViaWidth(padDepth) + ); + + for ( size_t depth = padDepth ; depth >= accessDepth ; --depth ) { + const Layer* segmentLayer = Session::getRoutingLayer(depth); + const Layer* targetLayer = (depth == accessDepth) ? segmentLayer + : Session::getContactLayer(depth-1); + DbU::Unit targetSide = (depth == accessDepth) ? Session::getWireWidth(depth) + : Session::getViaWidth (depth-1); + + target = Contact::create( rp->getNet() + , targetLayer + , position.getX() + , position.getY() + , targetSide + , targetSide + ); + if (Session::getDirection(depth) == KbHorizontal) { + anchor = Horizontal::create( source + , target + , segmentLayer + , position.getY() + , Session::getWireWidth(depth) + ); + } else { + anchor = Vertical::create( source + , target + , segmentLayer + , position.getX() + , Session::getWireWidth(depth) + ); + } + cdebug.log(145) << "Pad strap: " << anchor << endl; + source = target; + } + } else { + // Go *up* from the pad's RoutingPad. + Contact* target = NULL; + Contact* source = Contact::create ( rp + , Session::getContactLayer(padDepth) + , 0 + , 0 + , Session::getViaWidth(padDepth) + , Session::getViaWidth(padDepth) + ); + + for ( size_t depth = padDepth ; depth <= accessDepth ; ++depth ) { + const Layer* segmentLayer = Session::getRoutingLayer(depth); + const Layer* targetLayer = (depth == accessDepth) ? segmentLayer + : Session::getContactLayer(depth); + DbU::Unit targetSide = (depth == accessDepth) ? Session::getWireWidth(depth) + : Session::getViaWidth (depth); + + target = Contact::create( rp->getNet() + , targetLayer + , position.getX() + , position.getY() + , targetSide + , targetSide + ); + if (Session::getDirection(depth) == KbHorizontal) { + anchor = Horizontal::create( source + , target + , segmentLayer + , position.getY() + , Session::getWireWidth(depth) + ); + } else { + anchor = Vertical::create( source + , target + , segmentLayer + , position.getX() + , Session::getWireWidth(depth) + ); + } + cdebug.log(145) << "Pad strap: " << anchor << endl; + source = target; + } + } + } + + AutoContact* autoSource + = AutoContactTerminal::create ( gcell + , anchor + , Session::getRoutingLayer(accessDepth) + , position + , Session::getWireWidth(accessDepth) + , Session::getWireWidth(accessDepth) + ); + cdebug.tabw(145,-1); + return autoSource; + } + + void GCellTopology::doRp_StairCaseH ( GCell* gcell, Component* rp1, Component* rp2 ) { - ltrace(99) << "doRp_StairCaseH()" << endl; + cdebug.log(145) << "doRp_StairCaseH()" << endl; if (rp1->getCenter().getX() > rp2->getCenter().getX()) swap( rp1, rp2 ); @@ -1148,7 +1359,7 @@ namespace { doRp_AutoContacts( gcell, rp2, rp2ContactSource, rp2ContactTarget, DoSourceContact ); if (rp1ContactTarget->getY() == rp2ContactSource->getY()) { - ltrace(99) << "Aligned horizontal routing pads : straight wire" << endl; + cdebug.log(145) << "Aligned horizontal routing pads : straight wire" << endl; viaLayer = rp1->getLayer(); AutoSegment::create( rp1ContactTarget, rp2ContactSource, KbHorizontal ); @@ -1168,7 +1379,7 @@ namespace { void GCellTopology::doRp_StairCaseV ( GCell* gcell, Component* rp1, Component* rp2 ) { - ltrace(99) << "doRp_StairCaseV()" << endl; + cdebug.log(145) << "doRp_StairCaseV()" << endl; if (rp1->getCenter().getY() > rp2->getCenter().getY()) swap( rp1, rp2 ); @@ -1182,7 +1393,7 @@ namespace { doRp_AutoContacts( gcell, rp2, rp2ContactSource, rp2ContactTarget, DoSourceContact ); if (rp1ContactTarget->getX() == rp2ContactSource->getX()) { - ltrace(99) << "Aligned vertical routing pads : straight wire" << endl; + cdebug.log(145) << "Aligned vertical routing pads : straight wire" << endl; viaLayer = rp1->getLayer(); AutoSegment::create( rp1ContactTarget, rp2ContactSource, KbVertical ); @@ -1202,7 +1413,7 @@ namespace { void GCellTopology::_do_xG () { - ltrace(99) << "_do_xG()" << endl; + cdebug.log(145,1) << "_do_xG()" << endl; if (_connexity.fields.globals == 2) { _southWestContact @@ -1229,66 +1440,78 @@ namespace { AutoSegment::create( _southWestContact, turn, KbHorizontal ); AutoSegment::create( turn, _northEastContact, KbVertical ); } + cdebug.tabw(145,-1); } void GCellTopology::_do_xG_1Pad () { - ltrace(99) << "_do_xG_1Pad() [Managed Configuration - Optimized] " << _topology << endl; - ltracein(99); + cdebug.log(145,1) << "_do_xG_1Pad() [Managed Configuration - Optimized] " << _topology << endl; + cdebug.log(145) << "_connexity.globals:" << _connexity.fields.globals << endl; - bool eastPad = false; - bool westPad = false; - bool northPad = false; - bool southPad = false; - Instance* padInstance = dynamic_cast(_routingPads[0])->getOccurrence().getPath().getHeadInstance(); + unsigned int flags = NoFlags; + bool eastPad = false; + bool westPad = false; + bool northPad = false; + bool southPad = false; + Instance* padInstance = _routingPads[0]->getOccurrence().getPath().getHeadInstance(); switch ( padInstance->getTransformation().getOrientation() ) { case Transformation::Orientation::ID: northPad = true; break; - case Transformation::Orientation::YR: eastPad = true; break; - case Transformation::Orientation::R3: eastPad = true; break; case Transformation::Orientation::MY: southPad = true; break; - case Transformation::Orientation::R1: westPad = true; break; + case Transformation::Orientation::YR: + case Transformation::Orientation::R3: eastPad = true; flags |= HAccess; break; + case Transformation::Orientation::R1: westPad = true; flags |= HAccess; break; default: cerr << Warning( "Unmanaged orientation %s for pad <%s>." , getString(padInstance->getTransformation().getOrientation()).c_str() , getString(padInstance).c_str() ) << endl; break; } + cdebug.log(145) << "eastPad:" << eastPad << ", " + << "westPad:" << westPad << ", " + << "northPad:" << northPad << ", " + << "southPad:" << southPad + << endl; - Point position = _routingPads[0]->getCenter(); - AutoContact* source = NULL; - GCell* gcell = Session::getKatabatic()->getGCellGrid()->getGCell(position); + AutoContact* source = doRp_AccessPad( _routingPads[0], flags ); + // Point position = _routingPads[0]->getCenter(); + // AutoContact* source = NULL; + // GCell* gcell = Session::getKatabatic()->getGCellGrid()->getGCell(position); - source = AutoContactTerminal::create ( gcell - , _routingPads[0] - , Session::getContactLayer(3) - , position - , Session::getViaWidth(3), Session::getViaWidth(3) - ); - source->setFlags( CntFixed ); + // source = AutoContactTerminal::create ( gcell + // , _routingPads[0] + // , Session::getContactLayer(3) + // , position + // , Session::getViaWidth(3), Session::getViaWidth(3) + // ); + // source->setFlags( CntFixed ); - if (northPad or eastPad) { - _southWestContact = _northEastContact = source; - ltraceout(99); - return; - } + // if (northPad or eastPad) { + // _southWestContact = _northEastContact = source; + // cdebug.tabw(145,-1); + // return; + // } // Check for straight lines, which are not managed by _do_xG(). if (_connexity.fields.globals == 1) { - if (westPad and (_east != NULL)) { + if ( (westPad and (_east != NULL)) + or (eastPad and (_west != NULL)) ) { AutoContact* turn = AutoContactTurn::create( _gcell, _net, Session::getContactLayer(1) ); - _northEastContact = AutoContactTurn::create( _gcell, _net, Session::getContactLayer(1) ); + _northEastContact = _southWestContact + = AutoContactTurn::create( _gcell, _net, Session::getContactLayer(1) ); AutoSegment::create( source, turn, KbHorizontal ); AutoSegment::create( turn, _northEastContact, KbVertical ); - ltraceout(99); + cdebug.tabw(145,-1); return; - } else if (southPad and (_north != NULL)) { + } else if ( (southPad and (_north != NULL)) + or (northPad and (_south != NULL)) ) { AutoContact* turn = AutoContactTurn::create( _gcell, _net, Session::getContactLayer(1) ); - _northEastContact = AutoContactTurn::create( _gcell, _net, Session::getContactLayer(1) ); + _northEastContact = _southWestContact + = AutoContactTurn::create( _gcell, _net, Session::getContactLayer(1) ); AutoSegment::create( source, turn, KbVertical ); AutoSegment::create( turn, _northEastContact, KbHorizontal ); - ltraceout(99); + cdebug.tabw(145,-1); return; } } @@ -1297,7 +1520,9 @@ namespace { --_connexity.fields.Pad; if (westPad ) _west = source->getBodyHook(); + if (eastPad ) _east = source->getBodyHook(); if (southPad) _south = source->getBodyHook(); + if (northPad) _north = source->getBodyHook(); _do_xG(); @@ -1305,20 +1530,27 @@ namespace { AutoSegment::create( source, _southWestContact, KbHorizontal ); _west = NULL; } + if (eastPad) { + AutoSegment::create( source, _northEastContact, KbHorizontal ); + _east = NULL; + } if (southPad) { AutoSegment::create( source, _southWestContact, KbVertical ); _south = NULL; } + if (northPad) { + AutoSegment::create( source, _northEastContact, KbVertical ); + _north = NULL; + } --_connexity.fields.globals; - ltraceout(99); + cdebug.tabw(145,-1); } void GCellTopology::_do_1G_1PinM2 () { - ltrace(99) << "_do_1G_1PinM2() [Managed Configuration - Optimized] " << _topology << endl; - ltracein(99); + cdebug.log(145,1) << "_do_1G_1PinM2() [Managed Configuration - Optimized] " << _topology << endl; AutoContact* rpContact = doRp_Access( _gcell, _routingPads[0], NoFlags ); AutoContact* turn1 = AutoContactTurn::create( _gcell, _net, Session::getContactLayer(1) ); @@ -1331,14 +1563,13 @@ namespace { } _southWestContact = _northEastContact = turn1; - ltraceout(99); + cdebug.tabw(145,-1); } void GCellTopology::_do_1G_1M1 () { - ltrace(99) << "_do_1G_1M1() [Managed Configuration - Optimized] " << _topology << endl; - ltracein(99); + cdebug.log(145,1) << "_do_1G_1M1() [Managed Configuration - Optimized] " << _topology << endl; unsigned int flags = NoFlags; if (_east ) { flags |= HAccess; } @@ -1348,14 +1579,13 @@ namespace { _southWestContact = _northEastContact = doRp_Access( _gcell, _routingPads[0], flags ); - ltraceout(99); + cdebug.tabw(145,-1); } void GCellTopology::_do_1G_xM1 () { - ltrace(99) << "_do_1G_" << _connexity.fields.M1 << "M1() [Managed Configuration]" << endl; - ltracein(99); + cdebug.log(145,1) << "_do_1G_" << _connexity.fields.M1 << "M1() [Managed Configuration]" << endl; sort( _routingPads.begin(), _routingPads.end(), SortRpByX(NoFlags) ); // increasing X. for ( unsigned int i=1 ; i<_routingPads.size() ; ++i ) { @@ -1370,10 +1600,10 @@ namespace { else { globalRp = _routingPads[0]; - ltrace(99) << "| Initial N/S Global RP: " << globalRp << endl; + cdebug.log(145) << "| Initial N/S Global RP: " << globalRp << endl; for ( unsigned int i=1 ; i<_routingPads.size() ; ++i ) { if (_routingPads[i]->getBoundingBox().getHeight() > globalRp->getBoundingBox().getHeight()) { - ltrace(99) << "| Better RP: " << globalRp << endl; + cdebug.log(145) << "| Better RP: " << globalRp << endl; globalRp = _routingPads[i]; } } @@ -1389,14 +1619,13 @@ namespace { _northEastContact = _southWestContact = globalContact; - ltraceout(99); + cdebug.tabw(145,-1); } void GCellTopology::_do_xG_1M1_1M2 () { - ltrace(99) << "_do_xG_1M1_1M2() [Managed Configuration]" << endl; - ltracein(99); + cdebug.log(145,1) << "_do_xG_1M1_1M2() [Managed Configuration]" << endl; Component* rpL1; Component* rpL2; @@ -1407,8 +1636,8 @@ namespace { rpL1 = _routingPads[1]; rpL2 = _routingPads[0]; } - ltrace(99) << "rpL1 := " << rpL1 << endl; - ltrace(99) << "rpL2 := " << rpL2 << endl; + cdebug.log(145) << "rpL1 := " << rpL1 << endl; + cdebug.log(145) << "rpL2 := " << rpL2 << endl; AutoContact* rpL1ContactSource = NULL; AutoContact* rpL1ContactTarget = NULL; @@ -1452,21 +1681,20 @@ namespace { } } - ltraceout(99); + cdebug.tabw(145,-1); } void GCellTopology::_do_xG_xM1_xM3 () { - ltrace(99) << "_do_xG_" << _connexity.fields.M1 - << "M1_" << _connexity.fields.M3 - << "M3() [G:" << _connexity.fields.globals << " Managed Configuration]" << endl; - ltracein(99); - ltrace(99) << "_connexity: " << _connexity.connexity << endl; - ltrace(99) << "_north: " << _north << endl; - ltrace(99) << "_south: " << _south << endl; - ltrace(99) << "_east: " << _east << endl; - ltrace(99) << "_west: " << _west << endl; + cdebug.log(145,1) << "_do_xG_" << _connexity.fields.M1 + << "M1_" << _connexity.fields.M3 + << "M3() [G:" << _connexity.fields.globals << " Managed Configuration]" << endl; + cdebug.log(145) << "_connexity: " << _connexity.connexity << endl; + cdebug.log(145) << "_north: " << _north << endl; + cdebug.log(145) << "_south: " << _south << endl; + cdebug.log(145) << "_east: " << _east << endl; + cdebug.log(145) << "_west: " << _west << endl; Component* rpM3 = NULL; if (_routingPads[0]->getLayer() == Session::getRoutingLayer(2)) @@ -1510,11 +1738,11 @@ namespace { } else { // All RoutingPad are M1. Component* southWestRp = _routingPads[0]; - ltrace(99) << "| Initial S-W Global RP: " << southWestRp << endl; + cdebug.log(145) << "| Initial S-W Global RP: " << southWestRp << endl; for ( unsigned int i=1 ; i<_routingPads.size() ; ++i ) { if (southWestRp->getBoundingBox().getHeight() >= 4*Session::getPitch(1)) break; if (_routingPads[i]->getBoundingBox().getHeight() > southWestRp->getBoundingBox().getHeight()) { - ltrace(99) << "| Better RP: " << southWestRp << endl; + cdebug.log(145) << "| Better RP: " << southWestRp << endl; southWestRp = _routingPads[i]; } } @@ -1532,14 +1760,14 @@ namespace { } Component* northEastRp = _routingPads[_routingPads.size()-1]; - ltrace(99) << "| Initial N-E Global RP: " << northEastRp << endl; + cdebug.log(145) << "| Initial N-E Global RP: " << northEastRp << endl; if (_routingPads.size() > 1) { for ( unsigned int i=_routingPads.size()-1; i != 0 ; ) { i -= 1; if (northEastRp->getBoundingBox().getHeight() >= 4*Session::getPitch(1)) break; if (_routingPads[i]->getBoundingBox().getHeight() > northEastRp->getBoundingBox().getHeight()) { - ltrace(99) << "| Better RP: " << northEastRp << endl; + cdebug.log(145) << "| Better RP: " << northEastRp << endl; northEastRp = _routingPads[i]; } } @@ -1558,16 +1786,36 @@ namespace { } } - ltraceout(99); + cdebug.tabw(145,-1); } + void GCellTopology::_do_4G_1M2 () + { + cdebug.log(145,1) << "_do_4G_1M2() [Managed Configuration]" << endl; + + Component* rpL2 = _routingPads[0]; + cdebug.log(145) << "rpL2 := " << rpL2 << endl; + + AutoContact* rpL2ContactSource = NULL; + AutoContact* rpL2ContactTarget = NULL; + + doRp_AutoContacts( _gcell, rpL2, rpL2ContactSource, rpL2ContactTarget, DoSourceContact|DoTargetContact ); + + _southWestContact = AutoContactHTee::create( _gcell, _net, Session::getContactLayer(2) ); + _northEastContact = AutoContactHTee::create( _gcell, _net, Session::getContactLayer(2) ); + + AutoSegment::create( _southWestContact, rpL2ContactSource, KbHorizontal ); + AutoSegment::create( rpL2ContactTarget, _northEastContact, KbHorizontal ); + + cdebug.tabw(145,-1); + } + void GCellTopology::_do_xG_xM2 () { - ltrace(99) << "_do_" - << _connexity.fields.globals << "G_" - << _connexity.fields.M2 << "M2() [Managed Configuration - x]" << endl; - ltracein(99); + cdebug.log(145,1) << "_do_" + << _connexity.fields.globals << "G_" + << _connexity.fields.M2 << "M2() [Managed Configuration - x]" << endl; Component* biggestRp = _routingPads[0]; for ( unsigned int i=1 ; i<_routingPads.size() ; ++i ) { @@ -1598,14 +1846,13 @@ namespace { AutoSegment::create( rpContact, _northEastContact, KbVertical ); } - ltraceout(99); + cdebug.tabw(145,-1); } void GCellTopology::_do_1G_1M3 () { - ltrace(99) << "_do_1G_1M3() [Optimised Configuration]" << endl; - ltracein(99); + cdebug.log(145,1) << "_do_1G_1M3() [Optimised Configuration]" << endl; unsigned int flags = (_east or _west) ? HAccess : NoFlags; flags |= (_north) ? DoTargetContact : NoFlags; @@ -1620,8 +1867,8 @@ namespace { if (not _southWestContact) _southWestContact = _northEastContact; if (not _northEastContact) _northEastContact = _southWestContact; - ltrace(99) << "_southWest: " << _southWestContact << endl; - ltrace(99) << "_northEast: " << _northEastContact << endl; + cdebug.log(145) << "_southWest: " << _southWestContact << endl; + cdebug.log(145) << "_northEast: " << _northEastContact << endl; if (flags & HAccess) { // HARDCODED VALUE. @@ -1642,19 +1889,18 @@ namespace { } } } - ltraceout(99); + cdebug.tabw(145,-1); } void GCellTopology::_do_xG_xM3 () { - ltrace(99) << "_do_xG_" << _connexity.fields.M3 - << "M3() [Managed Configuration]" << endl; - ltracein(99); - ltrace(99) << "_west:" << _west << endl; - ltrace(99) << "_east:" << _east << endl; - ltrace(99) << "_south:" << _south << endl; - ltrace(99) << "_north:" << _north << endl; + cdebug.log(145,1) << "_do_xG_" << _connexity.fields.M3 + << "M3() [Managed Configuration]" << endl; + cdebug.log(145) << "_west:" << _west << endl; + cdebug.log(145) << "_east:" << _east << endl; + cdebug.log(145) << "_south:" << _south << endl; + cdebug.log(145) << "_north:" << _north << endl; sort( _routingPads.begin(), _routingPads.end(), SortRpByY(NoFlags) ); // increasing Y. for ( unsigned int i=1 ; i<_routingPads.size() ; i++ ) { @@ -1670,7 +1916,7 @@ namespace { doRp_AutoContacts( _gcell, rp, _southWestContact, unusedContact, DoSourceContact ); if (_sourceContact) { if (_sourceContact->getX() != _southWestContact->getX()) { - ltrace(200) << "Misaligned South: _source:" << DbU::getValueString(_sourceContact->getX()) + cdebug.log(149) << "Misaligned South: _source:" << DbU::getValueString(_sourceContact->getX()) << "_southWest:" << DbU::getValueString(_southWestContact->getX()) << endl; AutoContactTurn* turn1 = AutoContactTurn::create( _gcell, _net, Session::getContactLayer(1) ); @@ -1694,7 +1940,7 @@ namespace { doRp_AutoContacts( _gcell, rp, unusedContact, _northEastContact, DoTargetContact ); if (_sourceContact) { if (_sourceContact->getX() != _northEastContact->getX()) { - ltrace(200) << "Misaligned North: _source:" << DbU::getValueString(_sourceContact->getX()) + cdebug.log(149) << "Misaligned North: _source:" << DbU::getValueString(_sourceContact->getX()) << "_southWest:" << DbU::getValueString(_northEastContact->getX()) << endl; AutoContactTurn* turn1 = AutoContactTurn::create( _gcell, _net, Session::getContactLayer(1) ); @@ -1711,14 +1957,13 @@ namespace { AutoSegment::create( rpContact, _northEastContact, KbVertical ); } - ltraceout(99); + cdebug.tabw(145,-1); } void singleGCell ( KatabaticEngine* ktbt, Net* net ) { - ltrace(99) << "singleGCell() " << net << endl; - ltracein(99); + cdebug.log(145,1) << "singleGCell() " << net << endl; vector rpM1s; Component* rpM2 = NULL; @@ -1734,7 +1979,7 @@ namespace { cerr << Error( "For %s, less than two Plugs/Pins (%d)." , getString(net).c_str() , rpM1s.size() ) << endl; - ltraceout(99); + cdebug.tabw(145,-1); return; } @@ -1745,11 +1990,11 @@ namespace { if (not gcell) { cerr << Error( "No GCell under %s.", getString(rpM1s[0]).c_str() ) << endl; - ltraceout(99); + cdebug.tabw(145,-1); return; } - ltrace(80) << "singleGCell " << gcell << endl; + cdebug.log(145) << "singleGCell " << gcell << endl; AutoContact* turn = NULL; AutoContact* source = NULL; @@ -1769,7 +2014,7 @@ namespace { AutoSegment::create( turn , target, KbVertical ); } - ltraceout(99); + cdebug.tabw(145,-1); } @@ -1780,9 +2025,6 @@ namespace { namespace Katabatic { - using Hurricane::ltracein; - using Hurricane::ltraceout; - using Hurricane::ltracelevel; using Hurricane::Name; using Hurricane::DebugSession; using Hurricane::Error; @@ -1802,7 +2044,7 @@ namespace Katabatic { forEach ( Net*, inet, getCell()->getNets() ) { if (NetRoutingExtension::isAutomaticGlobalRoute(*inet)) { - DebugSession::open( *inet, 80 ); + DebugSession::open( *inet, 140, 150 ); _loadNetGlobalRouting( *inet ); Session::revalidate(); DebugSession::close(); @@ -1826,8 +2068,8 @@ namespace Katabatic { void KatabaticEngine::_loadNetGlobalRouting ( Net* net ) { - ltrace(100) << "Katabatic::_loadNetGlobalRouting( " << net << " )" << endl; - ltracein(99); + cdebug.log(149) << "Katabatic::_loadNetGlobalRouting( " << net << " )" << endl; + cdebug.tabw(145,1); ForkStack forks; Hook* sourceHook = NULL; @@ -1841,7 +2083,7 @@ namespace Katabatic { if (degree == 0) { cmess2 << Warning("Net \"%s\" do not have any RoutingPad (ignored)." ,getString(net->getName()).c_str()) << endl; - ltraceout(99); + cdebug.tabw(145,-1); return; } if (degree < 2) { @@ -1850,11 +2092,11 @@ namespace Katabatic { cmess2 << Warning("Net \"%s\" have less than 2 plugs/pins (ignored)." ,getString(net->getName()).c_str()) << endl; #endif - ltraceout(99); + cdebug.tabw(145,-1); return; } - ltracein(99); + cdebug.tabw(145,1); Hook* startHook = NULL; GCell* lowestGCell = NULL; size_t unconnecteds = 0; @@ -1862,12 +2104,12 @@ namespace Katabatic { GCellTopology::init( degree ); - ltrace(99) << "Start RoutingPad Ring" << endl; + cdebug.log(145) << "Start RoutingPad Ring" << endl; forEach ( RoutingPad*, startRp, routingPads ) { bool segmentFound = false; forEach ( Hook*, ihook, startRp->getBodyHook()->getHooks() ) { - ltrace(99) << "Component " << ihook->getComponent() << endl; + cdebug.log(145) << "Component " << ihook->getComponent() << endl; Segment* segment = dynamic_cast( ihook->getComponent() ); if (segment) { @@ -1877,7 +2119,7 @@ namespace Katabatic { GCellTopology gcellConf ( getGCellGrid(), *ihook, NULL ); if (gcellConf.getStateG() == 1) { if ( (lowestGCell == NULL) or (lowestGCell->getIndex() > gcellConf.getGCell()->getIndex()) ) { - ltrace(99) << "Starting from GCell " << gcellConf.getGCell() << endl; + cdebug.log(145) << "Starting from GCell " << gcellConf.getGCell() << endl; lowestGCell = gcellConf.getGCell(); startHook = *ihook; } @@ -1893,16 +2135,16 @@ namespace Katabatic { NetRoutingExtension::create( net )->setFlags ( NetRoutingState::Excluded ); NetRoutingExtension::create( net )->unsetFlags( NetRoutingState::AutomaticGlobalRoute ); - ltraceout(99); + cdebug.tabw(145,-1); return; } // Uncomment the next line to disable the lowest GCell search. // (takes first GCell with exactly one global). //if (startHook) break; } - ltraceout(99); + cdebug.tabw(145,-1); - if (startHook == NULL) { singleGCell( this, net ); ltraceout(99); return; } + if (startHook == NULL) { singleGCell( this, net ); cdebug.tabw(145,-1); return; } GCellTopology startGCellConf ( getGCellGrid(), startHook, NULL ); startGCellConf.construct( forks ); @@ -1919,8 +2161,8 @@ namespace Katabatic { sourceContact = forks.getContact(); forks.pop(); - ltrace(99) << "Popping (from) " << sourceHook << endl; - ltrace(99) << "Popping (to) " << sourceContact << endl; + cdebug.log(145) << "Popping (from) " << sourceHook << endl; + cdebug.log(145) << "Popping (to) " << sourceContact << endl; } lookupClear(); @@ -1935,7 +2177,7 @@ namespace Katabatic { Session::revalidate(); GCellTopology::fixSegments(); - ltraceout(99); + cdebug.tabw(145,-1); } diff --git a/katabatic/src/NetConstraints.cpp b/katabatic/src/NetConstraints.cpp index a9e0318e..1769db8e 100644 --- a/katabatic/src/NetConstraints.cpp +++ b/katabatic/src/NetConstraints.cpp @@ -61,28 +61,27 @@ namespace { void propagateConstraintFromRp ( RoutingPad* rp ) { - ltrace(99) << "propagateConstraintFromRp() - " << rp << endl; - ltracein(99); + cdebug.log(145,1) << "propagateConstraintFromRp() - " << rp << endl; forEach ( Component*, icomponent, rp->getSlaveComponents() ) { - ltrace(99) << "slave component: " << *icomponent << endl; + cdebug.log(145) << "slave component: " << *icomponent << endl; AutoContact* sourceContact = Session::lookup( dynamic_cast(*icomponent) ); if (sourceContact) { - ltrace(99) << "Start slave: " << sourceContact << endl; + cdebug.log(145) << "Start slave: " << sourceContact << endl; set verticalSegments; set horizontalSegments; forEach ( AutoSegment*, isegment, sourceContact->getAutoSegments() ) { - ltrace(99) << "Examining: " << (*isegment) << endl; + cdebug.log(145) << "Examining: " << (*isegment) << endl; AutoContact* targetContact = isegment->getOppositeAnchor(sourceContact); if (targetContact) { if (isegment->isHorizontal()) { - ltrace(99) << "On horizontal stack " << (*isegment) << endl; + cdebug.log(145) << "On horizontal stack " << (*isegment) << endl; horizontalSegments.insert( (*isegment) ); } else { - ltrace(99) << "On vertical stack " << (*isegment) << endl; + cdebug.log(145) << "On vertical stack " << (*isegment) << endl; verticalSegments.insert( (*isegment) ); } } @@ -91,33 +90,33 @@ namespace { Box constraintBox = sourceContact->getConstraintBox(); // Propagate constraint through horizontally aligned segments. - ltrace(99) << "Propagate constraint on horizontal segments" << endl; + cdebug.log(145) << "Propagate constraint on horizontal segments" << endl; set::iterator ihorizontal = horizontalSegments.begin(); for ( ; ihorizontal != horizontalSegments.end() ; ++ihorizontal ) { AutoContact* contact = NULL; forEach ( AutoSegment*, ialigned, (*ihorizontal)->getAligneds() ) { contact = ialigned->getAutoTarget(); - ltrace(99) << "contact: " << contact << endl; + cdebug.log(145) << "contact: " << contact << endl; if (contact) { - ltrace(99) << "Apply to (target): " << contact << endl; + cdebug.log(145) << "Apply to (target): " << contact << endl; contact->restrictConstraintBox( constraintBox.getYMin() , constraintBox.getYMax() - , KbHorizontal ); + , KbHorizontal|KbWarnOnError ); } contact = ialigned->getAutoSource(); - ltrace(99) << "contact: " << contact << endl; + cdebug.log(145) << "contact: " << contact << endl; if (contact) { - ltrace(99) << "Apply to (source): " << contact << endl; + cdebug.log(145) << "Apply to (source): " << contact << endl; contact->restrictConstraintBox( constraintBox.getYMin() , constraintBox.getYMax() - , KbHorizontal ); + , KbHorizontal|KbWarnOnError ); } } } // Propagate constraint through vertically aligned segments. - ltrace(99) << "Propagate constraint on vertical segments" << endl; + cdebug.log(145) << "Propagate constraint on vertical segments" << endl; set::iterator ivertical = verticalSegments.begin(); for ( ; ivertical != verticalSegments.end() ; ++ivertical ) { @@ -125,25 +124,25 @@ namespace { forEach ( AutoSegment*, ialigned, (*ivertical)->getAligneds() ) { contact = ialigned->getAutoTarget(); if (contact) { - ltrace(99) << "Apply to (target): " << contact << endl; + cdebug.log(145) << "Apply to (target): " << contact << endl; contact->restrictConstraintBox( constraintBox.getXMin() , constraintBox.getXMax() - , KbVertical ); + , KbVertical|KbWarnOnError ); } contact = ialigned->getAutoSource(); if (contact) { - ltrace(99) << "Apply to (source): " << contact << endl; + cdebug.log(145) << "Apply to (source): " << contact << endl; contact->restrictConstraintBox( constraintBox.getXMin() , constraintBox.getXMax() - , KbVertical ); + , KbVertical|KbWarnOnError ); } } } } } - ltrace(99) << "propagateConstraintFromRp() - Exit" << endl; - ltraceout(99); + cdebug.log(145) << "propagateConstraintFromRp() - Exit" << endl; + cdebug.tabw(145,-1); } @@ -159,10 +158,10 @@ namespace Katabatic { void KatabaticEngine::computeNetConstraints ( Net* net ) { - DebugSession::open( net ); + DebugSession::open( net, 140, 150); - ltrace(100) << "Katabatic::computeNetConstraints( " << net << " )" << endl; - ltracein(99); + cdebug.log(149) << "Katabatic::computeNetConstraints( " << net << " )" << endl; + cdebug.tabw(145,1); vector routingPads; forEach ( Component*, icomponent, net->getComponents() ) { @@ -185,7 +184,7 @@ namespace Katabatic { // if (autoSegment) autoSegment->toConstraintAxis(); // } - ltraceout(99); + cdebug.tabw(145,-1); DebugSession::close(); } diff --git a/katabatic/src/NetOptimals.cpp b/katabatic/src/NetOptimals.cpp index 0c839c85..4e32de29 100644 --- a/katabatic/src/NetOptimals.cpp +++ b/katabatic/src/NetOptimals.cpp @@ -29,9 +29,6 @@ namespace Katabatic { using namespace std; using Hurricane::tab; - using Hurricane::ltracein; - using Hurricane::ltraceout; - using Hurricane::inltrace; using Hurricane::ForEachIterator; using Hurricane::Net; using Hurricane::Segment; @@ -40,9 +37,9 @@ namespace Katabatic { void KatabaticEngine::_computeNetOptimals ( Net* net ) { - DebugSession::open( net, 88 ); - ltrace(100) << "Katabatic::_computeNetOptimals( " << net << " )" << endl; - ltracein(99); + DebugSession::open( net, 140, 150 ); + cdebug.log(149) << "Katabatic::_computeNetOptimals( " << net << " )" << endl; + cdebug.tabw(145,1); vector segments; forEach ( Segment*, segment, net->getSegments() ) { @@ -55,16 +52,16 @@ namespace Katabatic { for ( size_t i=0 ; icomputeOptimal( processeds ); - ltraceout(99); + cdebug.tabw(145,-1); DebugSession::close(); } void KatabaticEngine::toOptimals ( Net* net ) { - DebugSession::open( net, 88 ); - ltrace(100) << "Katabatic::_toOptimals( " << net << " )" << endl; - ltracein(99); + DebugSession::open( net, 140, 150 ); + cdebug.log(149) << "Katabatic::_toOptimals( " << net << " )" << endl; + cdebug.tabw(145,1); vector segments; forEach ( Segment*, segment, net->getSegments() ) { @@ -77,7 +74,7 @@ namespace Katabatic { if (segments[i]->isCanonical()) segments[i]->toOptimalAxis(); } - ltraceout(99); + cdebug.tabw(145,-1); DebugSession::close(); } diff --git a/katabatic/src/PyKatabatic.cpp b/katabatic/src/PyKatabatic.cpp index ead6c7b5..25cf9fe0 100644 --- a/katabatic/src/PyKatabatic.cpp +++ b/katabatic/src/PyKatabatic.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2012-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2012-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -23,7 +23,6 @@ namespace Katabatic { using std::cerr; using std::endl; using Hurricane::tab; - using Hurricane::in_trace; using Isobar::__cs; @@ -55,7 +54,7 @@ extern "C" { // Module Initialization : "initKatabatic ()" DL_EXPORT(void) initKatabatic () { - trace << "initKatabatic()" << endl; + cdebug.log(38) << "initKatabatic()" << endl; PyObject* module = Py_InitModule ( "Katabatic", PyKatabatic_Methods ); if ( module == NULL ) { diff --git a/katabatic/src/Session.cpp b/katabatic/src/Session.cpp index 75843c88..edae05df 100644 --- a/katabatic/src/Session.cpp +++ b/katabatic/src/Session.cpp @@ -1,7 +1,7 @@ // -*- mode: C++; explicit-buffer-name: "Session.cpp" -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -52,10 +52,6 @@ namespace Katabatic { using namespace std; using Hurricane::tab; - using Hurricane::ltracein; - using Hurricane::ltraceout; - using Hurricane::inltrace; - using Hurricane::ltracelevel; using Hurricane::Error; using Hurricane::ForEachIterator; using Hurricane::UpdateSession; @@ -123,19 +119,18 @@ namespace Katabatic { void Session::_invalidate ( Net* net ) { - ltrace(200) << "Session::invalidate(Net*) - " << net << endl; + cdebug.log(149) << "Session::invalidate(Net*) - " << net << endl; _netInvalidateds.insert(net); } void Session::_canonize () { - ltrace(110) << "Katabatic::Session::_canonize()" << endl; - ltracein(110); + cdebug.log(145,1) << "Katabatic::Session::_canonize()" << endl; if (_segmentInvalidateds.empty()) { - ltrace(110) << "Invalidated AutoSegment collection <_segmentInvalidateds> is empty." << endl; - ltraceout(110); + cdebug.log(145) << "Invalidated AutoSegment collection <_segmentInvalidateds> is empty." << endl; + cdebug.tabw(145,-1); return; } @@ -150,13 +145,13 @@ namespace Katabatic { AutoSegment* canonical = seedSegment; if (exploredSegments.find(seedSegment->base()) == exploredSegments.end()) { - ltrace(110) << "New chunk from: " << seedSegment << endl; + cdebug.log(145) << "New chunk from: " << seedSegment << endl; aligneds.push_back( seedSegment ); bool isWeakGlobal = seedSegment->isGlobal(); if (not seedSegment->isNotAligned()) { forEach ( AutoSegment*, aligned, seedSegment->getAligneds() ) { - ltrace(110) << "Aligned: " << *aligned << endl; + cdebug.log(145) << "Aligned: " << *aligned << endl; aligneds.push_back ( *aligned ); exploredSegments.insert ( aligned->base() ); @@ -166,10 +161,10 @@ namespace Katabatic { } } - ltracein(110); + cdebug.tabw(145,1); canonical->setFlags( SegCanonical ); - ltrace(110) << "Canonical: " << canonical << endl; + cdebug.log(145) << "Canonical: " << canonical << endl; for ( size_t j=0 ; jisGlobal()) aligneds[j]->setFlags ( SegWeakGlobal ); @@ -182,34 +177,33 @@ namespace Katabatic { ,getString(aligneds[j]).c_str()) << endl; } aligneds[j]->unsetFlags( SegCanonical ); - ltrace(110) << "Secondary: " << aligneds[j] << endl; + cdebug.log(145) << "Secondary: " << aligneds[j] << endl; } if (aligneds.empty()) canonical->setFlags( SegNotAligned ); - ltrace(159) << "Align @" << DbU::toLambda(canonical->getAxis()) + cdebug.log(149) << "Align @" << DbU::toLambda(canonical->getAxis()) << " on " << canonical << endl; //canonical->setAxis( canonical->getAxis(), KbRealignate ); if (canonical->isUnsetAxis()) canonical->toOptimalAxis( KbRealignate|KbPropagate ); else canonical->setAxis( canonical->getAxis(), KbRealignate|KbPropagate ); aligneds.clear(); - ltraceout(110); + cdebug.tabw(145,-1); } } - ltraceout(110); + cdebug.tabw(145,-1); } void Session::_revalidateTopology () { - ltrace(110) << "Katabatic::Session::_revalidateTopology()" << endl; - ltracein(110); + cdebug.log(145,1) << "Katabatic::Session::_revalidateTopology()" << endl; set::iterator inet = _netInvalidateds.begin(); for ( ; inet != _netInvalidateds.end() ; inet++ ) { - ltrace(110) << "Katabatic::Session::_revalidateTopology(Net*)" << *inet << endl; + cdebug.log(145) << "Katabatic::Session::_revalidateTopology(Net*)" << *inet << endl; _katabatic->updateNetTopology ( *inet ); _katabatic->computeNetConstraints( *inet ); _katabatic->_computeNetOptimals ( *inet ); @@ -227,29 +221,27 @@ namespace Katabatic { _netRevalidateds.clear(); _netRevalidateds.swap( _netInvalidateds ); - ltraceout(110); + cdebug.tabw(145,-1); } size_t Session::_revalidate () { - ltrace(110) << "Katabatic::Session::revalidate()" << endl; - ltracein(110); - - ltrace(110) << "_segmentInvalidateds.size(): " << _segmentInvalidateds.size() << endl; - ltrace(110) << "_autoContacts.size(): " << _autoContacts.size() << endl; + cdebug.log(145,1) << "Katabatic::Session::revalidate()" << endl; + cdebug.log(145) << "_segmentInvalidateds.size(): " << _segmentInvalidateds.size() << endl; + cdebug.log(145) << "_autoContacts.size(): " << _autoContacts.size() << endl; size_t count = 0; if (not _netInvalidateds.empty()) _revalidateTopology(); - ltrace(110) << "AutoContacts Revalidate (after _revalidateTopology())." << endl; + cdebug.log(145) << "AutoContacts Revalidate (after _revalidateTopology())." << endl; for ( size_t i=0 ; i < _autoContacts.size() ; i++, count++ ) _autoContacts[i]->updateGeometry(); _autoContacts.clear(); - ltrace(110) << "AutoSegments Revalidate (after AutoContact::updateGeometry())." << endl; - ltrace(110) << "_segmentInvalidateds.size(): " << _segmentInvalidateds.size() << endl; + cdebug.log(145) << "AutoSegments Revalidate (after AutoContact::updateGeometry())." << endl; + cdebug.log(145) << "_segmentInvalidateds.size(): " << _segmentInvalidateds.size() << endl; _segmentRevalidateds.clear(); for ( size_t i=0 ; i < _segmentInvalidateds.size() ; ++i, ++count ) { @@ -262,7 +254,7 @@ namespace Katabatic { } _segmentInvalidateds.clear(); - ltrace(110) << "AutoSegments/AutoContacts queued deletion." << endl; + cdebug.log(145) << "AutoSegments/AutoContacts queued deletion." << endl; unsigned int flags = _katabatic->getFlags( EngineDestroyMask ); _katabatic->setFlags( EngineDestroyMask ); set::iterator isegment = _destroyedSegments.begin(); @@ -276,7 +268,7 @@ namespace Katabatic { _katabatic->setFlags( flags ); set().swap( _destroyedSegments ); - ltraceout(110); + cdebug.tabw(145,-1); return count; } @@ -284,7 +276,7 @@ namespace Katabatic { Session* Session::open ( KatabaticEngine* ktbt ) { - ltrace(110) << "Session::open()" << endl; + cdebug.log(145) << "Session::open()" << endl; if (_session) { if (_session->_katabatic != ktbt) @@ -302,8 +294,7 @@ namespace Katabatic { void Session::close () { - ltrace(110) << "Session::close()" << endl; - ltracein(110); + cdebug.log(145,1) << "Session::close()" << endl; if (not _session) throw Error( openSessionError, "Session::Close()" ); @@ -312,7 +303,7 @@ namespace Katabatic { delete _session; _session = NULL; - ltraceout(110); + cdebug.tabw(145,-1); } diff --git a/katabatic/src/katabatic/AutoContact.h b/katabatic/src/katabatic/AutoContact.h index 8c482d33..39286105 100644 --- a/katabatic/src/katabatic/AutoContact.h +++ b/katabatic/src/katabatic/AutoContact.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -17,13 +17,13 @@ #ifndef KATABATIC_AUTOCONTACT_H #define KATABATIC_AUTOCONTACT_H -#include -#include -#include "hurricane/Contact.h" -#include "hurricane/ExtensionGo.h" -#include "katabatic/Constants.h" -#include "katabatic/AutoSegment.h" -#include "katabatic/GCell.h" +#include +#include +#include "hurricane/Contact.h" +#include "hurricane/ExtensionGo.h" +#include "katabatic/Constants.h" +#include "katabatic/AutoSegment.h" +#include "katabatic/GCell.h" namespace Katabatic { @@ -32,9 +32,6 @@ namespace Katabatic { using std::cerr; using std::endl; using Hurricane::tab; - using Hurricane::inltrace; - using Hurricane::ltracein; - using Hurricane::ltraceout; using Hurricane::Name; using Hurricane::Net; using Hurricane::Component; @@ -56,16 +53,18 @@ namespace Katabatic { // ------------------------------------------------------------------- // Class : "Katabatic::AutoContact". - enum AutoContactFlag { CntFixed = 0x00000001 - , CntTerminal = 0x00000002 - , CntTurn = 0x00000004 - , CntHTee = 0x00000008 - , CntVTee = 0x00000010 - , CntInvalidated = 0x00000020 - , CntInvalidatedCache = 0x00000040 - , CntInCreationStage = 0x00000080 - , CntBadTopology = 0x00000100 - , CntIgnoreAnchor = 0x00000200 + enum AutoContactFlag { CntFixed = 0x00000001 + , CntTerminal = 0x00000002 + , CntTurn = 0x00000004 + , CntHTee = 0x00000008 + , CntVTee = 0x00000010 + , CntInvalidated = 0x00000020 + , CntInvalidatedCache = 0x00000040 + , CntInCreationStage = 0x00000080 + , CntBadTopology = 0x00000100 + , CntIgnoreAnchor = 0x00000200 + , CntWeakTerminal = 0x00000400 + , CntUserNativeConstraints = 0x00000800 }; class AutoContact { @@ -112,6 +111,7 @@ namespace Katabatic { inline bool isHTee () const; inline bool isVTee () const; inline bool isFixed () const; + inline bool isUserNativeConstraints () const; inline bool hasBadTopology () const; bool canDestroy ( unsigned int flags=0 ) const; bool canMoveUp ( const AutoSegment* moved ) const; @@ -124,6 +124,7 @@ namespace Katabatic { virtual Box getBoundingBox () const; inline GCell* getGCell () const; virtual AutoSegment* getOpposite ( const AutoSegment* ) const = 0; + virtual AutoSegment* getPerpandicular ( const AutoSegment* ) const = 0; virtual AutoSegment* getSegment ( unsigned int ) const = 0; unsigned int getMinDepth () const; unsigned int getMaxDepth () const; @@ -160,6 +161,7 @@ namespace Katabatic { , DbU::Unit constraintMax , unsigned int flags=KbWarnOnError ); void restoreNativeConstraintBox (); + void migrateConstraintBox ( AutoContact* other ); void destroy (); // Inspector Management. Record* _getRecord () const; @@ -202,55 +204,56 @@ namespace Katabatic { // Wrapped Contact Inline Functions. - inline Hook* AutoContact::getBodyHook () { return _contact->getBodyHook(); } - inline Hook* AutoContact::getAnchorHook () { return _contact->getAnchorHook(); } - inline Component* AutoContact::getAnchor () const { return _contact->getAnchor(); } - inline Net* AutoContact::getNet () const { return _contact->getNet(); } - inline const Layer* AutoContact::getLayer () const { return _contact->getLayer(); } - inline DbU::Unit AutoContact::getX () const { return _contact->getX(); } - inline DbU::Unit AutoContact::getY () const { return _contact->getY(); } - inline DbU::Unit AutoContact::getDx () const { return _contact->getDx(); } - inline DbU::Unit AutoContact::getDy () const { return _contact->getDy(); } - inline Point AutoContact::getCenter () const { return _contact->getCenter(); } - inline Point AutoContact::getPosition () const { return _contact->getPosition(); } - inline DbU::Unit AutoContact::getWidth () const { return _contact->getWidth(); } - inline DbU::Unit AutoContact::getHalfWidth () const { return _contact->getHalfWidth(); } - inline DbU::Unit AutoContact::getHeight () const { return _contact->getHeight(); } - inline DbU::Unit AutoContact::getHalfHeight () const { return _contact->getHalfHeight(); } - inline Components AutoContact::getSlaveComponents () const { return _contact->getSlaveComponents(); } - inline void AutoContact::setLayer ( const Layer* layer ) { return _contact->setLayer(layer); } - inline void AutoContact::setWidth ( DbU::Unit w ) { return _contact->setWidth(w); } - inline void AutoContact::setHeight ( DbU::Unit h ) { return _contact->setHeight(h); } - inline void AutoContact::setSizes ( DbU::Unit w, DbU::Unit h ) { return _contact->setSizes(w,h); } - inline void AutoContact::setX ( DbU::Unit x ) { return _contact->setX(x); } - inline void AutoContact::setY ( DbU::Unit y ) { return _contact->setY(y); } - inline void AutoContact::setPosition ( DbU::Unit x, DbU::Unit y ) { return _contact->setPosition(x,y); } - inline void AutoContact::setPosition ( const Point& p ) { return _contact->setPosition(p); } - inline void AutoContact::setDx ( DbU::Unit dx ) { return _contact->setDx(dx); } - inline void AutoContact::setDy ( DbU::Unit dy ) { return _contact->setDy(dy); } - inline void AutoContact::setOffset ( DbU::Unit dx, DbU::Unit dy ) { return _contact->setOffset(dx,dy); } -// AutoContact Inline Functions. - inline bool AutoContact::isInCreationStage () const { return _flags&CntInCreationStage; } - inline bool AutoContact::isInvalidated () const { return _flags&CntInvalidated; } - inline bool AutoContact::isInvalidatedCache () const { return _flags&CntInvalidatedCache; } - inline bool AutoContact::isTurn () const { return _flags&CntTurn; } - inline bool AutoContact::isFixed () const { return _flags&CntFixed; } - inline bool AutoContact::isTerminal () const { return _flags&CntTerminal; } - inline bool AutoContact::isHTee () const { return _flags&CntHTee; } - inline bool AutoContact::isVTee () const { return _flags&CntVTee; } - inline bool AutoContact::hasBadTopology () const { return _flags&CntBadTopology; } - inline size_t AutoContact::getId () const { return _id; } - inline Contact* AutoContact::base () const { return _contact; } - inline GCell* AutoContact::getGCell () const { return _gcell; } - inline Box AutoContact::getConstraintBox () const { return Box(getCBXMin(),getCBYMin(),getCBXMax(),getCBYMax()); } - inline void AutoContact::setCBXMin ( DbU::Unit xMin ) { _dxMin = _getDeltaMin(xMin,_gcell->getX()); } - inline void AutoContact::setCBXMax ( DbU::Unit xMax ) { _dxMax = _getDeltaMax(xMax,_gcell->getX(),_gcell->getXMax()); } - inline void AutoContact::setCBYMin ( DbU::Unit yMin ) { _dyMin = _getDeltaMin(yMin,_gcell->getY()); } - inline void AutoContact::setCBYMax ( DbU::Unit yMax ) { _dyMax = _getDeltaMax(yMax,_gcell->getY(),_gcell->getYMax()); } - inline void AutoContact::setFlags ( unsigned int flags ) { _flags|= flags; } - inline void AutoContact::unsetFlags ( unsigned int flags ) { _flags&=~flags; } - inline int AutoContact::_getDeltaMin ( DbU::Unit x, DbU::Unit xMin ) { if (xxMax) x=xMax; return (int)DbU::toLambda(x-xMin); } + inline Hook* AutoContact::getBodyHook () { return _contact->getBodyHook(); } + inline Hook* AutoContact::getAnchorHook () { return _contact->getAnchorHook(); } + inline Component* AutoContact::getAnchor () const { return _contact->getAnchor(); } + inline Net* AutoContact::getNet () const { return _contact->getNet(); } + inline const Layer* AutoContact::getLayer () const { return _contact->getLayer(); } + inline DbU::Unit AutoContact::getX () const { return _contact->getX(); } + inline DbU::Unit AutoContact::getY () const { return _contact->getY(); } + inline DbU::Unit AutoContact::getDx () const { return _contact->getDx(); } + inline DbU::Unit AutoContact::getDy () const { return _contact->getDy(); } + inline Point AutoContact::getCenter () const { return _contact->getCenter(); } + inline Point AutoContact::getPosition () const { return _contact->getPosition(); } + inline DbU::Unit AutoContact::getWidth () const { return _contact->getWidth(); } + inline DbU::Unit AutoContact::getHalfWidth () const { return _contact->getHalfWidth(); } + inline DbU::Unit AutoContact::getHeight () const { return _contact->getHeight(); } + inline DbU::Unit AutoContact::getHalfHeight () const { return _contact->getHalfHeight(); } + inline Components AutoContact::getSlaveComponents () const { return _contact->getSlaveComponents(); } + inline void AutoContact::setLayer ( const Layer* layer ) { _contact->setLayer(layer); } + inline void AutoContact::setWidth ( DbU::Unit w ) { _contact->setWidth(w); } + inline void AutoContact::setHeight ( DbU::Unit h ) { _contact->setHeight(h); } + inline void AutoContact::setSizes ( DbU::Unit w, DbU::Unit h ) { _contact->setSizes(w,h); } + inline void AutoContact::setX ( DbU::Unit x ) { _contact->setX(x); } + inline void AutoContact::setY ( DbU::Unit y ) { _contact->setY(y); } + inline void AutoContact::setPosition ( DbU::Unit x, DbU::Unit y ) { _contact->setPosition(x,y); } + inline void AutoContact::setPosition ( const Point& p ) { _contact->setPosition(p); } + inline void AutoContact::setDx ( DbU::Unit dx ) { _contact->setDx(dx); } + inline void AutoContact::setDy ( DbU::Unit dy ) { _contact->setDy(dy); } + inline void AutoContact::setOffset ( DbU::Unit dx, DbU::Unit dy ) { _contact->setOffset(dx,dy); } +// AutoContact Inline Functions. + inline bool AutoContact::isInCreationStage () const { return _flags&CntInCreationStage; } + inline bool AutoContact::isInvalidated () const { return _flags&CntInvalidated; } + inline bool AutoContact::isInvalidatedCache () const { return _flags&CntInvalidatedCache; } + inline bool AutoContact::isTurn () const { return _flags&CntTurn; } + inline bool AutoContact::isFixed () const { return _flags&CntFixed; } + inline bool AutoContact::isUserNativeConstraints () const { return _flags&CntUserNativeConstraints; } + inline bool AutoContact::isTerminal () const { return _flags&CntTerminal; } + inline bool AutoContact::isHTee () const { return _flags&CntHTee; } + inline bool AutoContact::isVTee () const { return _flags&CntVTee; } + inline bool AutoContact::hasBadTopology () const { return _flags&CntBadTopology; } + inline size_t AutoContact::getId () const { return _id; } + inline Contact* AutoContact::base () const { return _contact; } + inline GCell* AutoContact::getGCell () const { return _gcell; } + inline Box AutoContact::getConstraintBox () const { return Box(getCBXMin(),getCBYMin(),getCBXMax(),getCBYMax()); } + inline void AutoContact::setCBXMin ( DbU::Unit xMin ) { _dxMin = _getDeltaMin(xMin,_gcell->getX()); } + inline void AutoContact::setCBXMax ( DbU::Unit xMax ) { _dxMax = _getDeltaMax(xMax,_gcell->getX(),_gcell->getXMax()); } + inline void AutoContact::setCBYMin ( DbU::Unit yMin ) { _dyMin = _getDeltaMin(yMin,_gcell->getY()); } + inline void AutoContact::setCBYMax ( DbU::Unit yMax ) { _dyMax = _getDeltaMax(yMax,_gcell->getY(),_gcell->getYMax()); } + inline void AutoContact::setFlags ( unsigned int flags ) { _flags|= flags; } + inline void AutoContact::unsetFlags ( unsigned int flags ) { _flags&=~flags; } + inline int AutoContact::_getDeltaMin ( DbU::Unit x, DbU::Unit xMin ) { if (xxMax) x=xMax; return (int)DbU::toLambda(x-xMin); } inline DbU::Unit AutoContact::getCBXMin () const { return isFixed() ? _contact->getX() : DbU::fromLambda(_dxMin) + _gcell->getX(); } @@ -286,13 +289,13 @@ namespace Katabatic { inline LocatorHelper::LocatorHelper ( AutoContact* contact, unsigned int flags ) : _flags(flags), _index(_min()), _contact(contact) { - ltracein(80); - ltrace(80) << "CTOR LocatorHelper " << contact->_getString() << endl; - ltrace(80) << "+ _min():" << _min() << endl; - ltrace(80) << "+ _max():" << _max() << endl; - ltrace(80) << "+ getSegment(_min()):" << _contact->getSegment(_min()) << endl; + cdebug.tabw(145,1); + cdebug.log(145) << "CTOR LocatorHelper " << contact->_getString() << endl; + cdebug.log(145) << "+ _min():" << _min() << endl; + cdebug.log(145) << "+ _max():" << _max() << endl; + cdebug.log(145) << "+ getSegment(_min()):" << _contact->getSegment(_min()) << endl; if (not _contact->getSegment(_index)) progress(); - ltraceout(80); + cdebug.tabw(145,-1); } inline bool LocatorHelper::isValid () const @@ -306,20 +309,20 @@ namespace Katabatic { inline AutoSegment* LocatorHelper::getSegment () const { - ltrace(80) << "LocatorHelper::getSegment(" << _index << ") - " << _contact->getSegment(_index) << endl; + cdebug.log(145) << "LocatorHelper::getSegment(" << _index << ") - " << _contact->getSegment(_index) << endl; return (_index < _max()) ? _contact->getSegment(_index) : NULL; } inline void LocatorHelper::progress () { - ltracein(80); - ltrace(80) << "LocatorHelper::progress() [" << _index << "] " << _contact->getSegment(_index) << endl; + cdebug.tabw(145,1); ++_index; + cdebug.log(145) << "LocatorHelper::progress() [" << _index << "] " << _contact->getSegment(_index) << endl; while ((_index < _max()) and (_contact->getSegment(_index) == NULL)) { - ltrace(80) << "LocatorHelper::progress() [" << _index << "] " << _contact->getSegment(_index) << endl; ++_index; + cdebug.log(145) << "LocatorHelper::progress() [" << _index << "] " << _contact->getSegment(_index) << endl; } - ltraceout(80); + cdebug.tabw(145,-1); } diff --git a/katabatic/src/katabatic/AutoContactHTee.h b/katabatic/src/katabatic/AutoContactHTee.h index c79cdbf9..f73814c0 100644 --- a/katabatic/src/katabatic/AutoContactHTee.h +++ b/katabatic/src/katabatic/AutoContactHTee.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2012-2015, All Rights Reserved +// Copyright (c) UPMC 2012-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -44,6 +44,7 @@ namespace Katabatic { inline AutoHorizontal* getHorizontal2 () const; inline AutoVertical* getVertical1 () const; virtual AutoSegment* getOpposite ( const AutoSegment* ) const; + virtual AutoSegment* getPerpandicular ( const AutoSegment* ) const; virtual AutoSegment* getSegment ( unsigned int ) const; virtual void updateGeometry (); virtual void updateTopology (); diff --git a/katabatic/src/katabatic/AutoContactTerminal.h b/katabatic/src/katabatic/AutoContactTerminal.h index 7832476e..3a6b126b 100644 --- a/katabatic/src/katabatic/AutoContactTerminal.h +++ b/katabatic/src/katabatic/AutoContactTerminal.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2012-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2012-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -55,6 +55,7 @@ namespace Katabatic { inline AutoSegment* getSegment () const; virtual AutoSegment* getSegment ( unsigned int ) const; virtual AutoSegment* getOpposite ( const AutoSegment* ) const; + virtual AutoSegment* getPerpandicular ( const AutoSegment* ) const; virtual void updateGeometry (); virtual void updateTopology (); virtual void cacheDetach ( AutoSegment* ); diff --git a/katabatic/src/katabatic/AutoContactTurn.h b/katabatic/src/katabatic/AutoContactTurn.h index 52657e82..6e2409cd 100644 --- a/katabatic/src/katabatic/AutoContactTurn.h +++ b/katabatic/src/katabatic/AutoContactTurn.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2012-2015, All Rights Reserved +// Copyright (c) UPMC 2012-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -43,6 +43,7 @@ namespace Katabatic { inline AutoHorizontal* getHorizontal1 () const; inline AutoVertical* getVertical1 () const; virtual AutoSegment* getOpposite ( const AutoSegment* ) const; + virtual AutoSegment* getPerpandicular ( const AutoSegment* ) const; virtual AutoSegment* getSegment ( unsigned int ) const; virtual void updateGeometry (); virtual void updateTopology (); diff --git a/katabatic/src/katabatic/AutoContactVTee.h b/katabatic/src/katabatic/AutoContactVTee.h index ba4d0f64..d201c091 100644 --- a/katabatic/src/katabatic/AutoContactVTee.h +++ b/katabatic/src/katabatic/AutoContactVTee.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2012-2015, All Rights Reserved +// Copyright (c) UPMC 2012-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -41,6 +41,7 @@ namespace Katabatic { inline AutoVertical* getVertical1 () const; inline AutoVertical* getVertical2 () const; virtual AutoSegment* getOpposite ( const AutoSegment* ) const; + virtual AutoSegment* getPerpandicular ( const AutoSegment* ) const; virtual AutoSegment* getSegment ( unsigned int ) const; virtual void updateGeometry (); virtual void updateTopology (); diff --git a/katabatic/src/katabatic/AutoSegment.h b/katabatic/src/katabatic/AutoSegment.h index f42668a8..3e6728ea 100644 --- a/katabatic/src/katabatic/AutoSegment.h +++ b/katabatic/src/katabatic/AutoSegment.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -30,7 +30,7 @@ namespace Hurricane { class Vertical; class Cell; } - +#include "crlcore/RoutingGauge.h" #include "katabatic/Constants.h" #include "katabatic/Observer.h" #include "katabatic/GCell.h" @@ -46,13 +46,13 @@ namespace Katabatic { using std::endl; using std::binary_function; using Hurricane::tab; - using Hurricane::inltrace; using Hurricane::Interval; using Hurricane::Layer; using Hurricane::Components; using Hurricane::Horizontal; using Hurricane::Vertical; using Hurricane::Cell; + using CRL::RoutingGauge; class AutoHorizontal; class AutoVertical; @@ -60,43 +60,44 @@ namespace Katabatic { // ------------------------------------------------------------------- // Class : "AutoSegment". - enum AutoSegmentFlag { SegNoFlags = 0x00000000 - , SegHorizontal = 0x00000001 - , SegFixed = 0x00000002 - , SegGlobal = 0x00000004 - , SegWeakGlobal = 0x00000008 - , SegCanonical = 0x00000010 - , SegBipoint = 0x00000020 - , SegDogleg = 0x00000040 - , SegStrap = 0x00000080 - , SegSourceTop = 0x00000100 - , SegSourceBottom = 0x00000200 - , SegTargetTop = 0x00000400 - , SegTargetBottom = 0x00000800 - , SegLayerChange = 0x00001000 - , SegSourceTerminal = 0x00002000 // Replace Terminal. - , SegTargetTerminal = 0x00004000 // Replace Terminal. + enum AutoSegmentFlag { SegNoFlags = 0x0 + , SegHorizontal = (1<< 0) + , SegFixed = (1<< 1) + , SegGlobal = (1<< 2) + , SegWeakGlobal = (1<< 3) + , SegCanonical = (1<< 4) + , SegBipoint = (1<< 5) + , SegDogleg = (1<< 6) + , SegStrap = (1<< 7) + , SegSourceTop = (1<< 8) + , SegSourceBottom = (1<< 9) + , SegTargetTop = (1<<10) + , SegTargetBottom = (1<<11) + , SegIsReduced = (1<<12) + , SegLayerChange = (1<<13) + , SegSourceTerminal = (1<<14) // Replace Terminal. + , SegTargetTerminal = (1<<15) // Replace Terminal. , SegStrongTerminal = SegSourceTerminal|SegTargetTerminal - , SegWeakTerminal1 = 0x00008000 // Replace TopologicalEnd. - , SegWeakTerminal2 = 0x00010000 // Replace TopologicalEnd. - , SegNotSourceAligned = 0x00020000 - , SegNotTargetAligned = 0x00040000 - , SegUnbound = 0x00100000 - , SegHalfSlackened = 0x00200000 - , SegSlackened = 0x00400000 - , SegAxisSet = 0x00800000 - , SegInvalidated = 0x01000000 - , SegInvalidatedSource = 0x02000000 - , SegInvalidatedTarget = 0x04000000 - , SegInvalidatedLayer = 0x08000000 - , SegCreated = 0x10000000 - , SegUserDefined = 0x20000000 + , SegWeakTerminal1 = (1<<16) // Replace TopologicalEnd. + , SegWeakTerminal2 = (1<<17) // Replace TopologicalEnd. + , SegNotSourceAligned = (1<<18) + , SegNotTargetAligned = (1<<19) + , SegUnbound = (1<<20) + , SegHalfSlackened = (1<<21) + , SegSlackened = (1<<22) + , SegAxisSet = (1<<23) + , SegInvalidated = (1<<24) + , SegInvalidatedSource = (1<<25) + , SegInvalidatedTarget = (1<<26) + , SegInvalidatedLayer = (1<<27) + , SegCreated = (1<<28) + , SegUserDefined = (1<<29) // Masks. , SegWeakTerminal = SegStrongTerminal|SegWeakTerminal1|SegWeakTerminal2 , SegNotAligned = SegNotSourceAligned|SegNotTargetAligned - , SegSpinTop = SegSourceTop |SegTargetTop - , SegSpinBottom = SegSourceBottom|SegTargetBottom - , SegDepthSpin = SegSpinTop |SegSpinBottom + , SegSpinTop = SegSourceTop |SegTargetTop + , SegSpinBottom = SegSourceBottom |SegTargetBottom + , SegDepthSpin = SegSpinTop |SegSpinBottom }; @@ -122,6 +123,7 @@ namespace Katabatic { static AutoSegment* create ( AutoContact* source , AutoContact* target , unsigned int dir + , size_t depth=RoutingGauge::nlayerdepth ); void destroy (); // Wrapped Segment Functions. @@ -169,11 +171,11 @@ namespace Katabatic { bool isStrongTerminal ( unsigned int flags=0 ) const; inline bool isSourceTerminal () const; inline bool isTargetTerminal () const; - bool isSameLayerDogleg () const; inline bool isLayerChange () const; inline bool isSpinTop () const; inline bool isSpinBottom () const; inline bool isSpinTopOrBottom () const; + inline bool isReduced () const; inline bool isStrap () const; inline bool isDogleg () const; inline bool isUnbound () const; @@ -184,7 +186,11 @@ namespace Katabatic { inline bool isUnsetAxis () const; inline bool isSlackened () const; inline bool isUserDefined () const; + bool isReduceCandidate () const; + bool isUTurn () const; virtual bool _canSlacken () const = 0; + bool canReduce () const; + bool mustRaise () const; unsigned int canDogleg ( Interval ); virtual bool canMoveULeft ( float reserve=0.0 ) const = 0; virtual bool canMoveURight ( float reserve=0.0 ) const = 0; @@ -239,6 +245,8 @@ namespace Katabatic { inline void unsetFlags ( unsigned int ); inline void setFlags ( unsigned int ); void setFlagsOnAligneds ( unsigned int ); + inline void incReduceds (); + inline void decReduceds (); virtual void setDuSource ( DbU::Unit du ) = 0; virtual void setDuTarget ( DbU::Unit du ) = 0; void computeTerminal (); @@ -270,6 +278,9 @@ namespace Katabatic { void changeDepth ( unsigned int depth, unsigned int flags ); bool moveUp ( unsigned int flags=KbNoFlags ); bool moveDown ( unsigned int flags=KbNoFlags ); + bool reduceDoglegLayer (); + bool reduce (); + bool raise (); // Canonical Modifiers. AutoSegment* canonize ( unsigned int flags=KbNoFlags ); virtual void invalidate ( unsigned int flags=KbPropagate ); @@ -314,6 +325,7 @@ namespace Katabatic { unsigned int _depth : 8; unsigned int _optimalMin : 8; unsigned int _optimalMax : 8; + unsigned int _reduceds : 2; DbU::Unit _sourcePosition; DbU::Unit _targetPosition; Interval _userConstraints; @@ -445,6 +457,7 @@ namespace Katabatic { inline bool AutoSegment::isSpinTop () const { return ((_flags & SegSpinTop ) == SegSpinTop); } inline bool AutoSegment::isSpinBottom () const { return ((_flags & SegSpinBottom) == SegSpinBottom); } inline bool AutoSegment::isSpinTopOrBottom () const { return isSpinTop() or isSpinBottom(); } + inline bool AutoSegment::isReduced () const { return _flags & SegIsReduced; } inline bool AutoSegment::isSlackened () const { return _flags & SegSlackened; } inline bool AutoSegment::isCanonical () const { return _flags & SegCanonical; } inline bool AutoSegment::isUnsetAxis () const { return not (_flags & SegAxisSet); } @@ -457,6 +470,8 @@ namespace Katabatic { inline unsigned int AutoSegment::getFlags () const { return _flags; } inline unsigned int AutoSegment::_getFlags () const { return _flags; } + inline void AutoSegment::incReduceds () { if (_reduceds<3) ++_reduceds; } + inline void AutoSegment::decReduceds () { if (_reduceds>0) --_reduceds; } inline void AutoSegment::setLayer ( const Layer* layer ) { base()->setLayer(layer); _depth=Session::getLayerDepth(layer); } inline void AutoSegment::setOptimalMin ( DbU::Unit min ) { _optimalMin = (unsigned int)DbU::getLambda(min-getOrigin()); } inline void AutoSegment::setOptimalMax ( DbU::Unit max ) { _optimalMax = (unsigned int)DbU::getLambda(max-getOrigin()); } @@ -506,7 +521,7 @@ namespace Katabatic { inline int AutoSegment::getTerminalCount ( AutoSegment* seed ) { - ltrace(80) << "getTerminalCount() - " << seed << endl; + cdebug.log(145) << "getTerminalCount() - " << seed << endl; vector collapseds; vector perpandiculars; diff --git a/katabatic/src/katabatic/AutoSegments.h b/katabatic/src/katabatic/AutoSegments.h index 973f8000..29b81e58 100644 --- a/katabatic/src/katabatic/AutoSegments.h +++ b/katabatic/src/katabatic/AutoSegments.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/katabatic/src/katabatic/ChipTools.h b/katabatic/src/katabatic/ChipTools.h index 37abe176..e3550943 100644 --- a/katabatic/src/katabatic/ChipTools.h +++ b/katabatic/src/katabatic/ChipTools.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/katabatic/src/katabatic/Configuration.h b/katabatic/src/katabatic/Configuration.h index b378e179..096a8842 100644 --- a/katabatic/src/katabatic/Configuration.h +++ b/katabatic/src/katabatic/Configuration.h @@ -1,7 +1,7 @@ // -*- mode: C++; explicit-buffer-name: "Configuration.h" -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/katabatic/src/katabatic/Constants.h b/katabatic/src/katabatic/Constants.h index 1b2c3314..af17beca 100644 --- a/katabatic/src/katabatic/Constants.h +++ b/katabatic/src/katabatic/Constants.h @@ -1,7 +1,7 @@ // -*- mode: C++; explicit-buffer-name: "Constants.h" -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2013-2015, All Rights Reserved +// Copyright (c) UPMC 2013-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -47,6 +47,7 @@ namespace Katabatic { , KbNoGCellShrink = 0x01000000 , KbCParanoid = 0x02000000 , KbCreate = 0x04000000 + , KbCheckLowDensity = 0x08000000 , KbDirectionMask = KbHorizontal|KbVertical }; diff --git a/katabatic/src/katabatic/GCell.h b/katabatic/src/katabatic/GCell.h index 74bbf72a..2adbd430 100644 --- a/katabatic/src/katabatic/GCell.h +++ b/katabatic/src/katabatic/GCell.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/katabatic/src/katabatic/GCellGrid.h b/katabatic/src/katabatic/GCellGrid.h index 9c55a24f..f99d1aa8 100644 --- a/katabatic/src/katabatic/GCellGrid.h +++ b/katabatic/src/katabatic/GCellGrid.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/katabatic/src/katabatic/GCells.h b/katabatic/src/katabatic/GCells.h index f6e655aa..f7498848 100644 --- a/katabatic/src/katabatic/GCells.h +++ b/katabatic/src/katabatic/GCells.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/katabatic/src/katabatic/Grid.h b/katabatic/src/katabatic/Grid.h index 2b053298..e98e6f43 100644 --- a/katabatic/src/katabatic/Grid.h +++ b/katabatic/src/katabatic/Grid.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/katabatic/src/katabatic/GridBox.h b/katabatic/src/katabatic/GridBox.h index 7b63e151..c4b11cf1 100644 --- a/katabatic/src/katabatic/GridBox.h +++ b/katabatic/src/katabatic/GridBox.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/katabatic/src/katabatic/GridCollections.h b/katabatic/src/katabatic/GridCollections.h index 1c09faf8..9d4cf45a 100644 --- a/katabatic/src/katabatic/GridCollections.h +++ b/katabatic/src/katabatic/GridCollections.h @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/katabatic/src/katabatic/KatabaticEngine.h b/katabatic/src/katabatic/KatabaticEngine.h index 01f26adc..9d40a84c 100644 --- a/katabatic/src/katabatic/KatabaticEngine.h +++ b/katabatic/src/katabatic/KatabaticEngine.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -146,6 +146,7 @@ namespace Katabatic { void slackenBorder ( Box bb, Layer::Mask, unsigned int flags ); void slackenBlockIos ( Instance* core ); bool moveUpNetTrunk ( AutoSegment*, set& globalNets, GCell::SetIndex& invalidateds ); + bool moveUpNetTrunk2 ( AutoSegment*, set& globalNets, GCell::SetIndex& invalidateds ); void moveULeft ( AutoSegment*, set& globalNets, GCell::SetIndex& invalidateds ); void moveURight ( AutoSegment*, set& globalNets, GCell::SetIndex& invalidateds ); void balanceGlobalDensity (); diff --git a/katabatic/src/katabatic/Observer.h b/katabatic/src/katabatic/Observer.h index 32efc9ed..aede2ebe 100644 --- a/katabatic/src/katabatic/Observer.h +++ b/katabatic/src/katabatic/Observer.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/katabatic/src/katabatic/Session.h b/katabatic/src/katabatic/Session.h index 8dab84a7..869cf7e8 100644 --- a/katabatic/src/katabatic/Session.h +++ b/katabatic/src/katabatic/Session.h @@ -1,7 +1,7 @@ // -*- mode: C++; explicit-buffer-name: "Session.h" -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -17,17 +17,17 @@ #ifndef KATABATIC_SESSION_H #define KATABATIC_SESSION_H -#include -#include -#include -#include -#include -#include "hurricane/Commons.h" -#include "hurricane/DbU.h" -#include "crlcore/CellGauge.h" -#include "crlcore/RoutingGauge.h" -#include "katabatic/Constants.h" -#include "katabatic/Configuration.h" +#include +#include +#include +#include +#include +#include "hurricane/Commons.h" +#include "hurricane/DbU.h" +#include "crlcore/CellGauge.h" +#include "crlcore/RoutingGauge.h" +#include "katabatic/Constants.h" +#include "katabatic/Configuration.h" namespace Hurricane { class Layer; @@ -48,7 +48,6 @@ namespace Katabatic { using std::map; using std::make_pair; using Hurricane::tab; - using Hurricane::inltrace; using Hurricane::_TName; using Hurricane::Record; using Hurricane::Layer; diff --git a/kite/doc/Session.dox b/kite/doc/Session.dox index dc6dd463..bbbd7568 100644 --- a/kite/doc/Session.dox +++ b/kite/doc/Session.dox @@ -56,17 +56,23 @@ * - Process all insert events. This is the time TrackSegment * are moved into their new Track (physical displacement). * It is at this point that the invalidation of both AutoSegment - * and TrackSEgment is done. + * and TrackSegment is done. * - Call the Katabatic::Session::revalidate() method which * will recompute the correct contact extensions and topologies. * \e After this step the Katabatic data-base is up to date, - * but \e not the Kite one. AutoSEgment are revalidated. + * but \e not the Kite one. AutoSegment are revalidated. * - Recompute the canonical position of source and target * of all invalidateds TrackSegment (take account of * extention modifications). The set of invalidated TrackSegment * is computed from the revalidated AutoSegment, that is * AutoSegment that are canonical. * - Perform a sort() on all Track that have been modifieds. + * - Now that the size of the segments have been accurately computed, + * look for revalidateds TrackSegment that: + * -# Can be reduced, generate a track remove event. + * -# Must be raised, generate a routing event (put into the + * queue). + * - Process the additional track remove events. * * Note: We cannot use the Observer mechanism to automatically * update TrackSegment from an AutoSegment, because we must wait for all diff --git a/kite/doc/TrackSegment.dox b/kite/doc/TrackSegment.dox index eb8e54ca..b617ce4b 100644 --- a/kite/doc/TrackSegment.dox +++ b/kite/doc/TrackSegment.dox @@ -27,7 +27,7 @@ * The associated DataNegociate and RoutingEvent are \b not updated. * - The RoutingEvent will be updated when it's key is updated, * typically during a requeueing operation \b and in the - * SegmentFsm constructor. This should be optimzed in the future. + * SegmentFsm constructor. This should be optimized in the future. * - The DataNegociate is updated \e only in the SegmentFsm * constructor. This is the most costly of the two updates as * it perform a perpandicular & parallel connexity exploration. @@ -51,9 +51,9 @@ * * Figure 2 below, shows an example of dogleg creation: * - At the Katabatic level, AutoSegment \c id:12 is broken. Thus - * the creation of AutoSegments \c id:20 and \c id:21. As per - * specification, the orignal segment \c id:10 remains on the - * left side (source) of the break. + * the creation of AutoSegments \c id:20 and \c id:21. The orignal + * TrackSegment (canonical AutoSegment \c id:10) remains on the + * right side (target) of the break. * - But, because the canonical of the former aligned AutoSegment * set \c (10,11,12,13,14) was on the \e right side of the break, * the new parallel TrackSegment will be created on the \c left diff --git a/kite/doc/footer.html b/kite/doc/footer.html index f52a215c..aea18d36 100644 --- a/kite/doc/footer.html +++ b/kite/doc/footer.html @@ -9,7 +9,7 @@ - +
              Kite - Detailed RouterCopyright © 2008-2015 UPMC. All rights reservedCopyright © 2008-2016 UPMC. All rights reserved
              diff --git a/kite/doc/notes.dox b/kite/doc/notes.dox index 8664e043..ae0f16e4 100644 --- a/kite/doc/notes.dox +++ b/kite/doc/notes.dox @@ -42,6 +42,14 @@ * - Now that the Hurricane database is deterministic, the router * seems to be likewise. * + * - Reduce/raise mechanism. To manage same layer dogleg + * this mechanism has been implemented. When a candidate dogleg + * perpandicular segment length shrink below one pitch it is + * removed from any track to become invisible. + * Conversely, when a reduced segment length expand over one pitch + * generate a new RoutingEvent to insert it. All this is managed + * in the Session::revalidate() method. + * * * \section secPendingModifications Pending Modifications * diff --git a/kite/src/BuildPowerRails.cpp b/kite/src/BuildPowerRails.cpp index 6a6a377b..b38f1087 100644 --- a/kite/src/BuildPowerRails.cpp +++ b/kite/src/BuildPowerRails.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -45,9 +45,6 @@ namespace { using namespace std; using Hurricane::tab; - using Hurricane::inltrace; - using Hurricane::ltracein; - using Hurricane::ltraceout; using Hurricane::DebugSession; using Hurricane::ForEachIterator; using Hurricane::Warning; @@ -380,7 +377,7 @@ namespace { Net* GlobalNetTable::getRootNet ( const Net* net, Path path ) const { - ltrace(300) << " getRootNet:" << path << ":" << net << endl; + cdebug.log(159) << " getRootNet:" << path << ":" << net << endl; if (net == _blockage) return _blockage; @@ -393,27 +390,27 @@ namespace { return NULL; } - DeepNet* deepClockNet = getTopCell()->getDeepNet( path, net ); - if (deepClockNet) { - ltrace(300) << " Deep Clock Net:" << deepClockNet - << " state:" << NetRoutingExtension::getFlags(deepClockNet) << endl; - - return NetRoutingExtension::isFixed(deepClockNet) ? _blockage : NULL; - } else { - ltrace(300) << " Top Clock Net:" << net - << " state:" << NetRoutingExtension::getFlags(net) << endl; - } - // Track up, *only* for clocks. const Net* upNet = net; if (not path.isEmpty()) { + DeepNet* deepClockNet = getTopCell()->getDeepNet( path, net ); + if (deepClockNet) { + cdebug.log(159) << " Deep Clock Net:" << deepClockNet + << " state:" << NetRoutingExtension::getFlags(deepClockNet) << endl; + + return NetRoutingExtension::isFixed(deepClockNet) ? _blockage : NULL; + } else { + cdebug.log(159) << " Top Clock Net:" << net + << " state:" << NetRoutingExtension::getFlags(net) << endl; + } + Path upPath = path; Instance* instance = NULL; Plug* plug = NULL; while ( true ) { - ltrace(300) << " " << path << "+" << upNet << endl; + cdebug.log(159) << " " << path << "+" << upNet << endl; if (path.isEmpty()) break; if ((upNet == NULL) or not upNet->isExternal()) return _blockage; @@ -427,7 +424,7 @@ namespace { } } - ltrace(300) << " Check againts top clocks ck:" << ((_ck) ? _ck->getName() : "NULL") + cdebug.log(159) << " Check againts top clocks ck:" << ((_ck) ? _ck->getName() : "NULL") << " cki:" << ((_cki) ? _cki->getName() : "NULL") << " cko:" << ((_cko) ? _cko->getName() : "NULL") << endl; @@ -441,7 +438,7 @@ namespace { } } - return NULL; + return NetRoutingExtension::isFixed(upNet) ? _blockage : NULL; } @@ -558,7 +555,7 @@ namespace { , _width (width) , _chunks() { - ltrace(300) << " new Rail " + cdebug.log(159) << " new Rail " << " @" << DbU::getValueString(axis) << " " << getRoutingPlane()->getLayer()->getName() << " " << getRails()->getNet() @@ -576,10 +573,10 @@ namespace { void PowerRailsPlanes::Rail::merge ( DbU::Unit source, DbU::Unit target ) { Interval chunkToMerge ( source, target ); - ltrace(300) << " Rail::merge() " + cdebug.log(159) << " Rail::merge() " << ((getDirection()==KbHorizontal) ? "Horizontal" : "Vertical") << " " << chunkToMerge << endl; - ltrace(300) << " | " << _getString() << endl; + cdebug.log(159) << " | " << _getString() << endl; list::iterator imerge = _chunks.end(); list::iterator ichunk = _chunks.begin(); @@ -587,20 +584,20 @@ namespace { while ( ichunk != _chunks.end() ) { if (imerge == _chunks.end()) { if (chunkToMerge.getVMax() < (*ichunk).getVMin()) { - ltrace(300) << " | Insert before " << *ichunk << endl; + cdebug.log(159) << " | Insert before " << *ichunk << endl; imerge = _chunks.insert( ichunk, chunkToMerge ); break; } if (chunkToMerge.intersect(*ichunk)) { - ltrace(300) << " | Merge with " << *ichunk << endl; + cdebug.log(159) << " | Merge with " << *ichunk << endl; imerge = ichunk; (*imerge).merge( chunkToMerge ); } } else { if (chunkToMerge.getVMax() >= (*ichunk).getVMin()) { (*imerge).merge( *ichunk ); - ltrace(300) << " | Absorb (erase) " << *ichunk << endl; + cdebug.log(159) << " | Absorb (erase) " << *ichunk << endl; ichunk = _chunks.erase( ichunk ); continue; } else @@ -609,12 +606,12 @@ namespace { // if (chunkToMerge.intersect(*ichunk)) { // if (imerge == _chunks.end()) { - // ltrace(300) << " | Merge with " << *ichunk << endl; + // cdebug.log(159) << " | Merge with " << *ichunk << endl; // imerge = ichunk; // (*imerge).merge( chunkToMerge ); // } else { // (*imerge).merge( *ichunk ); - // ltrace(300) << " | Absorb (erase) " << *ichunk << endl; + // cdebug.log(159) << " | Absorb (erase) " << *ichunk << endl; // ichunk = _chunks.erase( ichunk ); // continue; // } @@ -624,26 +621,27 @@ namespace { if (imerge == _chunks.end()) { _chunks.insert( ichunk, chunkToMerge ); - ltrace(300) << " | Insert at end " << DbU::getValueString(_axis) << " " << chunkToMerge << endl; - ltrace(300) << " | " << _getString() << endl; + cdebug.log(159) << " | Insert at end " << DbU::getValueString(_axis) << " " << chunkToMerge << endl; + cdebug.log(159) << " | " << _getString() << endl; } } void PowerRailsPlanes::Rail::doLayout ( const Layer* layer ) { - ltrace(300) << "Doing layout of rail: " + cdebug.log(159) << "Doing layout of rail: " << " " << layer->getName() << " " << ((getDirection()==KbHorizontal) ? "Horizontal" : "Vertical") << " @" << DbU::getValueString(_axis) << endl; - ltrace(300) << _getString() << endl; + cdebug.log(159) << _getString() << endl; Net* net = getNet(); RoutingPlane* plane = getRoutingPlane(); Segment* segment = NULL; - DbU::Unit delta = plane->getLayerGauge()->getPitch() - - plane->getLayerGauge()->getHalfWireWidth() - - DbU::fromLambda(0.1); + //DbU::Unit delta = plane->getLayerGauge()->getPitch() + // - plane->getLayerGauge()->getHalfWireWidth() + // - DbU::fromLambda(0.1); + DbU::Unit delta = plane->getLayerGauge()->getObstacleDw() - DbU::fromLambda(0.1); DbU::Unit extension = layer->getExtentionCap(); //DbU::Unit extension = Session::getExtentionCap(); //unsigned int type = plane->getLayerGauge()->getType(); @@ -651,13 +649,13 @@ namespace { DbU::Unit axisMin = 0; DbU::Unit axisMax = 0; - ltrace(300) << " delta:" << DbU::getValueString(delta) + cdebug.log(159) << " delta:" << DbU::getValueString(delta) << " (pitch:" << DbU::getValueString(plane->getLayerGauge()->getPitch()) << " , ww/2:" << DbU::getValueString(plane->getLayerGauge()->getHalfWireWidth()) << ")" << endl; // if ( type == Constant::PinOnly ) { - // ltrace(300) << " Layer is PinOnly." << endl; + // cdebug.log(159) << " Layer is PinOnly." << endl; // return; // } @@ -679,7 +677,7 @@ namespace { ) << endl; } - ltrace(300) << " chunk: [" << DbU::getValueString((*ichunk).getVMin()) + cdebug.log(159) << " chunk: [" << DbU::getValueString((*ichunk).getVMin()) << ":" << DbU::getValueString((*ichunk).getVMax()) << "]" << endl; segment = Horizontal::create ( net @@ -702,13 +700,13 @@ namespace { Track* track = plane->getTrackByPosition ( axisMin, Constant::Superior ); for ( ; track and (track->getAxis() <= axisMax) ; track = track->getNextTrack() ) { TrackElement* element = TrackFixedSegment::create ( track, segment ); - ltrace(300) << " Insert in " << track << "+" << element << endl; + cdebug.log(159) << " Insert in " << track << "+" << element << endl; } } } else { list::iterator ichunk = _chunks.begin(); for ( ; ichunk != _chunks.end() ; ichunk++ ) { - ltrace(300) << " chunk: [" << DbU::getValueString((*ichunk).getVMin()) + cdebug.log(159) << " chunk: [" << DbU::getValueString((*ichunk).getVMin()) << ":" << DbU::getValueString((*ichunk).getVMax()) << "]" << endl; segment = Vertical::create ( net @@ -723,15 +721,18 @@ namespace { axisMin = _axis - _width/2; axisMax = _axis + _width/2; - if (coronaBb.contains(segment->getBoundingBox())) { + //if (coronaBb.contains(segment->getBoundingBox())) { axisMin -= delta; axisMax += delta; - } + //} + + cdebug.log(159) << " axisMin:" << DbU::getValueString(axisMin) + << " axisMax:" << DbU::getValueString(axisMax) << endl; Track* track = plane->getTrackByPosition ( axisMin, Constant::Superior ); for ( ; track and (track->getAxis() <= axisMax) ; track = track->getNextTrack() ) { TrackElement* element = TrackFixedSegment::create ( track, segment ); - ltrace(300) << " Insert in " << track + cdebug.log(159) << " Insert in " << track << "+" << element << " " << (net->isExternal() ? "external" : "internal") << endl; @@ -783,7 +784,7 @@ namespace { , _net (net) , _rails () { - ltrace(300) << " new Rails @" + cdebug.log(159) << " new Rails @" << " " << getRoutingPlane()->getLayer()->getName() << " " << net << " " << ((getDirection()==KbHorizontal) ? "Horizontal": "Vertical") << endl; @@ -841,7 +842,7 @@ namespace { void PowerRailsPlanes::Rails::doLayout ( const Layer* layer ) { - ltrace(300) << "Doing layout of rails: " << layer->getName() + cdebug.log(159) << "Doing layout of rails: " << layer->getName() << " " << ((_direction==KbHorizontal) ? "Horizontal" : "Vertical") << " " << _net->getName() << endl; @@ -857,7 +858,7 @@ namespace { , _verticalRails () , _powerDirection (routingPlane->getDirection()) { - ltrace(300) << "New Plane " << _layer->getName() << " " << _routingPlane << endl; + cdebug.log(159) << "New Plane " << _layer->getName() << " " << _routingPlane << endl; // Hard-coded SxLib gauge. if (_routingPlane->getDepth() == 0) _powerDirection = KbHorizontal; @@ -887,7 +888,7 @@ namespace { { Rails* rails = NULL; - ltrace(300) << " Plane::merge() " << net->getName() << " " << bb << endl; + cdebug.log(159) << " Plane::merge() " << net->getName() << " " << bb << endl; unsigned int direction = getDirection(); if ( (net->getType() == Net::Type::POWER) or (net->getType() == Net::Type::GROUND) ) @@ -910,7 +911,7 @@ namespace { } else rails = (*irails).second; - ltrace(300) << " Vertical Merging" << endl; + cdebug.log(159) << " Vertical Merging" << endl; rails->merge ( bb ); } } @@ -918,7 +919,7 @@ namespace { void PowerRailsPlanes::Plane::doLayout () { - ltrace(300) << "Doing layout of plane: " << _layer->getName() << endl; + cdebug.log(159) << "Doing layout of plane: " << _layer->getName() << endl; RailsMap::iterator irails = _horizontalRails.begin(); for ( ; irails != _horizontalRails.end() ; ++irails ) { @@ -951,10 +952,10 @@ namespace { RoutingLayerGauge* lg = rg->getLayerGauge(regular); if ( not lg ) continue; - ltrace(300) << "Gauge: [" << lg->getDepth() << "] " << lg << endl; + cdebug.log(159) << "Gauge: [" << lg->getDepth() << "] " << lg << endl; RoutingPlane* rp = _kite->getRoutingPlaneByIndex(lg->getDepth()); - ltrace(300) << "Plane:" << rp << endl; + cdebug.log(159) << "Plane:" << rp << endl; _planes.insert( make_pair(regular->getBasicLayer(),new Plane(regular,rp)) ); @@ -1019,7 +1020,7 @@ namespace { Net* topGlobalNet = _globalNets.getRootNet( net, Path() ); if (topGlobalNet == NULL) { - ltrace(300) << "Not a global net: " << net << endl; + cdebug.log(159) << "Not a global net: " << net << endl; return; } @@ -1170,17 +1171,17 @@ namespace { #endif if ( rootNet == NULL ) { - ltrace(300) << " rootNet is NULL, not taken into account." << endl; + cdebug.log(159) << " rootNet is NULL, not taken into account." << endl; return; } - ltrace(300) << " rootNet " << rootNet << " (" << rootNet->isClock() << ") " + cdebug.log(159) << " rootNet " << rootNet << " (" << rootNet->isClock() << ") " << go->getCell() << " (" << go->getCell()->isTerminal() << ")" << endl; const Segment* segment = dynamic_cast(component); if ( segment != NULL ) { _goMatchCount++; - ltrace(300) << " Merging PowerRail element: " << segment << endl; + cdebug.log(159) << " Merging PowerRail element: " << segment << endl; Box bb = segment->getBoundingBox ( basicLayer ); @@ -1209,7 +1210,7 @@ namespace { Box bb = contact->getBoundingBox ( basicLayer ); transformation.applyOn ( bb ); - ltrace(300) << " Merging PowerRail element: " << contact << " bb:" << bb + cdebug.log(159) << " Merging PowerRail element: " << contact << " bb:" << bb << " " << basicLayer << endl; _powerRailsPlanes.merge ( bb, rootNet ); @@ -1286,12 +1287,14 @@ namespace Kite { void KiteEngine::buildPowerRails () { - //DebugSession::open( 300 ); + //DebugSession::open( 150, 160 ); if (not _blockageNet) { _blockageNet = getCell()->getNet("blockagenet"); - if (not _blockageNet) + if (not _blockageNet) { _blockageNet = Net::create( getCell(), "blockagenet" ); + _blockageNet->setType( Net::Type::BLOCKAGE ); + } NetRoutingState* state = getRoutingState( _blockageNet, Katabatic::KbCreate ); state->setFlags( NetRoutingState::Fixed ); diff --git a/kite/src/BuildPreRouteds.cpp b/kite/src/BuildPreRouteds.cpp index 5e024a4e..25c8aa4f 100644 --- a/kite/src/BuildPreRouteds.cpp +++ b/kite/src/BuildPreRouteds.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2014-2015, All Rights Reserved +// Copyright (c) UPMC 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -51,9 +51,6 @@ namespace Kite { using namespace std; using Hurricane::tab; - using Hurricane::inltrace; - using Hurricane::ltracein; - using Hurricane::ltraceout; using Hurricane::ForEachIterator; using Hurricane::Warning; using Hurricane::Error; diff --git a/kite/src/Configuration.cpp b/kite/src/Configuration.cpp index e4af6225..9c2f28d9 100644 --- a/kite/src/Configuration.cpp +++ b/kite/src/Configuration.cpp @@ -1,7 +1,7 @@ // -*- mode: C++; explicit-buffer-name: "Configuration.cpp" -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -29,7 +29,6 @@ namespace Kite { using std::endl; using std::ostringstream; using Hurricane::tab; - using Hurricane::inltrace; using Hurricane::Error; using Hurricane::Technology; diff --git a/kite/src/DataNegociate.cpp b/kite/src/DataNegociate.cpp index eaf34f56..14195368 100644 --- a/kite/src/DataNegociate.cpp +++ b/kite/src/DataNegociate.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -33,9 +33,6 @@ namespace Kite { using std::ostringstream; using Hurricane::Bug; using Hurricane::DebugSession; - using Hurricane::inltrace; - using Hurricane::ltracein; - using Hurricane::ltraceout; using Hurricane::tab; using Katabatic::KbHorizontal; using Katabatic::KbPropagate; @@ -59,6 +56,7 @@ namespace Kite { , _attractors () , _perpandiculars () , _perpandicularFree(false) + , _reduceRanges { Interval(), Interval() } { } @@ -73,22 +71,29 @@ namespace Kite { if ( _attractors[i] > axis ) attraction += _attractors[i] - axis; else attraction += axis - _attractors[i]; } + for ( size_t i=0 ; i<2 ; ++i ) { + if (_reduceRanges[i].isEmpty()) continue; + if (_reduceRanges[i].contains(axis)) attraction -= 2*_trackSegment->getPitch(); + } return attraction; } void DataNegociate::update () { - DebugSession::open( _trackSegment->getNet(), 148 ); + DebugSession::open( _trackSegment->getNet(), 150, 160 ); - //ltrace(500) << "Deter| DataNegociate::update() - " << _trackSegment << endl; - ltrace(148) << "DataNegociate::update() - " << _trackSegment << endl; - ltracein(148); + //cdebug.log(9000) << "Deter| DataNegociate::update() - " << _trackSegment << endl; + cdebug.log(159,1) << "DataNegociate::update() - " << _trackSegment << endl; + size_t reduceCandidates = 0; + DbU::Unit pitch = _trackSegment->getPitch(); vector collapseds; vector perpandiculars; map attractorSpins; + _reduceRanges[0].makeEmpty(); + _reduceRanges[1].makeEmpty(); _perpandiculars.clear(); AutoSegment::getTopologicalInfos( _trackSegment->base() , collapseds @@ -98,12 +103,12 @@ namespace Kite { ); _terminals = AutoSegment::getTerminalCount( _trackSegment->base(), collapseds ); - //ltrace(500) << "Deter| Terminals:" << _terminals << endl; + //cdebug.log(9000) << "Deter| Terminals:" << _terminals << endl; _attractors.clear(); _perpandiculars.clear(); _perpandicularFree = Interval(false); - ltrace(148) << "Extracting attractors from perpandiculars." << endl; + cdebug.log(159) << "Extracting attractors from perpandiculars." << endl; for ( size_t i=0 ; i < perpandiculars.size() ; i++ ) { Interval interval; TrackElement* perpandicular; @@ -127,27 +132,29 @@ namespace Kite { if (RoutingEvent::getStage() == RoutingEvent::Repair) perpandicular->base()->setFlagsOnAligneds( Katabatic::SegUnbound ); - interval.inflate( DbU::fromLambda(-0.5) ); + //cerr << "perpandicular:" << perpandicular << endl; + //cerr << " " << interval << endl; + //interval.inflate( DbU::fromLambda(-0.5) ); - ltrace(148) << "| perpandicular: " << perpandiculars[i] << endl; - ltrace(148) << "| canonical: " << perpandicular << endl; - ltracein(148); - ltrace(148) << "Canonical // interval: " << interval << endl; + cdebug.log(159) << "| perpandicular: " << perpandiculars[i] << endl; + cdebug.log(159) << "| canonical: " << perpandicular << endl; + cdebug.log(159,1) << "Canonical // interval: " << interval << endl; _perpandiculars.push_back( perpandicular ); if (perpandicular->getTrack()) { Interval trackFree = perpandicular->getFreeInterval(); - ltrace(148) << "Track Perpandicular Free: " << trackFree << endl; + cdebug.log(159) << "Track Perpandicular Free: " << trackFree << endl; _perpandicularFree.intersection( trackFree ); } else { - ltrace(148) << "Not in any track " << perpandicular << endl; + cdebug.log(159) << "Not in any track " << perpandicular << endl; } +#if 0 if (interval.isPonctual()) { - ltrace(148) << "Punctual attractor @" << DbU::getValueString(interval.getVMin()) << endl; + cdebug.log(159) << "Punctual attractor @" << DbU::getValueString(interval.getVMin()) << endl; _attractors.push_back( interval.getVMin() ); - ltraceout(148); + cdebug.tabw(159,-1); continue; } @@ -161,7 +168,7 @@ namespace Kite { } else { iattractor->second -= 1; } - ltrace(148) << "Left attractor @" << DbU::getValueString(interval.getVMin()) << endl; + cdebug.log(159) << "Left attractor @" << DbU::getValueString(interval.getVMin()) << endl; } if ( (interval.getVMax() != _trackSegment->getAxis()) @@ -174,10 +181,24 @@ namespace Kite { } else { iattractor->second += 1; } - ltrace(148) << "Right attractor @" << DbU::getValueString(interval.getVMax()) << endl; + cdebug.log(159) << "Right attractor @" << DbU::getValueString(interval.getVMax()) << endl; } - ltraceout(148); + if (perpandicular->base()->isReduceCandidate()) { + if (reduceCandidates < 2) { + if (interval.getVMin()+DbU::fromLambda(0.5) == _trackSegment->getAxis()) { + _reduceRanges[reduceCandidates] = Interval( interval.getVMax()-pitch + , interval.getVMax()+pitch ); + } else if (interval.getVMax()-DbU::fromLambda(0.5) == _trackSegment->getAxis()) { + _reduceRanges[reduceCandidates] = Interval( interval.getVMin()-pitch + , interval.getVMin()+pitch ); + } + ++reduceCandidates; + } + } +#endif + + cdebug.tabw(159,-1); } if ( not _trackSegment->isTerminal() and (_perpandiculars.size() < 2) ) cerr << Bug( "Less than two perpandiculars on %s.", getString(_trackSegment).c_str() ) << endl; @@ -195,11 +216,11 @@ namespace Kite { s << DbU::getValueString( _attractors[i] ); } s << "]"; - ltrace(148) << s.str() << endl; - ltrace(200) << "Perpandicular Free: " << _perpandicularFree << endl; + cdebug.log(159) << s.str() << endl; + cdebug.log(159) << "Perpandicular Free: " << _perpandicularFree << endl; - ltraceout(148); + cdebug.tabw(159,-1); DebugSession::close(); } diff --git a/kite/src/GraphicKiteEngine.cpp b/kite/src/GraphicKiteEngine.cpp index 0055d841..4f054bb4 100644 --- a/kite/src/GraphicKiteEngine.cpp +++ b/kite/src/GraphicKiteEngine.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/kite/src/KiteEngine.cpp b/kite/src/KiteEngine.cpp index 3cd1b1a8..248f41e4 100644 --- a/kite/src/KiteEngine.cpp +++ b/kite/src/KiteEngine.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -68,9 +68,6 @@ namespace Kite { using Hurricane::UpdateSession; using Hurricane::DebugSession; using Hurricane::tab; - using Hurricane::inltrace; - using Hurricane::ltracein; - using Hurricane::ltraceout; using Hurricane::ForEachIterator; using Hurricane::Bug; using Hurricane::Error; @@ -154,8 +151,7 @@ namespace Kite { void KiteEngine::_initDataBase () { - ltrace(90) << "KiteEngine::_initDataBase()" << endl; - ltracein(90); + cdebug.log(155,1) << "KiteEngine::_initDataBase()" << endl; Session::open( this ); createGlobalGraph( KtNoFlags ); @@ -167,7 +163,7 @@ namespace Kite { Session::close(); _runKiteInit(); - ltraceout(90); + cdebug.tabw(155,-1); } @@ -184,8 +180,7 @@ namespace Kite { void KiteEngine::_preDestroy () { - ltrace(90) << "KiteEngine::_preDestroy()" << endl; - ltracein(90); + cdebug.log(155,1) << "KiteEngine::_preDestroy()" << endl; cmess1 << " o Deleting ToolEngine<" << getName() << "> from Cell <" << _cell->getName() << ">" << endl; @@ -210,7 +205,7 @@ namespace Kite { _knik->destroy(); } - ltraceout(90); + cdebug.tabw(155,-1); } @@ -322,14 +317,8 @@ namespace Kite { if (not _knik) { unsigned int flags = Cell::Flags::WarnOnUnplacedInstances; flags |= (mode & KtBuildGlobalRouting) ? Cell::Flags::BuildRings : 0; - //if (not cell->isFlattenedNets()) cell->flattenNets( flags ); cell->flattenNets( flags ); cell->createRoutingPadRings( Cell::Flags::BuildRings ); - - // Test signals from . - //DebugSession::addToTrace( getCell(), "core.snx_inst.a2_x2_8_sig" ); - //DebugSession::addToTrace( getCell(), "m_clock" ); - //DebugSession::addToTrace( getCell(), "a2_x2_8_sig" ); KatabaticEngine::chipPrep(); @@ -354,6 +343,11 @@ namespace Kite { size_t coronaReserved = 4; for( Knik::Vertex* vertex : _knik->getRoutingGraph()->getVertexes() ) { + if ( chipTools.isChip() + and ( chipTools.hPadsEnclosed(Box(vertex->getPosition())) + or chipTools.vPadsEnclosed(Box(vertex->getPosition()))) ) + vertex->setBlocked(); + for ( int i=0 ; i<2 ; ++i ) { Knik::Edge* edge = NULL; @@ -446,21 +440,21 @@ namespace Kite { for ( size_t itrack=0 ; itrackgetTrackByIndex ( itrack ); - ltrace(300) << "Capacity from: " << track << endl; + cdebug.log(159) << "Capacity from: " << track << endl; if (track->getDirection() == KbHorizontal) { for ( size_t ielement=0 ; ielementgetSize() ; ++ielement ) { TrackElement* element = track->getSegment( ielement ); if (element->getNet() == NULL) { - ltrace(300) << "Reject capacity from (not Net): " << element << endl; + cdebug.log(159) << "Reject capacity from (not Net): " << element << endl; continue; } if ( (not element->isFixed()) and (not element->isBlockage()) and (not element->isUserDefined()) ) { cmess2 << "Reject capacity from (neither fixed, blockage nor user defined): " << element << endl; - //ltrace(300) << "Reject capacity from (neither fixed nor blockage): " << element << endl; + //cdebug.log(159) << "Reject capacity from (neither fixed nor blockage): " << element << endl; continue; } @@ -468,7 +462,7 @@ namespace Kite { //int elementCapacity = (chipCorona.contains(elementBb)) ? -hEdgeCapacity : -1; int elementCapacity = -1; - ltrace(300) << "Capacity from: " << element << ":" << elementCapacity << endl; + cdebug.log(159) << "Capacity from: " << element << ":" << elementCapacity << endl; Katabatic::GCell* gcell = getGCellGrid()->getGCell( Point(element->getSourceU(),track->getAxis()) ); Katabatic::GCell* end = getGCellGrid()->getGCell( Point(element->getTargetU(),track->getAxis()) ); @@ -494,11 +488,11 @@ namespace Kite { TrackElement* element = track->getSegment( ielement ); if (element->getNet() == NULL) { - ltrace(300) << "Reject capacity from (not Net): " << element << endl; + cdebug.log(159) << "Reject capacity from (not Net): " << element << endl; continue; } if ( (not element->isFixed()) and not (element->isBlockage()) ) { - ltrace(300) << "Reject capacity from (neither fixed nor blockage): " << element << endl; + cdebug.log(159) << "Reject capacity from (neither fixed nor blockage): " << element << endl; continue; } @@ -506,7 +500,7 @@ namespace Kite { //int elementCapacity = (chipCorona.contains(elementBb)) ? -vEdgeCapacity : -1; int elementCapacity = -1; - ltrace(300) << "Capacity from: " << element << ":" << elementCapacity << endl; + cdebug.log(159) << "Capacity from: " << element << ":" << elementCapacity << endl; Katabatic::GCell* gcell = getGCellGrid()->getGCell( Point(track->getAxis(),element->getSourceU()) ); Katabatic::GCell* end = getGCellGrid()->getGCell( Point(track->getAxis(),element->getTargetU()) ); @@ -661,6 +655,7 @@ namespace Kite { unsigned long long totalWireLength = 0; unsigned long long routedWireLength = 0; vector unrouteds; + vector reduceds; ostringstream result; AutoSegmentLut::const_iterator ilut = _getAutoSegmentLut().begin(); @@ -676,20 +671,16 @@ namespace Kite { } if (segment->isFixed() or segment->isBlockage()) continue; - - // if (segment->isSameLayerDogleg()) { - // cerr << " Same layer:" << segment << endl; - // cerr << " S: " << segment->base()->getAutoSource() << endl; - // cerr << " T: " << segment->base()->getAutoTarget() << endl; - // } + if (segment->isReduced()) reduceds.push_back( segment ); totalWireLength += wl; - if (segment->getTrack() != NULL) { + if ( (segment->getTrack() != NULL) or (segment->isReduced()) ) { routeds++; routedWireLength += wl; - } else { - unrouteds.push_back( segment ); + continue; } + + unrouteds.push_back( segment ); } float segmentRatio = (float)(routeds) / (float)(routeds+unrouteds.size()) * 100.0; @@ -704,6 +695,13 @@ namespace Kite { } } + // if (not reduceds.empty()) { + // cerr << " o Reduced segments:" << endl; + // for ( size_t i=0; i Katabatic::EngineDriving) return; - ltracein(90); + cdebug.tabw(155,1); setState( Katabatic::EngineDriving ); _gutKite(); KatabaticEngine::finalizeLayout(); - ltrace(90) << "State: " << getState() << endl; + cdebug.log(155) << "State: " << getState() << endl; getCell()->setFlags( Cell::Flags::Routed ); - ltraceout(90); + cdebug.tabw(155,-1); } void KiteEngine::_gutKite () { - ltrace(90) << "KiteEngine::_gutKite()" << endl; - ltracein(90); - ltrace(90) << "State: " << getState() << endl; + cdebug.log(155,1) << "KiteEngine::_gutKite()" << endl; + cdebug.log(155) << "State: " << getState() << endl; if (getState() < Katabatic::EngineGutted) { Session::open( this ); @@ -845,7 +842,7 @@ namespace Kite { Session::close(); } - ltraceout(90); + cdebug.tabw(155,-1); } diff --git a/kite/src/KiteMain.cpp b/kite/src/KiteMain.cpp index 043ade11..cc142a4b 100644 --- a/kite/src/KiteMain.cpp +++ b/kite/src/KiteMain.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -58,18 +58,17 @@ int main ( int argc, char *argv[] ) , "" ); - unsigned int traceLevel; - bool verbose1; - bool verbose2; - bool showConf; - bool info; - bool bug; - bool coreDump; - bool logMode; - bool loadGlobal; - bool dumpMeasures; - bool saveGlobal; - bool destroyDatabase; + bool verbose1; + bool verbose2; + bool showConf; + bool info; + bool bug; + bool coreDump; + bool logMode; + bool loadGlobal; + bool dumpMeasures; + bool saveGlobal; + bool destroyDatabase; bopts::options_description options ("Command line arguments & options"); options.add_options() @@ -86,9 +85,6 @@ int main ( int argc, char *argv[] ) , "Display bug related messages.") ( "log-mode,L" , bopts::bool_switch(&logMode)->default_value(false) , "Disable ANSI escape sequences displaying.") - ( "trace-level,l" , bopts::value(&traceLevel)->default_value(1000) - , "Set the level of trace, trace messages with a level superior to " - " will be printed on ." ) ( "core-dump,D" , bopts::bool_switch(&coreDump)->default_value(false) , "Enable core dumping.") ( "load-global,g" , bopts::bool_switch(&loadGlobal)->default_value(false) @@ -122,8 +118,6 @@ int main ( int argc, char *argv[] ) if (arguments["bug" ].as()) Cfg::getParamBool("misc.bug" )->setBool( true ); if (arguments["log-mode" ].as()) Cfg::getParamBool("misc.logMode" )->setBool( true ); if (arguments["show-conf" ].as()) Cfg::getParamBool("misc.showConf" )->setBool( true ); - - if (arguments.count("trace-level" )) Cfg::getParamInt("misc.traceLevel")->setInt( traceLevel ); Cfg::Configuration::popDefaultPriority(); cmess1 << banner << endl; diff --git a/kite/src/Manipulator.cpp b/kite/src/Manipulator.cpp index 47b26354..a75bd507 100644 --- a/kite/src/Manipulator.cpp +++ b/kite/src/Manipulator.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -95,7 +95,7 @@ namespace Kite { if (not _segment) throw Error( "Manipulator::Manipulator(): cannot build upon a NULL TrackElement." ); - DebugSession::open( _segment->getNet(), 200 ); + DebugSession::open( _segment->getNet(), 150, 160 ); _data = _segment->getDataNegociate(); if (_data) _event = _data->getRoutingEvent(); @@ -143,7 +143,7 @@ namespace Kite { bool Manipulator::ripup ( unsigned int type, DbU::Unit axisHint ) { - ltrace(200) << "Manipulator::ripup() " << endl; + cdebug.log(159) << "Manipulator::ripup() " << endl; if (not canRipup()) return false; @@ -157,7 +157,7 @@ namespace Kite { bool Manipulator::ripupPerpandiculars ( unsigned int flags ) { - ltrace(200) << "Manipulator::ripupPerpandiculars() - " << flags << endl; + cdebug.log(159) << "Manipulator::ripupPerpandiculars() - " << flags << endl; bool success = true; bool cagedPerpandiculars = false; @@ -177,7 +177,7 @@ namespace Kite { parallelActionFlags |= SegmentAction::ToRipupLimit; } - ltrace(200) << "Pure constraints: " << constraints << endl; + cdebug.log(159) << "Pure constraints: " << constraints << endl; Track* track = NULL; const vector& perpandiculars = _event->getPerpandiculars(); @@ -202,7 +202,7 @@ namespace Kite { // Try to ripup the perpandicular. DataNegociate* data2 = perpandiculars[i]->getDataNegociate(); - ltrace(200) << "| " << perpandiculars[i] << endl; + cdebug.log(159) << "| " << perpandiculars[i] << endl; if ( (flags & Manipulator::ToMoveUp) and (data2->getState() < DataNegociate::MoveUp) ) data2->setState( DataNegociate::MoveUp ); @@ -229,23 +229,23 @@ namespace Kite { // Try to ripup conflicting neighbor. if (Manipulator(other,_fsm).canRipup()) { - ltrace(200) << " | Ripup: " << begin << " " << other << endl; + cdebug.log(159) << " | Ripup: " << begin << " " << other << endl; _fsm.addAction( other, SegmentAction::OtherRipup ); } else { - ltrace(200) << "Aborted ripup of perpandiculars, fixed or blocked." << endl; + cdebug.log(159) << "Aborted ripup of perpandiculars, fixed or blocked." << endl; return false; } } } if (cagedPerpandiculars and not placedPerpandiculars) { - ltrace(200) << "Aborted ripup of perpandiculars, constraints are due to fixed/blockage." << endl; + cdebug.log(159) << "Aborted ripup of perpandiculars, constraints are due to fixed/blockage." << endl; _fsm.addAction( _segment, SegmentAction::SelfRipup ); return true; } if (_segment->isLocal() and not placedPerpandiculars) { - ltrace(200) << "No placed perpandiculars, tight native constraints, place perpandiculars FIRST." << endl; + cdebug.log(159) << "No placed perpandiculars, tight native constraints, place perpandiculars FIRST." << endl; for ( size_t i=0 ; i < perpandiculars.size() ; i++ ) { _fsm.addAction( perpandiculars[i], perpandicularActionFlags|SegmentAction::EventLevel4 ); } @@ -272,7 +272,7 @@ namespace Kite { bool Manipulator::relax ( Interval interval, unsigned int flags ) { interval.inflate( - Session::getExtensionCap(getLayer()) ); - ltrace(200) << "Manipulator::relax() of: " << _segment << " " << interval << endl; + cdebug.log(159) << "Manipulator::relax() of: " << _segment << " " << interval << endl; if (_segment->isFixed()) return false; if (not interval.intersect(_segment->getCanonicalInterval())) return false; @@ -284,10 +284,10 @@ namespace Kite { if (interval.contains(_segment->base()->getAutoTarget()->getX())) return false; } - ltracein(200); + cdebug.tabw(159,1); bool success = true; bool expand = _segment->isGlobal() and (flags&AllowExpand); - ltrace(200) << "Expand:" << expand << endl; + cdebug.log(159) << "Expand:" << expand << endl; Katabatic::GCellVector gcells; _segment->getGCells( gcells ); @@ -297,7 +297,7 @@ namespace Kite { , getString(_segment).c_str() , getString(gcells[0]).c_str() ) << endl; - ltraceout(200); + cdebug.tabw(159,-1); return false; } @@ -311,15 +311,15 @@ namespace Kite { // Look for closest enclosing min & max GCells indexes. for ( igcell=0 ; igcellgetSide(_segment->getDirection()); - ltrace(200) << "| " << setw(3) << igcell << " " << gcells[igcell] << " uside: " << uside << endl; + cdebug.log(159) << "| " << setw(3) << igcell << " " << gcells[igcell] << " uside: " << uside << endl; if (uside.contains(interval.getVMin())) { iminconflict = igcell; - ltrace(200) << "> Min conflict: " << iminconflict << endl; + cdebug.log(159) << "> Min conflict: " << iminconflict << endl; } if (uside.contains(interval.getVMax())) { imaxconflict = igcell; - ltrace(200) << "> Max conflict: " << imaxconflict << endl; + cdebug.log(159) << "> Max conflict: " << imaxconflict << endl; } } @@ -329,13 +329,13 @@ namespace Kite { bool maxExpanded = false; if (expand) { if (iminconflict < gcells.size()) { - //ltrace(200) << "Expand min" << endl; + //cdebug.log(159) << "Expand min" << endl; size_t imindensity = 0; for ( size_t iexpand=1 ; iexpandcanDogleg(gcells[iexpand],KtAllowDoglegReuse)) continue; - // ltrace(200) << " Density " + // cdebug.log(159) << " Density " // << "Density " << Session::getRoutingGauge()->getRoutingLayer(depth)->getName() // << " min. dens.:" << gcells[imindensity]->getDensity(depth) // << " exp. dens.:" << gcells[iexpand ]->getDensity(depth) @@ -343,7 +343,7 @@ namespace Kite { if (gcells[imindensity]->getDensity(depth) - gcells[iexpand]->getDensity(depth) > 1e-3) { imindensity = iexpand; - //ltrace(200) << "Accepted expand " << imindensity << endl; + //cdebug.log(159) << "Accepted expand " << imindensity << endl; } } @@ -352,13 +352,13 @@ namespace Kite { } if (imaxconflict < gcells.size()) { - //ltrace(200) << "Expand max" << endl; + //cdebug.log(159) << "Expand max" << endl; size_t imindensity = imaxconflict; for ( size_t iexpand=imaxconflict+1 ; iexpandcanDogleg(gcells[iexpand],KtAllowDoglegReuse)) continue; - // ltrace(200) << " Density " + // cdebug.log(159) << " Density " // << Session::getRoutingGauge()->getRoutingLayer(depth)->getName() // << " min. dens.:" << gcells[imindensity]->getDensity(depth) // << " exp. dens.:" << gcells[iexpand ]->getDensity(depth) @@ -366,7 +366,7 @@ namespace Kite { if (gcells[imindensity]->getDensity(depth) - gcells[iexpand]->getDensity(depth) > 1e-3) { imindensity = iexpand; - //ltrace(200) << "Accepted expand " << imindensity << endl; + //cdebug.log(159) << "Accepted expand " << imindensity << endl; } } @@ -374,14 +374,14 @@ namespace Kite { imaxconflict = (imindensity < gcells.size()) ? imindensity : gcells.size(); } } - ltrace(200) << "minExpanded:" << minExpanded << " (" << iminconflict + cdebug.log(159) << "minExpanded:" << minExpanded << " (" << iminconflict << ") maxExpanded:" << maxExpanded << " (" << imaxconflict << ")" << endl; // Check for full enclosure. if ( ( (iminconflict == gcells.size()) and (imaxconflict == gcells.size() ) ) or ( (iminconflict == 0) and (imaxconflict == gcells.size()-1) )) { cinfo << "[INFO] Manipulator::relax(): Segment fully enclosed in interval." << endl; - ltraceout(200); + cdebug.tabw(159,-1); return false; } @@ -412,47 +412,47 @@ namespace Kite { case 0: cerr << Bug( "Manipulator::relax() Can't find a GCell suitable for making dogleg." , getString(interval).c_str() ) << endl; - ltraceout(200); + cdebug.tabw(159,-1); return false; } - ltrace(200) << "| Has to do " << dogLegCount << " doglegs." << endl; + cdebug.log(159) << "| Has to do " << dogLegCount << " doglegs." << endl; // Check of "min is less than one track close the edge" (while not expanded). // AND we are on the first GCell AND there's one dogleg only. if (not minExpanded and (iminconflict == 0) and (imaxconflict == gcells.size())) { - ltrace(200) << "Cannot break in first GCell only." << endl; - ltraceout(200); + cdebug.log(159) << "Cannot break in first GCell only." << endl; + cdebug.tabw(159,-1); return false; } // Check of "min is less than one track close the edge" (while not expanded). if ( /*not minExpanded and*/ (iminconflict > 0) and (iminconflict < gcells.size()) ) { uside = gcells[iminconflict-1]->getSide(_segment->getDirection()); - ltrace(200) << "GCell Edge Comparison (min): " << uside + cdebug.log(159) << "GCell Edge Comparison (min): " << uside << " vs. " << DbU::getValueString(interval.getVMin()) << endl; // Ugly: One lambda shrink. if (interval.getVMin()-DbU::lambda(1.0) <= uside.getVMax()) { - ltrace(200) << "Using previous GCell." << endl; + cdebug.log(159) << "Using previous GCell." << endl; iminconflict--; } } // Check if there is only one dogleg AND it's the last one. if (not maxExpanded and (iminconflict == gcells.size()) and (imaxconflict == gcells.size()-1)) { - ltrace(200) << "Cannot break in last GCell only." << endl; - ltraceout(200); + cdebug.log(159) << "Cannot break in last GCell only." << endl; + cdebug.tabw(159,-1); return false; } // Check of "max is less than one track close the edge" (while not expanded). if ((imaxconflict < gcells.size()-1)) { uside = gcells[imaxconflict+1]->getSide( _segment->getDirection() ); - ltrace(200) << "GCell Edge Comparison (max): " << uside + cdebug.log(159) << "GCell Edge Comparison (max): " << uside << " vs. " << DbU::getValueString(interval.getVMax()) << endl; if (interval.getVMax()+getPPitch() >= uside.getVMin()) { interval.inflate( 0, getPPitch() ); - ltrace(200) << "Using next GCell " << interval << endl; + cdebug.log(159) << "Using next GCell " << interval << endl; imaxconflict++; } } @@ -467,7 +467,7 @@ namespace Kite { } // Making first dogleg. - ltrace(200) << "Making FIRST dogleg at " << ifirstDogleg << endl; + cdebug.log(159) << "Making FIRST dogleg at " << ifirstDogleg << endl; TrackElement* segment1 = NULL; TrackElement* segment2 = NULL; Track* track = _segment->getTrack(); @@ -481,14 +481,14 @@ namespace Kite { if (ifirstDogleg == 0) dogleg = _segment->getSourceDogleg(); if (ifirstDogleg == gcells.size()-1) dogleg = _segment->getTargetDogleg(); if (dogleg) { - ltrace(200) << "Reusing dogleg." << endl; + cdebug.log(159) << "Reusing dogleg." << endl; doglegReuse1 = true; segment1 = _segment; } else { // Try to create a new dogleg. if (not _segment->canDogleg(dogLegGCell)) { - ltrace(200) << "Cannot create FIRST dogleg." << endl; - ltraceout(200); + cdebug.log(159) << "Cannot create FIRST dogleg." << endl; + cdebug.tabw(159,-1); return false; } _segment->makeDogleg( dogLegGCell, dogleg, segment1 ); @@ -497,18 +497,18 @@ namespace Kite { if (firstDoglegIsMin) { if (minExpanded) { doglegAxis = dogLegGCell->getSide( _segment->getDirection() ).getCenter(); - //ltrace(200) << "MARK 1 doglegAxis: " << DbU::getValueString(doglegAxis) << endl; + //cdebug.log(159) << "MARK 1 doglegAxis: " << DbU::getValueString(doglegAxis) << endl; } else { doglegAxis = interval.getVMin() - getPPitch(); - //ltrace(200) << "MARK 2 doglegAxis: " << DbU::getValueString(doglegAxis) << endl; + //cdebug.log(159) << "MARK 2 doglegAxis: " << DbU::getValueString(doglegAxis) << endl; } } else { if (maxExpanded) { doglegAxis = dogLegGCell->getSide( _segment->getDirection() ).getVMin(); - //ltrace(200) << "MARK 3 doglegAxis: " << DbU::getValueString(doglegAxis) << endl; + //cdebug.log(159) << "MARK 3 doglegAxis: " << DbU::getValueString(doglegAxis) << endl; } else { doglegAxis = interval.getVMax() + getPPitch() - DbU::fromLambda(1.0); - //ltrace(200) << "MARK 4 doglegAxis: " << DbU::getValueString(doglegAxis) << endl; + //cdebug.log(159) << "MARK 4 doglegAxis: " << DbU::getValueString(doglegAxis) << endl; } } if (doglegReuse1) _fsm.addAction( dogleg, SegmentAction::OtherRipup ); @@ -517,35 +517,35 @@ namespace Kite { // If event is present, the dogleg is in the current RoutingSet. RoutingEvent* event = dogleg->getDataNegociate()->getRoutingEvent(); if (event) { - ltrace(200) << "Set Axis Hint: @" << DbU::getValueString(doglegAxis) << " " << dogleg << endl; + cdebug.log(159) << "Set Axis Hint: @" << DbU::getValueString(doglegAxis) << " " << dogleg << endl; event->setAxisHint( doglegAxis ); } else { - ltrace(200) << "Dogleg has no RoutingEvent yet." << endl; + cdebug.log(159) << "Dogleg has no RoutingEvent yet." << endl; } // Making second dogleg. if (dogLegCount > 1) { - ltrace(200) << "Making SECOND dogleg at " << isecondDogleg + cdebug.log(159) << "Making SECOND dogleg at " << isecondDogleg << " on " << segment1 << endl; dogleg = NULL; dogLegGCell = gcells[isecondDogleg]; if (ifirstDogleg == isecondDogleg) { - ltrace(200) << "Double break in same GCell." << endl; + cdebug.log(159) << "Double break in same GCell." << endl; segment1->setFlags( TElemSourceDogleg ); } if (isecondDogleg == gcells.size()-1) dogleg = segment1->getTargetDogleg(); if (dogleg) { - ltrace(200) << "Reusing dogleg." << endl; + cdebug.log(159) << "Reusing dogleg." << endl; doglegReuse2 = true; segment2 = segment1; } else { // Try to create a new dogleg. if (not segment1->canDogleg(dogLegGCell)) { - ltrace(200) << "Cannot create SECOND dogleg." << endl; - ltraceout(200); + cdebug.log(159) << "Cannot create SECOND dogleg." << endl; + cdebug.tabw(159,-1); return false; } segment1->makeDogleg( dogLegGCell, dogleg, segment2 ); @@ -562,10 +562,10 @@ namespace Kite { // If event is present, the dogleg is in the current RoutingSet. RoutingEvent* event = dogleg->getDataNegociate()->getRoutingEvent(); if (event) { - ltrace(200) << "Set Axis Hint: @" << DbU::getValueString(doglegAxis) << " " << dogleg << endl; + cdebug.log(159) << "Set Axis Hint: @" << DbU::getValueString(doglegAxis) << " " << dogleg << endl; event->setAxisHint( doglegAxis ); } else { - ltrace(200) << "Dogleg has no RoutingEvent yet." << endl; + cdebug.log(159) << "Dogleg has no RoutingEvent yet." << endl; } // This cases seems never to occurs. @@ -573,7 +573,7 @@ namespace Kite { for ( size_t i=0 ; igetTrack() and track) { - ltrace(200) << "Direct Track insert of: " << segment << endl; + cdebug.log(159) << "Direct Track insert of: " << segment << endl; Session::addInsertEvent( segment, track ); } } @@ -599,23 +599,23 @@ namespace Kite { } if (_segment->isLocal()) { - ltrace(200) << "Reset state of: " << _segment << endl; + cdebug.log(159) << "Reset state of: " << _segment << endl; _segment->getDataNegociate()->setState( DataNegociate::RipupPerpandiculars, true ); } else { - ltrace(200) << "No state reset: " << _segment << endl; + cdebug.log(159) << "No state reset: " << _segment << endl; } if ((not doglegReuse1) and segment1 and segment1->isLocal()) { - ltrace(200) << "Reset state of: " << segment1 << endl; + cdebug.log(159) << "Reset state of: " << segment1 << endl; segment1->getDataNegociate()->setState( DataNegociate::RipupPerpandiculars, true ); } if ((not doglegReuse2) and segment2 and segment2->isLocal()) { - ltrace(200) << "Reset state of: " << segment2 << endl; + cdebug.log(159) << "Reset state of: " << segment2 << endl; segment2->getDataNegociate()->setState( DataNegociate::RipupPerpandiculars, true ); } - ltraceout(200); + cdebug.tabw(159,-1); return success; } @@ -635,37 +635,37 @@ namespace Kite { bool rightIntrication = false; bool success = true; - ltrace(200) << "Manipulator::insertInTrack() - " << toFree << endl; + cdebug.log(159) << "Manipulator::insertInTrack() - " << toFree << endl; for ( size_t i = begin ; success && (i < end) ; i++ ) { TrackElement* segment2 = track->getSegment(i); - ltrace(200) << "* Looking // " << segment2 << endl; + cdebug.log(159) << "* Looking // " << segment2 << endl; if ( segment2->getNet() == ownerNet ) continue; if ( not toFree.intersect(segment2->getCanonicalInterval()) ) { - ltrace(200) << "No intersection with: " << segment2->getCanonicalInterval() << endl; + cdebug.log(159) << "No intersection with: " << segment2->getCanonicalInterval() << endl; continue; } if ( segment2->isBlockage() or segment2->isFixed() ) { - ltrace(200) << "Ovelap is blockage or fixed." << endl; + cdebug.log(159) << "Ovelap is blockage or fixed." << endl; success = false; continue; } // if ( segment2->getId() >= maxId ) { - // ltrace(200) << "Ovelap has an Id superior to AutoSegment::maxId:" << maxId << "." << endl; + // cdebug.log(159) << "Ovelap has an Id superior to AutoSegment::maxId:" << maxId << "." << endl; // continue; // } // ripupNet = segment2->getNet(); DataNegociate* data2 = segment2->getDataNegociate(); if ( !data2 ) { - ltrace(200) << "No DataNegociate, ignoring." << endl; + cdebug.log(159) << "No DataNegociate, ignoring." << endl; continue; } if ( data2->getState() == DataNegociate::MaximumSlack ) { - ltrace(200) << "At " << DataNegociate::getStateString(data2) + cdebug.log(159) << "At " << DataNegociate::getStateString(data2) << " for " << segment2 << endl; success = false; continue; @@ -675,7 +675,7 @@ namespace Kite { bool shrinkRight = false; if ( data2->getRightMinExtend() < toFree.getVMin() ) { - ltrace(200) << "- Shrink right edge (push left) " << segment2 << endl; + cdebug.log(159) << "- Shrink right edge (push left) " << segment2 << endl; shrinkRight = true; TrackElement* rightNeighbor2 = track->getSegment(i+1); if ( rightNeighbor2 && (rightNeighbor2->getNet() == segment2->getNet()) ) { @@ -688,7 +688,7 @@ namespace Kite { } if ( data2->getLeftMinExtend() > toFree.getVMax() ) { - ltrace(200) << "- Shrink left edge (push right) " << segment2 << endl; + cdebug.log(159) << "- Shrink left edge (push right) " << segment2 << endl; shrinkLeft = true; if ( i > 0 ) { TrackElement* leftNeighbor2 = track->getSegment(i-1); @@ -710,7 +710,7 @@ namespace Kite { } } - ltrace(200) << "- Hard overlap/enclosure/shrink " << segment2 << endl; + cdebug.log(159) << "- Hard overlap/enclosure/shrink " << segment2 << endl; if ( _segment->isStrap() and segment2->isGlobal() ) continue; if ( not (success = Manipulator(segment2,_fsm).ripup(SegmentAction::OtherRipup)) ) continue; @@ -725,11 +725,11 @@ namespace Kite { if ( not event3 ) continue; if ( not toFree.intersect(event3->getConstraints()) ) { - ltrace(200) << " . " << segment3 << endl; + cdebug.log(159) << " . " << segment3 << endl; continue; } - ltrace(200) << " | " << segment3 << endl; + cdebug.log(159) << " | " << segment3 << endl; if ( shrinkRight xor shrinkLeft ) { if ( shrinkRight ) { @@ -740,7 +740,7 @@ namespace Kite { break; if ( event3->getTracksFree() == 1 ) { - ltrace(200) << "Potential left intrication with other perpandicular." << endl; + cdebug.log(159) << "Potential left intrication with other perpandicular." << endl; if ( segment3->getAxis() == segment2->getTargetU() - Session::getExtensionCap(getLayer()) ) { leftIntrication = true; leftAxisHint = segment3->getAxis(); @@ -754,7 +754,7 @@ namespace Kite { )) ) break; if ( event3->getTracksFree() == 1 ) { - ltrace(200) << "Potential right intrication with other perpandicular." << endl; + cdebug.log(159) << "Potential right intrication with other perpandicular." << endl; if ( segment3->getAxis() == segment2->getSourceU() + Session::getExtensionCap(getLayer()) ) { rightIntrication = true; rightAxisHint = segment3->getAxis(); @@ -772,7 +772,7 @@ namespace Kite { } if ( success ) { - ltrace(200) << "Manipulator::insertInTrack() success" << endl; + cdebug.log(159) << "Manipulator::insertInTrack() success" << endl; _fsm.setState ( SegmentFsm::OtherRipup ); _fsm.addAction ( _segment @@ -802,12 +802,12 @@ namespace Kite { set canonicals; bool success = true; - ltrace(200) << "Manipulator::forceToTrack() - " << toFree << endl; + cdebug.log(159) << "Manipulator::forceToTrack() - " << toFree << endl; for ( size_t i=begin ; success and (i < end) ; ++i ) { TrackElement* segment2 = track->getSegment(i); - ltrace(200) << "* Looking // " << segment2 << endl; + cdebug.log(159) << "* Looking // " << segment2 << endl; if (segment2->getNet() == ownerNet) continue; if (not toFree.intersect(segment2->getCanonicalInterval())) continue; @@ -819,11 +819,11 @@ namespace Kite { DataNegociate* data2 = segment2->getDataNegociate(); if (not data2 ) { - ltrace(200) << "No DataNegociate, ignoring." << endl; + cdebug.log(159) << "No DataNegociate, ignoring." << endl; continue; } - ltrace(200) << "- Forced ripup " << segment2 << endl; + cdebug.log(159) << "- Forced ripup " << segment2 << endl; if (not (success=Manipulator(segment2,_fsm).ripup(SegmentAction::OtherRipup))) continue; @@ -864,17 +864,17 @@ namespace Kite { DbU::Unit leftExtend = _segment->getSourceU() + Session::getExtensionCap(getLayer()); DbU::Unit rightExtend = _segment->getSourceU() - Session::getExtensionCap(getLayer()); - ltrace(200) << "Manipulator::shrinkToTrack()" << endl; + cdebug.log(159) << "Manipulator::shrinkToTrack()" << endl; if (_segment->isLocal()) return false; Interval shrunkFree = _segment->base()->getMinSpanU(); - ltrace(200) << "* " << shrunkFree << endl; + cdebug.log(159) << "* " << shrunkFree << endl; for ( size_t i = begin ; success and (i < end) ; ++i ) { TrackElement* segment2 = track->getSegment(i); - ltrace(200) << "* Looking // " << segment2 << endl; + cdebug.log(159) << "* Looking // " << segment2 << endl; if (segment2->getNet() == ownerNet) continue; if (segment2->isFixed()) { success = false; continue; } @@ -895,7 +895,7 @@ namespace Kite { for ( iperpand = perpandiculars.begin() ; iperpand != perpandiculars.end() ; ++iperpand ) { DataNegociate* data2 = (*iperpand)->getDataNegociate(); if (data2) { - ltrace(200) << "| perpandicular bound:" << *iperpand << endl; + cdebug.log(159) << "| perpandicular bound:" << *iperpand << endl; success = Manipulator(*iperpand,_fsm).ripup( SegmentAction::SelfRipupPerpandWithAxisHint ); if (success) { if ((*iperpand)->getAxis() == leftExtend ) axisHint = leftAxisHint; @@ -913,7 +913,7 @@ namespace Kite { _fsm.addAction( _segment, SegmentAction::SelfInsert ); _fsm.setState ( SegmentFsm::OtherRipup ); - ltrace(200) << "Successful shrinkToTrack." << endl; + cdebug.log(159) << "Successful shrinkToTrack." << endl; return true; } #endif @@ -924,13 +924,12 @@ namespace Kite { bool Manipulator::forceOverLocals () { - ltrace(200) << "Manipulator::forceOverLocals()" << endl; - ltracein(200); + cdebug.log(159,1) << "Manipulator::forceOverLocals()" << endl; vector& costs = _fsm.getCosts(); size_t itrack = 0; for ( ; itrackgetSegment(i); - ltrace(200) << "* Looking // " << segment2 << endl; + cdebug.log(159) << "* Looking // " << segment2 << endl; if ( segment2->getNet() == ownerNet ) continue; if ( not toFree.intersect(segment2->getCanonicalInterval()) ) continue; @@ -959,12 +958,12 @@ namespace Kite { DataNegociate* data2 = segment2->getDataNegociate(); if ( not data2 ) { - ltrace(200) << "No DataNegociate, ignoring." << endl; + cdebug.log(159) << "No DataNegociate, ignoring." << endl; success = false; continue; } - ltrace(200) << "- Forced ripup " << segment2 << endl; + cdebug.log(159) << "- Forced ripup " << segment2 << endl; if ( not (success=Manipulator(segment2,_fsm).ripup(SegmentAction::OtherRipup)) ) { continue; } @@ -980,14 +979,14 @@ namespace Kite { } } - ltraceout(200); + cdebug.tabw(159,-1); return (itrack < costs.size()); } bool Manipulator::slacken ( unsigned int flags ) { - ltrace(200) << "Manipulator::slacken() " << _segment << endl; + cdebug.log(159) << "Manipulator::slacken() " << _segment << endl; if ( _segment->isFixed ()) return false; if (not _segment->canSlacken()) return false; @@ -998,7 +997,7 @@ namespace Kite { bool Manipulator::ripple () { - ltrace(200) << "Manipulator::ripple() from " << _segment << endl; + cdebug.log(159) << "Manipulator::ripple() from " << _segment << endl; //if (not _segment->canRipple()) return false; if (not _segment->isLocal()) return false; @@ -1007,7 +1006,7 @@ namespace Kite { Interval uside = _segment->base()->getAutoSource()->getGCell()->getSide ( Katabatic::perpandicularTo(_segment->getDirection())/*, false*/ ); RoutingPlane* plane = Session::getKiteEngine()->getRoutingPlaneByLayer(_segment->getLayer()); - ltracein(200); + cdebug.tabw(159,1); for( Track* track : Tracks_Range::get(plane,uside)) { size_t begin; size_t end; @@ -1015,7 +1014,7 @@ namespace Kite { track->getOverlapBounds( _segment->getCanonicalInterval(), begin, end ); for ( ; begin < end ; begin++ ) { TrackElement* other = track->getSegment(begin); - ltrace(200) << "| " << other << endl; + cdebug.log(159) << "| " << other << endl; if (other->getNet() == net) continue; if (not other->canRipple()) continue; @@ -1042,7 +1041,7 @@ namespace Kite { _fsm.addAction( other, SegmentAction::OtherRipup ); } } - ltraceout(200); + cdebug.tabw(159,-1); return true; } @@ -1050,7 +1049,7 @@ namespace Kite { bool Manipulator::pivotUp () { - ltrace(200) << "Manipulator::pivotUp() " << _segment << endl; + cdebug.log(159) << "Manipulator::pivotUp() " << _segment << endl; return false; if (_segment->isFixed()) return false; @@ -1065,7 +1064,7 @@ namespace Kite { bool Manipulator::pivotDown () { - ltrace(200) << "Manipulator::pivotDown() " << _segment << endl; + cdebug.log(159) << "Manipulator::pivotDown() " << _segment << endl; return false; if ( _segment->isFixed () ) return false; @@ -1078,7 +1077,7 @@ namespace Kite { bool Manipulator::moveUp ( unsigned int flags ) { - ltrace(200) << "Manipulator::moveUp() " << _segment << endl; + cdebug.log(159) << "Manipulator::moveUp() " << _segment << endl; unsigned int kflags = Katabatic::KbWithNeighbors; //kflags |= (flags & AllowLocalMoveUp ) ? Katabatic::AutoSegment::AllowLocal : 0; @@ -1104,7 +1103,7 @@ namespace Kite { bool Manipulator::makeDogleg () { - ltrace(200) << "Manipulator::makeDogleg() " << _segment << endl; + cdebug.log(159) << "Manipulator::makeDogleg() " << _segment << endl; if ( _segment->isFixed()) return false; if (not _segment->isLocal()) return false; @@ -1121,7 +1120,7 @@ namespace Kite { for ( size_t i=begin ; igetSegment(i); - ltrace(200) << "* Looking // " << segment2 << endl; + cdebug.log(159) << "* Looking // " << segment2 << endl; if ( segment2->getNet() == ownerNet) continue; if (not toFree.intersect(segment2->getCanonicalInterval())) continue; @@ -1144,8 +1143,8 @@ namespace Kite { bool Manipulator::makeDogleg ( Interval overlap ) { - ltrace(200) << "Manipulator::makeDogleg(Interval) " << _segment << endl; - ltrace(200) << overlap << endl; + cdebug.log(159) << "Manipulator::makeDogleg(Interval) " << _segment << endl; + cdebug.log(159) << overlap << endl; if ( _segment->isFixed () ) return false; if (not _segment->canDogleg(overlap)) return false; @@ -1153,7 +1152,7 @@ namespace Kite { unsigned int flags = 0; TrackElement* dogleg = _segment->makeDogleg(overlap,flags); if (dogleg) { - ltrace(200) << "Manipulator::makeDogleg(Interval) - Push dogleg to the " + cdebug.log(159) << "Manipulator::makeDogleg(Interval) - Push dogleg to the " << ((flags&Katabatic::KbDoglegOnLeft)?"left":"right") << endl; if (_segment->isTerminal()) { Katabatic::AutoContact* contact = @@ -1164,7 +1163,7 @@ namespace Kite { if (event) { event->setAxisHint ( axisHint ); event->setForcedToHint( true ); - ltrace(200) << "Forced to axis hint @" << DbU::getValueString(axisHint) << endl; + cdebug.log(159) << "Forced to axis hint @" << DbU::getValueString(axisHint) << endl; } } return true; @@ -1176,8 +1175,8 @@ namespace Kite { bool Manipulator::makeDogleg ( DbU::Unit position ) { - ltrace(200) << "Manipulator::makeDogleg(position) " << _segment << endl; - ltrace(200) << "Breaking position: " << DbU::getValueString(position) << endl; + cdebug.log(159) << "Manipulator::makeDogleg(position) " << _segment << endl; + cdebug.log(159) << "Breaking position: " << DbU::getValueString(position) << endl; if (_segment->isFixed()) return false; @@ -1201,7 +1200,7 @@ namespace Kite { bool Manipulator::minimize () { - ltrace(200) << "Manipulator::minimize() " << _segment << endl; + cdebug.log(159) << "Manipulator::minimize() " << _segment << endl; if (_segment->isFixed()) return false; if (not _event->canMinimize()) return false; @@ -1211,10 +1210,10 @@ namespace Kite { Interval punctualSpan ( false ); if (_segment->base()->getAutoSource()->getAnchor()) { - ltrace(200) << " | " << _segment->base()->getAutoSource() << endl; + cdebug.log(159) << " | " << _segment->base()->getAutoSource() << endl; Interval constraints ( _segment->base()->getAutoSource()->getUConstraints (perpandicularTo(_segment->getDirection())) ); - ltrace(200) << " | Constraints: " << constraints << endl; + cdebug.log(159) << " | Constraints: " << constraints << endl; minSpan = min( minSpan, constraints.getVMax() ); maxSpan = max( maxSpan, constraints.getVMin() ); @@ -1222,10 +1221,10 @@ namespace Kite { } if (_segment->base()->getAutoTarget()->getAnchor()) { - ltrace(200) << " | " << _segment->base()->getAutoTarget() << endl; + cdebug.log(159) << " | " << _segment->base()->getAutoTarget() << endl; Interval constraints ( _segment->base()->getAutoTarget()->getUConstraints (perpandicularTo(_segment->getDirection())) ); - ltrace(200) << " | Constraints: " << constraints << endl; + cdebug.log(159) << " | Constraints: " << constraints << endl; minSpan = min( minSpan, constraints.getVMax() ); maxSpan = max( maxSpan, constraints.getVMin() ); @@ -1237,12 +1236,12 @@ namespace Kite { DataNegociate* data2 = perpandiculars[i]->getDataNegociate(); if (not data2) continue; - ltrace(200) << " | " << perpandiculars[i] << endl; + cdebug.log(159) << " | " << perpandiculars[i] << endl; RoutingEvent* event2 = data2->getRoutingEvent(); if (not event2) continue; - ltrace(200) << " | Constraints: " << event2->getConstraints() << endl; + cdebug.log(159) << " | Constraints: " << event2->getConstraints() << endl; minSpan = min( minSpan, event2->getConstraints().getVMax() ); maxSpan = max( maxSpan, event2->getConstraints().getVMin() ); @@ -1250,7 +1249,7 @@ namespace Kite { } if (minSpan > maxSpan) swap( minSpan, maxSpan ); - ltrace(200) << "punctualSpan: " << punctualSpan + cdebug.log(159) << "punctualSpan: " << punctualSpan << " min/max span: [" << DbU::getValueString(minSpan) << ":" << DbU::getValueString(maxSpan) << "]" << " long: [" << minSpan @@ -1264,7 +1263,7 @@ namespace Kite { if (end < track->getSize()) end++; - ltrace(200) << "Looking for holes in " << _fsm.getCost(itrack) << endl; + cdebug.log(159) << "Looking for holes in " << _fsm.getCost(itrack) << endl; TrackElement* otherPrevious = NULL; // ToDo: Manage disjoint but subsequent segment of a Net. @@ -1275,13 +1274,13 @@ namespace Kite { if (not otherPrevious) { holes.push_back( Interval(track->getMin() ,otherSegment->getSourceU()) ); - ltrace(200) << "| First hole: " << holes.back() << " " << otherSegment << endl; + cdebug.log(159) << "| First hole: " << holes.back() << " " << otherSegment << endl; } else { if (otherSegment->getNet() == otherPrevious->getNet()) continue; holes.push_back( Interval(otherPrevious->getTargetU() ,otherSegment ->getSourceU()) ); - ltrace(200) << "| Found hole: " << holes.back() + cdebug.log(159) << "| Found hole: " << holes.back() << " " << otherPrevious << " <-> " << " " << otherSegment << endl; } otherPrevious = otherSegment; @@ -1289,7 +1288,7 @@ namespace Kite { } if (holes.empty()) { - ltrace(200) << "No holes found to minimize into." << endl; + cdebug.log(159) << "No holes found to minimize into." << endl; return false; } @@ -1306,45 +1305,45 @@ namespace Kite { bool success = false; if (biggestHole.intersect(punctualSpan)) { - ltrace(200) << "Go as punctual into biggest hole: " << biggestHole << endl; + cdebug.log(159) << "Go as punctual into biggest hole: " << biggestHole << endl; axisHint = biggestHole.intersection(punctualSpan).getCenter(); success = true; } else { for ( size_t i=0 ; igetDataNegociate(); if (not data2) continue; - ltrace(200) << " | " << perpandiculars[i] << endl; + cdebug.log(159) << " | " << perpandiculars[i] << endl; RoutingEvent* event2 = data2->getRoutingEvent(); if (not event2) continue; @@ -1389,7 +1388,7 @@ namespace Kite { void Manipulator::repackPerpandiculars () { - ltrace(200) << "Manipulator::repackPerpandiculars()" << endl; + cdebug.log(159) << "Manipulator::repackPerpandiculars()" << endl; const vector& perpandiculars = _event->getPerpandiculars(); for ( size_t iperpand=0 ; iperpandgetCanonicalInterval(); if (not intersect.intersect(cost.getInterval())) return; if (segment->isBlockage() or segment->isFixed()) { - ltrace(200) << "Infinite cost from: " << segment << endl; + cdebug.log(159) << "Infinite cost from: " << segment << endl; cost.setInfinite (); cost.setOverlap (); cost.setHardOverlap(); @@ -83,7 +83,7 @@ namespace { if ( segment->isLocal() ) { cost.mergeDataState( data->getState() ); if (data->getState() >= DataNegociate::LocalVsGlobal) { - ltrace(200) << "MaximumSlack/LocalVsGlobal for " << segment << endl; + cdebug.log(159) << "MaximumSlack/LocalVsGlobal for " << segment << endl; } } @@ -101,13 +101,13 @@ namespace { cost.setOverlap(); if ( segment->isLocal() or (cost.isForGlobal() and (Session::getRoutingGauge()->getLayerDepth(segment->getLayer()) < 3)) ) { - ltrace(500) << "Deter| incTerminals() " << boolalpha << cost.isForGlobal() << " " << (data->getTerminals()*100) << endl; + cdebug.log(9000) << "Deter| incTerminals() " << boolalpha << cost.isForGlobal() << " " << (data->getTerminals()*100) << endl; cost.incTerminals( data->getTerminals()*100 ); } else { - ltrace(500) << "Deter| isForGlobal() " << boolalpha << cost.isForGlobal() << endl; + cdebug.log(9000) << "Deter| isForGlobal() " << boolalpha << cost.isForGlobal() << endl; } - ltrace(200) << "| Increment Delta: " << DbU::getValueString(intersect.getSize()) << endl; + cdebug.log(159) << "| Increment Delta: " << DbU::getValueString(intersect.getSize()) << endl; cost.incDelta( intersect.getSize() ); } @@ -147,9 +147,6 @@ namespace Kite { using Hurricane::Warning; using Hurricane::Bug; using Hurricane::tab; - using Hurricane::inltrace; - using Hurricane::ltracein; - using Hurricane::ltraceout; using Hurricane::ForEachIterator; using CRL::Histogram; using CRL::addMeasure; @@ -228,8 +225,7 @@ namespace Kite { TrackElement* NegociateWindow::createTrackSegment ( AutoSegment* autoSegment, unsigned int flags ) { - ltrace(200) << "NegociateWindow::createTrackSegment() - " << autoSegment << endl; - ltracein(159); + cdebug.log(159,1) << "NegociateWindow::createTrackSegment() - " << autoSegment << endl; // Special case: fixed AutoSegments must not interfere with blockages. // Ugly: uses of getExtensionCap(). @@ -248,25 +244,25 @@ namespace Kite { for ( ; (begin < end) ; begin++ ) { TrackElement* other = track->getSegment(begin); - ltrace(200) << "| overlap: " << other << endl; + cdebug.log(159) << "| overlap: " << other << endl; if (not other->isBlockage()) continue; other->getCanonical( blockageSpan ); blockageSpan.inflate( Session::getExtensionCap(autoSegment->getLayer()) ); - ltrace(200) << " fixed:" << fixedSpan << " vs. blockage:" << blockageSpan << endl; + cdebug.log(159) << " fixed:" << fixedSpan << " vs. blockage:" << blockageSpan << endl; if (not fixedSpan.intersect(blockageSpan)) continue; // Overlap between fixed & blockage. - ltrace(200) << "* Blockage overlap: " << autoSegment << endl; + cdebug.log(159) << "* Blockage overlap: " << autoSegment << endl; Session::destroyRequest( autoSegment ); cerr << Warning( "Overlap between fixed %s and blockage at %s." , getString(autoSegment).c_str() , getString(blockageSpan).c_str() ) << endl; - ltraceout(159); + cdebug.tabw(159,-1); return NULL; } } @@ -278,10 +274,10 @@ namespace Kite { TrackElement* trackSegment = TrackSegment::create( autoSegment, NULL, created ); if (not (flags & KtLoadingStage)) - ltrace(159) << "* lookup: " << autoSegment << endl; + cdebug.log(159) << "* lookup: " << autoSegment << endl; if (created) { - ltrace(159) << "* " << trackSegment << endl; + cdebug.log(159) << "* " << trackSegment << endl; RoutingPlane* plane = Session::getKiteEngine()->getRoutingPlaneByLayer(autoSegment->getLayer()); Track* track = plane->getTrackByPosition ( autoSegment->getAxis() ); @@ -290,9 +286,9 @@ namespace Kite { if (track->getAxis() > uside.getVMax()) track = track->getPreviousTrack(); if (track->getAxis() < uside.getVMin()) track = track->getNextTrack(); - ltrace(159) << "* GCell U-side " << uside << endl; - ltrace(159) << "* " << plane << endl; - ltrace(159) << "* " << track << endl; + cdebug.log(159) << "* GCell U-side " << uside << endl; + cdebug.log(159) << "* " << plane << endl; + cdebug.log(159) << "* " << track << endl; trackSegment->setAxis( track->getAxis(), Katabatic::SegAxisSet ); trackSegment->invalidate(); @@ -305,10 +301,10 @@ namespace Kite { } if (not created and not (flags & KtLoadingStage)) { - ltrace(200) << "TrackSegment already exists (and not in loading stage)." << endl; + cdebug.log(159) << "TrackSegment already exists (and not in loading stage)." << endl; } - ltraceout(159); + cdebug.tabw(159,-1); return trackSegment; } @@ -351,35 +347,85 @@ namespace Kite { void NegociateWindow::_createRouting ( Katabatic::GCell* gcell ) { - ltrace(200) << "NegociateWindow::_createRouting() - " << gcell << endl; - ltracein(200); + cdebug.log(159,1) << "NegociateWindow::_createRouting() - " << gcell << endl; Segment* segment; AutoSegment* autoSegment; - ltrace(149) << "AutoSegments from AutoContacts" << endl; + cdebug.log(159) << "AutoSegments from AutoContacts" << endl; const vector& contacts = gcell->getContacts(); for ( size_t i=0 ; igetSlaveComponents() ) { segment = dynamic_cast(component); autoSegment = Session::base()->lookup( segment ); - ltrace(149) << autoSegment << endl; + cdebug.log(159) << autoSegment << endl; if (autoSegment and autoSegment->isCanonical()) { createTrackSegment( autoSegment, KtLoadingStage ); } } } - ltrace(149) << "_segments.size():" << _segments.size() << endl; - ltraceout(200); + cdebug.log(159) << "_segments.size():" << _segments.size() << endl; + cdebug.tabw(159,-1); + } + + + void NegociateWindow::_pack ( size_t& count, bool last ) + { + unsigned long limit = _kite->getEventsLimit(); + unsigned int pushStage = RoutingEvent::getStage(); + RoutingEvent::setStage( RoutingEvent::Pack ); + + RoutingEventQueue packQueue; + //for ( size_t i = (count > 600) ? count-600 : 0 + // ; (i<_eventHistory.size()-(last ? 0 : 100)) and not isInterrupted() ; i++ ) { + for ( size_t i=0 ; i<_eventHistory.size() ; ++i ) { + RoutingEvent* event = _eventHistory.getNth(i); + + if ( event and not event->isCloned() ) { + cerr << "Cloned:" << event->isCloned() + << " UTurn:" << event->getSegment()->isUTurn() << " " << event->getSegment() << endl; + } + + if ( event and not event->isCloned() and event->getSegment()->isUTurn() ) { + event->reschedule( packQueue, 0 ); + } + } + packQueue.commit(); + + while ( not packQueue.empty() and not isInterrupted() ) { + RoutingEvent* event = packQueue.pop(); + + if (tty::enabled()) { + cmess2 << " " + << setfill(' ') << tty::reset << tty::cr; + cmess2.flush(); + } else { + cmess2 << " getEventLevel() << ":" << event->getPriority() << "> " + << event->getSegment() + << endl; + cmess2.flush(); + } + + event->process( packQueue, _eventHistory, _eventLoop ); + + if (RoutingEvent::getProcesseds() >= limit) setInterrupt( true ); + } + // Count will be wrong! + + RoutingEvent::setStage( pushStage ); } size_t NegociateWindow::_negociate () { - ltrace(500) << "Deter| NegociateWindow::_negociate()" << endl; - ltrace(150) << "NegociateWindow::_negociate() - " << _segments.size() << endl; - ltracein(149); + cdebug.log(9000) << "Deter| NegociateWindow::_negociate()" << endl; + cdebug.log(159,1) << "NegociateWindow::_negociate() - " << _segments.size() << endl; cmess1 << " o Negociation Stage." << endl; @@ -388,7 +434,7 @@ namespace Kite { _eventHistory.clear(); _eventQueue.load( _segments ); cmess2 << " " << endl; - if (inltrace(500)) _eventQueue.dump(); + if (cdebug.enabled(9000)) _eventQueue.dump(); size_t count = 0; RoutingEvent::setStage( RoutingEvent::Negociate ); @@ -412,16 +458,21 @@ namespace Kite { } event->process( _eventQueue, _eventHistory, _eventLoop ); - count++; + + //if (count and not (count % 500)) { + // _pack( count, false ); + //} + if (RoutingEvent::getProcesseds() >= limit) setInterrupt( true ); } + //_pack( count, true ); if (count and cmess2.enabled() and tty::enabled()) cmess1 << endl; - ltrace(500) << "Deter| Repair Stage" << endl; + cdebug.log(9000) << "Deter| Repair Stage" << endl; cmess1 << " o Repair Stage." << endl; - ltrace(200) << "Loadind Repair queue." << endl; + cdebug.log(159) << "Loadind Repair queue." << endl; RoutingEvent::setStage( RoutingEvent::Repair ); for ( size_t i=0 ; (i<_eventHistory.size()) and not isInterrupted() ; i++ ) { RoutingEvent* event = _eventHistory.getNth(i); @@ -473,7 +524,7 @@ namespace Kite { } _statistics.setEventsCount( eventsCount ); - ltraceout(149); + cdebug.tabw(159,-1); return eventsCount; } @@ -481,8 +532,7 @@ namespace Kite { void NegociateWindow::run ( unsigned int flags ) { - ltrace(150) << "NegociateWindow::run()" << endl; - ltracein(149); + cdebug.log(159,1) << "NegociateWindow::run()" << endl; cmess1 << " o Running Negociate Algorithm" << endl; @@ -514,13 +564,14 @@ namespace Kite { _kite->setFixedPreRouted(); } + Session::revalidate(); Session::get()->isEmpty(); # if defined(CHECK_DATABASE) _kite->_check( overlaps, "after negociation" ); # endif - ltraceout(149); + cdebug.tabw(159,-1); } diff --git a/kite/src/PreProcess.cpp b/kite/src/PreProcess.cpp index e367bc2e..36fec087 100644 --- a/kite/src/PreProcess.cpp +++ b/kite/src/PreProcess.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -51,7 +51,7 @@ namespace { TrackElement* perpandicular; for( Segment* osegment : segment->base()->getAutoSource()->getSlaveComponents().getSubSet() ) { perpandicular = Session::lookup ( osegment ); - ltrace(200) << "S " << perpandicular << endl; + cdebug.log(159) << "S " << perpandicular << endl; if ( not perpandicular or (perpandicular->getDirection() == direction) ) continue; @@ -60,7 +60,7 @@ namespace { for( Segment* osegment : segment->base()->getAutoTarget()->getSlaveComponents().getSubSet() ) { perpandicular = Session::lookup ( osegment ); - ltrace(200) << "T " << perpandicular << endl; + cdebug.log(159) << "T " << perpandicular << endl; if ( not perpandicular or (perpandicular->getDirection() == direction) ) continue; @@ -71,12 +71,12 @@ namespace { void findFailedPerpandiculars ( RoutingPad* rp, unsigned int direction, set& faileds ) { - ltrace(200) << "Find failed caging: " << rp << endl; + cdebug.log(159) << "Find failed caging: " << rp << endl; TrackElement* parallel; for( Segment* osegment : rp->getSlaveComponents().getSubSet() ) { parallel = Session::lookup ( osegment ); - ltrace(200) << "* " << parallel << endl; + cdebug.log(159) << "* " << parallel << endl; if ( parallel->isFixed () ) continue; if ( parallel->getDirection() != direction ) continue; @@ -97,7 +97,7 @@ namespace { { if (not segment->isFixed()) return; - ltrace(200) << "Propagate caging: " << segment << endl; + cdebug.log(159) << "Propagate caging: " << segment << endl; Track* track = segment->getTrack(); //unsigned int direction = Session::getRoutingGauge()->getLayerDirection(segment->getLayer()); @@ -124,7 +124,7 @@ namespace { if (parallel->getNet() == segment->getNet()) continue; if (not parallel->isFixed()) continue; - ltrace(200) << "Min Constraint from: " << parallel << endl; + cdebug.log(159) << "Min Constraint from: " << parallel << endl; minConstraint = max( minConstraint, parallel->getTargetU() ); } @@ -136,7 +136,7 @@ namespace { if (parallel->getNet() == segment->getNet()) continue; if (not parallel->isFixed()) continue; - ltrace(200) << "Max Constraint from: " << parallel << endl; + cdebug.log(159) << "Max Constraint from: " << parallel << endl; maxConstraint = min( maxConstraint, parallel->getSourceU() ); } @@ -145,7 +145,7 @@ namespace { return; } if ( (minConstraint <= uside.getVMin()) and (maxConstraint >= uside.getVMax()) ) { - ltrace(200) << "No constraints [" << DbU::getValueString(minConstraint) + cdebug.log(159) << "No constraints [" << DbU::getValueString(minConstraint) << ":" << DbU::getValueString(maxConstraint) << " vs. " << uside << endl; return; @@ -158,7 +158,7 @@ namespace { TrackElement* parallel; for( Segment* osegment : rp->getSlaveComponents().getSubSet() ) { parallel = Session::lookup( osegment ); - ltrace(200) << "* " << parallel << endl; + cdebug.log(159) << "* " << parallel << endl; if (parallel->isFixed ()) continue; if (parallel->isGlobal()) continue; @@ -173,32 +173,31 @@ namespace { } // Apply caging constraints to perpandiculars. - ltracein(200); + cdebug.tabw(159,1); if (perpandiculars.size() == 0) { - ltrace(200) << "No perpandiculars to " << segment << endl; - ltraceout(200); + cdebug.log(159) << "No perpandiculars to " << segment << endl; + cdebug.tabw(159,-1); return; } Interval constraints ( minConstraint, maxConstraint ); for ( size_t iperpand=0 ; iperpandbase()->mergeUserConstraints( constraints ); if (perpandiculars[iperpand]->base()->getUserConstraints().isEmpty()) { - ltrace(200) << "Cumulative caged constraints are too tight on " << perpandiculars[iperpand] << endl; + cdebug.log(159) << "Cumulative caged constraints are too tight on " << perpandiculars[iperpand] << endl; findFailedPerpandiculars( rp, direction, faileds ); } } - ltraceout(200); + cdebug.tabw(159,-1); } void moveUpCaged ( TrackElement* segment ) { - DebugSession::open( segment->getNet(), 150 ); - ltrace(150) << "::moveUpCaged() " << segment << endl; - ltracein(150); + DebugSession::open( segment->getNet(), 150, 160 ); + cdebug.log(159,1) << "::moveUpCaged() " << segment << endl; //Configuration* configuration = Session::getConfiguration(); //const Layer* metal2 = configuration->getRoutingLayer( 1 ); @@ -216,18 +215,17 @@ namespace { } } - ltraceout(150); + cdebug.tabw(159,-1); DebugSession::close(); } void protectCagedTerminals ( Track* track ) { - ltrace(150) << "protectCagedTerminals() " << track << endl; - ltracein(150); + cdebug.log(159,1) << "protectCagedTerminals() " << track << endl; - DbU::Unit lastMovedUp = track->getMin(); - unsigned int moveUpCount = 0; + DbU::Unit lastMovedUp = track->getMin(); + unsigned int moveUpCount = 0; Configuration* configuration = Session::getConfiguration(); const Layer* metal2 = configuration->getRoutingLayer( 1 ); @@ -236,7 +234,7 @@ namespace { RoutingPlane* metal3plane = track->getRoutingPlane()->getTop(); if (track->getLayer() != metal2) { - ltraceout(150); + cdebug.tabw(159,-1); return; } @@ -258,9 +256,22 @@ namespace { continue; } - Katabatic::AutoContact* support = segment->base()->getAutoSource(); - RoutingPad* rp = dynamic_cast(support->getAnchor()); - Track* metal3track = metal3plane->getTrackByPosition( rp->getSourcePosition().getX() ); + Katabatic::AutoContact* support = NULL; + Katabatic::AutoContact* turn = NULL; + if (segment->base()->isSourceTerminal()) { + support = segment->base()->getAutoSource(); + turn = segment->base()->getAutoTarget(); + } else { + support = segment->base()->getAutoTarget(); + turn = segment->base()->getAutoSource(); + } + + RoutingPad* rp = dynamic_cast(support->getAnchor()); + Track* metal3track = metal3plane->getTrackByPosition( rp->getSourcePosition().getX() ); + + turn->restrictConstraintBox( freeInterval.getVMin() + , freeInterval.getVMax() + , KbVertical ); if (metal3track->getFreeInterval(segment->getAxis(),segment->getNet()).isEmpty()) { cparanoid << "[INFO] Cannot protect caged terminal because top layer (metal3) is obstructed." << endl; @@ -270,7 +281,7 @@ namespace { if (segment->getSourceU() - lastMovedUp < ppitch*4) { ++moveUpCount; if (moveUpCount % 2 == 0) { - moveUpCaged( segment ); + //moveUpCaged( segment ); } } else { moveUpCount = 0; @@ -304,7 +315,7 @@ namespace { } } - ltraceout(150); + cdebug.tabw(159,-1); } @@ -345,7 +356,7 @@ namespace Kite { segment = _lookup( isegment->second ); if (not segment or not segment->isFixed()) continue; - DebugSession::open( segment->getNet() ); + DebugSession::open( segment->getNet(), 150, 160 ); propagateCagedConstraints( segment, faileds ); DebugSession::close(); } diff --git a/kite/src/ProtectRoutingPads.cpp b/kite/src/ProtectRoutingPads.cpp index 309db737..c6b98d77 100644 --- a/kite/src/ProtectRoutingPads.cpp +++ b/kite/src/ProtectRoutingPads.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -44,7 +44,6 @@ namespace { using namespace std; using Hurricane::tab; - using Hurricane::inltrace; using Hurricane::ForEachIterator; using Hurricane::DbU; using Hurricane::Box; @@ -71,12 +70,17 @@ namespace { void protectRoutingPad ( RoutingPad* rp ) { + Name padNetName = "pad"; Component* usedComponent = rp->_getEntityAsComponent(); Path path = rp->getOccurrence().getPath(); Net* masterNet = usedComponent->getNet(); Transformation transformation = path.getTransformation(); - if ( CatalogExtension::isPad(masterNet->getCell()) ) return; + if ( CatalogExtension::isPad(masterNet->getCell()) ) { + if ( rp->getNet()->isPower() + or (rp->getNet()->getName() == padNetName) ) + return; + } vector segments; @@ -93,8 +97,6 @@ namespace { } for ( size_t i=0 ; igetRoutingPlaneByLayer(segments[i]->getLayer()); unsigned int direction = plane->getDirection(); DbU::Unit wireWidth = plane->getLayerGauge()->getWireWidth(); diff --git a/kite/src/PyGraphicKiteEngine.cpp b/kite/src/PyGraphicKiteEngine.cpp index a4551db8..0ac5107e 100644 --- a/kite/src/PyGraphicKiteEngine.cpp +++ b/kite/src/PyGraphicKiteEngine.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -48,7 +48,7 @@ extern "C" { static PyObject* PyGraphicKiteEngine_grab ( PyObject* ) { - trace << "PyGraphicKiteEngine_grab()" << endl; + cdebug.log(40) << "PyGraphicKiteEngine_grab()" << endl; PyGraphicKiteEngine* pyGraphicKiteEngine = NULL; HTRY @@ -64,7 +64,7 @@ extern "C" { static PyObject* PyGraphicKiteEngine_getCell ( PyGraphicKiteEngine* self ) { - trace << "PyGraphicKiteEngine_getCell ()" << endl; + cdebug.log(40) << "PyGraphicKiteEngine_getCell ()" << endl; Cell* cell = NULL; diff --git a/kite/src/PyKite.cpp b/kite/src/PyKite.cpp index f884b2a3..ac838ac0 100644 --- a/kite/src/PyKite.cpp +++ b/kite/src/PyKite.cpp @@ -26,7 +26,6 @@ namespace Kite { using std::cerr; using std::endl; using Hurricane::tab; - using Hurricane::in_trace; using Isobar::__cs; using CRL::PyTypeToolEngine; using CRL::PyTypeGraphicTool; @@ -66,7 +65,7 @@ extern "C" { // Module Initialization : "initKite ()" DL_EXPORT(void) initKite () { - trace << "initKite()" << endl; + cdebug.log(40) << "initKite()" << endl; PyKiteEngine_LinkPyType(); PyGraphicKiteEngine_LinkPyType(); diff --git a/kite/src/PyKiteEngine.cpp b/kite/src/PyKiteEngine.cpp index 7ffa27fc..d4598fe5 100644 --- a/kite/src/PyKiteEngine.cpp +++ b/kite/src/PyKiteEngine.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2010-2015, All Rights Reserved +// Copyright (c) UPMC 2010-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -35,7 +35,8 @@ namespace Kite { using std::hex; using std::ostringstream; using Hurricane::tab; - using Hurricane::in_trace; + using Hurricane::Exception; + using Hurricane::Bug; using Hurricane::Error; using Hurricane::Warning; using Hurricane::ExceptionWidget; @@ -61,7 +62,7 @@ extern "C" { #define DirectVoidToolMethod(SELF_TYPE, SELF_OBJECT, FUNC_NAME) \ static PyObject* Py##SELF_TYPE##_##FUNC_NAME(Py##SELF_TYPE* self) \ { \ - trace << "Py" #SELF_TYPE "_" #FUNC_NAME "()" << endl; \ + cdebug.log(40) << "Py" #SELF_TYPE "_" #FUNC_NAME "()" << endl; \ HTRY \ METHOD_HEAD(#SELF_TYPE "." #FUNC_NAME "()") \ if (SELF_OBJECT->getViewer()) { \ @@ -84,7 +85,7 @@ extern "C" { static PyObject* PyKiteEngine_wipeoutRouting ( PyObject*, PyObject* args ) { - trace << "PyKiteEngine_wipeoutRouting()" << endl; + cdebug.log(40) << "PyKiteEngine_wipeoutRouting()" << endl; HTRY PyObject* arg0; @@ -101,7 +102,7 @@ extern "C" { static PyObject* PyKiteEngine_get ( PyObject*, PyObject* args ) { - trace << "PyKiteEngine_get()" << endl; + cdebug.log(40) << "PyKiteEngine_get()" << endl; KiteEngine* kite = NULL; @@ -118,7 +119,7 @@ extern "C" { static PyObject* PyKiteEngine_create ( PyObject*, PyObject* args ) { - trace << "PyKiteEngine_create()" << endl; + cdebug.log(40) << "PyKiteEngine_create()" << endl; KiteEngine* kite = NULL; @@ -144,7 +145,7 @@ extern "C" { static PyObject* PyKiteEngine_setViewer ( PyKiteEngine* self, PyObject* args ) { - trace << "PyKiteEngine_setViewer ()" << endl; + cdebug.log(40) << "PyKiteEngine_setViewer ()" << endl; HTRY METHOD_HEAD( "KiteEngine.setViewer()" ) @@ -165,7 +166,7 @@ extern "C" { PyObject* PyKiteEngine_runGlobalRouter ( PyKiteEngine* self, PyObject* args ) { - trace << "PyKiteEngine_runGlobalRouter()" << endl; + cdebug.log(40) << "PyKiteEngine_runGlobalRouter()" << endl; HTRY METHOD_HEAD("KiteEngine.runGlobalRouter()") @@ -191,7 +192,7 @@ extern "C" { PyObject* PyKiteEngine_loadGlobalRouting ( PyKiteEngine* self, PyObject* args ) { - trace << "PyKiteEngine_loadGlobalRouting()" << endl; + cdebug.log(40) << "PyKiteEngine_loadGlobalRouting()" << endl; HTRY METHOD_HEAD("KiteEngine.loadGlobalRouting()") @@ -242,7 +243,7 @@ extern "C" { PyObject* PyKiteEngine_layerAssign ( PyKiteEngine* self, PyObject* args ) { - trace << "PyKiteEngine_layerAssign()" << endl; + cdebug.log(40) << "PyKiteEngine_layerAssign()" << endl; HTRY METHOD_HEAD("KiteEngine.layerAssign()") @@ -274,7 +275,7 @@ extern "C" { static PyObject* PyKiteEngine_runNegociatePreRouted ( PyKiteEngine* self ) { - trace << "PyKiteEngine_runNegociatePreRouted()" << endl; + cdebug.log(40) << "PyKiteEngine_runNegociatePreRouted()" << endl; HTRY METHOD_HEAD("KiteEngine.runNegociatePreRouted()") if (kite->getViewer()) { @@ -292,7 +293,7 @@ extern "C" { static PyObject* PyKiteEngine_runNegociate ( PyKiteEngine* self ) { - trace << "PyKiteEngine_runNegociate()" << endl; + cdebug.log(40) << "PyKiteEngine_runNegociate()" << endl; HTRY METHOD_HEAD("KiteEngine.runNegociate()") if (kite->getViewer()) { diff --git a/kite/src/RoutingEvent.cpp b/kite/src/RoutingEvent.cpp index 74f54c79..a2c495ee 100644 --- a/kite/src/RoutingEvent.cpp +++ b/kite/src/RoutingEvent.cpp @@ -1,14 +1,14 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | // | K i t e - D e t a i l e d R o u t e r | // | | // | Author : Jean-Paul CHAPUT | -// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Module : "./RoutingEvent.cpp" | // +-----------------------------------------------------------------+ @@ -49,9 +49,6 @@ namespace Kite { using std::min; using std::ostringstream; using Hurricane::tab; - using Hurricane::inltrace; - using Hurricane::ltracein; - using Hurricane::ltraceout; using Hurricane::DebugSession; using Hurricane::Bug; using Hurricane::Error; @@ -189,8 +186,8 @@ namespace Kite { DataNegociate* data = _segment->getDataNegociate(); if (data) data->setRoutingEvent( this ); - ltrace(180) << "create: " << this << endl; - ltrace(200) << "Initial setAxisHint @" << DbU::getValueString(getAxisHint()) << endl; + cdebug.log(159) << "create: " << this << endl; + cdebug.log(159) << "Initial setAxisHint @" << DbU::getValueString(getAxisHint()) << endl; if (_segment->getTrack()) { cerr << Bug( "RoutingEvent::create() - TrackElement is already inserted in a Track." @@ -227,7 +224,7 @@ namespace Kite { clone->_disabled = false; clone->_eventLevel = 0; - ltrace(200) << "RoutingEvent::clone() " << clone + cdebug.log(159) << "RoutingEvent::clone() " << clone << " (from: " << ")" << endl; return clone; @@ -236,7 +233,7 @@ namespace Kite { RoutingEvent::~RoutingEvent () { - ltrace(180) << "~RoutingEvent() " << endl; + cdebug.log(159) << "~RoutingEvent() " << endl; DataNegociate* data = _segment->getDataNegociate(); if ( data and (data->getRoutingEvent() == this) ) @@ -246,7 +243,7 @@ namespace Kite { void RoutingEvent::destroy () { - ltrace(180) << "RoutingEvent::destroy() " << this << endl; + cdebug.log(159) << "RoutingEvent::destroy() " << this << endl; if (_allocateds > 0) --_allocateds; delete this; @@ -277,7 +274,7 @@ namespace Kite { void RoutingEvent::setAxisHint ( DbU::Unit axis ) { - ltrace(200) << "setAxisHint @" << DbU::getValueString(axis) << " " << _segment << endl; + cdebug.log(159) << "setAxisHint @" << DbU::getValueString(axis) << " " << _segment << endl; _axisHint = axis; } @@ -301,7 +298,7 @@ namespace Kite { } _axisHint = parent->getAxis(); - ltrace(200) << "setAxisHintFromParent() - hint:" << DbU::getValueString(_axisHint) + cdebug.log(159) << "setAxisHintFromParent() - hint:" << DbU::getValueString(_axisHint) << " axis:" << DbU::getValueString(parent->getAxis()) << " parent:" << parent << endl; return; } @@ -315,14 +312,14 @@ namespace Kite { RoutingEvent* fork = NULL; if ( (getStage() != Repair) and isUnimplemented() ) { - ltrace(200) << "Reschedule: cancelled (Unimplemented) " + cdebug.log(159) << "Reschedule: cancelled (Unimplemented) " << " -> " << fork << endl; return NULL; } if (not isProcessed()) { fork = this; - ltrace(200) << "Reschedule/Self: " + cdebug.log(159) << "Reschedule/Self: " << " -> " << eventLevel << ":" << fork << endl; } else { @@ -331,7 +328,7 @@ namespace Kite { _segment->getDataNegociate()->setRoutingEvent( fork ); - ltrace(200) << "Reschedule/Fork: " + cdebug.log(159) << "Reschedule/Fork: " << " -> " << fork << endl; } @@ -341,6 +338,8 @@ namespace Kite { if (getStage() == Repair) { fork->setMode( RoutingEvent::Repair ); _segment->getDataNegociate()->setState( DataNegociate::Repair ); + } else if (getStage() == RoutingEvent::Pack) { + fork->setMode( RoutingEvent::Pack ); } queue.repush( fork ); @@ -395,32 +394,33 @@ namespace Kite { #endif } - DebugSession::open( _segment->getNet(), 148 ); + DebugSession::open( _segment->getNet(), 150, 160 ); - ltrace(500) << "Deter| Event " - << getProcesseds() - << "," << getEventLevel() - << "," << setw(6) << getPriority() - << ": " << _segment << endl; + cdebug.log(9000) << "Deter| Event " + << getProcesseds() + << "," << getEventLevel() + << "," << setw(6) << getPriority() + << ": " << _segment << endl; _processeds++; - ltracein(200); - ltrace(200) << "State: *before* " - << DataNegociate::getStateString(_segment->getDataNegociate()) - << " ripup:" << _segment->getDataNegociate()->getRipupCount() - << endl; - ltrace(149) << "Level: " << getEventLevel() - << ", area: " << _segment->getFreedomDegree() << endl; + cdebug.tabw(159,1); + cdebug.log(159) << "State: *before* " + << DataNegociate::getStateString(_segment->getDataNegociate()) + << " ripup:" << _segment->getDataNegociate()->getRipupCount() + << endl; + cdebug.log(159) << "Level: " << getEventLevel() + << ", area: " << _segment->getFreedomDegree() << endl; //_preCheck( _segment ); _eventLevel = 0; - history.push( this ); + if (_mode != Pack) history.push( this ); if ( isProcessed() or isDisabled() ) { - ltrace(200) << "Already processed or disabled." << endl; + cdebug.log(159) << "Already processed or disabled." << endl; } else { setProcessed(); + setTimeStamp( _processeds ); switch ( _mode ) { case Negociate: _processNegociate( queue, history ); break; @@ -431,7 +431,7 @@ namespace Kite { break; } } - ltraceout(200); + cdebug.tabw(159,-1); queue.repushInvalidateds(); Session::revalidate(); @@ -450,7 +450,7 @@ namespace Kite { void RoutingEvent::_processNegociate ( RoutingEventQueue& queue, RoutingEventHistory& history ) { - ltrace(200) << "* Mode:Negociation." << endl; + cdebug.log(159) << "* Mode:Negociation." << endl; SegmentFsm fsm ( this, queue, history ); @@ -459,24 +459,25 @@ namespace Kite { return; } - ltracein(200); + cdebug.tabw(159,1); fsm.getData()->incRipupCount(); size_t itrack = 0; for ( itrack = 0 ; itrack < fsm.getCosts().size() ; itrack++ ) - ltrace(200) << "| " << fsm.getCost(itrack) << endl; + cdebug.log(159) << "| " << fsm.getCost(itrack) << endl; itrack = 0; if ( (not isOverConstrained()) and Manipulator(_segment,fsm).canRipup() ) { if (fsm.getCosts().size() and fsm.getCost(itrack).isFree()) { - ltrace(200) << "Insert in free space " << this << endl; + cdebug.log(159) << "Insert in free space " << this << endl; resetInsertState(); _axisHistory = _segment->getAxis(); _eventLevel = 0; - ltrace(500) << "Deter| addInsertEvent() @" << fsm.getCost(itrack).getTrack() << endl; - Session::addInsertEvent( _segment, fsm.getCost(itrack).getTrack() ); + cdebug.log(9000) << "Deter| addInsertEvent() @" << fsm.getCost(itrack).getTrack() << endl; + if (not _segment->isReduced()) + Session::addInsertEvent( _segment, fsm.getCost(itrack).getTrack() ); fsm.setState( SegmentFsm::SelfInserted ); } else { // Do ripup. @@ -484,13 +485,13 @@ namespace Kite { Manipulator(_segment,fsm).ripupPerpandiculars(); } else { if (Manipulator(_segment,fsm).canRipup(Manipulator::NotOnLastRipup)) { - if (inltrace(500)) { + if (cdebug.enabled(9000)) { for ( itrack=0 ; itracksetState( DataNegociate::Slacken ); } if (not fsm.slackenTopology()) { @@ -516,51 +517,47 @@ namespace Kite { fsm.doActions(); if (itrack < fsm.getCosts().size()) { - ltrace(200) << "Placed: @" << DbU::getValueString(fsm.getCost(itrack).getTrack()->getAxis()) + cdebug.log(159) << "Placed: @" << DbU::getValueString(fsm.getCost(itrack).getTrack()->getAxis()) << " " << this << endl; } - ltraceout(200); + cdebug.tabw(159,-1); } void RoutingEvent::_processPack ( RoutingEventQueue& queue, RoutingEventHistory& history ) { - ltrace(200) << "* Mode:Pack." << endl; + cdebug.log(159) << "* Mode:Pack." << endl; - if (_segment->getTrack() != NULL) { - ltrace(200) << "* Cancel: already in Track." << endl; - return; - } + if (not _segment->isUTurn()) return; SegmentFsm fsm ( this, queue, history ); if (fsm.getState() == SegmentFsm::MissingData ) return; if (fsm.getState() == SegmentFsm::EmptyTrackList) return; - ltracein(200); + cdebug.tabw(159,1); for ( size_t i = 0 ; i < fsm.getCosts().size() ; i++ ) - ltrace(200) << "| " << fsm.getCost(i) << endl; - ltraceout(200); + cdebug.log(159) << "| " << fsm.getCost(i) << endl; + cdebug.tabw(159,-1); - if (fsm.getCosts().size() and fsm.getCost(0).isFree()) { - ltrace(200) << "Insert in free space." << endl; - Session::addInsertEvent( _segment, fsm.getCost(0).getTrack() ); + if ( _segment->getTrack() + and fsm.getCosts().size() + and fsm.getCost(0).isFree() + and (fsm.getCost(0).getTrack() != _segment->getTrack()) ) { + + cerr << "_processPack(): move to " << fsm.getCost(0).getTrack() << endl; + Session::addMoveEvent( _segment, fsm.getCost(0).getTrack() ); fsm.setState( SegmentFsm::SelfInserted ); - } else { - ltrace(200) << "Pack failed." << endl; - _mode = Negociate; - fsm.addAction( _segment, SegmentAction::SelfInsert ); - fsm.doActions(); } } void RoutingEvent::_processRepair ( RoutingEventQueue& queue, RoutingEventHistory& history ) { - ltrace(200) << "* Mode:Repair." << endl; + cdebug.log(159) << "* Mode:Repair." << endl; if ( _segment->getTrack() != NULL ) { - ltrace(200) << "* Cancel: already in Track." << endl; + cdebug.log(159) << "* Cancel: already in Track." << endl; return; } @@ -568,13 +565,13 @@ namespace Kite { if (fsm.getState() == SegmentFsm::MissingData ) return; if (fsm.getState() == SegmentFsm::EmptyTrackList) return; - ltracein(200); + cdebug.tabw(159,1); for ( size_t i = 0 ; i < fsm.getCosts().size() ; i++ ) - ltrace(200) << "| " << fsm.getCost(i) << endl; - ltraceout(200); + cdebug.log(159) << "| " << fsm.getCost(i) << endl; + cdebug.tabw(159,-1); if (fsm.getCosts().size() and fsm.getCost(0).isFree()) { - ltrace(200) << "Insert in free space." << endl; + cdebug.log(159) << "Insert in free space." << endl; Session::addInsertEvent( _segment, fsm.getCost(0).getTrack() ); fsm.setState( SegmentFsm::SelfInserted ); } else { @@ -594,7 +591,7 @@ namespace Kite { queue.commit(); break; default: - ltrace(200) << "Repair failed." << endl; + cdebug.log(159) << "Repair failed." << endl; break; } } @@ -603,37 +600,36 @@ namespace Kite { void RoutingEvent::revalidate () { - DebugSession::open( _segment->getNet(), 148 ); + DebugSession::open( _segment->getNet(), 150, 160 ); - ltrace(200) << "RoutingEvent::revalidate() - " << this << endl; - ltracein(200); + cdebug.log(159,1) << "RoutingEvent::revalidate() - " << this << endl; //_dataNegociate->update(); setAxisHintFromParent(); - ltrace(200) << "axisHint:" << DbU::getValueString(getAxisHint()) << endl; + cdebug.log(159) << "axisHint:" << DbU::getValueString(getAxisHint()) << endl; _overConstrained = false; _segment->base()->getConstraints( _constraints ); _segment->base()->getOptimal ( _optimal ); - ltrace(200) << "Stage:" << RoutingEvent::getStage() << endl; + cdebug.log(159) << "Stage:" << RoutingEvent::getStage() << endl; if (RoutingEvent::getStage() == RoutingEvent::Repair) { if (_segment->isStrongTerminal(KbPropagate)) { - ltrace(200) << "Not expanding on Terminals:" << _constraints << endl; + cdebug.log(159) << "Not expanding on Terminals:" << _constraints << endl; } else { - ltrace(200) << "Expanding:" << _constraints << endl; + cdebug.log(159) << "Expanding:" << _constraints << endl; _constraints.inflate( Session::getSliceHeight() ); - ltrace(200) << "Expanding (after):" << _constraints << endl; + cdebug.log(159) << "Expanding (after):" << _constraints << endl; } } - ltrace(200) << "| Raw Track Constraint: " << _constraints << endl; + cdebug.log(159) << "| Raw Track Constraint: " << _constraints << endl; _tracksNb = 0; Interval perpandicular = _constraints; perpandicular.intersection( getPerpandicularFree()); - ltrace(200) << "| Perpandicular Free: " << perpandicular << endl; + cdebug.log(159) << "| Perpandicular Free: " << perpandicular << endl; if (not perpandicular.isEmpty()) { RoutingPlane* plane = Session::getKiteEngine()->getRoutingPlaneByLayer(_segment->getLayer()); @@ -644,7 +640,7 @@ namespace Kite { ; track = track->getNextTrack(), _tracksNb++ ); } if (not _tracksNb) { - ltrace(200) << "| Reverting to pure constraints." << endl; + cdebug.log(159) << "| Reverting to pure constraints." << endl; RoutingPlane* plane = Session::getKiteEngine()->getRoutingPlaneByLayer(_segment->getLayer()); Track* track = plane->getTrackByPosition(_constraints.getVMin()); @@ -653,7 +649,7 @@ namespace Kite { ; track = track->getNextTrack(), _tracksNb++ ); } if (not _tracksNb) { - ltrace(200) << "| Pure constraints are too tight." << endl; + cdebug.log(159) << "| Pure constraints are too tight." << endl; if (_segment->base()) _overConstrained = _segment->base()->getAutoSource()->isTerminal() and _segment->base()->getAutoTarget()->isTerminal(); @@ -663,8 +659,8 @@ namespace Kite { = (DbU::toLambda(_segment->getLength()) + 1.0) * (DbU::toLambda(_segment->base()->getSlack()) + 1.0); - ltrace(200) << _segment << " has " << _tracksNb << " choices " << perpandicular << endl; - ltraceout(200); + cdebug.log(159) << _segment << " has " << _tracksNb << " choices " << perpandicular << endl; + cdebug.tabw(159,-1); DebugSession::close(); } diff --git a/kite/src/RoutingEventHistory.cpp b/kite/src/RoutingEventHistory.cpp index 7e2d32ff..ce2d953f 100644 --- a/kite/src/RoutingEventHistory.cpp +++ b/kite/src/RoutingEventHistory.cpp @@ -1,14 +1,14 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2013, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | // | K i t e - D e t a i l e d R o u t e r | // | | // | Author : Jean-Paul CHAPUT | -// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Module : "./RoutingEventHistory.cpp" | // +-----------------------------------------------------------------+ diff --git a/kite/src/RoutingEventQueue.cpp b/kite/src/RoutingEventQueue.cpp index e06b6ca1..0270f64e 100644 --- a/kite/src/RoutingEventQueue.cpp +++ b/kite/src/RoutingEventQueue.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -36,9 +36,6 @@ namespace Kite { using std::pop_heap; using Hurricane::tab; - using Hurricane::inltrace; - using Hurricane::ltracein; - using Hurricane::ltraceout; using Hurricane::Bug; @@ -92,8 +89,7 @@ namespace Kite { void RoutingEventQueue::commit () { - ltrace(200) << "RoutingEventQueue::commit()" << endl; - ltracein(200); + cdebug.log(159,1) << "RoutingEventQueue::commit()" << endl; size_t addeds = _pushRequests.size(); size_t before = _events.size(); @@ -105,7 +101,7 @@ namespace Kite { _topEventLevel = max( _topEventLevel, (*ipushEvent)->getEventLevel() ); _events.insert( (*ipushEvent) ); - ltrace(200) << "| " << (*ipushEvent) << endl; + cdebug.log(159) << "| " << (*ipushEvent) << endl; } _pushRequests.clear(); #if defined(CHECK_ROUTINGEVENT_QUEUE) @@ -117,7 +113,7 @@ namespace Kite { , addeds,(after-before) ) << endl; } - ltraceout(200); + cdebug.tabw(159,-1); } diff --git a/kite/src/RoutingPlane.cpp b/kite/src/RoutingPlane.cpp index 6dade76f..3214783c 100644 --- a/kite/src/RoutingPlane.cpp +++ b/kite/src/RoutingPlane.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -40,9 +40,6 @@ namespace Kite { using std::cerr; using std::endl; using Hurricane::tab; - using Hurricane::inltrace; - using Hurricane::ltracein; - using Hurricane::ltraceout; using Hurricane::Error; using Hurricane::Box; using Hurricane::Cell; @@ -79,16 +76,15 @@ namespace Kite { void RoutingPlane::destroy () { - ltrace(90) << "RoutingPlane::destroy() - " - << (void*)this << " " << this << endl; - ltracein(90); + cdebug.log(155,1) << "RoutingPlane::destroy() - " + << (void*)this << " " << this << endl; for ( size_t index=0 ; index<_tracks.size() ; ++index ) _tracks[index]->destroy(); delete this; - ltraceout(90); + cdebug.tabw(155,-1); } diff --git a/kite/src/SegmentFsm.cpp b/kite/src/SegmentFsm.cpp index d8340254..b775691f 100644 --- a/kite/src/SegmentFsm.cpp +++ b/kite/src/SegmentFsm.cpp @@ -1,14 +1,14 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | // | K i t e - D e t a i l e d R o u t e r | // | | // | Author : Jean-Paul CHAPUT | -// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Module : "./SegmentFsm.cpp" | // +-----------------------------------------------------------------+ @@ -160,7 +160,7 @@ namespace { void UnionIntervals::addInterval ( Interval& interval ) { - ltrace(200) << "UnionInterval::addInterval() - " << interval << endl; + cdebug.log(159) << "UnionInterval::addInterval() - " << interval << endl; list::iterator iintv = _intervals.begin (); @@ -337,9 +337,6 @@ namespace Kite { using std::sort; using Hurricane::tab; - using Hurricane::inltrace; - using Hurricane::ltracein; - using Hurricane::ltraceout; using Hurricane::DebugSession; using Hurricane::Bug; using Hurricane::ForEachIterator; @@ -367,12 +364,12 @@ namespace Kite { // "_immediate" ripup flags was associated with "perpandicular", as they // must be re-inserted *before* any parallel. Must look to solve the redundancy. - DebugSession::open( _segment->getNet(), 200 ); + DebugSession::open( _segment->getNet(), 150, 160 ); if (_type & Perpandicular) { - ltrace(200) << "* Riping Pp " << _segment << endl; + cdebug.log(159) << "* Riping Pp " << _segment << endl; } else { - ltrace(200) << "* Riping // " << _segment << endl; + cdebug.log(159) << "* Riping // " << _segment << endl; } if (_segment->isFixed()) { DebugSession::close(); return true; } @@ -398,7 +395,7 @@ namespace Kite { } if ( (_type & AxisHint) /*and not _segment->isSlackenDogleg()*/ ) { - ltrace(200) << "Setting Axis Hint: @" << DbU::getValueString(_axisHint) << endl; + cdebug.log(159) << "Setting Axis Hint: @" << DbU::getValueString(_axisHint) << endl; event->setAxisHint( _axisHint ); } @@ -406,7 +403,7 @@ namespace Kite { // There should be no need to move the axis of the segment to be inserted, // it will automatically slot into the empty track, if any. if (_type & MoveToAxis) { - ltrace(200) << "Moving Axis To: @" << DbU::getValueString(_axisHint) << endl; + cdebug.log(159) << "Moving Axis To: @" << DbU::getValueString(_axisHint) << endl; _segment->setAxis( _axisHint ); } @@ -443,23 +440,23 @@ namespace Kite { SegmentFsm::SegmentFsm ( RoutingEvent* event, RoutingEventQueue& queue, RoutingEventHistory& history ) - : _event (event) - , _queue (queue) - , _history (history) - , _state (0) - , _data (NULL) - , _constraint () - , _optimal () - , _costs () - , _actions () - , _fullBlocked (true) + : _event (event) + , _queue (queue) + , _history (history) + , _state (0) + , _data (NULL) + , _constraint () + , _optimal () + , _costs () + , _actions () + , _fullBlocked(true) { TrackElement* segment = _event->getSegment(); unsigned int depth = Session::getRoutingGauge()->getLayerDepth(segment->getLayer()); - _event->setTracksFree ( 0 ); + _event->setTracksFree( 0 ); _data = segment->getDataNegociate(); - if ( !_data ) { + if (not _data) { _state = MissingData; return; } @@ -470,31 +467,30 @@ namespace Kite { _constraint = _event->getConstraints(); _optimal = _event->getOptimal(); - const Interval& perpandicular = _event->getPerpandicularFree (); + const Interval& perpandicular = _event->getPerpandicularFree(); - ltrace(148) << "Katabatic intervals:" << endl; - ltrace(148) << "* Optimal: " << _optimal << endl; - ltrace(148) << "* Constraints: " << _constraint << endl; - ltrace(148) << "* Perpandicular: " << perpandicular << endl; - ltrace(148) << "* AxisHint: " << DbU::getValueString(_event->getAxisHint()) << endl; + cdebug.log(159) << "Katabatic intervals:" << endl; + cdebug.log(159) << "* Optimal: " << _optimal << endl; + cdebug.log(159) << "* Constraints: " << _constraint << endl; + cdebug.log(159) << "* Perpandicular: " << perpandicular << endl; + cdebug.log(159) << "* AxisHint: " << DbU::getValueString(_event->getAxisHint()) << endl; - if ( _event->getTracksNb() ) { - if ( _constraint.getIntersection(perpandicular).isEmpty() ) { - ltrace(200) << "Perpandicular free is too tight." << endl; + if (_event->getTracksNb()) { + if (_constraint.getIntersection(perpandicular).isEmpty()) { + cdebug.log(159) << "Perpandicular free is too tight." << endl; _state = EmptyTrackList; } else - _constraint.intersection ( perpandicular ); + _constraint.intersection( perpandicular ); } else { - ltrace(200) << "No Track in perpandicular free." << endl; + cdebug.log(159) << "No Track in perpandicular free." << endl; _state = EmptyTrackList; } - if ( _state == EmptyTrackList ) return; + if (_state == EmptyTrackList) return; - ltrace(148) << "Negociate intervals:" << endl; - ltrace(148) << "* Optimal: " << _optimal << endl; - ltrace(148) << "* Constraints: " << _constraint << endl; - ltracein(148); + cdebug.log(159) << "Negociate intervals:" << endl; + cdebug.log(159) << "* Optimal: " << _optimal << endl; + cdebug.log(159,1) << "* Constraints: " << _constraint << endl; // if ( segment->isLocal() and (_data->getState() >= DataNegociate::MaximumSlack) ) // _constraint.inflate ( 0, DbU::lambda(1.0) ); @@ -504,35 +500,38 @@ namespace Kite { and (segment->base()->getAutoSource()->getGCell()->getGlobalsCount(depth) >= 9.0); RoutingPlane* plane = Session::getKiteEngine()->getRoutingPlaneByLayer(segment->getLayer()); - for( Track* track : Tracks_Range::get(plane,_constraint)) { + for ( Track* track : Tracks_Range::get(plane,_constraint) ) { unsigned int costflags = 0; costflags |= (segment->isLocal() and (depth >= 3)) ? TrackCost::LocalAndTopDepth : 0; - _costs.push_back ( track->getOverlapCost(segment,costflags) ); - _costs.back().setAxisWeight ( _event->getAxisWeight(track->getAxis()) ); - _costs.back().incDeltaPerpand ( _data->getWiringDelta(track->getAxis()) ); + if (not segment->isReduced()) + _costs.push_back( track->getOverlapCost(segment,costflags) ); + else + _costs.push_back( TrackCost(track,segment->getNet()) ); + _costs.back().setAxisWeight ( _event->getAxisWeight(track->getAxis()) ); + _costs.back().incDeltaPerpand( _data->getWiringDelta(track->getAxis()) ); if (segment->isGlobal()) { - ltrace(500) << "Deter| setForGlobal() on " << track << endl; + cdebug.log(9000) << "Deter| setForGlobal() on " << track << endl; _costs.back().setForGlobal(); } if ( inLocalDepth and (_costs.back().getDataState() == DataNegociate::MaximumSlack) ) - _costs.back().setInfinite (); + _costs.back().setInfinite(); if ( isOneLocalTrack and _costs.back().isOverlapGlobal() and (_costs.back().getDataState() >= DataNegociate::ConflictSolveByHistory) ) - _costs.back().setInfinite (); + _costs.back().setInfinite(); - _costs.back().consolidate (); + _costs.back().consolidate(); if ( _fullBlocked and (not _costs.back().isBlockage() and not _costs.back().isFixed()) ) _fullBlocked = false; - ltrace(149) << "| " << _costs.back() << ((_fullBlocked)?" FB ": " -- ") << track << endl; + cdebug.log(159) << "| " << _costs.back() << ((_fullBlocked)?" FB ": " -- ") << track << endl; } - ltraceout(148); + cdebug.tabw(159,-1); - if ( _costs.empty() ) { + if (_costs.empty()) { Track* nearest = plane->getTrackByPosition(_constraint.getCenter()); if ( (nearest->getAxis() < _constraint.getVMin()) @@ -541,9 +540,9 @@ namespace Kite { //cerr << "[UNIMPLEMENTED] " << segment << " no Track in constraint interval " // << _constraint << " " << "." << endl; } else { - cerr << Bug(" %s Track_Range() failed to find Tracks in %s (they exists)." - ,getString(segment).c_str() - ,getString(_constraint).c_str() + cerr << Bug( " %s Track_Range() failed to find Tracks in %s (they exists)." + , getString(segment).c_str() + , getString(_constraint).c_str() ) << endl; } _state = EmptyTrackList; @@ -557,11 +556,11 @@ namespace Kite { ? TrackCost::DiscardGlobals : 0; flags |= (RoutingEvent::getStage() == RoutingEvent::Repair) ? TrackCost::IgnoreSharedLength : 0; - if ( flags & TrackCost::DiscardGlobals ) { - ltrace(200) << "TrackCost::Compare() - DiscardGlobals" << endl; + if (flags & TrackCost::DiscardGlobals) { + cdebug.log(159) << "TrackCost::Compare() - DiscardGlobals" << endl; } - sort ( _costs.begin(), _costs.end(), TrackCost::Compare(flags) ); + sort( _costs.begin(), _costs.end(), TrackCost::Compare(flags) ); size_t i=0; for ( ; (i<_costs.size()) and _costs[i].isFree() ; i++ ); @@ -576,14 +575,14 @@ namespace Kite { { if ( not segment->isFixed() ) { _actions.push_back ( SegmentAction(segment,type,axisHint,toSegmentFsm) ); - ltrace(200) << "SegmentFsm::addAction(): " << segment << endl; + cdebug.log(159) << "SegmentFsm::addAction(): " << segment << endl; } } void SegmentFsm::doActions () { - ltrace(200) << "SegmentFsm::doActions() - " << _actions.size() << endl; + cdebug.log(159) << "SegmentFsm::doActions() - " << _actions.size() << endl; bool ripupOthersParallel = false; bool ripedByLocal = getEvent()->getSegment()->isLocal(); @@ -599,7 +598,7 @@ namespace Kite { if ( (_actions[i].getType() & SegmentAction::SelfInsert) and ripupOthersParallel ) _actions[i].setFlag ( SegmentAction::EventLevel3 ); - DebugSession::open ( _actions[i].getSegment()->getNet(), 200 ); + DebugSession::open ( _actions[i].getSegment()->getNet(), 150, 160 ); if ( not _actions[i].doAction(_queue) ) { cinfo << "[INFO] Failed action on " << _actions[i].getSegment() << endl; } @@ -612,7 +611,7 @@ namespace Kite { bool SegmentFsm::insertInTrack ( size_t i ) { - ltrace(200) << "SegmentFsm::insertInTrack() istate:" << _event->getInsertState() + cdebug.log(159) << "SegmentFsm::insertInTrack() istate:" << _event->getInsertState() << " track:" << i << endl; _event->incInsertState(); @@ -638,7 +637,7 @@ namespace Kite { RoutingEvent* event; TrackElement* segment = _event->getSegment(); - ltrace(200) << "SegmentFsm::conflictSolveByHistory()" << endl; + cdebug.log(159) << "SegmentFsm::conflictSolveByHistory()" << endl; size_t maxDepth = min( getHistory().size(), (size_t)300 ); size_t depth = 0; @@ -664,10 +663,10 @@ namespace Kite { if (sourceDogleg) { if (segment->isHorizontal()) { breakPoint = Point( minConflict, segment->getAxis() ); - ltrace(200) << breakPoint << endl; + cdebug.log(159) << breakPoint << endl; } else { breakPoint = Point( segment->getAxis(), minConflict ); - ltrace(200) << breakPoint << endl; + cdebug.log(159) << breakPoint << endl; } Katabatic::GCell* dogLegGCell = Session::getGCellUnder( breakPoint.getX(), breakPoint.getY() ); @@ -683,10 +682,10 @@ namespace Kite { if (not success and targetDogleg) { if (segment->isHorizontal()) { breakPoint = Point( maxConflict, segment->getAxis() ); - ltrace(200) << breakPoint << endl; + cdebug.log(159) << breakPoint << endl; } else { breakPoint = Point( segment->getAxis(), maxConflict ); - ltrace(200) << breakPoint << endl; + cdebug.log(159) << breakPoint << endl; } Katabatic::GCell* dogLegGCell = Session::getGCellUnder( breakPoint.getX(), breakPoint.getY() ); @@ -700,14 +699,14 @@ namespace Kite { } } } else { - ltrace(200) << "No disloggers found @" << DbU::getValueString(segment->getAxis()) << endl; + cdebug.log(159) << "No disloggers found @" << DbU::getValueString(segment->getAxis()) << endl; Interval freeSpan = Session::getKiteEngine()-> getTrackByPosition(segment->getLayer(),segment->getAxis())-> getFreeInterval(segment->getSourceU(),segment->getNet()); if (freeSpan.contains(segment->getCanonicalInterval())) { - ltrace(200) << "Disloggers vanished, Segment can be re-inserted." << endl; + cdebug.log(159) << "Disloggers vanished, Segment can be re-inserted." << endl; success = true; } } @@ -722,13 +721,13 @@ namespace Kite { Interval constraints; vector candidates; TrackElement* segment = _event->getSegment(); - bool canMoveUp = (segment->isLocal()) ? segment->canPivotUp(0.5) : segment->canMoveUp(1.0); // MARK 1 + bool canMoveUp = (segment->isLocal()) ? segment->canPivotUp(0.5) : segment->canMoveUp(1.0,Katabatic::KbCheckLowDensity); // MARK 1 unsigned int relaxFlags = Manipulator::NoDoglegReuse | ((_data and (_data->getStateCount() < 2)) ? Manipulator::AllowExpand : Manipulator::NoExpand); - ltrace(200) << "SegmentFsm::conflictSolveByPlaceds()" << endl; - ltrace(200) << "| Candidates Tracks: " << endl; + cdebug.log(159) << "SegmentFsm::conflictSolveByPlaceds()" << endl; + cdebug.log(159) << "| Candidates Tracks: " << endl; segment->base()->getConstraints( constraints ); Interval overlap = segment->getCanonicalInterval(); @@ -760,29 +759,29 @@ namespace Kite { candidates.back().setBegin( begin ); candidates.back().setEnd ( end ); - ltrace(200) << "* " << track << " [" << begin << ":" << end << "]" << endl; + cdebug.log(159) << "* " << track << " [" << begin << ":" << end << "]" << endl; for ( ; (begin < end) ; ++begin ) { other = track->getSegment( begin ); if (other->getNet() == segment->getNet()) { - ltrace(200) << " | " << begin << " Same net: " << " " << other << endl; + cdebug.log(159) << " | " << begin << " Same net: " << " " << other << endl; continue; } if (not other->getCanonicalInterval().intersect(overlap)) { - ltrace(200) << " | " << begin << " No Conflict: " << " " << other << endl; + cdebug.log(159) << " | " << begin << " No Conflict: " << " " << other << endl; if (otherNet == NULL) candidates.back().setBegin( begin+1 ); continue; } - ltrace(200) << " | " << begin << " Conflict: " << " " << other << endl; + cdebug.log(159) << " | " << begin << " Conflict: " << " " << other << endl; if (otherNet != other->getNet()) { if (otherNet) { if (otherIsGlobal) { candidates.back().addConflict( otherOverlap ); - ltrace(200) << " | Other overlap G: " << otherOverlap << endl; + cdebug.log(159) << " | Other overlap G: " << otherOverlap << endl; } else { - ltrace(200) << " | Other overlap L: " << otherOverlap << " ignored." << endl; + cdebug.log(159) << " | Other overlap L: " << otherOverlap << " ignored." << endl; } } otherNet = other->getNet(); @@ -796,9 +795,9 @@ namespace Kite { if (not otherOverlap.isEmpty()) { if (otherIsGlobal) { candidates.back().addConflict( otherOverlap ); - ltrace(200) << " | Other overlap G: " << otherOverlap << endl; + cdebug.log(159) << " | Other overlap G: " << otherOverlap << endl; } else { - ltrace(200) << " | Other overlap L: " << otherOverlap << " ignored." << endl; + cdebug.log(159) << " | Other overlap L: " << otherOverlap << " ignored." << endl; } } @@ -808,14 +807,14 @@ namespace Kite { sort( candidates.begin(), candidates.end() ); for ( size_t icandidate=0 ; icandidateisGlobal()) { - ltrace(200) << "conflictSolveByPlaceds() - Conflict with global, other move up" << endl; + cdebug.log(159) << "conflictSolveByPlaceds() - Conflict with global, other move up" << endl; if ((success = Manipulator(other,*this).moveUp())) break; } - ltrace(200) << "conflictSolveByPlaceds() - Relaxing self" << endl; + cdebug.log(159) << "conflictSolveByPlaceds() - Relaxing self" << endl; if (Manipulator(segment,*this).relax(overlap0,relaxFlags)) { success = true; @@ -840,7 +839,7 @@ namespace Kite { if ( not canMoveUp and (relaxFlags != Manipulator::NoExpand) and Manipulator(segment,*this).relax(overlap0,Manipulator::NoExpand|Manipulator::NoDoglegReuse) ) { - ltrace(200) << "Cannot move up but successful narrow breaking." << endl; + cdebug.log(159) << "Cannot move up but successful narrow breaking." << endl; success = true; break; } @@ -848,8 +847,8 @@ namespace Kite { } if ( not success and segment->isGlobal() and (_costs.size() <= 1) ) { - ltrace(200) << "Overconstrained perpandiculars, rip them up. On track:" << endl; - ltrace(200) << " " << track << endl; + cdebug.log(159) << "Overconstrained perpandiculars, rip them up. On track:" << endl; + cdebug.log(159) << " " << track << endl; Manipulator(segment,*this).ripupPerpandiculars (); success = true; } @@ -861,7 +860,7 @@ namespace Kite { bool SegmentFsm::solveTerminalVsGlobal () { TrackElement* segment = getEvent()->getSegment(); - ltrace(200) << "SegmentFsm::solveTerminalVsGlobal: " << " " << segment << endl; + cdebug.log(159) << "SegmentFsm::solveTerminalVsGlobal: " << " " << segment << endl; if (not (segment->isTerminal() and segment->isLocal())) return false; @@ -879,9 +878,9 @@ namespace Kite { if (not other->isGlobal()) continue; if (not otherOverlap.contains(overlap)) continue; - ltrace(200) << "| Global candidate:" << other << endl; + cdebug.log(159) << "| Global candidate:" << other << endl; if (Manipulator(other,*this).moveUp(Manipulator::AllowTerminalMoveUp)) { - ltrace(200) << "| Global candidate selected." << endl; + cdebug.log(159) << "| Global candidate selected." << endl; return true; } } @@ -896,14 +895,13 @@ namespace Kite { bool success = false; TrackElement* segment = getEvent()->getSegment(); - ltrace(200) << "SegmentFsm::solveFullBlockages: " << " " << segment << endl; - ltracein(200); + cdebug.log(159,1) << "SegmentFsm::solveFullBlockages: " << " " << segment << endl; if ( segment->isLocal() ) { success = Manipulator(segment,*this).pivotUp(); if ( not success ) { - ltrace(200) << "Tightly constrained local segment overlapping a blockage, move up." << endl; - ltrace(200) << segment << endl; + cdebug.log(159) << "Tightly constrained local segment overlapping a blockage, move up." << endl; + cdebug.log(159) << segment << endl; success = Manipulator(segment,*this).moveUp (Manipulator::AllowLocalMoveUp|Manipulator::AllowTerminalMoveUp); } @@ -920,7 +918,7 @@ namespace Kite { if ( other->getNet() == segment->getNet() ) continue; if ( not otherOverlap.intersect(overlap) ) continue; - ltrace(200) << "| " << begin << " Blockage conflict: " << " " << other << endl; + cdebug.log(159) << "| " << begin << " Blockage conflict: " << " " << other << endl; if ( (success = Manipulator(segment,*this).relax (otherOverlap,Manipulator::NoDoglegReuse|Manipulator::NoExpand)) ) { break; @@ -930,25 +928,24 @@ namespace Kite { if ( not success ) { cparanoid << Error( "Tighly constrained segment overlapping a blockage:\n %s" , getString(segment).c_str() ) << endl; - ltrace(200) << "Segment is hard blocked, bypass to Unimplemented." << endl; + cdebug.log(159) << "Segment is hard blocked, bypass to Unimplemented." << endl; } - ltraceout(200); + cdebug.tabw(159,-1); return success; } bool SegmentFsm::desaturate () { - ltrace(200) << "SegmentFsm::desaturate()" << endl; - ltracein(200); + cdebug.log(159,1) << "SegmentFsm::desaturate()" << endl; size_t itrack = 0; #if THIS_IS_DISABLED TrackElement* segment = _event->getSegment(); for ( ; itrackgetSegment(i); - ltrace(200) << "* Looking // " << segment2 << endl; + cdebug.log(159) << "* Looking // " << segment2 << endl; if ( segment2->getNet() == ownerNet ) continue; if ( not toFree.intersect(segment2->getCanonicalInterval()) ) continue; @@ -972,12 +969,12 @@ namespace Kite { DataNegociate* data2 = segment2->getDataNegociate(); if ( not data2 ) { - ltrace(200) << "No DataNegociate, ignoring." << endl; + cdebug.log(159) << "No DataNegociate, ignoring." << endl; success = false; continue; } - ltrace(200) << "- Forced moveUp " << segment2 << endl; + cdebug.log(159) << "- Forced moveUp " << segment2 << endl; if ( not (success=Manipulator(segment2,*this).moveUp(Manipulator::AllowTerminalMoveUp)) ) { continue; } @@ -995,7 +992,7 @@ namespace Kite { } #endif - ltraceout(200); + cdebug.tabw(159,-1); return (itrack < _costs.size()); } @@ -1003,7 +1000,7 @@ namespace Kite { bool SegmentFsm::_slackenStrap ( TrackElement*& segment, DataNegociate*& data, unsigned int flags ) { - ltrace(200) << "Strap segment Fsm." << endl; + cdebug.log(159) << "Strap segment Fsm." << endl; bool success = false; unsigned int nextState = data->getState(); @@ -1035,7 +1032,7 @@ namespace Kite { if (not (flags&NoTransition)) { data->setState( nextState ); - ltrace(200) << "Incrementing state (after): " << nextState << " count:" << data->getStateCount() << endl; + cdebug.log(159) << "Incrementing state (after): " << nextState << " count:" << data->getStateCount() << endl; } return success; @@ -1044,7 +1041,7 @@ namespace Kite { bool SegmentFsm::_slackenLocal ( TrackElement*& segment, DataNegociate*& data, unsigned int flags ) { - ltrace(200) << "Local segment Fsm." << endl; + cdebug.log(159) << "Local segment Fsm." << endl; bool success = false; unsigned int nextState = data->getState(); @@ -1056,7 +1053,7 @@ namespace Kite { if (success) break; case DataNegociate::Minimize: if (isFullBlocked() and not segment->isTerminal()) { - ltrace(200) << "Is Fully blocked." << endl; + cdebug.log(159) << "Is Fully blocked." << endl; nextState = DataNegociate::Unimplemented; break; } @@ -1112,7 +1109,7 @@ namespace Kite { if (not (flags&NoTransition)) { data->setState( nextState ); - ltrace(200) << "Incrementing state (after): " << nextState << " count:" << data->getStateCount() << endl; + cdebug.log(159) << "Incrementing state (after): " << nextState << " count:" << data->getStateCount() << endl; } return success; @@ -1128,17 +1125,17 @@ namespace Kite { case DataNegociate::RipupPerpandiculars: case DataNegociate::Minimize: case DataNegociate::Dogleg: - ltrace(200) << "Global, SegmentFsm: RipupPerpandiculars." << endl; + cdebug.log(159) << "Global, SegmentFsm: RipupPerpandiculars." << endl; nextState = DataNegociate::Slacken; break; case DataNegociate::Slacken: - ltrace(200) << "Global, SegmentFsm: Slacken." << endl; + cdebug.log(159) << "Global, SegmentFsm: Slacken." << endl; if ((success = Manipulator(segment,*this).slacken(KbHalfSlacken))) { nextState = DataNegociate::RipupPerpandiculars; break; } case DataNegociate::MoveUp: - ltrace(200) << "Global, SegmentFsm: MoveUp." << endl; + cdebug.log(159) << "Global, SegmentFsm: MoveUp." << endl; if ((success = Manipulator(segment,*this).moveUp(Manipulator::AllowShortPivotUp))) { break; } @@ -1146,9 +1143,9 @@ namespace Kite { break; case DataNegociate::ConflictSolveByHistory: case DataNegociate::ConflictSolveByPlaceds: - ltrace(200) << "Global, SegmentFsm: ConflictSolveByHistory or ConflictSolveByPlaceds." << endl; + cdebug.log(159) << "Global, SegmentFsm: ConflictSolveByHistory or ConflictSolveByPlaceds." << endl; if ((success = conflictSolveByPlaceds())) { - if (segment->canMoveUp(1.0)) + if (segment->canMoveUp(1.0,Katabatic::KbCheckLowDensity)) nextState = DataNegociate::MoveUp; else { if (data->getStateCount() > 3) @@ -1163,7 +1160,7 @@ namespace Kite { break; } case DataNegociate::Unimplemented: - ltrace(200) << "Global, SegmentFsm: MaximumSlack or Unimplemented." << endl; + cdebug.log(159) << "Global, SegmentFsm: MaximumSlack or Unimplemented." << endl; nextState = DataNegociate::Unimplemented; break; } @@ -1183,12 +1180,12 @@ namespace Kite { if (not (flags&NoTransition)) { if (data->getChildSegment()) { TrackElement* child = segment; - ltrace(200) << "Incrementing state of childs (after): " << endl; + cdebug.log(159) << "Incrementing state of childs (after): " << endl; while ( child ) { - ltrace(200) << "| " << child << endl; + cdebug.log(159) << "| " << child << endl; if (child->base()->isGlobal()) { child->getDataNegociate()->setState( nextState ); - ltrace(200) << "| Update:" << nextState << " count:" << child->getDataNegociate()->getStateCount() << endl; + cdebug.log(159) << "| Update:" << nextState << " count:" << child->getDataNegociate()->getStateCount() << endl; } TrackElement* parent = child; child = parent->getDataNegociate()->getChildSegment(); @@ -1196,8 +1193,8 @@ namespace Kite { } } else { data->setState( nextState ); - ltrace(200) << "Incrementing state (after): " << segment << endl; - ltrace(200) << "| " << nextState << " count:" << data->getStateCount() << endl; + cdebug.log(159) << "Incrementing state (after): " << segment << endl; + cdebug.log(159) << "| " << nextState << " count:" << data->getStateCount() << endl; } } @@ -1212,12 +1209,11 @@ namespace Kite { DataNegociate* data = segment->getDataNegociate (); unsigned int actionFlags = SegmentAction::SelfInsert|SegmentAction::EventLevel5; - DebugSession::open( segment->getNet(), 200 ); - ltrace(200) << "Slacken Topology for " << segment->getNet() - << " " << segment << endl; - ltracein(200); + DebugSession::open( segment->getNet(), 150, 160 ); + cdebug.log(159,1) << "Slacken Topology for " << segment->getNet() + << " " << segment << endl; - if (not segment or not data) { ltraceout(200); DebugSession::close(); return false; } + if (not segment or not data) { cdebug.tabw(159,-1); DebugSession::close(); return false; } _event->resetInsertState(); data->resetRipupCount(); @@ -1236,7 +1232,7 @@ namespace Kite { } } - ltraceout(200); + cdebug.tabw(159,-1); DebugSession::close(); return success; diff --git a/kite/src/Session.cpp b/kite/src/Session.cpp index 4ed63a37..bfd75940 100644 --- a/kite/src/Session.cpp +++ b/kite/src/Session.cpp @@ -1,7 +1,7 @@ // -*- mode: C++; explicit-buffer-name: "Session.cpp" -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -14,14 +14,14 @@ // +-----------------------------------------------------------------+ -#include "hurricane/Bug.h" -#include "hurricane/Point.h" -#include "hurricane/Error.h" -#include "katabatic/GCellGrid.h" -#include "kite/Session.h" -#include "kite/Track.h" -#include "kite/TrackElement.h" -#include "kite/KiteEngine.h" +#include "hurricane/Bug.h" +#include "hurricane/Point.h" +#include "hurricane/Error.h" +#include "katabatic/GCellGrid.h" +#include "kite/Session.h" +#include "kite/Track.h" +#include "kite/TrackElement.h" +#include "kite/KiteEngine.h" namespace { @@ -42,9 +42,6 @@ namespace Kite { using std::cerr; using std::endl; using Hurricane::tab; - using Hurricane::inltrace; - using Hurricane::ltracein; - using Hurricane::ltraceout; using Hurricane::Error; using Hurricane::Bug; using Hurricane::Point; @@ -78,7 +75,7 @@ namespace Kite { Session* Session::open ( KiteEngine* kite ) { - ltrace(110) << "Kite::Session::open()" << endl; + cdebug.log(159) << "Kite::Session::open()" << endl; Session* session = Session::get(); if (session) { @@ -135,11 +132,8 @@ namespace Kite { { return _getKiteEngine()->getGCellGrid()->getGCell(Point(x,y)); }; - size_t Session::_revalidate () + void Session::_doRemovalEvents () { - ltrace(90) << "Kite::Session::_revalidate()" << endl; - ltracein(90); - set packTracks; for ( size_t i=0 ; i<_removeEvents.size() ; ++i ) { @@ -152,6 +146,14 @@ namespace Kite { for ( set::iterator it=packTracks.begin() ; it != packTracks.end() ; ++it ) (*it)->doRemoval(); + } + + + size_t Session::_revalidate () + { + cdebug.log(159,1) << "Kite::Session::_revalidate()" << endl; + + _doRemovalEvents(); for ( size_t i=0 ; i<_insertEvents.size() ; ++i ) { if (_insertEvents[i]._segment) { @@ -166,7 +168,7 @@ namespace Kite { set::const_iterator idestroyed = destroyeds.begin(); for ( ; idestroyed != destroyeds.end() ; ++idestroyed ) { if (lookup(*idestroyed)) { - ltraceout(90); + cdebug.tabw(155,-1); throw Error( "Destroyed AutoSegment is associated with a TrackSegment\n" " (%s)" , getString(*idestroyed).c_str()); @@ -194,10 +196,10 @@ namespace Kite { # if defined(CHECK_DATABASE) unsigned int overlaps = 0; # endif - for ( set::iterator it=_sortEvents.begin() ; it!=_sortEvents.end() ; ++it ) { - (*it)->doReorder(); + for ( Track* track : _sortEvents ) { + track->doReorder(); # if defined(CHECK_DATABASE) - (*it)->check( overlaps, "Session::_revalidate() - track sorting." ); + track->check( overlaps, "Session::_revalidate() - track sorting." ); # endif } @@ -227,7 +229,24 @@ namespace Kite { } #endif - ltraceout(90); + // Looking for reduced/raised segments. + for ( size_t i=0 ; icanReduce()) { + revalidateds[i]->reduce(); + TrackElement* trackSegment = lookup( revalidateds[i] ); + if (trackSegment->getTrack()) _addRemoveEvent( trackSegment ); + cdebug.log(159) << "Session: reduce:" << revalidateds[i] << endl; + } + if (revalidateds[i]->mustRaise()) { + revalidateds[i]->raise(); + lookup( revalidateds[i] )->reschedule( 0 ); + cdebug.log(159) << "Session: raise:" << revalidateds[i] << endl; + } + } + + _doRemovalEvents(); + + cdebug.tabw(159,-1); return count; } @@ -235,11 +254,17 @@ namespace Kite { bool Session::_isEmpty () const { if ( not _insertEvents.empty() or not _removeEvents.empty() or not _sortEvents.empty() ) { - cerr << Bug( " Session::checkEmpty() failed :\n" - " %u inserts, %u removes and %u sort events remains." + cerr << Bug( "Session::_isEmpty() failed :\n" + " %u inserts, %u removes and %u sort events remains." , _insertEvents.size() , _removeEvents.size() , _sortEvents .size() ) << endl; + if (not _sortEvents.empty()) { + cerr << " Remaining sort events on Tracks:" << endl; + for ( Track* track : _sortEvents ) { + cerr << " | " << track << endl; + } + } return false; } @@ -256,7 +281,7 @@ namespace Kite { void Session::_addInsertEvent ( TrackElement* segment, Track* track ) { - ltrace(200) << "addInsertEvent() " << segment + cdebug.log(159) << "addInsertEvent() " << segment << "\n @" << track << endl; if ( segment->getTrack() != NULL ) { @@ -282,7 +307,7 @@ namespace Kite { return; } - ltrace(200) << "Ripup: @" << DbU::getValueString(segment->getAxis()) << " " << segment << endl; + cdebug.log(159) << "Ripup: @" << DbU::getValueString(segment->getAxis()) << " " << segment << endl; _removeEvents.push_back( Event(segment,segment->getTrack()) ); _addSortEvent( segment->getTrack(), true ); } @@ -291,12 +316,12 @@ namespace Kite { void Session::_addMoveEvent ( TrackElement* segment, Track* track ) { if (not segment->getTrack()) { - cerr << Bug( " Kite::Session::addMoveEvent() : %s has no target Track." + cerr << Bug( " Kite::Session::addMoveEvent() : %s is not yet in a track." , getString(segment).c_str() ) << endl; - return; + } else { + _addRemoveEvent( segment ); } - _addRemoveEvent( segment ); _addInsertEvent( segment, track ); } diff --git a/kite/src/Track.cpp b/kite/src/Track.cpp index 6d5eefb9..8f4740ed 100644 --- a/kite/src/Track.cpp +++ b/kite/src/Track.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -54,9 +54,6 @@ namespace Kite { using std::sort; using Hurricane::dbo_ptr; using Hurricane::tab; - using Hurricane::inltrace; - using Hurricane::ltracein; - using Hurricane::ltraceout; using Hurricane::Warning; using Hurricane::Bug; using Hurricane::Layer; @@ -89,27 +86,26 @@ namespace Kite { Track::~Track () - { ltrace(90) << "Track::~Track() - " << (void*)this << endl; } + { cdebug.log(155) << "Track::~Track() - " << (void*)this << endl; } void Track::_preDestroy () { - ltrace(90) << "Track::_preDestroy() - " << (void*)this << " " << this << endl; - ltracein(90); + cdebug.log(155,1) << "Track::_preDestroy() - " << (void*)this << " " << this << endl; for ( size_t i=0 ; i<_segments.size() ; i++ ) - if (_segments[i]) _segments[i]->detach(); + if (_segments[i]) { _segments[i]->detach(); _segments[i]->destroy(); } for ( size_t i=0 ; i<_markers.size() ; i++ ) if (_markers[i]) _markers[i]->destroy(); - ltraceout(90); + cdebug.tabw(155,-1); } void Track::destroy () { - ltrace(90) << "Track::destroy() - " << (void*)this << " " << this << endl; + cdebug.log(155) << "Track::destroy() - " << (void*)this << " " << this << endl; Track::_preDestroy(); delete this; @@ -176,7 +172,7 @@ namespace Kite { TrackElement* Track::getPrevious ( size_t& index, Net* net ) const { for ( index-- ; index != npos ; index-- ) { - if (inltrace(148)) { + if (cdebug.enabled()) { cerr << tab << index << ":"; cerr.flush(); cerr << _segments[index] << endl; } @@ -234,14 +230,17 @@ namespace Kite { // I guess this has been written for the case of overlapping segments from the same // net, we find the first one of the overlapped sets. But what if they are not overlapping // but still from the same net? - if (begin < _segments.size()) - for ( ; (begin > 0) and (_segments[begin-1]->getNet() == _segments[begin]->getNet()) ; --begin ); + size_t sameNetDelta = 0; + if (begin < _segments.size()) { + for ( ; (begin > 0) and (_segments[begin-1]->getNet() == _segments[begin]->getNet()) + ; --begin, ++sameNetDelta ); + } state = 0; if ( (begin == 0) and (position < _segments[0]->getSourceU()) ) { state = BeforeFirstElement; } else { - if (begin) begin -= 1; + if (begin and not sameNetDelta) begin -= 1; size_t usedBegin = begin; Interval usedInterval = getOccupiedInterval( usedBegin ); @@ -272,9 +271,11 @@ namespace Kite { getOccupiedInterval( begin ); getBeginIndex( interval.getVMax(), end, iState ); - while ( end < _segments.size() ) { - if (_segments[end++]->getSourceU() >= interval.getVMax()) break; + for ( ; end < _segments.size() ; ++end ) { + if (_segments[end]->getSourceU() >= interval.getVMax()) break; } + + cdebug.log(159) << "Track::getOverlapBounds(): begin:" << begin << " end:" << end << endl; } @@ -286,13 +287,11 @@ namespace Kite { { TrackCost cost ( const_cast(this), interval, begin, end, net, flags ); - ltrace(190) << "getOverlapCost() @" << DbU::getValueString(_axis) - << " [" << DbU::getValueString(interval.getVMin()) - << ":" << DbU::getValueString(interval.getVMax()) - << "] <-> [" << begin << ":" << end << "]" - << endl; - - ltracein(148); + cdebug.log(159,1) << "getOverlapCost() @" << DbU::getValueString(_axis) + << " [" << DbU::getValueString(interval.getVMin()) + << ":" << DbU::getValueString(interval.getVMax()) + << "] <-> [" << begin << ":" << end << "]" + << endl; vector::const_iterator lowerBound = lower_bound( _markers.begin(), _markers.end(), interval.getVMin(), TrackMarker::Compare() ); @@ -300,16 +299,16 @@ namespace Kite { for ( ; (mbegin < _markers.size()) and (_markers[mbegin]->getSourceU() <= interval.getVMax()) ; mbegin++ ) { - ltrace(148) << "| @" << DbU::getValueString(_axis) << _markers[mbegin] << endl; + cdebug.log(159) << "| @" << DbU::getValueString(_axis) << _markers[mbegin] << endl; if ( _markers[mbegin]->getNet() != net ) { - ltrace(148) << "* Mark: @" << DbU::getValueString(_axis) << " " << _markers[mbegin] << endl; + cdebug.log(159) << "* Mark: @" << DbU::getValueString(_axis) << " " << _markers[mbegin] << endl; cost.incTerminals( _markers[mbegin]->getWeight(this) ); } } if (begin == npos) { - ltrace(148) << " begin == npos (after last TrackElement)." << endl; - ltraceout(148); + cdebug.log(159) << " begin == npos (after last TrackElement)." << endl; + cdebug.tabw(159,-1); return cost; } @@ -318,12 +317,12 @@ namespace Kite { if ( _segments[begin]->getNet() == net ) { cost.incDeltaShared ( overlap.getSize() ); } - ltrace(190) << "| overlap: " << _segments[begin] << endl; + cdebug.log(159) << "| overlap: " << _segments[begin] << endl; _segments[begin]->incOverlapCost( net, cost ); if (cost.isInfinite()) break; } - ltraceout(148); + cdebug.tabw(159,-1); return cost; } @@ -346,9 +345,8 @@ namespace Kite { void Track::getTerminalWeight ( Interval interval, Net* net, size_t& count, unsigned int& weight ) const { - ltrace(148) << "getTerminalWeight() @" << DbU::getValueString(_axis) - << " [" << interval.getVMin() << " " << interval.getVMax() << "]" << endl; - ltracein(148); + cdebug.log(159,1) << "getTerminalWeight() @" << DbU::getValueString(_axis) + << " [" << interval.getVMin() << " " << interval.getVMax() << "]" << endl; //count = 0; //weight = 0; @@ -359,14 +357,14 @@ namespace Kite { for ( ; (mbegin < _markers.size()) && (_markers[mbegin]->getSourceU() <= interval.getVMax()) ; mbegin++ ) { - ltrace(148) << "| @" << DbU::getValueString(_axis) << _markers[mbegin] << endl; + cdebug.log(159) << "| @" << DbU::getValueString(_axis) << _markers[mbegin] << endl; if ( _markers[mbegin]->getNet() == net ) { - ltrace(200) << "* Mark: @" << DbU::getValueString(_axis) << " " << _markers[mbegin] << endl; + cdebug.log(159) << "* Mark: @" << DbU::getValueString(_axis) << " " << _markers[mbegin] << endl; weight += _markers[mbegin]->getWeight(this); ++count; } } - ltraceout(148); + cdebug.tabw(159,-1); } @@ -452,9 +450,9 @@ namespace Kite { void Track::insert ( TrackElement* segment ) { - // ltrace(500) << "Deter| Track::insert() " << getLayer()->getName() + // cdebug.log(9000) << "Deter| Track::insert() " << getLayer()->getName() // << " @" << DbU::getValueString(getAxis()) << " " << segment << endl; - ltrace(200) << "Track::insert() " << getLayer()->getName() + cdebug.log(159) << "Track::insert() " << getLayer()->getName() << " @" << DbU::getValueString(getAxis()) << " " << segment << endl; if ( (getLayer()->getMask() != segment->getLayer()->getMask()) @@ -484,7 +482,7 @@ namespace Kite { bool holes = false; if (message) cerr << " o Checking Track - " << message << endl; - ltrace(90) << (void*)this << ":" << this << endl; + cdebug.log(155) << (void*)this << ":" << this << endl; for ( size_t i=0 ; i<_segments.size() ; i++ ) { if (_segments[i]) { @@ -625,8 +623,7 @@ namespace Kite { size_t Track::doRemoval () { - ltrace(148) << "Track::doRemoval() - " << this << endl; - ltracein(148); + cdebug.log(159,1) << "Track::doRemoval() - " << this << endl; size_t size = _segments.size(); @@ -635,8 +632,8 @@ namespace Kite { _segments.erase( beginRemove, _segments.end() ); - ltrace(148) << "After doRemoval " << this << endl; - ltraceout(148); + cdebug.log(159) << "After doRemoval " << this << endl; + cdebug.tabw(159,-1); return size - _segments.size(); } @@ -644,7 +641,7 @@ namespace Kite { void Track::doReorder () { - ltrace(200) << "Track::doReorder() " << this << endl; + cdebug.log(159) << "Track::doReorder() " << this << endl; if (not _segmentsValid ) { std::sort ( _segments.begin(), _segments.end(), SegmentCompare() ); diff --git a/kite/src/TrackCost.cpp b/kite/src/TrackCost.cpp index dc78f751..be81dcee 100644 --- a/kite/src/TrackCost.cpp +++ b/kite/src/TrackCost.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -31,6 +31,34 @@ namespace Kite { // ------------------------------------------------------------------- // Class : "TrackCost". + TrackCost::TrackCost ( Track* track, Net* net ) + : _flags (ZeroCost) + , _track (track) + , _begin (Track::npos) + , _end (Track::npos) + , _interval () + , _forGlobal (false) + , _blockage (false) + , _fixed (false) + , _infinite (false) + , _hardOverlap (false) + , _overlap (false) + , _leftOverlap (false) + , _rightOverlap (false) + , _overlapGlobal (false) + , _globalEnclosed (false) + , _terminals (0) + , _delta (0) + , _deltaShared (0) + , _deltaPerpand (0) + , _axisWeight (0) + , _distanceToFixed(2*Session::getSliceHeight()) + , _longuestOverlap(0) + , _dataState (0) + , _ripupCount (0) + { } + + TrackCost::TrackCost ( Track* track , const Interval& interval , size_t begin @@ -94,7 +122,6 @@ namespace Kite { } } - TrackCost::~TrackCost () { } @@ -139,6 +166,19 @@ namespace Kite { if ( lhs._delta > rhs._delta ) return false; } +#if 0 + DbU::Unit lhsMixedWeight = 0.5*lhs._deltaPerpand; + DbU::Unit rhsMixedWeight = 0.5*rhs._deltaPerpand; + + if ( not (_flags & TrackCost::IgnoreAxisWeight) ) { + lhsMixedWeight += lhsMixedWeight; + rhsMixedWeight += rhsMixedWeight; + } + + if (lhsMixedWeight < rhsMixedWeight) return true; + if (lhsMixedWeight > rhsMixedWeight) return false; +#endif + if ( not (_flags & TrackCost::IgnoreAxisWeight) ) { if ( lhs._axisWeight < rhs._axisWeight ) return true; if ( lhs._axisWeight > rhs._axisWeight ) return false; diff --git a/kite/src/TrackElement.cpp b/kite/src/TrackElement.cpp index fb3cee5b..3a2a19e4 100644 --- a/kite/src/TrackElement.cpp +++ b/kite/src/TrackElement.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -52,9 +52,6 @@ namespace { namespace Kite { - using Hurricane::inltrace; - using Hurricane::ltracein; - using Hurricane::ltraceout; using Hurricane::tab; using Hurricane::Bug; using Hurricane::Net; @@ -104,7 +101,7 @@ namespace Kite { TrackElement* segment = getOwner(); if (flags & AutoSegment::Invalidate) { if (not segment->isInvalidated()) { - ltrace(200) << "::notify() on " << segment << endl; + cdebug.log(159) << "::notify() on " << segment << endl; segment->invalidate(); } } @@ -112,7 +109,7 @@ namespace Kite { if (flags & AutoSegment::Revalidate) { // Revalidation must be delayed until *all* the AutoSegments have been revalidated. // if (segment->isInvalidated()) { - // ltrace(200) << "::notify() on " << segment << endl; + // cdebug.log(159) << "::notify() on " << segment << endl; // segment->revalidate( true ); // } } @@ -149,7 +146,8 @@ namespace Kite { bool TrackElement::isStrap () const { return false; } bool TrackElement::isSlackened () const { return false; } bool TrackElement::isDogleg () const { return false; } - bool TrackElement::isSameLayerDogleg () const { return false; } + bool TrackElement::isReduced () const { return false; } + bool TrackElement::isUTurn () const { return false; } bool TrackElement::isUserDefined () const { return false; } // Predicates. bool TrackElement::canSlacken () const { return false; } diff --git a/kite/src/TrackElements.cpp b/kite/src/TrackElements.cpp index 3ef8d438..e9091b12 100644 --- a/kite/src/TrackElements.cpp +++ b/kite/src/TrackElements.cpp @@ -25,9 +25,6 @@ namespace Kite { using namespace std; using Hurricane::tab; - using Hurricane::inltrace; - using Hurricane::ltracein; - using Hurricane::ltraceout; using Hurricane::ForEachIterator; using Hurricane::Interval; using Hurricane::Bug; @@ -42,8 +39,8 @@ namespace Kite { , _locator (segment->base()) , _element (NULL) { - ltrace(80) << "TrackElements_Perpandiculars::Locator::Locator()" << endl; - ltrace(80) << " " << segment << endl; + cdebug.log(155) << "TrackElements_Perpandiculars::Locator::Locator()" << endl; + cdebug.log(155) << " " << segment << endl; Interval bounds; if ( _locator.isValid() ) { @@ -62,7 +59,7 @@ namespace Kite { void TrackElements_Perpandiculars::Locator::progress () { - ltrace(80) << "TrackElements_Perpandiculars::Locator::progress()" << endl; + cdebug.log(155) << "TrackElements_Perpandiculars::Locator::progress()" << endl; Interval bounds; while ( _locator.isValid() ) { diff --git a/kite/src/TrackFixedSegment.cpp b/kite/src/TrackFixedSegment.cpp index 661cfa1a..5c51bf43 100644 --- a/kite/src/TrackFixedSegment.cpp +++ b/kite/src/TrackFixedSegment.cpp @@ -1,15 +1,14 @@ - // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2013, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | // | K i t e - D e t a i l e d R o u t e r | // | | // | Author : Jean-Paul CHAPUT | -// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Module : "./TrackFixedSegment.cpp" | // +-----------------------------------------------------------------+ @@ -41,9 +40,6 @@ namespace Kite { using namespace std; - using Hurricane::inltrace; - using Hurricane::ltracein; - using Hurricane::ltraceout; using Hurricane::tab; using Hurricane::Warning; using Hurricane::ForEachIterator; @@ -120,12 +116,13 @@ namespace Kite { _sourceU = max( boundingBox.getYMin(), uside.getVMin()); _targetU = min( boundingBox.getYMax(), uside.getVMax()); - Katabatic::GCell* gcell = track->getKiteEngine()->getGCellGrid()->getGCell( Point(track->getAxis(),_sourceU) ); - Katabatic::GCell* end = track->getKiteEngine()->getGCellGrid()->getGCell( Point(track->getAxis(),_targetU) ); - Katabatic::GCell* up = NULL; - Interval guside = gcell->getSide( KbVertical ); - Interval segside ( boundingBox.getYMin(), boundingBox.getYMax() ); + Katabatic::GCell* gcell = track->getKiteEngine()->getGCellGrid()->getGCell( Point(track->getAxis(),_sourceU) ); if (gcell) { + Katabatic::GCell* end = track->getKiteEngine()->getGCellGrid()->getGCell( Point(track->getAxis(),_targetU) ); + Katabatic::GCell* up = NULL; + Interval guside = gcell->getSide( KbVertical ); + Interval segside ( boundingBox.getYMin(), boundingBox.getYMax() ); + while ( gcell and (gcell != end) ) { up = gcell->getUp(); if (up == NULL) break; @@ -162,7 +159,7 @@ namespace Kite { void TrackFixedSegment::_preDestroy () { - ltrace(90) << "TrackFixedSegment::_preDestroy() - " << (void*)this << endl; + cdebug.log(155) << "TrackFixedSegment::_preDestroy() - " << (void*)this << endl; TrackElement::_preDestroy(); } @@ -176,8 +173,8 @@ namespace Kite { trackFixedSegment = new TrackFixedSegment ( track, segment ); trackFixedSegment->_postCreate(); - ltrace(190) << "Adding: " << segment << " on " << track << endl; - ltrace(200) << "TrackFixedSegment::create(): " << trackFixedSegment << endl; + cdebug.log(159) << "Adding: " << segment << " on " << track << endl; + cdebug.log(159) << "TrackFixedSegment::create(): " << trackFixedSegment << endl; Session::addInsertEvent( trackFixedSegment, track ); } diff --git a/kite/src/TrackMarker.cpp b/kite/src/TrackMarker.cpp index 2d20dc6f..ffaa3b49 100644 --- a/kite/src/TrackMarker.cpp +++ b/kite/src/TrackMarker.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/kite/src/TrackSegment.cpp b/kite/src/TrackSegment.cpp index cbbcea47..ca628e34 100644 --- a/kite/src/TrackSegment.cpp +++ b/kite/src/TrackSegment.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -18,6 +18,7 @@ #include #include "hurricane/Bug.h" #include "hurricane/Warning.h" +#include "hurricane/BasicLayer.h" #include "hurricane/Net.h" #include "hurricane/Name.h" #include "hurricane/RoutingPad.h" @@ -36,13 +37,11 @@ namespace Kite { using namespace std; - using Hurricane::inltrace; - using Hurricane::ltracein; - using Hurricane::ltraceout; using Hurricane::tab; using Hurricane::ForEachIterator; using Hurricane::Bug; using Hurricane::Error; + using Hurricane::BasicLayer; using Hurricane::Net; using Hurricane::Name; using Hurricane::RoutingPad; @@ -67,8 +66,8 @@ namespace Kite { , _data (NULL) , _dogLegLevel (0) { - ltrace(99) << "CTOR TrackSegment " << (void*)this << ":" << this << endl; - ltrace(99) << " over " << (void*)segment << ":" << segment << endl; + cdebug.log(155) << "CTOR TrackSegment " << (void*)this << ":" << this << endl; + cdebug.log(155) << " over " << (void*)segment << ":" << segment << endl; setFlags( TElemCreated|TElemLocked ); if (segment) { @@ -98,10 +97,26 @@ namespace Kite { void TrackSegment::_preDestroy () { - ltrace(90) << "TrackSegment::_preDestroy() - " << (void*)this + cdebug.log(155) << "TrackSegment::_preDestroy() - " << (void*)this << " [" << (void*)_base << ", " << (void*)(_base?_base->base():NULL) << "]" << endl; + DbU::Unit length = base()->getLength(); + if ( (length > 0) and (length < getPPitch()) ) { + BasicLayer* layer = getLayer()->getBasicLayers().getFirst(); + DbU::Unit width = base()->getWidth(); + Contact* source = base()->getAutoSource()->base(); + Contact* target = base()->getAutoTarget()->base(); + if (isHorizontal()) { + width = std::max( width, source->getBoundingBox(layer).getHeight() ); + width = std::max( width, target->getBoundingBox(layer).getHeight() ); + } else { + width = std::max( width, source->getBoundingBox(layer).getWidth() ); + width = std::max( width, target->getBoundingBox(layer).getWidth() ); + } + base()->base()->setWidth( width ); + } + base()->removeObserver( getObserver() ); TrackElement::_preDestroy(); } @@ -119,7 +134,7 @@ namespace Kite { trackSegment->invalidate(); - ltrace(200) << "TrackSegment::create(): " << trackSegment << endl; + cdebug.log(159) << "TrackSegment::create(): " << trackSegment << endl; trackElement = trackSegment; } @@ -141,8 +156,9 @@ namespace Kite { bool TrackSegment::isStrap () const { return _base->isStrap(); } bool TrackSegment::isSlackened () const { return _base->isSlackened(); } bool TrackSegment::isDogleg () const { return _base->isDogleg(); } - bool TrackSegment::isSameLayerDogleg () const { return _base->isSameLayerDogleg(); } + bool TrackSegment::isReduced () const { return _base->isReduced(); } bool TrackSegment::isUserDefined () const { return _base->isUserDefined(); } + bool TrackSegment::isUTurn () const { return _base->isUTurn(); } // Predicates. // Accessors. unsigned long TrackSegment::getId () const { return _base->getId(); } @@ -213,22 +229,22 @@ namespace Kite { Katabatic::GCell* sourceGCell = base()->getAutoSource()->getGCell(); Katabatic::GCell* targetGCell = base()->getAutoTarget()->getGCell(); - ltrace(148) << "getGCells(): sourceGCell: " << sourceGCell << endl; - ltrace(148) << "getGCells(): targetGCell: " << targetGCell << endl; + cdebug.log(159) << "getGCells(): sourceGCell: " << sourceGCell << endl; + cdebug.log(159) << "getGCells(): targetGCell: " << targetGCell << endl; for( AutoSegment* segment : base()->getAligneds() ) { - ltrace(148) << "| " << segment << endl; + cdebug.log(159) << "| " << segment << endl; Katabatic::GCell* gcell = segment->getAutoSource()->getGCell(); if (gcell->getIndex() < sourceGCell->getIndex()) { sourceGCell = gcell; - ltrace(148) << "getGCells(): new sourceGCell: " << sourceGCell << endl; + cdebug.log(159) << "getGCells(): new sourceGCell: " << sourceGCell << endl; } gcell = segment->getAutoTarget()->getGCell(); if (gcell->getIndex() > targetGCell->getIndex()) { targetGCell = gcell; - ltrace(148) << "getGCells(): new targetGCell: " << targetGCell << endl; + cdebug.log(159) << "getGCells(): new targetGCell: " << targetGCell << endl; } } @@ -304,7 +320,7 @@ namespace Kite { void TrackSegment::detach () { - ltrace(200) << "TrackSegment::detach() - " << endl; + cdebug.log(159) << "TrackSegment::detach() - " << endl; setTrack( NULL ); setIndex( (size_t)-1 ); @@ -315,7 +331,7 @@ namespace Kite { void TrackSegment::revalidate () { unsetFlags( TElemCreated ); - ltrace(148) << "revalidate() - " << this << endl; + cdebug.log(159) << "revalidate() - " << this << endl; _base->getCanonical( _sourceU, _targetU ); @@ -335,7 +351,7 @@ namespace Kite { { if (not other) return; - ltrace(200) << "TrackSegment::swapTrack()" << endl; + cdebug.log(159) << "TrackSegment::swapTrack()" << endl; size_t thisIndex = getIndex (); Track* thisTrack = getTrack (); @@ -368,15 +384,14 @@ namespace Kite { if (thisEvent ) thisEvent ->setSegment( other ); if (otherEvent) otherEvent->setSegment( this ); - ltrace(200) << "| this: " << this << endl; - ltrace(200) << "| other: " << other << endl; + cdebug.log(159) << "| this: " << this << endl; + cdebug.log(159) << "| other: " << other << endl; } void TrackSegment::reschedule ( unsigned int level ) { - ltrace(200) << "TrackSegment::reschedule() - " << this << endl; - ltracein(200); + cdebug.log(159,1) << "TrackSegment::reschedule() - " << this << endl; if (not _data or not _data->hasRoutingEvent()) Session::getNegociateWindow()->addRoutingEvent( this, level ); @@ -386,7 +401,7 @@ namespace Kite { Session::getNegociateWindow()->rescheduleEvent( _data->getRoutingEvent(), level ); } - ltraceout(200); + cdebug.tabw(159,-1); } @@ -408,13 +423,13 @@ namespace Kite { bool TrackSegment::canSlacken () const { - ltrace(200) << "TrackSegment::canSlacken() doglegLevel:" << getDoglegLevel() << endl; + cdebug.log(159) << "TrackSegment::canSlacken() doglegLevel:" << getDoglegLevel() << endl; return (not isSlackened() and (getDoglegLevel() <= 3)) ? _base->canSlacken(KbPropagate) : false; } bool TrackSegment::slacken ( unsigned int flags ) { - ltrace(200) << "TrackSegment::slacken()" << endl; + cdebug.log(159) << "TrackSegment::slacken()" << endl; bool success = false; @@ -422,12 +437,12 @@ namespace Kite { TrackElement* perpandicular = NULL; TrackElement* parallel = NULL; - ltracein(200); + cdebug.tabw(159,1); success = base()->slacken( flags|KbPropagate ); _postDoglegs( perpandicular, parallel ); - ltraceout(200); + cdebug.tabw(159,-1); return success; } else cerr << Bug("TrackSegment::slacken(): NULL base or already slackened.") << endl; @@ -440,8 +455,7 @@ namespace Kite { { bool success = false; - ltrace(200) << "TrackSegment::moveUp() " << flags << endl; - ltracein(200); + cdebug.log(159,1) << "TrackSegment::moveUp() " << flags << endl; success = base()->moveUp( flags ); if (success) { @@ -452,7 +466,7 @@ namespace Kite { _postDoglegs( perpandicular, parallel ); } - ltraceout(200); + cdebug.tabw(159,-1); return success; } @@ -462,8 +476,7 @@ namespace Kite { { bool success = false; - ltrace(200) << "TrackSegment::moveDown() " << flags << endl; - ltracein(200); + cdebug.log(159,1) << "TrackSegment::moveDown() " << flags << endl; success = base()->moveDown( flags ); if (success) { @@ -474,7 +487,7 @@ namespace Kite { _postDoglegs( perpandicular, parallel ); } - ltraceout(200); + cdebug.tabw(159,-1); return success; } @@ -484,13 +497,12 @@ namespace Kite { { bool success = true; - ltrace(200) << "TrackSegment::moveAside() - " - << ((flags&KtMoveToLeft )?"left" :"") - << ((flags&KtMoveToRight)?"rigth":"") << endl; - ltracein(200); + cdebug.log(159,1) << "TrackSegment::moveAside() - " + << ((flags&KtMoveToLeft )?"left" :"") + << ((flags&KtMoveToRight)?"rigth":"") << endl; if (flags & KtMoveToLeft ) base()->moveULeft (); if (flags & KtMoveToRight) base()->moveURight(); - ltraceout(200); + cdebug.tabw(159,-1); return success; } @@ -505,7 +517,7 @@ namespace Kite { for( Segment* segment : base()->getAutoSource()->getSlaveComponents().getSubSet() ) { dogleg = Session::lookup( segment ); if (dogleg and (dogleg->getDirection() == direction)) { - ltrace(200) << "Source dogleg: " << dogleg << endl; + cdebug.log(159) << "Source dogleg: " << dogleg << endl; return dogleg; } } @@ -522,7 +534,7 @@ namespace Kite { for( Segment* segment : base()->getAutoTarget()->getSlaveComponents().getSubSet() ) { dogleg = Session::lookup( segment ); if (dogleg and (dogleg->getDirection() == direction)) { - ltrace(200) << "Target dogleg: " << dogleg << endl; + cdebug.log(159) << "Target dogleg: " << dogleg << endl; return dogleg; } } @@ -532,35 +544,35 @@ namespace Kite { bool TrackSegment::canDogleg () { - ltrace(200) << "TrackSegment::canDogleg()" << endl; + cdebug.log(159) << "TrackSegment::canDogleg()" << endl; if (not isLocal()) { - ltrace(200) << "Failed: is not local." << endl; + cdebug.log(159) << "Failed: is not local." << endl; return false; } if (isFixed()) { - ltrace(200) << "Failed: is fixed." << endl; + cdebug.log(159) << "Failed: is fixed." << endl; return false; } if (isRouted()) { - ltrace(200) << "Failed: belongs to an already routed net." << endl; + cdebug.log(159) << "Failed: belongs to an already routed net." << endl; return false; } if (isSlackened()) { - ltrace(200) << "Failed: is local & slackened." << endl; + cdebug.log(159) << "Failed: is local & slackened." << endl; return false; } if (hasSourceDogleg() or hasTargetDogleg()) { - ltrace(200) << "Failed: already has source or target dogleg." << endl; + cdebug.log(159) << "Failed: already has source or target dogleg." << endl; return false; } if (getDoglegLevel() > 3) { - ltrace(200) << "Failed: maximum dogleg level reached (4)." << endl; + cdebug.log(159) << "Failed: maximum dogleg level reached (4)." << endl; return false; } @@ -570,51 +582,50 @@ namespace Kite { bool TrackSegment::canDogleg ( Katabatic::GCell* doglegGCell, unsigned int flags ) { - ltrace(200) << "TrackSegment::canDogleg(GCell*) " << doglegGCell << endl; - ltracein(200); + cdebug.log(159,1) << "TrackSegment::canDogleg(GCell*) " << doglegGCell << endl; if (doglegGCell->isUnderIoPad()) { - ltrace(200) << "false: Cannot dogleg in a GCell under an I/O Pad." << endl; - ltraceout(200); + cdebug.log(159) << "false: Cannot dogleg in a GCell under an I/O Pad." << endl; + cdebug.tabw(159,-1); return false; } if (isFixed()) { - ltrace(200) << "false: Cannot dogleg a fixed segment." << endl; - ltraceout(200); + cdebug.log(159) << "false: Cannot dogleg a fixed segment." << endl; + cdebug.tabw(159,-1); return false; } if (isRouted()) { - ltrace(200) << "false: Cannot dogleg a segment belonging to an already routed net." << endl; - ltraceout(200); + cdebug.log(159) << "false: Cannot dogleg a segment belonging to an already routed net." << endl; + cdebug.tabw(159,-1); return false; } if (isLocal()) { if (hasSourceDogleg() or hasTargetDogleg()) { - ltrace(200) << "false: Cannot dogleg again a local segment." << endl; - ltraceout(200); + cdebug.log(159) << "false: Cannot dogleg again a local segment." << endl; + cdebug.tabw(159,-1); return false; } if (isSlackened()) { - ltrace(200) << "false: Cannot dogleg a local slackened segment." << endl; - ltraceout(200); + cdebug.log(159) << "false: Cannot dogleg a local slackened segment." << endl; + cdebug.tabw(159,-1); return false; } } if (getDoglegLevel() > 3) { - ltrace(200) << "Failed: maximum dogleg level reached (4)." << endl; - ltraceout(200); + cdebug.log(159) << "Failed: maximum dogleg level reached (4)." << endl; + cdebug.tabw(159,-1); return false; } vector gcells; getGCells( gcells ); - ltrace(190) << "Source: " << *gcells.begin () << endl; - ltrace(190) << "Target: " << *gcells.rbegin() << endl; + cdebug.log(159) << "Source: " << *gcells.begin () << endl; + cdebug.log(159) << "Target: " << *gcells.rbegin() << endl; bool isGCellInside = false; for ( size_t igcell=0 ; igcell 3) { - ltrace(200) << "Failed: maximum dogleg level reached (4)." << endl; + cdebug.log(159) << "Failed: maximum dogleg level reached (4)." << endl; return false; } @@ -708,7 +719,7 @@ namespace Kite { DbU::Unit axis = (_base->isHorizontal()) ? source->getX() : source->getY(); - ltrace(200) << "Setting dogleg axis @" << DbU::getValueString(axis) << endl; + cdebug.log(159) << "Setting dogleg axis @" << DbU::getValueString(axis) << endl; dogleg->setAxis( axis ); } } @@ -721,8 +732,8 @@ namespace Kite { , TrackElement*& parallel ) { - ltrace(200) << "TrackSegment::makeDogleg(GCell*)" << endl; - ltrace(200) << "Break in: " << dogLegGCell << endl; + cdebug.log(159) << "TrackSegment::makeDogleg(GCell*)" << endl; + cdebug.log(159) << "Break in: " << dogLegGCell << endl; base()->makeDogleg( dogLegGCell ); _postDoglegs( perpandicular, parallel ); @@ -736,7 +747,7 @@ namespace Kite { TrackElement* perpandicular = NULL; TrackElement* parallel = NULL; - ltrace(200) << "TrackSegment::makeDogleg(Interval)" << endl; + cdebug.log(159) << "TrackSegment::makeDogleg(Interval)" << endl; flags = base()->makeDogleg( interval ); _postDoglegs( perpandicular, parallel ); @@ -746,8 +757,7 @@ namespace Kite { void TrackSegment::_postDoglegs ( TrackElement*& perpandicular, TrackElement*& parallel ) { - ltrace(200) << "TrackSegment::_postDoglegs()" << endl; - ltracein(200); + cdebug.log(159,1) << "TrackSegment::_postDoglegs()" << endl; unsigned int doglegLevel = 0; const vector& doglegs = Session::getDoglegs(); @@ -759,7 +769,7 @@ namespace Kite { , doglegs.size() ) << endl; for ( size_t i=0 ; icreateTrackSegment(doglegs[i],0) ); segments[i+0]->setFlags( TElemTargetDogleg ); segments[i+0]->getDataNegociate()->resetRipupCount(); @@ -768,12 +778,12 @@ namespace Kite { doglegLevel = segments[i+0]->getDoglegLevel(); segments[i+0]->setDoglegLevel( doglegLevel + (segments[i]->isLocal()?1:0) ); - ltrace(200) << "Looking up new perpand: " << doglegs[i+1] << endl; + cdebug.log(159) << "Looking up new perpand: " << doglegs[i+1] << endl; segments.push_back( Session::getNegociateWindow()->createTrackSegment(doglegs[i+1],0) ); segments[i+1]->setFlags( TElemSourceDogleg|TElemTargetDogleg ); segments[i+1]->setDoglegLevel( doglegLevel + 1 ); - ltrace(200) << "Looking up new parallel: " << doglegs[i+2] << endl; + cdebug.log(159) << "Looking up new parallel: " << doglegs[i+2] << endl; segments.push_back( Session::getNegociateWindow()->createTrackSegment(doglegs[i+2],0) ); segments[i+2]->setFlags( TElemSourceDogleg ); segments[i+2]->getDataNegociate()->resetStateCount(); @@ -799,14 +809,14 @@ namespace Kite { case 1: segPart = "perpand "; break; case 2: segPart = "new paral"; break; } - ltrace(200) << "[" << (i/3) << ":" << i << "] " << segPart << ": " + cdebug.log(159) << "[" << (i/3) << ":" << i << "] " << segPart << ": " << segments[i] << endl; } } else { reschedule( 1 ); } - ltraceout(200); + cdebug.tabw(159,-1); Session::doglegReset(); } diff --git a/kite/src/TrackSegment.cpp.OK b/kite/src/TrackSegment.cpp.OK new file mode 100644 index 00000000..ee0fec35 --- /dev/null +++ b/kite/src/TrackSegment.cpp.OK @@ -0,0 +1,898 @@ +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC 2008-2016, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | K i t e - D e t a i l e d R o u t e r | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Module : "./TrackSegment.cpp" | +// +-----------------------------------------------------------------+ + + +#include +#include +#include "hurricane/Bug.h" +#include "hurricane/Warning.h" +#include "hurricane/BasicLayer.h" +#include "hurricane/Net.h" +#include "hurricane/Name.h" +#include "hurricane/RoutingPad.h" +#include "katabatic/AutoContact.h" +#include "katabatic/GCell.h" +#include "crlcore/RoutingGauge.h" +#include "kite/DataNegociate.h" +#include "kite/TrackSegment.h" +#include "kite/Track.h" +#include "kite/Session.h" +#include "kite/RoutingEvent.h" +#include "kite/NegociateWindow.h" +#include "kite/KiteEngine.h" + + +namespace Kite { + + using namespace std; + using Hurricane::inltrace; + using Hurricane::ltracein; + using Hurricane::ltraceout; + using Hurricane::tab; + using Hurricane::ForEachIterator; + using Hurricane::Bug; + using Hurricane::Error; + using Hurricane::BasicLayer; + using Hurricane::Net; + using Hurricane::Name; + using Hurricane::RoutingPad; + using Katabatic::SegSlackened; + using Katabatic::KbPropagate; + +// ------------------------------------------------------------------- +// Class : "TrackSegment". + + size_t TrackSegment::_allocateds = 0; + + + size_t TrackSegment::getAllocateds () + { return _allocateds; } + + + TrackSegment::TrackSegment ( AutoSegment* segment, Track* track ) + : TrackElement (track) + , _base (segment) + , _freedomDegree(0) + , _ppitch (0) + , _data (NULL) + , _dogLegLevel (0) + { + ltrace(99) << "CTOR TrackSegment " << (void*)this << ":" << this << endl; + ltrace(99) << " over " << (void*)segment << ":" << segment << endl; + + setFlags( TElemCreated|TElemLocked ); + if (segment) { + _data = new DataNegociate( this ); + _base->getCanonical( _sourceU, _targetU ); + updateFreedomDegree(); + updatePPitch(); + } + + ++_allocateds; + } + + + void TrackSegment::_postCreate () + { + TrackElement::_postCreate(); + base()->addObserver( getObserver() ); + } + + + TrackSegment::~TrackSegment () + { + if (_data) delete _data; + --_allocateds; + } + + + void TrackSegment::_preDestroy () + { + ltrace(90) << "TrackSegment::_preDestroy() - " << (void*)this + << " [" << (void*)_base << ", " + << (void*)(_base?_base->base():NULL) << "]" << endl; + + DbU::Unit length = base()->getLength(); + if ( (length > 0) and (length < getPPitch()) ) { + BasicLayer* layer = getLayer()->getBasicLayers().getFirst(); + DbU::Unit width = base()->getWidth(); + Contact* source = base()->getAutoSource()->base(); + Contact* target = base()->getAutoTarget()->base(); + if (isHorizontal()) { + width = std::max( width, source->getBoundingBox(layer).getHeight() ); + width = std::max( width, target->getBoundingBox(layer).getHeight() ); + } else { + width = std::max( width, source->getBoundingBox(layer).getWidth() ); + width = std::max( width, target->getBoundingBox(layer).getWidth() ); + } + base()->base()->setWidth( width ); + } + + base()->removeObserver( getObserver() ); + TrackElement::_preDestroy(); + } + + + TrackElement* TrackSegment::create ( AutoSegment* segment, Track* track, bool& created ) + { + created = false; + + TrackElement* trackElement = Session::lookup( segment->base() ); + if (not trackElement) { + TrackSegment* trackSegment = new TrackSegment( segment, track ); + trackSegment->_postCreate(); + created = true; + + trackSegment->invalidate(); + + ltrace(200) << "TrackSegment::create(): " << trackSegment << endl; + trackElement = trackSegment; + } + + return trackElement; + } + + +// Formerly Inline Functions. +// Wrappeds. + AutoSegment* TrackSegment::base () const { return _base; } + bool TrackSegment::isFixed () const { return _base->isFixed(); } + bool TrackSegment::isHorizontal () const { return _base->isHorizontal(); } + bool TrackSegment::isVertical () const { return _base->isVertical(); } + bool TrackSegment::isLocal () const { return not _base->isWeakGlobal() and not _base->isGlobal(); } + bool TrackSegment::isGlobal () const { return _base->isWeakGlobal() or _base->isGlobal(); } + bool TrackSegment::isBipoint () const { return _base->isBipoint(); } + bool TrackSegment::isTerminal () const { return _base->isTerminal(); } + bool TrackSegment::isStrongTerminal ( unsigned int flags ) const { return _base->isStrongTerminal(flags); } + bool TrackSegment::isStrap () const { return _base->isStrap(); } + bool TrackSegment::isSlackened () const { return _base->isSlackened(); } + bool TrackSegment::isDogleg () const { return _base->isDogleg(); } + bool TrackSegment::isReduced () const { return _base->isReduced(); } + bool TrackSegment::isUserDefined () const { return _base->isUserDefined(); } +// Predicates. +// Accessors. + unsigned long TrackSegment::getId () const { return _base->getId(); } + unsigned int TrackSegment::getDirection () const { return _base->getDirection(); } + Net* TrackSegment::getNet () const { return _base->getNet(); } + const Layer* TrackSegment::getLayer () const { return _base->getLayer(); } + DbU::Unit TrackSegment::getPitch () const { return _base->getPitch(); } + DbU::Unit TrackSegment::getPPitch () const { return _ppitch; } + DbU::Unit TrackSegment::getAxis () const { return _base->getAxis(); } + unsigned long TrackSegment::getFreedomDegree () const { return _freedomDegree; } + unsigned int TrackSegment::getDoglegLevel () const { return _dogLegLevel; } + Interval TrackSegment::getSourceConstraints () const { return _base->getSourceConstraints(); } + Interval TrackSegment::getTargetConstraints () const { return _base->getTargetConstraints(); } + TrackElement* TrackSegment::getCanonical ( Interval& i ) { return Session::lookup( _base->getCanonical(i)->base() ); } + TrackElements TrackSegment::getPerpandiculars () { return new TrackElements_Perpandiculars(this); } +// Mutators. + void TrackSegment::invalidate () { setFlags( TElemInvalidated ); _base->invalidate(); } + + + DataNegociate* TrackSegment::getDataNegociate ( unsigned int flags ) const + { + if (flags & KtDataSelf) return _data; + + TrackElement* parent = getParent(); + return (parent) ? parent->getDataNegociate() : NULL; + } + + + TrackElement* TrackSegment::getNext () const + { + size_t dummy = _index; + return _track->getNext( dummy, getNet() ); + } + + + TrackElement* TrackSegment::getPrevious () const + { + size_t dummy = _index; + return _track->getPrevious( dummy, getNet() ); + } + + + TrackElement* TrackSegment::getParent () const + { + AutoSegment* baseParent = base()->getParent(); + if (not baseParent) return NULL; + + TrackElement* element = Session::lookup( baseParent ); + return element; + } + + + Interval TrackSegment::getFreeInterval () const + { + if (not _track) return Interval(false); + + size_t begin = _index; + size_t end = _index; + + return _track->expandFreeInterval( begin, end, Track::InsideElement, getNet() ); + } + + + size_t TrackSegment::getGCells ( Katabatic::GCellVector& gcells ) const + { + Katabatic::GCellVector().swap( gcells ); + + Katabatic::GCell* sourceGCell = base()->getAutoSource()->getGCell(); + Katabatic::GCell* targetGCell = base()->getAutoTarget()->getGCell(); + + ltrace(148) << "getGCells(): sourceGCell: " << sourceGCell << endl; + ltrace(148) << "getGCells(): targetGCell: " << targetGCell << endl; + + for( AutoSegment* segment : base()->getAligneds() ) { + ltrace(148) << "| " << segment << endl; + + Katabatic::GCell* gcell = segment->getAutoSource()->getGCell(); + if (gcell->getIndex() < sourceGCell->getIndex()) { + sourceGCell = gcell; + ltrace(148) << "getGCells(): new sourceGCell: " << sourceGCell << endl; + } + + gcell = segment->getAutoTarget()->getGCell(); + if (gcell->getIndex() > targetGCell->getIndex()) { + targetGCell = gcell; + ltrace(148) << "getGCells(): new targetGCell: " << targetGCell << endl; + } + } + + if (not sourceGCell or not targetGCell) return 0; + if (not sourceGCell) { gcells.push_back( targetGCell ); return 1; } + if (not targetGCell) { gcells.push_back( sourceGCell ); return 1; } + + if (isHorizontal()) { + gcells.push_back( sourceGCell ); + while ( sourceGCell != targetGCell ) { + sourceGCell = sourceGCell->getRight(); + if (not sourceGCell) break; + + gcells.push_back( sourceGCell ); + } + } else { + gcells.push_back( sourceGCell ); + while ( sourceGCell != targetGCell ) { + sourceGCell = sourceGCell->getUp(); + if (not sourceGCell) break; + + gcells.push_back( sourceGCell ); + } + } + + return gcells.size(); + } + + + size_t TrackSegment::getPerpandicularsBound ( set& bounds ) + { + bounds.clear (); + + set baseBounds; + set::iterator ibase; + _base->getPerpandicularsBound( baseBounds ); + + for ( ibase=baseBounds.begin() ; ibase!=baseBounds.end() ; ++ibase ) { + TrackElement* segment = Session::lookup( *ibase ); + if (segment) + bounds.insert( segment ); + } + + return bounds.size(); + } + + + void TrackSegment::setDoglegLevel ( unsigned int level ) + { + if (level > 15) { + cerr << Bug("%s has reached maximum dog leg count (15)." + ,_getString().c_str()) << endl; + level = 15; + } + _dogLegLevel = level; + } + + + void TrackSegment::updateFreedomDegree () + { _freedomDegree = _base->getSlack(); } + + + void TrackSegment::updatePPitch () + { + _ppitch = _base->getPPitch(); + //cerr << "Update P/Pitch (" << DbU::toLambda(getPPitch()) << ") on " << this << endl; + } + + + void TrackSegment::setTrack ( Track* track ) + { TrackElement::setTrack( track ); } + + + void TrackSegment::detach () + { + ltrace(200) << "TrackSegment::detach() - " << endl; + + setTrack( NULL ); + setIndex( (size_t)-1 ); + setFlags( TElemLocked ); + } + + + void TrackSegment::revalidate () + { + unsetFlags( TElemCreated ); + ltrace(148) << "revalidate() - " << this << endl; + + _base->getCanonical( _sourceU, _targetU ); + + if (_track) Session::addSortEvent( _track, true ); + unsetFlags( TElemInvalidated ); + } + + + void TrackSegment::setAxis ( DbU::Unit axis, unsigned int flags ) + { + _base->setAxis( axis, flags ); + invalidate(); + } + + + void TrackSegment::swapTrack ( TrackElement* other ) + { + if (not other) return; + + ltrace(200) << "TrackSegment::swapTrack()" << endl; + + size_t thisIndex = getIndex (); + Track* thisTrack = getTrack (); + size_t otherIndex = other->getIndex (); + Track* otherTrack = other->getTrack (); + + if (_track and otherTrack and (_track != otherTrack)) { + cerr << Error("TrackSegment::swapTrack() - swapping TrackSegments from different tracks.") << endl; + } + + setTrack( NULL ); + other->setTrack( NULL ); + + other->setTrack( thisTrack ); + other->setIndex( thisIndex ); + if (thisTrack) thisTrack->setSegment( other, thisIndex ); + + setTrack( otherTrack ); + setIndex( otherIndex ); + if (_track) _track->setSegment( this, _index ); + +#if defined(CHECK_DATABASE_DISABLED) + if (_track) _track->_check(); + else if (other->getTrack()) other->getTrack()->_check(); +#endif + + RoutingEvent* thisEvent = getDataNegociate(KtDataSelf)->getRoutingEvent(); + RoutingEvent* otherEvent = other->getDataNegociate()->getRoutingEvent(); + + if (thisEvent ) thisEvent ->setSegment( other ); + if (otherEvent) otherEvent->setSegment( this ); + + ltrace(200) << "| this: " << this << endl; + ltrace(200) << "| other: " << other << endl; + } + + + void TrackSegment::reschedule ( unsigned int level ) + { + ltrace(200) << "TrackSegment::reschedule() - " << this << endl; + ltracein(200); + + if (not _data or not _data->hasRoutingEvent()) + Session::getNegociateWindow()->addRoutingEvent( this, level ); + else { + if (_track != NULL) + Session::addRemoveEvent( this ); + Session::getNegociateWindow()->rescheduleEvent( _data->getRoutingEvent(), level ); + } + + ltraceout(200); + } + + + float TrackSegment::getMaxUnderDensity ( unsigned int flags ) const + { return _base->getMaxUnderDensity( flags ); } + + + bool TrackSegment::canPivotUp ( float reserve ) const + { return _base->canPivotUp(reserve); } + + + bool TrackSegment::canPivotDown ( float reserve ) const + { return _base->canPivotDown( reserve ); } + + + bool TrackSegment::canMoveUp ( float reserve, unsigned int flags ) const + { return _base->canMoveUp( reserve, flags ); } + + + bool TrackSegment::canSlacken () const + { + ltrace(200) << "TrackSegment::canSlacken() doglegLevel:" << getDoglegLevel() << endl; + return (not isSlackened() and (getDoglegLevel() <= 3)) ? _base->canSlacken(KbPropagate) : false; + } + + bool TrackSegment::slacken ( unsigned int flags ) + { + ltrace(200) << "TrackSegment::slacken()" << endl; + + bool success = false; + + if (not isSlackened()) { + TrackElement* perpandicular = NULL; + TrackElement* parallel = NULL; + + ltracein(200); + + success = base()->slacken( flags|KbPropagate ); + _postDoglegs( perpandicular, parallel ); + + ltraceout(200); + return success; + } else + cerr << Bug("TrackSegment::slacken(): NULL base or already slackened.") << endl; + + return success; + } + + + bool TrackSegment::moveUp ( unsigned int flags ) + { + bool success = false; + + ltrace(200) << "TrackSegment::moveUp() " << flags << endl; + ltracein(200); + + success = base()->moveUp( flags ); + if (success) { + TrackElement* perpandicular = NULL; + TrackElement* parallel = NULL; + + Session::revalidateTopology(); + _postDoglegs( perpandicular, parallel ); + } + + ltraceout(200); + + return success; + } + + + bool TrackSegment::moveDown ( unsigned int flags ) + { + bool success = false; + + ltrace(200) << "TrackSegment::moveDown() " << flags << endl; + ltracein(200); + + success = base()->moveDown( flags ); + if (success) { + TrackElement* perpandicular = NULL; + TrackElement* parallel = NULL; + + Session::revalidateTopology(); + _postDoglegs( perpandicular, parallel ); + } + + ltraceout(200); + + return success; + } + + + bool TrackSegment::moveAside ( unsigned int flags ) + { + bool success = true; + + ltrace(200) << "TrackSegment::moveAside() - " + << ((flags&KtMoveToLeft )?"left" :"") + << ((flags&KtMoveToRight)?"rigth":"") << endl; + ltracein(200); + if (flags & KtMoveToLeft ) base()->moveULeft (); + if (flags & KtMoveToRight) base()->moveURight(); + ltraceout(200); + + return success; + } + + + TrackElement* TrackSegment::getSourceDogleg () + { + if (not hasSourceDogleg()) return NULL; + + unsigned int direction = perpandicularTo( getDirection() ); + TrackElement* dogleg = NULL; + for( Segment* segment : base()->getAutoSource()->getSlaveComponents().getSubSet() ) { + dogleg = Session::lookup( segment ); + if (dogleg and (dogleg->getDirection() == direction)) { + ltrace(200) << "Source dogleg: " << dogleg << endl; + return dogleg; + } + } + return NULL; + } + + + TrackElement* TrackSegment::getTargetDogleg () + { + if (not hasSourceDogleg()) return NULL; + + unsigned int direction = perpandicularTo( getDirection() ); + TrackElement* dogleg = NULL; + for( Segment* segment : base()->getAutoTarget()->getSlaveComponents().getSubSet() ) { + dogleg = Session::lookup( segment ); + if (dogleg and (dogleg->getDirection() == direction)) { + ltrace(200) << "Target dogleg: " << dogleg << endl; + return dogleg; + } + } + return NULL; + } + + + bool TrackSegment::canDogleg () + { + ltrace(200) << "TrackSegment::canDogleg()" << endl; + + if (not isLocal()) { + ltrace(200) << "Failed: is not local." << endl; + return false; + } + + if (isFixed()) { + ltrace(200) << "Failed: is fixed." << endl; + return false; + } + + if (isRouted()) { + ltrace(200) << "Failed: belongs to an already routed net." << endl; + return false; + } + + if (isSlackened()) { + ltrace(200) << "Failed: is local & slackened." << endl; + return false; + } + + if (hasSourceDogleg() or hasTargetDogleg()) { + ltrace(200) << "Failed: already has source or target dogleg." << endl; + return false; + } + + if (getDoglegLevel() > 3) { + ltrace(200) << "Failed: maximum dogleg level reached (4)." << endl; + return false; + } + + return true; + } + + + bool TrackSegment::canDogleg ( Katabatic::GCell* doglegGCell, unsigned int flags ) + { + ltrace(200) << "TrackSegment::canDogleg(GCell*) " << doglegGCell << endl; + ltracein(200); + + if (doglegGCell->isUnderIoPad()) { + ltrace(200) << "false: Cannot dogleg in a GCell under an I/O Pad." << endl; + ltraceout(200); + return false; + } + + if (isFixed()) { + ltrace(200) << "false: Cannot dogleg a fixed segment." << endl; + ltraceout(200); + return false; + } + + if (isRouted()) { + ltrace(200) << "false: Cannot dogleg a segment belonging to an already routed net." << endl; + ltraceout(200); + return false; + } + + if (isLocal()) { + if (hasSourceDogleg() or hasTargetDogleg()) { + ltrace(200) << "false: Cannot dogleg again a local segment." << endl; + ltraceout(200); + return false; + } + if (isSlackened()) { + ltrace(200) << "false: Cannot dogleg a local slackened segment." << endl; + ltraceout(200); + return false; + } + } + + if (getDoglegLevel() > 3) { + ltrace(200) << "Failed: maximum dogleg level reached (4)." << endl; + ltraceout(200); + return false; + } + + vector gcells; + getGCells( gcells ); + + ltrace(190) << "Source: " << *gcells.begin () << endl; + ltrace(190) << "Target: " << *gcells.rbegin() << endl; + + bool isGCellInside = false; + for ( size_t igcell=0 ; igcell 3) { + ltrace(200) << "Failed: maximum dogleg level reached (4)." << endl; + return false; + } + + return _base->canDogleg(interval); + } + + + TrackElement* TrackSegment::makeDogleg () + { + Katabatic::AutoContact* source = _base->getAutoSource(); + Katabatic::AutoContact* target = _base->getAutoTarget(); + Katabatic::GCell* gcell = _base->getAutoSource()->getGCell(); + + TrackElement* dogleg = NULL; + TrackElement* parallel = NULL; + makeDogleg( gcell, dogleg, parallel ); + + if (dogleg) { + if (source->isTerminal() xor target->isTerminal()) { + if (target->isTerminal()) + source = target; + + DbU::Unit axis = (_base->isHorizontal()) ? source->getX() : source->getY(); + + ltrace(200) << "Setting dogleg axis @" << DbU::getValueString(axis) << endl; + dogleg->setAxis( axis ); + } + } + return dogleg; + } + + + TrackElement* TrackSegment::makeDogleg ( Katabatic::GCell* dogLegGCell + , TrackElement*& perpandicular + , TrackElement*& parallel + ) + { + ltrace(200) << "TrackSegment::makeDogleg(GCell*)" << endl; + ltrace(200) << "Break in: " << dogLegGCell << endl; + + base()->makeDogleg( dogLegGCell ); + _postDoglegs( perpandicular, parallel ); + + return perpandicular; + } + + + TrackElement* TrackSegment::makeDogleg ( Interval interval, unsigned int& flags ) + { + TrackElement* perpandicular = NULL; + TrackElement* parallel = NULL; + + ltrace(200) << "TrackSegment::makeDogleg(Interval)" << endl; + flags = base()->makeDogleg( interval ); + _postDoglegs( perpandicular, parallel ); + + return perpandicular; + } + + + void TrackSegment::_postDoglegs ( TrackElement*& perpandicular, TrackElement*& parallel ) + { + ltrace(200) << "TrackSegment::_postDoglegs()" << endl; + ltracein(200); + + unsigned int doglegLevel = 0; + const vector& doglegs = Session::getDoglegs(); + vector segments; + + if (not doglegs.empty()) { + if (doglegs.size()%3 != 0) + cerr << Error( "Session::_postDoglegs(): Number of created segments incoherent with pure doglegs (%u)." + , doglegs.size() ) << endl; + + for ( size_t i=0 ; icreateTrackSegment(doglegs[i],0) ); + segments[i+0]->setFlags( TElemTargetDogleg ); + segments[i+0]->getDataNegociate()->resetRipupCount(); + //segments[i+0]->getDataNegociate()->resetStateCount(); + segments[i+0]->getDataNegociate()->setState( DataNegociate::RipupPerpandiculars ); + doglegLevel = segments[i+0]->getDoglegLevel(); + segments[i+0]->setDoglegLevel( doglegLevel + (segments[i]->isLocal()?1:0) ); + + ltrace(200) << "Looking up new perpand: " << doglegs[i+1] << endl; + segments.push_back( Session::getNegociateWindow()->createTrackSegment(doglegs[i+1],0) ); + segments[i+1]->setFlags( TElemSourceDogleg|TElemTargetDogleg ); + segments[i+1]->setDoglegLevel( doglegLevel + 1 ); + + ltrace(200) << "Looking up new parallel: " << doglegs[i+2] << endl; + segments.push_back( Session::getNegociateWindow()->createTrackSegment(doglegs[i+2],0) ); + segments[i+2]->setFlags( TElemSourceDogleg ); + segments[i+2]->getDataNegociate()->resetStateCount(); + segments[i+2]->getDataNegociate()->setState( segments[i+0]->getDataNegociate()->getState() ); + segments[i+2]->setDoglegLevel( doglegLevel + (segments[i]->isLocal()?1:0) ); + + segments[i+0]->getDataNegociate()->setChildSegment( segments[i+2] ); + + perpandicular = segments[i+1]; + parallel = segments[i+2]; + } + + // TO CHECK + // If the original TrackElement was inserted in a Track, must check + // if the new bit takes it's place or not. + //if ( getGCell() != originalGCell ) swapTrack ( segments[2] ); + + for ( size_t i=0 ; ireschedule ( ((i%3==1) ? 0 : 1) ); + const char* segPart = "Unknown"; + switch ( i%3 ) { + case 0: segPart = "original "; break; + case 1: segPart = "perpand "; break; + case 2: segPart = "new paral"; break; + } + ltrace(200) << "[" << (i/3) << ":" << i << "] " << segPart << ": " + << segments[i] << endl; + } + } else { + reschedule( 1 ); + } + + ltraceout(200); + + Session::doglegReset(); + } + + + bool TrackSegment::_check () const + { + if (not base()) return true; + + bool coherency = true; + + if (not base()->isCanonical()) { + cerr << "[CHECK] " << this << " supporting AutoSegment is not canonical." << endl; + coherency = false; + } + + DbU::Unit min; + DbU::Unit max; + base()->checkPositions(); + base()->getCanonical( min, max ); + if (getSourceU() != min) { + cerr << "[CHECK] " << this << " has bad source position " + << "cache:" << DbU::getValueString(getSourceU()) << " vs. " + << "canon:" << DbU::getValueString(min) << "." << endl; + coherency = false; + } + if (getTargetU() != max) { + cerr << "[CHECK] " << this << " has bad target position " + << "cache:" << DbU::getValueString(getTargetU()) << " vs. " + << "canon:" << DbU::getValueString(max) << "." << endl; + coherency = false; + } + + return coherency; + } + + + string TrackSegment::_getTypeName () const + { return "TrackSegment"; } + + + string TrackSegment::_getString () const + { + string s1 = _base->_getString(); + string s2 = " [" + DbU::getValueString(_sourceU) + + ":" + DbU::getValueString(_targetU) + "]" + + " " + DbU::getValueString(_targetU-_sourceU) + + " " + getString(_dogLegLevel) + + " [" + ((_track) ? getString(_index) : "npos") + "] " + + ((isRouted() ) ? "R" : "-") + + ((isSlackened() ) ? "S" : "-") + + ((_track ) ? "T" : "-") + + ((canRipple() ) ? "r" : "-") + + ((hasSourceDogleg()) ? "s" : "-") + + ((hasTargetDogleg()) ? "t" : "-"); + + s1.insert( s1.size()-1, s2 ); + + return s1; + } + + + Record* TrackSegment::_getRecord () const + { + Record* record = TrackElement::_getRecord(); + record->add( getSlot( "_base", _base ) ); + return record; + } + + +} // Kite namespace. diff --git a/kite/src/TrackSegmentCost.cpp b/kite/src/TrackSegmentCost.cpp index 4c95cb55..dd89c54d 100644 --- a/kite/src/TrackSegmentCost.cpp +++ b/kite/src/TrackSegmentCost.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -37,9 +37,6 @@ namespace Kite { using std::ostringstream; using Hurricane::Bug; using Hurricane::DebugSession; - using Hurricane::inltrace; - using Hurricane::ltracein; - using Hurricane::ltraceout; using Hurricane::tab; @@ -76,10 +73,9 @@ namespace Kite { void TrackSegmentCost::update ( TrackElement* trackSegment ) { - DebugSession::open ( trackSegment->getNet(), 148 ); + DebugSession::open ( trackSegment->getNet(), 150, 160 ); - ltrace(148) << "TrackSegmentCost::update() - " << trackSegment << endl; - ltracein(148); + cdebug.log(159,1) << "TrackSegmentCost::update() - " << trackSegment << endl; vector collapseds; vector perpandiculars; @@ -118,15 +114,14 @@ namespace Kite { } interval.inflate ( DbU::lambda(-1.5) ); - ltrace(148) << "| perpandicular: " << perpandiculars[i] << endl; - ltrace(148) << "| canonical: " << perpandicular << endl; - ltracein(148); - ltrace(148) << "interval: " << interval << endl; + cdebug.log(159) << "| perpandicular: " << perpandiculars[i] << endl; + cdebug.log(159,1) << "| canonical: " << perpandicular << endl; + cdebug.log(159) << "interval: " << interval << endl; if ( interval.isPonctual() ) { - ltrace(148) << "Punctual attractor @" << DbU::getValueString(interval.getVMin()) << endl; + cdebug.log(159) << "Punctual attractor @" << DbU::getValueString(interval.getVMin()) << endl; _attractors.push_back ( interval.getVMin() ); - ltraceout(148); + cdebug.tabw(159,-1); continue; } @@ -141,7 +136,7 @@ namespace Kite { } else { iattractor->second -= 1; } - ltrace(148) << "Left attractor @" << DbU::getValueString(interval.getVMin()) << endl; + cdebug.log(159) << "Left attractor @" << DbU::getValueString(interval.getVMin()) << endl; } if ( ( interval.getVMax() != trackSegment->getAxis() ) @@ -155,10 +150,10 @@ namespace Kite { } else { iattractor->second += 1; } - ltrace(148) << "Right attractor @" << DbU::getValueString(interval.getVMax()) << endl; + cdebug.log(159) << "Right attractor @" << DbU::getValueString(interval.getVMax()) << endl; } - ltraceout(148); + cdebug.tabw(159,-1); } map::iterator iattractor = attractorSpins.begin(); @@ -174,10 +169,10 @@ namespace Kite { s << DbU::getValueString(_attractors[i]); } s << "]"; - ltrace(148) << s.str() << endl; + cdebug.log(159) << s.str() << endl; - ltraceout(148); + cdebug.tabw(159,-1); DebugSession::close (); } diff --git a/kite/src/Tracks.cpp b/kite/src/Tracks.cpp index 0df2b44b..112409b0 100644 --- a/kite/src/Tracks.cpp +++ b/kite/src/Tracks.cpp @@ -26,9 +26,6 @@ namespace Kite { using std::cerr; using std::endl; using Hurricane::tab; - using Hurricane::inltrace; - using Hurricane::ltracein; - using Hurricane::ltraceout; // ------------------------------------------------------------------- @@ -41,15 +38,15 @@ namespace Kite { : Hurricane::Locator() , _constraints (constraints) { - ltrace(147) << "Tracks_Range::Locator()" << endl; - ltrace(147) << "* Constraints: " << _constraints << endl; + cdebug.log(159) << "Tracks_Range::Locator()" << endl; + cdebug.log(159) << "* Constraints: " << _constraints << endl; _track = routingPlane->getTrackByPosition ( _constraints.getVMin() ); if ( _track and (_track->getAxis() < _constraints.getVMin()) ) _track = _track->getNextTrack(); if ( _track and (_track->getAxis() > _constraints.getVMax()) ) _track = NULL; - ltrace(147) << "_track: " << _track << endl;; + cdebug.log(159) << "_track: " << _track << endl;; } @@ -150,9 +147,9 @@ namespace Kite { , _inMinOptimal(true) , _inMaxOptimal(true) { - ltrace(147) << "Tracks_Spiral::Locator()" << endl; - ltrace(147) << "* Optimal: " << _optimal << endl; - ltrace(147) << "* Constraints: " << _constraints << endl; + cdebug.log(159) << "Tracks_Spiral::Locator()" << endl; + cdebug.log(159) << "* Optimal: " << _optimal << endl; + cdebug.log(159) << "* Constraints: " << _constraints << endl; _minTrack = _maxTrack = routingPlane->getTrackByPosition ( _optimal.getCenter() ); @@ -172,8 +169,8 @@ namespace Kite { if ( _minTrack && (_minTrack->getAxis() < _optimal.getVMin()) ) _inMinOptimal = false; if ( _maxTrack && (_maxTrack->getAxis() > _optimal.getVMax()) ) _inMaxOptimal = false; - ltrace(147) << "_minTrack: " << _minTrack << endl;; - ltrace(147) << "_maxTrack: " << _maxTrack << endl;; + cdebug.log(159) << "_minTrack: " << _minTrack << endl;; + cdebug.log(159) << "_maxTrack: " << _maxTrack << endl;; } @@ -213,14 +210,13 @@ namespace Kite { void Tracks_Spiral::Locator::progress () { - ltrace(147) << "Track_Spiral::progress() - State:" << endl; - ltracein(147); - ltrace(147) << _onMin - << " " << _minTrack - << " " << _maxTrack << endl; + cdebug.log(159,1) << "Track_Spiral::progress() - State:" << endl; + cdebug.log(159) << _onMin + << " " << _minTrack + << " " << _maxTrack << endl; if ( !isValid() ) { - ltraceout(147); + cdebug.tabw(159,-1); return; } @@ -249,10 +245,10 @@ namespace Kite { } } - ltrace(147) << _onMin + cdebug.log(159) << _onMin << " " << _minTrack << " " << _maxTrack << endl; - ltraceout(147); + cdebug.tabw(159,-1); } diff --git a/kite/src/kite/Configuration.h b/kite/src/kite/Configuration.h index 4c63576b..b8e0a343 100644 --- a/kite/src/kite/Configuration.h +++ b/kite/src/kite/Configuration.h @@ -1,7 +1,7 @@ // -*- mode: C++; explicit-buffer-name: "Configuration.h" -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/kite/src/kite/Constants.h b/kite/src/kite/Constants.h index 0a8340bb..cf7c39bb 100644 --- a/kite/src/kite/Constants.h +++ b/kite/src/kite/Constants.h @@ -1,7 +1,7 @@ // -*- mode: C++; explicit-buffer-name: "Constants.h" -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/kite/src/kite/DataNegociate.h b/kite/src/kite/DataNegociate.h index 742ad2be..6ba12a4f 100644 --- a/kite/src/kite/DataNegociate.h +++ b/kite/src/kite/DataNegociate.h @@ -1,14 +1,14 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | // | K i t e - D e t a i l e d R o u t e r | // | | // | Author : Jean-Paul CHAPUT | -// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Header : "./kite/DataNegociate.h" | // +-----------------------------------------------------------------+ @@ -108,6 +108,7 @@ namespace Kite { vector _attractors; vector _perpandiculars; Interval _perpandicularFree; + Interval _reduceRanges[2]; private: DataNegociate ( const DataNegociate& ); DataNegociate& operator= ( const DataNegociate& ); diff --git a/kite/src/kite/GraphicKiteEngine.h b/kite/src/kite/GraphicKiteEngine.h index b74fb805..70a96a59 100644 --- a/kite/src/kite/GraphicKiteEngine.h +++ b/kite/src/kite/GraphicKiteEngine.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/kite/src/kite/KiteEngine.h b/kite/src/kite/KiteEngine.h index 69f9494d..eba26afd 100644 --- a/kite/src/kite/KiteEngine.h +++ b/kite/src/kite/KiteEngine.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/kite/src/kite/Manipulator.h b/kite/src/kite/Manipulator.h index 46b9ce79..cb754f6f 100644 --- a/kite/src/kite/Manipulator.h +++ b/kite/src/kite/Manipulator.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/kite/src/kite/NegociateWindow.h b/kite/src/kite/NegociateWindow.h index 0014d854..3fdb0395 100644 --- a/kite/src/kite/NegociateWindow.h +++ b/kite/src/kite/NegociateWindow.h @@ -1,14 +1,14 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | // | K i t e - D e t a i l e d R o u t e r | // | | // | Author : Jean-Paul CHAPUT | -// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Header : "./kite/NegociateWindow.h" | // +-----------------------------------------------------------------+ @@ -116,6 +116,7 @@ namespace Kite { void run ( unsigned int flags ); void printStatistics () const; void _createRouting ( Katabatic::GCell* ); + void _pack ( size_t& count, bool last ); size_t _negociate (); Hurricane::Record* _getRecord () const; std::string _getString () const; diff --git a/kite/src/kite/RoutingEvent.h b/kite/src/kite/RoutingEvent.h index 43ce7166..5262cab4 100644 --- a/kite/src/kite/RoutingEvent.h +++ b/kite/src/kite/RoutingEvent.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -17,10 +17,10 @@ #ifndef KITE_ROUTING_EVENT_H #define KITE_ROUTING_EVENT_H -#include -#include -#include -#include +#include +#include +#include +#include #include "hurricane/Interval.h" namespace Hurricane { @@ -75,7 +75,7 @@ namespace Kite { DbU::Unit _sourceU; Net* _net; unsigned long _id; - friend class Compare; + friend class Compare; }; public: @@ -115,6 +115,7 @@ namespace Kite { inline bool isRipedByLocal () const; inline bool isOverConstrained () const; inline unsigned int getId () const; + inline unsigned int getTimeStamp () const; inline bool getMode () const; inline bool canMinimize () const; unsigned int getState () const; @@ -142,6 +143,7 @@ namespace Kite { RoutingEvent* reschedule ( RoutingEventQueue&, unsigned int eventLevel ); void setMode ( unsigned int ); void setState ( unsigned int ); + inline void setTimeStamp ( unsigned int ); inline void setProcessed ( bool state=true ); inline void setDisabled ( bool state=true ); inline void setMinimized ( bool state=true ); @@ -178,6 +180,7 @@ namespace Kite { bool _forceToHint; bool _ripedByLocal; unsigned int _id; + unsigned int _timeStamp; TrackElement* _segment; DataNegociate* _dataNegociate; DbU::Unit _axisHistory; @@ -205,8 +208,9 @@ namespace Kite { inline bool RoutingEvent::isRipedByLocal () const { return _ripedByLocal; } inline bool RoutingEvent::isOverConstrained () const { return _overConstrained; } inline unsigned int RoutingEvent::getId () const { return _id; } + inline unsigned int RoutingEvent::getTimeStamp () const { return _timeStamp; } inline bool RoutingEvent::getMode () const { return _mode; } - inline bool RoutingEvent::canMinimize () const { return !_minimized; } + inline bool RoutingEvent::canMinimize () const { return not _minimized; } inline const RoutingEvent::Key& RoutingEvent::getKey () const { return _key; } inline TrackElement* RoutingEvent::getSegment () const { return _segment; } inline const vector& RoutingEvent::getPerpandiculars () const { return _dataNegociate->getPerpandiculars(); } @@ -223,6 +227,7 @@ namespace Kite { inline unsigned int RoutingEvent::getTracksNb () const { return _tracksNb; } inline unsigned int RoutingEvent::getTracksFree () const { return _tracksFree; } inline unsigned int RoutingEvent::getInsertState () const { return _insertState; } + inline void RoutingEvent::setTimeStamp ( unsigned int stamp ) { _timeStamp = stamp; } inline void RoutingEvent::setProcessed ( bool state ) { _processed = state; } inline void RoutingEvent::setDisabled ( bool state ) { _disabled = state; } inline void RoutingEvent::setMinimized ( bool state ) { _minimized = state; } @@ -255,7 +260,7 @@ namespace Kite { << Session::getSegmentStackSize() << ")." << endl; # define _postCheck(segment) \ - ltrace(149) << "Bounds := [" \ + cdebug.log(159) << "Bounds := [" \ << DbU::getValueString(segment->base()->getSourcePosition()) << ":" \ << DbU::getValueString(segment->base()->getTargetPosition()) << "] " \ << DbU::getValueString(segment->getAxis()) << " " \ diff --git a/kite/src/kite/RoutingEventHistory.h b/kite/src/kite/RoutingEventHistory.h index c3f0f087..5da5a468 100644 --- a/kite/src/kite/RoutingEventHistory.h +++ b/kite/src/kite/RoutingEventHistory.h @@ -1,14 +1,14 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2013, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | // | K i t e - D e t a i l e d R o u t e r | // | | // | Author : Jean-Paul CHAPUT | -// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Header : "./kite/RoutingEventHistory.h" | // +-----------------------------------------------------------------+ diff --git a/kite/src/kite/RoutingEventQueue.h b/kite/src/kite/RoutingEventQueue.h index b1eb488d..2935cc9d 100644 --- a/kite/src/kite/RoutingEventQueue.h +++ b/kite/src/kite/RoutingEventQueue.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/kite/src/kite/SegmentFsm.h b/kite/src/kite/SegmentFsm.h index f05469c3..26fb82f0 100644 --- a/kite/src/kite/SegmentFsm.h +++ b/kite/src/kite/SegmentFsm.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/kite/src/kite/Session.h b/kite/src/kite/Session.h index b2a27a16..c30d6ef6 100644 --- a/kite/src/kite/Session.h +++ b/kite/src/kite/Session.h @@ -1,7 +1,7 @@ // -*- mode: C++; explicit-buffer-name: "Session.h" -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -83,6 +83,7 @@ namespace Kite { Net* _getBlockageNet (); unsigned int _getRipupCost (); Katabatic::GCell* _getGCellUnder ( DbU::Unit, DbU::Unit ); + void _doRemovalEvents (); virtual size_t _revalidate (); bool _isEmpty () const; NegociateWindow* _getNegociateWindow (); diff --git a/kite/src/kite/Track.h b/kite/src/kite/Track.h index c78a7852..668243ec 100644 --- a/kite/src/kite/Track.h +++ b/kite/src/kite/Track.h @@ -1,14 +1,14 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | // | K i t e - D e t a i l e d R o u t e r | // | | // | Author : Jean-Paul CHAPUT | -// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Header : "./kite/Track.h" | // +-----------------------------------------------------------------+ diff --git a/kite/src/kite/TrackCost.h b/kite/src/kite/TrackCost.h index d7d72cc1..02a2f3bd 100644 --- a/kite/src/kite/TrackCost.h +++ b/kite/src/kite/TrackCost.h @@ -1,8 +1,7 @@ - // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -40,10 +39,11 @@ namespace Kite { class TrackCost { public: - enum Flags { IgnoreAxisWeight = 0x1 - , DiscardGlobals = 0x2 - , IgnoreSharedLength = 0x4 - , LocalAndTopDepth = 0x1 + enum Flags { IgnoreAxisWeight = 0x0001 + , DiscardGlobals = 0x0002 + , IgnoreSharedLength = 0x0004 + , LocalAndTopDepth = 0x0008 + , ZeroCost = 0x0010 }; public: @@ -61,6 +61,9 @@ namespace Kite { }; public: + TrackCost ( Track* track + , Net* net + ); TrackCost ( Track* track , const Interval& interval , size_t begin diff --git a/kite/src/kite/TrackElement.h b/kite/src/kite/TrackElement.h index 863b96fa..7b2a68ff 100644 --- a/kite/src/kite/TrackElement.h +++ b/kite/src/kite/TrackElement.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -116,7 +116,8 @@ namespace Kite { virtual bool isStrap () const; virtual bool isSlackened () const; virtual bool isDogleg () const; - virtual bool isSameLayerDogleg () const; + virtual bool isReduced () const; + virtual bool isUTurn () const; virtual bool isUserDefined () const; // Predicates. inline bool isCreated () const; diff --git a/kite/src/kite/TrackFixedSegment.h b/kite/src/kite/TrackFixedSegment.h index d1e2a0e8..6421ef46 100644 --- a/kite/src/kite/TrackFixedSegment.h +++ b/kite/src/kite/TrackFixedSegment.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/kite/src/kite/TrackSegment.h b/kite/src/kite/TrackSegment.h index 608d9fa3..120ff35e 100644 --- a/kite/src/kite/TrackSegment.h +++ b/kite/src/kite/TrackSegment.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -67,7 +67,8 @@ namespace Kite { virtual bool isStrap () const; virtual bool isSlackened () const; virtual bool isDogleg () const; - virtual bool isSameLayerDogleg () const; + virtual bool isReduced () const; + virtual bool isUTurn () const; virtual bool isUserDefined () const; // Predicates. virtual bool canDogleg (); diff --git a/knik/src/Edge.cpp b/knik/src/Edge.cpp index ec3bbfbd..e01aa8b6 100644 --- a/knik/src/Edge.cpp +++ b/knik/src/Edge.cpp @@ -104,7 +104,7 @@ void Edge::increaseCapacity ( int capacity ) //cerr << "Increasing capacity to " << _capacity << " on " << this << endl; if ( _capacity == 0 ) - ltrace(300) << Warning("%s has reached NULL capacity.",getString(this).c_str()) << endl; + cdebug.log(139) << Warning("%s has reached NULL capacity.",getString(this).c_str()) << endl; } void Edge::incOccupancy () diff --git a/knik/src/Graph.cpp b/knik/src/Graph.cpp index 433e008e..ef677393 100644 --- a/knik/src/Graph.cpp +++ b/knik/src/Graph.cpp @@ -43,9 +43,6 @@ namespace Knik { - using Hurricane::inltrace; - using Hurricane::ltracein; - using Hurricane::ltraceout; using Hurricane::tab; using Hurricane::ForEachIterator; @@ -170,12 +167,12 @@ void Graph::_postCreate() } if (_lowerLeftVertex->getHEdgeOut()) - cout << Dots::asUInt (" - Global router H edges capacity" ,_lowerLeftVertex->getHEdgeOut()->getCapacity()) << endl; + cmess1 << Dots::asUInt (" - Global router H edges capacity" ,_lowerLeftVertex->getHEdgeOut()->getCapacity()) << endl; else cerr << Warning( "Knik::Graph: Design has only one column, H edge capacity is zero." ) << endl; if (_lowerLeftVertex->getVEdgeOut()) - cout << Dots::asUInt (" - Global router V edges capacity" ,_lowerLeftVertex->getVEdgeOut()->getCapacity()) << endl; + cmess1 << Dots::asUInt (" - Global router V edges capacity" ,_lowerLeftVertex->getVEdgeOut()->getCapacity()) << endl; else cerr << Warning( "Knik::Graph: Design has only one row, V edge capacity is zero." ) << endl; @@ -369,7 +366,7 @@ Vertex* Graph::getVertex ( Point p ) { Vertex* vertex; #ifdef __USE_MATRIXVERTEX__ - vertex = _matrixVertex->getVertex(p); + vertex = _matrixVertex->getVertex(p); assert(vertex); #endif #ifdef __USE_SLICINGTREE__ @@ -788,14 +785,14 @@ void Graph::increaseVTuplePriority ( VTuple* vtuple, float distance ) void Graph::printVTuplePriorityQueue() // *********************************** { - ltracein(600); - ltrace(600) << "VTuplePriorityQueue:" << endl; + cdebug.tabw(139,1); + cdebug.log(139) << "VTuplePriorityQueue:" << endl; unsigned int i=0; for ( auto iv : _vtuplePriorityQueue ) { - ltrace(600) << setw(3) << i << "| " << iv->getVertex() << " : " << iv->getDistance() << endl; + cdebug.log(139) << setw(3) << i << "| " << iv->getVertex() << " : " << iv->getDistance() << endl; ++i; } - ltraceout(600); + cdebug.tabw(139,-1); } void Graph::clearPriorityQueue() @@ -981,6 +978,9 @@ int Graph::initRouting ( Net* net ) //editor->Refresh(); //editor->Stop ("Going to init"); + //if (_working_net->getName() == "read0") DebugSession::open( 130, 140 ); + cdebug.log(139,1) << "Graph::initRouting() " << _working_net << endl; + int currentConnexID = 0; vector vContacts; vector vRoutingPads; @@ -1023,14 +1023,15 @@ int Graph::initRouting ( Net* net ) } } } + //cerr << " traitement pour les contacts : OK" << endl; //OoOoooOoooOoO A QUOI SERT CE BOOLEEN OoOoooOoooOoO ==>> pour le //5 le connexID ne doit pas avoir été augmenté ! ou alors connexID-1 !! //bool useConnexID = false; for ( unsigned index = 0 ; index < vRoutingPads.size() ; index ++ ) { RoutingPad* routingPad = vRoutingPads[index]; - //cerr << " RoutingPad :" << routingPad << endl; + cdebug.log(139) << routingPad << endl; Vertex* rpVertex = getVertex ( routingPad->getCenter() ); - //cerr << " Vertex :" << rpVertex << endl; + cdebug.log(139) << rpVertex << endl; Contact* rpContact = rpVertex->getContact(); if ( rpContact && (rpContact->getNet() == routingPad->getNet()) ) { // s'il existe deja un contact pour ce vertex pour ce net, on s'y attache @@ -1063,6 +1064,13 @@ int Graph::initRouting ( Net* net ) } } } + + if (_searchingArea.getHeight() <= _matrixVertex->getTileHeight()) + _searchingArea.inflate( 0, _matrixVertex->getTileHeight() ); + + if (_searchingArea.getWidth() <= _matrixVertex->getTileWidth()) + _searchingArea.inflate( _matrixVertex->getTileWidth(), 0 ); + // for ripup & reroute purpose if ( __ripupMode__ ) _searchingArea = _cell->getAbutmentBox(); // recherche sur toute la surface : trop long pour gros circuits @@ -1105,6 +1113,10 @@ int Graph::initRouting ( Net* net ) //cerr << "net " << net << " has " << _vertexes_to_route.size() << " vertexes to route." << endl; //} + + cdebug.tabw(139,-1); + //DebugSession::close(); + return _vertexes_to_route.size(); } @@ -1131,13 +1143,16 @@ void Graph::Dijkstra() UpdateEstimateCongestion(); //#endif - DebugSession::open( _working_net, 600 ); - ltrace(600) << "Dijkstra for net: " << _working_net << endl; - ltracein(600); - ltrace(600) << "Stamp:" << _netStamp << endl; - ltrace(600) << "Central vertex : " << centralVertex << endl; - ltrace(600) << "_vertexes_to_route.size(): " << _vertexes_to_route.size() << endl; - ltracein(600); +//DebugSession::open( _working_net, 130, 140 ); +//if (_working_net->getName() == "read0") DebugSession::open( 130, 140 ); + + cdebug.log(139,1) << "Dijkstra for net: " << _working_net << endl; + cdebug.log(139) << "Stamp:" << _netStamp << endl; + cdebug.log(139) << "Search area : " << _searchingArea + << " h:" << DbU::getValueString(_searchingArea.getHeight()) << endl; + cdebug.log(139) << "Matrix tile height : " << DbU::getValueString(_matrixVertex->getTileHeight()) << endl; + cdebug.log(139) << "Central vertex : " << centralVertex << endl; + cdebug.log(139,1) << "_vertexes_to_route.size(): " << _vertexes_to_route.size() << endl; //Breakpoint::stop(1, "
              Dijkstra
              initialized
              "); while ( _vertexes_to_route.size() > 1 ) { @@ -1146,13 +1161,13 @@ void Graph::Dijkstra() float reachedDistance = (float)(HUGE_VAL); //checkGraphConsistency(); - if (ltracelevel() >= 600) { - ltrace(600) << "_vertexes_to_route:" << endl; + if (cdebug.enabled(139)) { + cdebug.log(139) << "_vertexes_to_route:" << endl; for ( auto iv : _vertexes_to_route ) - ltrace(600) << "| " << iv << endl; + cdebug.log(139) << "| " << iv << endl; } - ltrace(600) << "Source component" << endl; + cdebug.log(139) << "Source component" << endl; printVTuplePriorityQueue(); //Breakpoint::stop(1, "
              Dijkstra
              source connexe component
              "); @@ -1173,7 +1188,7 @@ void Graph::Dijkstra() reachedDistance = currentVertex->getDistance(); reachedVertexes.clear(); reachedVertexes.push_back ( currentVertex ); - ltrace(600) << "Re-init reachedVertexes with " << currentVertex << endl; + cdebug.log(139) << "Re-init reachedVertexes with " << currentVertex << endl; break; } @@ -1213,21 +1228,21 @@ void Graph::Dijkstra() VTuple* oppositeVTuple = oppositeVertex->getVTuple(); if (oppositeVTuple) { - ltrace(600) << "Increasing priority for:" << endl; - ltrace(600) << "* " << oppositeVertex << endl; - ltrace(600) << "* " << oppositeVTuple << endl; + cdebug.log(139) << "Increasing priority for:" << endl; + cdebug.log(139) << "* " << oppositeVertex << endl; + cdebug.log(139) << "* " << oppositeVTuple << endl; increaseVTuplePriority( oppositeVTuple, newDistance ); // Du fait de la reinit ce n'est plus seulement un increase! // Non, c'est bon si on garde le CleanRoutingState (avec clearPriorityQueue) } else { VTuple* newOppositeVTuple = VTuple::create ( oppositeVertex, newDistance ); - ltrace(600) << "Creating New VTuple for Vertex:" << endl; - ltrace(600) << "* " << oppositeVertex << ":" << newDistance << endl; - ltrace(600) << "* " << newOppositeVTuple << endl; + cdebug.log(139) << "Creating New VTuple for Vertex:" << endl; + cdebug.log(139) << "* " << oppositeVertex << ":" << newDistance << endl; + cdebug.log(139) << "* " << newOppositeVTuple << endl; addVTupleToPriorityQueue( newOppositeVTuple ); } - ltrace(600) << "Updated distance " << newDistance << " on: " << (*iedge) << endl; + cdebug.log(139) << "Updated distance " << newDistance << " on: " << (*iedge) << endl; printVTuplePriorityQueue(); //Breakpoint::stop(1, "
              Dijkstra
              distance has been updated
              "); } @@ -1241,7 +1256,7 @@ void Graph::Dijkstra() reachedDistance = newDistance; reachedVertexes.clear(); reachedVertexes.push_back( oppositeVertex ); - ltrace(600) << "Re-init (< distance) reachedVertexes with " << oppositeVertex << endl; + cdebug.log(139) << "Re-init (< distance) reachedVertexes with " << oppositeVertex << endl; } else if (newDistance == reachedDistance) { // on pourrait simplifier grandement tout ca : 1 seul vertex atteint sauvergardé! // Conclusion qu'il ait le meme connexID ou pas, on ne fait rien, on en a deja atteint @@ -1258,7 +1273,7 @@ void Graph::Dijkstra() } if (not foundVertex) { reachedVertexes.push_back( oppositeVertex ); - ltrace(600) << "Re-init (== distance) reachedVertexes with " << oppositeVertex << endl; + cdebug.log(139) << "Re-init (== distance) reachedVertexes with " << oppositeVertex << endl; } } else { // Nothing to do? @@ -1278,9 +1293,9 @@ void Graph::Dijkstra() } assert( reachedDistance < (float)(HUGE_VAL) ); - ltrace(600) << "Updating two connex components:" << endl; - ltrace(600) << "1. " << (*(reachedVertexes.begin())) << endl; - ltrace(600) << "2. " << firstVertex << endl; + cdebug.log(139) << "Updating two connex components:" << endl; + cdebug.log(139) << "1. " << (*(reachedVertexes.begin())) << endl; + cdebug.log(139) << "2. " << firstVertex << endl; UpdateConnexComp( reachedVertexes, firstVertex ); } @@ -1291,9 +1306,8 @@ void Graph::Dijkstra() //_vertexes_to_route.clear(); // no more useful //_vertexes_to_route = copy_vertex ; - ltraceout(600); - ltraceout(600); - DebugSession::close(); + cdebug.tabw(139,-2); +//DebugSession::close(); } void Graph::Monotonic() diff --git a/knik/src/GraphicKnikEngine.cpp b/knik/src/GraphicKnikEngine.cpp index 16e9c3df..f8e3f764 100644 --- a/knik/src/GraphicKnikEngine.cpp +++ b/knik/src/GraphicKnikEngine.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/knik/src/KnikEngine.cpp b/knik/src/KnikEngine.cpp index 859d793a..d5ee1691 100644 --- a/knik/src/KnikEngine.cpp +++ b/knik/src/KnikEngine.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2006-2015, All Rights Reserved +// Copyright (c) UPMC 2006-2016, All Rights Reserved // // x-----------------------------------------------------------------x // | C O R I O L I S | @@ -270,6 +270,10 @@ void KnikEngine::initGlobalRouting( const map& excludedNets ) _timer.stop(); cmess2 << " - # of Nets to route:" << _nets_to_route.size() << endl; + + // for ( NetRecord record : _nets_to_route ) { + // cerr << "Route: " << record._net << endl; + // } __initialized__ = true; } diff --git a/knik/src/LoadSolution.cpp b/knik/src/LoadSolution.cpp index c7455f3f..6b396975 100644 --- a/knik/src/LoadSolution.cpp +++ b/knik/src/LoadSolution.cpp @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/knik/src/MatrixVertex.cpp b/knik/src/MatrixVertex.cpp index d61a0cd6..113308ff 100644 --- a/knik/src/MatrixVertex.cpp +++ b/knik/src/MatrixVertex.cpp @@ -381,7 +381,27 @@ Vertex* MatrixVertex::getVertex ( Point point ) // ******************************************** { pair indexes = getIJ ( point ); - return getVertex ( indexes ); + Vertex* vertex = getVertex ( indexes ); + + cdebug.log(139) << "MatrixVertex::getVertex(): " << vertex << endl; + + if (vertex and vertex->isBlocked()) { + cdebug.log(139) << "Vertex is blocked, looking for neighbor." << endl; + Vertex* neighbor = NULL; + for ( size_t i=0; i<4 ; ++i ) { + neighbor = vertex->getFirstEdges(i)->getOpposite( vertex ); + if (neighbor and not neighbor->isBlocked()) + return neighbor; + } + } + + if (not vertex) { + cerr << Error( "MatrixVertex::getVertex(Point): On %s,\n" + " blocked and it's neighbors are also blocked (vertex unreachable)." + , getString(vertex).c_str() ) << endl; + } + + return vertex; } Vertex* MatrixVertex::getVertex ( DbU::Unit x, DbU::Unit y ) diff --git a/knik/src/NetExtension.cpp b/knik/src/NetExtension.cpp index 07089a88..b68095c8 100644 --- a/knik/src/NetExtension.cpp +++ b/knik/src/NetExtension.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/knik/src/Vertex.cpp b/knik/src/Vertex.cpp index 301b8568..332574e6 100644 --- a/knik/src/Vertex.cpp +++ b/knik/src/Vertex.cpp @@ -106,6 +106,7 @@ Vertex::Vertex ( Graph* routingGraph, Point position, DbU::Unit halfWidth, DbU:: , _netStamp (0) , _halfWidth (halfWidth) , _halfHeight (halfHeight) + , _flags(0) { _firstEdges[0] = NULL; _firstEdges[1] = NULL; diff --git a/knik/src/knik/Configuration.h b/knik/src/knik/Configuration.h index c7052074..d1504fc8 100644 --- a/knik/src/knik/Configuration.h +++ b/knik/src/knik/Configuration.h @@ -1,7 +1,7 @@ // -*- mode: C++; explicit-buffer-name: "Configuration.h" -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/knik/src/knik/Graph.h b/knik/src/knik/Graph.h index 96f7208e..3febd579 100644 --- a/knik/src/knik/Graph.h +++ b/knik/src/knik/Graph.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2006-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2006-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/knik/src/knik/KnikEngine.h b/knik/src/knik/KnikEngine.h index ab35ba0f..4297023f 100644 --- a/knik/src/knik/KnikEngine.h +++ b/knik/src/knik/KnikEngine.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2006-2015, All Rights Reserved +// Copyright (c) UPMC 2006-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/knik/src/knik/MatrixVertex.h b/knik/src/knik/MatrixVertex.h index 789fa468..c141fbf8 100644 --- a/knik/src/knik/MatrixVertex.h +++ b/knik/src/knik/MatrixVertex.h @@ -70,6 +70,8 @@ namespace Knik { // Accessors // ********* public: + DbU::Unit getTileWidth () const { return _tileWidth; } + DbU::Unit getTileHeight () const { return _tileHeight; } size_t getXSize () const { return _matrix[0].size(); }; size_t getYSize () const { return _matrix.size(); }; unsigned int getLineIndex ( DbU::Unit y ); diff --git a/knik/src/knik/Vertex.h b/knik/src/knik/Vertex.h index d942c9c5..a22c38fe 100644 --- a/knik/src/knik/Vertex.h +++ b/knik/src/knik/Vertex.h @@ -19,24 +19,25 @@ namespace Knik { // ***** public: typedef ExtensionGo Inherit; + enum Flags { Blocked=0x0001 }; //enum EdgeDirection { EAST=0, NORTH=1, WEST=2, SOUTH=3, UNDEFINED=4 }; // Attributes // ********** private: - static const Name _extensionName; - Graph* _routingGraph; - Edge* _firstEdges[4]; // dans l'ordre : _hEdgeOut, _vEdgeOut, _hEdgeIn et _vEdgeIn - Edge* _predecessor; - Contact* _contact; - Point _position; - VTuple* _vtuple; - float _distance; - int _connexID; // XXX limiter le nombre de bits du connexID pour associer aux 3 booléens ? - unsigned _netStamp; - DbU::Unit _halfWidth; // this corresponds to the half width of dual bin of the vertex - DbU::Unit _halfHeight; // this corresponds to the half height of dual bin of the vertex - Box _boundingBox; + static const Name _extensionName; + Graph* _routingGraph; + Edge* _firstEdges[4]; // dans l'ordre : _hEdgeOut, _vEdgeOut, _hEdgeIn et _vEdgeIn + Edge* _predecessor; + Contact* _contact; + Point _position; + VTuple* _vtuple; + float _distance; + int _connexID; // XXX limiter le nombre de bits du connexID pour associer aux 3 booléens ? + unsigned _netStamp; + DbU::Unit _halfWidth; // this corresponds to the half width of dual bin of the vertex + DbU::Unit _halfHeight; // this corresponds to the half height of dual bin of the vertex + unsigned int _flags; // Constructors & Destructors // ************************** @@ -65,60 +66,62 @@ namespace Knik { void setVTuple ( VTuple* vtuple ) { _vtuple = vtuple; }; void attachToLocalRing ( Component* component ); void sortEdges (); + void setBlocked () { _flags |= Blocked; } + void resetBlocked () { _flags &= ~Blocked; } // Accessors // ********* public: - static const Name& staticGetName () { return _extensionName; }; - virtual const Name& getName () const { return _extensionName; }; - Edge* getHEdgeOut () const { return _firstEdges[0]; }; - Edge* getVEdgeOut () const { return _firstEdges[1]; }; - Edge* getHEdgeIn () const { return _firstEdges[2]; }; - Edge* getVEdgeIn () const { return _firstEdges[3]; }; - Edges getAdjacentEdges () const; - Edge* getPredecessor () const { return _predecessor; }; - Contact* getContact () const { return _contact; }; - int getConnexID () const { return _connexID; }; - float getDistance () const { return _distance; }; - unsigned getNetStamp () const { return _netStamp; }; - Point getPosition () const { return _position; }; - VTuple* getVTuple () const { return _vtuple; }; - Graph* getRoutingGraph () const { return _routingGraph; }; - DbU::Unit getX () const { return _position.getX(); }; - DbU::Unit getY () const { return _position.getY(); }; - DbU::Unit getXMin () const { return _position.getX() - _halfWidth; }; - DbU::Unit getYMin () const { return _position.getY() - _halfHeight; }; - DbU::Unit getXMax () const { return _position.getX() + _halfWidth; }; - DbU::Unit getYMax () const { return _position.getY() + _halfHeight; }; - DbU::Unit getHalfWidth () const { return _halfWidth; }; - DbU::Unit getHalfHeight () const { return _halfHeight; }; - Box getBox () const { return Box(getXMin(),getYMin(),getXMax(),getYMax()); }; - Edge* getFirstEdges ( int i ) const { return _firstEdges[i]; }; - Contact* getContact ( Edge* arrivalEdge ); - Edge* getHEdgeLeadingTo ( Vertex* to ); - Edge* getVEdgeLeadingTo ( Vertex* to ); - Edge* getHEdgeComingFrom ( Vertex* from ); - Edge* getVEdgeComingFrom ( Vertex* from ); - Edge* getBestHEdgeOut ( DbU::Unit yDest ); - Edge* getBestVEdgeOut ( DbU::Unit xDest ); - Edge* getBestHEdgeIn ( DbU::Unit yDest ); - Edge* getBestVEdgeIn ( DbU::Unit xDest ); + static const Name& staticGetName () { return _extensionName; }; + virtual const Name& getName () const { return _extensionName; }; + Edge* getHEdgeOut () const { return _firstEdges[0]; }; + Edge* getVEdgeOut () const { return _firstEdges[1]; }; + Edge* getHEdgeIn () const { return _firstEdges[2]; }; + Edge* getVEdgeIn () const { return _firstEdges[3]; }; + Edges getAdjacentEdges () const; + Edge* getPredecessor () const { return _predecessor; }; + Contact* getContact () const { return _contact; }; + int getConnexID () const { return _connexID; }; + float getDistance () const { return _distance; }; + unsigned getNetStamp () const { return _netStamp; }; + Point getPosition () const { return _position; }; + VTuple* getVTuple () const { return _vtuple; }; + Graph* getRoutingGraph () const { return _routingGraph; }; + DbU::Unit getX () const { return _position.getX(); }; + DbU::Unit getY () const { return _position.getY(); }; + DbU::Unit getXMin () const { return _position.getX() - _halfWidth; }; + DbU::Unit getYMin () const { return _position.getY() - _halfHeight; }; + DbU::Unit getXMax () const { return _position.getX() + _halfWidth; }; + DbU::Unit getYMax () const { return _position.getY() + _halfHeight; }; + DbU::Unit getHalfWidth () const { return _halfWidth; }; + DbU::Unit getHalfHeight () const { return _halfHeight; }; + Box getBox () const { return Box(getXMin(),getYMin(),getXMax(),getYMax()); }; + Edge* getFirstEdges ( int i ) const { return _firstEdges[i]; }; + Contact* getContact ( Edge* arrivalEdge ); + Edge* getHEdgeLeadingTo ( Vertex* to ); + Edge* getVEdgeLeadingTo ( Vertex* to ); + Edge* getHEdgeComingFrom ( Vertex* from ); + Edge* getVEdgeComingFrom ( Vertex* from ); + Edge* getBestHEdgeOut ( DbU::Unit yDest ); + Edge* getBestVEdgeOut ( DbU::Unit xDest ); + Edge* getBestHEdgeIn ( DbU::Unit yDest ); + Edge* getBestVEdgeIn ( DbU::Unit xDest ); // Predicates // ********** public: + bool isBlocked () const { return _flags & Blocked; }; bool isVerticallyAligned ( Vertex* vertex ) { return ( getX() == vertex->getX() ); }; bool isHorizontallyAligned ( Vertex* vertex ) { return ( getY() == vertex->getY() ); }; - bool hasInfo() const; + bool hasInfo () const; // ExtensionGo methods // ************** public: - void translate ( const DbU::Unit& dx, const DbU::Unit& dy ); - Cell* getCell () const; - Box getBoundingBox() const { Box area ( getPosition() ); return area.inflate(DbU::lambda(1)); }; - - void invalidate ( bool propagateFlag ); + void translate ( const DbU::Unit& dx, const DbU::Unit& dy ); + Cell* getCell () const; + Box getBoundingBox () const { Box area ( getPosition() ); return area.inflate(DbU::lambda(1)); }; + void invalidate ( bool propagateFlag ); // Others // ****** diff --git a/mauka/src/Configuration.cpp b/mauka/src/Configuration.cpp index 7ff1461f..2450006d 100644 --- a/mauka/src/Configuration.cpp +++ b/mauka/src/Configuration.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/mauka/src/GraphicMaukaEngine.cpp b/mauka/src/GraphicMaukaEngine.cpp index 0ddaa69a..8d946833 100644 --- a/mauka/src/GraphicMaukaEngine.cpp +++ b/mauka/src/GraphicMaukaEngine.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/mauka/src/InsertFeeds.cpp b/mauka/src/InsertFeeds.cpp index 516c75ec..ab1beeef 100644 --- a/mauka/src/InsertFeeds.cpp +++ b/mauka/src/InsertFeeds.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/mauka/src/mauka/Configuration.h b/mauka/src/mauka/Configuration.h index a247fae3..4dde11ca 100644 --- a/mauka/src/mauka/Configuration.h +++ b/mauka/src/mauka/Configuration.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/mauka/src/mauka/GraphicMaukaEngine.h b/mauka/src/mauka/GraphicMaukaEngine.h index b09becf2..bdf502fb 100644 --- a/mauka/src/mauka/GraphicMaukaEngine.h +++ b/mauka/src/mauka/GraphicMaukaEngine.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/mauka/src/mauka/MaukaEngine.h b/mauka/src/mauka/MaukaEngine.h index f8df1640..337b7264 100644 --- a/mauka/src/mauka/MaukaEngine.h +++ b/mauka/src/mauka/MaukaEngine.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2006-2015, All Rights Reserved +// Copyright (c) UPMC 2006-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/metis/src/metis/Configuration.h b/metis/src/metis/Configuration.h index bd4feaae..1c96a17b 100644 --- a/metis/src/metis/Configuration.h +++ b/metis/src/metis/Configuration.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/stratus1/src/dpgen/dpgen_RAM.py b/stratus1/src/dpgen/dpgen_RAM.py index 939e4847..1ac62b94 100644 --- a/stratus1/src/dpgen/dpgen_RAM.py +++ b/stratus1/src/dpgen/dpgen_RAM.py @@ -48,6 +48,7 @@ +from Hurricane import DbU from stratus import * class DpgenRam ( Model ) : @@ -589,7 +590,8 @@ class DpgenRam ( Model ) : ############################ def Layout ( self ) : - HCELL = 50 + #HCELL = 50 + HCELL = DbU.toLambda( self.Prech[0]._hur_masterCell.getAbutmentBox().getHeight() ) # Lignes de bit bottom = 0 diff --git a/stratus1/src/dpgen/dpgen_RF1.py b/stratus1/src/dpgen/dpgen_RF1.py index 32874a41..92756f60 100644 --- a/stratus1/src/dpgen/dpgen_RF1.py +++ b/stratus1/src/dpgen/dpgen_RF1.py @@ -1180,7 +1180,8 @@ class top_rf1 ( Model ) : hbuf = 2 # hauteur des buffers (2 ou 4 slices) : non utilise - HCELL = 50 + #HCELL = 50 + HCELL = DbU.toLambda( self.In[0]._hur_masterCell.getAbutmentBox().getHeight() ) ## Placement des lignes de bit en dessous des buffers ## bottom = 0 @@ -1352,7 +1353,7 @@ class top_rf1 ( Model ) : # Sixieme ligne bottom = ( nbit + nbitu + hbuf + 5 ) * HCELL - Place ( self.Pr[nword - 1] , SYMXY, XY ( 50, bottom ) ) + Place ( self.Pr[nword - 1] , SYMXY, XY ( HCELL, bottom ) ) for j in range ( 1, half ) : PlaceRight ( self.Pr[nword - 1 - j], SYM_Y ) diff --git a/stratus1/src/dpgen/dpgen_RF2.py b/stratus1/src/dpgen/dpgen_RF2.py index 10d77216..1a85fe3b 100644 --- a/stratus1/src/dpgen/dpgen_RF2.py +++ b/stratus1/src/dpgen/dpgen_RF2.py @@ -939,7 +939,8 @@ class top_rf2 ( Model ) : def Layout ( self, nbit, nword, type ) : global adrange - HCELL = 50 + #HCELL = 50 + HCELL = DbU.toLambda( self.In[0]._hur_masterCell.getAbutmentBox().getHeight() ) # placement des lignes de bit en dessous des buffers bottom = 0 diff --git a/stratus1/src/stratus/st_instance.py b/stratus1/src/stratus/st_instance.py index e0dbbd8b..983f862b 100644 --- a/stratus1/src/stratus/st_instance.py +++ b/stratus1/src/stratus/st_instance.py @@ -322,7 +322,7 @@ class Inst : plug.setNet ( hurNet ) # In order to see the ring - if str ( realNet.__class__ ) not in ALIM_NET : CRL.createPartRing ( self._st_cell._hur_cell, hurNet.getName() ) + #if str ( realNet.__class__ ) not in ALIM_NET : CRL.createPartRing ( self._st_cell._hur_cell, hurNet.getName() ) ##### Loop on each pin for pin in self._map : diff --git a/stratus1/src/stratus/st_placement.py b/stratus1/src/stratus/st_placement.py index 3a861da1..09f630c7 100644 --- a/stratus1/src/stratus/st_placement.py +++ b/stratus1/src/stratus/st_placement.py @@ -49,9 +49,13 @@ from Hurricane import * - +from st_net import * from util_Place import * +global nbCkBuf +nbCkBuf = 0 + + ########### def Place ( ins, sym, ref, plac = FIXED, cell = None ) : global MYPITCH, MYSLICE @@ -535,3 +539,63 @@ def gauche ( sym ) : def droite ( sym ) : return sym == Transformation.Orientation.R2 or sym == Transformation.Orientation.MX or sym == Transformation.Orientation.R1 or sym == Transformation.Orientation.XR + + +################# +## ClockBuffer ## +################# +class ClockBuffer : + def __init__ ( self, netname ) : + global CELLS + from st_model import CELLS + global nbCkBuf + self.cell = CELLS[-1] + + self.net = self.cell._hur_cell.getNet ( netname ) + self.ck_b = Signal ( "ck_b%d"%nbCkBuf, 1 ) + + modelMasterCell = CRL.AllianceFramework.get().getCell ( "buf_x2", CRL.Catalog.State.Views ) + if not modelMasterCell : + err = "Stratus Error : ClockBuffer : Cannot find model cell : buf_x2 in database !\n" + raise Exception ( err ) + + inst = Instance.create ( self.cell._hur_cell, "ck_buffer%d"%nbCkBuf, modelMasterCell ) + nbCkBuf += 1 + + ##### Connection ##### + plugI = inst.getPlug ( modelMasterCell.getNet ( "i" ) ) + plugI.setNet ( self.net ) + + plugQ = inst.getPlug ( modelMasterCell.getNet ( "q" ) ) + plugQ.setNet ( self.ck_b._hur_net[0] ) + + plugGround = inst.getPlug ( iter(modelMasterCell.getGroundNets()).next() ) + plugGround.setNet ( iter(self.cell._hur_cell.getGroundNets()).next() ) + + plugPower = inst.getPlug ( iter(modelMasterCell.getPowerNets()).next() ) + plugPower.setNet ( iter(self.cell._hur_cell.getPowerNets()).next() ) + + def AddFF ( self, netname ) : + net = self.cell._hur_cell.getNet ( netname ) + if not net : + err = "AddFF Error net : " + netname + " not found" + raise Exception ( err ) + + instDrive = None + for plug in net.getPlugs(): + if plug.getMasterNet().getDirection() == Net.Direction.OUT : + instDrive = plug.getInstance() + break + + if instDrive == None : + err = "AddFF Error no drive instance found for net " + netname + ".\n" + raise Exception ( err ) + + masterCell = instDrive.getMasterCell() + ## ici il vaudrait mieux faire une recherche sur l'ensemble des plugs de l'instDrive et trouver celle accrochee au self.net ## + netCk = masterCell.getNet ( "ck" ) + if instDrive.getPlug ( netCk ).getNet() != self.net : + err = "Stratus Error : AddFF : driver Instance of net " + netname + " is not connected to signal " + str ( self.net.getName() ) + ".\n" + raise Exception ( err ) + + instDrive.getPlug ( netCk ).setNet ( self.ck_b._hur_net[0] ) diff --git a/stratus1/src/stratus/stratus.py b/stratus1/src/stratus/stratus.py index 1bb7316d..aa1afb13 100644 --- a/stratus1/src/stratus/stratus.py +++ b/stratus1/src/stratus/stratus.py @@ -1,7 +1,7 @@ #!/usr/bin/python # # This file is part of the Coriolis Software. -# Copyright (c) UPMC 2008-2015, All Rights Reserved +# Copyright (c) UPMC 2008-2016, All Rights Reserved # # +-----------------------------------------------------------------+ # | C O R I O L I S | @@ -71,16 +71,19 @@ DoLayout = 0x0002 DoStop = 0x0004 -def buildModel ( name, flags ): +def buildModel ( moduleName, flags, className=None, modelName=None, parameters={} ): try: - print name - module = __import__( name, globals(), locals(), name ) - if not module.__dict__.has_key(name): - print '[ERROR] Stratus module <%s> do not contains a design of the same name.' % name + #print moduleName + if not className: className = moduleName + if not modelName: modelName = moduleName.lower() + + module = __import__( moduleName, globals(), locals(), className ) + if not module.__dict__.has_key(className): + print '[ERROR] Stratus module <%s> do not contains a design named <%s>.' % (moduleName,className) sys.exit(1) - print ' - Generating Stratus Model <%s>' % name - model = module.__dict__[name](name) + print ' - Generating Stratus Model <%s> (generator:<%s>).' % (modelName, className) + model = module.__dict__[className](modelName,parameters) model.Interface() if flags & DoNetlist: model.Netlist() @@ -88,7 +91,7 @@ def buildModel ( name, flags ): stopLevel=0 if flags & DoStop: stopLevel = 1 - model.View(stopLevel, 'Model %s' % name) + model.View(stopLevel, 'Model %s' % modelName) model.Save(LOGICAL|PHYSICAL) except ImportError, e: @@ -100,10 +103,10 @@ def buildModel ( name, flags ): sys.exit(1) except Exception, e: print '[ERROR] A strange exception occurred while loading the Stratus' - print ' design <%s>. Please check that module for error:\n' % name + print ' design <%s>. Please check that module for error:\n' % moduleName traceback.print_tb(sys.exc_info()[2]) print ' %s' % e sys.exit(2) framework = CRL.AllianceFramework.get() - return framework.getCell( name, CRL.Catalog.State.Views ) + return framework.getCell( modelName, CRL.Catalog.State.Views ) diff --git a/unicorn/doc/unicorn/footer.html b/unicorn/doc/unicorn/footer.html index 55cc00ca..f8817851 100644 --- a/unicorn/doc/unicorn/footer.html +++ b/unicorn/doc/unicorn/footer.html @@ -9,7 +9,7 @@ - +
              Unicorn - Coriolis GUICopyright © 2008-2015 UPMC All rights reservedCopyright © 2008-2016 UPMC All rights reserved
              diff --git a/unicorn/python/unicornInit.py b/unicorn/python/unicornInit.py index 3da180c4..d7c21ecc 100644 --- a/unicorn/python/unicornInit.py +++ b/unicorn/python/unicornInit.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # # This file is part of the Coriolis Software. -# Copyright (c) UPMC 2014-2015, All Rights Reserved +# Copyright (c) UPMC 2014-2016, All Rights Reserved # # +-----------------------------------------------------------------+ # | C O R I O L I S | diff --git a/unicorn/src/CgtMain.cpp b/unicorn/src/CgtMain.cpp index 97751205..f91c71b2 100644 --- a/unicorn/src/CgtMain.cpp +++ b/unicorn/src/CgtMain.cpp @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -29,6 +29,7 @@ namespace bopts = boost::program_options; #include "hurricane/DebugSession.h" #include "hurricane/DataBase.h" #include "hurricane/Cell.h" +#include "hurricane/Bug.h" #include "hurricane/Warning.h" #include "hurricane/UpdateSession.h" #include "hurricane/viewer/Script.h" @@ -95,7 +96,6 @@ int main ( int argc, char *argv[] ) bool destroyDatabase; float edgeCapacity; unsigned long eventsLimit; - unsigned int traceLevel; bool textMode; double margin; bool quadriPlace; @@ -114,9 +114,6 @@ int main ( int argc, char *argv[] ) ( "help,h" , "Print this help." ) ( "destroy-db" , bopts::bool_switch(&destroyDatabase)->default_value(false) , "Perform a complete deletion of the database (may be buggy).") - ( "trace-level,l" , bopts::value(&traceLevel) - , "Set the level of trace, trace messages with a level superior to " - " will be printed on ." ) ( "verbose,v" , bopts::bool_switch() , "First level of verbosity.") ( "very-verbose,V" , bopts::bool_switch() @@ -199,13 +196,10 @@ int main ( int argc, char *argv[] ) if (arguments["info" ].as()) Cfg::getParamBool("misc.info" )->setBool ( true , Cfg::Parameter::CommandLine ); if (arguments["log-mode" ].as()) Cfg::getParamBool("misc.logMode" )->setBool ( true , Cfg::Parameter::CommandLine ); if (arguments["show-conf" ].as()) Cfg::getParamBool("misc.showConf" )->setBool ( true , Cfg::Parameter::CommandLine ); - - if (arguments.count("trace-level" )) Cfg::getParamInt("misc.traceLevel")->setInt ( traceLevel, Cfg::Parameter::CommandLine ); - bool showConf = Cfg::getParamBool("misc.showConf")->asBool(); - dbo_ptr db ( DataBase::create() ); - dbo_ptr af ( AllianceFramework::create() ); + dbo_ptr db ( DataBase::getDB() ); + dbo_ptr af ( AllianceFramework::get() ); Cell* cell = NULL; Utilities::Path path = Utilities::Path::cwd(); @@ -435,6 +429,10 @@ int main ( int argc, char *argv[] ) if ( not destroyDatabase ) exit ( 0 ); cmess1 << " o Full database deletion (may be buggy)." << endl; } + catch ( Bug& e ) { + cerr << e.what() << endl; + exit ( 1 ); + } catch ( Error& e ) { cerr << e.what() << endl; cerr << "\nProgram stack:\n" << e.where() << endl; diff --git a/unicorn/src/ExportCellDialog.cpp b/unicorn/src/ExportCellDialog.cpp index caefb8cf..f16457e9 100644 --- a/unicorn/src/ExportCellDialog.cpp +++ b/unicorn/src/ExportCellDialog.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -78,6 +78,7 @@ namespace Unicorn { formatLabel->setFont ( Graphics::getNormalFont(true) ); hLayout2->addWidget ( formatLabel ); + _formatComboBox->addItem ( tr("JSON (experimental)") , Json ); _formatComboBox->addItem ( tr("Alliance compliant DEF"), AllianceDef ); _formatComboBox->addItem ( tr("ASCII/GDSII (AGDS)") , AsciiGds ); hLayout2->addWidget ( _formatComboBox ); diff --git a/unicorn/src/ImportCell.cpp b/unicorn/src/ImportCell.cpp index 49500d7c..febd65ef 100644 --- a/unicorn/src/ImportCell.cpp +++ b/unicorn/src/ImportCell.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2014-2015, All Rights Reserved +// Copyright (c) UPMC 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/unicorn/src/ImportCellDialog.cpp b/unicorn/src/ImportCellDialog.cpp index b1f62541..d6bc3150 100644 --- a/unicorn/src/ImportCellDialog.cpp +++ b/unicorn/src/ImportCellDialog.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/unicorn/src/OpenCellDialog.cpp b/unicorn/src/OpenCellDialog.cpp index 8606393f..80091ecf 100644 --- a/unicorn/src/OpenCellDialog.cpp +++ b/unicorn/src/OpenCellDialog.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/unicorn/src/PyUnicorn.cpp b/unicorn/src/PyUnicorn.cpp index 8ead1986..9fb3bac8 100644 --- a/unicorn/src/PyUnicorn.cpp +++ b/unicorn/src/PyUnicorn.cpp @@ -23,7 +23,6 @@ namespace Unicorn { using std::cerr; using std::endl; using Hurricane::tab; - using Hurricane::in_trace; using Hurricane::CellViewer; using Hurricane::PyTypeCellViewer; using Isobar::__cs; @@ -58,7 +57,7 @@ extern "C" { // Module Initialization : "initUnicorn ()" DL_EXPORT(void) initUnicorn () { - trace << "initUnicorn()" << endl; + cdebug.log(46) << "initUnicorn()" << endl; PyUnicornGui_LinkPyType (); diff --git a/unicorn/src/PyUnicornGui.cpp b/unicorn/src/PyUnicornGui.cpp index 9dbca8d5..dd1c0f20 100644 --- a/unicorn/src/PyUnicornGui.cpp +++ b/unicorn/src/PyUnicornGui.cpp @@ -45,7 +45,7 @@ extern "C" { static PyObject* PyUnicornGui_create ( PyObject*, PyObject* args ) { - trace << "PyUnicornGui_create()" << endl; + cdebug.log(46) << "PyUnicornGui_create()" << endl; UnicornGui* gui = NULL; PyUnicornGui* pyGui = NULL; @@ -68,7 +68,7 @@ extern "C" { static PyObject* PyUnicornGui_registerTool ( PyUnicornGui* self, PyObject* args ) { - trace << "PyUnicornGui_registerTool()" << endl; + cdebug.log(46) << "PyUnicornGui_registerTool()" << endl; HTRY METHOD_HEAD("UnicornGui.registerTool()") @@ -92,7 +92,7 @@ extern "C" { static PyObject* PyUnicornGui_show ( PyUnicornGui* self ) { - trace << "PyUnicornGui_show()" << endl; + cdebug.log(46) << "PyUnicornGui_show()" << endl; HTRY METHOD_HEAD("UnicornGui.show()") @@ -105,7 +105,7 @@ extern "C" { static PyObject* PyUnicornGui_getBanner ( PyUnicornGui* self ) { - trace << "PyUnicornGui_getBanner()" << endl; + cdebug.log(46) << "PyUnicornGui_getBanner()" << endl; Banner* banner = NULL; diff --git a/unicorn/src/UnicornGui.cpp b/unicorn/src/UnicornGui.cpp index ccdb0c75..adbb3d3b 100644 --- a/unicorn/src/UnicornGui.cpp +++ b/unicorn/src/UnicornGui.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -17,6 +17,7 @@ #include #include #include +#include "hurricane/DebugSession.h" #include "hurricane/Warning.h" #include "hurricane/viewer/Script.h" #include "hurricane/viewer/CellViewer.h" @@ -45,8 +46,10 @@ namespace Unicorn { using Hurricane::dbo_ptr; + using Hurricane::DebugSession; using Hurricane::Warning; using Hurricane::PyCellViewer_Link; + using Hurricane::jsonCellParse; using CRL::System; using CRL::Catalog; using CRL::AllianceFramework; @@ -89,6 +92,7 @@ namespace Unicorn { _runUnicornInit(); _importCell.setDialog( _importDialog ); + _importCell.addImporter( "JSON (experimental)" , std::bind( &Cell::fromJson , placeholders::_1 ) ); _importCell.addImporter( "BLIF (Yosys/ABC)" , std::bind( &Blif::load , placeholders::_1 ) ); _importCell.addImporter( "ACM/SIGDA (aka MCNC, .bench)", std::bind( &AcmSigda::load , placeholders::_1 ) ); _importCell.addImporter( "ISPD'04 (Bookshelf)" , std::bind( &Ispd04::load , placeholders::_1 ) ); @@ -178,6 +182,7 @@ namespace Unicorn { , QKeySequence(tr("CTRL+M")) ); connect( action, SIGNAL(triggered()), _libraryManager, SLOT(toggleShow()) ); + connect( this , SIGNAL(cellLoadedFromDisk(Cell*)), _libraryManager, SLOT(updateLibrary(Cell*)) ); } @@ -234,6 +239,7 @@ namespace Unicorn { viewer->show (); } viewer->setCell ( cell ); + emit cellLoadedFromDisk ( cell ); } else cerr << "[ERROR] Cell not found: " << cellName.toStdString() << endl; } @@ -256,6 +262,7 @@ namespace Unicorn { viewer->show(); } viewer->setCell( cell ); + emit cellLoadedFromDisk ( cell ); } } } @@ -282,8 +289,19 @@ namespace Unicorn { DefExport::drive ( cell, DefExport::WithLEF ); break; case ExportCellDialog::AsciiGds: - GdsDriver gdsDriver ( cell ); - gdsDriver.save( getString(cell->getName())+".agds" ); + { GdsDriver gdsDriver ( cell ); + gdsDriver.save( getString(cell->getName())+".agds" ); + } + break; + case ExportCellDialog::Json: + { //DebugSession::open( 19, 20 ); + cerr << "cdebug (" << cdebug.getMinLevel() << "," << cdebug.getMaxLevel() + << ") level:" << cdebug.getLevel() << " enabled:" << cdebug.enabled() << endl; + + JsonWriter writer ( cellName.toStdString()+".json.bz2" ); + jsonWrite( &writer, cell ); + //DebugSession::close(); + } break; } } diff --git a/unicorn/src/cgt.py b/unicorn/src/cgt.py index 3eff1b54..c8ac6c22 100755 --- a/unicorn/src/cgt.py +++ b/unicorn/src/cgt.py @@ -9,6 +9,7 @@ try: import Hurricane import Viewer import CRL + #import Anabatic import Etesian import Katabatic import Kite @@ -57,25 +58,34 @@ def credits (): def runScript ( scriptPath, editor ): - try: - script = __import__(scriptPath) - except Exception, e: + try: + kw = { 'editor':editor } + sys.path.append(os.path.dirname(scriptPath)) + + module = __import__( os.path.basename(scriptPath), globals(), locals() ) + if not module.__dict__.has_key('ScriptMain'): + print '[ERROR] Script module is missing function ScriptMain().' + print ' <%s>' % scriptPath + return + if not callable( module.__dict__['ScriptMain'] ): + print '[ERROR] Script module symbol ScriptMain is not callable (not a function?).' + print ' <%s>' % scriptPath + return + + module.__dict__['ScriptMain']( **kw ) + + except ImportError, e: + module = str(e).split()[-1] + print '[ERROR] The <%s> script cannot be loaded.' % module + print ' Please check your design hierarchy.' + except Exception, e: print '[ERROR] An exception occured while loading the Stratus script module:' print ' <%s>\n' % (scriptPath) print ' You should check for simple python errors in this module.' print ' Error was:' print ' %s\n' % e print ' Trying to continue anyway...' - return - - if not hasattr(script,'ScriptMain'): - print '[ERROR] Script module is missing function ScriptMain().' - print ' <%s>' % scriptPath - return - - script.ScriptMain(editor) - - return + return if __name__ == '__main__': @@ -85,6 +95,7 @@ if __name__ == '__main__': usage += '\ncgt [options]' parser = optparse.OptionParser(usage) + parser.add_option( '--no-init' , action='store_true', dest='noInit' , help='Do not load any initialization.') parser.add_option( '-c', '--cell' , type='string' , dest='cell' , help='The name of the cell to load, whithout extension.') parser.add_option( '--acm-sigda-89' , type='string' , dest='acmSigdaName' , help='An ACM/SIGDA 89 bench name to load, whithout extension.') parser.add_option( '--blif' , type='string' , dest='blifName' , help='A Blif (Yosys) design name to load, whithout extension.') @@ -114,10 +125,13 @@ if __name__ == '__main__': (options, args) = parser.parse_args() args.insert(0, 'cgt') - af = CRL.AllianceFramework.get() + flags = 0 + if options.noInit: + flags |= CRL.AllianceFramework.NoPythonInit + + af = CRL.AllianceFramework.create( flags ) print af.getEnvironment().getPrint() - #Hurricane.trace(True) Cfg.Configuration.pushDefaultPriority(Cfg.Parameter.Priority.CommandLine) if options.coreDump: Cfg.getParamBool ('misc.catchCore' ).setBool(False) @@ -165,6 +179,7 @@ if __name__ == '__main__': unicorn = Unicorn.UnicornGui.create() unicorn.setApplicationName ('cgt') + unicorn.registerTool (Anabatic.GraphicAnabaticEngine.grab()) unicorn.registerTool (Etesian.GraphicEtesianEngine.grab()) unicorn.registerTool (Kite.GraphicKiteEngine.grab()) #unicorn.setAnonNetSelectable(False) diff --git a/unicorn/src/coriolis.py b/unicorn/src/coriolis.py index ddddd3b4..5d54752a 100755 --- a/unicorn/src/coriolis.py +++ b/unicorn/src/coriolis.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # # This file is part of the Coriolis Software. -# Copyright (c) UPMC/LIP6 2015-2015, All Rights Reserved +# Copyright (c) UPMC/LIP6 2015-2016, All Rights Reserved # # +-----------------------------------------------------------------+ # | C O R I O L I S | diff --git a/unicorn/src/unicorn/ExportCellDialog.h b/unicorn/src/unicorn/ExportCellDialog.h index cbc2a44b..0601c2fe 100644 --- a/unicorn/src/unicorn/ExportCellDialog.h +++ b/unicorn/src/unicorn/ExportCellDialog.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -31,7 +31,7 @@ namespace Unicorn { Q_OBJECT; public: - enum Formats { AllianceDef=1, AsciiGds=2 }; + enum Formats { AllianceDef=1, AsciiGds=2, Json=3 }; public: ExportCellDialog ( QWidget* parent=NULL ); bool runDialog ( QString& name, int& format ); diff --git a/unicorn/src/unicorn/ImportCell.h b/unicorn/src/unicorn/ImportCell.h index 011a8ac7..e2b13661 100644 --- a/unicorn/src/unicorn/ImportCell.h +++ b/unicorn/src/unicorn/ImportCell.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2014-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2014-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/unicorn/src/unicorn/ImportCellDialog.h b/unicorn/src/unicorn/ImportCellDialog.h index d4f54bbd..51339217 100644 --- a/unicorn/src/unicorn/ImportCellDialog.h +++ b/unicorn/src/unicorn/ImportCellDialog.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/unicorn/src/unicorn/SaveCellDialog.h b/unicorn/src/unicorn/SaveCellDialog.h index 81c6da82..80ff2368 100644 --- a/unicorn/src/unicorn/SaveCellDialog.h +++ b/unicorn/src/unicorn/SaveCellDialog.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/unicorn/src/unicorn/UnicornGui.h b/unicorn/src/unicorn/UnicornGui.h index 8839f5d5..596c2653 100644 --- a/unicorn/src/unicorn/UnicornGui.h +++ b/unicorn/src/unicorn/UnicornGui.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/vlsisapd/src/bookshelf/src/Parser.cpp b/vlsisapd/src/bookshelf/src/Parser.cpp index 074e4d7d..eb72cd83 100644 --- a/vlsisapd/src/bookshelf/src/Parser.cpp +++ b/vlsisapd/src/bookshelf/src/Parser.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the VSLSI Stand-Alone Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | V L S I Stand - Alone Parsers / Drivers | diff --git a/vlsisapd/src/bookshelf/src/Pin.cpp b/vlsisapd/src/bookshelf/src/Pin.cpp index c1935478..eac533e5 100644 --- a/vlsisapd/src/bookshelf/src/Pin.cpp +++ b/vlsisapd/src/bookshelf/src/Pin.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the VSLSI Stand-Alone Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/vlsisapd/src/bookshelf/src/vlsisapd/bookshelf/Circuit.h b/vlsisapd/src/bookshelf/src/vlsisapd/bookshelf/Circuit.h index 0aca0827..218acf9e 100644 --- a/vlsisapd/src/bookshelf/src/vlsisapd/bookshelf/Circuit.h +++ b/vlsisapd/src/bookshelf/src/vlsisapd/bookshelf/Circuit.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the VLSI Stand-Alone Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/vlsisapd/src/bookshelf/src/vlsisapd/bookshelf/Node.h b/vlsisapd/src/bookshelf/src/vlsisapd/bookshelf/Node.h index 95918e56..8ebb151a 100644 --- a/vlsisapd/src/bookshelf/src/vlsisapd/bookshelf/Node.h +++ b/vlsisapd/src/bookshelf/src/vlsisapd/bookshelf/Node.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the VSLSI Stand-Alone Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/vlsisapd/src/bookshelf/src/vlsisapd/bookshelf/Parser.h b/vlsisapd/src/bookshelf/src/vlsisapd/bookshelf/Parser.h index 511e59fe..7959d589 100644 --- a/vlsisapd/src/bookshelf/src/vlsisapd/bookshelf/Parser.h +++ b/vlsisapd/src/bookshelf/src/vlsisapd/bookshelf/Parser.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the VLSI Stand-Alone Software. -// Copyright (c) UPMC 2008-2015, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | V L S I Stand - Alone Parsers / Drivers | diff --git a/vlsisapd/src/bookshelf/src/vlsisapd/bookshelf/Pin.h b/vlsisapd/src/bookshelf/src/vlsisapd/bookshelf/Pin.h index 357fb2eb..165c1846 100644 --- a/vlsisapd/src/bookshelf/src/vlsisapd/bookshelf/Pin.h +++ b/vlsisapd/src/bookshelf/src/vlsisapd/bookshelf/Pin.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the VSLSI Stand-Alone Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/vlsisapd/src/bookshelf/src/vlsisapd/bookshelf/Row.h b/vlsisapd/src/bookshelf/src/vlsisapd/bookshelf/Row.h index ce47578a..b7ac2e1b 100644 --- a/vlsisapd/src/bookshelf/src/vlsisapd/bookshelf/Row.h +++ b/vlsisapd/src/bookshelf/src/vlsisapd/bookshelf/Row.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the VLSI Stand-Alone Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/vlsisapd/src/configuration/src/ConfTabWidget.cpp b/vlsisapd/src/configuration/src/ConfTabWidget.cpp index 5deacf27..e70f9fcd 100644 --- a/vlsisapd/src/configuration/src/ConfTabWidget.cpp +++ b/vlsisapd/src/configuration/src/ConfTabWidget.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the VSLSI Stand-Alone Software. -// Copyright (c) UPMC 2010-2015, All Rights Reserved +// Copyright (c) UPMC 2010-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/vlsisapd/src/configuration/src/Configuration.cpp b/vlsisapd/src/configuration/src/Configuration.cpp index f12328d3..0370b7ce 100644 --- a/vlsisapd/src/configuration/src/Configuration.cpp +++ b/vlsisapd/src/configuration/src/Configuration.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the VSLSI Stand-Alone Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -407,6 +407,7 @@ namespace Cfg { ConfigurationWidget* Configuration::buildWidget ( unsigned int flags ) { return _layout.buildWidget(flags); } + ConfigurationDialog* Configuration::buildDialog() { return new ConfigurationDialog(); } diff --git a/vlsisapd/src/configuration/src/ConfigurationWidget.cpp b/vlsisapd/src/configuration/src/ConfigurationWidget.cpp index 27650456..d499d64a 100644 --- a/vlsisapd/src/configuration/src/ConfigurationWidget.cpp +++ b/vlsisapd/src/configuration/src/ConfigurationWidget.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the VSLSI Stand-Alone Software. -// Copyright (c) UPMC 2010-2015, All Rights Reserved +// Copyright (c) UPMC 2010-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/vlsisapd/src/configuration/src/LayoutDescription.cpp b/vlsisapd/src/configuration/src/LayoutDescription.cpp index aaef7024..b52eea51 100644 --- a/vlsisapd/src/configuration/src/LayoutDescription.cpp +++ b/vlsisapd/src/configuration/src/LayoutDescription.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the VSLSI Stand-Alone Software. -// Copyright (c) UPMC 2010-2015, All Rights Reserved +// Copyright (c) UPMC 2010-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -14,10 +14,10 @@ // +-----------------------------------------------------------------+ -#include "vlsisapd/configuration/LayoutDescription.h" -#include "vlsisapd/configuration/Configuration.h" -#include "vlsisapd/configuration/ParameterWidget.h" -#include "vlsisapd/configuration/ConfigurationWidget.h" +#include "vlsisapd/configuration/LayoutDescription.h" +#include "vlsisapd/configuration/Configuration.h" +#include "vlsisapd/configuration/ParameterWidget.h" +#include "vlsisapd/configuration/ConfigurationWidget.h" namespace Cfg { @@ -32,6 +32,33 @@ namespace Cfg { using std::ostream; +// ------------------------------------------------------------------- +// Class : "Cfg::WidgetDescription". + + string WidgetDescription::typeToString ( WidgetDescription::Type type ) + { + switch ( type ) { + case Title: return "Title"; + case Section: return "Section"; + case Rule: return "Rule"; + case Parameter: return "Parameter"; + } + return "Rule"; + } + + + WidgetDescription::Type WidgetDescription::stringToType ( const string& s ) + { + if (s == "Title" ) return Title; + if (s == "Section" ) return Section; + if (s == "Parameter") return Parameter; + return Rule; + } + + +// ------------------------------------------------------------------- +// Class : "Cfg::TabDescription". + void TabDescription::addWidget ( WidgetDescription* widget ) { _widgets.push_back(widget); @@ -39,6 +66,12 @@ namespace Cfg { } +// ------------------------------------------------------------------- +// Class : "Cfg::LayoutDescription". + + size_t LayoutDescription::_timestamp = 0; + + WidgetDescription* LayoutDescription::getWidget ( const string& id ) { map::iterator iwid = _widgets.find(id); @@ -69,6 +102,7 @@ namespace Cfg { { TabDescription* tab = getTab ( tabName ); tab->addWidget ( WidgetDescription::rule() ); + ++_timestamp; } @@ -76,6 +110,7 @@ namespace Cfg { { TabDescription* tab = getTab ( tabName ); tab->addWidget ( WidgetDescription::title(title) ); + ++_timestamp; } @@ -83,6 +118,7 @@ namespace Cfg { { TabDescription* tab = getTab ( tabName ); tab->addWidget ( WidgetDescription::section(section,column) ); + ++_timestamp; } @@ -97,6 +133,7 @@ namespace Cfg { WidgetDescription* widget = WidgetDescription::parameter(id,label,column,span,flags); tab->addWidget ( widget ); + ++_timestamp; } diff --git a/vlsisapd/src/configuration/src/Parameter.cpp b/vlsisapd/src/configuration/src/Parameter.cpp index 253b6e97..738df86f 100644 --- a/vlsisapd/src/configuration/src/Parameter.cpp +++ b/vlsisapd/src/configuration/src/Parameter.cpp @@ -1,8 +1,7 @@ - // -*- C++ -*- // // This file is part of the VSLSI Stand-Alone Software. -// Copyright (c) UPMC 2008-2013, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -71,6 +70,46 @@ namespace Cfg { } + Parameter::Type Parameter::stringToType ( const std::string& stype ) + { + if (stype == "string" ) return String; + else if (stype == "int" ) return Int; + else if (stype == "double" ) return Double; + else if (stype == "bool" ) return Bool; + else if (stype == "percentage") return Percentage; + else if (stype == "enumerate" ) return Enumerate; + + return Unknown; + } + + + string Parameter::priorityToString ( Parameter::Priority priority ) + { + switch ( priority ) { + case UseDefault: return "UseDefault"; + case ApplicationBuiltin: return "ApplicationBuiltin"; + case ConfigurationFile: return "ConfigurationFile"; + case UserFile: return "UserFile"; + case CommandLine: return "CommandLine"; + case Interactive: return "Interactive"; + } + return "UseDefault"; + } + + + Parameter::Priority Parameter::stringToPriority ( const std::string& spriority ) + { + if (spriority == "UseDefault" ) return UseDefault; + else if (spriority == "ApplicationBuiltin") return ApplicationBuiltin; + else if (spriority == "ConfigurationFile" ) return ConfigurationFile; + else if (spriority == "UserFile" ) return UserFile; + else if (spriority == "CommandLine" ) return CommandLine; + else if (spriority == "Interactive" ) return Interactive; + + return UseDefault; + } + + Parameter::Parameter ( const std::string& id , Type type , const std::string& value @@ -156,6 +195,13 @@ namespace Cfg { } + bool Parameter::setRawString ( const string& s, Priority priority ) + { + if ( not _updatePriority(priority) ) return false; + return _doChange ( _flags|FromString, s, false, 0, 0.0 ); + } + + bool Parameter::setString ( const std::string& s, Priority priority, unsigned int flags ) { if ( not _updatePriority(priority) ) return false; diff --git a/vlsisapd/src/configuration/src/ParameterWidget.cpp b/vlsisapd/src/configuration/src/ParameterWidget.cpp index 44b5f66c..0f00ac95 100644 --- a/vlsisapd/src/configuration/src/ParameterWidget.cpp +++ b/vlsisapd/src/configuration/src/ParameterWidget.cpp @@ -1,15 +1,9 @@ - // -*- C++ -*- // // This file is part of the VSLSI Stand-Alone Software. -// Copyright (c) UPMC/LIP6 2010-2010, All Rights Reserved +// Copyright (c) UPMC 2010-2016, All Rights Reserved // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | C O R I O L I S | // | C o n f i g u r a t i o n D a t a - B a s e | // | | @@ -17,25 +11,22 @@ // | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Module : "./ParameterWidget.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ -#include "boost/bind.hpp" -#include -#include -#include -#include -#include -#include -#include -#include "vlsisapd/configuration/Parameter.h" -#include "vlsisapd/configuration/FilePathEdit.h" -#include "vlsisapd/configuration/ParameterWidget.h" -#include "vlsisapd/configuration/ConfTabWidget.h" -#include "vlsisapd/configuration/ConfigurationWidget.h" +#include "boost/bind.hpp" +#include +#include +#include +#include +#include +#include +#include +#include "vlsisapd/configuration/Parameter.h" +#include "vlsisapd/configuration/FilePathEdit.h" +#include "vlsisapd/configuration/ParameterWidget.h" +#include "vlsisapd/configuration/ConfTabWidget.h" +#include "vlsisapd/configuration/ConfigurationWidget.h" namespace Cfg { @@ -175,10 +166,14 @@ namespace Cfg { string valueId = _parameter->getId() + ".edit"; _valueWidget->setObjectName ( valueId.c_str() ); - _parameter->registerCb ( boost::bind(&ParameterWidget::onUpdateValueCb,this,_1) ); + _parameter->registerCb ( this, boost::bind(&ParameterWidget::onUpdateValueCb,this,_1) ); } + ParameterWidget::~ParameterWidget () + { _parameter->unregisterCb ( this ); } + + void ParameterWidget::updateValue () { if ( _parameter->getType() == Parameter::String ) diff --git a/vlsisapd/src/configuration/src/PyConfiguration.cpp b/vlsisapd/src/configuration/src/PyConfiguration.cpp index 4ee99124..5173092c 100644 --- a/vlsisapd/src/configuration/src/PyConfiguration.cpp +++ b/vlsisapd/src/configuration/src/PyConfiguration.cpp @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the VSLSI Stand-Alone Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | V L S I Stand - Alone Parsers / Drivers | diff --git a/vlsisapd/src/configuration/src/vlsisapd/configuration/Configuration.h b/vlsisapd/src/configuration/src/vlsisapd/configuration/Configuration.h index 6d264848..ad3c6f68 100644 --- a/vlsisapd/src/configuration/src/vlsisapd/configuration/Configuration.h +++ b/vlsisapd/src/configuration/src/vlsisapd/configuration/Configuration.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the VSLSI Stand-Alone Software. -// Copyright (c) UPMC/LIP6 2008-2015, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/vlsisapd/src/configuration/src/vlsisapd/configuration/ConfigurationWidget.h b/vlsisapd/src/configuration/src/vlsisapd/configuration/ConfigurationWidget.h index fbb218a6..6fb187b1 100644 --- a/vlsisapd/src/configuration/src/vlsisapd/configuration/ConfigurationWidget.h +++ b/vlsisapd/src/configuration/src/vlsisapd/configuration/ConfigurationWidget.h @@ -1,35 +1,25 @@ - // -*- C++ -*- // // This file is part of the VSLSI Stand-Alone Software. -// Copyright (c) UPMC/LIP6 2010-2010, All Rights Reserved +// Copyright (c) UPMC 2010-2016, All Rights Reserved // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | C O R I O L I S | // | C o n f i g u r a t i o n D a t a - B a s e | // | | // | Author : Jean-Paul Chaput | // | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | -// | C++ Header : "./ConfigurationWidget.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// | C++ Header : "./vlsisapd/configuration/ConfigurationWidget.h" | +// +-----------------------------------------------------------------+ +#ifndef CFG_CONFIGURATION_WIDGET_H +#define CFG_CONFIGURATION_WIDGET_H -#ifndef __CFG_CONFIGURATION_WIDGET__ -#define __CFG_CONFIGURATION_WIDGET__ - -#include -#include -#include +#include +#include +#include class QPushButton; class QTabWidget; @@ -46,7 +36,6 @@ namespace Cfg { // ------------------------------------------------------------------- // Class : "Cfg::ConfigurationWidget". - class ConfigurationWidget : public QWidget { Q_OBJECT; public: @@ -127,7 +116,6 @@ namespace Cfg { std::string toXml ( const std::string& ); -} // End of Cfg namespace. +} // Cfg namespace. - -#endif // __CFG_CONFIGURATION_WIDGET__ +#endif // CFG_CONFIGURATION_WIDGET_H diff --git a/vlsisapd/src/configuration/src/vlsisapd/configuration/LayoutDescription.h b/vlsisapd/src/configuration/src/vlsisapd/configuration/LayoutDescription.h index 08448f30..3cd7f2fd 100644 --- a/vlsisapd/src/configuration/src/vlsisapd/configuration/LayoutDescription.h +++ b/vlsisapd/src/configuration/src/vlsisapd/configuration/LayoutDescription.h @@ -1,12 +1,7 @@ - // -*- C++ -*- // // This file is part of the VSLSI Stand-Alone Software. -// Copyright (c) UPMC/LIP6 2010-2011, All Rights Reserved -// -// =================================================================== -// -// $Id$ +// Copyright (c) UPMC 2010-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -15,13 +10,12 @@ // | Author : Jean-Paul Chaput | // | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | -// | C++ Header : "./LayoutDescription.h" | +// | C++ Header : "./vlsisapd/configuration/LayoutDescription.h" | // +-----------------------------------------------------------------+ - -#ifndef __CFG_LAYOUT_DESCRIPTION__ -#define __CFG_LAYOUT_DESCRIPTION__ +#ifndef CFG_LAYOUT_DESCRIPTION_H +#define CFG_LAYOUT_DESCRIPTION_H #include #include @@ -39,10 +33,12 @@ namespace Cfg { // ------------------------------------------------------------------- // Class : "Cfg::WidgetDescription". - class WidgetDescription { public: enum Type { Title=1, Section=2, Rule=3, Parameter=4 }; + public: + static std::string typeToString ( Type ); + static Type stringToType ( const std::string& ); public: inline static WidgetDescription* rule (); inline static WidgetDescription* title ( const std::string& title ); @@ -115,7 +111,6 @@ namespace Cfg { // ------------------------------------------------------------------- // Class : "Cfg::TabDescription". - class TabDescription { public: inline TabDescription ( LayoutDescription*, const std::string& name, const std::string& id ); @@ -151,6 +146,8 @@ namespace Cfg { class LayoutDescription { + public: + inline static size_t getTimestamp (); public: inline LayoutDescription ( Configuration* ); WidgetDescription* getWidget ( const std::string& id ); @@ -175,14 +172,17 @@ namespace Cfg { ConfigurationWidget* buildWidget ( unsigned int flags ); void writeToStream ( std::ostream&, const std::string& ) const; private: - Configuration* _configuration; - std::vector _tabs; - std::map _widgets; + static size_t _timestamp; + Configuration* _configuration; + std::vector _tabs; + std::map _widgets; }; // Inline Methods. - inline LayoutDescription::LayoutDescription ( Configuration* cfg ) + inline size_t LayoutDescription::getTimestamp () { return _timestamp; } + + inline LayoutDescription::LayoutDescription ( Configuration* cfg ) : _configuration(cfg), _tabs(), _widgets() { } diff --git a/vlsisapd/src/configuration/src/vlsisapd/configuration/Parameter.h b/vlsisapd/src/configuration/src/vlsisapd/configuration/Parameter.h index 0aabeb8d..34f512af 100644 --- a/vlsisapd/src/configuration/src/vlsisapd/configuration/Parameter.h +++ b/vlsisapd/src/configuration/src/vlsisapd/configuration/Parameter.h @@ -1,8 +1,7 @@ - // -*- C++ -*- // // This file is part of the VSLSI Stand-Alone Software. -// Copyright (c) UPMC/LIP6 2008-2012, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -15,8 +14,8 @@ // +-----------------------------------------------------------------+ -#ifndef __CFG_CONFIGURATION_PARAMETER__ -#define __CFG_CONFIGURATION_PARAMETER__ +#ifndef CFG_CONFIGURATION_PARAMETER_H +#define CFG_CONFIGURATION_PARAMETER_H #include #include @@ -66,6 +65,9 @@ namespace Cfg { }; public: static std::string typeToString ( Type ); + static std::string priorityToString ( Priority ); + static Type stringToType ( const std::string& ); + static Priority stringToPriority ( const std::string& ); static Priority pushDefaultPriority ( Priority ); static Priority popDefaultPriority (); static Priority getDefaultPriority (); @@ -82,7 +84,8 @@ namespace Cfg { inline bool hasMustExist () const; inline bool hasFlags ( int mask ) const; inline const std::string& getId () const; - inline const Type getType () const; + inline Type getType () const; + inline Priority getPriority () const; inline const std::vector& getValues () const; inline const std::vector& @@ -105,6 +108,7 @@ namespace Cfg { inline void setPriority ( Priority ); inline void setFlags ( int mask ); inline void unsetFlags ( int mask ); + bool setRawString ( const std::string& , Priority priority=UseDefault ); bool setString ( const std::string& , Priority priority=UseDefault , unsigned int flags =AllRequirements @@ -117,26 +121,28 @@ namespace Cfg { void setMax ( int , Priority priority=UseDefault ); void setMin ( double, Priority priority=UseDefault ); void setMax ( double, Priority priority=UseDefault ); - inline void registerCb ( ParameterChangedCb_t ); + inline void registerCb ( void* tag, ParameterChangedCb_t ); + inline void unregisterCb ( void* tag ); + inline void valueChanged (); private: inline void _onValueChanged (); inline bool _updatePriority ( Priority ); bool _doChange ( unsigned int flags, const std::string&, bool, int, double ); private: // Attributes. - static std::vector _defaultPriorities; - std::string _id; - Type _type; - std::string _value; - std::vector _values; - int _priority; - int _flags; - int _minInt; - int _maxInt; - double _minDouble; - double _maxDouble; - std::vector _slaves; - std::vector _callbacks; + static std::vector _defaultPriorities; + std::string _id; + Type _type; + std::string _value; + std::vector _values; + Priority _priority; + int _flags; + int _minInt; + int _maxInt; + double _minDouble; + double _maxDouble; + std::vector _slaves; + std::vector< std::pair > _callbacks; }; @@ -148,7 +154,8 @@ namespace Cfg { inline bool Parameter::hasNeedRestart () const { return hasFlags(NeedRestart); }; inline bool Parameter::hasMustExist () const { return hasFlags(MustExist); }; inline const std::string& Parameter::getId () const { return _id; } - inline const Parameter::Type Parameter::getType () const { return _type; } + inline Parameter::Type Parameter::getType () const { return _type; } + inline Parameter::Priority Parameter::getPriority () const { return _priority; } inline int Parameter::getFlags () const { return _flags; } inline bool Parameter::hasFlags ( int mask ) const { return (_flags & mask); } inline int Parameter::getMinInt () const { return _minInt; } @@ -159,6 +166,7 @@ namespace Cfg { inline void Parameter::setFlags ( int mask ) { _flags |= mask; } inline void Parameter::unsetFlags ( int mask ) { _flags &= ~mask; } inline void Parameter::setPriority ( Priority priority ) { _priority = priority; } + inline void Parameter::valueChanged () { _onValueChanged(); } inline bool Parameter::checkValue ( int value ) const { bool ok = not ( ( (_flags&HasMin) and (value < _minInt) ) @@ -194,8 +202,17 @@ namespace Cfg { inline Parameter::EnumValue::EnumValue ( const std::string& label, int value ) : _label(label), _value(value) { } - inline void Parameter::registerCb ( ParameterChangedCb_t cb ) { _callbacks.push_back(cb); } + inline void Parameter::registerCb ( void* tag, ParameterChangedCb_t cb ) + { + _callbacks.push_back(make_pair(tag,cb)); cb(this); + } + inline void Parameter::unregisterCb ( void* tag ) + { + for ( auto icb = _callbacks.begin() ; icb != _callbacks.end() ; ++icb ) { + if ( (*icb).first == tag ) { _callbacks.erase( icb ); break; } + } + } inline bool Parameter::_updatePriority ( Priority priority ) { @@ -206,10 +223,9 @@ namespace Cfg { } inline void Parameter::_onValueChanged () - { for ( size_t icb=0 ; icb<_callbacks.size() ; ++icb ) _callbacks[icb]( this ); } + { for ( size_t icb=0 ; icb<_callbacks.size() ; ++icb ) _callbacks[icb].second( this ); } -} // End of Cfg namespace. +} // Cfg namespace. - -#endif // __CFG_CONFIGURATION_PARAMETER__ +#endif // CFG_CONFIGURATION_PARAMETER_H diff --git a/vlsisapd/src/configuration/src/vlsisapd/configuration/ParameterWidget.h b/vlsisapd/src/configuration/src/vlsisapd/configuration/ParameterWidget.h index 3fd47269..084a1425 100644 --- a/vlsisapd/src/configuration/src/vlsisapd/configuration/ParameterWidget.h +++ b/vlsisapd/src/configuration/src/vlsisapd/configuration/ParameterWidget.h @@ -1,15 +1,9 @@ - // -*- C++ -*- // // This file is part of the VSLSI Stand-Alone Software. -// Copyright (c) UPMC/LIP6 2010-2010, All Rights Reserved +// Copyright (c) UPMC 2010-2016, All Rights Reserved // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | C O R I O L I S | // | C o n f i g u r a t i o n D a t a - B a s e | // | | @@ -17,15 +11,11 @@ // | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Header : "./ParameterWidget.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ - -#ifndef __CFG_PARAMETER_WIDGET__ -#define __CFG_PARAMETER_WIDGET__ +#ifndef CFG_PARAMETER_WIDGET_H +#define CFG_PARAMETER_WIDGET_H #include #include @@ -42,26 +32,26 @@ namespace Cfg { // ------------------------------------------------------------------- // Class : "Cfg::ParameterWidget". - class ParameterWidget : public QObject { Q_OBJECT; public: enum Flags { UseSpinBox=0x1, IsFileName=0x2, IsPathName=0x4 }; public: - ParameterWidget ( ConfTabWidget* parent, Parameter*, const std::string& label, int flags ); - inline Parameter* getParameter (); - inline QLabel* getLabelWidget (); - inline QWidget* getValueWidget (); - inline ConfTabWidget* getConfTabWidget (); - ConfigurationWidget* getConfigurationWidget (); - inline int getFlags () const; - inline bool hasFlags ( int mask ) const; - inline void setFlags ( int mask ); - inline void unsetFlags ( int mask ); - void onUpdateValueCb ( Parameter* ); + ParameterWidget ( ConfTabWidget* parent, Parameter*, const std::string& label, int flags ); + virtual ~ParameterWidget (); + inline Parameter* getParameter (); + inline QLabel* getLabelWidget (); + inline QWidget* getValueWidget (); + inline ConfTabWidget* getConfTabWidget (); + ConfigurationWidget* getConfigurationWidget (); + inline int getFlags () const; + inline bool hasFlags ( int mask ) const; + inline void setFlags ( int mask ); + inline void unsetFlags ( int mask ); + void onUpdateValueCb ( Parameter* ); public slots: - void updateValue (); - void enableSlaves ( int ); + void updateValue (); + void enableSlaves ( int ); public: ConfTabWidget* _confTabWidget; Parameter* _parameter; @@ -82,6 +72,6 @@ namespace Cfg { inline void ParameterWidget::unsetFlags ( int mask ) { _flags &= ~mask; } -} // End of Cfg namespace. +} // Cfg namespace. -#endif // __CFG_PARAMETER_WIDGET__ +#endif // CFG_PARAMETER_WIDGET_H diff --git a/vlsisapd/src/liberty/src/LibertyParserScanner.ll b/vlsisapd/src/liberty/src/LibertyParserScanner.ll index 11e5fe01..e03820d3 100644 --- a/vlsisapd/src/liberty/src/LibertyParserScanner.ll +++ b/vlsisapd/src/liberty/src/LibertyParserScanner.ll @@ -3,6 +3,7 @@ %{ +#include #include #include #include diff --git a/vlsisapd/src/openChams/src/CMakeLists.txt b/vlsisapd/src/openChams/src/CMakeLists.txt index 01f87f6e..0d86e749 100644 --- a/vlsisapd/src/openChams/src/CMakeLists.txt +++ b/vlsisapd/src/openChams/src/CMakeLists.txt @@ -1,4 +1,9 @@ -INCLUDE_DIRECTORIES(${VLSISAPD_SOURCE_DIR}/src/openChams/src ${LIBXML2_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} ${PYTHON_INCLUDE_PATH}) +INCLUDE_DIRECTORIES( ${VLSISAPD_SOURCE_DIR}/src/openChams/src + ${LIBXML2_INCLUDE_DIR} + ${Boost_INCLUDE_DIRS} + ${PYTHON_INCLUDE_PATH} + ${HURRICANE_INCLUDE_DIR} + ) SET ( hpps vlsisapd/openChams/Circuit.h vlsisapd/openChams/Netlist.h @@ -21,6 +26,7 @@ SET ( hpps vlsisapd/openChams/Circuit.h vlsisapd/openChams/NRCCstr.h vlsisapd/openChams/DDP.h vlsisapd/openChams/DesignerCstrOC.h + vlsisapd/openChams/SlicingTree.h ) SET ( cpps Circuit.cpp Netlist.cpp @@ -41,23 +47,24 @@ SET ( cpps Circuit.cpp NRCCstr.cpp DDP.cpp DesignerCstrOC.cpp - ) -SET ( pycpps PyOpenChams.cpp - ) + SlicingTree.cpp + ) + SET ( pycpps PyOpenChams.cpp + ) -ADD_LIBRARY(openChams ${cpps}) -TARGET_LINK_LIBRARIES(openChams ${LIBXML2_LIBRARIES}) -SET_TARGET_PROPERTIES(openChams PROPERTIES VERSION 1.0 SOVERSION 1) -INSTALL(TARGETS openChams DESTINATION lib${LIB_SUFFIX} ) + ADD_LIBRARY(openChams ${cpps}) + TARGET_LINK_LIBRARIES(openChams ${LIBXML2_LIBRARIES}) + SET_TARGET_PROPERTIES(openChams PROPERTIES VERSION 1.0 SOVERSION 1) + INSTALL(TARGETS openChams DESTINATION lib${LIB_SUFFIX} ) -IF(Boost_FOUND) - ADD_LIBRARY(pyOPENCHAMS MODULE ${pycpps}) - SET_TARGET_PROPERTIES(pyOPENCHAMS PROPERTIES - OUTPUT_NAME "OPENCHAMS" - PREFIX "" - ) - TARGET_LINK_LIBRARIES(pyOPENCHAMS openChams ${LIBXML2_LIBRARIES} ${Boost_LIBRARIES} ${PYTHON_LIBRARIES}) - INSTALL(TARGETS pyOPENCHAMS DESTINATION ${PYTHON_SITE_PACKAGES}) -ENDIF(Boost_FOUND) + IF(Boost_FOUND) + ADD_LIBRARY(pyOPENCHAMS MODULE ${pycpps}) + SET_TARGET_PROPERTIES(pyOPENCHAMS PROPERTIES + OUTPUT_NAME "OPENCHAMS" + PREFIX "" + ) + TARGET_LINK_LIBRARIES(pyOPENCHAMS openChams ${LIBXML2_LIBRARIES} ${Boost_LIBRARIES} ${PYTHON_LIBRARIES}) + INSTALL(TARGETS pyOPENCHAMS DESTINATION ${PYTHON_SITE_PACKAGES}) + ENDIF(Boost_FOUND) -INSTALL(FILES ${hpps} DESTINATION include/vlsisapd/openChams) + INSTALL(FILES ${hpps} DESTINATION include/vlsisapd/openChams) diff --git a/vlsisapd/src/openChams/src/Circuit.cpp b/vlsisapd/src/openChams/src/Circuit.cpp index a0d2512e..38fb6600 100644 --- a/vlsisapd/src/openChams/src/Circuit.cpp +++ b/vlsisapd/src/openChams/src/Circuit.cpp @@ -2,13 +2,14 @@ // -*- C++ -*- // // This file is part of the VLSI SAPD Software. -// Copyright (c) UPMC/LIP6 2009-2012, All Rights Reserved +// Copyright (c) UPMC/LIP6 2009-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | V L S I S A P D | // | OpenChams Circuit Data Base | // | | // | Author : Damien Dupuis | +// | Eric Lao | // | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Module : "./Circuit.cpp" | @@ -152,6 +153,7 @@ namespace OpenChams { static bool readSchematicDone = false; static bool readSizingDone = false; static bool readLayoutDone = false; + static bool readSlicingTreeDone = false; Circuit::Circuit(const std::string& name, const std::string& techno) : _name (name) @@ -161,6 +163,7 @@ namespace OpenChams { , _schematic (NULL) , _sizing (NULL) , _layout (NULL) + , _slicingtree (NULL) { readSubCircuitsPathsDone = false; readCircuitParametersDone = false; @@ -981,16 +984,16 @@ namespace OpenChams { Layout* layout = new Layout(this); xmlNode* child = node->children; - //cerr << "** L ** " << node->name << ": " << node->type << endl; + //cerr << "** L ** " << node->name << ": " << node->type << endl; for (xmlNode* node = child; node; node = node->next) { if (node->type == XML_ELEMENT_NODE) { - if (xmlStrEqual(node->name, (xmlChar*)"instance")) { - readInstanceLayout(node, layout); - } else if (xmlStrEqual(node->name, (xmlChar*)"hbtree")) { - readHBTree(node, layout); - } else { - cerr << "[WARNING] Only 'instance' and 'hbtree' nodes are allowed in 'layout' section, others will be ignored." << endl; - } + if (xmlStrEqual(node->name, (xmlChar*)"instance")) { + readInstanceLayout(node, layout); + } else if (xmlStrEqual(node->name, (xmlChar*)"hbtree")) { + readHBTree(node, layout); + } else { + cerr << "[WARNING] Only 'instance' and 'hbtree' nodes are allowed in 'layout' section, others will be ignored." << endl; + } } } readLayoutDone = true; @@ -1010,10 +1013,10 @@ namespace OpenChams { } void Circuit::readHBTree(xmlNode* node, Layout* layout) { - // HBTree node can have only one child (group or bloc) + // HBTree node can have only one child (group or bloc) xmlNode* child = node->children; if (child->type == XML_ELEMENT_NODE) { - // create root node + // create root node // thanks to readNodeOrBloc Node* root = readNodeOrBloc(child); // save root node in layout @@ -1022,70 +1025,70 @@ namespace OpenChams { } Node* Circuit::readNodeOrBloc(xmlNode* node, Node* parent) { - // 1 - create Node based on xmlNode* passed as argument + // 1 - create Node based on xmlNode* passed as argument if (node->type == XML_ELEMENT_NODE) { bool isAGroup = xmlStrEqual(node->name, (xmlChar*)"group"); xmlChar* nameC = xmlGetProp(node, (xmlChar*)"name"); xmlChar* posiC = xmlGetProp(node, (xmlChar*)"position"); if (!nameC) - throw OpenChamsException("[ERROR] 'bloc' and 'group' nodes in 'hbtree' must have at least a 'name' property."); + throw OpenChamsException("[ERROR] 'bloc' and 'group' nodes in 'hbtree' must have at least a 'name' property."); Node* nodeOC = NULL; const std::string& name ((const char*)nameC); Node::Position pos = Node::NONE; if (posiC) { - string posStr ((const char*)posiC); - if (posStr == "right") pos = Node::RIGHT; - else if (posStr == "top") pos = Node::TOP; - else throw OpenChamsException("[ERROR] 'position' property of 'bloc' and 'group' nodes must be 'right' or 'top'."); + string posStr ((const char*)posiC); + if (posStr == "right") pos = Node::RIGHT; + else if (posStr == "top") pos = Node::TOP; + else throw OpenChamsException("[ERROR] 'position' property of 'bloc' and 'group' nodes must be 'right' or 'top'."); } if (isAGroup) { - Group* groupOC = new Group(name, pos, parent); - xmlChar* isolatC = xmlGetProp(node, (xmlChar*)"isolation"); - xmlChar* alignC = xmlGetProp(node, (xmlChar*)"align"); - xmlChar* pairedC = xmlGetProp(node, (xmlChar*)"paired"); - if (isolatC) { - string isolation ((const char*)isolatC); - if (isolation == "true") groupOC->setIsolated(true); - else if (isolation == "false") groupOC->setIsolated(false); - else throw OpenChamsException("[ERROR] 'isolation' property of 'group' node must be 'true' or 'false'."); - } - if (alignC) { - string align ((const char*)alignC); - Group::Align galign = Group::NONE; - if (align == "vertical") galign = Group::VERTICAL; - else if (align == "horizontal") galign = Group::HORIZONTAL; - else throw OpenChamsException("[ERROR] 'align' property of 'group' node must be 'vertical' or 'horizontal'."); - groupOC->setAlign(galign); - } - if (pairedC) { - string paired ((const char*)pairedC); - if (paired == "true") groupOC->setPaired(true); - else if (paired == "false") groupOC->setPaired(false); - else throw OpenChamsException("[ERROR] 'paired' property of 'group' node must be 'true' or 'false'."); - } - nodeOC = groupOC; + Group* groupOC = new Group(name, pos, parent); + xmlChar* isolatC = xmlGetProp(node, (xmlChar*)"isolation"); + xmlChar* alignC = xmlGetProp(node, (xmlChar*)"align"); + xmlChar* pairedC = xmlGetProp(node, (xmlChar*)"paired"); + if (isolatC) { + string isolation ((const char*)isolatC); + if (isolation == "true") groupOC->setIsolated(true); + else if (isolation == "false") groupOC->setIsolated(false); + else throw OpenChamsException("[ERROR] 'isolation' property of 'group' node must be 'true' or 'false'."); + } + if (alignC) { + string align ((const char*)alignC); + Group::Align galign = Group::NONE; + if (align == "vertical") galign = Group::VERTICAL; + else if (align == "horizontal") galign = Group::HORIZONTAL; + else throw OpenChamsException("[ERROR] 'align' property of 'group' node must be 'vertical' or 'horizontal'."); + groupOC->setAlign(galign); + } + if (pairedC) { + string paired ((const char*)pairedC); + if (paired == "true") groupOC->setPaired(true); + else if (paired == "false") groupOC->setPaired(false); + else throw OpenChamsException("[ERROR] 'paired' property of 'group' node must be 'true' or 'false'."); + } + nodeOC = groupOC; } else { - nodeOC = new Bloc(name, pos, parent); + nodeOC = new Bloc(name, pos, parent); } - // 2 - for each children (up to 2) readNodeOrBloc + // 2 - for each children (up to 2) readNodeOrBloc for (xmlNode* child = node->children; child; child = child->next) { - if (child->type == XML_ELEMENT_NODE) { - Node* childOC = readNodeOrBloc(child, nodeOC); - // 3 - add to returned Node* to current Node* as right or top children (based on its position) - switch(childOC->getPosition()) { - case Node::RIGHT: - nodeOC->setRight(childOC); - break; - case Node::TOP: - nodeOC->setTop(childOC); - break; - case Node::NONE: - if (!isAGroup) - throw OpenChamsException("[ERROR] a 'bloc' or 'group' without position is only allowed directly under a 'group'."); - Group* groupOC = dynamic_cast(nodeOC); - groupOC->setRootNode(childOC); - } - } + if (child->type == XML_ELEMENT_NODE) { + Node* childOC = readNodeOrBloc(child, nodeOC); + // 3 - add to returned Node* to current Node* as right or top children (based on its position) + switch(childOC->getPosition()) { + case Node::RIGHT: + nodeOC->setRight(childOC); + break; + case Node::TOP: + nodeOC->setTop(childOC); + break; + case Node::NONE: + if (!isAGroup) + throw OpenChamsException("[ERROR] a 'bloc' or 'group' without position is only allowed directly under a 'group'."); + Group* groupOC = dynamic_cast(nodeOC); + groupOC->setRootNode(childOC); + } + } } // 4 - return current Node return nodeOC; @@ -1103,6 +1106,254 @@ namespace OpenChams { _absolutePath = _absolutePath.substr(0, found); } + + // SLICINGTREE // + void Circuit::readSlicingTree(xmlNode* node) { + if (readSlicingTreeDone) { + cerr << "[WARNING] Only one 'slicingtree' is allowed in circuit, others will be ignored." << endl; + return; + } + _slicingtree = readSlicingNode(node); + readSlicingTreeDone = true; + } + + SlicingNode* Circuit::readSlicingNode(xmlNode* xnode, SlicingNode* slicingNode) { + SlicingNode* snode = NULL; + + xmlNode* child = xnode->children; + for (xmlNode* node = child; node; node = node->next) { + if (node->type == XML_ELEMENT_NODE) { + if (xmlStrEqual(node->name , (xmlChar*)"vertical" )) { + snode = createVerticalSlicingNode (node, slicingNode); + } else if (xmlStrEqual(node->name , (xmlChar*)"horizontal")) { + snode = createHorizontalSlicingNode(node, slicingNode); + } else if (xmlStrEqual(node->name , (xmlChar*)"device" )) { + snode = createDeviceSlicingNode (node, slicingNode); + } else if (xmlStrEqual(node->name , (xmlChar*)"routing" )) { + snode = createRoutingSlicingNode (node, slicingNode); + } else if (!xmlStrEqual(node->name, (xmlChar*)"comment" )) { + cerr << "[WARNING] Unknown " << node->name << " node in 'slicingtree' section, it will be ignored." << endl; + } + } + } + return snode; + } + + VSlicingNode* Circuit::createVerticalSlicingNode (xmlNode* xnode, SlicingNode* slicingNode) { + VSlicingNode* vnode = VSlicingNode::create(slicingNode); + + xmlNode* child = xnode->children; + for (xmlNode* node = child; node; node = node->next) { + if (xmlStrEqual(node->name , (xmlChar*)"parameters")) { + setHVParameters(node, vnode); + } else if (xmlStrEqual(node->name, (xmlChar*)"symmetries")) { + setHVSymmetries(node, vnode); + } else if (xmlStrEqual(node->name, (xmlChar*)"children" )) { + addChildren(node, vnode); + } else if (!xmlStrEqual(node->name,(xmlChar*)"comment" )) { + cerr << "[WARNING] Unknown " << node->name << " node in 'vertical' section, it will be ignored." << endl; + } + } + return vnode; + } + + HSlicingNode* Circuit::createHorizontalSlicingNode (xmlNode* xnode, SlicingNode* slicingNode) { + HSlicingNode* hnode = HSlicingNode::create(slicingNode); + + xmlNode* child = xnode->children; + for (xmlNode* node = child; node; node = node->next) { + if (xmlStrEqual(node->name, (xmlChar*)"children")) { + addChildren(node, hnode); + } else if (xmlStrEqual(node->name , (xmlChar*)"parameters")) { + setHVParameters(node, hnode); + } else if (xmlStrEqual(node->name , (xmlChar*)"symmetries")) { + setHVSymmetries(node, hnode); + } else if (!xmlStrEqual(node->name, (xmlChar*)"comment" )){ + cerr << "[WARNING] Unknown " << node->name << " node in 'horizontal' section, it will be ignored." << endl; + } + } + return hnode; + } + + void Circuit::addChildren (xmlNode* xnode, HVSlicingNode* hvnode) { + xmlNode* child = xnode->children; + for (xmlNode* node = child; node; node = node->next) { + if (node->type == XML_ELEMENT_NODE) { + if (xmlStrEqual(node->name , (xmlChar*)"vertical" )) { + hvnode->push_back(createVerticalSlicingNode (node, hvnode)); + } else if (xmlStrEqual(node->name , (xmlChar*)"horizontal")) { + hvnode->push_back(createHorizontalSlicingNode(node, hvnode)); + } else if (xmlStrEqual(node->name , (xmlChar*)"device" )) { + hvnode->push_back(createDeviceSlicingNode (node, hvnode)); + } else if (xmlStrEqual(node->name , (xmlChar*)"routing" )) { + hvnode->push_back(createRoutingSlicingNode (node, hvnode)); + } else if (!xmlStrEqual(node->name, (xmlChar*)"comment" )){ + cerr << "[WARNING] Unknown " << node->name << " node in 'slicingtree' section, it will be ignored." << endl; + } + } + } + } + + void Circuit::setHVParameters (xmlNode* xnode, HVSlicingNode* hvnode) { + bool toleranceRatioHSet = false; + bool toleranceRatioWSet = false; + bool toleranceBandHSet = false; + bool toleranceBandWSet = false; + + xmlNode* child = xnode->children; + for (xmlNode* node = child; node; node = node->next) { + xmlChar* typeC = xmlGetProp(node, (xmlChar*)"type"); + + if (typeC) { + string type ((const char*)typeC); + + if (type == "alignment") { + xmlChar* alignmentC = xmlGetProp(node, (xmlChar*)"alignment"); + if (alignmentC){ + string alignment ((const char*)alignmentC); + hvnode->setAlignment(alignment); + } + } else if (type == "toleranceBandH") { + xmlChar* toleranceBandHC = xmlGetProp(node, (xmlChar*)"toleranceBandH"); + if (toleranceBandHC){ + string toleranceBandH ((const char*)toleranceBandHC); + hvnode->setToleranceBandH(toleranceBandH); + toleranceBandHSet = true; + } + } else if (type == "toleranceBandW") { + xmlChar* toleranceBandWC = xmlGetProp(node, (xmlChar*)"toleranceBandW"); + if (toleranceBandWC){ + string toleranceBandW ((const char*)toleranceBandWC); + hvnode->setToleranceBandW(toleranceBandW); + toleranceBandWSet = true; + } + } else if (type == "toleranceRatioH") { + xmlChar* toleranceRatioHC = xmlGetProp(node, (xmlChar*)"toleranceRatioH"); + if (toleranceRatioHC){ + string toleranceRatioH ((const char*)toleranceRatioHC); + hvnode->setToleranceRatioH(toleranceRatioH); + toleranceRatioHSet = true; + } + } else if (type == "toleranceRatioW") { + xmlChar* toleranceRatioWC = xmlGetProp(node, (xmlChar*)"toleranceRatioW"); + if (toleranceRatioWC){ + string toleranceRatioW ((const char*)toleranceRatioWC); + hvnode->setToleranceRatioW(toleranceRatioW); + toleranceRatioWSet = true; + } + } else if (!xmlStrEqual(node->name, (xmlChar*)"comment" )){ + cerr << "[WARNING] Unknown " << node->name << " node in 'HVparameters' section, it will be ignored." << endl; + } + } + } + + if (!hvnode->isRoot()){ + if (!toleranceRatioHSet){ + hvnode->setToleranceRatioH(hvnode->getParent()->getToleranceRatioH()); + } + if (!toleranceRatioWSet){ + hvnode->setToleranceRatioW(hvnode->getParent()->getToleranceRatioW()); + } + if (!toleranceBandHSet){ + hvnode->setToleranceBandH(hvnode->getParent()->getToleranceBandH()); + } + if (!toleranceBandWSet){ + hvnode->setToleranceBandW(hvnode->getParent()->getToleranceBandW()); + } + } + } + + void Circuit::setHVSymmetries (xmlNode* xnode, HVSlicingNode* hvnode) { + xmlNode* child = xnode->children; + for (xmlNode* node = child; node; node = node->next) { + xmlChar* sourceC = xmlGetProp(node, (xmlChar*)"source"); + xmlChar* targetC = xmlGetProp(node, (xmlChar*)"target"); + if ((sourceC)&&(targetC)) { + string source ((const char*)sourceC); + string target ((const char*)targetC); + hvnode->addSymmetry(source, target); + } else if (!xmlStrEqual(node->name, (xmlChar*)"comment" )){ + cerr << "[WARNING] Unknown " << node->name << " node in 'HVsymmetries' section, it will be ignored." << endl; + } + } + } + + DSlicingNode* Circuit::createDeviceSlicingNode (xmlNode* xnode, SlicingNode* slicingNode) { + DSlicingNode* dnode = NULL; + + xmlChar* instanceNameC = xmlGetProp(xnode, (xmlChar*)"instance"); + if (instanceNameC){ + string instanceName ((const char*)instanceNameC); + dnode = DSlicingNode::create( instanceName, slicingNode ); + + xmlNode* child = xnode->children; + for (xmlNode* node = child; node; node = node->next) { + xmlChar* typeC = xmlGetProp(node, (xmlChar*)"type"); + if (typeC) { + string type ((const char*)typeC); + + if (type == "alignment") { + xmlChar* alignmentC = xmlGetProp(node, (xmlChar*)"alignment"); + if (alignmentC){ + string alignment ((const char*)alignmentC); + dnode->setAlignment(alignment); + } + } else if (type == "preset") { + xmlChar* presetC = xmlGetProp(node, (xmlChar*)"preset"); + if (presetC){ + string preset ((const char*)presetC); + dnode->setPreset(preset); + } + } else if (type == "nfing") { + xmlChar* nfingC = xmlGetProp(node, (xmlChar*)"nfing"); + if (nfingC){ + string nfing ((const char*)nfingC); + dnode->setNFing(nfing); + } + } else if (type == "x") { + xmlChar* xC = xmlGetProp(node, (xmlChar*)"x"); + if (xC){ + string x ((const char*)xC); + dnode->setX(x); + } + } else if (type == "y") { + xmlChar* yC = xmlGetProp(node, (xmlChar*)"y"); + if (yC){ + string y ((const char*)yC); + dnode->setY(y); + } + } else if (type == "nodeSets") { + xmlChar* startC = xmlGetProp(node, (xmlChar*)"start"); + xmlChar* stepC = xmlGetProp(node, (xmlChar*)"step"); + xmlChar* countC = xmlGetProp(node, (xmlChar*)"count"); + if ( (startC) && (stepC) && (countC) ){ + string start ((const char*)startC); + string step ((const char*)stepC); + string count ((const char*)countC); + dnode->setStart(start); + dnode->setStep (step); + dnode->setCount(count); + } + } else + cerr << "[WARNING] Unknown " << type << " type in 'device/parameter' section, it will be ignored." << endl; + } else if (!xmlStrEqual(node->name, (xmlChar*)"comment" )){ + cerr << "[WARNING] Unknown " << node->name << " node in 'device' section, it will be ignored." << endl; + } + } + } + return dnode; + } + + RSlicingNode* Circuit::createRoutingSlicingNode (xmlNode* xnode, SlicingNode* slicingNode) { + RSlicingNode* rnode = NULL; + xmlChar* valueC = xmlGetProp(xnode, (xmlChar*)"value"); + if (valueC){ + string value ((const char*)valueC); + rnode = RSlicingNode::create(value, slicingNode); + } + return rnode; + } + Circuit* Circuit::readFromFile(const string filePath) { LIBXML_TEST_VERSION; Circuit* cir = NULL; @@ -1112,7 +1363,7 @@ namespace OpenChams { string error ("[ERROR] Failed to parse: "); error += filePath; throw OpenChamsException(error); - //return NULL; + //return NULL; } xmlNode* rootElement = xmlDocGetRootElement(doc); if (rootElement->type == XML_ELEMENT_NODE && xmlStrEqual(rootElement->name, (xmlChar*)"circuit")) { @@ -1120,47 +1371,50 @@ namespace OpenChams { xmlChar* technoNameC = xmlGetProp(rootElement, (xmlChar*)"techno"); if (circuitNameC && technoNameC) { - const std::string& circuitName ((const char*)circuitNameC); - const std::string& technoName ((const char*)technoNameC); - cir = new Circuit(circuitName, technoName); + const std::string& circuitName ((const char*)circuitNameC); + const std::string& technoName ((const char*)technoNameC); + cir = new Circuit(circuitName, technoName); } else { - throw OpenChamsException("[ERROR] 'circuit' node must have 'name' and 'techno' properties."); - return NULL; + throw OpenChamsException("[ERROR] 'circuit' node must have 'name' and 'techno' properties."); + return NULL; } cir->setAbsolutePath(filePath); xmlNode* child = rootElement->children; for (xmlNode* node = child; node; node = node->next) { - if (node->type == XML_ELEMENT_NODE) { - if (xmlStrEqual(node->name, (xmlChar*)"subCircuitsPaths")) { - cir->readSubCircuitsPaths(node); - } - else if (xmlStrEqual(node->name, (xmlChar*)"parameters")) { - cir->readCircuitParameters(node); - } - else if (xmlStrEqual(node->name, (xmlChar*)"simulModels")) { - cir->readSimulModels(node); - } - else if (xmlStrEqual(node->name, (xmlChar*)"netlist")) { - cir->readNetList(node); - } - else if (xmlStrEqual(node->name, (xmlChar*)"schematic")) { - cir->readSchematic(node); - } - else if (xmlStrEqual(node->name, (xmlChar*)"sizing")) { - cir->readSizing(node); - } - else if (xmlStrEqual(node->name, (xmlChar*)"layout")) { - cir->readLayout(node); - } - else { - string error("[ERROR] Unknown section "); - error += string((const char*)node->name); - error += " in circuit description."; - throw OpenChamsException(error); - return NULL; - } - } + if (node->type == XML_ELEMENT_NODE) { + if (xmlStrEqual(node->name, (xmlChar*)"subCircuitsPaths")) { + cir->readSubCircuitsPaths(node); + } + else if (xmlStrEqual(node->name, (xmlChar*)"parameters")) { + cir->readCircuitParameters(node); + } + else if (xmlStrEqual(node->name, (xmlChar*)"simulModels")) { + cir->readSimulModels(node); + } + else if (xmlStrEqual(node->name, (xmlChar*)"netlist")) { + cir->readNetList(node); + } + else if (xmlStrEqual(node->name, (xmlChar*)"schematic")) { + cir->readSchematic(node); + } + else if (xmlStrEqual(node->name, (xmlChar*)"sizing")) { + cir->readSizing(node); + } + else if (xmlStrEqual(node->name, (xmlChar*)"layout")) { + cir->readLayout(node); + } + else if (xmlStrEqual(node->name, (xmlChar*)"slicingtree")) { + cir->readSlicingTree(node); + } + else { + string error("[ERROR] Unknown section "); + error += string((const char*)node->name); + error += " in circuit description."; + throw OpenChamsException(error); + return NULL; + } + } } } if (!readNetListDone) { @@ -1213,6 +1467,16 @@ namespace OpenChams { return _layout; } + void Circuit::setSlicingTree( SlicingNode* slicingtree ) { + if (_slicingtree) + throw OpenChamsException("[ERROR] Cannot create two slicing trees in one circuit."); + + _slicingtree = slicingtree; + if (!_slicingtree) + throw OpenChamsException("[ERROR] Cannot create slicingtree."); + + } + void Circuit::driveHBTree(ofstream& file, Node* node, unsigned indent) { if (!node) return; for (unsigned i = 0 ; i < indent ; i++) @@ -1233,16 +1497,16 @@ namespace OpenChams { if (bloc) { file << "getName() << "\""; if (pos != "") - file << " position=\"" << pos << "\""; + file << " position=\"" << pos << "\""; if (bloc->getTop() == NULL && bloc->getRight() == NULL) - file << "/>" << endl; + file << "/>" << endl; else { - file << ">" << endl; - driveHBTree(file, bloc->getTop() , indent+1); - driveHBTree(file, bloc->getRight(), indent+1); - for (unsigned i = 0 ; i < indent ; i++) - file << " "; - file << "" << endl; + file << ">" << endl; + driveHBTree(file, bloc->getTop() , indent+1); + driveHBTree(file, bloc->getRight(), indent+1); + for (unsigned i = 0 ; i < indent ; i++) + file << " "; + file << "" << endl; } return; } @@ -1275,6 +1539,17 @@ namespace OpenChams { } } + void Circuit::driveSlicingTree(ofstream& file, SlicingNode* snode, unsigned indent) { + if (!snode) return; + for (unsigned i = 0 ; i < indent ; i++){ file << " "; } + file << "" << endl; + + snode->toXML(file, indent+1); + + for (unsigned i = 0 ; i < indent ; i++){ file << " "; } + file << "" << endl; + } + bool Circuit::writeToFile(string filePath) { ofstream file; file.open(filePath.c_str()); @@ -1284,21 +1559,21 @@ namespace OpenChams { error += " for writing."; throw OpenChamsException(error); } - // checks before do anything + // checks before do anything if (!_netlist) { - //cerr << "no netlist" << endl; cerr.flush(); + //cerr << "no netlist" << endl; cerr.flush(); throw OpenChamsException("[ERROR] Cannot writeToFile since no netlist is defined !"); - //return false; + //return false; } if (_netlist->hasNoInstances()) { - //cerr << "no instances" << endl; cerr.flush(); + //cerr << "no instances" << endl; cerr.flush(); throw OpenChamsException("[ERROR] Cannot writeToFile since no instance is defined in netlist !"); - //return false; + //return false; } if (_netlist->hasNoNets()) { - //cerr << "no nets" << endl; cerr.flush(); + //cerr << "no nets" << endl; cerr.flush(); throw OpenChamsException("[ERROR] Cannot writeToFile since no net is defined in netlist !"); - //return false; + //return false; } file << "" << endl @@ -1306,7 +1581,7 @@ namespace OpenChams { if (_subCircuitsPaths.size() != 0) { file << " " << endl; for (size_t i = 0 ; i < _subCircuitsPaths.size() ; i++ ) { - file << " " << endl; + file << " " << endl; } file << " " << endl; } @@ -1315,7 +1590,7 @@ namespace OpenChams { for (map::const_iterator it = _params.getValues().begin() ; it != _params.getValues().end() ; ++it) { file << " " << endl; } - //cerr << "_params.getValues().size() = " << _params.getValues().size() << endl; + //cerr << "_params.getValues().size() = " << _params.getValues().size() << endl; file << " " << endl; } file << " " << endl @@ -1326,46 +1601,46 @@ namespace OpenChams { Instance* inst = (*it); Device* dev = dynamic_cast(inst); if (inst->hasNoConnectors()) { - string error("[ERROR] Cannot writeToFile since instance ("); - error += inst->getName(); - error += ") has no connectors !"; - throw OpenChamsException(error); - //return false; + string error("[ERROR] Cannot writeToFile since instance ("); + error += inst->getName(); + error += ") has no connectors !"; + throw OpenChamsException(error); + //return false; } if (dev && dev->hasNoTransistors()) { - string error("[ERROR] Cannot writeToFile since device instance ("); - error += dev->getName(); - error += ") has no transistors !"; - throw OpenChamsException(error); + string error("[ERROR] Cannot writeToFile since device instance ("); + error += dev->getName(); + error += ") has no transistors !"; + throw OpenChamsException(error); } if (dev) { - string sourceBulkStr = (dev->isSourceBulkConnected()) ? "True" : "False"; - file << " getName() << "\" model=\"" << dev->getModel() << "\" mostype=\"" << dev->getMosType() << "\" sourceBulkConnected=\"" << sourceBulkStr << "\" order=\"" << dev->getOrder() << "\">" << endl; + string sourceBulkStr = (dev->isSourceBulkConnected()) ? "True" : "False"; + file << " getName() << "\" model=\"" << dev->getModel() << "\" mostype=\"" << dev->getMosType() << "\" sourceBulkConnected=\"" << sourceBulkStr << "\" order=\"" << dev->getOrder() << "\">" << endl; } else { - file << " getName() << "\" model=\"" << inst->getModel() << "\" order=\"" << inst->getOrder() << "\">" << endl; + file << " getName() << "\" model=\"" << inst->getModel() << "\" order=\"" << inst->getOrder() << "\">" << endl; } file << " " << endl; for (map::const_iterator it = inst->getConnectors().begin() ; it != inst->getConnectors().end() ; ++it) { - file << " " << endl; + file << " " << endl; } file << " " << endl; if (dev) { - file << " " << endl; - for (vector::const_iterator it = dev->getTransistors().begin() ; it != dev->getTransistors().end() ; ++it ) { - Transistor* tr = (*it); - file << " getName() << "\">" << endl - << " getGate() << "\" source=\"" << tr->getSource() << "\" drain=\"" << tr->getDrain() << "\" bulk=\"" << tr->getBulk() << "\"/>" << endl - << " " << endl; - } - file << " " << endl; + file << " " << endl; + for (vector::const_iterator it = dev->getTransistors().begin() ; it != dev->getTransistors().end() ; ++it ) { + Transistor* tr = (*it); + file << " getName() << "\">" << endl + << " getGate() << "\" source=\"" << tr->getSource() << "\" drain=\"" << tr->getDrain() << "\" bulk=\"" << tr->getBulk() << "\"/>" << endl + << " " << endl; + } + file << " " << endl; } if (!inst->getParameters().isEmpty()) { - Parameters params = inst->getParameters(); - file << " " << endl; - for (map::const_iterator it = params.getValues().begin() ; it != params.getValues().end() ; ++it) { - file << " " << endl; - } - file << " " << endl; + Parameters params = inst->getParameters(); + file << " " << endl; + for (map::const_iterator it = params.getValues().begin() ; it != params.getValues().end() ; ++it) { + file << " " << endl; + } + file << " " << endl; } file << " " << endl; } @@ -1377,20 +1652,20 @@ namespace OpenChams { for (vector::iterator it = nets.begin() ; it != nets.end() ; ++it) { Net* net = (*it); if (net->hasNoConnections()) { - string error("[ERROR] Cannot writeToFile since net ("); - error += net->getName(); - error += ") has no connectors !"; - throw OpenChamsException(error); - //return false; + string error("[ERROR] Cannot writeToFile since net ("); + error += net->getName(); + error += ") has no connectors !"; + throw OpenChamsException(error); + //return false; } if (!net->hasNoPorts() || !net->hasNoWires()) - schematicNets = true; + schematicNets = true; string externStr = (net->isExternal()) ? "True" : "False"; file << " getName() << "\" type=\"" << net->getType() << "\" isExternal=\"" << externStr << "\">" << endl; vector connections = net->getConnections(); sort(connections.begin(), connections.end(), ConnectionsSort); for (vector::iterator it = connections.begin() ; it != connections.end() ; ++it) { - file << " getInstanceName() << "\" name=\"" << (*it)->getConnectorName() << "\"/>" << endl; + file << " getInstanceName() << "\" name=\"" << (*it)->getConnectorName() << "\"/>" << endl; } file << " " << endl; } @@ -1399,119 +1674,119 @@ namespace OpenChams { if (_schematic && !_schematic->hasNoInstances()) { file << " " << endl; for (map::const_iterator it = _schematic->getInstances().begin() ; it != _schematic->getInstances().end(); ++it ) { - Schematic::Infos* infos = (*it).second; - file << " getX() << "\" y=\"" << infos->getY() << "\" orient=\"" << infos->getOrientation() << "\"/>" << endl; + Schematic::Infos* infos = (*it).second; + file << " getX() << "\" y=\"" << infos->getY() << "\" orient=\"" << infos->getOrientation() << "\"/>" << endl; } if (schematicNets) { - for (size_t i = 0 ; i < nets.size() ; i++) { - Net* net = nets[i]; - if (net->hasNoPorts() && net->hasNoWires()) - continue; - file << " getName() << "\">" << endl; - for (size_t j = 0 ; j < net->getPorts().size() ; j++) { - Port* port = net->getPorts()[j]; - if (!port) - continue; - file << " getType() << "\" idx=\"" << port->getIndex() << "\" x=\"" << port->getX() << "\" y=\"" << port->getY() << "\" orient=\"" << port->getOrientation() << "\"/>" << endl; - } - for (size_t j = 0 ; j < net->getWires().size() ; j++) { - Wire* wire = net->getWires()[j]; - file << " " << endl; - WirePoint* start = wire->getStartPoint(); - WirePoint* end = wire->getEndPoint(); - // start point - if (dynamic_cast(start)) { - InstancePoint* iP = static_cast(start); - file << " getName() << "\" plug=\"" << iP->getPlug() << "\"/>" << endl; - } else if (dynamic_cast(start)) { - PortPoint* pP = static_cast(start); - file << " getIndex() << "\"/>" << endl; - } else { - throw OpenChamsException("[ERROR] Wire start point is nor an InstancePoint nor a PortPoint."); - } - // intermediate points - for (size_t k = 0 ; k < wire->getIntermediatePoints().size() ; k++) { - IntermediatePoint* iP = wire->getIntermediatePoints()[k]; - file << " getX() << "\" y=\"" << iP->getY() << "\"/>" << endl; - } - // end point - if (dynamic_cast(end)) { - InstancePoint* iP = static_cast(end); - file << " getName() << "\" plug=\"" << iP->getPlug() << "\"/>" << endl; - } else if (dynamic_cast(end)) { - PortPoint* pP = static_cast(end); - file << " getIndex() << "\"/>" << endl; - } else { - throw OpenChamsException("[ERROR] Wire end point is nor an InstancePoint nor a PortPoint."); - } - file << " " << endl; - } - file << " " << endl; - } + for (size_t i = 0 ; i < nets.size() ; i++) { + Net* net = nets[i]; + if (net->hasNoPorts() && net->hasNoWires()) + continue; + file << " getName() << "\">" << endl; + for (size_t j = 0 ; j < net->getPorts().size() ; j++) { + Port* port = net->getPorts()[j]; + if (!port) + continue; + file << " getType() << "\" idx=\"" << port->getIndex() << "\" x=\"" << port->getX() << "\" y=\"" << port->getY() << "\" orient=\"" << port->getOrientation() << "\"/>" << endl; + } + for (size_t j = 0 ; j < net->getWires().size() ; j++) { + Wire* wire = net->getWires()[j]; + file << " " << endl; + WirePoint* start = wire->getStartPoint(); + WirePoint* end = wire->getEndPoint(); + // start point + if (dynamic_cast(start)) { + InstancePoint* iP = static_cast(start); + file << " getName() << "\" plug=\"" << iP->getPlug() << "\"/>" << endl; + } else if (dynamic_cast(start)) { + PortPoint* pP = static_cast(start); + file << " getIndex() << "\"/>" << endl; + } else { + throw OpenChamsException("[ERROR] Wire start point is nor an InstancePoint nor a PortPoint."); + } + // intermediate points + for (size_t k = 0 ; k < wire->getIntermediatePoints().size() ; k++) { + IntermediatePoint* iP = wire->getIntermediatePoints()[k]; + file << " getX() << "\" y=\"" << iP->getY() << "\"/>" << endl; + } + // end point + if (dynamic_cast(end)) { + InstancePoint* iP = static_cast(end); + file << " getName() << "\" plug=\"" << iP->getPlug() << "\"/>" << endl; + } else if (dynamic_cast(end)) { + PortPoint* pP = static_cast(end); + file << " getIndex() << "\"/>" << endl; + } else { + throw OpenChamsException("[ERROR] Wire end point is nor an InstancePoint nor a PortPoint."); + } + file << " " << endl; + } + file << " " << endl; + } } file << " " << endl; } - // SIZING (modified by Farakh) *************************************************************** + // SIZING (modified by Farakh) *************************************************************** if(_sizing && (!_sizing->hasNoOperators() || !_sizing->hasNoEquations()) ) file << " " << endl; if (_sizing && !_sizing->hasNoOperators()) { - // file << " " << endl; + // file << " " << endl; for (map::const_iterator it = _sizing->getOperators().begin() ; it != _sizing->getOperators().end() ; ++it) { - Operator* op = (*it).second; - string opName = op->getName(); - transform(opName.begin(), opName.end(), opName.begin(), ::toupper); - file << " getSimulModel() << "\">" << endl; - if (!op->hasNoConstraints()) { - for (map::const_iterator cit = op->getConstraints().begin() ; cit != op->getConstraints().end() ; ++cit) { - Operator::Constraint* cn = (*cit).second; - const std::string& ref = cn->getRef(); - if (ref.empty()) { - file << " getRefParam() << "\" factor=\"" << cn->getFactor() << "\"/>" << endl; - } else { - file << " getRef() << "\" refParam=\"" << cn->getRefParam() << "\" factor=\"" << cn->getFactor() << "\"/>" << endl; - } - } - } - file << " " << endl; + Operator* op = (*it).second; + string opName = op->getName(); + transform(opName.begin(), opName.end(), opName.begin(), ::toupper); + file << " getSimulModel() << "\">" << endl; + if (!op->hasNoConstraints()) { + for (map::const_iterator cit = op->getConstraints().begin() ; cit != op->getConstraints().end() ; ++cit) { + Operator::Constraint* cn = (*cit).second; + const std::string& ref = cn->getRef(); + if (ref.empty()) { + file << " getRefParam() << "\" factor=\"" << cn->getFactor() << "\"/>" << endl; + } else { + file << " getRef() << "\" refParam=\"" << cn->getRefParam() << "\" factor=\"" << cn->getFactor() << "\"/>" << endl; + } + } + } + file << " " << endl; } } - // EQUATIONS + // EQUATIONS if (_sizing && !_sizing->hasNoEquations()) { file << " " << endl; - // for (map::const_iterator it = _sizing->getEquations().begin() ; it != _sizing->getEquations().end() ; ++it) - // file << " " << endl; + // for (map::const_iterator it = _sizing->getEquations().begin() ; it != _sizing->getEquations().end() ; ++it) + // file << " " << endl; file << " " << endl; for(map::const_iterator it = _sizing->getEquations().begin() ; it != _sizing->getEquations().end() ; ++it) { - if(dynamic_cast((*it).second)) - file << " getEquationStr()[0] << "\"/>" << endl; + if(dynamic_cast((*it).second)) + file << " getEquationStr()[0] << "\"/>" << endl; } file << " " << endl; file << " " << endl; for(map::const_iterator it = _sizing->getEquations().begin() ; it != _sizing->getEquations().end() ; ++it) { - if(dynamic_cast((*it).second)) - file << " getEquationStr()[0] << "\"/>" << endl; + if(dynamic_cast((*it).second)) + file << " getEquationStr()[0] << "\"/>" << endl; } file << " " << endl; file << " " << endl; for(map::const_iterator it = _sizing->getEquations().begin() ; it != _sizing->getEquations().end() ; ++it) { - if(dynamic_cast((*it).second)) { - NRCCstr* nrcCstr = (NRCCstr*)((*it).second); - file << " getVoltage() << "\" equation=\"" << (*it).second->getEquationStr()[0] << "\"/>" << endl; - } + if(dynamic_cast((*it).second)) { + NRCCstr* nrcCstr = (NRCCstr*)((*it).second); + file << " getVoltage() << "\" equation=\"" << (*it).second->getEquationStr()[0] << "\"/>" << endl; + } } file << " " << endl; file << " " << endl; for(map::const_iterator it = _sizing->getEquations().begin() ; it != _sizing->getEquations().end() ; ++it) { - if(dynamic_cast((*it).second)) { - file << " " << endl; - for(map::const_iterator it2 = (*it).second->getEquationStr().begin(); it2!=(*it).second->getEquationStr().end(); ++it2) - file << " " << endl; - file << " " << endl; - } + if(dynamic_cast((*it).second)) { + file << " " << endl; + for(map::const_iterator it2 = (*it).second->getEquationStr().begin(); it2!=(*it).second->getEquationStr().end(); ++it2) + file << " " << endl; + file << " " << endl; + } } file << " " << endl; @@ -1520,22 +1795,29 @@ namespace OpenChams { } if(_sizing && (!_sizing->hasNoOperators() || !_sizing->hasNoEquations()) ) file << " " << endl; - // ******************************************************************************************* - + // ******************************************************************************************* if (_layout) { file << " " << endl; if (!_layout->hasNoInstance()) { - for (map::const_iterator it = _layout->getInstances().begin() ; it != _layout->getInstances().end() ; ++it) { - file << " " << endl; - } + for (map::const_iterator it = _layout->getInstances().begin() ; it != _layout->getInstances().end() ; ++it) { + file << " " << endl; + } } if (Node* root = _layout->getHBTreeRoot()) { - file << " " << endl; - driveHBTree(file, root, 3); - file << " " << endl; + file << " " << endl; + driveHBTree(file, root, 3); + file << " " << endl; } file << " " << endl; } + // ******************************************************************************************* + + if (_slicingtree) { + driveSlicingTree(file, _slicingtree, 1); + } + + + file << "" << endl; file.close(); return true; diff --git a/vlsisapd/src/openChams/src/Schematic.cpp b/vlsisapd/src/openChams/src/Schematic.cpp index 390ff093..842c905d 100644 --- a/vlsisapd/src/openChams/src/Schematic.cpp +++ b/vlsisapd/src/openChams/src/Schematic.cpp @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the VLSI SAPD Software. -// Copyright (c) UPMC 2010-2015, All Rights Reserved +// Copyright (c) UPMC 2010-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | V L S I S A P D | diff --git a/vlsisapd/src/openChams/src/SlicingTree.cpp b/vlsisapd/src/openChams/src/SlicingTree.cpp new file mode 100644 index 00000000..6453a7ff --- /dev/null +++ b/vlsisapd/src/openChams/src/SlicingTree.cpp @@ -0,0 +1,1088 @@ + +// -*- C++ -*- +// +// This file is part of the VLSI SAPD Software. +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | V L S I S A P D | +// | OpenChams Circuit Data Base | +// | | +// | Author : Eric Lao | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./SlicingTree.cpp" | +// +-----------------------------------------------------------------+ + + +#include "vlsisapd/openChams/SlicingTree.h" + +using namespace std; + +namespace OpenChams { + +// -----------------------------------------------------------------------------------------------// +// Class : SlicingNode +// -----------------------------------------------------------------------------------------------// + + + void printList( list liste ) + { + for ( list::const_iterator it = liste.begin(); it != liste.end(); it++ ){ + (*it)->print(); + } + } + + SlicingNode::SlicingNode( SlicingNode* parent ) + { + _parent = parent; + _alignment = UnknownAlignment; + } + + + void SlicingNode::setParent ( SlicingNode* parent ) + { + _parent = parent; + } + + + SlicingNode* SlicingNode::getParent () const + { + return _parent; + } + + + void SlicingNode::setAlignment ( std::string alignment ) + { + if (!_parent){ + if ( alignment == "AlignRight" ){ _alignment = AlignRight ; } + else if ( alignment == "AlignLeft" ){ _alignment = AlignLeft ; } + else if ( alignment == "AlignCenter" ){ _alignment = AlignCenter ; } + else if ( alignment == "AlignTop" ){ _alignment = AlignTop ; } + else { _alignment = UnknownAlignment; } + } else { + if (_parent->getType() == HorizontalSNode ){ + if ( alignment == "AlignRight" ){ _alignment = AlignRight ; } + else if ( alignment == "AlignCenter" ){ _alignment = AlignCenter ; } + else { _alignment = AlignLeft ; } + } else if ( _parent->getType() == VerticalSNode ){ + if ( alignment == "AlignCenter" ){ _alignment = AlignCenter ; } + else if ( alignment == "AlignTop" ){ _alignment = AlignTop ; } + else { _alignment = AlignBottom ; } + } else { _alignment = UnknownAlignment; } + } + } + + + string SlicingNode::alignmentToString () const + { + string salignment = ""; + if ( _alignment == AlignRight ){ salignment = "AlignRight" ; } + else if ( _alignment == AlignLeft ){ salignment = "AlignLeft" ; } + else if ( _alignment == AlignCenter ){ salignment = "AlignCenter" ; } + else if ( _alignment == AlignTop ){ salignment = "AlignTop" ; } + else { salignment = "UnknownAlignment"; } + return salignment; + } + + + bool SlicingNode::checkInitialPlacement( int& cpt ) const + { + bool initialPlacement = false; + if ( cpt < 2 ){ initialPlacement = true; } + return initialPlacement; + } + + + list SlicingNode::getLeaves() const + { + return list(); + } + + +// Error Methods + std::string SlicingNode::getInstanceName () const + { + cerr << "Error(std::string SlicingNode::getInstanceName ()): Instance name is used in Device only." << endl; + return ""; + } + + + unsigned int SlicingNode::getAlignment () const + { + cerr << "Error(unsigned int SlicingNode::getAlignment ()): No Alignment in Routing Node." << endl; + return UnknownAlignment; + } + + + bool SlicingNode::getPreset () const + { + cerr << "Error(bool SlicingNode::getPreset ()): Preset is used in Device only." << endl; + return false; + } + + + double SlicingNode::getX () const + { + cerr << "Error(double SlicingNode::getX ()): X is used in Device only." << endl; + return 0; + } + + + double SlicingNode::getY () const + { + cerr << "Error(double SlicingNode::getY ()): Y is used in Device only." << endl; + return 0; + } + + + int SlicingNode::getNFing () const + { + cerr << "Error(int SlicingNode::getNFing ()): Nfing is used in Device only." << endl; + return 1; + } + + + double SlicingNode::getStart () const + { + cerr << "Error(double SlicingNode::getStart ()): Start is used in Device only." << endl; + return 0; + } + + + double SlicingNode::getStep () const + { + cerr << "Error(double SlicingNode::getStep ()): Step is used in Device only." << endl; + return 0; + } + + + double SlicingNode::getCount () const + { + cerr << "Error(double SlicingNode::getCount ()): Step is used in Device only." << endl; + return 0; + } + + + void SlicingNode::setInstanceName ( std::string instanceName ) + { + cerr << "Error(void SlicingNode::setInstanceName ( std::string instanceName )): Instance name is used in Device only." << endl; + } + + + void SlicingNode::setPreset ( std::string preset ) + { + cerr << "Error(void SlicingNode::setPreset ( std::string preset )): Preset is used in Device only." << endl; + } + + + void SlicingNode::setX ( std::string x ) + { + cerr << "Error(void SlicingNode::setX ( std::string x )): X is used in Device only." << endl; + } + + + void SlicingNode::setY ( std::string y ) + { + cerr << "Error(void SlicingNode::setY ( std::string y )): Y is used in Device only." << endl; + } + + + void SlicingNode::setNFing ( std::string nfing ) + { + cerr << "Error(void SlicingNode::setNFing ( std::string nfing )): NFing is used in Device only." << endl; + } + + + void SlicingNode::setStart ( std::string start ) + { + cerr << "Error(void SlicingNode::setStart ( std::string start )): Start is used in Device only." << endl; + } + + + void SlicingNode::setStep ( std::string step ) + { + cerr << "Error(void SlicingNode::setStep ( std::string step )): Step is used in Device only." << endl; + } + + + void SlicingNode::setCount ( std::string count ) + { + cerr << "Error(void SlicingNode::setCount ( std::string count )): Count is used in Device only." << endl; + } + + + void SlicingNode::setPreset ( bool preset ) + { + cerr << "Error(void SlicingNode::setPreset ( bool preset )): Preset is used in Device only." << endl; + } + + + void SlicingNode::setX ( double x ) + { + cerr << "Error(void SlicingNode::setX ( double x )): X is used in Device only." << endl; + } + + + void SlicingNode::setY ( double y ) + { + cerr << "Error(void SlicingNode::setY ( double y )): Y is used in Device only." << endl; + } + + + void SlicingNode::setNFing ( int nfing ) + { + cerr << "Error(void SlicingNode::setNFing ( int nfing )): NFing is used in Device only." << endl; + } + + + void SlicingNode::setStart ( double start ) + { + cerr << "Error(void SlicingNode::setStart ( double start )): Start is used in Device only." << endl; + } + + + void SlicingNode::setStep ( double step ) + { + cerr << "Error(void SlicingNode::setStep ( double step )): Step is used in Device only." << endl; + } + + + void SlicingNode::setCount ( double count ) + { + cerr << "Error(void SlicingNode::setCount ( double count )): Count is used in Device only." << endl; + } + + + double SlicingNode::getToleranceRatioH () const + { + cerr << "Error(double SlicingNode::getToleranceRatioH ()): Tolerances are used in Horizontal or Vertical Node only." << endl; + return 0; + } + + + const vector SlicingNode::getChildren () const + { + cerr << "Error(const vector SlicingNode::getChildren () const): Children are used in Horizontal or Vertical Node only." << endl; + return vector(); + } + + + list > SlicingNode::getSymmetries () const + { + cerr << "Error(list > SlicingNode::getSymmetries () const): Symmetries are used in Horizontal or Vertical Node only." << endl; + return list >(); + } + + + double SlicingNode::getToleranceRatioW () const + { + cerr << "Error(double SlicingNode::getToleranceRatioW ()): Tolerances are used in Horizontal or Vertical Node only." << endl; + return 0; + } + + + double SlicingNode::getToleranceBandH () const + { + cerr << "Error(double SlicingNode::getToleranceBandH ()): Tolerances are used in Horizontal or Vertical Node only." << endl; + return 0; + } + + + double SlicingNode::getToleranceBandW () const + { + cerr << "Error(double SlicingNode::getToleranceBandW ()): Tolerances are used in Horizontal or Vertical Node only." << endl; + return 0; + } + + + void SlicingNode::setToleranceRatioH ( std::string value ) + { + cerr << "Error(void SlicingNode::setToleranceRatioH ( std::string value )): Tolerances are used in Horizontal or Vertical Node only." << endl; + } + + + void SlicingNode::setToleranceRatioW ( std::string value ) + { + cerr << "Error(void SlicingNode::setToleranceRatioW ( std::string value )): Tolerances are used in Horizontal or Vertical Node only." << endl; + } + + + void SlicingNode::setToleranceBandH ( std::string value ) + { + cerr << "Error(void SlicingNode::setToleranceBandH ( std::string value )): Tolerances are used in Horizontal or Vertical Node only." << endl; + } + + + void SlicingNode::setToleranceBandW ( std::string value ) + { + cerr << "Error(void SlicingNode::setToleranceBandW ( std::string value )): Tolerances are used in Horizontal or Vertical Node only." << endl; + + } + + + void SlicingNode::setToleranceRatioH ( double value ) + { + cerr << "Error(void SlicingNode::setToleranceRatioH ( double value )): Tolerances are used in Horizontal or Vertical Node only." << endl; + } + + + void SlicingNode::setToleranceRatioW ( double value ) + { + cerr << "Error(void SlicingNode::setToleranceRatioW ( double value )): Tolerances are used in Horizontal or Vertical Node only." << endl; + } + + + void SlicingNode::setToleranceBandH ( double value ) + { + cerr << "Error(void SlicingNode::setToleranceBandH ( double value )): Tolerances are used in Horizontal or Vertical Node only." << endl; + } + + + void SlicingNode::setToleranceBandW ( double value ) + { + cerr << "Error(void SlicingNode::setToleranceBandW ( double value )): Tolerances are used in Horizontal or Vertical Node only." << endl; + + } + + + void SlicingNode::push_back ( SlicingNode* node ) + { + cerr << "Error(void SlicingNode::push_back ( SlicingNode* node )): Children are used in Horizontal or Vertical Node only." << endl; + } + + + void SlicingNode::addSymmetry ( std::string source, std::string target ) + { + cerr << "Error(void SlicingNode::addSymmetry ( std::string source, std::string target )): Symmetries are used in Horizontal or Vertical Node only." << endl; + } + + + void SlicingNode::addSymmetry ( int source, int target ) + { + cerr << "Error(void SlicingNode::addSymmetry ( int source, int target )): Symmetries are used in Horizontal or Vertical Node only." << endl; + } + + + double SlicingNode::getValue () const + { + cerr << "Error(double SlicingNode::getValue ()): Value is used in Routing Node only." << endl; + return 0; + } + + + void SlicingNode::setValue ( std::string value ) + { + cerr << "Error(void SlicingNode::setValue ( std::string value )): Value is used in Routing Node only." << endl; + } + + + string SlicingNode::presetToString () const + { + cerr << "Error(string SlicingNode::presetToString () const): Preset is used in Device only." << endl; + return ""; + } + + + string SlicingNode::xToString () const + { + cerr << "Error(string SlicingNode::xToString () const): X is used in Device only." << endl; + return ""; + } + + + string SlicingNode::yToString () const + { + cerr << "Error(string SlicingNode::yToString () const): Y is used in Device only." << endl; + return ""; + } + + + string SlicingNode::nfingToString () const + { + cerr << "Error(string SlicingNode::nfingToString () const): NFing is used in Device only." << endl; + return ""; + } + + + string SlicingNode::startToString () const + { + cerr << "Error(string SlicingNode::startToString () const): Start is used in Device only." << endl; + return ""; + } + + + string SlicingNode::stepToString () const + { + cerr << "Error(string SlicingNode::stepToString () const): Step is used in Device only." << endl; + return ""; + } + + + string SlicingNode::countToString () const + { + cerr << "Error(string SlicingNode::countToString () const): Count is used in Device only." << endl; + return ""; + } + + + string SlicingNode::valueToString () const + { + cerr << "Error(string SlicingNode::valueToString () const): Value is used in Routing Node only." << endl; + return ""; + } + + + string SlicingNode::toleranceRatioHToString () const + { + cerr << "Error(string SlicingNode::toleranceRatioHToString () const): Tolerances are used in Horizontal or Vertical Node only." << endl; + return ""; + } + + + string SlicingNode::toleranceRatioWToString () const + { + cerr << "Error(double SlicingNode::getToleranceRatioW ()): Tolerances are used in Horizontal or Vertical Node only." << endl; + return ""; + } + + + string SlicingNode::toleranceBandHToString () const + { + cerr << "Error(string SlicingNode::toleranceBandHToString () const): Tolerances are used in Horizontal or Vertical Node only." << endl; + return ""; + } + + + string SlicingNode::toleranceBandWToString () const + { + cerr << "Error(string SlicingNode::toleranceBandWToString () const): Tolerances are used in Horizontal or Vertical Node only." << endl; + return ""; + } + + bool SlicingNode::hasSameParentToleranceRatioH () const + { + cerr << "Error(bool SlicingNode::hasSameParentToleranceRatioH () const): Tolerances are used in Horizontal or Vertical Node only." << endl; + return false; + } + + + bool SlicingNode::hasSameParentToleranceRatioW () const + { + cerr << "Error(bool SlicingNode::hasSameParentToleranceRatioW () const): Tolerances are used in Horizontal or Vertical Node only." << endl; + return false; + } + + + bool SlicingNode::hasSameParentToleranceBandH () const + { + cerr << "Error(bool SlicingNode::hasSameParentToleranceBandH () const): Tolerances are used in Horizontal or Vertical Node only." << endl; + return false; + } + + + bool SlicingNode::hasSameParentToleranceBandW () const + { + cerr << "Error(bool SlicingNode::hasSameParentToleranceBandW () const): Tolerances are used in Horizontal or Vertical Node only." << endl; + return false; + } + + +// -----------------------------------------------------------------------------------------------// +// Class : DSlicingNode +// -----------------------------------------------------------------------------------------------// + + + DSlicingNode::DSlicingNode( std::string instanceName, SlicingNode* parent ): SlicingNode(parent) + { + _instanceName = instanceName; + _alignment = UnknownAlignment; + _preset = false; + _x = 0; + _y = 0; + _nfing = 0; + _start = 0; + _step = 0; + _count = 0; + } + + void DSlicingNode::setInstanceName( std::string instanceName ) + { + _instanceName = instanceName; + } + + + void DSlicingNode::setPreset( std::string preset ) + { + if ( preset == "true" ){ _preset = true ; } + else { _preset = false; } + } + + + void DSlicingNode::setX( std::string x ) + { + std::string::size_type sz; + _x = stof(x, &sz); + } + + + void DSlicingNode::setY( std::string y ) + { + std::string::size_type sz; + _y = stof(y, &sz); + } + + + void DSlicingNode::setNFing( std::string nfing ) + { + std::string::size_type sz; + _nfing = stoi(nfing, &sz); + } + + + void DSlicingNode::setStart( std::string start ) + { + std::string::size_type sz; + _start = stod(start, &sz); + } + + + void DSlicingNode::setStep( std::string step ) + { + std::string::size_type sz; + _step = stod(step, &sz); + } + + + void DSlicingNode::setCount( std::string count ) + { + std::string::size_type sz; + _count = stod(count, &sz); + } + + + void DSlicingNode::print() const + { + cerr << "instance : " << _instanceName << endl; + + if (_parent != NULL){ + unsigned int type = _parent->getType(); + if ( type == HorizontalSNode ){ cerr << "Parent : Type: HorizontalSNode" ; } + else if ( type == VerticalSNode ){ cerr << "Parent : Type: VerticalSNode" ; } + else { cerr << "Parent : Type: UnknownType"; } + cerr << ", trh: " << _parent->getToleranceRatioH(); + cerr << ", trw: " << _parent->getToleranceRatioW(); + cerr << ", tbh: " << _parent->getToleranceBandH(); + cerr << ", tbw: " << _parent->getToleranceBandW(); + cerr << endl; + } else { + cerr << "Parent : None " << endl; + } + + if ( _alignment == AlignLeft ){ cerr << "alignment: AlignLeft" << endl; } + else if ( _alignment == AlignRight ){ cerr << "alignment: AlignRight" << endl; } + else if ( _alignment == AlignCenter ){ cerr << "alignment: AlignCenter" << endl; } + else if ( _alignment == AlignTop ){ cerr << "alignment: AlignTop" << endl; } + else if ( _alignment == AlignBottom ){ cerr << "alignment: AlignBottom" << endl; } + else { cerr << "alignment: Unknown" << endl; } + cerr << "preset : " << _preset << endl; + cerr << "x : " << _x << endl; + cerr << "y : " << _y << endl; + cerr << "nfing : " << _nfing << endl; + cerr << "start : " << _start << endl; + cerr << "step : " << _step << endl; + cerr << "count : " << _count << endl; + cerr << "type : Device" << endl; + cerr << endl; + } + + + void DSlicingNode::toXML ( ofstream& file, unsigned indent ) + { + for (unsigned i = 0 ; i < indent ; i++){ file << " "; } + file << "" << endl; + + for (unsigned i = 0 ; i < indent+1 ; i++){ file << " "; } + file << "" << endl; + + if (_preset){ + for (unsigned i = 0 ; i < indent+1 ; i++){ file << " "; } + file << "" << endl; + } + + for (unsigned i = 0 ; i < indent+1 ; i++){ file << " "; } + file << "" << endl; + + + for (unsigned i = 0 ; i < indent+1 ; i++){ file << " "; } + file << "" << endl; + + + for (unsigned i = 0 ; i < indent+1 ; i++){ file << " "; } + file << "" << endl; + + + for (unsigned i = 0 ; i < indent+1 ; i++){ file << " "; } + file << "" << endl; + + for (unsigned i = 0 ; i < indent ; i++){ file << " "; } + file << "" << endl; + } + + + bool DSlicingNode::checkInitialPlacement ( int& cpt ) const + { + bool initialPlacement = false; + if ( cpt < 2 ){ + if ( (_x == 0) && (_y == 0) ){ + cpt++; + if ( cpt < 2 ) { initialPlacement = true; } + } + else { initialPlacement = true; } + } + return initialPlacement; + } + + +// -----------------------------------------------------------------------------------------------// +// Class : HVSlicingNode +// -----------------------------------------------------------------------------------------------// + + + HVSlicingNode::HVSlicingNode( SlicingNode* parent ): SlicingNode( parent ) + { + _alignment = UnknownAlignment; + _toleranceRatioH = 0; + _toleranceRatioW = 0; + _toleranceBandH = 0; + _toleranceBandW = 0; + _symmetries = list > (); + _children = vector (); + } + + + void HVSlicingNode::setToleranceRatioH( std::string value ) + { + std::string::size_type sz; + _toleranceRatioH = stof(value, &sz); + } + + + void HVSlicingNode::setToleranceRatioW( std::string value ) + { + std::string::size_type sz; + _toleranceRatioW = stof(value, &sz); + } + + + void HVSlicingNode::setToleranceBandH( std::string value ) + { + std::string::size_type sz; + _toleranceBandH = stof(value, &sz); + } + + + void HVSlicingNode::setToleranceBandW( std::string value ) + { + std::string::size_type sz; + _toleranceBandW = stof(value, &sz); + } + + + void HVSlicingNode::setToleranceRatioH( double value ) + { + _toleranceRatioH = value; + } + + + void HVSlicingNode::setToleranceRatioW( double value ) + { + _toleranceRatioW = value; + } + + + void HVSlicingNode::setToleranceBandH( double value ) + { + _toleranceBandH = value; + } + + + void HVSlicingNode::setToleranceBandW( double value ) + { + _toleranceBandW = value; + } + + + void HVSlicingNode::push_back( SlicingNode* node ) + { + if (node != NULL){ + node->setParent(this); + _children.push_back(node); + } + } + + + void HVSlicingNode::addSymmetry( string source, string target ) + { + std::string::size_type sz; + int isource = stoi(source, &sz); + int itarget = stoi(target, &sz); + _symmetries.push_back(pair(isource, itarget)); + } + + + void HVSlicingNode::addSymmetry( int source, int target ) + { + _symmetries.push_back(pair(source, target)); + } + + + void HVSlicingNode::recursiveDestroy() + { + for (std::vector::iterator it = _children.begin(); it != _children.end(); it++){ + (*it)->recursiveDestroy(); + } + delete(this); + } + + + void HVSlicingNode::print() const + { + if ( _alignment == AlignLeft ){ cerr << "alignment: AlignLeft" << endl; } + else if ( _alignment == AlignRight ){ cerr << "alignment: AlignRight" << endl; } + else if ( _alignment == AlignCenter ){ cerr << "alignment: AlignCenter" << endl; } + else if ( _alignment == AlignTop ){ cerr << "alignment: AlignTop" << endl; } + else if ( _alignment == AlignBottom ){ cerr << "alignment: AlignBottom" << endl; } + else { cerr << "alignment: Unknown" << endl; } + cerr << "tRatioH : " << _toleranceRatioH << endl; + cerr << "tRatioW : " << _toleranceRatioW << endl; + cerr << "tBandH : " << _toleranceBandH << endl; + cerr << "tBandW : " << _toleranceBandW << endl; + } + + + bool HVSlicingNode::hasSameParentToleranceRatioH () const + { + bool same = false; + if (_parent){ + same = (_toleranceRatioH == _parent->getToleranceRatioH()); + } + return same; + } + + + bool HVSlicingNode::hasSameParentToleranceRatioW () const + { + bool same = false; + if (_parent){ + same = (_toleranceRatioW == _parent->getToleranceRatioW()); + } + return same; + } + + + bool HVSlicingNode::hasSameParentToleranceBandH () const + { + bool same = false; + if (_parent){ + same = (_toleranceBandH == _parent->getToleranceBandH()); + } + return same; + } + + + bool HVSlicingNode::hasSameParentToleranceBandW () const + { + bool same = false; + if (_parent){ + same = (_toleranceBandW == _parent->getToleranceBandW()); + } + return same; + } + + + bool HVSlicingNode::checkInitialPlacement( int& cpt ) const + { + bool initialPlacement = false; + if (cpt < 2){ + initialPlacement = true; + for (vector::const_iterator it = _children.begin(); it != _children.end(); it++){ + if (cpt < 2){ initialPlacement = (*it)->checkInitialPlacement(cpt); } + } + } + return initialPlacement; + } + + + list HVSlicingNode::getLeaves () const + { + list leaves = list(); + for (vector::const_iterator it = _children.begin(); it != _children.end(); it++){ + if ( ((*it)->getType() == DeviceSNode) || ((*it)->getType() == RoutingSNode) ){ + leaves.push_back((*it)); + } else { + leaves.splice(leaves.end(), (*it)->getLeaves()); + } + } + return leaves; + } + + +// -----------------------------------------------------------------------------------------------// +// Class : HSlicingNode +// -----------------------------------------------------------------------------------------------// + + + HSlicingNode::HSlicingNode( SlicingNode* parent ): HVSlicingNode(parent) + { + _alignment = AlignLeft; + } + + + void HSlicingNode::print() const + { + cerr << "type : Horizontal " << endl; + + if (_parent != NULL){ + unsigned int type = _parent->getType(); + if ( type == HorizontalSNode ){ cerr << "Parent : Type: HorizontalSNode" ; } + else if ( type == VerticalSNode ){ cerr << "Parent : Type: VerticalSNode" ; } + else { cerr << "Parent : Type: UnknownType"; } + cerr << ", trh: " << _parent->getToleranceRatioH(); + cerr << ", trw: " << _parent->getToleranceRatioW(); + cerr << ", tbh: " << _parent->getToleranceBandH(); + cerr << ", tbw: " << _parent->getToleranceBandW(); + cerr << endl; + } else { + cerr << "Parent : None " << endl; + } + HVSlicingNode::print(); + + for (list >::const_iterator it1 = _symmetries.begin(); it1 != _symmetries.end(); it1++){ + cerr << "Symmetrie: (" << (*it1).first << " - " << (*it1).second << ")" << endl; + } + cerr << endl; + + for(vector::const_iterator it = _children.begin(); it != _children.end(); it++ ){ + (*it)->print(); + } + cerr << endl; + } + + + void HSlicingNode::toXML ( ofstream& file, unsigned indent ) + { + for (unsigned i = 0 ; i < indent ; i++){ file << " "; } + file << "" << endl; + + // Parameters + for (unsigned i = 0 ; i < indent+1 ; i++){ file << " "; } + file << "" << endl; + + for (unsigned i = 0 ; i < indent+2 ; i++){ file << " "; } + file << "" << endl; + + if (!hasSameParentToleranceRatioH ()){ + for (unsigned i = 0 ; i < indent+2 ; i++){ file << " "; } + file << "" << endl; + } + + if (!hasSameParentToleranceRatioW ()){ + for (unsigned i = 0 ; i < indent+2 ; i++){ file << " "; } + file << "" << endl; + } + + if (!hasSameParentToleranceBandH ()){ + for (unsigned i = 0 ; i < indent+2 ; i++){ file << " "; } + file << "" << endl; + } + + if (!hasSameParentToleranceBandW ()){ + for (unsigned i = 0 ; i < indent+2 ; i++){ file << " "; } + file << "" << endl; + } + + for (unsigned i = 0 ; i < indent+1 ; i++){ file << " "; } + file << "" << endl; + + // Symmetries + if (!_symmetries.empty()){ + for (unsigned i = 0 ; i < indent+1 ; i++){ file << " "; } + file << "" << endl; + + for ( std::list >::const_iterator it = _symmetries.begin(); it != _symmetries.end(); it++ ){ + for (unsigned i = 0 ; i < indent+2 ; i++){ file << " "; } + file << "" << endl; + } + + for (unsigned i = 0 ; i < indent+1 ; i++){ file << " "; } + file << "" << endl; + } + + // Children + if (!_children.empty()){ + for (unsigned i = 0 ; i < indent+1 ; i++){ file << " "; } + file << "" << endl; + + for (std::vector::const_iterator it2 = _children.begin(); it2 != _children.end(); it2++){ + (*it2)->toXML(file, indent+2); + } + + for (unsigned i = 0 ; i < indent+1 ; i++){ file << " "; } + file << "" << endl; + } + + for (unsigned i = 0 ; i < indent ; i++){ file << " "; } + file << "" << endl; + } + + +// -----------------------------------------------------------------------------------------------// +// Class : VSlicingNode +// -----------------------------------------------------------------------------------------------// + + + VSlicingNode::VSlicingNode( SlicingNode* parent ): HVSlicingNode(parent) + { + _alignment = AlignBottom; + } + + + void VSlicingNode::print() const + { + cerr << "type : Vertical " << endl; + + if (_parent != NULL){ + unsigned int type = _parent->getType(); + if ( type == HorizontalSNode ){ cerr << "Parent : Type: HorizontalSNode" ; } + else if ( type == VerticalSNode ){ cerr << "Parent : Type: VerticalSNode" ; } + else { cerr << "Parent : Type: UnknownType"; } + cerr << ", trh: " << _parent->getToleranceRatioH(); + cerr << ", trw: " << _parent->getToleranceRatioW(); + cerr << ", tbh: " << _parent->getToleranceBandH(); + cerr << ", tbw: " << _parent->getToleranceBandW(); + cerr << endl; + } else { + cerr << "Parent : None " << endl; + } + HVSlicingNode::print(); + + for (list >::const_iterator it1 = _symmetries.begin(); it1 != _symmetries.end(); it1++){ + cerr << "Symmetrie: (" << (*it1).first << " - " << (*it1).second << ")" << endl; + } + cerr << endl; + + for(vector::const_iterator it = _children.begin(); it != _children.end(); it++ ){ + (*it)->print(); + } + cerr << endl; + } + + + void VSlicingNode::toXML ( ofstream& file, unsigned indent ) + { + for (unsigned i = 0 ; i < indent ; i++){ file << " "; } + file << "" << endl; + + // Parameters + for (unsigned i = 0 ; i < indent+1 ; i++){ file << " "; } + file << "" << endl; + + for (unsigned i = 0 ; i < indent+2 ; i++){ file << " "; } + file << "" << endl; + + if (!hasSameParentToleranceRatioH ()){ + for (unsigned i = 0 ; i < indent+2 ; i++){ file << " "; } + file << "" << endl; + } + + if (!hasSameParentToleranceRatioW ()){ + for (unsigned i = 0 ; i < indent+2 ; i++){ file << " "; } + file << "" << endl; + } + + if (!hasSameParentToleranceBandH ()){ + for (unsigned i = 0 ; i < indent+2 ; i++){ file << " "; } + file << "" << endl; + } + + if (!hasSameParentToleranceBandW ()){ + for (unsigned i = 0 ; i < indent+2 ; i++){ file << " "; } + file << "" << endl; + } + + for (unsigned i = 0 ; i < indent+1 ; i++){ file << " "; } + file << "" << endl; + + // Symmetries + if (!_symmetries.empty()){ + for (unsigned i = 0 ; i < indent+1 ; i++){ file << " "; } + file << "" << endl; + + for ( std::list >::const_iterator it = _symmetries.begin(); it != _symmetries.end(); it++ ){ + for (unsigned i = 0 ; i < indent+2 ; i++){ file << " "; } + file << "" << endl; + } + + for (unsigned i = 0 ; i < indent+1 ; i++){ file << " "; } + file << "" << endl; + } + + // Children + if (!_children.empty()){ + for (unsigned i = 0 ; i < indent+1 ; i++){ file << " "; } + file << "" << endl; + + for (std::vector::const_iterator it2 = _children.begin(); it2 != _children.end(); it2++){ + (*it2)->toXML(file, indent+2); + } + + for (unsigned i = 0 ; i < indent+1 ; i++){ file << " "; } + file << "" << endl; + } + + for (unsigned i = 0 ; i < indent ; i++){ file << " "; } + file << "" << endl; + } + + +// -----------------------------------------------------------------------------------------------// +// Class : RSlicingNode +// -----------------------------------------------------------------------------------------------// + + + RSlicingNode::RSlicingNode( std::string value, SlicingNode* parent ): SlicingNode(parent) + { + std::string::size_type sz; + _value = stof(value, &sz); + } + + + RSlicingNode::RSlicingNode( double value, SlicingNode* parent ): SlicingNode(parent) + { + _value = value; + } + + + void RSlicingNode::setValue( string value ) + { + std::string::size_type sz; + _value = stof(value, &sz); + } + + + void RSlicingNode::print() const + { + cerr << "type : Routing " << endl; + cerr << "value : " << _value << endl; + cerr << endl; + } + + + void RSlicingNode::toXML ( ofstream& file, unsigned indent ) + { + for (unsigned i = 0 ; i < indent ; i++){ file << " "; } + file << "" << endl; + } + +} // OpenChams namespace diff --git a/vlsisapd/src/openChams/src/vlsisapd/openChams/Circuit.h b/vlsisapd/src/openChams/src/vlsisapd/openChams/Circuit.h index 1f995133..e11469a0 100644 --- a/vlsisapd/src/openChams/src/vlsisapd/openChams/Circuit.h +++ b/vlsisapd/src/openChams/src/vlsisapd/openChams/Circuit.h @@ -2,13 +2,14 @@ // -*- C++ -*- // // This file is part of the VLSI SAPD Software. -// Copyright (c) UPMC/LIP6 2009-2012, All Rights Reserved +// Copyright (c) UPMC/LIP6 2009-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | V L S I S A P D | // | OpenChams Circuit Data Base | // | | // | Author : Damien Dupuis | +// | Eric Lao | // | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Header : "./vlsisapd/openChams/Circuit.h" | @@ -27,6 +28,7 @@ #include "vlsisapd/openChams/Parameters.h" #include "vlsisapd/openChams/SimulModel.h" +#include "vlsisapd/openChams/SlicingTree.h" namespace OpenChams { @@ -58,6 +60,7 @@ namespace OpenChams { inline Parameters getParameters (); inline void addSubCircuitPath ( std::string ); inline std::vector& getSubCircuitPaths (); + inline SlicingNode* getSlicingTree (); // Mutators. void addSimulModel ( unsigned , SimulModel::Base @@ -69,7 +72,9 @@ namespace OpenChams { Schematic* createSchematic (); Sizing* createSizing (); Layout* createLayout (); + void setSlicingTree ( SlicingNode* slicingtree ); void driveHBTree ( std::ofstream&, Node*, unsigned ); + void driveSlicingTree ( std::ofstream&, SlicingNode*, unsigned ); bool writeToFile ( std::string filePath ); static Circuit* readFromFile ( const std::string filePath ); @@ -112,6 +117,17 @@ namespace OpenChams { void readHBTree ( xmlNode*, Layout* ); Node* readNodeOrBloc ( xmlNode*, Node* parent = NULL ); void setAbsolutePath ( const std::string filePath ); + // Slicingtree related XML methods. + void readSlicingTree ( xmlNode* ); + SlicingNode* readSlicingNode ( xmlNode* xnode, SlicingNode* slicingNode = NULL ); + VSlicingNode* createVerticalSlicingNode ( xmlNode* xnode, SlicingNode* slicingNode = NULL ); + HSlicingNode* createHorizontalSlicingNode ( xmlNode* xnode, SlicingNode* slicingNode = NULL ); + DSlicingNode* createDeviceSlicingNode ( xmlNode* xnode, SlicingNode* slicingNode = NULL ); + RSlicingNode* createRoutingSlicingNode ( xmlNode* xnode, SlicingNode* slicingNode = NULL ); + void addChildren ( xmlNode*, HVSlicingNode* ); + void setHVParameters ( xmlNode*, HVSlicingNode* ); + void setHVSymmetries ( xmlNode*, HVSlicingNode* ); + // Utilities methods. void check_uppercase ( std::string& str, std::vector& compares, std::string message ); void check_lowercase ( std::string& str, std::vector& compares, std::string message ); @@ -127,6 +143,7 @@ namespace OpenChams { Layout* _layout; std::vector _subCircuitsPaths; std::map _simulModels; + SlicingNode* _slicingtree; }; @@ -142,7 +159,7 @@ namespace OpenChams { inline Parameters Circuit::getParameters () { return _params; } inline void Circuit::addSubCircuitPath (std::string path) { _subCircuitsPaths.push_back(path); } inline std::vector& Circuit::getSubCircuitPaths () { return _subCircuitsPaths; } - + inline SlicingNode* Circuit::getSlicingTree () { return _slicingtree; } template inline std::string asString ( T value ) diff --git a/vlsisapd/src/openChams/src/vlsisapd/openChams/Schematic.h b/vlsisapd/src/openChams/src/vlsisapd/openChams/Schematic.h index eadd0186..52834912 100644 --- a/vlsisapd/src/openChams/src/vlsisapd/openChams/Schematic.h +++ b/vlsisapd/src/openChams/src/vlsisapd/openChams/Schematic.h @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the VLSI SAPD Software. -// Copyright (c) UPMC 2010-2015, All Rights Reserved +// Copyright (c) UPMC 2010-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | V L S I S A P D | diff --git a/vlsisapd/src/openChams/src/vlsisapd/openChams/SlicingTree.h b/vlsisapd/src/openChams/src/vlsisapd/openChams/SlicingTree.h new file mode 100644 index 00000000..3bcb21ce --- /dev/null +++ b/vlsisapd/src/openChams/src/vlsisapd/openChams/SlicingTree.h @@ -0,0 +1,392 @@ + +// -*- C++ -*- +// +// This file is part of the VLSI SAPD Software. +// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | V L S I S A P D | +// | OpenChams Circuit Data Base | +// | | +// | Author : Eric Lao | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./vlsisapd/openChams/SlicingTree.h" | +// +-----------------------------------------------------------------+ + +#ifndef __OPENCHAMS_SLICINGTREE_H__ +#define __OPENCHAMS_SLICINGTREE_H__ + +#include +#include +#include +#include +#include +#include + + +namespace OpenChams { + + enum Flags { UnknownType = 1 << 0 + , HorizontalSNode = 1 << 1 + , VerticalSNode = 1 << 2 + , DeviceSNode = 1 << 3 + , RoutingSNode = 1 << 4 + , UnknownAlignment = 1 << 5 + , AlignLeft = 1 << 6 + , AlignRight = 1 << 7 + , AlignCenter = 1 << 8 + , AlignTop = 1 << 9 + , AlignBottom = 1 << 10 + }; + +// -----------------------------------------------------------------------------------------------// +// Class : SlicingNode +// -----------------------------------------------------------------------------------------------// + + + class SlicingNode + { + public: + SlicingNode( SlicingNode* parent = NULL ); + virtual ~SlicingNode(){}; + + public: + virtual unsigned int getType () const { return UnknownType; } + virtual void print () const {}; + inline void recursiveDestroy (); + void setParent ( SlicingNode* parent ); + SlicingNode* getParent () const; + inline bool isRoot () const; + virtual void setAlignment ( std::string alignment ); + std::string alignmentToString() const; + //Error Methods + virtual std::string getInstanceName () const; + virtual unsigned int getAlignment () const; + virtual bool getPreset () const; + virtual double getX () const; + virtual double getY () const; + virtual int getNFing () const; + virtual double getStart () const; + virtual double getStep () const; + virtual double getCount () const; + + virtual void setInstanceName ( std::string instanceName ); + virtual void setPreset ( std::string preset ); + virtual void setX ( std::string x ); + virtual void setY ( std::string y ); + virtual void setNFing ( std::string nfing ); + virtual void setStart ( std::string start ); + virtual void setStep ( std::string step ); + virtual void setCount ( std::string count ); + + virtual void setPreset ( bool preset ); + virtual void setX ( double x ); + virtual void setY ( double y ); + virtual void setNFing ( int nfing ); + virtual void setStart ( double start ); + virtual void setStep ( double step ); + virtual void setCount ( double count ); + + virtual const std::vector getChildren () const; + virtual std::list > getSymmetries () const; + + virtual double getToleranceRatioH() const; + virtual double getToleranceRatioW() const; + virtual double getToleranceBandH () const; + virtual double getToleranceBandW () const; + + virtual void setToleranceRatioH( std::string value ); + virtual void setToleranceRatioW( std::string value ); + virtual void setToleranceBandH ( std::string value ); + virtual void setToleranceBandW ( std::string value ); + + virtual void setToleranceRatioH( double value ); + virtual void setToleranceRatioW( double value ); + virtual void setToleranceBandH ( double value ); + virtual void setToleranceBandW ( double value ); + + virtual void push_back ( SlicingNode* node ); + virtual void addSymmetry ( std::string source, std::string target ); + virtual void addSymmetry ( int source, int target ); + virtual double getValue () const; + virtual void setValue ( std::string value ); + virtual void toXML ( std::ofstream& file, unsigned indent ){}; + + virtual std::string presetToString () const; + virtual std::string xToString () const; + virtual std::string yToString () const; + virtual std::string nfingToString () const; + virtual std::string startToString () const; + virtual std::string stepToString () const; + virtual std::string countToString () const; + virtual std::string valueToString () const; + + virtual std::string toleranceRatioHToString() const; + virtual std::string toleranceRatioWToString() const; + virtual std::string toleranceBandHToString () const; + virtual std::string toleranceBandWToString () const; + + virtual bool hasSameParentToleranceRatioH () const; + virtual bool hasSameParentToleranceRatioW () const; + virtual bool hasSameParentToleranceBandH () const; + virtual bool hasSameParentToleranceBandW () const; + + virtual bool checkInitialPlacement( int& cpt ) const; + virtual std::list getLeaves () const; + + protected: + SlicingNode* _parent; + unsigned int _alignment; + }; + + inline void SlicingNode::recursiveDestroy(){ delete(this); } + inline bool SlicingNode::isRoot () const { return (_parent == NULL); } + + +// -----------------------------------------------------------------------------------------------// +// Class : DeviceSNode +// -----------------------------------------------------------------------------------------------// + + + class DSlicingNode : public SlicingNode + { + private: + DSlicingNode( std::string instanceName, SlicingNode* parent = NULL ); + ~DSlicingNode(){}; + + public: + inline static DSlicingNode* create ( std::string instanceName, SlicingNode* parent = NULL ); + inline std::string getInstanceName () const; + inline unsigned int getAlignment () const; + inline bool getPreset () const; + inline double getX () const; + inline double getY () const; + inline int getNFing () const; + inline double getStart () const; + inline double getStep () const; + inline double getCount () const; + inline unsigned int getType () const; + + void setInstanceName ( std::string instanceName ); + void setPreset ( std::string preset ); + void setX ( std::string x ); + void setY ( std::string y ); + void setNFing ( std::string nfing ); + void setStart ( std::string start ); + void setStep ( std::string step ); + void setCount ( std::string count ); + + inline void setPreset ( bool preset ); + inline void setX ( double x ); + inline void setY ( double y ); + inline void setNFing ( int nfing ); + inline void setStart ( double start ); + inline void setStep ( double step ); + inline void setCount ( double count ); + + void print () const; + void toXML ( std::ofstream& file, unsigned indent ); + inline std::string presetToString () const; + inline std::string xToString () const; + inline std::string yToString () const; + inline std::string nfingToString () const; + inline std::string startToString () const; + inline std::string stepToString () const; + inline std::string countToString () const; + + bool checkInitialPlacement ( int& cpt ) const; + + private: + std::string _instanceName; + bool _preset; + double _x; + double _y; + int _nfing; + double _start; + double _step; + double _count; + }; + + inline DSlicingNode* DSlicingNode::create ( std::string instanceName, SlicingNode* parent ){ return new DSlicingNode( instanceName ); } + inline std::string DSlicingNode::getInstanceName () const { return _instanceName ; } + inline unsigned int DSlicingNode::getAlignment () const { return _alignment ; } + inline bool DSlicingNode::getPreset () const { return _preset ; } + inline double DSlicingNode::getX () const { return _x ; } + inline double DSlicingNode::getY () const { return _y ; } + inline int DSlicingNode::getNFing () const { return _nfing ; } + inline double DSlicingNode::getStart () const { return _start ; } + inline double DSlicingNode::getStep () const { return _step ; } + inline double DSlicingNode::getCount () const { return _count ; } + inline unsigned int DSlicingNode::getType () const { return DeviceSNode ; } + + inline void DSlicingNode::setPreset ( bool preset ) { _preset = preset; } + inline void DSlicingNode::setX ( double x ) { _x = x ; } + inline void DSlicingNode::setY ( double y ) { _y = y ; } + inline void DSlicingNode::setNFing ( int nfing ) { _nfing = nfing ; } + inline void DSlicingNode::setStart ( double start ) { _start = start ; } + inline void DSlicingNode::setStep ( double step ) { _step = step ; } + inline void DSlicingNode::setCount ( double count ) { _count = count ; } + + inline std::string DSlicingNode::presetToString () const { return _preset ? "true" : "false"; } + inline std::string DSlicingNode::xToString () const { return std::to_string(_x ); } + inline std::string DSlicingNode::yToString () const { return std::to_string(_y ); } + inline std::string DSlicingNode::nfingToString () const { return std::to_string(_nfing); } + inline std::string DSlicingNode::startToString () const { return std::to_string(_start); } + inline std::string DSlicingNode::stepToString () const { return std::to_string(_step ); } + inline std::string DSlicingNode::countToString () const { return std::to_string(_count); } + +// -----------------------------------------------------------------------------------------------// +// Class : HVSlicingNode +// -----------------------------------------------------------------------------------------------// + + + class HVSlicingNode : public SlicingNode + { + protected: + HVSlicingNode( SlicingNode* parent = NULL ); + virtual ~HVSlicingNode(){}; + + public: + inline unsigned int getAlignment () const; + inline double getToleranceRatioH() const; + inline double getToleranceRatioW() const; + inline double getToleranceBandH () const; + inline double getToleranceBandW () const; + inline const std::vector getChildren () const; + inline std::list > getSymmetries () const; + + void setToleranceRatioH( std::string value ); + void setToleranceRatioW( std::string value ); + void setToleranceBandH ( std::string value ); + void setToleranceBandW ( std::string value ); + + void setToleranceRatioH( double value ); + void setToleranceRatioW( double value ); + void setToleranceBandH ( double value ); + void setToleranceBandW ( double value ); + + void push_back ( SlicingNode* node ); + void addSymmetry ( std::string source, std::string target ); + void addSymmetry ( int source, int target ); + void recursiveDestroy (); + void print () const; + + inline std::string toleranceRatioHToString () const; + inline std::string toleranceRatioWToString () const; + inline std::string toleranceBandHToString () const; + inline std::string toleranceBandWToString () const; + + bool hasSameParentToleranceRatioH () const; + bool hasSameParentToleranceRatioW () const; + bool hasSameParentToleranceBandH () const; + bool hasSameParentToleranceBandW () const; + + bool checkInitialPlacement ( int& cpt ) const; + std::list getLeaves () const; + + protected: + double _toleranceRatioH; + double _toleranceRatioW; + double _toleranceBandH; + double _toleranceBandW; + std::list > _symmetries; + std::vector _children; + }; + + inline unsigned int HVSlicingNode::getAlignment () const { return _alignment ; } + inline double HVSlicingNode::getToleranceRatioH() const { return _toleranceRatioH; } + inline double HVSlicingNode::getToleranceRatioW() const { return _toleranceRatioW; } + inline double HVSlicingNode::getToleranceBandH () const { return _toleranceBandH ; } + inline double HVSlicingNode::getToleranceBandW () const { return _toleranceBandW ; } + inline const std::vector HVSlicingNode::getChildren () const { return _children ; } + inline std::list > HVSlicingNode::getSymmetries () const { return _symmetries ; } + + inline std::string HVSlicingNode::toleranceRatioHToString() const { return std::to_string(_toleranceRatioH); } + inline std::string HVSlicingNode::toleranceRatioWToString() const { return std::to_string(_toleranceRatioW); } + inline std::string HVSlicingNode::toleranceBandHToString () const { return std::to_string(_toleranceBandH); } + inline std::string HVSlicingNode::toleranceBandWToString () const { return std::to_string(_toleranceBandW); } + + +// -----------------------------------------------------------------------------------------------// +// Class : HSlicingNode +// -----------------------------------------------------------------------------------------------// + + + class HSlicingNode: public HVSlicingNode + { + private: + HSlicingNode( SlicingNode* parent = NULL ); + ~HSlicingNode(){}; + + public: + inline static HSlicingNode* create ( SlicingNode* parent = NULL ); + inline unsigned int getType () const; + void print () const; + void toXML ( std::ofstream& file, unsigned indent ); + }; + + inline HSlicingNode* HSlicingNode::create ( SlicingNode* parent ){ return new HSlicingNode(parent); } + inline unsigned int HSlicingNode::getType() const { return HorizontalSNode ; } + + +// -----------------------------------------------------------------------------------------------// +// Class : VSlicingNode +// -----------------------------------------------------------------------------------------------// + + + class VSlicingNode: public HVSlicingNode + { + private: + VSlicingNode( SlicingNode* parent = NULL ); + ~VSlicingNode(){}; + + public: + inline static VSlicingNode* create ( SlicingNode* parent = NULL ); + inline unsigned int getType () const; + void print () const; + void toXML ( std::ofstream& file, unsigned indent ); + }; + + inline VSlicingNode* VSlicingNode::create ( SlicingNode* parent ){ return new VSlicingNode(parent); } + inline unsigned int VSlicingNode::getType() const { return VerticalSNode ; } + + +// -----------------------------------------------------------------------------------------------// +// Class : RoutingSNode +// -----------------------------------------------------------------------------------------------// + + + class RSlicingNode: public SlicingNode + { + private: + RSlicingNode( std::string value, SlicingNode* parent = NULL ); + RSlicingNode( double value, SlicingNode* parent = NULL ); + ~RSlicingNode(){}; + + public: + inline static RSlicingNode* create ( std::string value, SlicingNode* parent = NULL ); + inline static RSlicingNode* create ( double value, SlicingNode* parent = NULL ); + inline void recursiveDestroy (); + inline double getValue () const; + void setValue ( std::string value ); + inline unsigned int getType () const; + void print () const; + void setAlignment ( std::string alignment) {}; + void toXML ( std::ofstream& file, unsigned indent ); + inline std::string valueToString () const; + + private: + double _value; + }; + + inline RSlicingNode* RSlicingNode::create ( std::string value, SlicingNode* parent ){ return new RSlicingNode( value, parent ); } + inline RSlicingNode* RSlicingNode::create ( double value, SlicingNode* parent ){ return new RSlicingNode( value, parent ); } + inline double RSlicingNode::getValue () const{ return _value ; } + inline unsigned int RSlicingNode::getType () const{ return RoutingSNode; } + inline std::string RSlicingNode::valueToString () const { return std::to_string(_value); } + + +} // OpenChams namespace + +#endif diff --git a/vlsisapd/src/utilities/src/Dots.cpp b/vlsisapd/src/utilities/src/Dots.cpp index d18551cf..772d08c4 100644 --- a/vlsisapd/src/utilities/src/Dots.cpp +++ b/vlsisapd/src/utilities/src/Dots.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the VLSI Stand-Alone Software. -// Copyright (c) UPMC 2013-2015, All Rights Reserved +// Copyright (c) UPMC 2013-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | V L S I Stand - Alone Parsers / Drivers | @@ -30,7 +30,8 @@ namespace Utilities { CR(); else _flags &= ~FirstDot; - _ostream << _indent; + if (enabled()) + _ostream << _indent; } _flush( '.' ); diff --git a/vlsisapd/src/utilities/src/Path.cpp b/vlsisapd/src/utilities/src/Path.cpp index e921f1cf..12edbffb 100644 --- a/vlsisapd/src/utilities/src/Path.cpp +++ b/vlsisapd/src/utilities/src/Path.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the VLSI Stand-Alone Software. -// Copyright (c) UPMC 2013-2015, All Rights Reserved +// Copyright (c) UPMC 2013-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | V L S I Stand - Alone Parsers / Drivers | diff --git a/vlsisapd/src/utilities/src/vlsisapd/utilities/Dots.h b/vlsisapd/src/utilities/src/vlsisapd/utilities/Dots.h index 6e6884ce..0a0e38ad 100644 --- a/vlsisapd/src/utilities/src/vlsisapd/utilities/Dots.h +++ b/vlsisapd/src/utilities/src/vlsisapd/utilities/Dots.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the VLSI Stand-Alone Software. -// Copyright (c) UPMC 2013-2015, All Rights Reserved +// Copyright (c) UPMC 2013-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | V L S I Stand - Alone Parsers / Drivers | @@ -26,7 +26,7 @@ namespace Utilities { class Dots { public: - enum Flag { NoFlags=0x00, FirstDot=0x01, Reset=0x02 }; + enum Flag { NoFlags=0x00, FirstDot=0x01, Reset=0x02, Disabled=0x04 }; public: inline Dots ( std::ostream& , const std::string& indent @@ -38,6 +38,9 @@ namespace Utilities { inline void CR (); void dot (); void finish ( unsigned int flags ); + inline bool enabled (); + inline void enable (); + inline void disable (); private: inline void _flush ( char ); private: @@ -61,10 +64,15 @@ namespace Utilities { inline void Dots::setWidth ( unsigned int w ) { _width=w; } inline void Dots::setDivider ( unsigned int d ) { _divider=d; } + inline bool Dots::enabled () { return not (_flags & Disabled); } + inline void Dots::enable () { _flags &= ~Disabled; } + inline void Dots::disable () { _flags |= Disabled; } inline void Dots::_flush ( char c ) { - _ostream.put( c ); + if (not enabled()) return; + + _ostream << c; _ostream.flush(); } @@ -75,7 +83,7 @@ namespace Utilities { inline void Dots::reset ( unsigned int flags ) { - _flags = flags; + _flags = flags | ((not enabled()) ? Disabled : NoFlags); _count = 0; } diff --git a/vlsisapd/src/utilities/src/vlsisapd/utilities/Path.h b/vlsisapd/src/utilities/src/vlsisapd/utilities/Path.h index 17b8d7be..7b8df996 100644 --- a/vlsisapd/src/utilities/src/vlsisapd/utilities/Path.h +++ b/vlsisapd/src/utilities/src/vlsisapd/utilities/Path.h @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the VSLSI Stand-Alone Software. -// Copyright (c) UPMC 2013-2015, All Rights Reserved +// Copyright (c) UPMC 2013-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | V L S I Stand - Alone Parsers / Drivers |