Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Derive xlen values from a logarithmic constant #447

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ else
$(error '$(ARCH)' is not a valid architecture, must be one of: RV32, RV64)
endif

SAIL_XLEN += riscv_xlen.sail
SAIL_FLEN := riscv_flen_D.sail
SAIL_VLEN := riscv_vlen.sail

Expand Down
11 changes: 11 additions & 0 deletions model/riscv_xlen.sail
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*=======================================================================================*/
/* 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 xlen_bytes : Int = 2 ^ log2_xlen_bytes
type xlen : Int = xlen_bytes * 8
type xlenbits = bits(xlen)
9 changes: 4 additions & 5 deletions model/riscv_xlen32.sail
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*=======================================================================================*/

/* Define the XLEN value for the architecture. */

type xlen : Int = 32
type xlen_bytes : Int = 4
type xlenbits = bits(xlen)
// Define the XLEN value for the architecture.
// This is done using the smallest/most logarithmic possible value since Sail's
// type system works well for multiply and 2^ but not divide and log2.
type log2_xlen_bytes : Int = 2
9 changes: 4 additions & 5 deletions model/riscv_xlen64.sail
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*=======================================================================================*/

/* Define the XLEN value for the architecture. */

type xlen : Int = 64
type xlen_bytes : Int = 8
type xlenbits = bits(xlen)
// Define the XLEN value for the architecture.
// This is done using the smallest/most logarithmic possible value since Sail's
// type system works well for multiply and 2^ but not divide and log2.
type log2_xlen_bytes : Int = 3
Loading