renamed all self-defined print functions

This commit is contained in:
Julian Hammer
2017-09-20 15:01:04 +02:00
parent 4c115c6725
commit f312e47a09
6 changed files with 15 additions and 36 deletions

View File

@@ -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

View File

@@ -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}"

View File

@@ -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)

View File

@@ -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()

View File

@@ -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!

View File

@@ -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