From 4b5a3ef5d298a392117ad8d852fc7a1512d10467 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Mon, 3 Dec 2012 08:31:26 +0000 Subject: [PATCH] * All Tools: - New: Added FreeBSD/Ubuntu patches from Otacilio De Araujo (). * ./stratus/src/stratus.py - Change: Configuration is now read through the new python C/API system. No more st_config. --- stratus1/src/stratus/st_instance.py | 1 + stratus1/src/stratus/st_model.py | 81 ++++++---------- stratus1/src/stratus/st_net.py | 4 +- stratus1/src/stratus/st_placement.py | 2 +- stratus1/src/stratus/stratus.py | 132 ++++++++++----------------- 5 files changed, 82 insertions(+), 138 deletions(-) diff --git a/stratus1/src/stratus/st_instance.py b/stratus1/src/stratus/st_instance.py index faa05d40..b8114fd3 100644 --- a/stratus1/src/stratus/st_instance.py +++ b/stratus1/src/stratus/st_instance.py @@ -351,6 +351,7 @@ class Inst : if chaine : name = chaine.group(1) err = "\n[Stratus ERROR] Inst : plug " + name + " of instance " + self._name + " must be connected.\n" + err += ' (raw name: <%s>)\n' % str(plug.getMasterNet().getName()) raise Exception ( err ) ############## diff --git a/stratus1/src/stratus/st_model.py b/stratus1/src/stratus/st_model.py index c9989e7d..0b7ace14 100644 --- a/stratus1/src/stratus/st_model.py +++ b/stratus1/src/stratus/st_model.py @@ -1,60 +1,27 @@ #!/usr/bin/python - -# This file is part of the Coriolis Project. -# Copyright (C) Laboratoire LIP6 - Departement ASIM -# Universite Pierre et Marie Curie # -# Main contributors : -# Christophe Alexandre -# Sophie Belloeil -# Hugo Clement -# 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 +# This file is part of the Coriolis Software. +# Copyright (c) UPMC/LIP6 2008-2012, All Rights Reserved # -# License-Tag -# Authors-Tag -# =================================================================== -# -# x-----------------------------------------------------------------x -# | | +# +-----------------------------------------------------------------+ # | C O R I O L I S | -# | S t r a t u s - Netlists/Layouts Description | +# | S t r a t u s - Netlists/Layouts Description | # | | # | Author : Sophie BELLOEIL | # | E-mail : Sophie.Belloeil@asim.lip6.fr | # | =============================================================== | # | Py Module : "./st_model.py" | -# | *************************************************************** | -# | U p d a t e s | -# | | -# x-----------------------------------------------------------------x - +# +-----------------------------------------------------------------+ +import re +import types +import string +import Cfg import CRL import Viewer -from Hurricane import * +from Hurricane import * -import re, types, string - -import st_config FRAMEWORK = None EDITOR = None @@ -475,16 +442,18 @@ class Model : global FRAMEWORK global CELLS + netlistFormat = Cfg.getParamString('stratus1.format').asString() + if views == STRATUS : self.exportStratus ( fileName ) - elif st_config.format in ['vst','vhd'] : + elif netlistFormat in ['vst','vhd'] : UpdateSession.open() hurCell = self._hur_cell if str ( hurCell.getName() ) != "__Scratch__" : - if st_config.format == 'vst' : + if netlistFormat == 'vst' : FRAMEWORK.saveCell ( hurCell, views|CRL.Catalog.State.Logical ) else : self.exportVHD() @@ -497,14 +466,14 @@ class Model : UpdateSession.close() - elif st_config.format == 'stratus' : + elif netlistFormat == 'stratus' : self.exportStratus ( fileName ) - elif st_config.format == 'vlog' : - raise Exception('Format %s not yet implemented' % st_config.format) + elif netlistFormat == 'vlog' : + raise Exception('Format %s not yet implemented' % netlistFormat) else : - raise Exception('Unrecognized format %s' % st_config.format) + raise Exception('Unrecognized format %s' % netlistFormat) ##### Simul : in order to use simulation tool ##### def Simul ( self, name = None, tool = 'asimut' ) : @@ -512,9 +481,11 @@ class Model : if not name : name = self._name - if st_config.simulator == 'asimut' : + simulator = Cfg.getParamString('stratus1.simulator').asString() + + if simulator == 'asimut' : runpat ( self._name, name, '-l 1 -p 100 -zerodelay -bdd' ) - elif st_config.simulator == 'ghdl' : + elif simulator == 'ghdl' : import os cmd_str = ('ghdl -c -g -Psxlib --ieee=synopsys *.vhd -r %s_run --vcd=%s.vcd' %(name,name)) os.system(cmd_str) @@ -523,9 +494,11 @@ class Model : ##### TestBench : in order to create testbench ##### def Testbench ( self ) : + netlistFormat = Cfg.getParamString('stratus1.format').asString() + import stimuli stim = stimuli.Stimuli(self) - if st_config.format == 'vhd' : + if netlistFormat == 'vhd' : # Create stimuli input file stim.create_stimuli_text_file() @@ -534,10 +507,10 @@ class Model : # Create testbench and block instance stim.create_run(debug = False, downto = True) - elif st_config.format == 'vst' : + elif netlistFormat == 'vst' : stim.create_pat_file() else : - raise Exception('Testbench not yet implemented for format %s' % st_config.format) + raise Exception('Testbench not yet implemented for format %s' % netlistFormat) ##### Create a stratus file given the database ##### def exportStratus ( self, fileName ) : diff --git a/stratus1/src/stratus/st_net.py b/stratus1/src/stratus/st_net.py index e2c717be..71d6e949 100644 --- a/stratus1/src/stratus/st_net.py +++ b/stratus1/src/stratus/st_net.py @@ -919,7 +919,9 @@ class net : if self._arity == 1 : self.hur_net ( self._name, 0 ) else : - for i in range ( self._ind+self._arity, self._ind, -1 ): + #for i in range ( self._ind+self._arity, self._ind, -1 ): + for i in range ( self._ind, self._ind+self._arity, 1 ): + #print 'create %s(%d)' % (self._name,i) self.hur_net ( '%s(%d)' % (self._name,i), i ) ##### hur_net one by one ##### diff --git a/stratus1/src/stratus/st_placement.py b/stratus1/src/stratus/st_placement.py index e7aef1bc..052e973f 100644 --- a/stratus1/src/stratus/st_placement.py +++ b/stratus1/src/stratus/st_placement.py @@ -91,7 +91,7 @@ def PlaceTop ( ins, symetry, offsetX = 0, offsetY = 0, plac = FIXED ) : if offsetY % MYSLICE : err = "\n[Stratus ERROR] PlaceTop : " + ins._name + " : offsetY is not a mutiple of SLICE.\n" raise Exception ( err ) - + if ( plac != PLACED ) and ( plac != FIXED ) : err = "\n[Stratus ERROR] PlaceTop : " + ins._name + " : wrong argument for placement type.\n" raise Exception ( err ) diff --git a/stratus1/src/stratus/stratus.py b/stratus1/src/stratus/stratus.py index 16a3513a..2160195f 100644 --- a/stratus1/src/stratus/stratus.py +++ b/stratus1/src/stratus/stratus.py @@ -1,97 +1,65 @@ #!/usr/bin/python - -# This file is part of the Coriolis Project. -# Copyright (C) Laboratoire LIP6 - Departement ASIM -# Universite Pierre et Marie Curie # -# Main contributors : -# Christophe Alexandre -# Sophie Belloeil -# Hugo Clement -# 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 +# This file is part of the Coriolis Software. +# Copyright (c) UPMC/LIP6 2008-2012, All Rights Reserved # -# License-Tag -# Authors-Tag -# =================================================================== -# -# x-----------------------------------------------------------------x -# | | +# +-----------------------------------------------------------------+ # | C O R I O L I S | -# | S t r a t u s - Netlists/Layouts Description | +# | S t r a t u s - Netlists/Layouts Description | # | | # | Author : Sophie BELLOEIL | # | E-mail : Sophie.Belloeil@asim.lip6.fr | # | =============================================================== | # | Py Module : "./stratus.py" | -# | *************************************************************** | -# | U p d a t e s | -# | | -# x-----------------------------------------------------------------x +# +-----------------------------------------------------------------+ -# Get configuration of Stratus -def getConfigFile(): - import os +try: + import sys + import Cfg + import CRL - config_file = os.path.join(os.getcwd(),".st_config.py") - if os.path.exists(config_file): - return config_file - else: - config_file = os.path.join(os.getenv('HOME'),".st_config.py") - if os.path.exists(config_file): - return config_file - else: - return None - -configFile = getConfigFile() -if configFile: - import imp - imp.load_source('st_config',configFile) -else: - print "No configuration file found, using default configuration" - import st_config -print "Output format : %s\nSimulator : %s" %(st_config.format,st_config.simulator) - - -from st_model import * -from st_net import * -from st_instance import * -from st_placement import * -from st_placeAndRoute import * -from st_ref import * -from st_generate import * -from st_const import * -from st_cat import * -from st_param import * -from st_getrealmodel import GetWeightTime, GetWeightArea, GetWeightPower - -from util_Const import * -from util_Defs import * -from util_Misc import * -from util_Gen import * -from util_Shift import * -from util_uRom import * -from util import * - -from patterns import * + # Triggers the default configuration files loading. + CRL.AllianceFramework.get() + Cfg.Configuration.pushDefaultPriority(Cfg.Parameter.Priority.ApplicationBuiltin) + Cfg.getParamString('stratus1.format' ).setString('vst') + Cfg.getParamString('stratus1.simulator').setString('asimut') + Cfg.Configuration.popDefaultPriority() + print ' o Stratus Configuration:' + print ' - Netlist format: <%s>.' % Cfg.getParamString('stratus1.format').asString() + print ' - Simulator: <%s>.' % Cfg.getParamString('stratus1.simulator').asString() + + from st_model import * + from st_net import * + from st_instance import * + from st_placement import * + from st_placeAndRoute import * + from st_ref import * + from st_generate import * + from st_const import * + from st_cat import * + from st_param import * + from st_getrealmodel import GetWeightTime, GetWeightArea, GetWeightPower + + from util_Const import * + from util_Defs import * + from util_Misc import * + from util_Gen import * + from util_Shift import * + from util_uRom import * + from util import * + + from patterns import * +except ImportError, e: + module = str(e).split()[-1] + print '[ERROR] The <%s> python module or symbol cannot be loaded.' % module + print ' Please check the integrity of the package.' + sys.exit(1) +except Exception, e: + print '[ERROR] A strange exception occurred while loading the basic Coriolis/Python' + print ' modules. Something may be wrong at Python/C API level.\n' + print ' %s' % e + sys.exit(2)