From cb4e538b78c109aaa3ba15bca71f46c3de1ac23c Mon Sep 17 00:00:00 2001 From: Sophie Belloeil Date: Thu, 22 Jul 2010 14:33:55 +0000 Subject: [PATCH] No more setup_apple() macro raise in Python > 2.5 do not accept string anymore --- stratus1/CMakeLists.txt | 1 - stratus1/src/stratus/st_bool.py | 2 +- stratus1/src/stratus/st_cat.py | 2 +- stratus1/src/stratus/st_comp.py | 4 +- stratus1/src/stratus/st_extend.py | 3 +- stratus1/src/stratus/st_generate.py | 6 +- stratus1/src/stratus/st_getrealmodel.py | 8 +- stratus1/src/stratus/st_instance.py | 50 +++++----- stratus1/src/stratus/st_model.py | 38 +++++--- stratus1/src/stratus/st_net.py | 119 +++++++++++++---------- stratus1/src/stratus/st_param.py | 4 +- stratus1/src/stratus/st_placeAndRoute.py | 26 ++--- stratus1/src/stratus/st_placement.py | 76 +++++++-------- stratus1/src/stratus/st_ref.py | 40 ++++---- stratus1/src/stratus/st_shifter.py | 6 +- stratus1/src/stratus/st_slansky.py | 12 +-- stratus1/src/stratus/util_Const.py | 18 ++-- 17 files changed, 219 insertions(+), 196 deletions(-) diff --git a/stratus1/CMakeLists.txt b/stratus1/CMakeLists.txt index c63c1076..395a22b0 100644 --- a/stratus1/CMakeLists.txt +++ b/stratus1/CMakeLists.txt @@ -10,7 +10,6 @@ find_package(Bootstrap REQUIRED) set_cmake_policies() set_lib_link_mode() - setup_apple() setup_sysconfdir("$ENV{CORIOLIS_TOP}") find_package(PythonLibs REQUIRED) diff --git a/stratus1/src/stratus/st_bool.py b/stratus1/src/stratus/st_bool.py index 277a704f..19ff8350 100644 --- a/stratus1/src/stratus/st_bool.py +++ b/stratus1/src/stratus/st_bool.py @@ -67,7 +67,7 @@ class Bool ( Model ) : if self.nbit < 1 : err = "\n[Stratus ERROR] " + self.m + " : the number of bits must be greater than 0.\n" - raise err + raise Exception ( err ) def Interface ( self ) : if self.m in I : diff --git a/stratus1/src/stratus/st_cat.py b/stratus1/src/stratus/st_cat.py index 5ba7962c..4cc63fe7 100644 --- a/stratus1/src/stratus/st_cat.py +++ b/stratus1/src/stratus/st_cat.py @@ -74,7 +74,7 @@ def Cat ( *nets ) : if ( "_arity" not in net.__dict__ ) or ( "_real_net" not in net.__dict__ ) or ( "_ind" not in net.__dict__ ) : err = "\n[Stratus ERROR] Cat : Problem of parameter.\n" - raise err + raise Exception ( err ) # Construction of the tab _to_cat if needed if not ( len ( netToCat._to_cat ) ) : diff --git a/stratus1/src/stratus/st_comp.py b/stratus1/src/stratus/st_comp.py index 1466fc25..f9afc488 100644 --- a/stratus1/src/stratus/st_comp.py +++ b/stratus1/src/stratus/st_comp.py @@ -67,7 +67,7 @@ class Comp ( Model ) : # Error : if net is not a string if type ( self.nb ) != types.StringType : err = "\n[Stratus ERROR] " + self.func + " : the argument must be a string.\n" - raise err + raise Exception ( err ) def Interface ( self ) : self.netIn = SignalIn ( "netin", self.nbit ) @@ -87,7 +87,7 @@ class Comp ( Model ) : # Error : if the number is too big for the arity of the net if netConst._arity > self.nbit : err = "\n[Stratus ERROR] " + self.func + " : the number does not match with the net's lenght.\n" - raise err + raise Exception ( err ) # Otherwise, completion of the net elif netConst._arity < self.nbit : extendConst <= netConst.Extend ( self.nbit, 'zero' ) else : netConst.Alias ( extendConst ) diff --git a/stratus1/src/stratus/st_extend.py b/stratus1/src/stratus/st_extend.py index 1fbd5a13..7075fd0a 100644 --- a/stratus1/src/stratus/st_extend.py +++ b/stratus1/src/stratus/st_extend.py @@ -78,7 +78,8 @@ class Extend ( Model ) : elif self.type == 'signed' : for i in range ( self.nbit0, self.nbit1 ) : self.o[i] <= self.i[self.nbit0-1].Buffer() else : - raise "\n[Stratus ERROR] Extend : type must be \'zero\', \'one\' or \'signed\'.\n" + err = "\n[Stratus ERROR] Extend : type must be \'zero\', \'one\' or \'signed\'.\n" + raise Exception ( err ) def GetParam ( cls ): diff --git a/stratus1/src/stratus/st_generate.py b/stratus1/src/stratus/st_generate.py index 87ec99fc..c40442ea 100644 --- a/stratus1/src/stratus/st_generate.py +++ b/stratus1/src/stratus/st_generate.py @@ -66,15 +66,15 @@ def Generate ( model_name, inst_name, param = {} ) : # Error : if the model is not a string if type ( model_name ) != types.StringType : err = "\n[Stratus ERROR] Generate : the model must be described in a string.\n" - raise err + raise Exception ( err ) if type ( inst_name ) != types.StringType : err = "\n[Stratus ERROR] Generate : the model must be described in a string.\n" - raise err + raise Exception ( err ) # Error : spaces are forbidden if re.search ( " ", inst_name ) : err = "\n[Stratus ERROR] Generate : " + inst_name + " the name of the model \"" + model_name + "\" can not contain a space.\n" - raise err + raise Exception ( err ) # Warning : the name can not contain capitalized letters if re.search ( "[A-Z]", inst_name ) : print "[Stratus Warning] Generate : Upper case letters are not supported, the name", inst_name, "is lowered." diff --git a/stratus1/src/stratus/st_getrealmodel.py b/stratus1/src/stratus/st_getrealmodel.py index 0f995fc3..3b2afdfa 100644 --- a/stratus1/src/stratus/st_getrealmodel.py +++ b/stratus1/src/stratus/st_getrealmodel.py @@ -57,7 +57,7 @@ def InitBV () : myP.Parse ( os.environ['STRATUS_MAPPING_NAME'] ) else : err = "\n[Stratus ERROR] Virtual library : No file found in order to parse.\nCheck STRATUS_MAPPING_NAME.\n" - raise err + raise Exception ( err ) def GetRealModel ( model ) : myP = Parser() @@ -66,7 +66,7 @@ def GetRealModel ( model ) : myP.Parse ( os.environ['STRATUS_MAPPING_NAME'] ) else : err = "\n[Stratus ERROR] Virtual library : No file found in order to parse.\nCheck STRATUS_MAPPING_NAME.\n" - raise err + raise Exception ( err ) return myP._realCell[model], myP._inOut[model] @@ -77,7 +77,7 @@ def GetWeightTime ( model ) : myP.Parse ( os.environ['STRATUS_MAPPING_NAME'] ) else : err = "\n[Stratus ERROR] Virtual library : No file found in order to parse.\nCheck STRATUS_MAPPING_NAME.\n" - raise err + raise Exception ( err ) return myP._weightTime[model] @@ -88,6 +88,6 @@ def GetWeightArea ( model ) : myP.Parse ( os.environ['STRATUS_MAPPING_NAME'] ) else : err = "\n[Stratus ERROR] Virtual library : No file found in order to parse.\nCheck STRATUS_MAPPING_NAME.\n" - raise err + raise Exception ( err ) return myP._weightArea[model] diff --git a/stratus1/src/stratus/st_instance.py b/stratus1/src/stratus/st_instance.py index a9601dcf..7425815c 100644 --- a/stratus1/src/stratus/st_instance.py +++ b/stratus1/src/stratus/st_instance.py @@ -66,15 +66,15 @@ ROMLIB = "rom_" DPSXLIB = "dp_.*_x[1-8]" ## Puts MBK_CATA_LIB at the begining of PYTHONPATH ## -cata_lib = os.environ['MBK_CATA_LIB'] -chaine = re.search ( "([^:]*):(.*)", cata_lib ) -while chaine : - rep = chaine.group ( 1 ) - cata_lib = chaine.group ( 2 ) - - sys.path.insert ( 0, rep ) - - chaine = re.search ( "([^:]*):(.*)", cata_lib ) +#cata_lib = os.environ['MBK_CATA_LIB'] +#chaine = re.search ( "([^:]*):(.*)", cata_lib ) +#while chaine : +# rep = chaine.group ( 1 ) +# cata_lib = chaine.group ( 2 ) +# +# sys.path.insert ( 0, rep ) +# +# chaine = re.search ( "([^:]*):(.*)", cata_lib ) ## Class of nets ## NET = ( "st_net.SignalIn", "st_net.SignalOut", "st_net.SignalInOut" \ @@ -129,7 +129,9 @@ class Inst : ##### Errors ##### # Error : if the model is not a string - if type ( model ) != types.StringType : raise "\n[Stratus ERROR] Inst : the model must be described in a string.\n" + if type ( model ) != types.StringType : + err = "\n[Stratus ERROR] Inst : the model must be described in a string.\n" + raise Exception ( err ) # Warning : the model can not contain capitalized letters if re.search ( "[A-Z]", model ) : print "[Stratus Warning] Inst : Upper case letters are not supported, the name", model, "is lowered." @@ -137,11 +139,11 @@ class Inst : # Error : spaces are forbidden if re.search ( " ", model ) : err = "\n[Stratus ERROR] Inst : " + name + " the name of the model \"" + model + "\" can not contain a space.\n" - raise err + raise Exception ( err ) if name : if re.search ( " ", name ) : err = "\n[Stratus ERROR] Inst : \"" + name + "\" the name of the instance can not contain a space.\n" - raise err + raise Exception ( err ) # Warning : the name can not contain capitalized letters if re.search ( "[A-Z]", name ) : print "[Stratus Warning] : Upper case letters are not supported, the name", name, "is lowered." @@ -156,7 +158,7 @@ class Inst : if map[pin] : err += str(map[pin]) else : err += "None" err += "\n" - raise err + raise Exception ( err ) ##### MasterCell ##### self._hur_masterCell = FRAMEWORK.getCell ( self._model, CRL.Catalog.State.Views ) @@ -193,7 +195,7 @@ class Inst : if not self._hur_masterCell : err = "\n[Stratus ERROR] HurricanePlug : Problem of master cell " + model + ".\nCheck model name and/or CRL_IN_LO/CRL_IN_PH variables .\n" - raise err + raise Exception ( err ) if not self._st_masterCell : if MODELMAP.has_key ( str ( self._hur_masterCell ) ) : @@ -203,7 +205,7 @@ class Inst : if not self._st_cell._hur_cell : err = "\n[Stratus ERROR] HurricanePlug : Problem of hurricane cell.\nTry to contact Coriolis team.\n" - raise err + raise Exception ( err ) inst = Instance ( self._st_cell._hur_cell , self._name @@ -222,12 +224,12 @@ class Inst : # Error : if there is a space in the name of the pin (usually done at the end of the pin ...) if re.search ( " ", pin ) : err = "\n[Stratus ERROR] Inst : " + self._name + " the keys of the connection map can not contain a space : \"" + pin + "\".\n" - raise err + raise Exception ( err ) # Error : if the net to connect does not have it's arity defined if not ( mapNet._arity ) : err = "\n[Stratus ERROR] Inst : " + self._name + " : the size of " + mapNet._name + " has not been defined properly.\n" - raise err + raise Exception ( err ) wrong_pin = 1 for net in self._hur_masterCell.getExternalNets(): @@ -245,7 +247,7 @@ class Inst : sea = re.search ( "(.*),$", err ) if not sea : err += "No pins found ..." else : err = sea.group(1) - raise err + raise Exception ( err ) # Error : if the arities of the nets don't correspond tabPins = self._st_masterCell._st_ports + self._st_masterCell._st_cks + self._st_cell._st_vdds + self._st_cell._st_vsss @@ -254,7 +256,7 @@ class Inst : if net._arity != mapNet._arity : err = "\n[Stratus ERROR] Inst : " + str(self._name) + " : The arity of the net " + mapNet._name + " " + str(mapNet._arity) \ + " does not correspond to the arity of the port of the cell : "+ net._name + " " + str(net._arity) + ".\n" - raise err + raise Exception ( err ) # If the port of the masterCell doesn't have a LSB which is 0 lsb = 0 @@ -265,7 +267,7 @@ class Inst : lsb += 1 if lsb > 20 : # value chosen in order to avoid infinite loop in case of a problem (may be higher) err = "\n[Stratus ERROR] Inst : " + str(self._name) + " : Probem of map, check the arities of your nets.\n" - raise err + raise Exception ( err ) if lsb : lsb -= 1 ### Connection ### @@ -318,7 +320,7 @@ class Inst : if not ( tempNet ) : err = "\n[Stratus ERROR] Inst : Problem in map. Check that the arities of your nets are correct.\n" - raise err + raise Exception ( err ) plug = self._hur_instance.getPlug ( tempNet ) plug.setNet ( hurNet ) @@ -336,7 +338,7 @@ class Inst : if chaine : name = chaine.group(1) err = "\n[Stratus ERROR] Inst : plug " + name + " of instance " + self._name + " must be connected.\n" - raise err + raise Exception ( err ) ############## ### Prints ### @@ -363,12 +365,12 @@ def SetCurrentModel ( instance ) : if not instance : err = "\n[Stratus ERROR] SetCurrentModel : argument given does not exist.\n" - raise err + raise Exception ( err ) cell = instance._st_masterCell if not cell : err = "\n[Stratus ERROR] SetCurrentModel : cannot find model for instance " + str ( getName ( instance ) ) + ".\n" - raise err + raise Exception ( err ) CELLS.append ( cell ) diff --git a/stratus1/src/stratus/st_model.py b/stratus1/src/stratus/st_model.py index 32fbcad9..b69c844d 100644 --- a/stratus1/src/stratus/st_model.py +++ b/stratus1/src/stratus/st_model.py @@ -285,7 +285,8 @@ class Model : break if not hurCell and not stCell : - raise "\nError : no cell found with model %s.\n" % model + err = "\nError : no cell found with model %s.\n" % model + raise Exception ( err ) # Hurricane cell found: if hurCell : @@ -306,9 +307,13 @@ class Model : found = True if direction == DirectionOUT : return "output" elif direction == DirectionIN : return "input" - else : raise "\nError : unable to find direction of port %s in model %s. Direction is %d\n" % ( pin, model, direction ) + else : + err = "\nError : unable to find direction of port %s in model %s. Direction is %d\n" % ( pin, model, direction ) + raise Exception ( err ) - if not found : raise "\nError : unable to find port %s in model %s.\n" % ( pin, model ) + if not found : + err = "\nError : unable to find port %s in model %s.\n" % ( pin, model ) + raise Exception ( err ) # Stratus cell found: elif stCell : @@ -335,16 +340,19 @@ class Model : found = True if net._direct == "OUT" : return "output" elif net._direct == "IN" : return "input" - else : raise "\nError : unable to find direction of port %s in model %s.\n" % ( pin, model ) + else : + err = "\nError : unable to find direction of port %s in model %s.\n" % ( pin, model ) + raise Exception ( err ) if not found : ports = "" for net in stCell._st_ports : ports += net._name + "," - raise "\nError : unable to find port %s in model %s.\nPorts are : %s\n" % ( pin, model, ports ) + err = "\nError : unable to find port %s in model %s.\nPorts are : %s\n" % ( pin, model, ports ) + raise Exception ( err ) else : err = "\n[ERROR] InitGraph : no model named " + model + " in the database.\n" - raise err + raise Exception ( err ) ############################# ##### Print of the cell ##### @@ -366,11 +374,11 @@ class Model : def PrintGraph ( self ) : if "_graph" not in self.__dict__ : err = "\n[Stratus ERROR] PrintGraph : The graph does not exist. Use initGraph before.\n" - raise err + raise Exception ( err ) else : if self._graph == False : err = "\n[Stratus ERROR] PrintGraph : The graph does not exist. Use initGraph before.\n" - raise err + raise Exception ( err ) print "################## Cell's Graph features ##################" for inst in self._st_insts : @@ -434,7 +442,7 @@ class Model : if not self._hur_cell : err = "\n[Stratus ERROR] View : Hurricane Cell does not exist.\nCheck CRL_IN_LO/CRL_IN_PH variables.\n" - raise err + raise Exception ( err ) if EDITOR: EDITOR.setCell ( self._hur_cell ) @@ -459,7 +467,7 @@ class Model : if len ( CELLS ) == 0 : err = "\n[Stratus ERROR] Save : CELLS stack is empty.\n" - raise err + raise Exception ( err ) CELLS.pop() @@ -472,7 +480,7 @@ class Model : if not name : name = self._name if tool == 'asimut' : runpat ( self._name, name, '-l 1 -p 100 -zerodelay -nocheckdriver -nostrict -bdd -nowarning' ) - else : raise 'not implemented yet' + else : raise Exception ( 'not implemented yet' ) ##### Create a stratus file given the database ##### def exportStratus ( self, fileName ) : @@ -762,7 +770,8 @@ class Model : from util_Gen import F_MSB_FIRST if type ( dict ) != types.DictType : - raise "\n[Stratus ERROR] Inst : instanciation of a user's defined generator. The methods' arguments must be dictionnaries.\n" + err = "\n[Stratus ERROR] Inst : instanciation of a user's defined generator. The methods' arguments must be dictionnaries.\n" + raise Exception ( err ) ##### Creation of the instance ##### # dict['flags'] = F_MSB_FIRST # When vst driver permits to do F_LSB_FIRST or F_LSB_FIRST TODO @@ -1118,7 +1127,8 @@ class Model : if not isPad ( instance ): cores.append ( instance ) - if len(cores) == 0 : raise "\n[Stratus ERROR] getCore : No core found.\n" - elif len(cores) > 1 : raise "\n[Stratus ERROR] getCore : More than one core found.\n" + if len(cores) == 0 : err = "\n[Stratus ERROR] getCore : No core found.\n" + elif len(cores) > 1 : err = "\n[Stratus ERROR] getCore : More than one core found.\n" + if len(cores) != 1 : raise Exception ( err ) return cores[0] diff --git a/stratus1/src/stratus/st_net.py b/stratus1/src/stratus/st_net.py index 73efbc72..5f72f04d 100644 --- a/stratus1/src/stratus/st_net.py +++ b/stratus1/src/stratus/st_net.py @@ -116,7 +116,7 @@ class net : + self._name + " of arity " + str(self._arity) if self._ind != 0 : err += " and LSB " + str(self._ind) err += ".\n" - raise err + raise Exception ( err ) return Sig ( self, indice ) @@ -134,13 +134,13 @@ class net : + " for net : " + self._name + " of arity " + str(self._arity) if self._ind != 0 : err += " and LSB " + str(self._ind) err += ".\n" - raise err + raise Exception ( err ) if ( indmax >= ( self._ind + self._arity ) ) or ( indmin < self._ind ) : err = "\n[Stratus ERROR] [:] : bad indexes " + str(indmax) + ", and " + str(indmin) \ + " for net : " + self._name + " of arity " + str(self._arity) if self._ind != 0 : err += " and LSB " + str(self._ind) err += ".\n" - raise err + raise Exception ( err ) return Sig ( self, ind1, ind2 ) @@ -156,7 +156,8 @@ class net : from st_const import Constant if not ( cell._st_vdds ) or not ( cell._st_vsss ) : - raise "\n[Stratus ERROR] : there is no alim.\n" + err = "\n[Stratus ERROR] : there is no alim.\n" + raise Exception ( err ) constParam = { 'nb' : net } string = Constant.getString ( constParam ) @@ -199,7 +200,7 @@ class net : if self._arity - net._arity : err = "\n[Stratus ERROR] <= : the nets " + self._name + " " + str(self._arity) + " and " + net._name + " " + str(net._arity) \ + " must have the same lenght\n" - raise err + raise Exception ( err ) # If the nets are virtual, Let s work with the corresponding real nets if self._real_net : netInCell = self._real_net @@ -211,7 +212,7 @@ class net : # Error if self is an input net if ( netInCell._ext ) and ( netInCell._direct == "IN" ) : err = "\n[Stratus ERROR] <= : " + self._name + " One can not give a value to an input net.\n" - raise err + raise Exception ( err ) if netToMerge._ext : err = "\n[Stratus ERROR] <= : " + self._name @@ -219,7 +220,7 @@ class net : if netToMerge._direct == "OUT" : err += " One can not initialise a net with an output net.\n" # Error if net is an input net elif netToMerge._direct == "IN" : err += " One can not initialise a net with an input net. The method Buffer() should be used.\n" - raise err + raise Exception ( err ) # Construction of the tab if needed if not ( len ( netToMerge._to_merge ) ) : @@ -243,8 +244,10 @@ class net : cell = CELLS[-1] - if not ( cell._st_vdds ) or not ( cell._st_vsss ) : raise "\n[Stratus ERROR] : there is no alim.\n" - + if not ( cell._st_vdds ) or not ( cell._st_vsss ) : + err = "\n[Stratus ERROR] : there is no alim.\n" + raise Exception ( err ) + # Creation of the output net with the right size num_net = len ( cell._TAB_NETS_OUT ) cell._TAB_NETS_OUT += [Signal ( "net_outbuf_%d" % num_net, self._arity )] @@ -288,14 +291,16 @@ class net : elif model == self._st_cell._xor : f = "^" if self._arity - other_net._arity : err = "\n[Stratus ERROR] " + f + " : the nets " + self._name + " and " + other_net._name + " must have the same lenght.\n" - raise err + raise Exception ( err ) # Creation of the output net with the right size num_net = len ( cell._TAB_NETS_OUT ) cell._TAB_NETS_OUT += [Signal ( "net_out_%d" % num_net, self._arity )] - if not ( cell._st_vdds ) or not ( cell._st_vsss ) : raise "\n[Stratus ERROR] : there is no alim.\n" - + if not ( cell._st_vdds ) or not ( cell._st_vsss ) : + err = "\n[Stratus ERROR] : there is no alim.\n" + raise Exception ( err ) + # if ( model in ( "A2", "O2", "Xr2" ) ) and ( self._arity == 1 ) and ( other_net._arity == 1 ) : # inst_name = model.lower() # @@ -325,8 +330,10 @@ class net : cell = CELLS[-1] - if not ( cell._st_vdds ) or not ( cell._st_vsss ) : raise "\n[Stratus ERROR] : there is no alim.\n" - + if not ( cell._st_vdds ) or not ( cell._st_vsss ) : + err = "\n[Stratus ERROR] : there is no alim.\n" + raise Exception ( err ) + # Creation of the output net with the right size num_net = len ( cell._TAB_NETS_OUT ) cell._TAB_NETS_OUT += [Signal ( "net_out_%d" % num_net, self._arity )] @@ -365,9 +372,13 @@ class net : cell = CELLS[-1] - if not function : raise "\n[Stratus ERROR] / : to be done.\n" + if not function : + err = "\n[Stratus ERROR] / : to be done.\n" + raise Exception ( err ) - if not ( cell._st_vdds ) or not ( cell._st_vsss ) : raise "\n[Stratus ERROR] there is no alim in cell %s.\n" % str(cell._name) + if not ( cell._st_vdds ) or not ( cell._st_vsss ) : + err = "\n[Stratus ERROR] there is no alim in cell %s.\n" % str(cell._name) + raise Exception ( err ) # Creation of the output net with the right size num_net = len ( cell._TAB_NETS_OUT ) @@ -431,12 +442,12 @@ class net : cell = CELLS[-1] - if not inputNet._arity : raise "\n[Stratus ERROR] Shift : The input net does not have a positive arity.\n" - if not self._arity : raise "\n[Stratus ERROR] Shift : The command net does not have a positive arity.\n" - if not ( cell._st_vdds ) or not ( cell._st_vsss ) : raise "\n[Stratus ERROR] there is no alim.\n" + if not inputNet._arity : raise Exception ( "\n[Stratus ERROR] Shift : The input net does not have a positive arity.\n" ) + if not self._arity : raise Exception ( "\n[Stratus ERROR] Shift : The command net does not have a positive arity.\n" ) + if not ( cell._st_vdds ) or not ( cell._st_vsss ) : raise Exception ( "\n[Stratus ERROR] there is no alim.\n" ) # Wrong parameters : - if direction not in ( "left", "right" ) : raise "\n[Stratus ERROR] Shift : The direction parameter must be \"left\" or \"right\".\n" - if type not in ( "logical", "arith", "circular" ) : raise "\n[Stratus ERROR] Shift : The type parameter must be \"logical\" or \"arith\" or \"circular\".\n" + if direction not in ( "left", "right" ) : raise Exception ( "\n[Stratus ERROR] Shift : The direction parameter must be \"left\" or \"right\".\n" ) + if type not in ( "logical", "arith", "circular" ) : raise Exception ( "\n[Stratus ERROR] Shift : The type parameter must be \"logical\" or \"arith\" or \"circular\".\n" ) # Creation of the output net with the right size num_net = len ( cell._TAB_NETS_OUT ) @@ -479,9 +490,9 @@ class net : cell = CELLS[-1] - if not inputNet._arity : raise "\n[Stratus ERROR] Reg : The input net does not have a positive arity.\n" - if not self._arity : raise "\n[Stratus ERROR] Reg : The clock does not have a positive arity.\n" - if not ( cell._st_vdds ) or not ( cell._st_vsss ) : raise "\n[Stratus ERROR] there is no alim.\n" + if not inputNet._arity : raise Exception ( "\n[Stratus ERROR] Reg : The input net does not have a positive arity.\n" ) + if not self._arity : raise Exception ( "\n[Stratus ERROR] Reg : The clock does not have a positive arity.\n" ) + if not ( cell._st_vdds ) or not ( cell._st_vsss ) : raise Exception ( "\n[Stratus ERROR] there is no alim.\n" ) # Creation of the output net with the right size num_net = len ( cell._TAB_NETS_OUT ) @@ -525,7 +536,7 @@ class net : ### List ### if type ( nets ) == types.ListType : if len ( nets ) != ( maxPossibility + 1 ) : - raise "\n[Stratus ERROR] Mux : when using a list, all the nets must be precised. Maybe one should use a dictionnary.\n" + raise Exception ( "\n[Stratus ERROR] Mux : when using a list, all the nets must be precised. Maybe one should use a dictionnary.\n" ) return self.muxList ( nets ) @@ -551,10 +562,10 @@ class net : # Error : wrong interval if nb1 >= nb2 : - raise "\n[Stratus ERROR] Mux : when an interval is specified, the second number of the interval must be the greater one.\n" + raise Exception ( "\n[Stratus ERROR] Mux : when an interval is specified, the second number of the interval must be the greater one.\n" ) # Error : if the interval does not correspond to the lenght of the command if ( nb1 > maxPossibility ) or ( nb2 > maxPossibility ) : - raise "\n[Stratus ERROR] Mux : One key does not match with the arity of the input nets.\n" + raise Exception ( "\n[Stratus ERROR] Mux : One key does not match with the arity of the input nets.\n" ) for i in range ( nb1, nb2+1 ) : nets[i] = nets[net] @@ -566,7 +577,7 @@ class net : ############## elif chiffre : if int ( chiffre.group(0) ) > maxPossibility : - raise "\n[Stratus ERROR] Mux : One key does not match with the arity of the input nets.\n" + raise Exception ( "\n[Stratus ERROR] Mux : One key does not match with the arity of the input nets.\n" ) nets[int(chiffre.group(0))] = nets[net] @@ -583,13 +594,13 @@ class net : if len ( binaire ) != self._arity : err = "\n[Stratus ERROR] Mux : the binary number " + str(binaire) \ + " does not match with the lenght of the command. It has to be a " + str(self._arity) + "bits number.\n" - raise err + raise Exception ( err ) # Error : if the number is not binary for n in binaire : if n not in ( "0", "1", "?", "#" ) : err = "\n[Stratus ERROR] Mux : after #, the number has to be binary.\n" - raise err + raise Exception ( err ) nombrebit = self._arity @@ -619,7 +630,7 @@ class net : else : err = "\n[Stratus ERROR] Mux : wrong key.\n" - raise err + raise Exception ( err ) del nets[net] @@ -630,7 +641,7 @@ class net : if int ( chiffre ) > maxPossibility : err = "\n[Stratus ERROR] Mux : One key does not match with the arity of the input nets.\n" - raise err + raise Exception ( err ) nets[int(chiffre)] = nets[chiffre] del nets[chiffre] @@ -638,7 +649,7 @@ class net : else : if net != "default" : err = "\n[Stratus ERROR] Mux : wrong key.\n" - raise err + raise Exception ( err ) clefs = nets.keys () clefs.sort () @@ -674,7 +685,7 @@ class net : # Error : wrong argument else : err = "\n[Stratus ERROR] Mux : wrong argument type.\n" - raise err + raise Exception ( err ) ### List ### @@ -684,14 +695,14 @@ class net : cell = CELLS[-1] - if not ( cell._st_vdds ) or not ( cell._st_vsss ) : raise "\n[Stratus ERROR] : there is no alim.\n" + if not ( cell._st_vdds ) or not ( cell._st_vsss ) : raise Exception ( "\n[Stratus ERROR] : there is no alim.\n" ) long = 0 for i in range ( len ( nets ) ) : if nets[i] : long = nets[i]._arity # Error : if no input net - if not ( long ) : raise "\n[Stratus ERROR] Mux : there are no input nets.\n" + if not ( long ) : raise Exception ( "\n[Stratus ERROR] Mux : there are no input nets.\n" ) # Instanciation of a zero cell if needed for net in nets : @@ -747,7 +758,7 @@ class net : cell = CELLS[-1] - if not ( cell._st_vdds ) or not ( cell._st_vsss ) : raise "\n[Stratus ERROR] : threre is no alim.\n" + if not ( cell._st_vdds ) or not ( cell._st_vsss ) : raise Exception ( "\n[Stratus ERROR] : threre is no alim.\n" ) # Initialisation of the output net num_net = len ( cell._TAB_NETS_OUT ) @@ -780,7 +791,7 @@ class net : # Error : if the net already has an alias if net._alias : err = "\n[Stratus ERROR] Alias : the net " + net._name + " is already an alias.\n" - raise err + raise Exception ( err ) # Resizement of the net if needed if not ( net._arity ) : net.create_net ( net._name, self._arity ) @@ -788,7 +799,7 @@ class net : # Error : if the nets don't have the same lenght if self._arity != net._arity : err = "\n[Stratus ERROR] Alias : the nets " + self._name + " and " + net._name + " must have the same lenght\n" - raise err + raise Exception ( err ) # If nets are virtual, let's work with the corresponding real nets if net._real_net : realNet = net._real_net @@ -809,7 +820,7 @@ class net : # Alias of an alias else : err = "\n[Stratus ERROR] Alias : 2 Alias in a row are not supported.\n" - raise err + raise Exception ( err ) # FIXME bug : for now, Alias of Alias are not permitted # if realSelf._alias[i + self._ind - net._ind] : # netAlias = realSelf._alias[i + self._ind - net._ind].keys()[0] @@ -835,7 +846,7 @@ class net : if self._arity >= width : err = "\n[Stratus ERROR] Extend : the net " + self._name + \ " can not be extended to " + str(width) + " bits, it's arity is already " + str(self._arity) + ".\n" - raise err + raise Exception ( err ) num_net = len ( cell._TAB_NETS_OUT ) cell._TAB_NETS_OUT += [Signal ( "%s_ext_%d_%d" % ( self._name, width, num_net ), width )] @@ -870,7 +881,7 @@ class net : chaine = re.search ( "st_net\.(.*)", str ( self.__class__ ) ) classe = chaine.group(1) err = "\n[Stratus ERROR] " + classe + " : \"" + nom + "\" the name of the net can not contain a space.\n" - raise err + raise Exception ( err ) self._st_cell = cell self._name = nom @@ -887,7 +898,7 @@ class net : # Error : if ( nbit == 1 ) and indice : err = "\n[Stratus ERROR] " + str ( self.__class__ ) + " : " + self._name + " : one can not put an indice for a 1 bit net.\n" - raise err + raise Exception ( err ) if hType : self._h_type = hType @@ -957,7 +968,7 @@ class net : if self._to_cat : err = "\n[Stratus ERROR] HurricanePlug <= : net " + self._name + " is a Cat net. Forbidden utilisation of <= and Cat.\n" - raise err + raise Exception ( err ) for i in range ( self._ind, self._arity + self._ind ) : if realNet._to_merge[i] : @@ -971,16 +982,16 @@ class net : if realNet._hur_net == [] : err = "\n[Stratus ERROR] HurricanePlug <= : net " + realNet._name + " has no hurricane net.\n" - raise err + raise Exception ( err ) if bitToMerge > ( len ( selfToMerge._hur_net ) - 1 ) : err = "\n[Stratus ERROR] HurricanePlug <= : net " + selfToMerge._name + " with hur_net : " + str(selfToMerge._hur_net) \ + " with asked bit : " + str(bitToMerge) + ".\n" - raise err + raise Exception ( err ) if i > ( len ( realNet._hur_net ) - 1 ) : err = "\n[Stratus ERROR] HurricanePlug <= : net " + realNet._name + " with hur_net : " + str(realNet._hur_net) \ + " with asked bit : " + str(i) + ".\n" - raise err + raise Exception ( err ) selfToMerge._hur_net[bitToMerge].merge ( realNet._hur_net[i] ) # realNet._hur_net[i] = 0 @@ -1033,7 +1044,7 @@ class net : class SignalIn ( net ) : def __init__ ( self, nom, nbit, indice = 0 ) : - if nbit < 1 : raise "\n[Stratus ERROR] SignalIn : the lenght of the net must be a positive value\n" + if nbit < 1 : raise Exception ( "\n[Stratus ERROR] SignalIn : the lenght of the net must be a positive value\n" ) self.create_net ( nom, nbit, indice, True, "IN" ) @@ -1046,7 +1057,7 @@ class SignalInFromHur ( net ) : class SignalOut ( net ) : def __init__ ( self, nom, nbit, indice = 0 ) : - if nbit < 1 : raise "\n[Stratus ERROR] SignalOut : the lenght of the net must be a positive value\n" + if nbit < 1 : raise Exception ( "\n[Stratus ERROR] SignalOut : the lenght of the net must be a positive value\n" ) self.create_net ( nom, nbit, indice, True, "OUT" ) @@ -1059,7 +1070,7 @@ class SignalOutFromHur ( net ) : class SignalInOut ( net ) : def __init__ ( self, nom, nbit, indice = 0 ) : - if nbit < 1 : raise "\n[Stratus ERROR] SignalInOut : the lenght of the net must be a positive value\n" + if nbit < 1 : raise Exception ( "\n[Stratus ERROR] SignalInOut : the lenght of the net must be a positive value\n" ) self.create_net ( nom, nbit, indice, True, "INOUT" ) @@ -1072,7 +1083,7 @@ class SignalInOutFromHur ( net ) : class SignalUnknown ( net ) : def __init__ ( self, nom, nbit, indice = 0 ) : - if nbit < 1 : raise "\n[Stratus ERROR] SignalUnknown : the lenght of the net must be a positive value\n" + if nbit < 1 : raise Exception ( "\n[Stratus ERROR] SignalUnknown : the lenght of the net must be a positive value\n" ) self.create_net ( nom, nbit, indice, True, "UNKNOWN" ) @@ -1085,8 +1096,8 @@ class SignalUnknownFromHur ( net ) : class TriState ( net ) : def __init__ ( self, nom, nbit, indice = 0 ) : - if nbit < 1 : raise "\n[Stratus ERROR] TriState : the lenght of the net must be a positive value\n" - + if nbit < 1 : raise Exception ( "\n[Stratus ERROR] TriState : the lenght of the net must be a positive value\n" ) + self.create_net ( nom, nbit, indice, True, "TRISTATE" ) class SignalTriStateFromHur ( net ) : @@ -1108,7 +1119,7 @@ class CkInFromHur ( net ) : class Signal ( net ) : def __init__ ( self, nom, nbit = 0, indice = 0 ) : - if nbit < 0 : raise "\n[Stratus ERROR] Signal : the lenght of the net must be a positive value\n" + if nbit < 0 : raise Exception ( "\n[Stratus ERROR] Signal : the lenght of the net must be a positive value\n" ) self.create_net ( nom, nbit, indice ) diff --git a/stratus1/src/stratus/st_param.py b/stratus1/src/stratus/st_param.py index aee523ef..69f912f0 100644 --- a/stratus1/src/stratus/st_param.py +++ b/stratus1/src/stratus/st_param.py @@ -58,10 +58,10 @@ def Param ( *tokens ) : opts = getopt.getopt ( sys.argv[1:], argum % tokens )[0] except getopt.GetoptError : - raise "\n[Stratus ERROR] Param.\n" + raise Exception ( "\n[Stratus ERROR] Param.\n" ) if opts == [] : - raise "\n[Stratus ERROR] Param : there is no parameter.\n" + raise Exception ( "\n[Stratus ERROR] Param : there is no parameter.\n" ) n = [] for option, argument in opts : diff --git a/stratus1/src/stratus/st_placeAndRoute.py b/stratus1/src/stratus/st_placeAndRoute.py index 3810908f..c471aad4 100644 --- a/stratus1/src/stratus/st_placeAndRoute.py +++ b/stratus1/src/stratus/st_placeAndRoute.py @@ -194,9 +194,9 @@ def PadNorth ( *args ) : hur_args = [] for arg in args : if not arg : - raise "\n[Stratus ERROR] PadNorth : one instance doesn't exist.\n" + raise Exception ( "\n[Stratus ERROR] PadNorth : one instance doesn't exist.\n" ) if str ( arg.__class__ ) != "st_instance.Inst" : - raise "\n[Stratus ERROR] PadNorth : one argument is not an instance.\n" + raise Exception ( "\n[Stratus ERROR] PadNorth : one argument is not an instance.\n" ) hur_args.append ( arg._hur_instance ) @@ -216,9 +216,9 @@ def PadSouth ( *args ) : hur_args = [] for arg in args : if not arg : - raise "\n[Stratus ERROR] PadSouth : one instance doesn't exist.\n" + raise Exception ( "\n[Stratus ERROR] PadSouth : one instance doesn't exist.\n" ) if str ( arg.__class__ ) != "st_instance.Inst" : - raise "\n[Stratus ERROR] PadSouth : one argument is not an instance.\n" + raise Exception ( "\n[Stratus ERROR] PadSouth : one argument is not an instance.\n" ) hur_args.append ( arg._hur_instance ) @@ -238,9 +238,9 @@ def PadEast ( *args ) : hur_args = [] for arg in args : if not arg : - raise "\n[Stratus ERROR] PadEast : one instance doesn't exist.\n" + raise Exception ( "\n[Stratus ERROR] PadEast : one instance doesn't exist.\n" ) if str ( arg.__class__ ) != "st_instance.Inst" : - raise "\n[Stratus ERROR] PadEast : one argument is not an instance.\n" + raise Exception ( "\n[Stratus ERROR] PadEast : one argument is not an instance.\n" ) hur_args.append ( arg._hur_instance ) @@ -260,9 +260,9 @@ def PadWest ( *args ) : hur_args = [] for arg in args : if not arg : - raise "\n[Stratus ERROR] PadWest : one instance doesn't exist.\n" + raise Exception ( "\n[Stratus ERROR] PadWest : one instance doesn't exist.\n" ) if str ( arg.__class__ ) != "st_instance.Inst" : - raise "\n[Stratus ERROR] PadWest : one argument is not an instance.\n" + raise Exception ( "\n[Stratus ERROR] PadWest : one argument is not an instance.\n" ) hur_args.append ( arg._hur_instance ) @@ -277,7 +277,7 @@ def PowerRing ( n ) : cell = CELLS[-1] - if n < 3 : raise "\n[Stratus ERROR] : PowerRing : must have at least 3 pairs of vdd/vss rings\n" + if n < 3 : raise Exception ( "\n[Stratus ERROR] : PowerRing : must have at least 3 pairs of vdd/vss rings\n" ) hur_core = cell.getCore() @@ -300,7 +300,7 @@ class ClockBuffer : 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 err + raise Exception ( err ) inst = Instance ( self.cell._hur_cell, "ck_buffer%d"%nbCkBuf, modelMasterCell ) nbCkBuf += 1 @@ -322,7 +322,7 @@ class ClockBuffer : net = self.cell._hur_cell.getNet ( netname ) if not net : err = "AddFF Error net : " + netname + " not found" - raise err + raise Exception ( err ) instDrive = None for plug in net.getPlugs(): @@ -332,13 +332,13 @@ class ClockBuffer : if instDrive == None : err = "AddFF Error no drive instance found for net " + netname + ".\n" - raise err + 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 err + raise Exception ( err ) instDrive.getPlug ( netCk ).setNet ( self.ck_b._hur_net[0] ) diff --git a/stratus1/src/stratus/st_placement.py b/stratus1/src/stratus/st_placement.py index 94fcc788..e7aef1bc 100644 --- a/stratus1/src/stratus/st_placement.py +++ b/stratus1/src/stratus/st_placement.py @@ -59,18 +59,18 @@ def Place ( ins, sym, ref, plac = FIXED, cell = None ) : # Error if x and y found not permitted : if ref._x % MYPITCH : err = "\n[Stratus ERROR] Place : " + ins._name + " : coordinate x is not a mutiple of PITCH.\n" - raise err + raise Exception ( err ) if ref._y % MYSLICE : err = "\n[Stratus ERROR] Place : " + ins._name + " : coordinate y is not a mutiple of SLICE.\n" - raise err + raise Exception ( err ) # Error message : if ref is not a reference if str ( ref.__class__ ) != "st_ref.XY" : - raise "\n[Stratus ERROR] Place : wrong argument for placement, the coordinates must be put in a XY object.\n" + raise Exception ( "\n[Stratus ERROR] Place : wrong argument for placement, the coordinates must be put in a XY object.\n" ) # Error message if plac is not one of the permitted values - if ( plac != PLACED ) and ( plac != FIXED ) : raise "\n[Stratus ERROR] Place : wrong argument for placement type.\n" + if ( plac != PLACED ) and ( plac != FIXED ) : raise Exception ( "\n[Stratus ERROR] Place : wrong argument for placement type.\n" ) #placement ( ins, sym, getUnit(ref._x), getUnit(ref._y), plac, cell = cell ) placement ( ins, sym, DbU_lambda(ref._x), DbU_lambda(ref._y), plac, cell = cell ) @@ -86,19 +86,19 @@ def PlaceTop ( ins, symetry, offsetX = 0, offsetY = 0, plac = FIXED ) : if offsetX % MYPITCH : err = "\n[Stratus ERROR] PlaceTop : " + ins._name + " : offsetX is not a mutiple of PITCH.\n" - raise err + raise Exception ( err ) if offsetY % MYSLICE : err = "\n[Stratus ERROR] PlaceTop : " + ins._name + " : offsetY is not a mutiple of SLICE.\n" - raise err + raise Exception ( err ) if ( plac != PLACED ) and ( plac != FIXED ) : err = "\n[Stratus ERROR] PlaceTop : " + ins._name + " : wrong argument for placement type.\n" - raise err + raise Exception ( err ) if cell._insref == None : err = "\n[Stratus ERROR] PlaceTop : " + ins._name + " : no previous instance.\n" - raise err + raise Exception ( err ) x = cell._insref._x y = cell._insref._y @@ -124,19 +124,19 @@ def PlaceRight ( ins, symetry, offsetX = 0, offsetY = 0, plac = FIXED ) : if offsetX % MYPITCH : err = "\n[Stratus ERROR] PlaceRight : " + ins._name + " : offsetX is not a mutiple of PITCH.\n" - raise err + raise Exception ( err ) if offsetY % MYSLICE : err = "\n[Stratus ERROR] PlaceRight : " + ins._name + " : offsetY is not a mutiple of SLICE.\n" - raise err + raise Exception ( err ) if ( plac != PLACED ) and ( plac != FIXED ) : err = "\n[Stratus ERROR] PlaceRight : " + ins._name + " : wrong argument for placement type.\n" - raise err + raise Exception ( err ) if cell._insref == None : err = "\n[Stratus ERROR] PlaceRight : " + ins._name + " : no previous instance.\n" - raise err + raise Exception ( err ) x = cell._insref._x y = cell._insref._y @@ -162,19 +162,19 @@ def PlaceLeft ( ins, symetry, offsetX = 0, offsetY = 0, plac = FIXED ) : if offsetX % MYPITCH : err = "\n[Stratus ERROR] PlaceLeft : " + ins._name + " : offsetX is not a mutiple of PITCH.\n" - raise err + raise Exception ( err ) if offsetY % MYSLICE : err = "\n[Stratus ERROR] PlaceLeft : " + ins._name + " : offsetY is not a mutiple of SLICE.\n" - raise err + raise Exception ( err ) if ( plac != PLACED ) and ( plac != FIXED ) : err = "\n[Stratus ERROR] PlaceLeft : " + ins._name + " : wrong argument for placement type.\n" - raise err + raise Exception ( err ) if cell._insref == None : err = "\n[Stratus ERROR] PlaceLeft : " + ins._name + " : no previous instance.\n" - raise err + raise Exception ( err ) x = cell._insref._x y = cell._insref._y @@ -202,19 +202,19 @@ def PlaceBottom ( ins, symetry, offsetX = 0, offsetY = 0, plac = FIXED ) : if offsetX % MYPITCH : err = "\n[Stratus ERROR] PlaceBottom : " + ins._name + " : offsetX is not a mutiple of PITCH.\n" - raise err + raise Exception ( err ) if offsetY % MYSLICE : err = "\n[Stratus ERROR] PlaceBottom : " + ins._name + " : offsetY is not a mutiple of SLICE.\n" - raise err + raise Exception ( err ) if ( plac != PLACED ) and ( plac != FIXED ) : err = "\n[Stratus ERROR] PlaceBottom : " + ins._name + " : wrong argument for placement type.\n" - raise err + raise Exception ( err ) if cell._insref == None : err = "\n[Stratus ERROR] PlaceBottom : " + ins._name + " : no previous instance.\n" - raise err + raise Exception ( err ) x = cell._insref._x y = cell._insref._y @@ -241,12 +241,12 @@ def SetRefIns ( ins ) : cell = CELLS[-1] # Error : SetRefIns on a non existing instance - if not ins : raise "\n[Stratus ERROR] SetRefIns : the instance doesn't exist.\n" + if not ins : raise Exception ( "\n[Stratus ERROR] SetRefIns : the instance doesn't exist.\n" ) # Error : SetRefIns on a non placed instance if ins._plac == UNPLACED : err = "\n[Stratus ERROR] SetRefIns : the instance " + ins._name + " is not placed.\n" - raise err + raise Exception ( err ) cell._insref = ins @@ -264,7 +264,7 @@ def DefAb ( ref1, ref2 ) : # Error message : if ref are not references if ( str ( ref1.__class__ ) != "st_ref.XY" ) or ( str ( ref2.__class__ ) != "st_ref.XY" ) : err = "\n[Stratus ERROR] DefAb : wrong argument, the coordinates must be put in a XY object.\n" - raise err + raise Exception ( err ) x1 = ref1._x y1 = ref1._y @@ -274,12 +274,12 @@ def DefAb ( ref1, ref2 ) : if not cell._hur_cell : err = "\n[Stratus ERROR] Layout : The hurricane cell has not been created.\n" \ + "One has to use HurricanePlug before creating the layout.\n" - raise err + raise Exception ( err ) if x1 % MYPITCH or y1 % MYSLICE or x2 % MYPITCH or y2 % MYSLICE : err = "\nError in DefAb : Coordinates of an abutment Box in y must be multiple of the slice.\n" \ + " : Coordinates of an abutment Box in x must be multiple of the pitch.\n" - raise err + raise Exception ( err ) boite = cell._hur_cell.getAbutmentBox () @@ -287,7 +287,7 @@ def DefAb ( ref1, ref2 ) : err = "\n[Stratus ERROR] DefAb : an abutment box already exists for cell : " \ + str ( cell._name ) \ + ". Maybe you should use ResizeAb function.\n" - raise err + raise Exception ( err ) cell._hur_cell.setAbutmentBox ( Box ( DbU_lambda ( x1 ) , DbU_lambda ( y1 ) @@ -315,7 +315,7 @@ def ResizeAb ( dx1, dy1, dx2, dy2 ) : if dx1 % MYPITCH or dy1 % MYSLICE or dx2 % MYPITCH or dy2 % MYSLICE : err = "\n[Stratus ERROR] ResizeAb : Coordinates of an abutment Box in y must be multiple of the slice.\n" \ + " : Coordinates of an abutment Box in x must be multiple of the pitch.\n" - raise err + raise Exception ( err ) old_xmin = ab.getXMin() old_xmax = ab.getXMax() @@ -329,11 +329,11 @@ def ResizeAb ( dx1, dy1, dx2, dy2 ) : if new_xmin >= new_xmax : err = "\n[Stratus ERROR] ResizeAb : one of the values of dx1 or dx2 is incompatible with the size of the abutment box.\n" - raise err + raise Exception ( err ) if new_ymin >= new_ymax : err = "\n[Stratus ERROR] ResizeAb : one of the values of dy1 or dy2 is incompatible with the size of the abutment box.\n" - raise err + raise Exception ( err ) hurCell.setAbutmentBox ( Box ( new_xmin, new_ymin, new_xmax, new_ymax ) ) @@ -348,12 +348,12 @@ def DefInstanceAb ( instance, x1, y1, x2, y2 ) : if not ( boite.isEmpty() ) : err = "\n[Stratus ERROR] DefInstanceAb : an abutment box already exists. Maybe you should use ResizeAb function.\n" - raise err + raise Exception ( err ) if x1 % MYPITCH or y1 % MYSLICE or x2 % MYPITCH or y2 % MYSLICE : err = "\nError in DefAb : Coordinates of an abutment Box in y must be multiple of the slice.\n" \ + " : Coordinates of an abutment Box in x must be multiple of the pitch.\n" - raise err + raise Exception ( err ) cell.setAbutmentBox ( Box ( DbU_lambda ( x1 ) , DbU_lambda ( y1 ) @@ -373,12 +373,12 @@ def placement ( st_inst, sym, x, y, plac = FIXED, cell = None, fonction = None ) if not cell : cell = CELLS[-1] # Error : placement of a non existing instance - if not st_inst : raise "\n[Stratus ERROR] Placement : the instance doesn't exist.\n" + if not st_inst : raise Exception ( "\n[Stratus ERROR] Placement : the instance doesn't exist.\n" ) # Error : st_inst is not an instance if str ( st_inst.__class__ ) != "st_instance.Inst" : err = "\n\n[Stratus ERROR] Placement : the first argument " + st_inst + " is not an instance.\n" - raise err + raise Exception ( err ) # Hurricane instance hur_inst = st_inst._hur_instance @@ -387,12 +387,12 @@ def placement ( st_inst, sym, x, y, plac = FIXED, cell = None, fonction = None ) if not hur_inst : err = "\n[Stratus ERROR] Layout : The hurricane instance of " + st_inst._name + " has not been created.\n" \ + "One has to use HurricanePlug before creating the layout.\n" - raise err + raise Exception ( err ) # Error : if the instance is already placed if hur_inst.getPlacementStatus() == PlacementStatusFIXED : err = "\n[Stratus ERROR] Placement : the instance " + st_inst._name + " is already placed.\n" - raise err + raise Exception ( err ) ##### Legalization of the symetry ##### st_inst._sym = transformation ( sym ) @@ -454,7 +454,7 @@ def placement ( st_inst, sym, x, y, plac = FIXED, cell = None, fonction = None ) st_inst._y = y + abtemp.getWidth () else : - raise "\n[Stratus ERROR] Placement : wrong transformation.\n" + raise Exception ( "\n[Stratus ERROR] Placement : wrong transformation.\n" ) # if the abutment box is not at 0 0 FIXME if st_inst._sym == OrientationMY : @@ -477,7 +477,7 @@ def placement ( st_inst, sym, x, y, plac = FIXED, cell = None, fonction = None ) elif plac == UNPLACED : hur_inst.setPlacementStatus ( PlacementStatusUNPLACED ) else : - raise "\n[Stratus ERROR] Placement : wrong argument for type of placement.\n" + raise Exception ( "\n[Stratus ERROR] Placement : wrong argument for type of placement.\n" ) st_inst._plac = plac @@ -496,7 +496,7 @@ def transformation ( symetry ) : elif symetry == SY_RM or symetry == OrientationXR : transf = OrientationXR else : err = "\n[Stratus ERROR] Placement :Illegal transformation.\n" - raise err + raise Exception ( err ) return transf diff --git a/stratus1/src/stratus/st_ref.py b/stratus1/src/stratus/st_ref.py index 95ab704e..e3c2e9ec 100644 --- a/stratus1/src/stratus/st_ref.py +++ b/stratus1/src/stratus/st_ref.py @@ -72,11 +72,11 @@ def GetRefXY ( pathname, refname ) : # Check arguments type if type ( pathname ) != types.StringType : err = "\n[Stratus ERROR] GetRefXY : The instance's path must be put with a string.\n" - raise err + raise Exception ( err ) if type ( refname ) != types.StringType : err = "\n[Stratus ERROR] GetRefXY : The reference must be done with it's name : a string.\n" - raise err + raise Exception ( err ) ( x, y ) = pyGetXY ( cell._hur_cell, pathname, refname ) @@ -92,11 +92,11 @@ def PlaceRef ( ref, name ) : # Check arguments type if ( str ( ref.__class__ ) != "st_ref.XY" ) : err = "\n[Stratus ERROR] PlaceRef : Wrong argument, the coordinates of the reference must be put in a XY object.\n" - raise err + raise Exception ( err ) if type ( name ) != types.StringType : err = "\n[Stratus ERROR] PlaceRef : Argument layer must be a string.\n" - raise err + raise Exception ( err ) pyPlaceRef ( cell._hur_cell, name, ref._x, ref._y ) @@ -108,7 +108,7 @@ def PlaceContact ( net, layer, ref, width, height ) : # Check arguments type if type ( layer ) != types.StringType : err = "\n[Stratus ERROR] PlaceContact : Argument layer must be a string.\n" - raise err + raise Exception ( err ) myLayer = getDataBase().getTechnology().getLayer ( layer ) # if not ( myLayer ) : # err = "\n[Stratus ERROR] PlaceContact : Argument layer does not exist.\n" @@ -116,11 +116,11 @@ def PlaceContact ( net, layer, ref, width, height ) : if ( str ( ref.__class__ ) != "st_ref.XY" ) : err = "\n[Stratus ERROR] PlaceContact : Wrong argument, the coordinates of the contact must be put in a XY object.\n" - raise err + raise Exception ( err ) if ( net._arity > 1 ) : err = "\n[Stratus ERROR] PlaceContact : Wrong argument, the net must be a 1 bit net.\n" - raise err + raise Exception ( err ) if net._real_net : indice = net._ind - net._real_net._ind @@ -138,12 +138,12 @@ def PlacePin ( net, layer, direction, ref, width, height ) : # Check arguments type if type ( layer ) != types.StringType : err = "\n[Stratus ERROR] PlacePin : Argument layer must be a string.\n" - raise err + raise Exception ( err ) # No CALU permitted for Pin calu = re.search ( "CALU", layer ) if calu : err = "\n[Stratus ERROR] PlacePin : Illegal layer, CALU not allowed.\n" - raise err + raise Exception ( err ) myLayer = getDataBase().getTechnology().getLayer ( layer ) # if not ( myLayer ) : # err = "\n[Stratus ERROR] PlacePin : Argument layer does not exist.\n" @@ -156,15 +156,15 @@ def PlacePin ( net, layer, direction, ref, width, height ) : elif direction == WEST : direct = PinAccessDirectionWEST else : err = "\n[Stratus ERROR] PlacePin : Illegal pin access direction. The values are : UNDEFINED, NORTH, SOUTH, EAST, WEST.\n" - raise err + raise Exception ( err ) if ( str ( ref.__class__ ) != "st_ref.XY" ) : err = "\n[Stratus ERROR] PlacePin : Wrong argument, the coordinates of the pin must be put in a XY object.\n" - raise err + raise Exception ( err ) if ( net._arity > 1 ) : err = "\n[Stratus ERROR] PlacePin : Wrong argument, the net must be a 1 bit net.\n" - raise err + raise Exception ( err ) if net._real_net : indice = net._ind - net._real_net._ind @@ -174,7 +174,7 @@ def PlacePin ( net, layer, direction, ref, width, height ) : if ( net._ext == False ) : err = "\n[Stratus ERROR] PlacePin : Wrong argument, the net must be external.\n" - raise err + raise Exception ( err ) pyPlacePin ( net._hur_net[indice], direct, PinPlacementStatusFIXED, myLayer, ref._x, ref._y, width, height ) @@ -186,19 +186,19 @@ def PlaceSegment ( net, layer, ref1, ref2, width ) : # Check arguments type if type ( layer ) != types.StringType : err = "\n[Stratus ERROR] PlaceSegment : Argument layer must be a string.\n" - raise err + raise Exception ( err ) if ( str ( ref1.__class__ ) != "st_ref.XY" ) or ( str ( ref2.__class__ ) != "st_ref.XY" ) : err = "\n[Stratus ERROR] PlaceSegment : Wrong argument, the coordinates of the segment must be put in XY objects.\n" - raise err + raise Exception ( err ) if ( ref1._x != ref2._x ) and ( ref1._y != ref2._y ) : err = "\n[Stratus ERROR] PlaceSegment : Segments are vertical or horizontal.\n" - raise err + raise Exception ( err ) if ( net._arity > 1 ) : err = "\n[Stratus ERROR] PlaceSegment : Wrong argument, the net must be a 1 bit net.\n" - raise err + raise Exception ( err ) if net._real_net : indice = net._ind - net._real_net._ind @@ -223,15 +223,15 @@ def CopyUpSegment ( pathname, netname, newnet ) : # Check arguments type if type ( pathname ) != types.StringType : err = "\n[Stratus ERROR] CopyUpSegment : The instance's path must be put with a string.\n" - raise err + raise Exception ( err ) if type ( netname ) != types.StringType : err = "\n[Stratus ERROR] CopyUpSegment : The segment must be done with it's name : a string.\n" - raise err + raise Exception ( err ) if ( newnet._arity > 1 ) : err = "\n[Stratus ERROR] PlacePin : Wrong argument, the net must be a 1 bit net.\n" - raise err + raise Exception ( err ) if newnet._real_net : indice = newnet._ind - newnet._real_net._ind diff --git a/stratus1/src/stratus/st_shifter.py b/stratus1/src/stratus/st_shifter.py index f5b3f384..f77984fd 100644 --- a/stratus1/src/stratus/st_shifter.py +++ b/stratus1/src/stratus/st_shifter.py @@ -74,9 +74,9 @@ def getConfig ( type ) : or (config['type']['arith'] and config['type']['rot'])) if not (config['dir']['left'] or config['dir']['right']): - raise 'any of left or right directions are set' + raise Exception ( 'any of left or right directions are set' ) if not (config['type']['log'] or config['type']['arith'] or config['type']['rot']) : - raise 'any of log or arith or rot types are set' + raise Exception ( 'any of log or arith or rot types are set' ) return config @@ -89,7 +89,7 @@ class Shifter ( Model ) : self.nbit = param['nbit'] - if self.nbit < 2: raise "\n[Stratus ERROR] Shift : input arity should be greater than 1.\n" + if self.nbit < 2: raise Exception ( "\n[Stratus ERROR] Shift : input arity should be greater than 1.\n" ) self.config = getConfig(param['type']) diff --git a/stratus1/src/stratus/st_slansky.py b/stratus1/src/stratus/st_slansky.py index 1d42a4df..e0e4dbdc 100644 --- a/stratus1/src/stratus/st_slansky.py +++ b/stratus1/src/stratus/st_slansky.py @@ -69,7 +69,7 @@ class Sub ( Model ) : if 'extended' not in param : self._extended = False else : self._extended = param['extended'] - if (self.nbit < 2): raise "\n[Stratus ERROR] slansky : input arity should be greater than 1.\n" + if (self.nbit < 2): raise Exception ( "\n[Stratus ERROR] slansky : input arity should be greater than 1.\n" ) def Interface(self): self.i0 = SignalIn("i0", self.nbit0) @@ -135,7 +135,7 @@ class Slansky ( Model ) : if 'cin' not in param : self._cin = False else : self._cin = param['cin'] - if (self.nbit < 2): raise "\n[Stratus ERROR] slansky : input arity should be greater than 1.\n" + if (self.nbit < 2): raise Exception ( "\n[Stratus ERROR] slansky : input arity should be greater than 1.\n" ) def Interface(self): self.i0 = SignalIn("i0", self.nbit0) @@ -244,7 +244,7 @@ class PiGiBus(Model): Model.__init__(self, name, param) self.nbit = param['nbit'] if self.nbit < 1: - raise 'PiGiBus : input arity should be greater than 0' + raise Exception ( 'PiGiBus : input arity should be greater than 0' ) def Interface(self): self.a = SignalIn("a",self.nbit) @@ -315,10 +315,10 @@ class PGTree(Model): Model.__init__(self, name, param) self.nbit = param['nbit'] if self.nbit < 1: - raise 'input arity should be greater than 0' + raise Exception ( 'input arity should be greater than 0' ) self.algo = param['algo'] if self.algo != 'slansky': - raise '%s algorithm is not yet implemented' %self.algo + raise Exception ( '%s algorithm is not yet implemented' %self.algo ) def Interface(self): self.pi = SignalIn("pi",self.nbit) @@ -406,4 +406,4 @@ def prefixMatrix(algo,size): matrix[i].append(0) return matrix else: - raise '%s algorithm is not yet implemented' %algo + raise Exception ( '%s algorithm is not yet implemented' %algo ) diff --git a/stratus1/src/stratus/util_Const.py b/stratus1/src/stratus/util_Const.py index 8ad527ad..8c9ce953 100644 --- a/stratus1/src/stratus/util_Const.py +++ b/stratus1/src/stratus/util_Const.py @@ -65,7 +65,7 @@ def btol ( aDigit ) : elif aDigit == '1' : digit = 1 else : err = "\n[Stratus ERROR] : Invalid digit \'%c\' in boolean string \"%s\"\n" % ( aDigit, LV_const ) - raise err + raise Exception ( err ) return digit @@ -82,7 +82,7 @@ def otol ( aDigit ) : if digit < 0 : err = "\n[Stratus ERROR] : Invalid digit \'%c\' in octal string \"%s\".\n" % ( aDigit, LV_const ) - raise err + raise Exception ( err ) return digit @@ -105,7 +105,7 @@ def xtol ( aDigit ) : if digit < 0 : err = "\n[Stratus ERROR] : Invalid digit \'%c\' in hexadecimal string \"%s\".\n" % ( aDigit, LV_const ) - raise err + raise Exception ( err ) return digit @@ -126,7 +126,7 @@ def ltox ( aDigit ) : if digit == '\0' : err = "\n[Stratus ERROR] : Invalid number %d in hexadecimal conversion.\n" % aDigit - raise err + raise Exception ( err ) return digit @@ -151,7 +151,7 @@ class newxl : LV_const = asConst - if type ( asConst ) != types.StringType : raise "\n[Stratus ERROR] : the constant must be described in a string.\n" + if type ( asConst ) != types.StringType : raise Exception ( "\n[Stratus ERROR] : the constant must be described in a string.\n" ) base = 1 offset = 2 @@ -162,10 +162,10 @@ class newxl : elif asConst[1] == 'o' or asConst[1] == 'O' : base = 3 else : err = "\n[Stratus ERROR] : one has to specify the basis of the constant : 0b or 0x or 0o.\n" - raise err + raise Exception ( err ) else : err = "\n[Stratus ERROR] : one has to specify the basis of the constant : 0b or 0x or 0o.\n" - raise err + raise Exception ( err ) length = len ( asConst ) @@ -234,7 +234,7 @@ class newxl : if i >= XLONG_SIZE : err = "\n[Stratus ERROR] : Requested bit", aBit, "is out of range\n" - raise err + raise Exception ( err ) if self._l[i] & mask : return 1L else : return 0L @@ -249,7 +249,7 @@ class newxl : if i >= XLONG_SIZE : err = "\n[Stratus ERROR] : Requested hexa %ld is out of range.\n" % aBit - raise err + raise Exception ( err ) return ( ( self._l[i] ) >> shift ) & 15