-
Notifications
You must be signed in to change notification settings - Fork 51
Add FFLAGS and FRM CSRs #657
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
Merged
ThinkOpenly
merged 11 commits into
riscv-software-src:main
from
neverlandiz:add-remaining-f-csrs
May 8, 2025
Merged
Changes from 8 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
1ee9192
add fflags and frm csrs
neverlandiz da61f15
tag & identifier changes
neverlandiz f2b85a3
fixed alias and removed some lines
neverlandiz 4b8015e
Merge branch 'main' into add-remaining-f-csrs
neverlandiz 52abb83
added long names to fields
neverlandiz b19c0a1
add sw_read
neverlandiz 8419274
change description to structured format
neverlandiz e112ad4
Merge branch 'main' into add-remaining-f-csrs
neverlandiz 368af3b
add sw_write
neverlandiz 94e88f8
Merge branch 'main' into add-remaining-f-csrs
neverlandiz bdb5dbf
Merge branch 'main' into add-remaining-f-csrs
neverlandiz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# yaml-language-server: $schema=../../../schemas/csr_schema.json | ||
|
||
$schema: "csr_schema.json#" | ||
kind: csr | ||
name: fflags | ||
long_name: Floating-Point Accrued Exceptions | ||
address: 0x001 | ||
description: | ||
- id: csr-fflags-purpose | ||
normative: true | ||
text: | | ||
The accrued exception flags indicate the exception conditions that have arisen on any floating-point arithmetic | ||
instruction since the field was last reset by software. | ||
- id: csr-fflags-fptrap | ||
normative: false | ||
text: The base RISC-V ISA does not support generating a trap on the setting of a floating-point exception flag. | ||
- id: csr-fflags-reasoning | ||
normative: false | ||
text: | | ||
As allowed by the standard, we do not support traps on floating-point exceptions in the F | ||
extension, but instead require explicit checks of the flags in software. We considered | ||
adding branches controlled directly by the contents of the floating-point accrued | ||
exception flags, but ultimately chose to omit these instructions to keep the ISA simple. | ||
|
||
priv_mode: U | ||
length: 32 | ||
definedBy: F | ||
fields: | ||
NV: | ||
alias: fcsr.NV | ||
long_name: Invalid Operation | ||
location: 4 | ||
description: | | ||
Set by hardware when a floating point operation is invalid and stays set until explicitly | ||
cleared by software. | ||
type: RW-H | ||
reset_value: UNDEFINED_LEGAL | ||
neverlandiz marked this conversation as resolved.
Show resolved
Hide resolved
dhower-qc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
DZ: | ||
alias: fcsr.DZ | ||
long_name: Divide by Zero | ||
location: 3 | ||
description: | | ||
Set by hardware when a floating point divide attempts to divide by zero and stays set until explicitly | ||
cleared by software. | ||
type: RW-H | ||
reset_value: UNDEFINED_LEGAL | ||
OF: | ||
alias: fcsr.OF | ||
long_name: Overflow | ||
location: 2 | ||
description: | | ||
Set by hardware when a floating point operation overflows and stays set until explicitly | ||
cleared by software. | ||
type: RW-H | ||
reset_value: UNDEFINED_LEGAL | ||
UF: | ||
alias: fcsr.UF | ||
long_name: Underflow | ||
location: 1 | ||
description: | | ||
Set by hardware when a floating point operation underflows and stays set until explicitly | ||
cleared by software. | ||
type: RW-H | ||
reset_value: UNDEFINED_LEGAL | ||
NX: | ||
alias: fcsr.NX | ||
long_name: Inexact | ||
location: 0 | ||
description: | | ||
Set by hardware when a floating point operation is inexact and stays set until explicitly | ||
cleared by software. | ||
type: RW-H | ||
reset_value: UNDEFINED_LEGAL | ||
dhower-qc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
sw_read(): | | ||
return | ||
(CSR[fcsr].NV `<< 4) | | ||
(CSR[fcsr].DZ `<< 3) | | ||
(CSR[fcsr].OF `<< 2) | | ||
(CSR[fcsr].UF `<< 1) | | ||
CSR[fcsr].NX; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# yaml-language-server: $schema=../../../schemas/csr_schema.json | ||
|
||
$schema: "csr_schema.json#" | ||
kind: csr | ||
name: frm | ||
long_name: Floating-Point Dynamic Rounding Mode | ||
address: 0x002 | ||
description: | ||
- id: csr-frm-encodings | ||
normative: false | ||
text: | | ||
Rounding modes are encoded as follows: | ||
|
||
[[rm]] | ||
.Rounding mode encoding. | ||
[%autowidth,float="center",align="center",cols="^,^,<",options="header"] | ||
!=== | ||
!Rounding Mode |Mnemonic |Meaning | ||
!000 !RNE !Round to Nearest, ties to Even | ||
!001 !RTZ !Round towards Zero | ||
!010 !RDN !Round Down (towards latexmath:[$-\infty$]) | ||
!011 !RUP !Round Up (towards latexmath:[$+\infty$]) | ||
!100 !RMM !Round to Nearest, ties to Max Magnitude | ||
!101 ! !_Reserved for future use._ | ||
!110 ! !_Reserved for future use._ | ||
!111 !DYN !In instruction's _rm_ field, selects dynamic rounding mode; In Rounding Mode register, _reserved_. | ||
!=== | ||
- id: csr-frm-reserved | ||
normative: false | ||
text: | | ||
The behavior of floating-point instructions that depend on rounding mode when | ||
executed with a reserved rounding mode is _reserved_, including both static | ||
reserved rounding modes (101-110) and dynamic reserved rounding modes (101-111). | ||
- id: csr-frm-rmfield | ||
normative: false | ||
text: | | ||
Some instructions, including widening conversions, have the _rm_ field but are | ||
nevertheless mathematically unaffected by the rounding mode; software should set | ||
their _rm_ field to RNE (000) but implementations must treat the _rm_ field as | ||
usual (in particular, with regard to decoding legal vs. reserved encodings). | ||
|
||
priv_mode: U | ||
length: 32 | ||
definedBy: F | ||
fields: | ||
ROUNDINGMODE: | ||
alias: fcsr.FRM | ||
location: 2-0 | ||
dhower-qc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
description: | | ||
Rounding mode data. | ||
type: RW-H | ||
reset_value: UNDEFINED_LEGAL | ||
dhower-qc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
sw_read(): | | ||
return | ||
CSR[fcsr].FRM; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.