From: Luke Kenneth Casson Leighton Date: Sun, 7 Oct 2018 07:03:11 +0000 (+0100) Subject: add rd bit-setting function X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6da01eab5e40b1e91a7406e6f9ad5ff5ef50793d;p=riscv-isa-sim.git add rd bit-setting function --- diff --git a/riscv/sv.cc b/riscv/sv.cc index 8088ef4..6979e44 100644 --- a/riscv/sv.cc +++ b/riscv/sv.cc @@ -189,3 +189,16 @@ uint64_t sv_insn_t::_rvc_spoffs_imm(uint64_t elwidth, uint64_t offs) return offs; } +// for use in predicated branches. sets bit N if val=true; clears bit N if false +uint64_t sv_insn_t::rd_bitset(uint64_t bit, bool set) +{ + reg_t reg = rd(); + uint64_t val = READ_REG(reg); + if (set) { + val |= (1<