Mod 3

Submission Date: 2024/9/14 16:15:55
Status: Accepted
Author: value
Lines: 51

VSM

# 2048 UInt = 16MAB * 4PE * 32 UInt elems = 1024 LW
# 1024 LW / 8 L1B = 128 LW/L1B
# Outline
# v = float(lm0)
# 1/3 = '0x1.5555555555555p-2'
# ln0 = ftoi(v - floor(v * 1/3) * 3) # subtract the quotient to get the remainder.
# Consts
# 8388608 is 2**23. Its weight for the LSB of mantissa is 1.0
imm f"8388608" $r0/1000
# py>>> print(format(unpack('>L', pack('>f', 1/3))[0],'032b'))
#imm i"0x3eaaaaab" $lr2/1000 # 0b0(+)_01111101(125=-2+127)_01010101010101010101011
imm f"0.3333333333333333" $r2/1000
imm f"-3" $r4/1000
#d getf $lr0 3
# *8
# imm i"2" $nowrite
# llsl $l1bid $aluf $t
# #d get $t 1
# nop
# s0 = float(m[8cycle+l1b])
ior $r0 $m0v $nowrite # Create 2**23 + 1.0 * n = 2**23 + n in float
fvadd $aluf -$r0 $s0v # Calculate (2 ** 23 + n) - 2**23, equals to n
# n0 = s0 / 3
fvmul $mauf $r2 $nowrite
#d getf $n0 4
# n0 = floor(n0)
ffloor $mauf $nowrite
# n0 = -3n0 + s0
fvfma $r4 $aluf $s0v $nowrite
# n0 = ftoi(n0)
fftoi $mauf $n0v # n[cycle]ncb[l1b]mp = f(m[8cycle+l1b]ncb[l1b]mp)
#d getf $n0 4
ior $r0 $m4v $nowrite
fvadd $aluf -$r0 $s0v
fvmul $mauf $r2 $nowrite
ffloor $mauf $nowrite
fvfma $r4 $aluf $s0v $nowrite
fftoi $mauf $n4v
ior $r0 $m8v $nowrite
fvadd $aluf -$r0 $s0v
fvmul $mauf $r2 $nowrite
ffloor $mauf $nowrite
fvfma $r4 $aluf $s0v $nowrite
fftoi $mauf $n8v
ior $r0 $m12v $nowrite
fvadd $aluf -$r0 $s0v
fvmul $mauf $r2 $nowrite
ffloor $mauf $nowrite
fvfma $r4 $aluf $s0v $nowrite
fftoi $mauf $n12v
ior $r0 $m16v $nowrite
fvadd $aluf -$r0 $s0v
fvmul $mauf $r2 $nowrite
ffloor $mauf $nowrite
fvfma $r4 $aluf $s0v $nowrite
fftoi $mauf $n16v
ior $r0 $m20v $nowrite
fvadd $aluf -$r0 $s0v
fvmul $mauf $r2 $nowrite
ffloor $mauf $nowrite
fvfma $r4 $aluf $s0v $nowrite
fftoi $mauf $n20v
ior $r0 $m24v $nowrite
fvadd $aluf -$r0 $s0v
fvmul $mauf $r2 $nowrite
ffloor $mauf $nowrite
fvfma $r4 $aluf $s0v $nowrite
fftoi $mauf $n24v
ior $r0 $m28v $nowrite
fvadd $aluf -$r0 $s0v
fvmul $mauf $r2 $nowrite
ffloor $mauf $nowrite
fvfma $r4 $aluf $s0v $nowrite
fftoi $mauf $n28v
#nop/2
#ipassa $llm0v8 $lln0v8
# forall cycle, mab, pe. lb[64cycle+4mab+pe] = n[cycle]ncbm[mab]p[pe]
# => forall cycle, mab, pe. lb[64cycle+4mab+pe]ncb[l1b]::ULong = f(m[8cycle+l1b]ncb[l1b]m[mab]p[pe])::UInt
# d set $n0n0c0b0m0p0 1 s00000001_0 #@0
# d set $n1n0c0b0m0p0 1 s00000002_0 #@8
# d set $n2n0c0b0m0p0 1 s00000003_0
# d set $n3n0c0b0m0p0 1 s00000004_0
# d set $n0n0c0b0m0p0 1 s00000005_0 #@0
# d set $n0n0c0b1m0p0 1 s00000006_0 #@256
# d set $n0n0c0b2m0p0 1 s00000007_0 #@512
# d set $n0n0c0b3m0p0 1 s00000008_0
# d set $n0n0c0b0m0p0 1 s00000009_0 #@0
# d set $n0n0c0b0m1p0 1 s0000000a_0 #@128
# d set $n0n0c0b0m2p0 1 s0000000b_0 #@1
# d set $n0n0c0b0m3p0 1 s0000000c_0 #@129
# d set $n0n0c0b0m0p1 1 s0000000d_0 #@32
# l1bmd $n0v $lb0 # 4W/PE => 4LW/PE = 256LW; lb[0..255]
# nop/2
# l2bmd $lb0 $lc0
# l2bmd $lb32 $lc256
# l2bmd $lb64 $lc512
# l2bmd $lb96 $lc768
# l2bmd $lb128 $lc1024
# l2bmd $lb160 $lc1280
# l2bmd $lb192 $lc1536
# l2bmd $lb224 $lc1792
# nop/3
# l2bmb@[0] $lc0 $lb0
# l2bmb@[0] $lc64 $lb64
# l2bmb@[0] $lc128 $lb128
# l2bmb@[0] $lc192 $lb192
# l2bmb@[0] $lc256 $lb256
# l2bmb@[0] $lc320 $lb320
# l2bmb@[0] $lc384 $lb384
# l2bmb@[0] $lc448 $lb448
# l2bmb@[0] $lc512 $lb512
# l2bmb@[0] $lc576 $lb576
# l2bmb@[0] $lc640 $lb640
# l2bmb@[0] $lc704 $lb704
# l2bmb@[0] $lc768 $lb768
# l2bmb@[0] $lc832 $lb832
# l2bmb@[0] $lc896 $lb896
# l2bmb@[0] $lc960 $lb960
# l2bmb@[0] $lc1024 $lb1024
# l2bmb@[0] $lc1088 $lb1088
# l2bmb@[0] $lc1152 $lb1152
# l2bmb@[0] $lc1216 $lb1216
# l2bmb@[0] $lc1280 $lb1280
# l2bmb@[0] $lc1344 $lb1344
# l2bmb@[0] $lc1408 $lb1408
# l2bmb@[0] $lc1472 $lb1472
# l2bmb@[0] $lc1536 $lb1536
# l2bmb@[0] $lc1600 $lb1600
# l2bmb@[0] $lc1664 $lb1664
# l2bmb@[0] $lc1728 $lb1728
# l2bmb@[0] $lc1792 $lb1792
# l2bmb@[0] $lc1856 $lb1856
# l2bmb@[0] $lc1920 $lb1920
# l2bmb@[0] $lc1984 $lb1984
# l1bmd $lb0 $n0v
# l1bmd $lb256 $n4v
# l1bmd $lb512 $n8v
# l1bmd $lb768 $n12v
# l1bmd $lb1024 $n16v
# l1bmd $lb1280 $n20v
# l1bmd $lb1536 $n24v
# l1bmd $lb1792 $n28v
#d get $lb0 64
#nop/2
# forall cycle, mab, pe. lln[cycle]m[mab]p[pe] = llb[64cycle+4mab+pe]
# forall cycle, mab, pe. n[cycle]m[mab]p[pe] = b[64cycle+4mab+pe]
#l1bmp $lb0 $ln0v
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Standard Output

