[gem5-dev] Change in gem5/gem5[develop]: ext: googletest: upgrade to googletest 1.10

2020-12-21 Thread Yu-hsin Wang (Gerrit) via gem5-dev
Yu-hsin Wang has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/38577 )



Change subject: ext: googletest: upgrade to googletest 1.10
..

ext: googletest: upgrade to googletest 1.10

Upgrade googletest to 1.10
upstream commit: 703bd9caab50b139428cea1aaff9974ebee5742e
tag: release-1.10.0

sha1sum c4bb446ee3f8a730168097f44c31c90b62c63287 generated by command:
find . -type f ! -name SConscript ! -path "./.git/*" ! -name ".*" -print0 \
| sort -z | xargs -0 sha1sum | sha1sum

Change-Id: I6500e13e9c094efd99ebc72b3ae564861e67c159
---
A ext/googletest/BUILD.bazel
A ext/googletest/CMakeLists.txt
A ext/googletest/CONTRIBUTING.md
A ext/googletest/LICENSE
A ext/googletest/README.md
A ext/googletest/WORKSPACE
A ext/googletest/appveyor.yml
C ext/googletest/ci/build-linux-bazel.sh
A ext/googletest/ci/build-platformio.sh
C ext/googletest/ci/env-linux.sh
C ext/googletest/ci/env-osx.sh
R ext/googletest/ci/get-nprocessors.sh
C ext/googletest/ci/install-linux.sh
C ext/googletest/ci/install-osx.sh
A ext/googletest/ci/install-platformio.sh
C ext/googletest/ci/log-config.sh
A ext/googletest/ci/travis.sh
D ext/googletest/googlemock/CHANGES
M ext/googletest/googlemock/CMakeLists.txt
D ext/googletest/googlemock/Makefile.am
M ext/googletest/googlemock/README.md
D ext/googletest/googlemock/build-aux/.keep
A ext/googletest/googlemock/cmake/gmock.pc.in
A ext/googletest/googlemock/cmake/gmock_main.pc.in
D ext/googletest/googlemock/configure.ac
D ext/googletest/googlemock/docs/CheatSheet.md
D ext/googletest/googlemock/docs/CookBook.md
D ext/googletest/googlemock/docs/DesignDoc.md
D ext/googletest/googlemock/docs/DevGuide.md
D ext/googletest/googlemock/docs/Documentation.md
D ext/googletest/googlemock/docs/ForDummies.md
D ext/googletest/googlemock/docs/FrequentlyAskedQuestions.md
D ext/googletest/googlemock/docs/KnownIssues.md
A ext/googletest/googlemock/docs/cheat_sheet.md
A ext/googletest/googlemock/docs/cook_book.md
A ext/googletest/googlemock/docs/for_dummies.md
A ext/googletest/googlemock/docs/gmock_faq.md
D ext/googletest/googlemock/docs/v1_5/CheatSheet.md
D ext/googletest/googlemock/docs/v1_5/CookBook.md
D ext/googletest/googlemock/docs/v1_5/Documentation.md
D ext/googletest/googlemock/docs/v1_5/ForDummies.md
D ext/googletest/googlemock/docs/v1_5/FrequentlyAskedQuestions.md
D ext/googletest/googlemock/docs/v1_6/CheatSheet.md
D ext/googletest/googlemock/docs/v1_6/CookBook.md
D ext/googletest/googlemock/docs/v1_6/Documentation.md
D ext/googletest/googlemock/docs/v1_6/ForDummies.md
D ext/googletest/googlemock/docs/v1_6/FrequentlyAskedQuestions.md
D ext/googletest/googlemock/docs/v1_7/CheatSheet.md
D ext/googletest/googlemock/docs/v1_7/CookBook.md
D ext/googletest/googlemock/docs/v1_7/Documentation.md
D ext/googletest/googlemock/docs/v1_7/ForDummies.md
D ext/googletest/googlemock/docs/v1_7/FrequentlyAskedQuestions.md
M ext/googletest/googlemock/include/gmock/gmock-actions.h
M ext/googletest/googlemock/include/gmock/gmock-cardinalities.h
A ext/googletest/googlemock/include/gmock/gmock-function-mocker.h
M ext/googletest/googlemock/include/gmock/gmock-generated-actions.h
M ext/googletest/googlemock/include/gmock/gmock-generated-actions.h.pump
M ext/googletest/googlemock/include/gmock/gmock-generated-function-mockers.h
M  
ext/googletest/googlemock/include/gmock/gmock-generated-function-mockers.h.pump

M ext/googletest/googlemock/include/gmock/gmock-generated-matchers.h
M ext/googletest/googlemock/include/gmock/gmock-generated-matchers.h.pump
D ext/googletest/googlemock/include/gmock/gmock-generated-nice-strict.h
D ext/googletest/googlemock/include/gmock/gmock-generated-nice-strict.h.pump
M ext/googletest/googlemock/include/gmock/gmock-matchers.h
M ext/googletest/googlemock/include/gmock/gmock-more-actions.h
M ext/googletest/googlemock/include/gmock/gmock-more-matchers.h
A ext/googletest/googlemock/include/gmock/gmock-nice-strict.h
M ext/googletest/googlemock/include/gmock/gmock-spec-builders.h
M ext/googletest/googlemock/include/gmock/gmock.h
A ext/googletest/googlemock/include/gmock/internal/custom/README.md
M  
ext/googletest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h
M  
ext/googletest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h.pump

M ext/googletest/googlemock/include/gmock/internal/custom/gmock-matchers.h
M ext/googletest/googlemock/include/gmock/internal/custom/gmock-port.h
D  
ext/googletest/googlemock/include/gmock/internal/gmock-generated-internal-utils.h
D  
ext/googletest/googlemock/include/gmock/internal/gmock-generated-internal-utils.h.pump

M ext/googletest/googlemock/include/gmock/internal/gmock-internal-utils.h
M ext/googletest/googlemock/include/gmock/internal/gmock-port.h
A ext/googletest/googlemock/include/gmock/internal/gmock-pp.h
D ext/googletest/googlemock/make/Makefile
D ext/googletest/googlemock/msvc/2005/gmock.sln
D 

