From 03ee49f424424df22a6a4c1d20a73b1687a11074 Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Thu, 9 Feb 2012 03:30:55 -0800 Subject: [PATCH] fix 32-bit AMOs to upper halves of 64-bit words thanks, torture! --- rocket/src/main/scala/nbdcache.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rocket/src/main/scala/nbdcache.scala b/rocket/src/main/scala/nbdcache.scala index dec60832..60a7c5f3 100644 --- a/rocket/src/main/scala/nbdcache.scala +++ b/rocket/src/main/scala/nbdcache.scala @@ -635,11 +635,13 @@ class AMOALU extends Component { val less = Mux(cmp_lhs === cmp_rhs, cmp_diff, Mux(sgned, cmp_lhs, cmp_rhs)) val cmp_out = Mux(min === less, io.lhs, io.rhs) - io.out := Mux(io.cmd === M_XA_ADD, adder_out, + val out = Mux(io.cmd === M_XA_ADD, adder_out, Mux(io.cmd === M_XA_SWAP, io.rhs, Mux(io.cmd === M_XA_AND, io.lhs & io.rhs, Mux(io.cmd === M_XA_OR, io.lhs | io.rhs, /* MIN[U]/MAX[U] */ cmp_out)))); + + io.out := Mux(word, Cat(out(31,0), out(31,0)).toUFix, out) } class HellaCacheDM extends Component {