From ebe4d05f70e2cac823bdbbc1e2060ab507e3e80f Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Tue, 19 Jun 2007 14:50:35 +0000 Subject: [PATCH] Renovate the "fault" microop implementation. --HG-- extra : convert_revision : dc9d67dd5413f00f16d37cb2d0f8b0d10971e14a --- src/arch/x86/isa/microops/specop.isa | 64 +++++++++++++--------------- 1 file changed, 30 insertions(+), 34 deletions(-) diff --git a/src/arch/x86/isa/microops/specop.isa b/src/arch/x86/isa/microops/specop.isa index 96fdf1c5e..b56223390 100644 --- a/src/arch/x86/isa/microops/specop.isa +++ b/src/arch/x86/isa/microops/specop.isa @@ -59,67 +59,63 @@ // ////////////////////////////////////////////////////////////////////////// -def template MicroFaultExecute {{ - Fault %(class_name)s ::execute(%(CPU_exec_context)s *xc, - Trace::InstRecord *traceData) const - { - //Return the fault we were constructed with - return fault; - } -}}; - -def template MicroFaultDeclare {{ - class %(class_name)s : public X86MicroopBase +output header {{ + class MicroFault : public X86MicroopBase { protected: Fault fault; void buildMe(); public: - %(class_name)s(ExtMachInst _machInst, - const char * instMnem, + MicroFault(ExtMachInst _machInst, const char * instMnem, bool isMicro, bool isDelayed, bool isFirst, bool isLast, Fault _fault); - %(class_name)s(ExtMachInst _machInst, - const char * instMnem, + MicroFault(ExtMachInst _machInst, const char * instMnem, Fault _fault); %(BasicExecDeclare)s }; }}; -def template MicroFaultConstructor {{ - - inline void %(class_name)s::buildMe() - { - %(constructor)s; - } +output decoder {{ + Fault MicroFault::execute(%(CPU_exec_context)s *xc, + Trace::InstRecord *traceData) const + { + //Return the fault we were constructed with + return fault; + } +}}; - inline %(class_name)s::%(class_name)s( +output decoder {{ + inline MicroFault::MicroFault( ExtMachInst machInst, const char * instMnem, Fault _fault) : - %(base_class)s(machInst, "%(mnemonic)s", instMnem, - false, false, false, false, %(op_class)s), fault(_fault) + X86MicroopBase(machInst, "fault", instMnem, + false, false, false, false, No_OpClass), fault(_fault) { - buildMe(); } - inline %(class_name)s::%(class_name)s( + inline MicroFault::MicroFault( ExtMachInst machInst, const char * instMnem, bool isMicro, bool isDelayed, bool isFirst, bool isLast, Fault _fault) : - %(base_class)s(machInst, "%(mnemonic)s", instMnem, - isMicro, isDelayed, isFirst, isLast, %(op_class)s), + X86MicroopBase(machInst, "fault", instMnem, + isMicro, isDelayed, isFirst, isLast, No_OpClass), fault(_fault) { - buildMe(); } }}; let {{ - # This microop takes in a single parameter, a fault to return. - iop = InstObjParams("fault", "GenFault", 'X86MicroopBase', {"code" : ""}) - header_output += MicroFaultDeclare.subst(iop) - decoder_output += MicroFaultConstructor.subst(iop) - exec_output += MicroFaultExecute.subst(iop) + class Fault(X86Microop): + def __init__(self, fault): + self.fault = fault + + def getAllocator(self, *microFlags): + allocator = '''new MicroFault(machInst, mnemonic + %(flags)s, %(fault)s)''' % { + "flags" : self.microFlagsText(microFlags), + "fault" : self.fault} + return allocator + microopClasses["fault"] = Fault }}; -- 2.30.2