[gem5-dev] Change in gem5/gem5[develop]: util: Force the m5 utility to be built using c++14.

2020-12-21 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/38216 )


Change subject: util: Force the m5 utility to be built using c++14.
..

util: Force the m5 utility to be built using c++14.

Otherwise, the version of the standard being used will depend on the
version of the compiler, and may not build consistently on different
machines.

Change-Id: I3a031a2dfe97df3dd83926abb517781069c1c6a5
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38216
Reviewed-by: Daniel Gerzhoy 
Reviewed-by: Matt Sinclair 
Maintainer: Matt Sinclair 
Tested-by: kokoro 
---
M util/m5/SConstruct
1 file changed, 1 insertion(+), 0 deletions(-)

Approvals:
  Matt Sinclair: Looks good to me, approved; Looks good to me, approved
  Daniel Gerzhoy: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/util/m5/SConstruct b/util/m5/SConstruct
index 6552bfb..e36cb73 100644
--- a/util/m5/SConstruct
+++ b/util/m5/SConstruct
@@ -58,6 +58,7 @@
 main.Append(CXXFLAGS=[ '-O2' ])
 main.Append(CCFLAGS=[ '-O2' ])
 main.Append(CPPPATH=[ common_include ])
+main.Append(CXXFLAGS=[ '-std=c++14' ])

 if not GetOption('verbose'):
 # A functor which returns a shorter summary string to replace the  
normal


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38216
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: I3a031a2dfe97df3dd83926abb517781069c1c6a5
Gerrit-Change-Number: 38216
Gerrit-PatchSet: 5
Gerrit-Owner: Gabe Black 
Gerrit-Reviewer: Brandon Potter 
Gerrit-Reviewer: Daniel Gerzhoy 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Matt Sinclair 
Gerrit-Reviewer: kokoro 
Gerrit-MessageType: merged
___
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

[gem5-dev] Change in gem5/gem5[develop]: util: Break up some unit tests in the m5 utility.

2020-12-21 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/36855 )


Change subject: util: Break up some unit tests in the m5 utility.
..

util: Break up some unit tests in the m5 utility.

Some unit tests for the inst and semi call types in the m5 utility were
too big and testing multiple scenarioes. This change breaks them up into
individual tests, like in the addr call type unit test.

Change-Id: I764d9edfbe4f6bdcc5907173247f7511c68aa1d0
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/36855
Reviewed-by: Daniel Carvalho 
Maintainer: Bobby R. Bruce 
Tested-by: kokoro 
---
M util/m5/src/call_type/inst.test.cc
M util/m5/src/call_type/semi.test.cc
2 files changed, 79 insertions(+), 47 deletions(-)

Approvals:
  Daniel Carvalho: Looks good to me, approved
  Bobby R. Bruce: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/util/m5/src/call_type/inst.test.cc  
b/util/m5/src/call_type/inst.test.cc

index be87b0b..292eea9 100644
--- a/util/m5/src/call_type/inst.test.cc
+++ b/util/m5/src/call_type/inst.test.cc
@@ -58,24 +58,34 @@

 DefaultCallType defaultCallType;

-TEST(InstCallType, Detect)
+class InstCallTypeTest : public testing::Test
 {
-CallType *ct;
+  protected:
+CallType *ct = nullptr;
+};

+TEST_F(InstCallTypeTest, EmptyArgs)
+{
 // Inst should not be selected if there are no arguments.
 Args empty({});
 defaultCallType.init_called = false;
 ct = CallType::detect(empty);
 EXPECT_EQ(ct, );
 EXPECT_TRUE(defaultCallType.init_called);
+}

+TEST_F(InstCallTypeTest, NotAnyArg)
+{
 // Inst should not be selected if --inst isn't the first argument.
 Args one_arg({"one"});
 defaultCallType.init_called = false;
 ct = CallType::detect(one_arg);
 EXPECT_EQ(ct, );
 EXPECT_TRUE(defaultCallType.init_called);
+}

+TEST_F(InstCallTypeTest, FirstArg)
+{
 // Inst should be selected if --inst is the first argument.
 Args selected({"--inst"});
 defaultCallType.init_called = false;
@@ -83,14 +93,20 @@
 EXPECT_NE(ct, );
 EXPECT_NE(ct, nullptr);
 EXPECT_FALSE(defaultCallType.init_called);
+}

+TEST_F(InstCallTypeTest, ExtraArg)
+{
 Args extra({"--inst", "foo"});
 defaultCallType.init_called = false;
 ct = CallType::detect(extra);
 EXPECT_NE(ct, );
 EXPECT_NE(ct, nullptr);
 EXPECT_FALSE(defaultCallType.init_called);
+}

