From 32b1c568d6dfbc3f1a099891829dd0b7b032dd02 Mon Sep 17 00:00:00 2001 From: Jordan Carlin Date: Fri, 6 Dec 2024 02:58:57 -0800 Subject: [PATCH] Factor out common parts of flen files Similar to what was done to XLEN already, place the the types/variables that are derived from FLEN into a separate file that is always included and only leave the value of FLEN itself in the F/D specific files. --- Makefile | 1 + model/riscv_flen.sail | 14 ++++++++++++++ model/riscv_flen_D.sail | 8 +------- model/riscv_flen_F.sail | 8 +------- 4 files changed, 17 insertions(+), 14 deletions(-) create mode 100644 model/riscv_flen.sail diff --git a/Makefile b/Makefile index d72153579..4f3b63af5 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,7 @@ endif SAIL_XLEN += riscv_xlen.sail SAIL_FLEN := riscv_flen_D.sail +SAIL_FLEN += riscv_flen.sail SAIL_VLEN := riscv_vlen.sail # Instruction sources, depending on target diff --git a/model/riscv_flen.sail b/model/riscv_flen.sail new file mode 100644 index 000000000..bed3f245e --- /dev/null +++ b/model/riscv_flen.sail @@ -0,0 +1,14 @@ +/*=======================================================================================*/ +/* This Sail RISC-V architecture model, comprising all files and */ +/* directories except where otherwise noted is subject the BSD */ +/* two-clause license in the LICENSE file. */ +/* */ +/* SPDX-License-Identifier: BSD-2-Clause */ +/*=======================================================================================*/ + +type flenbits = bits(flen) + +// Variable versions of the above types. Variables and types +// are disjoint in Sail so they are allowed to have the same name. +// This saves typing `sizeof()` everywhere. +let flen = sizeof(flen) diff --git a/model/riscv_flen_D.sail b/model/riscv_flen_D.sail index 2f85ec5a2..385eb4943 100644 --- a/model/riscv_flen_D.sail +++ b/model/riscv_flen_D.sail @@ -8,10 +8,4 @@ /* Define the FLEN value for the 'D' extension. */ -type flen : Int = 64 -type flenbits = bits(flen) - -// Variable versions of the above types. Variables and types -// are disjoint in Sail so they are allowed to have the same name. -// This saves typing `sizeof()` everywhere. -let flen = sizeof(flen) +type flen : Int = 64 diff --git a/model/riscv_flen_F.sail b/model/riscv_flen_F.sail index fd329ee4b..b3475b943 100644 --- a/model/riscv_flen_F.sail +++ b/model/riscv_flen_F.sail @@ -8,10 +8,4 @@ /* Define the FLEN value for the 'F' extension. */ -type flen : Int = 32 -type flenbits = bits(flen) - -// Variable versions of the above types. Variables and types -// are disjoint in Sail so they are allowed to have the same name. -// This saves typing `sizeof()` everywhere. -let flen = sizeof(flen) +type flen : Int = 32