changeset 14321ce30881 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=14321ce30881
description:
        Decode: Make the Decoder class defined per ISA.

diffstat:

 src/arch/SConscript                     |   1 +
 src/arch/alpha/decoder.hh               |  44 ++++++++++++++++++++++
 src/arch/alpha/remote_gdb.cc            |   2 +-
 src/arch/arm/decoder.hh                 |  44 ++++++++++++++++++++++
 src/arch/arm/remote_gdb.cc              |   2 +-
 src/arch/generic/SConscript             |  31 +++++++++++++++
 src/arch/generic/decoder.cc             |  38 +++++++++++++++++++
 src/arch/generic/decoder.hh             |  64 +++++++++++++++++++++++++++++++++
 src/arch/mips/decoder.hh                |  44 ++++++++++++++++++++++
 src/arch/mips/remote_gdb.cc             |   2 +-
 src/arch/power/decoder.hh               |  44 ++++++++++++++++++++++
 src/arch/sparc/decoder.hh               |  44 ++++++++++++++++++++++
 src/arch/x86/decoder.hh                 |  44 ++++++++++++++++++++++
 src/cpu/SConscript                      |   1 -
 src/cpu/checker/thread_context.hh       |   3 +-
 src/cpu/decode.cc                       |  33 -----------------
 src/cpu/decode.hh                       |  59 ------------------------------
 src/cpu/inorder/cpu.cc                  |   2 +-
 src/cpu/inorder/cpu.hh                  |   2 +-
 src/cpu/inorder/resources/fetch_unit.hh |   4 +-
 src/cpu/inorder/thread_context.hh       |   2 +-
 src/cpu/legiontrace.cc                  |   2 +-
 src/cpu/o3/fetch.hh                     |   4 +-
 src/cpu/o3/thread_context.hh            |   2 +-
 src/cpu/simple/base.hh                  |   2 +-
 src/cpu/simple_thread.hh                |   6 +-
 src/cpu/thread_context.hh               |   6 +-
 27 files changed, 419 insertions(+), 113 deletions(-)

diffs (truncated from 831 to 300 lines):

