Skip to content

Commit 5cd882f

Browse files
committed
Q extension floating point support
Complete Q extension implementation including Zfa instructions Based on original work by 'LiuTaowen-Tony' in #187
1 parent 9454e6e commit 5cd882f

25 files changed

+2172
-97
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ if (NOT SAIL_BIN)
6565
message(FATAL_ERROR "Sail not found. See README.md for installation instructions.")
6666
endif()
6767

68-
set(DEFAULT_ARCHITECTURES "rv32d;rv64d" CACHE STRING "Architectures to build by default (rv32f|rv64f|rv32d|rv64d)(_rvfi)? " )
68+
set(DEFAULT_ARCHITECTURES "rv32d;rv64d" CACHE STRING "Architectures to build by default (rv32f|rv64f|rv32d|rv64d|rv32q|rv64q)(_rvfi)? " )
6969

7070
option(COVERAGE "Compile with Sail coverage collection enabled.")
7171

Makefile.old

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
# Select architecture: RV32 or RV64.
88
ARCH ?= RV64
9+
FLEN ?= 64
910

1011
ifeq ($(ARCH),32)
1112
override ARCH := RV32
@@ -21,8 +22,17 @@ else
2122
$(error '$(ARCH)' is not a valid architecture, must be one of: RV32, RV64)
2223
endif
2324

25+
ifeq ($(FLEN),32)
26+
SAIL_FLEN := riscv_flen_F.sail
27+
else ifeq ($(FLEN),64)
28+
SAIL_FLEN := riscv_flen_D.sail
29+
else ifeq ($(FLEN),128)
30+
SAIL_FLEN := riscv_flen_Q.sail
31+
else
32+
$(error '$(FLEN)' is not a valid value for FLEN, must be one of: 32, 64, 128)
33+
endif
34+
2435
SAIL_XLEN += riscv_xlen.sail
25-
SAIL_FLEN := riscv_flen_D.sail
2636
SAIL_FLEN += riscv_flen.sail
2737
SAIL_VLEN := riscv_vlen.sail
2838

@@ -31,6 +41,7 @@ SAIL_CHECK_SRCS = riscv_addr_checks_common.sail riscv_addr_checks.sail riscv_mis
3141
SAIL_DEFAULT_INST = riscv_insts_base.sail riscv_insts_zifencei.sail riscv_insts_aext.sail riscv_insts_zca.sail riscv_insts_mext.sail riscv_insts_zicsr.sail riscv_insts_hints.sail
3242
SAIL_DEFAULT_INST += riscv_insts_fext.sail riscv_insts_zcf.sail
3343
SAIL_DEFAULT_INST += riscv_insts_dext.sail riscv_insts_zcd.sail
44+
SAIL_DEFAULT_INST += riscv_insts_qext.sail
3445

3546
SAIL_DEFAULT_INST += riscv_insts_svinval.sail
3647

c_emulator/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@ set(EMULATOR_COMMON_SRCS
1313
)
1414

1515
foreach (xlen IN ITEMS 32 64)
16-
foreach (flen IN ITEMS 32 64)
16+
foreach (flen IN ITEMS 32 64 128)
1717
foreach (variant IN ITEMS "" "rvfi")
1818
set(arch "rv${xlen}")
1919
if (flen EQUAL 32)
2020
string(APPEND arch "f")
21-
else()
21+
elseif (flen EQUAL 64)
2222
string(APPEND arch "d")
23+
else()
24+
string(APPEND arch "q")
2325
endif()
2426
if (variant)
2527
string(APPEND arch "_${variant}")

c_emulator/riscv_sail.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ extern mach_bits zmstatus;
6060
extern mach_bits zmepc, zmtval;
6161
extern mach_bits zsepc, zstval;
6262

63-
extern mach_bits zfloat_result, zfloat_fflags;
63+
extern mach_bits zfloat_result, zfloat_result_high, zfloat_fflags;
6464

6565
struct zMcause {
6666
mach_bits zMcause_chunk_0;

0 commit comments

Comments
 (0)