+TEST_F(InstCallTypeTest, NotFirstArg)
+{
 // Inst should not be selected if --inst isn't first.
 Args not_first({"foo", "--inst"});
 defaultCallType.init_called = false;
@@ -103,7 +119,7 @@
 siginfo_t interceptSiginfo;

 void
-sigill_handler(int sig, siginfo_t *info, void *ucontext)
+sigillHandler(int sig, siginfo_t *info, void *ucontext)
 {
 std::memcpy(, info, sizeof(interceptSiginfo));
 siglongjmp(interceptEnv, 1);
@@ -138,7 +154,7 @@

 struct sigaction sigill_action;
 std::memset(_action, 0, sizeof(sigill_action));
-sigill_action.sa_sigaction = _handler;
+sigill_action.sa_sigaction = 
 sigill_action.sa_flags = SA_SIGINFO | SA_RESETHAND;

 struct sigaction old_sigill_action;
diff --git a/util/m5/src/call_type/semi.test.cc  
b/util/m5/src/call_type/semi.test.cc

index 6c17a06..72fded3 100644
--- a/util/m5/src/call_type/semi.test.cc
+++ b/util/m5/src/call_type/semi.test.cc
@@ -54,57 +54,73 @@
 const DispatchTable () const override { return dt; }
 };

-DefaultCallType default_call_type;
+DefaultCallType defaultCallType;

-TEST(SemiCallType, Detect)
+class SemiCallTypeTest : public testing::Test
 {
-CallType *ct;
+  protected:
+CallType *ct = nullptr;
+};

+TEST_F(SemiCallTypeTest, EmptyArgs)
+{
 // Semi should not be selected if there are no arguments.
 Args empty({});
-default_call_type.init_called = false;
+defaultCallType.init_called = false;
 ct = CallType::detect(empty);
-EXPECT_EQ(ct, _call_type);
-EXPECT_TRUE(default_call_type.init_called);
-
-// Inst should not be selected if --semi isn't the first argument.
-Args one_arg({"one"});
-default_call_type.init_called = false;
-ct = CallType::detect(one_arg);
-EXPECT_EQ(ct, _call_type);
-EXPECT_TRUE(default_call_type.init_called);
-
-// Semi should be selected if --semi is the first argument.
-Args selected({"--semi"});
-default_call_type.init_called = false;
-ct = CallType::detect(selected);
-EXPECT_NE(ct, _call_type);
-EXPECT_NE(ct, nullptr);
-EXPECT_FALSE(default_call_type.init_called);
-
-Args extra({"--semi", "foo"});
-default_call_type.init_called = false;
-ct = CallType::detect(extra);
-EXPECT_NE(ct, _call_type);
-EXPECT_NE(ct, nullptr);
-EXPECT_FALSE(default_call_type.init_called);
-
-// Semi should not be selected if --semi isn't first.
-Args not_first({"foo", "--semi"});
-default_call_type.init_called = false;
-ct = 

[gem5-dev] Change in gem5/gem5[develop]: util: Use the std namespace for memcpy and memset in the m5 util.

2020-12-21 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/31834 )


Change subject: util: Use the std namespace for memcpy and memset in the m5  
util.

..

util: Use the std namespace for memcpy and memset in the m5 util.

The C++ versions of those functions are technically in the std
namespace, and while they may work without it (the C version leaking
through from somewhere?), they should still use it.

Change-Id: Ib53a7f0c41d7f5776221e7661c616ea51e8ed528
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/31834
Tested-by: kokoro 
Maintainer: Bobby R. Bruce 
Reviewed-by: Daniel Carvalho 
---
M util/m5/src/args.cc
M util/m5/src/command/readfile.cc
M util/m5/src/command/readfile.test.cc
M util/m5/src/command/writefile.cc
M util/m5/src/command/writefile.test.cc
5 files changed, 7 insertions(+), 6 deletions(-)

Approvals:
  Daniel Carvalho: Looks good to me, approved
  Bobby R. Bruce: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/util/m5/src/args.cc b/util/m5/src/args.cc
index 1caad43..83dd3d5 100644
--- a/util/m5/src/args.cc
+++ b/util/m5/src/args.cc
@@ -49,7 +49,7 @@
 const size_t MaxLen = num_regs * RegSize;
 const char *arg = str.c_str();

-memset(regs, 0, MaxLen);
+std::memset(regs, 0, MaxLen);

 size_t len = str.size();

diff --git a/util/m5/src/command/readfile.cc  
b/util/m5/src/command/readfile.cc

index 92c39e2..8cd5203 100644
--- a/util/m5/src/command/readfile.cc
+++ b/util/m5/src/command/readfile.cc
@@ -44,7 +44,7 @@
 // Touch all buffer pages to ensure they are mapped in the
 // page table. This is required in the case of X86_FS, where
 // Linux does demand paging.
-memset(buf, 0, sizeof(buf));
+std::memset(buf, 0, sizeof(buf));

 int len;
 int offset = 0;
diff --git a/util/m5/src/command/readfile.test.cc  
b/util/m5/src/command/readfile.test.cc

index d5ffe1d..435b54e 100644
--- a/util/m5/src/command/readfile.test.cc
+++ b/util/m5/src/command/readfile.test.cc
@@ -27,6 +27,7 @@

 #include 

+#include 
 #include 

 #include "args.hh"
@@ -85,7 +86,7 @@
 chunks[i] = chunk_idx++;

 // Copy out to the requested buffer.
-memcpy(buffer, ((uint8_t *)chunks) + (chunk_size - at_start), len);
+std::memcpy(buffer, ((uint8_t *)chunks) + (chunk_size - at_start),  
len);


 // Clean up.
 delete [] chunks;
diff --git a/util/m5/src/command/writefile.cc  
b/util/m5/src/command/writefile.cc

index 7771dfe..41596bc 100644
--- a/util/m5/src/command/writefile.cc
+++ b/util/m5/src/command/writefile.cc
@@ -55,7 +55,7 @@
 char buf[256 * 1024];
 int offset = 0;

-memset(buf, 0, sizeof(buf));
+std::memset(buf, 0, sizeof(buf));

 while (true) {
 src.seekg(offset);
diff --git a/util/m5/src/command/writefile.test.cc  
b/util/m5/src/command/writefile.test.cc

index a1adf5c..41d70d4 100644
--- a/util/m5/src/command/writefile.test.cc
+++ b/util/m5/src/command/writefile.test.cc
@@ -67,7 +67,7 @@
 if (test_written_data.size() < required_size)
 test_written_data.resize(required_size);

-memcpy(test_written_data.data() + offset, buffer, len);
+std::memcpy(test_written_data.data() + offset, buffer, len);

 return len;
 }
@@ -133,7 +133,7 @@
 for (size_t i = 0; i < num_chunks; i++)
 *buf32++ = val++;
 if (leftovers)
-memcpy(buf32, , leftovers);
+std::memcpy(buf32, , leftovers);

 // Make sure our new contents are out there.
 msync(_buf, _size, MS_SYNC | MS_INVALIDATE);

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/31834
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: Ib53a7f0c41d7f5776221e7661c616ea51e8ed528
Gerrit-Change-Number: 31834
Gerrit-PatchSet: 15
Gerrit-Owner: Gabe Black 
Gerrit-Reviewer: Bobby R. Bruce 
Gerrit-Reviewer: Daniel Carvalho 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Giacomo Travaglini 
Gerrit-Reviewer: kokoro 
Gerrit-MessageType: merged
___
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

[gem5-dev] Change in gem5/gem5[develop]: util: Expose addr config mechanisms in the gem5 op java wrapper.

2020-12-21 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/28184 )


