raise
try:
for label in statement.labels:
- container.labels[label.name] = microop
+ container.labels[label.text] = microop
if label.extern:
- container.externs[label.name] = microop
+ container.externs[label.text] = microop
container.add_microop(microop)
except:
print_error("Error adding microop.")
t[1].append(t[2])
t[0] = t[1]
+# labels on lines by themselves are attached to the following instruction.
+def p_labels_2(t):
+ 'labels : labels NEWLINE'
+ t[0] = t[1]
+
def p_label_0(t):
'label : ID COLON'
label = Label()
# Standard functions.
#
+standardStart:
# 0x00000000 -- Processor Vendor and Largest Standard Function Number
-standardStart: limm rax, 0x00000001, dataSize=4
+ limm rax, 0x00000001, dataSize=4
limm rbx, 0x68747541, dataSize=4
limm rdx, 0x69746e65, dataSize=4
limm rcx, 0x444d4163, dataSize=4
# Extended functions.
#
-# 0x80000000 -- Processor Vendor and Largest Extended Function Number
+extendedStart:
-extendedStart: limm rax, 0x80000018, dataSize=4
+# 0x80000000 -- Processor Vendor and Largest Extended Function Number
+ limm rax, 0x80000018, dataSize=4
limm rbx, 0x68747541, dataSize=4
limm rdx, 0x69746e65, dataSize=4
limm rcx, 0x444d4163, dataSize=4
fault "NoFault"
fault "NoFault"
-end: fault "NoFault"
+end:
+ fault "NoFault"
};
'''
*/
class %(class_name)s : public %(base_class)s
{
+ private:
+ %(declareLabels)s
public:
// Constructor.
%(class_name)s(ExtMachInst machInst, X86ISA::EmulEnv env);
let {{
from micro_asm import Combinational_Macroop, Rom_Macroop
class X86Macroop(Combinational_Macroop):
+ def add_microop(self, microop):
+ microop.micropc = len(self.microops)
+ self.microops.append(microop)
def setAdjustEnv(self, val):
self.adjust_env = val
def __init__(self, name):
def getDeclaration(self):
#FIXME This first parameter should be the mnemonic. I need to
#write some code which pulls that out
- iop = InstObjParams(self.name, self.name, "Macroop", {"code" : ""})
+ declareLabels = ""
+ for (label, microop) in self.labels.items():
+ declareLabels += "const static uint64_t label_%s = %d;\n" \
+ % (label, microop.micropc)
+ iop = InstObjParams(self.name, self.name, "Macroop",
+ {"code" : "",
+ "declareLabels" : declareLabels
+ })
return MacroDeclare.subst(iop);
def getDefinition(self):
#FIXME This first parameter should be the mnemonic. I need to