aboutsummaryrefslogtreecommitdiffhomepage
path: root/problems
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-09-19 23:13:08 +0900
committernsfisis <nsfisis@gmail.com>2024-09-19 23:13:30 +0900
commitcc170e93f6092a81d1fcafe54f0ce13ea76a678b (patch)
tree80084f8101fda3e20860c5530f120b020d66b723 /problems
parente803719bd220a0449a06c29d798ffa0d2a226ef2 (diff)
downloadmncore-challenge-cc170e93f6092a81d1fcafe54f0ce13ea76a678b.tar.gz
mncore-challenge-cc170e93f6092a81d1fcafe54f0ce13ea76a678b.tar.zst
mncore-challenge-cc170e93f6092a81d1fcafe54f0ce13ea76a678b.zip
18-Inversion-Small
Diffstat (limited to 'problems')
-rw-r--r--problems/18-Inversion-Small/02.vsm8
-rw-r--r--problems/18-Inversion-Small/03.vsm32
2 files changed, 36 insertions, 4 deletions
diff --git a/problems/18-Inversion-Small/02.vsm b/problems/18-Inversion-Small/02.vsm
index 4a1c10e..641ff18 100644
--- a/problems/18-Inversion-Small/02.vsm
+++ b/problems/18-Inversion-Small/02.vsm
@@ -1,7 +1,7 @@
# $ls[0:32] = k
-# $ls[32:64] = j < k
-# $lr[0:32] = A[j] > A[k]
-# $lr[0:32] = (j < k) and (A[j] > A[k])
+# $ls[32:64] = j >= k
+# $lr[0:32] = A[j] < A[k]
+# $lr[0:32] = (j >= k) and (A[j] < A[k])
imm i"1" $s3/1000
imm i"2" $s5/1000
imm i"3" $s7/1000
@@ -39,7 +39,7 @@ llnot $lr8v $lr8v
llnot $lr16v $lr16v
llnot $lr24v $lr24v
-# d getd $ls0n0c0b0p0 16
+# d getd $ls32n0c0b0p0 16
# d getd $lr0n0c0b0p0 16
# 4.times { |i| puts "land $ls#{32+i*8}v $lr#{i*8}v $lr#{i*8}v" }
diff --git a/problems/18-Inversion-Small/03.vsm b/problems/18-Inversion-Small/03.vsm
new file mode 100644
index 0000000..ac6bc56
--- /dev/null
+++ b/problems/18-Inversion-Small/03.vsm
@@ -0,0 +1,32 @@
+imm i"1" $s3/1000
+imm i"2" $s5/1000
+imm i"3" $s7/1000
+imm i"4" $s9/1000
+iadd $aluf $s3v2 $s11v2
+iadd $aluf $s9 $s19v2
+iadd $aluf $s9 $s27v2/1110
+
+lpackbit $mabid $ln0 $t
+lpassa $llm0v $llr0v
+lpassa $llm16v $llr16v
+linc $lmt0 $t
+
+lsub $mabid $ls0v $omr1
+lsub $lr0v $t $omr1/$imr1
+lpassa/$imr1 $ls2 $nowrite
+lsub $mabid $ls8v $omr1; l1bmrliadd $aluf $lbi
+lsub $lr8v $t $omr1/$imr1; l1bmm $lbi $lm0v
+lpassa/$imr1 $ls2 $nowrite
+lsub $mabid $ls16v $omr1; l1bmrliadd $aluf $lbi
+lsub $lr16v $t $omr1/$imr1; l1bmm $lbi $lm8v
+lpassa/$imr1 $ls2 $nowrite
+lsub $mabid $ls24v $omr1; l1bmrliadd $aluf $lbi
+lsub $lr24v $t $omr1/$imr1; l1bmm $lbi $lm16v
+lpassa/$imr1 $ls2 $nowrite
+l1bmrliadd $aluf $lbi
+l1bmm $lbi $lm24v
+
+lpackbit $mabid $ln0 $t
+nop
+l1bmrliadd $lmt0 $lbi
+l1bmm $lbi $ln0