diff --git a/EUsched.py b/EUsched.py index bd3d4d4..f9faa20 100755 --- a/EUsched.py +++ b/EUsched.py @@ -299,7 +299,7 @@ class Scheduler(object): elif(isinstance(instrForm[i], MemAddr)): optmp = 'mem' else: - optmp = instrForm[i].print().lower() + optmp = str(instrForm[i]).lower() opExt.append(optmp) operands = '_'.join(opExt) return operands diff --git a/Params.py b/Params.py index dc5f306..13f8551 100755 --- a/Params.py +++ b/Params.py @@ -6,15 +6,8 @@ class Parameter(object): if(self.ptype not in self.type_list): raise NameError("Type not supported: "+ptype) - def print(self): - ''' - Prints Parameter. - - Returns - ------- - str - Parameter as string - ''' + def __str__(self): + '''returns string representation''' if(self.ptype == "NONE"): return "" else: @@ -51,15 +44,8 @@ class MemAddr(Parameter): else: raise NameError("Type not supported: "+name) - def print(self): - ''' - Prints MemAddr. - - Returns - ------- - str - MemAddr as string - ''' + def __str__(self): + '''returns string representation''' mem_format = "MEM(" if(self.sreg): mem_format += "sreg:" @@ -115,15 +101,8 @@ class Register(Parameter): # except KeyError: # print(lncnt) - def print(self): - ''' - Prints Register. - - Returns - ------- - str - Register as string - ''' + def __str__(self): + '''returns string representation''' opmask = "" if(self.mask): opmask = "{opmask}" diff --git a/Testcase.py b/Testcase.py index e1bd566..f3276e3 100755 --- a/Testcase.py +++ b/Testcase.py @@ -121,7 +121,7 @@ class Testcase(object): op_a = oprnds[0].reg_type.lower() elif(isinstance(oprnds[0], MemAddr)): op_a = 'mem' - elif(isinstance(oprnds[0], Parameter) and oprnds[0].print() == 'IMD'): + elif(isinstance(oprnds[0], Parameter) and str(oprnds[0]) == 'IMD'): op_a = 'imd' if(op_a == 'gpr'): gprPush, gprPop, zeroGPR = self.__initialise_gprs() @@ -131,7 +131,7 @@ class Testcase(object): op_b = oprnds[1].reg_type.lower() elif(isinstance(oprnds[1], MemAddr)): op_b = 'mem' - elif(isinstance(oprnds[1], Parameter) and oprnds[1].print() == 'IMD'): + elif(isinstance(oprnds[1], Parameter) and str(oprnds[1]) == 'IMD'): op_b = 'imd' if(op_b == 'gpr'): op_b += str(oprnds[1].size) @@ -142,7 +142,7 @@ class Testcase(object): op_c = oprnds[2].reg_type.lower() elif(isinstance(oprnds[2], MemAddr)): op_c = 'mem' - elif(isinstance(oprnds[2], Parameter) and oprnds[2].print() == 'IMD'): + elif(isinstance(oprnds[2], Parameter) and str(oprnds[2]) == 'IMD'): op_c = 'imd' if(op_c == 'gpr'): op_c += str(oprnds[2].size) diff --git a/create_testcase.py b/create_testcase.py index fe64f4f..9779e6f 100755 --- a/create_testcase.py +++ b/create_testcase.py @@ -34,7 +34,7 @@ per_loop = '100' # Start operands = [x for x in [dst, op1, op2] if x is not None] -opListStr = ', '.join([x.print() for x in operands]) +opListStr = ', '.join([str(x) for x in operands]) print('Create Testcase for {} {}'.format(mnemonic, opListStr ), end='') tc = Testcase(mnemonic, operands, per_loop) tc.write_testcase() diff --git a/get_instr.py b/get_instr.py index b85d6a4..8894c61 100755 --- a/get_instr.py +++ b/get_instr.py @@ -114,7 +114,7 @@ def check_instr(instr): op = Parameter("LBL") else: op = MemAddr(op) - param_list[i] = op.print() + param_list[i] = str(op) opList[i] = op #Join mnemonic and operand(s) to an instruction form if(len(mnemonic) > 7): @@ -145,7 +145,7 @@ def check_instr(instr): #Only create benchmark if no label (LBL) is part of the operands do_bench = True for par in opList: - if(par.print() == 'LBL'): + if(str(par) == 'LBL'): do_bench = False if(do_bench): #Create testcase with reversed param list, due to the fact its intel syntax! diff --git a/osaca.py b/osaca.py index 79e138a..37bfa73 100755 --- a/osaca.py +++ b/osaca.py @@ -524,7 +524,7 @@ class Osaca(object): op = Parameter('LBL') else: op = MemAddr(op) - param_list[i] = op.print() + param_list[i] = str(op) param_list_types[i] = op # Add to list if(len(instr) > self.longestInstr): @@ -679,7 +679,7 @@ class Osaca(object): elif(isinstance(elem[i], MemAddr)): optmp = 'mem' else: - optmp = elem[i].print().lower() + optmp = str(elem[i]).lower() opExt.append(optmp) operands = '_'.join(opExt) # Now look up the value in the dataframe