(no commit message)
authorlkcl <lkcl@web>
Wed, 2 Oct 2019 13:31:12 +0000 (14:31 +0100)
committerIkiWiki <ikiwiki.info>
Wed, 2 Oct 2019 13:31:12 +0000 (14:31 +0100)
simple_v_extension/specification/bitmanip.mdwn

index 3f0b60dbf831f9b5c39442bcfdb9af9f5f5035d4..0a572b7be47a52567c01c7484ee36ecf91bc586a 100644 (file)
@@ -143,6 +143,9 @@ Pseudo-code:
         setting_mode = rs2 == x0 or (regs[rs2] & 1)
         while i < XLEN:
             bit = 1<<i
+            if rs2 != x0 and (regs[rs2] & bit):
+                # reset searching
+                setting_mode = False
             if setting_mode:
                 if regs[rs1] & bit: # found a bit in rs1: stop setting rd
                     setting_mode = False
@@ -182,6 +185,9 @@ Pseudo-code:
         setting_mode = rs2 == x0 or (regs[rs2] & 1)
         while i < XLEN:
             bit = 1<<i
+            if rs2 != x0 and (regs[rs2] & bit):
+                # reset searching
+                setting_mode = False
             if setting_mode:
                 regs[rd] |= bit
                 if regs[rs1] & bit: # found a bit in rs1: stop setting rd