From eb4ce01056f92ba971e929d57db047fc5e280a9a Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Fri, 26 Feb 2010 18:14:48 -0800 Subject: [PATCH] isa_parser: simple fixes, formatting and style --- src/arch/isa_parser.py | 64 +++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 35 deletions(-) diff --git a/src/arch/isa_parser.py b/src/arch/isa_parser.py index bd45a8313..42f51d806 100755 --- a/src/arch/isa_parser.py +++ b/src/arch/isa_parser.py @@ -321,11 +321,11 @@ StaticInstPtr def p_def_operand_types(self, t): 'def_operand_types : DEF OPERAND_TYPES CODELIT SEMI' try: - userDict = eval('{' + t[3] + '}') + user_dict = eval('{' + t[3] + '}') except Exception, exc: error(t.lexer.lineno, 'error: %s in def operand_types block "%s".' % (exc, t[3])) - buildOperandTypeMap(userDict, t.lexer.lineno) + buildOperandTypeMap(user_dict, t.lexer.lineno) t[0] = GenCode() # contributes nothing to the output C++ file # Define the mapping from operand names to operand classes and @@ -336,11 +336,11 @@ StaticInstPtr error(t.lexer.lineno, 'error: operand types must be defined before operands') try: - userDict = eval('{' + t[3] + '}', exportContext) + user_dict = eval('{' + t[3] + '}', exportContext) except Exception, exc: error(t.lexer.lineno, 'error: %s in def operands block "%s".' % (exc, t[3])) - buildOperandNameMap(userDict, t.lexer.lineno) + buildOperandNameMap(user_dict, t.lexer.lineno) t[0] = GenCode() # contributes nothing to the output C++ file # A bitfield definition looks like: @@ -787,7 +787,7 @@ def protect_non_subst_percents(s): # has_decode_default attribute is used in the decode block to allow # explicit default clauses to override default default clauses. -class GenCode: +class GenCode(object): # Constructor. At this point we substitute out all CPU-specific # symbols. For the exec output, these go into the per-model # dictionary. For all other output types they get collapsed into @@ -852,7 +852,7 @@ def exportDict(*symNames): return dict([(s, eval(s)) for s in symNames]) -class Format: +class Format(object): def __init__(self, id, params, code): # constructor: just save away arguments self.id = id @@ -889,7 +889,7 @@ class Format: # Special null format to catch an implicit-format instruction # definition outside of any format block. -class NoFormat: +class NoFormat(object): def __init__(self): self.defaultInst = '' @@ -1040,7 +1040,7 @@ def substBitOps(code): labelRE = re.compile(r'(?setNextNPC(%s);\n' % self.base_name -def buildOperandNameMap(userDict, lineno): +def buildOperandNameMap(user_dict, lineno): global operandNameMap operandNameMap = {} - for (op_name, val) in userDict.iteritems(): + for (op_name, val) in user_dict.iteritems(): (base_cls_name, dflt_ext, reg_spec, flags, sort_pri) = val[:5] if len(val) > 5: read_code = val[5] @@ -1598,7 +1594,7 @@ def buildOperandNameMap(userDict, lineno): operandNameMap[op_name] = type(cls_name, (base_cls,), tmp_dict) # Define operand variables. - operands = userDict.keys() + operands = user_dict.keys() operandsREString = (r''' (?