Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/56487 )

Change subject: arch-x86: Make the microopClasses dict come from python first.
......................................................................

arch-x86: Make the microopClasses dict come from python first.

This will make it possible to define microops there first, and then more
can be defined in the ISA desc.

Change-Id: Id17b0b7723f8388c4b889b0f0d1e73504cbee3e8
---
M src/arch/x86/isa/microops/base.isa
M src/arch/x86/ucasmlib/arch/x86/__init__.py
A src/arch/x86/ucasmlib/arch/x86/microops.py
3 files changed, 77 insertions(+), 18 deletions(-)



diff --git a/src/arch/x86/isa/microops/base.isa b/src/arch/x86/isa/microops/base.isa
index 6a5002b..89a9e80 100644
--- a/src/arch/x86/isa/microops/base.isa
+++ b/src/arch/x86/isa/microops/base.isa
@@ -36,9 +36,20 @@
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

 let {{
+    import sys
+
+    old_path = sys.path
+    sys.path[0:0] = ['src/arch/x86']
+
     # This will be populated with mappings between microop mnemonics and
     # the classes that represent them.
-    microopClasses = {}
+    from ucasmlib.arch.x86 import microopClasses
+
+    # For now, implement this base class into the ISA desc until it's no
+    # longer needed.
+    from ucasmlib.arch.x86.microops import X86Microop
+
+    sys.path = old_path
 }};

 //////////////////////////////////////////////////////////////////////////
@@ -197,21 +208,4 @@
         RegType = FoldedSrc2Op
         FloatType = FloatSrc2Op
         ImmType = Imm8Op
-
-    class X86Microop(object):
-        def __init__(self, name):
-            self.name = name
-
-        def microFlagsText(self, flags):
-            wrapped = ("(1ULL << StaticInst::%s)" % flag for flag in flags)
-            return " | ".join(wrapped)
-
-        def getGenerator(self):
-            return f'''
-            [](const char *macrocodeBlock, const ExtMachInst &machInst,
-                    const EmulEnv &env)
-            {'{'}
-                using namespace rom_labels;
- return {self.getAllocator(["IsMicroop", "IsDelayedCommit"])};
-            {'}'}'''
 }};
diff --git a/src/arch/x86/ucasmlib/arch/x86/__init__.py b/src/arch/x86/ucasmlib/arch/x86/__init__.py
index 6832bd4..26fea5b 100644
--- a/src/arch/x86/ucasmlib/arch/x86/__init__.py
+++ b/src/arch/x86/ucasmlib/arch/x86/__init__.py
@@ -23,6 +23,7 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

+from .microops import classes as microopClasses
 from .macroop import Macroop
 from .rom import Rom
 from .symbols import symbols
diff --git a/src/arch/x86/ucasmlib/arch/x86/microops.py b/src/arch/x86/ucasmlib/arch/x86/microops.py
new file mode 100644
index 0000000..ab6a14b
--- /dev/null
+++ b/src/arch/x86/ucasmlib/arch/x86/microops.py
@@ -0,0 +1,52 @@
+# Copyright 2007-2008 The Hewlett-Packard Development Company
+#
+# The license below extends only to copyright in the software and shall
+# not be construed as granting a license to any other intellectual
+# property including but not limited to intellectual property relating
+# to a hardware implementation of the functionality of the software
+# licensed hereunder.  You may use the software subject to the license
+# terms below provided that you ensure that this notice is replicated
+# unmodified and in its entirety in all distributions of the software,
+# modified or unmodified, in source code or in binary form.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met: redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer;
+# redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution;
+# neither the name of the copyright holders nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+classes = {}
+
+class X86Microop(object):
+    def __init__(self, name):
+        self.name = name
+
+    def microFlagsText(self, flags):
+        wrapped = ("(1ULL << StaticInst::%s)" % flag for flag in flags)
+        return " | ".join(wrapped)
+
+    def getGenerator(self):
+        return f'''
+        [](const char *macrocodeBlock, const ExtMachInst &machInst,
+                const EmulEnv &env)
+        {{
+            using namespace rom_labels;
+            return {self.getAllocator(["IsMicroop", "IsDelayedCommit"])};
+        }}'''

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/56487
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Id17b0b7723f8388c4b889b0f0d1e73504cbee3e8
Gerrit-Change-Number: 56487
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to