Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
bb6a2f8
test(idl): test:idl task takes config from enviornment
dhower-qc Apr 4, 2025
f8a7b59
idl: add indirect csr access; do direct csr access with functions
dhower-qc Apr 4, 2025
54b5f3a
schema(csr): add writeable field
dhower-qc Apr 4, 2025
bffee3f
fix(ruby): corrects adoc generation for CSR read expressions
dhower-qc Apr 4, 2025
60addff
test(idl): test:idl task takes config from enviornment
dhower-qc Apr 4, 2025
716b515
idl: add indirect csr access; do direct csr access with functions
dhower-qc Apr 4, 2025
fe3dc19
schema(csr): add writeable field
dhower-qc Apr 4, 2025
7222654
fix(ruby): corrects adoc generation for CSR read expressions
dhower-qc Apr 4, 2025
ca1cdd5
correct(csr): Fixes the layout file for hpmcounterXh
dhower-qc Apr 8, 2025
9d10541
Merge remote-tracking branch 'origin/indirect-csr' into indirect-csr
dhower-qc Apr 8, 2025
4095177
fix: buggy last commit
dhower-qc Apr 8, 2025
f13a222
refactor: small comment cleanup
dhower-qc Apr 8, 2025
a2a49a9
fix: make csr address at most MXLEN bits
dhower-qc Apr 15, 2025
e98d4b2
Merge remote-tracking branch 'origin/main' into indirect-csr
dhower-qc Apr 15, 2025
6340f6a
fix: XLEN -> MXLEN in builtin_functions
dhower-qc Apr 15, 2025
b9e1407
feat: add window slot for indirect csrs
dhower-qc Apr 29, 2025
fc4cc5e
Merge remote-tracking branch 'origin/main' into indirect-csr
dhower-qc Apr 29, 2025
9959661
fix: add indirect_address/slot to Csr model
dhower-qc Apr 29, 2025
03e86af
Merge branch 'main' into indirect-csr
dhower-qc Apr 30, 2025
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 .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ repos:
rev: v5.0.2
hooks:
- id: reuse-lint-file
exclude: COMMIT_EDITMSG

- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v9.22.0
Expand Down
23 changes: 13 additions & 10 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -264,18 +264,15 @@ namespace :test do
puts "All files validate against their schema"
end

task idl: ["#{$root}/.stamps/resolve-rv32.stamp", "#{$root}/.stamps/resolve-rv64.stamp"] do
print "Parsing IDL code for RV32..."
cfg_arch32 = cfg_arch_for("rv32")
puts "done"

cfg_arch32.type_check
task :idl do
cfg = ENV["CFG"]
raise "Missing CFG enviornment variable" if cfg.nil?

print "Parsing IDL code for RV64..."
cfg_arch64 = cfg_arch_for("rv64")
print "Parsing IDL code for #{cfg}..."
cfg_arch = cfg_arch_for(cfg)
puts "done"

cfg_arch64.type_check
cfg_arch.type_check

puts "All IDL passed type checking"
end
Expand Down Expand Up @@ -442,8 +439,14 @@ namespace :test do
Rake::Task["test:lib"].invoke
$logger.info "Running test:schema"
Rake::Task["test:schema"].invoke
$logger.info "Running test:idl"
$logger.info "UPDATE: Running test:idl for rv32"
ENV["CFG"] = "rv32"
Rake::Task["test:idl"].invoke
$logger.info "UPDATE: Running test:idl for rv64"
ENV["CFG"] = "rv64"
Rake::Task["test:idl"].invoke
$logger.info "UPDATE: Running test:idl for qc_iu"
ENV["CFG"] = "qc_iu"
$logger.info "Running test:inst_encodings"
Rake::Task["test:inst_encodings"].invoke
$logger.info "Running test:llvm"
Expand Down
1 change: 1 addition & 0 deletions arch/csr/F/fcsr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ kind: csr
name: fcsr
long_name: Floating-point control and status register (`frm` + `fflags`)
address: 0x003
writeable: true
description: |
The floating-point control and status register, `fcsr`, is a RISC-V
control and status register (CSR). It is a 32-bit read/write register
Expand Down
1 change: 1 addition & 0 deletions arch/csr/H/henvcfg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ $schema: "csr_schema.json#"
kind: csr
name: henvcfg
address: 0x60A
writeable: true
long_name: Hypervisor Environment Configuration
description: |
The henvcfg CSR is a 64-bit read/write register that controls certain characteristics of the
Expand Down
1 change: 1 addition & 0 deletions arch/csr/H/henvcfgh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ $schema: "csr_schema.json#"
kind: csr
name: henvcfgh
address: 0x61A
writeable: true
base: 32
long_name: most-significant 32 bits of Hypervisor Environment Configuration
description: |
Expand Down
1 change: 1 addition & 0 deletions arch/csr/H/hgatp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ description: |
HFENCE.GVMA instruction (see <<hfence.vma>>) before or
after writing `hgatp`.
address: 0x680
writeable: true
priv_mode: S
definedBy: H
length: SXLEN
Expand Down
1 change: 1 addition & 0 deletions arch/csr/H/htimedelta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ description: |
`htimedelta` may be used to represent negative time offsets.