diff -r ea7d6873af6e -r 14321ce30881 src/arch/SConscript
--- a/src/arch/SConscript       Thu May 24 04:09:19 2012 -0400
+++ b/src/arch/SConscript       Fri May 25 00:53:37 2012 -0700
@@ -44,6 +44,7 @@
 
 # List of headers to generate
 isa_switch_hdrs = Split('''
+        decoder.hh
         interrupts.hh
         isa.hh
         isa_traits.hh
diff -r ea7d6873af6e -r 14321ce30881 src/arch/alpha/decoder.hh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/src/arch/alpha/decoder.hh Fri May 25 00:53:37 2012 -0700
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2012 Google
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * Authors: Gabe Black
+ */
+
+#ifndef __ARCH_ALPHA_DECODER_HH__
+#define __ARCH_ALPHA_DECODER_HH__
+
+#include "arch/generic/decoder.hh"
+
+namespace AlphaISA
+{
+
+class Decoder : public GenericISA::Decoder
+{};
+
+} // namespace AlphaISA
+
+#endif // __ARCH_ALPHA_DECODER_HH__
diff -r ea7d6873af6e -r 14321ce30881 src/arch/alpha/remote_gdb.cc
--- a/src/arch/alpha/remote_gdb.cc      Thu May 24 04:09:19 2012 -0400
+++ b/src/arch/alpha/remote_gdb.cc      Fri May 25 00:53:37 2012 -0700
@@ -122,6 +122,7 @@
 #include <string>
 
 
+#include "arch/alpha/decoder.hh"
 #include "arch/alpha/kgdb.h"
 #include "arch/alpha/regredir.hh"
 #include "arch/alpha/remote_gdb.hh"
@@ -131,7 +132,6 @@
 #include "base/remote_gdb.hh"
 #include "base/socket.hh"
 #include "base/trace.hh"
-#include "cpu/decode.hh"
 #include "cpu/static_inst.hh"
 #include "cpu/thread_context.hh"
 #include "debug/GDBAcc.hh"
diff -r ea7d6873af6e -r 14321ce30881 src/arch/arm/decoder.hh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/src/arch/arm/decoder.hh   Fri May 25 00:53:37 2012 -0700
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2012 Google
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * Authors: Gabe Black
+ */
+
+#ifndef __ARCH_ARM_DECODER_HH__
+#define __ARCH_ARM_DECODER_HH__
+
+#include "arch/generic/decoder.hh"
+
+namespace ArmISA
+{
+
+class Decoder : public GenericISA::Decoder
+{};
+
+} // namespace ArmISA
+
+#endif // __ARCH_ARM_DECODER_HH__
diff -r ea7d6873af6e -r 14321ce30881 src/arch/arm/remote_gdb.cc
--- a/src/arch/arm/remote_gdb.cc        Thu May 24 04:09:19 2012 -0400
+++ b/src/arch/arm/remote_gdb.cc        Fri May 25 00:53:37 2012 -0700
@@ -134,6 +134,7 @@
 
 #include <string>
 
+#include "arch/arm/decoder.hh"
 #include "arch/arm/pagetable.hh"
 #include "arch/arm/registers.hh"
 #include "arch/arm/remote_gdb.hh"
@@ -143,7 +144,6 @@
 #include "base/remote_gdb.hh"
 #include "base/socket.hh"
 #include "base/trace.hh"
-#include "cpu/decode.hh"
 #include "cpu/static_inst.hh"
 #include "cpu/thread_context.hh"
 #include "cpu/thread_state.hh"
diff -r ea7d6873af6e -r 14321ce30881 src/arch/generic/SConscript
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/src/arch/generic/SConscript       Fri May 25 00:53:37 2012 -0700
@@ -0,0 +1,31 @@
+# Copyright (c) 2012 Google
+# All rights reserved.
+#
+# 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.
+#
+# Authors: Gabe Black
+
+Import('*')
+
+Source('decoder.cc')
diff -r ea7d6873af6e -r 14321ce30881 src/arch/generic/decoder.cc
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/src/arch/generic/decoder.cc       Fri May 25 00:53:37 2012 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2011 Google
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * Authors: Gabe Black
+ */
+
+#include "arch/generic/decoder.hh"
+
+namespace GenericISA
+{
+
+DecodeCache<TheISA::decodeInst> Decoder::defaultCache;
+
+}
diff -r ea7d6873af6e -r 14321ce30881 src/arch/generic/decoder.hh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/src/arch/generic/decoder.hh       Fri May 25 00:53:37 2012 -0700
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2011-2012 Google
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * Authors: Gabe Black
+ */
+
+#ifndef __ARCH_GENERIC_DECODER_HH__
+#define __ARCH_GENERIC_DECODER_HH__
+
+#include "arch/isa_traits.hh"
+#include "arch/types.hh"
+#include "config/the_isa.hh"
+#include "cpu/decode_cache.hh"
+#include "cpu/static_inst.hh"
+
+namespace GenericISA
+{
+
+/// The decoder class. This class doesn't do much of anything now, but in the
+/// future it will be redefinable per ISA and allow more interesting behavior.
+class Decoder
+{
+  protected:
+    /// A cache of decoded instruction objects.
+    static DecodeCache<TheISA::decodeInst> defaultCache;
+
+  public:
+    /// Decode a machine instruction.
+    /// @param mach_inst The binary instruction to decode.
+    /// @retval A pointer to the corresponding StaticInst object.
+    StaticInstPtr
+    decode(TheISA::ExtMachInst mach_inst, Addr addr)
+    {
+        return defaultCache.decode(mach_inst, addr);
+    }
+};
+
+} // namespace GenericISA
+
+#endif // __ARCH_GENERIC_DECODER_HH__
diff -r ea7d6873af6e -r 14321ce30881 src/arch/mips/decoder.hh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/src/arch/mips/decoder.hh  Fri May 25 00:53:37 2012 -0700
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2012 Google
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to