[gem5-dev] Change in gem5/gem5[develop]: arch-sparc: Fix an operator precedence bug in the iob device.

2021-03-05 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/40955 )


Change subject: arch-sparc: Fix an operator precedence bug in the iob  
device.

..

arch-sparc: Fix an operator precedence bug in the iob device.

Like in the nomali library, this bug is in some code making a bitmask
where what bits are enabled depends on some conditions. It used ?: to
evaluate the conditions and | to aggregate the bits, but didn't use any
()s, so the | happened first, then the ?:s. This would generate an
incorrect bitmask.

Change-Id: Iabcc8a9fd38cde5de3c0627a3b143407247c0c0e
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40955
Maintainer: Gabe Black 
Tested-by: kokoro 
Reviewed-by: Boris Shingarov 
---
M src/dev/sparc/iob.cc
1 file changed, 2 insertions(+), 2 deletions(-)

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



diff --git a/src/dev/sparc/iob.cc b/src/dev/sparc/iob.cc
index a0d1982..624563e 100644
--- a/src/dev/sparc/iob.cc
+++ b/src/dev/sparc/iob.cc
@@ -101,8 +101,8 @@

 if (accessAddr >= IntCtlAddr && accessAddr < IntCtlAddr +  
IntCtlSize) {

 int index = (accessAddr - IntCtlAddr) >> 3;
-uint64_t data = intCtl[index].mask  ? 1 << 2 : 0 |
-intCtl[index].pend  ? 1 << 0 : 0;
+uint64_t data = (intCtl[index].mask  ? (1 << 2) : 0) |
+(intCtl[index].pend  ? (1 << 0) : 0);
 pkt->setBE(data);
 return;
 }



10 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the  
submitted one.

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/40955
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: Iabcc8a9fd38cde5de3c0627a3b143407247c0c0e
Gerrit-Change-Number: 40955
Gerrit-PatchSet: 12
Gerrit-Owner: Gabe Black 
Gerrit-Reviewer: Andreas Sandberg 
Gerrit-Reviewer: Boris Shingarov 
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]: arch-sparc: Fix an operator precedence bug in the iob device.

2021-02-08 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/40955 )



Change subject: arch-sparc: Fix an operator precedence bug in the iob  
device.

..

arch-sparc: Fix an operator precedence bug in the iob device.

Like in the nomali library, this bug is in some code making a bitmask
where what bits are enabled depends on some conditions. It used ?: to
evaluate the conditions and | to aggregate the bits, but didn't use any
()s, so the | happened first, then the ?:s. This would generate an
incorrect bitmask.

Change-Id: Iabcc8a9fd38cde5de3c0627a3b143407247c0c0e
---
M src/dev/sparc/iob.cc
1 file changed, 2 insertions(+), 2 deletions(-)



diff --git a/src/dev/sparc/iob.cc b/src/dev/sparc/iob.cc
index a0d1982..624563e 100644
--- a/src/dev/sparc/iob.cc
+++ b/src/dev/sparc/iob.cc
@@ -101,8 +101,8 @@

 if (accessAddr >= IntCtlAddr && accessAddr < IntCtlAddr +  
IntCtlSize) {

 int index = (accessAddr - IntCtlAddr) >> 3;
-uint64_t data = intCtl[index].mask  ? 1 << 2 : 0 |
-intCtl[index].pend  ? 1 << 0 : 0;
+uint64_t data = (intCtl[index].mask  ? (1 << 2) : 0) |
+(intCtl[index].pend  ? (1 << 0) : 0);
 pkt->setBE(data);
 return;
 }

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/40955
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: Iabcc8a9fd38cde5de3c0627a3b143407247c0c0e
Gerrit-Change-Number: 40955
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black 
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