Change subject: util: Expose addr config mechanisms in the gem5 op java  
wrapper.

..

util: Expose addr config mechanisms in the gem5 op java wrapper.

These allow you to set the target physical address, and map or unmap the
region of physical memory. This is not automatic for two reasons. First,
the address needs to be configured before the mapping is done, and
there's no way to ensure that ordering when everything is handled
automatically. Second, if the user isn't going to use the address based
mechanism, then the mapping and access to /dev/mem isn't necessary and
may prevent using the other call types.

Change-Id: I0f9c32d6bfa402ba59ea1bf5672fb7f11003568d
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/28184
Reviewed-by: Gabe Black 
Maintainer: Bobby R. Bruce 
Tested-by: kokoro 
---
M util/m5/README.md
M util/m5/src/java/gem5/Ops.java
M util/m5/src/java/gem5/ops.cc
3 files changed, 36 insertions(+), 0 deletions(-)

Approvals:
  Gabe Black: Looks good to me, approved
  Bobby R. Bruce: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/util/m5/README.md b/util/m5/README.md
index b9ccbff..cbdff1d 100644
--- a/util/m5/README.md
+++ b/util/m5/README.md
@@ -362,6 +362,19 @@
 long sum = gem5_ops.sum(1, 2, 3, 4, 5, 6);
 ```

+To configure the address based trigger mechanism, you can use these static
+methods.
+
+void setAddr(long addr);
+Set the address for the "magic" address region.
+
+void mapMem();
+Map the "magic" physical address region into the process' address space,  
likely

+by mmapping the "/dev/mem" device file.
+
+void unmapMem();
+Unmap the "magic" physical address region that was previously mapped.
+


 # lua module
diff --git a/util/m5/src/java/gem5/Ops.java b/util/m5/src/java/gem5/Ops.java
index f6ab178..ab25419 100644
--- a/util/m5/src/java/gem5/Ops.java
+++ b/util/m5/src/java/gem5/Ops.java
@@ -53,6 +53,10 @@
 private static Map _callTypes;
 public static final Map callTypes;

+public static native void setAddr(long addr);
+public static native void mapMem();
+public static native void unmapMem();
+
 static {
 try {
 File temp_lib = File.createTempFile("gem5Ops", ".so");
diff --git a/util/m5/src/java/gem5/ops.cc b/util/m5/src/java/gem5/ops.cc
index c1f36e4..da21840 100644
--- a/util/m5/src/java/gem5/ops.cc
+++ b/util/m5/src/java/gem5/ops.cc
@@ -44,6 +44,7 @@
 #include "call_type/semi_dt.hh"
 #include "gem5/m5ops.h"
 #include "java/gem5_Ops.h"
+#include "m5_mmap.h"

 #define _stringify(x) #x
 #define stringify(x) _stringify(x)
@@ -108,6 +109,24 @@
 env->DeleteLocalRef(map);
 }

+JNIEXPORT void JNICALL
+Java_gem5_Ops_setAddr(JNIEnv *env, jclass clazz, jlong addr)
+{
+m5op_addr = addr;
+}
+
+JNIEXPORT void JNICALL
+Java_gem5_Ops_mapMem(JNIEnv *env, jclass clazz)
+{
+map_m5_mem();
+}
+
+JNIEXPORT void JNICALL
+Java_gem5_Ops_unmapMem(JNIEnv *env, jclass clazz)
+{
+unmap_m5_mem();
+}
+
 static DispatchTable *
 getDispatchTable(JNIEnv *env, jobject obj)
 {

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/28184
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: I0f9c32d6bfa402ba59ea1bf5672fb7f11003568d
Gerrit-Change-Number: 28184
Gerrit-PatchSet: 31
Gerrit-Owner: Gabe Black 
Gerrit-Reviewer: Bobby R. Bruce 
Gerrit-Reviewer: Earl Ou 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Giacomo Travaglini 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: Pouya Fotouhi 
Gerrit-Reviewer: Yu-hsin Wang 
Gerrit-Reviewer: kokoro 
Gerrit-MessageType: merged
___
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

[gem5-dev] Change in gem5/gem5[develop]: util: Embed the JNI library (.so) in the jar file for the gem5 ops.

2020-12-21 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/28183 )


Change subject: util: Embed the JNI library (.so) in the jar file for the  
gem5 ops.

..

util: Embed the JNI library (.so) in the jar file for the gem5 ops.

This makes it easier to manage the java wrapper since there's only one
file. This change also splits up the command builder which builds the
java jar since we need to run one step which produces the .h, then a
second step to build the library, and then finally the step that
produces the jar. The first step is left as a command builder since the
scons Java builder still doesn't know about the -h option, but the
second step now uses the Jar builder.

Change-Id: I76e2e5e86bb3153f2ba69a75ad94cd4e065cd33d
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/28183
Reviewed-by: Gabe Black 
Maintainer: Gabe Black 
Tested-by: kokoro 
---
M util/m5/SConstruct
M util/m5/src/SConscript
M util/m5/src/java/gem5/Ops.java
3 files changed, 39 insertions(+), 13 deletions(-)

Approvals:
  Gabe Black: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/util/m5/SConstruct b/util/m5/SConstruct
index 242bbe7..6552bfb 100644
--- a/util/m5/SConstruct
+++ b/util/m5/SConstruct
@@ -79,6 +79,7 @@
 main['ASPPCOMSTR'] = ComStr('ASPP')
 main['ARCOMSTR'] = ComStr('AR')
 main['RANLIBCOMSTR'] = ComStr('RANLIB')
+main['JARCOMSTR'] = ComStr('JAR')

 def MakeAction(action, string, *args, **kwargs):
 def func(target, source, env, executor):
diff --git a/util/m5/src/SConscript b/util/m5/src/SConscript
index b3e057c..1105b60 100644
--- a/util/m5/src/SConscript
+++ b/util/m5/src/SConscript
@@ -105,16 +105,24 @@
 # that the javah tool exists. Java has dropped that tool in favor of a  
-h
 # option on javac which the Java builder doesn't know how to use. To  
get
 # around this, we set up our own builder which does the "right thing"  
here.

-java_env.Command([ Dir('java').File('gem5_Ops.h'),
-   Dir('out').Dir('java').File('gem5Ops.jar') ],
- srcs,
- MakeAction([
- '${JAVAC} ${JAVACFLAGS} -d ${OUT} '
- '${SOURCES} -h ${JAVA_DIR}',
- '${JAR} cvf ${TARGETS[1]} ${CLS_DIR}/*.class' ],
-'JAVA'),
- CLS_DIR=Dir('out').Dir('java').Dir('gem5'),
- OUT=Dir('out').Dir('java'), JAVA_DIR=Dir('java'))
+jni_header = Dir('java').File('gem5_Ops.h')
+
+java_files = []
+class_files = []
+def check_for_java(arg, dirname, fnames):
+for filename in fnames:
+base, extension = os.path.splitext(filename)
+if extension == '.java':
+java_files.append(dirname.File(filename))
+class_files.append(dirname.File(base + '.class'))
+
+Dir('java').walk(check_for_java, None)
+
+java_env.Command([ jni_header ] + class_files, java_files,
+ MakeAction('${JAVAC} ${JAVACFLAGS} -d ${JAVA_DIR} '
+'${SOURCES} -h ${JAVA_DIR}',
+'JAVA'), JAVA_DIR=Dir('java'))
+
 # Set include paths to the C headers from the JDK which scons found  
for us.

 java_env.Append(CPPPATH='${JAVAINCLUDES}')
 for ct in all_call_types:
@@ -122,9 +130,11 @@
 java_env.Append(CXXFLAGS=[ '-DCALL_TYPE_DEFAULT=%s' % ct.name  
])

 java_env.Append(CXXFLAGS=[ '-DCALL_TYPE_%s_ENABLED=%s' %
(ct.name, '1' if ct.enabled else '0') ])
-java_env.SharedLibrary('out/java/gem5Ops',
-   [ jni ] + m5op_shared + m5_mmap_shared)
+jni_lib = java_env.SharedLibrary(
+'java/gem5Ops', [ jni ] + m5op_shared + m5_mmap_shared)

+java_env.Jar(Dir('out').File('gem5Ops.jar'),
+ jni_lib + class_files, JARCHDIR=Dir('java'))

 if env['HAVE_LUA51']:
 #
diff --git a/util/m5/src/java/gem5/Ops.java b/util/m5/src/java/gem5/Ops.java
index 44afad9..f6ab178 100644
--- a/util/m5/src/java/gem5/Ops.java
+++ b/util/m5/src/java/gem5/Ops.java
@@ -37,6 +37,7 @@

 package gem5;

+import java.io.*;
 import java.util.*;

 /**
@@ -53,7 +54,21 @@
 public static final Map callTypes;

 static {
-System.loadLibrary("gem5Ops");
+try {
+File temp_lib = File.createTempFile("gem5Ops", ".so");
+temp_lib.deleteOnExit();
+
+InputStream in =  
Ops.class.getResourceAsStream("/libgem5Ops.so");

+byte[] buffer = new byte[in.available()];
+in.read(buffer);
+OutputStream out = new FileOutputStream(temp_lib);
+out.write(buffer);
+
+System.load(temp_lib.getAbsolutePath());
+} catch (Exception e) {
+throw new 

[gem5-dev] Change in gem5/gem5[develop]: util: Enable using different call types in the gem5 ops java wrapper.

2020-12-21 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/28182 )


Change subject: util: Enable using different call types in the gem5 ops  
java wrapper.

..

util: Enable using different call types in the gem5 ops java wrapper.

Convert the native implementation from C to C++. Also expand the test to
cycle through the different call mechanisms and call "sum" using each
one. This test should primarily be run on a gem5 native CPU which will
support all call types.

To access a particular call type, get an instance of the gem5.Ops class
from the callTypes static map, using the name of the call type you want
as the key. If you just want whatever the default is, use the additional
key "default".

Change-Id: If4ef812c9746fbf974e54cc9fe515e2b581e9939
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/28182
Reviewed-by: Gabe Black 
Reviewed-by: Bobby R. Bruce 
Maintainer: Gabe Black 
Tested-by: kokoro 
---
M util/m5/README.md
M util/m5/SConstruct
M util/m5/src/SConscript
M util/m5/src/java/gem5/Ops.java
M util/m5/src/java/gem5/OpsTest.java
D util/m5/src/java/gem5/ops.c
A util/m5/src/java/gem5/ops.cc
7 files changed, 355 insertions(+), 245 deletions(-)

Approvals:
  Gabe Black: Looks good to me, but someone else must approve; Looks good  
to me, approved

  Bobby R. Bruce: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/util/m5/README.md b/util/m5/README.md
index 7d2d66b..b9ccbff 100644
--- a/util/m5/README.md
+++ b/util/m5/README.md
@@ -345,15 +345,22 @@

 # Java jar

-In your java source, import the gem5Op class which will have methods for
-calling each of the gem5 operations. The .so library will be loaded
-automatically.
+In your java source, import the gem5Op class.

-```shell
+```java
 import gem5.Ops
 ```

