On 6/2/23 08:52, Peter Maydell wrote:
+# Load/store single structure
+
+%ldst_single_selem 13:1 21:1 !function=plus_1
+# The index is made up from bits Q, S and the size; we may then need to scale
+# it down by the size.
+%ldst_single_index q:1 s:1 sz:2
+%ldst_single_index_scaled q:1 s:1 sz:2 scale:3 !function=uimm_scaled_down
+%ldst_single_repl_scale 10:2
+
+# We don't care about S in the trans functions (the decode folds it into
+# the calculation of index), but we have to list it here so that we can
+# handle the S-must-be-0 pattern lines. Similarly we don't care about sz
+# once it has been used to calculate index.
+&ldst_single rm rn rt sz p q s selem index scale repl
+
+@ldst_single . q:1 ...... p:1 . . rm:5 ... . .. rn:5 rt:5 \
+ &ldst_single index=%ldst_single_index_scaled \
+ selem=%ldst_single_selem repl=0
+@ldst_single_repl . q:1 ...... p:1 . . rm:5 ... . sz:2 rn:5 rt:5 \
+ &ldst_single index=%ldst_single_index \
+ scale=%ldst_single_repl_scale selem=%ldst_single_selem
repl=1
+
+
+ST_single 0 . 001101 . 0 . ..... 00 . s:1 sz:2 ..... ..... @ldst_single
scale=0
+ST_single 0 . 001101 . 0 . ..... 01 . s:1 00 ..... ..... @ldst_single
scale=1 sz=0
+ST_single 0 . 001101 . 0 . ..... 01 . s:1 10 ..... ..... @ldst_single
scale=1 sz=2
+ST_single 0 . 001101 . 0 . ..... 10 . s:1 00 ..... ..... @ldst_single
scale=2 sz=0
+ST_single 0 . 001101 . 0 . ..... 10 . 0 01 ..... ..... @ldst_single
scale=3 sz=1 s=0
Wow, that's hard to follow. How about
%ldst_single_selem 13:1 21:1 !function=plus_1
%ldst_single_index_b 30:1 10:3
%ldst_single_index_h 30:1 11:2
%ldst_single_index_s 30:1 12:1
@ldst_single_b .. ...... p:1 . . rm:5 ...... rn:5 rt:5 \
&ldst_single scale=0 selem=%ldst_single_selem \
index=%ldst_single_index_b
@ldst_single_h .. ...... p:1 . . rm:5 ...... rn:5 rt:5 \
&ldst_single scale=1 selem=%ldst_single_selem \
index=%ldst_single_index_h
@ldst_single_s .. ...... p:1 .. rm:5 ...... rn:5 rt:5 \
&ldst_single scale=2 selem=%ldst_single_selem \
index=%ldst_single_index_s
@ldst_single_d . index:1 ...... p:1 .. rm:5 ...... rn:5 rt:5 \
&ldst_single scale=3 selem=%ldst_single_selem
ST_single 0 . 001101 . 0 . ..... 00 . ... ..... ..... @ldst_single_b
ST_single 0 . 001101 . 0 . ..... 01 . ..0 ..... ..... @ldst_single_h
ST_single 0 . 001101 . 0 . ..... 10 . .00 ..... ..... @ldst_single_s
ST_single 0 . 001101 . 0 . ..... 10 . 001 ..... ..... @ldst_single_d
LD_single 0 . 001101 . 1 . ..... 00 . ... ..... ..... @ldst_single_b
LD_single 0 . 001101 . 1 . ..... 01 . ..0 ..... ..... @ldst_single_h
LD_single 0 . 001101 . 1 . ..... 10 . .00 ..... ..... @ldst_single_s
LD_single 0 . 001101 . 1 . ..... 10 . 001 ..... ..... @ldst_single_d
# Different unnamed argument set -- there is no index for repl.
LD_single_repl 0 . 001101 p:1 1 . rm:5 11 00 scale:2 rn:5 rt:5 \
selem=%ldst_single_selem
This is similar to how I handle similar situations in SVE, e.g. PSEL.
r~