Skip to content

Commit

Permalink
Factor out common parts of flen files
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jordancarlin authored Dec 6, 2024
1 parent cbc3396 commit 32b1c56
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions model/riscv_flen.sail
Original file line number Diff line number Diff line change
@@ -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)
8 changes: 1 addition & 7 deletions model/riscv_flen_D.sail
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 1 addition & 7 deletions model/riscv_flen_F.sail
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 32b1c56

Please sign in to comment.