From: bugzilla-daemon@libre-soc.org
To: libre-riscv-dev@lists.libre-riscv.org
Subject: [libre-riscv-dev] [Bug 363] inconsistency between isel and mfcr and crand unit test on bit-ordering of CR
Date: Sun, 07 Jun 2020 20:19:47 +0000
Message-ID: <bug-363-13-xlaaV0WuKI@https.bugs.libre-soc.org/> (raw)
In-Reply-To: <bug-363-13@https.bugs.libre-soc.org/>
https://bugs.libre-soc.org/show_bug.cgi?id=363
Luke Kenneth Casson Leighton <lkcl@lkcl.net> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|CONFIRMED |RESOLVED
Resolution|--- |FIXED
--- Comment #8 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
michael i've just been investigating by adding extra unit tests that
i believe to be reasonable:
def test_1_mcrf(self):
for i in range(20):
src = random.randint(0, 7)
dst = random.randint(0, 7)
lst = [f"mcrf {src}, {dst}"]
cr = random.randint(0, (1<<32)-1)
self.run_tst_program(Program(lst), initial_cr=cr)
def test_0_mcrf(self):
for i in range(8):
lst = [f"mcrf 5, {i}"]
cr = 0xfeff0001
self.run_tst_program(Program(lst), initial_cr=cr)
(i used numbering to get them to run first)
test_0_mcrf one fails straight away (even on the first loop):
self.assertEqual(expected_cr, real_cr, code)
AssertionError: 14 != 15 : mcrf 5, 0
a clue is here:
def op_mcrf(self, CR):
print ("op_mcrf", hex(CR.si.value), "BF", BF, "BFA", BFA)
CR.si[(4 * BF) + 32:(4 * BF) + 35 + 1] = CR.si[(4 * BFA) + 32:(4 * BFA)
+ 35 + 1]
print ("op_mcrf", hex(CR.si.value))
this prints out:
op_mcrf 0xfeff0001 BF 5 BFA 0
op_mcrf 0xfeff0f01
and... oink, the write_cr is invalid. it's set to 1.
cr_sel = yield dec2.e.write_cr.data
expected_cr = simulator.cr.get_range().value
print(f"CR whole: {expected_cr:x}, sel {cr_sel}")
CR whole: feff0f01, sel 1
ah HA!
--- a/src/soc/decoder/power_decoder2.py
+++ b/src/soc/decoder/power_decoder2.py
@@ -445,7 +445,7 @@ class DecodeCROut(Elaboratable):
comb += self.cr_bitfield.data.eq(0)
comb += self.cr_bitfield.ok.eq(self.rc_in) # only when RC=1
with m.Case(CROutSel.BF):
- comb += self.cr_bitfield.data.eq(self.dec.FormX.BF[0:-1])
+ comb += self.cr_bitfield.data.eq(self.dec.FormX.BF)
comb += self.cr_bitfield.ok.eq(1)
with m.Case(CROutSel.BT):
that's it! that's all it was. what a pain.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev
next prev parent reply index
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-04 19:51 [libre-riscv-dev] [Bug 363] New: inconsistency between isel and mfcr " bugzilla-daemon
2020-06-04 19:55 ` [libre-riscv-dev] [Bug 363] " bugzilla-daemon
2020-06-04 20:52 ` [libre-riscv-dev] [Bug 363] inconsistency between isel and mfcr and crand " bugzilla-daemon
2020-06-05 3:55 ` bugzilla-daemon
2020-06-05 3:55 ` bugzilla-daemon
2020-06-05 13:39 ` bugzilla-daemon
2020-06-05 13:58 ` bugzilla-daemon
2020-06-05 19:41 ` bugzilla-daemon
2020-06-05 19:47 ` bugzilla-daemon
2020-06-07 20:19 ` bugzilla-daemon [this message]
2020-06-07 20:25 ` bugzilla-daemon
2020-06-07 20:31 ` bugzilla-daemon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-363-13-xlaaV0WuKI@https.bugs.libre-soc.org/ \
--to=bugzilla-daemon@libre-soc.org \
--cc=libre-riscv-dev@lists.libre-riscv.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Libre RISC-V Mailing list Archives (accessible via public-inbox)
Archives are clonable: git clone --mirror https://inbox.libre-soc.org/libre-riscv-dev
Example config snippet for mirrors
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git