address: 0x605
writeable: true
priv_mode: S
definedBy: H
length: 64
Expand Down
1 change: 1 addition & 0 deletions arch/csr/H/htimedeltah.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ description: |
Upper half of the `htimedelta` CSR.

address: 0x615
writeable: true
priv_mode: S
definedBy: H
length: 32
Expand Down
1 change: 1 addition & 0 deletions arch/csr/H/htinst.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ $schema: "csr_schema.json#"
kind: csr
name: htinst
address: 0x64a
writeable: true
long_name: Hypervisor Trap Instruction Register
description: |
When a trap is taken into HS-mode, mtinst is written with a value that, if nonzero,
Expand Down
1 change: 1 addition & 0 deletions arch/csr/H/htval.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ $schema: "csr_schema.json#"
kind: csr
name: htval
address: 0x643
writeable: true
long_name: Hypervisor Trap Value Register
description: |
When a trap is taken into HS-mode, htval is written with additional exception-specific information, alongside stval, to assist software in handling the trap.
Expand Down
1 change: 1 addition & 0 deletions arch/csr/H/mtinst.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ $schema: "csr_schema.json#"
kind: csr
name: mtinst
address: 0x34a
writeable: true
long_name: Machine Trap Instruction Register
description: |
When a trap is taken into M-mode, mtinst is written with a value that, if nonzero,
Expand Down
1 change: 1 addition & 0 deletions arch/csr/H/mtval2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ $schema: "csr_schema.json#"
kind: csr
name: mtval2
address: 0x34b
writeable: true
long_name: Machine Second Trap Value Register
description: |
When a trap is taken into M-mode from a virtual mode, mtval2 is written with additional exception-specific information,
Expand Down
1 change: 1 addition & 0 deletions arch/csr/H/vsatp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ $schema: "csr_schema.json#"
kind: csr
name: vsatp
address: 0x280
writeable: true
virtual_address: 0x180
long_name: Virtual Supervisor Address Translation and Protection
description: |
Expand Down
1 change: 1 addition & 0 deletions arch/csr/Smrnmi/mncause.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ kind: csr
name: mncause
long_name: Resumable NMI cause
address: 0x742
writeable: true
priv_mode: M
length: MXLEN
definedBy: Smrnmi
Expand Down
1 change: 1 addition & 0 deletions arch/csr/Smrnmi/mnepc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ kind: csr
name: mnepc
long_name: Machine Exception Program Counter
address: 0x741
writeable: true
priv_mode: M
length: MXLEN
description: |
Expand Down
5 changes: 4 additions & 1 deletion arch/csr/Smrnmi/mnscratch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ kind: csr
name: mnscratch
long_name: Machine Scratch Register
address: 0x740
writeable: true
priv_mode: M
length: MXLEN
description: Scratch register for software use in NMI / double trap. Bits are not interpreted by hardware.
description:
Scratch register for software use in NMI / double trap. Bits are not
interpreted by hardware.
definedBy: Smrnmi
fields:
SCRATCH:
Expand Down
5 changes: 4 additions & 1 deletion arch/csr/Smrnmi/mnstatus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ kind: csr
name: mnstatus
long_name: Machine NMI Status
address: 0x744
writeable: true
priv_mode: M