-These methods will all use the magic instruction based trigger mechanism.
+This class provides a static map named callTypes which map from each of the
+call type names ("addr", "inst", or "semi") to an Ops instance. That  
instance
+will provide a set of methods which trigger each of the gem5 operations  
using
+the requested trigger mechanism. The call type "default" maps to whatever  
the

+default call type is for the current ABI.
+
+```shell
+gem5.Ops gem5_ops = gem5.Ops.callTypes.get("default");
+long sum = gem5_ops.sum(1, 2, 3, 4, 5, 6);
+```



diff --git a/util/m5/SConstruct b/util/m5/SConstruct
index 63143a8..242bbe7 100644
--- a/util/m5/SConstruct
+++ b/util/m5/SConstruct
@@ -39,6 +39,8 @@
 src_dir = Dir('src')
 build_dir = Dir('build')

+main.SConsignFile(build_dir.File("sconsign").abspath)
+
 def abspath(d):
 return os.path.abspath(str(d))

diff --git a/util/m5/src/SConscript b/util/m5/src/SConscript
index 5eabcc3..b3e057c 100644
--- a/util/m5/src/SConscript
+++ b/util/m5/src/SConscript
@@ -37,7 +37,7 @@
 m5_mmap = 'm5_mmap.c'
 usage = 'usage.cc'

