Exemple #1
0
 def enterWrite_config_call(self,
                            ctx: ConfigParser.Write_config_callContext):
     #print('enterWrite_config_call: ')
     writeType = ctx.getChild(0).getText()
     writePath = ctx.path().getText()
     writeVal = ctx.value().getText()
     #print(' ' + writeType + ' ' + writePath + ' ' + writeVal)
     isRmw = True if writeType == 'rmwField' else False
     Cm.CfgWriteNode(writePath, writeVal, writeType, isRmw, None)
 def pyF1GetWrite(assignNd):
     ''' extract a reg write from Assign node - adds node to model, tags ast node as valid, and returns True on match '''
     if type(assignNd) is not ast.Assign:
         return False
     # extract assign targets and paths
     #paths = [__class__.getSourceString(i) for i in assignNd.targets]  # convert each target to a string
     if len(assignNd.targets) != 1:  # only 1 lhs allowed per assign
         return False
     path = __class__.pyF1ToCfgData(assignNd.targets[0])
     #print('found write path=' + targ_path)
     value = __class__.getSourceString(assignNd.value)
     if type(path) is Cm.CfgPathDataType:
         Cm.CfgWriteNode(path, value, assignNd)
         assignNd.__cfg_valid__ = True  # tag this ast node as translated
         return True
     return False