# length is MXLEN-bit
length: MXLEN
description: The mnstatus register tracks and controls the hart's current NMI operating state.
description:
The mnstatus register tracks and controls the hart's current NMI operating
state.
definedBy: Smrnmi
fields:
MNPP:
Expand Down
6 changes: 3 additions & 3 deletions arch/csr/Zihpm/hpmcounter10h.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ description: |
! 1 ! 1 ! 1 ! read-only ! read-only ! read-only ! read-only
!===
priv_mode: U
length: 64
length: 32
definedBy: Sscofpmf
fields:
COUNT:
location: 63-0
alias: mhpmcounter10h.COUNT
location: 31-0
alias: mhpmcounter10h.COUNT[63:32]
description: Alias of `mhpmcounter10h.COUNT`.
type: RO-H
reset_value: UNDEFINED_LEGAL
Expand Down
6 changes: 3 additions & 3 deletions arch/csr/Zihpm/hpmcounter11h.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ description: |
! 1 ! 1 ! 1 ! read-only ! read-only ! read-only ! read-only
!===
priv_mode: U
length: 64
length: 32
definedBy: Sscofpmf
fields:
COUNT:
location: 63-0
alias: mhpmcounter11h.COUNT
location: 31-0
alias: mhpmcounter11h.COUNT[63:32]
description: Alias of `mhpmcounter11h.COUNT`.
type: RO-H
reset_value: UNDEFINED_LEGAL
Expand Down
6 changes: 3 additions & 3 deletions arch/csr/Zihpm/hpmcounter12h.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ description: |
! 1 ! 1 ! 1 ! read-only ! read-only ! read-only ! read-only
!===
priv_mode: U
length: 64
length: 32
definedBy: Sscofpmf
fields:
COUNT:
location: 63-0
alias: mhpmcounter12h.COUNT
location: 31-0
alias: mhpmcounter12h.COUNT[63:32]
description: Alias of `mhpmcounter12h.COUNT`.
type: RO-H
reset_value: UNDEFINED_LEGAL
Expand Down
6 changes: 3 additions & 3 deletions arch/csr/Zihpm/hpmcounter13h.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ description: |
! 1 ! 1 ! 1 ! read-only ! read-only ! read-only ! read-only
!===
priv_mode: U
length: 64
length: 32
definedBy: Sscofpmf
fields:
COUNT:
location: 63-0
alias: mhpmcounter13h.COUNT
location: 31-0
alias: mhpmcounter13h.COUNT[63:32]
description: Alias of `mhpmcounter13h.COUNT`.
type: RO-H
reset_value: UNDEFINED_LEGAL
Expand Down
6 changes: 3 additions & 3 deletions arch/csr/Zihpm/hpmcounter14h.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ description: |
! 1 ! 1 ! 1 ! read-only ! read-only ! read-only ! read-only
!===
priv_mode: U
length: 64
length: 32
definedBy: Sscofpmf
fields:
COUNT:
location: 63-0
alias: mhpmcounter14h.COUNT
location: 31-0
alias: mhpmcounter14h.COUNT[63:32]
description: Alias of `mhpmcounter14h.COUNT`.
type: RO-H
reset_value: UNDEFINED_LEGAL
Expand Down
6 changes: 3 additions & 3 deletions arch/csr/Zihpm/hpmcounter15h.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ description: |
! 1 ! 1 ! 1 ! read-only ! read-only ! read-only ! read-only
!===
priv_mode: U
length: 64
length: 32
definedBy: Sscofpmf
fields:
COUNT:
location: 63-0
alias: mhpmcounter15h.COUNT
location: 31-0
alias: mhpmcounter15h.COUNT[63:32]
description: Alias of `mhpmcounter15h.COUNT`.
type: RO-H
reset_value: UNDEFINED_LEGAL
Expand Down
6 changes: 3 additions & 3 deletions arch/csr/Zihpm/hpmcounter16h.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ description: |
! 1 ! 1 ! 1 ! read-only ! read-only ! read-only ! read-only
!===
priv_mode: U
length: 64
length: 32
definedBy: Sscofpmf
fields:
COUNT:
location: 63-0
alias: mhpmcounter16h.COUNT
location: 31-0
alias: mhpmcounter16h.COUNT[63:32]
description: Alias of `mhpmcounter16h.COUNT`.
type: RO-H
reset_value: UNDEFINED_LEGAL
Expand Down
6 changes: 3 additions & 3 deletions arch/csr/Zihpm/hpmcounter17h.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ description: |
! 1 ! 1 ! 1 ! read-only ! read-only ! read-only ! read-only
!===
priv_mode: U
length: 64
length: 32
definedBy: Sscofpmf
fields:
COUNT:
location: 63-0
alias: mhpmcounter17h.COUNT
location: 31-0
alias: mhpmcounter17h.COUNT[63:32]
description: Alias of `mhpmcounter17h.COUNT`.
type: RO-H
reset_value: UNDEFINED_LEGAL
Expand Down
6 changes: 3 additions & 3 deletions arch/csr/Zihpm/hpmcounter18h.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ description: |
! 1 ! 1 ! 1 ! read-only ! read-only ! read-only ! read-only
!===
priv_mode: U
length: 64
length: 32
definedBy: Sscofpmf
fields:
COUNT:
location: 63-0
alias: mhpmcounter18h.COUNT
location: 31-0
alias: mhpmcounter18h.COUNT[63:32]
description: Alias of `mhpmcounter18h.COUNT`.
type: RO-H
reset_value: UNDEFINED_LEGAL
Expand Down
6 changes: 3 additions & 3 deletions arch/csr/Zihpm/hpmcounter19h.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ description: |
! 1 ! 1 ! 1 ! read-only ! read-only ! read-only ! read-only
!===
priv_mode: U
length: 64
length: 32
definedBy: Sscofpmf
fields:
COUNT:
location: 63-0
alias: mhpmcounter19h.COUNT
location: 31-0
alias: mhpmcounter19h.COUNT[63:32]
description: Alias of `mhpmcounter19h.COUNT`.
type: RO-H
reset_value: UNDEFINED_LEGAL
Expand Down
6 changes: 3 additions & 3 deletions arch/csr/Zihpm/hpmcounter20h.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ description: |
! 1 ! 1 ! 1 ! read-only ! read-only ! read-only ! read-only
!===
priv_mode: U
length: 64
length: 32
definedBy: Sscofpmf
fields:
COUNT:
location: 63-0
alias: mhpmcounter20h.COUNT
location: 31-0
alias: mhpmcounter20h.COUNT[63:32]
description: Alias of `mhpmcounter20h.COUNT`.
type: RO-H
reset_value: UNDEFINED_LEGAL
Expand Down
6 changes: 3 additions & 3 deletions arch/csr/Zihpm/hpmcounter21h.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ description: |
! 1 ! 1 ! 1 ! read-only ! read-only ! read-only ! read-only
!===
priv_mode: U
length: 64
length: 32
definedBy: Sscofpmf
fields:
COUNT:
location: 63-0
alias: mhpmcounter21h.COUNT
location: 31-0
alias: mhpmcounter21h.COUNT[63:32]
description: Alias of `mhpmcounter21h.COUNT`.
type: RO-H
reset_value: UNDEFINED_LEGAL
Expand Down
6 changes: 3 additions & 3 deletions arch/csr/Zihpm/hpmcounter22h.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ description: |
! 1 ! 1 ! 1 ! read-only ! read-only ! read-only ! read-only
!===
priv_mode: U
length: 64
length: 32
definedBy: Sscofpmf
fields:
COUNT:
location: 63-0
alias: mhpmcounter22h.COUNT
location: 31-0
alias: mhpmcounter22h.COUNT[63:32]
description: Alias of `mhpmcounter22h.COUNT`.
type: RO-H
reset_value: UNDEFINED_LEGAL
Expand Down
Loading
Loading