aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-09-03 06:12:22 +0900
committernsfisis <nsfisis@gmail.com>2024-09-03 06:12:22 +0900
commitf6baf93269d18e65518539a5b28de2e99a7c1d61 (patch)
tree160940def9bc4ac4b00d27824660548232b59fde
parentc106b1fbea2a162b2c0ccb3d79163cab00a2bf74 (diff)
downloadmncore-challenge-f6baf93269d18e65518539a5b28de2e99a7c1d61.tar.gz
mncore-challenge-f6baf93269d18e65518539a5b28de2e99a7c1d61.tar.zst
mncore-challenge-f6baf93269d18e65518539a5b28de2e99a7c1d61.zip
12-Convert-Endian
-rw-r--r--problems/12-Convert-Endian/02.vsm24
1 files changed, 24 insertions, 0 deletions
diff --git a/problems/12-Convert-Endian/02.vsm b/problems/12-Convert-Endian/02.vsm
new file mode 100644
index 0000000..234b7bf
--- /dev/null
+++ b/problems/12-Convert-Endian/02.vsm
@@ -0,0 +1,24 @@
+# n = 6909045637428952499
+# bin = n.to_s(2).rjust(64, '0')
+# ds = bin.each_char.each_slice(8).map(&:join)
+#
+# 8.times { |i| puts "[#{i}] = #{ds[i]}" }
+# puts
+# 8.times { |i| puts "[#{i}] = #{ds[8-i-1]}" }
+
+imm ui"0x000000FF" $s0
+imm ui"0x0000FF00" $s1
+imm ui"0x00FF0000" $s2
+imm ui"0xFF000000" $s3
+imm i"8" $s4
+imm i"24" $s5
+
+iand $m0 $s0v $r0v
+iand $m1 $s0v $r4v
+
+nop
+ilsl $r[0,1,4,5] $s[5,4,5,4] $r8v
+uilsr $r[2,3,6,7] $s[4,5,4,5] $nowrite
+ior $r8v $aluf $s16v $r16v
+nop
+ior $r[0,0,16,18] $s[0,0,17,19] $n[3,2,1,0]