-jni = 'java/gem5/ops.c'
+jni = 'java/gem5/ops.cc'
 lua = 'lua_gem5Op.cc'

 all_call_types = list(env['CALL_TYPE'].values())
@@ -117,6 +117,11 @@
  OUT=Dir('out').Dir('java'), JAVA_DIR=Dir('java'))
 # Set include paths to the C headers from the JDK which scons found  
for us.

 java_env.Append(CPPPATH='${JAVAINCLUDES}')
+for ct in all_call_types:
+if ct.default:
+java_env.Append(CXXFLAGS=[ '-DCALL_TYPE_DEFAULT=%s' % ct.name  
])

+java_env.Append(CXXFLAGS=[ '-DCALL_TYPE_%s_ENABLED=%s' %
+   (ct.name, '1' if ct.enabled else '0') ])
 java_env.SharedLibrary('out/java/gem5Ops',
[ jni ] + m5op_shared + m5_mmap_shared)

diff --git a/util/m5/src/java/gem5/Ops.java b/util/m5/src/java/gem5/Ops.java
index cc92505..44afad9 100644
--- a/util/m5/src/java/gem5/Ops.java
+++ b/util/m5/src/java/gem5/Ops.java
@@ -37,13 +37,25 @@

 package gem5;

+import java.util.*;
+
 /**
  * Java class to implement JNI for m5Ops
  */

 public class Ops {
+private Ops() {}
+
+private static native void setupCallTypes();
+private long dispatchTablePtr;
+
+private static Map _callTypes;
+public static final Map callTypes;
+
 static {
 System.loadLibrary("gem5Ops");
+setupCallTypes();
+callTypes = Collections.unmodifiableMap(_callTypes);
 }

 public native void arm(long address);
@@ -73,5 +85,4 @@
 public native void panic();
 public native void work_begin(long workid, long threadid);
 public native void work_end(long workid, long threadid);
-
 }
diff --git a/util/m5/src/java/gem5/OpsTest.java  
b/util/m5/src/java/gem5/OpsTest.java

index 6e855c9..5678ecd 100644
--- a/util/m5/src/java/gem5/OpsTest.java
+++ b/util/m5/src/java/gem5/OpsTest.java
@@ -34,15 +34,25 @@
 import org.junit.runner.Result;
 import org.junit.runner.notification.Failure;

+import java.util.Random;
+import java.util.Map;
+
 import gem5.Ops;

 public class OpsTest {

 @Test
 

[gem5-dev] Change in gem5/gem5[develop]: scons,fastmodel: Change how ARM license slots are throttled.

2020-12-21 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/38617 )


Change subject: scons,fastmodel: Change how ARM license slots are throttled.
..

scons,fastmodel: Change how ARM license slots are throttled.

To limit the number of license slots used by SCons when building fast
model components, the fastmodel SConscript set up a group of nodes
which are attached to each simgen run using the SCons SideEffect
method using one of the library files it generates.

To create each unique node, the SCons Value() method was used, passing
it the counter for the loop. In at least version 4 of SCons, what this
ended up doing was setting that library file as a source for each of
the Value() nodes it corresponds to.

That doesn't *seem* like a problem, but then when creating config
include files, files which expose SCons configuration values to C++,
they also create Value() nodes using the value of the config variable.
In cases where that variable is boolean, the value might be 0 or 1.

The result was that the config header depended on Value(0) (for
instance), and then Value(0) depended on a collection of static library
files.

When scons tried to determine whether the config file was up to date,
it tried to check if if its sources had changed. It would check
Value(0), and then Value(0) would try to compute a checksum for its own
source. To do that, it seems to assume that the value can be
interpreted as a string and tries to decode it as utf8. Since the
library is a binary file, that would fail and break the build with a
cryptic message from within the guts of SCons.

To address this, this change replaces the loop index with a call to
object(). Each instance created in that way will be different from
every other, and there will be no way (purposefully or otherwise) to
create a collision with it when creating Value() nodes for some other
purpose.

Change-Id: I56bc842ae66b8cb36d3dcbc25796b708254d6982
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38617
Reviewed-by: Yu-hsin Wang 
Reviewed-by: Ahbong Chang 
Maintainer: Gabe Black 
Tested-by: kokoro 
---
M src/arch/arm/fastmodel/SConscript
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Ahbong Chang: Looks good to me, approved
  Yu-hsin Wang: Looks good to me, approved
  Gabe Black: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/arch/arm/fastmodel/SConscript  
b/src/arch/arm/fastmodel/SConscript

index 3980373..f5516fa 100644
--- a/src/arch/arm/fastmodel/SConscript
+++ b/src/arch/arm/fastmodel/SConscript
@@ -244,7 +244,7 @@


 license_count = int(env['ARMLMD_LICENSE_COUNT'])
-arm_licenses = list((Value(i) for i in range(license_count)))
+arm_licenses = list((Value(object()) for i in range(license_count)))
 license_cycle = cycle(arm_licenses)

 class ArmFastModelComponent(object):

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38617
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: I56bc842ae66b8cb36d3dcbc25796b708254d6982
Gerrit-Change-Number: 38617
Gerrit-PatchSet: 3
Gerrit-Owner: Gabe Black 
Gerrit-Reviewer: Ahbong Chang 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Giacomo Travaglini 
Gerrit-Reviewer: Nikos Nikoleris 
Gerrit-Reviewer: Yu-hsin Wang 
Gerrit-Reviewer: kokoro 
Gerrit-CC: Earl Ou 
Gerrit-CC: Jui-min Lee 
Gerrit-MessageType: merged
___
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

