2023-01-31 23:20:00 +03:00
|
|
|
#
|
|
|
|
# Translation routines for the instructions of the XThead* ISA extensions
|
|
|
|
#
|
|
|
|
# Copyright (c) 2022 Christoph Muellner, christoph.muellner@vrull.eu
|
2023-01-31 23:20:02 +03:00
|
|
|
# Dr. Philipp Tomsich, philipp.tomsich@vrull.eu
|
2023-01-31 23:20:00 +03:00
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
|
#
|
|
|
|
# The documentation of the ISA extensions can be found here:
|
|
|
|
# https://github.com/T-head-Semi/thead-extension-spec/releases/latest
|
|
|
|
|
|
|
|
# Fields:
|
2023-01-31 23:20:02 +03:00
|
|
|
%rd 7:5
|
2023-01-31 23:20:00 +03:00
|
|
|
%rs1 15:5
|
2023-01-31 23:20:01 +03:00
|
|
|
%rs2 20:5
|
2023-01-31 23:20:03 +03:00
|
|
|
%sh5 20:5
|
|
|
|
%sh6 20:6
|
2023-01-31 23:20:00 +03:00
|
|
|
|
2023-01-31 23:20:02 +03:00
|
|
|
# Argument sets
|
|
|
|
&r rd rs1 rs2 !extern
|
2023-01-31 23:20:03 +03:00
|
|
|
&r2 rd rs1 !extern
|
|
|
|
&shift shamt rs1 rd !extern
|
|
|
|
&th_bfext msb lsb rs1 rd
|
2023-01-31 23:20:02 +03:00
|
|
|
|
2023-01-31 23:20:00 +03:00
|
|
|
# Formats
|
|
|
|
@sfence_vm ....... ..... ..... ... ..... ....... %rs1
|
2023-01-31 23:20:01 +03:00
|
|
|
@rs2_s ....... ..... ..... ... ..... ....... %rs2 %rs1
|
2023-01-31 23:20:02 +03:00
|
|
|
@r ....... ..... ..... ... ..... ....... &r %rs2 %rs1 %rd
|
2023-01-31 23:20:03 +03:00
|
|
|
@r2 ....... ..... ..... ... ..... ....... &r2 %rs1 %rd
|
|
|
|
@th_bfext msb:6 lsb:6 ..... ... ..... ....... &th_bfext %rs1 %rd
|
|
|
|
@sh5 ....... ..... ..... ... ..... ....... &shift shamt=%sh5 %rs1 %rd
|
|
|
|
@sh6 ...... ...... ..... ... ..... ....... &shift shamt=%sh6 %rs1 %rd
|
2023-01-31 23:20:02 +03:00
|
|
|
|
|
|
|
# XTheadBa
|
|
|
|
# Instead of defining a new encoding, we simply use the decoder to
|
|
|
|
# extract the imm[0:1] field and dispatch to separate translation
|
|
|
|
# functions (mirroring the `sh[123]add` instructions from Zba and
|
|
|
|
# the regular RVI `add` instruction.
|
|
|
|
#
|
|
|
|
# The only difference between sh[123]add and addsl is that the shift
|
|
|
|
# is applied to rs1 (for addsl) instead of rs2 (for sh[123]add).
|
|
|
|
#
|
|
|
|
# Note that shift-by-0 is a valid operation according to the manual.
|
|
|
|
# This will be equivalent to a regular add.
|
|
|
|
add 0000000 ..... ..... 001 ..... 0001011 @r
|
|
|
|
th_addsl1 0000001 ..... ..... 001 ..... 0001011 @r
|
|
|
|
th_addsl2 0000010 ..... ..... 001 ..... 0001011 @r
|
|
|
|
th_addsl3 0000011 ..... ..... 001 ..... 0001011 @r
|
2023-01-31 23:20:00 +03:00
|
|
|
|
2023-01-31 23:20:03 +03:00
|
|
|
# XTheadBb
|
|
|
|
th_ext ...... ...... ..... 010 ..... 0001011 @th_bfext
|
|
|
|
th_extu ...... ...... ..... 011 ..... 0001011 @th_bfext
|
|
|
|
th_ff0 1000010 00000 ..... 001 ..... 0001011 @r2
|
|
|
|
th_ff1 1000011 00000 ..... 001 ..... 0001011 @r2
|
|
|
|
th_srri 000100 ...... ..... 001 ..... 0001011 @sh6
|
|
|
|
th_srriw 0001010 ..... ..... 001 ..... 0001011 @sh5
|
|
|
|
th_rev 1000001 00000 ..... 001 ..... 0001011 @r2
|
|
|
|
th_revw 1001000 00000 ..... 001 ..... 0001011 @r2
|
|
|
|
th_tstnbz 1000000 00000 ..... 001 ..... 0001011 @r2
|
|
|
|
|
2023-01-31 23:20:04 +03:00
|
|
|
# XTheadBs
|
|
|
|
th_tst 100010 ...... ..... 001 ..... 0001011 @sh6
|
|
|
|
|
2023-01-31 23:20:00 +03:00
|
|
|
# XTheadCmo
|
|
|
|
th_dcache_call 0000000 00001 00000 000 00000 0001011
|
|
|
|
th_dcache_ciall 0000000 00011 00000 000 00000 0001011
|
|
|
|
th_dcache_iall 0000000 00010 00000 000 00000 0001011
|
|
|
|
th_dcache_cpa 0000001 01001 ..... 000 00000 0001011 @sfence_vm
|
|
|
|
th_dcache_cipa 0000001 01011 ..... 000 00000 0001011 @sfence_vm
|
|
|
|
th_dcache_ipa 0000001 01010 ..... 000 00000 0001011 @sfence_vm
|
|
|
|
th_dcache_cva 0000001 00101 ..... 000 00000 0001011 @sfence_vm
|
|
|
|
th_dcache_civa 0000001 00111 ..... 000 00000 0001011 @sfence_vm
|
|
|
|
th_dcache_iva 0000001 00110 ..... 000 00000 0001011 @sfence_vm
|
|
|
|
th_dcache_csw 0000001 00001 ..... 000 00000 0001011 @sfence_vm
|
|
|
|
th_dcache_cisw 0000001 00011 ..... 000 00000 0001011 @sfence_vm
|
|
|
|
th_dcache_isw 0000001 00010 ..... 000 00000 0001011 @sfence_vm
|
|
|
|
th_dcache_cpal1 0000001 01000 ..... 000 00000 0001011 @sfence_vm
|
|
|
|
th_dcache_cval1 0000001 00100 ..... 000 00000 0001011 @sfence_vm
|
|
|
|
th_icache_iall 0000000 10000 00000 000 00000 0001011
|
|
|
|
th_icache_ialls 0000000 10001 00000 000 00000 0001011
|
|
|
|
th_icache_ipa 0000001 11000 ..... 000 00000 0001011 @sfence_vm
|
|
|
|
th_icache_iva 0000001 10000 ..... 000 00000 0001011 @sfence_vm
|
|
|
|
th_l2cache_call 0000000 10101 00000 000 00000 0001011
|
|
|
|
th_l2cache_ciall 0000000 10111 00000 000 00000 0001011
|
|
|
|
th_l2cache_iall 0000000 10110 00000 000 00000 0001011
|
2023-01-31 23:20:01 +03:00
|
|
|
|
|
|
|
# XTheadSync
|
|
|
|
th_sfence_vmas 0000010 ..... ..... 000 00000 0001011 @rs2_s
|
|
|
|
th_sync 0000000 11000 00000 000 00000 0001011
|
|
|
|
th_sync_i 0000000 11010 00000 000 00000 0001011
|
|
|
|
th_sync_is 0000000 11011 00000 000 00000 0001011
|
|
|
|
th_sync_s 0000000 11001 00000 000 00000 0001011
|