ACCEPTED!! score=51 j=51 m=0 bytes=1191
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Standard Error

------------------- vsm --------------------
# ======= In(0): ((16_MAB:1, 4_PE:1, 16:1, 2_W:1))@LM0 / UInt =======
d set $lm0m0p0 1 000000680000007F # values=[104, 127] / UInt @[0],[1]
d set $lm2m0p0 1 00000061000000C7 # values=[97, 199] / UInt @[2],[3]
d set $lm4m0p0 1 0000005F000000F8 # values=[95, 248] / UInt @[4],[5]
d set $lm6m0p0 1 0000002700000007 # values=[39, 7] / UInt @[6],[7]
d set $lm8m0p0 1 0000001200000096 # values=[18, 150] / UInt @[8],[9]
d set $lm10m0p0 1 000000500000003C # values=[80, 60] / UInt @[10],[11]
d set $lm12m0p0 1 0000006700000098 # values=[103, 152] / UInt @[12],[13]
d set $lm14m0p0 1 0000007C000000D9 # values=[124, 217] / UInt @[14],[15]
d set $lm16m0p0 1 0000005B000000CA # values=[91, 202] / UInt @[16],[17]
d set $lm18m0p0 1 000000BC0000009C # values=[188, 156] / UInt @[18],[19]
d set $lm20m0p0 1 0000008300000010 # values=[131, 16] / UInt @[20],[21]
d set $lm22m0p0 1 00000027000000DB # values=[39, 219] / UInt @[22],[23]
d set $lm24m0p0 1 000000DB000000DA # values=[219, 218] / UInt @[24],[25]
d set $lm26m0p0 1 000000EB000000C1 # values=[235, 193] / UInt @[26],[27]
d set $lm28m0p0 1 000000D600000092 # values=[214, 146] / UInt @[28],[29]
d set $lm30m0p0 1 00000011000000AA # values=[17, 170] / UInt @[30],[31]
d set $lm0m0p1 1 0000001F00000005 # values=[31, 5] / UInt @[32],[33]
d set $lm2m0p1 1 000000E000000083 # values=[224, 131] / UInt @[34],[35]
d set $lm4m0p1 1 000000B2000000AC # values=[178, 172] / UInt @[36],[37]
d set $lm6m0p1 1 0000009400000084 # values=[148, 132] / UInt @[38],[39]
d set $lm8m0p1 1 0000004900000070 # values=[73, 112] / UInt @[40],[41]
d set $lm10m0p1 1 000000B1000000C1 # values=[177, 193] / UInt @[42],[43]
d set $lm12m0p1 1 000000350000003E # values=[53, 62] / UInt @[44],[45]
d set $lm14m0p1 1 0000004400000086 # values=[68, 134] / UInt @[46],[47]
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX