macroop.isa (4863:b6dacc9a39ff) | macroop.isa (5009:78d53ea88c74) |
---|---|
1// -*- mode:c++ -*- 2 3// Copyright (c) 2007 The Hewlett-Packard Development Company 4// All rights reserved. 5// 6// Redistribution and use of this software in source and binary forms, 7// with or without modification, are permitted provided that the 8// following conditions are met: --- 112 unchanged lines hidden (view full) --- 121def template MacroDeclare {{ 122 namespace X86Macroop 123 { 124 /** 125 * Static instruction class for "%(mnemonic)s". 126 */ 127 class %(class_name)s : public %(base_class)s 128 { | 1// -*- mode:c++ -*- 2 3// Copyright (c) 2007 The Hewlett-Packard Development Company 4// All rights reserved. 5// 6// Redistribution and use of this software in source and binary forms, 7// with or without modification, are permitted provided that the 8// following conditions are met: --- 112 unchanged lines hidden (view full) --- 121def template MacroDeclare {{ 122 namespace X86Macroop 123 { 124 /** 125 * Static instruction class for "%(mnemonic)s". 126 */ 127 class %(class_name)s : public %(base_class)s 128 { |
129 private: 130 %(declareLabels)s |
|
129 public: 130 // Constructor. 131 %(class_name)s(ExtMachInst machInst, X86ISA::EmulEnv env); 132 }; 133 }; 134}}; 135 136// Basic instruction class constructor template. --- 9 unchanged lines hidden (view full) --- 146 //array in the parent class. 147 %(alloc_microops)s; 148 } 149}}; 150 151let {{ 152 from micro_asm import Combinational_Macroop, Rom_Macroop 153 class X86Macroop(Combinational_Macroop): | 131 public: 132 // Constructor. 133 %(class_name)s(ExtMachInst machInst, X86ISA::EmulEnv env); 134 }; 135 }; 136}}; 137 138// Basic instruction class constructor template. --- 9 unchanged lines hidden (view full) --- 148 //array in the parent class. 149 %(alloc_microops)s; 150 } 151}}; 152 153let {{ 154 from micro_asm import Combinational_Macroop, Rom_Macroop 155 class X86Macroop(Combinational_Macroop): |
156 def add_microop(self, microop): 157 microop.micropc = len(self.microops) 158 self.microops.append(microop) |
|
154 def setAdjustEnv(self, val): 155 self.adjust_env = val 156 def __init__(self, name): 157 super(X86Macroop, self).__init__(name) 158 self.directives = { 159 "adjust_env" : self.setAdjustEnv 160 } 161 self.declared = False 162 self.adjust_env = "" 163 self.doModRM = "" 164 def getAllocator(self, env): 165 return "new X86Macroop::%s(machInst, %s)" % (self.name, env.getAllocator()) 166 def getDeclaration(self): 167 #FIXME This first parameter should be the mnemonic. I need to 168 #write some code which pulls that out | 159 def setAdjustEnv(self, val): 160 self.adjust_env = val 161 def __init__(self, name): 162 super(X86Macroop, self).__init__(name) 163 self.directives = { 164 "adjust_env" : self.setAdjustEnv 165 } 166 self.declared = False 167 self.adjust_env = "" 168 self.doModRM = "" 169 def getAllocator(self, env): 170 return "new X86Macroop::%s(machInst, %s)" % (self.name, env.getAllocator()) 171 def getDeclaration(self): 172 #FIXME This first parameter should be the mnemonic. I need to 173 #write some code which pulls that out |
169 iop = InstObjParams(self.name, self.name, "Macroop", {"code" : ""}) | 174 declareLabels = "" 175 for (label, microop) in self.labels.items(): 176 declareLabels += "const static uint64_t label_%s = %d;\n" \ 177 % (label, microop.micropc) 178 iop = InstObjParams(self.name, self.name, "Macroop", 179 {"code" : "", 180 "declareLabels" : declareLabels 181 }) |
170 return MacroDeclare.subst(iop); 171 def getDefinition(self): 172 #FIXME This first parameter should be the mnemonic. I need to 173 #write some code which pulls that out 174 numMicroops = len(self.microops) 175 allocMicroops = '' 176 micropc = 0 177 for op in self.microops: --- 84 unchanged lines hidden --- | 182 return MacroDeclare.subst(iop); 183 def getDefinition(self): 184 #FIXME This first parameter should be the mnemonic. I need to 185 #write some code which pulls that out 186 numMicroops = len(self.microops) 187 allocMicroops = '' 188 micropc = 0 189 for op in self.microops: --- 84 unchanged lines hidden --- |