[gem5-dev] Change in gem5/gem5[develop]: scons: Stop auto including the git tool from the default too override.

2020-12-21 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/38616 )


Change subject: scons: Stop auto including the git tool from the default  
too override.

..

scons: Stop auto including the git tool from the default too override.

SCons has a system of "tools", which basically detect versions of build
tools (compilers, linkers, etc) and set up an environment with the
appropriate build variable substitutions for that tool to be used.

For instance, there would be a "tool" for gcc, and it would detect if
gcc is present on the system, and if so would set the "CC" variable to
"gcc". An actually tool as defined by SCons would be a lot more
sophisticated than that and set more variables, but that's the basic
idea.

To help modularize the gem5 SConstruct file, I moved code which would
set up git commit hooks into a "tool" which helped modularize it and
reduce the size of SConstruct.

This isn't quite right since, while the code does detect if git was
used to check out the source (if there is a .git file at the root), it
doesn't really modify the environment at all. It will also be invoked
every time any environment is set up, although right now that will only
be the DefaultEnvironment, what's used when loose functions like
Builder or Command are called with, and the "main" environment which
all the others are Clone-d from.

Normally, when SCons sets up a new environment, either implicitly or
when Environment() is called, it sets up a bunch of built in tools
which are fixed within SCons itself. If you want, you can add a "tools"
argument to Environment (or to the DefaultEnvironment() function) which
will replace that list of tools. That can be used to make an
environment use the new "git" tool, but it isn't automatic.

SCons also lets you override default tools by creating your own with
the same name as the default. To make loading the git tool automatic,
I added an override "default" tool which, in addition to setting some
defaults which should apply to all environments, also pulled in other
tools, at that time "git" and "mercurial" (RIP).

Unfortunately, that meant that today, apparently particularly with
SCons version 4, *any* Environment would pull in "git", and all of
"git"'s dependencies, even if SCons wasn't set up enough for those to
work.

To break that dependency, this change stops the default tool from
automatically loading the git tool, although it does continue to set
other defaults which have very minimal external dependencies. When
creating the "main" Environment in the SConstruct, the "git" tool is
now added in explicitly. Since the list of tools replaces the original
and doesn't extend it, we have to add in "default" explicitly as well.

Really, the "git" tool should be converted from the tool interface into
something more appropriate, like perhaps a small module under
site_scons which site_init.py can import and call. When that happens,
main can be declared like normal again.

While making this change, I also got rid of a few nonstandard additions
to the main environment that were little used and not really necessary.
When reading the SConstruct, it wasn't very obvious where those extra
values were coming from, and they didn't really add any value.

Change-Id: I574db42fc2196bf62fc13d6754357c753ceb9117
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38616
Reviewed-by: Jason Lowe-Power 
Reviewed-by: Yu-hsin Wang 
Maintainer: Gabe Black 
Tested-by: kokoro 
---
M SConstruct
M site_scons/site_tools/default.py
2 files changed, 8 insertions(+), 16 deletions(-)

Approvals:
  Jason Lowe-Power: Looks good to me, but someone else must approve
  Yu-hsin Wang: Looks good to me, approved
  Gabe Black: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/SConstruct b/SConstruct
index 5033344..b5505ff 100755
--- a/SConstruct
+++ b/SConstruct
@@ -139,7 +139,7 @@
 #
 

-main = Environment()
+main = Environment(tools=['default', 'git'])

 from gem5_scons.util import get_termcap
 termcap = get_termcap()
@@ -259,7 +259,7 @@

 # Parse EXTRAS variable to build list of all directories where we're
 # look for sources etc.  This list is exported as extras_dir_list.
-base_dir = main.srcdir.abspath
+base_dir = Dir('#src').abspath
 if main['EXTRAS']:
 extras_dir_list = makePathListAbsolute(main['EXTRAS'].split(':'))
 else:
@@ -1027,7 +1027,7 @@
 # value of the variable.
 def build_config_file(target, source, env):
 (variable, value) = [s.get_contents().decode('utf-8') for s in source]
-with open(str(target[0]), 'w') as f:
+with open(str(target[0].abspath), 'w') as f:
 print('#define', variable, value, file=f)
 return None

@@ -1040,7 +1040,7 @@
 # extract variable name from Builder arg
 variable = str(target[0])
 # True target is config header file
-target = 

[gem5-dev] Re: Invitation to complete the gem5 Survey 2020!

2020-12-21 Thread Bobby Bruce via gem5-dev
This is a friendly reminder that you still have time to complete the 2020
gem5 survey if you have not already done so. This is a great chance to give
the gem5 project feedback which we will use to decide where to allocate
resources over the course of the next year. It only takes 10 minutes and is
entirely anonymous. The survey is open to both gem5 users and gem5
developers.

Kind regards,
Bobby
--
Dr. Bobby R. Bruce
Room 2235,
Kemper Hall, UC Davis
Davis,
CA, 95616

web: https://www.bobbybruce.net

Please consider making a submission to GI@ICSE '21:
http://geneticimprovementofsoftware.com/gi2021icse.html


On Fri, Dec 4, 2020 at 5:56 PM Bobby Bruce  wrote:

