%(op_class)s)
{
%(constructor)s;
+ %(cond_control_flag_init)s;
}
}};
%(op_class)s)
{
%(constructor)s;
+ %(cond_control_flag_init)s;
}
}};
class RegOpMeta(type):
def buildCppClasses(self, name, Name, suffix, \
- code, flag_code, cond_check, else_code):
+ code, flag_code, cond_check, else_code, cond_control_flag_init):
# Globals to stick the output in
global header_output
global exec_output
# Stick all the code together so it can be searched at once
- allCode = "|".join((code, flag_code, cond_check, else_code))
+ allCode = "|".join((code, flag_code, cond_check, else_code,
+ cond_control_flag_init))
# If op2 is used anywhere, make register and immediate versions
# of this code.
matcher.sub(src2_name, code),
matcher.sub(src2_name, flag_code),
matcher.sub(src2_name, cond_check),
- matcher.sub(src2_name, else_code))
+ matcher.sub(src2_name, else_code),
+ matcher.sub(src2_name, cond_control_flag_init))
imm_name = "%simm8" % match.group("prefix")
self.buildCppClasses(name + "i", Name, suffix + "Imm",
matcher.sub(imm_name, code),
matcher.sub(imm_name, flag_code),
matcher.sub(imm_name, cond_check),
- matcher.sub(imm_name, else_code))
+ matcher.sub(imm_name, else_code),
+ matcher.sub(imm_name, cond_control_flag_init))
return
# If there's something optional to do with flags, generate
# a version without it and fix up this version to use it.
if flag_code != "" or cond_check != "true":
self.buildCppClasses(name, Name, suffix,
- code, "", "true", else_code)
+ code, "", "true", else_code, "")
suffix = "Flags" + suffix
# If psrc1 or psrc2 is used, we need to actually insert code to
{"code" : code,
"flag_code" : flag_code,
"cond_check" : cond_check,
- "else_code" : else_code})
+ "else_code" : else_code,
+ "cond_control_flag_init": cond_control_flag_init})
# Generate the actual code (finally!)
header_output += templates[0].subst(iop)
flag_code = cls.flag_code
cond_check = cls.cond_check
else_code = cls.else_code
+ cond_control_flag_init = cls.cond_control_flag_init
# Set up the C++ classes
- mcls.buildCppClasses(cls, name, Name, "",
- code, flag_code, cond_check, else_code)
+ mcls.buildCppClasses(cls, name, Name, "", code, flag_code,
+ cond_check, else_code, cond_control_flag_init)
# Hook into the microassembler dict
global microopClasses
microopClasses[name] = cls
- allCode = "|".join((code, flag_code, cond_check, else_code))
+ allCode = "|".join((code, flag_code, cond_check, else_code,
+ cond_control_flag_init))
# If op2 is used anywhere, make register and immediate versions
# of this code.
flag_code = ""
cond_check = "true"
else_code = ";"
+ cond_control_flag_init = ""
def __init__(self, dest, src1, op2, flags = None, dataSize = "env.dataSize"):
self.dest = dest
class CondRegOp(RegOp):
abstract = True
cond_check = "checkCondition(ccFlagBits, ext)"
+ cond_control_flag_init = "flags[IsCondControl] = flags[IsControl];"
class RdRegOp(RegOp):
abstract = True
setFlags, _target, _cc)
{
%(constructor)s;
+ %(cond_control_flag_init)s;
}
}};
iop = InstObjParams("br", "MicroBranchFlags", "SeqOpBase",
{"code": "nuIP = target;",
"else_code": "nuIP = nuIP;",
- "cond_test": "checkCondition(ccFlagBits, cc)"})
+ "cond_test": "checkCondition(ccFlagBits, cc)",
+ "cond_control_flag_init": "flags[IsCondControl] = true"})
exec_output += SeqOpExecute.subst(iop)
header_output += SeqOpDeclare.subst(iop)
decoder_output += SeqOpConstructor.subst(iop)
iop = InstObjParams("br", "MicroBranch", "SeqOpBase",
{"code": "nuIP = target;",
"else_code": "nuIP = nuIP;",
- "cond_test": "true"})
+ "cond_test": "true",
+ "cond_control_flag_init": ""})
exec_output += SeqOpExecute.subst(iop)
header_output += SeqOpDeclare.subst(iop)
decoder_output += SeqOpConstructor.subst(iop)
iop = InstObjParams("eret", "EretFlags", "SeqOpBase",
{"code": "", "else_code": "",
- "cond_test": "checkCondition(ccFlagBits, cc)"})
+ "cond_test": "checkCondition(ccFlagBits, cc)",
+ "cond_control_flag_init": ""})
exec_output += SeqOpExecute.subst(iop)
header_output += SeqOpDeclare.subst(iop)
decoder_output += SeqOpConstructor.subst(iop)
iop = InstObjParams("eret", "Eret", "SeqOpBase",
{"code": "", "else_code": "",
- "cond_test": "true"})
+ "cond_test": "true",
+ "cond_control_flag_init": ""})
exec_output += SeqOpExecute.subst(iop)
header_output += SeqOpDeclare.subst(iop)
decoder_output += SeqOpConstructor.subst(iop)