aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChih-Min Chao <48193236+chihminchao@users.noreply.github.com>2020-07-15 16:04:23 +0800
committerGitHub <noreply@github.com>2020-07-15 01:04:23 -0700
commit759f4eba829d299eb34cd1568d3f4694e0d198cb (patch)
tree85c581b8147272efeb3b58c581aed8e4d803d8c9
parentf4904b677e8edfca5b48ff278e43abc5a68f287c (diff)
downloadspike-759f4eba829d299eb34cd1568d3f4694e0d198cb.zip
spike-759f4eba829d299eb34cd1568d3f4694e0d198cb.tar.gz
spike-759f4eba829d299eb34cd1568d3f4694e0d198cb.tar.bz2
commitlog: fix vmvnfr.v register information (#506)
Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
-rw-r--r--riscv/insns/vmvnfr_v.h21
1 files changed, 17 insertions, 4 deletions
diff --git a/riscv/insns/vmvnfr_v.h b/riscv/insns/vmvnfr_v.h
index 0813d69..aedb521 100644
--- a/riscv/insns/vmvnfr_v.h
+++ b/riscv/insns/vmvnfr_v.h
@@ -4,11 +4,24 @@ const reg_t baseAddr = RS1;
const reg_t vd = insn.rd();
const reg_t vs2 = insn.rs2();
const reg_t len = insn.rs1() + 1;
-require((vd & (len - 1)) == 0);
-require((vs2 & (len - 1)) == 0);
+require_align(vd, len);
+require_align(vs2, len);
const reg_t size = len * P.VU.vlenb;
+
+//register needs one-by-one copy to keep commitlog correct
if (vd != vs2 && P.VU.vstart < size) {
- memcpy(&P.VU.elt<uint8_t>(vd, P.VU.vstart, true),
- &P.VU.elt<uint8_t>(vs2, P.VU.vstart), size - P.VU.vstart);
+ reg_t i = P.VU.vstart / P.VU.vlenb;
+ reg_t off = P.VU.vstart % P.VU.vlenb;
+ if (off) {
+ memcpy(&P.VU.elt<uint8_t>(vd + i, off, true),
+ &P.VU.elt<uint8_t>(vs2 + i, off), P.VU.vlenb - off);
+ i++;
+ }
+
+ for (; i < len; ++i) {
+ memcpy(&P.VU.elt<uint8_t>(vd + i, 0, true),
+ &P.VU.elt<uint8_t>(vs2 + i, 0), P.VU.vlenb);
+ }
}
+
P.VU.vstart = 0;