> Dear all,
>
> To all those willing, I wish to extend an invitation to participate in
> this year's gem5 survey. The purpose of this survey is to provide valuable
> feedback to the gem5 community as to which areas of the project we should
> focus on over the next year and beyond. This survey may be completed by
> anyone with a stake in gem5, from our developers to users, beginner or
> expert.
>
> Participating in this survey should take around 10 minutes to complete.
> Doing so is voluntary, and we assure you that all responses are
> confidential. Any results shared with the community will be published in
> the aggregate, without any connection to the individual. So please, feel
> free to be candid in your responses.
>
> To start the survey, please click the link below:
> https://ucdavis.co1.qualtrics.com/jfe/form/SV_4YgmHgpz3LzPkfb
>
> Thank you for your participation in this year's survey!
>
> Kind regards,
> Bobby
> --
> Dr. Bobby R. Bruce
> Room 2235,
> Kemper Hall, UC Davis
> Davis,
> CA, 95616
>
> web: https://www.bobbybruce.net
>
> Please consider making a submission to GI@ICSE '21:
> http://geneticimprovementofsoftware.com/gi2021icse.html
>
___
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

[gem5-dev] Jenkins build is back to normal : Nightly #167

2020-12-21 Thread jenkins-no-reply--- via gem5-dev
See 
___
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


[gem5-dev] Change in gem5/gem5[develop]: ISA: Extended Instructions adopted in RISCV arch XUANTIE C910 CPU

2020-12-21 Thread Huang Jiasen (Gerrit) via gem5-dev
Huang Jiasen has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/38576 )



Change subject: ISA: Extended Instructions adopted in RISCV arch XUANTIE  
C910 CPU

..

ISA: Extended Instructions adopted in RISCV arch XUANTIE C910 CPU

Change-Id: I3fdf1dfbd0c0a88d4cc03b3663660265b9f78d76
---
M src/arch/riscv/isa/decoder.isa
1 file changed, 186 insertions(+), 2 deletions(-)



diff --git a/src/arch/riscv/isa/decoder.isa b/src/arch/riscv/isa/decoder.isa
index 5ef68fe..009dd70 100644
--- a/src/arch/riscv/isa/decoder.isa
+++ b/src/arch/riscv/isa/decoder.isa
@@ -418,10 +418,193 @@
 }
 }

+0x02: decode FUNCT3 { // FUNCT3: <14:12>
+format ROp {
+0x2: ext({{
+uint32_t msb = FUNCT6; // <31:26>
+uint32_t lsb = SHAMT6; // <25:20>
+uint64_t mask = 0x;
+Rs1 = (Rs1 << (63 - msb));
+Rs1 = (Rs1 >> (63 - msb));
+Rs1 = Rs1 >> lsb;
+if ((msb - lsb + 1) > 63) { mask = 0; }
+else {
+mask = mask >> (msb - lsb + 1);
+mask = mask << (msb - lsb + 1);
+}
+
+if (Rs1 >> (msb - lsb)) { Rs1 = Rs1 | mask; }
+
+Rd = Rs1;
+}});
+0x3: extu({{
+uint32_t msb = FUNCT6; // <31:26>
+uint32_t lsb = SHAMT6; // <25:20>
+Rs1 = (Rs1 << (63 - msb));
+Rs1 = (Rs1 >> (63 - msb));
+Rs1 = (Rs1 >> lsb);
+Rd = Rs1;
+}});
+0x1: decode FUNCT5 { // FUNCT5: <31:27>
+0x0: addsl({{
+Rd = Rs1 + (Rs2 << FUNCT2);
+}});
+0x2: decode FUNCT2_HI {
+0x0: srri({{
+Rd = Rs1 >> SHAMT6;
+Rd = Rd | (Rs1 << (64 - SHAMT6));
+}});
+0x1: decode FUNCT2_LO {
+0x0: srriw({{
+uint32_t op1_tmp = Rs1_sd & 0x;
+uint32_t imm_use = RS2 & 0x1f;
+uint32_t result = (op1_tmp >> imm_use);
+result = result | (op1_tmp << (32 -  
imm_use));
+//Rd = (result & 0x8000) ?  
(0x | result) : (result & 0x); // Exactly  
the same as (int32_t)(result)

+Rd = (int32_t)(result);
+}});
+}
+}
+0x4: decode FUNCT2 {
+0x0: mula({{
+if (Rs2_sd == 0) {
+Rd = Rs1_sd;
+printf("mveqz::execute\n");
+} else {
+uint64_t tmp = (Rs1_sd * Rs2_sd) &  
0x;

+uint64_t tmp_Rd = Rd;
+printf("~mula::execute  
(rs1 * rs2)[63:0]_hi_32 = %x (rs1 * rs2)[63:0]_lo_32 = %x tmp_Rd_hi_32 = %x  
tmp_Rd_lo_32 = %x\n", (int32_t)((tmp >> 32) & 0x), (int32_t)(tmp &  
0x), (int32_t)((tmp_Rd >> 32) & 0x), (int32_t)(tmp_Rd &  
0x));

+Rd = Rd + tmp;
+printf("Rd_hi_32 = %x Rd_lo_32 = %x\n",  
(int32_t)((Rd >> 32) & 0x), (int32_t)(Rd & 0x));

+}
+}}, IntMultOp);
+0x1: muls({{
+uint64_t tmp = (Rs1_sd * Rs2_sd) &  
0x;

+uint64_t tmp_Rd = Rd;
+printf("~muls::execute  
(rs1 * rs2)[63:0]_hi_32 = %x (rs1 * rs2)[63:0]_lo_32 = %x tmp_Rd_hi_32 = %x  
tmp_Rd_lo_32 = %x\n", (int32_t)((tmp >> 32) & 0x), (int32_t)(tmp &  
0x), (int32_t)((tmp_Rd >> 32) & 0x), (int32_t)(tmp_Rd &  
0x));

+Rd = Rd - tmp;
+printf("Rd_hi_32 = %x Rd_lo_32 = %x\n",  
(int32_t)((Rd >> 32) & 0x), (int32_t)(Rd & 0x));

+}}, IntMultOp);
+0x2: mulaw({{
+//int64_t tmp = (Rd_sd & 0x) +  
(int32_t)((int32_t)(Rs1_sd & 0x) * (int32_t)(Rs2_sd & 0x));
+int64_t tmp = (Rd_sd & 0x) +  
(int32_t)((Rs1_sd & 0x) * (Rs2_sd & 0x));

+int32_t tmp_lo_32 = tmp & 0x;
+