microasm.isa (4528:f0b19ee67a7b) microasm.isa (4533:126c53d7644a)
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:

--- 41 unchanged lines hidden (view full) ---

50// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
51// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
52// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
53// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
54// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
55//
56// Authors: Gabe Black
57
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:

--- 41 unchanged lines hidden (view full) ---

50// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
51// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
52// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
53// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
54// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
55//
56// Authors: Gabe Black
57
58//##include "microops/microops.isa"
59//##include "macroop.isa"
58//Include the definitions of the micro ops.
59//These are StaticInst classes which stand on their own and make up an
60//internal instruction set.
61##include "microops/microops.isa"
60
62
63//Include code to build macroops.
64##include "macroop.isa"
65
61let {{
62 import sys
63 sys.path[0:0] = ["src/arch/x86/isa/"]
64 from insts import microcode
65 print microcode
66 from micro_asm import MicroAssembler, Rom_Macroop, Rom
67 mainRom = Rom('main ROM')
68 assembler = MicroAssembler(X86Macroop, microopClasses, mainRom, Rom_Macroop)
69 macroopDict = assembler.assemble(microcode)
70}};
66let {{
67 import sys
68 sys.path[0:0] = ["src/arch/x86/isa/"]
69 from insts import microcode
70 print microcode
71 from micro_asm import MicroAssembler, Rom_Macroop, Rom
72 mainRom = Rom('main ROM')
73 assembler = MicroAssembler(X86Macroop, microopClasses, mainRom, Rom_Macroop)
74 macroopDict = assembler.assemble(microcode)
75}};
71
72////////////////////////////////////////////////////////////////////
73//
74// Microcode assembler specialization for x86
75//
76
77let {{
78 from micro_asm import MicroAssembler, Combinational_Macroop, Rom_Macroop, Rom
79 class X86Macroop(Combinational_Macroop):
80 def __init__(self, name):
81 super(X86Macroop, self).__init__(name)
82 self.directives = {
83 }
84
85 mainRom = Rom('main ROM')
86}};
87
88let {{
89 class X86Microop(object):
90 def __init__(self, name):
91 self.name = name
92
93 # This converts a list of python bools into
94 # a comma seperated list of C++ bools.
95 def microFlagsText(self, vals):
96 text = ""
97 for val in vals:
98 if val:
99 text += ", true"
100 else:
101 text += ", false"
102 return text
103
104 def getAllocator(self, mnemonic, *microFlags):
105 return 'new %s(machInst, %s)' % (self.className, mnemonic, self.microFlagsText(microFlags))
106}};