Skip to content

Commit

Permalink
Fix bug in Juno GUPs
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon David Hammond authored and Simon David Hammond committed Jul 26, 2018
1 parent d7f9426 commit a37393f
Showing 1 changed file with 27 additions and 28 deletions.
55 changes: 27 additions & 28 deletions test/asm/gups.juno
Original file line number Diff line number Diff line change
Expand Up @@ -13,42 +13,41 @@ ADD r1 r7 r7
# -------------------------------------------------------
# Initialize the arrays used by GUPS in a loop
# r5 is the counter register, ++r5 on each iteration
# r6 is address of valyes
# r6 is address of values
# r7 is address of indices
# -------------------------------------------------------
INITLOOP:
ADD r3 r5 r5
ADD r4 r6 r6
ADD r4 r7 r7
MUL r5 r4 r13
MUL r5 r4 r12
ADD r6 r13 r13
ADD r7 r12 r12
GTZLOOP:
RAND r8
JGTZ r8 SKIPZERO
XOR r9 r9 r9
SUB r9 r8 r8
SKIPZERO:
JLTZ r8 GTZLOOP
MOD r8 r2 r9
AND r9 r14 r13
SUB r9 r13 r9
STORE r9 r6
STORE r9 r7
AND r9 r14 r15
SUB r9 r15 r15
MUL r15 r4 r11
STORE r11 r13
STORE r11 r12
SUB r2 r5 r15
ADD r3 r5 r5
JGTZ r15 INITLOOP
# -------------------------------------------------------
EXITINIT:
XOR r5 r5 r5
XOR r6 r6 r6
XOR r7 r7 r7
MUL r4 r2 r6
ADD r1 r6 r6
ADD r1 r7 r7
XOR r12 r12 r12
XOR r13 r13 r13
XOR r11 r11 r11
XOR r15 r15 r15
# -------------------------------------------------------
GUPSLOOP:
XOR r8 r8 r8
XOR r9 r9 r9
LOAD r7 r8
LOAD r8 r9
XOR r9 r3 r9
STORE r9 r8
MUL r5 r4 r12
ADD r12 r7 r12
LOAD r12 r13
ADD r13 r6 r11
LOAD r11 r12
XOR r12 r12 r12
STORE r12 r11
SUB r2 r5 r15
ADD r3 r5 r5
ADD r4 r7 r7
SUB r2 r5 r8
JGTZ r8 GUPSLOOP
JGTZ r15 GUPSLOOP
HALT

0 comments on commit a37393f

Please sign in to comment.