-
Notifications
You must be signed in to change notification settings - Fork 78
feat: added sie and sccountinhibit yaml files #1046
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
Open
sudo-apt-abdullah
wants to merge
5
commits into
riscv-software-src:main
Choose a base branch
from
sudo-apt-abdullah:CSR
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0387598
feat: added sie and sccountinhibit yaml files
sudo-apt-abdullah 4ae12d4
Merge branch 'main' into CSR
sudo-apt-abdullah 14b7d4a
Merge branch 'main' into CSR
sudo-apt-abdullah c04a772
improved descriptions a bit
sudo-apt-abdullah 43c2940
tried to address the concerns
sudo-apt-abdullah 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
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,118 @@ | ||
| # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. | ||
| # SPDX-License-Identifier: BSD-3-Clause-Clear | ||
|
|
||
| # yaml-language-server: $schema=../../../schemas/csr_schema.json | ||
|
|
||
| $schema: csr_schema.json# | ||
| kind: csr | ||
| name: scountinhibit | ||
| long_name: Supervisor Counter-Inhibit Register | ||
| address: 0x120 | ||
| writable: true | ||
| priv_mode: S | ||
| length: 32 | ||
| description: | | ||
| For counters delegated to S-mode, the associated `mcountinhibit` bits can be accessed | ||
| via `scountinhibit`. For counters not delegated to S-mode, the associated bits in | ||
| `scountinhibit` are read-only zero. | ||
| definedBy: | ||
| anyOf: | ||
| - Smcdeleg | ||
| - Ssccfg | ||
| fields: | ||
| CY: | ||
| location: 0 | ||
| alias: mcountinhibit.CY | ||
| description: | | ||
| Cycle inhibit. When 1, the cycle counter does not increment. Only meaningful if | ||
| mcycle is delegated to S-mode; otherwise reads as 0. | ||
| type(): | | ||
| return COUNTINHIBIT_EN[0] ? CsrFieldType::RW : CsrFieldType::RO; | ||
| reset_value(): | | ||
| return COUNTINHIBIT_EN[0] ? UNDEFINED_LEGAL : 0; | ||
| sw_write(csr_value): | | ||
| if (implemented_csr?(CsrName::menvcfg) && CSR[menvcfg].CDE == 1'b0) { | ||
| if (mode() == PrivilegeMode::M) { | ||
| raise(ExceptionCode::IllegalInstruction, mode(), $encoding); | ||
| } | ||
| } else if (implemented_csr?(CsrName::menvcfg) && CSR[menvcfg].CDE == 1'b1) { | ||
| if ((mode() == PrivilegeMode::VS) || (mode() == PrivilegeMode::VU)) { | ||
| raise(ExceptionCode::VirtualInstruction, mode(), $encoding); | ||
| } | ||
| } | ||
| CSR[mcountinhibit].CY = csr_value.CY; | ||
| return csr_value.CY; | ||
| IR: | ||
| location: 2 | ||
| alias: mcountinhibit.IR | ||
| description: | | ||
| Instructions-retired inhibit. When 1, the instret counter does not increment. Only | ||
| meaningful if minstret is delegated to S-mode; else reads 0. | ||
| type(): | | ||
| return COUNTINHIBIT_EN[2] ? CsrFieldType::RW : CsrFieldType::RO; | ||
| reset_value(): | | ||
| return COUNTINHIBIT_EN[2] ? UNDEFINED_LEGAL : 0; | ||
| sw_write(csr_value): | | ||
| if (implemented_csr?(CsrName::menvcfg) && CSR[menvcfg].CDE == 1'b0) { | ||
| if (mode() == PrivilegeMode::M) { | ||
| raise(ExceptionCode::IllegalInstruction, mode(), $encoding); | ||
| } | ||
| } else if (implemented_csr?(CsrName::menvcfg) && CSR[menvcfg].CDE == 1'b1) { | ||
| if ((mode() == PrivilegeMode::VS) || (mode() == PrivilegeMode::VU)) { | ||
| raise(ExceptionCode::VirtualInstruction, mode(), $encoding); | ||
| } | ||
| } | ||
| CSR[mcountinhibit].IR = csr_value.IR; | ||
| return csr_value.IR; | ||
| <%- (3..31).each do |hpm_num| -%> | ||
| HPM<%= hpm_num %>: | ||
| location: <%= hpm_num %> | ||
| alias: mcountinhibit.HPM<%= hpm_num %> | ||
| description: | ||
| - id: csr-field-hpmcounter<%= hpm_num %>.COUNT-effect | ||
| normative: true | ||
| when: | ||
| param: | ||
| name: COUNTINHIBIT_EN | ||
| index: <%= hpm_num %> | ||
| value: true | ||
| text: | | ||
| When bit is set `hpmcounter<%= hpm_num %>.COUNT` does not increment; when 0, `hpmcounter<%= hpm_num %>.COUNT` increments normally. | ||
ThinkOpenly marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - id: unimplemented-hpmcounter<%= hpm_num %> | ||
| normative: false | ||
| when: | ||
| param: | ||
| name: COUNTINHIBIT_EN | ||
| index: <%= hpm_num %> | ||
| value: false | ||
| text: | | ||
| Since hpmcounter<%= hpm_num %> is not implemented, this field is read-only zero. | ||
| type(): | | ||
| return COUNTINHIBIT_EN[<%= hpm_num %>] ? CsrFieldType::RW : CsrFieldType::RO; | ||
| reset_value(): | | ||
| return COUNTINHIBIT_EN[<%= hpm_num %>] ? UNDEFINED_LEGAL : 0; | ||
| sw_write(csr_value): | | ||
| if (implemented_csr?(CsrName::menvcfg) && CSR[menvcfg].CDE == 1'b0) { | ||
| if (mode() == PrivilegeMode::M) { | ||
| raise(ExceptionCode::IllegalInstruction, mode(), $encoding); | ||
| } | ||
| } else if (implemented_csr?(CsrName::menvcfg) && CSR[menvcfg].CDE == 1'b1) { | ||
| if ((mode() == PrivilegeMode::VS) || (mode() == PrivilegeMode::VU)) { | ||
| raise(ExceptionCode::VirtualInstruction, mode(), $encoding); | ||
| } | ||
| } | ||
| CSR[mcountinhibit].HPM<%= hpm_num %> = csr_value.HPM<%= hpm_num %>; | ||
| return csr_value.HPM<%= hpm_num %>; | ||
| <%- end -%> | ||
|
|
||
| sw_read(): | | ||
| if (implemented_csr?(CsrName::menvcfg) && CSR[menvcfg].CDE == 1'b0) { | ||
| if (mode() == PrivilegeMode::M) { | ||
| raise(ExceptionCode::IllegalInstruction, mode(), $encoding); | ||
| } | ||
| } else if (implemented_csr?(CsrName::menvcfg) && CSR[menvcfg].CDE == 1'b1) { | ||
| if ((mode() == PrivilegeMode::VS) || (mode() == PrivilegeMode::VU)) { | ||
| raise(ExceptionCode::VirtualInstruction, mode(), $encoding); | ||
| } | ||
| } | ||
| return ($bits(CSR[mcountinhibit]) & ($bits(CSR[scounteren]) & ~32'd2)) ; | ||
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.