andes-riscv 0.1.0

Low level access to Andes' AndeStar V5 RISC-V processors
Documentation
# AndeStar V5 supervisor mode CSRs
block/CSR:
  description: Supervisor Mode CSRs
  items:
    # Supervisor Trap Handling
    - name: slie
      byte_offset: 0x9C4
      description: Supervisor local interrupt enable
      fieldset: SLIE
    - name: slip
      byte_offset: 0x9C5
      description: Supervisor local interrupt pending
      fieldset: SLIP
    - name: sdcause
      byte_offset: 0x9C9
      description: Detailed exception cause
      fieldset: SDCAUSE
    # Supervisor Counter Related
    - name: scounterinten
      byte_offset: 0x9CF
      description: Counter overflow interrupt enable
      fieldset: SCOUNTER_COMMON
    - name: scountermask_m
      byte_offset: 0x9D1
      description: Counter mask for M-mode
      fieldset: SCOUNTER_COMMON
    - name: scountermask_s
      byte_offset: 0x9D2
      description: Counter mask for S-mode
      fieldset: SCOUNTER_COMMON
    - name: scountermask_u
      byte_offset: 0x9D3
      description: Counter mask for U-mode
      fieldset: SCOUNTER_COMMON
    - name: scounterovf
      byte_offset: 0x9D4
      description: Counter overflow status
      fieldset: SCOUNTER_COMMON
    - name: scountinhibit
      byte_offset: 0x9E0
      description: Supervisor counter inhibit
      fieldset: SCOUNTER_COMMON
    # shpmevent3~6
    - name: shpmevent3
      byte_offset: 0x9E3
      description: Performance monitoring event selection
    - name: shpmevent4
      byte_offset: 0x9E4
      description: Performance monitoring event selection
    - name: shpmevent5
      byte_offset: 0x9E5
      description: Performance monitoring event selection
    - name: shpmevent6
      byte_offset: 0x9E6
      description: Performance monitoring event selection
    # Supervisor Control
    - name: scctldata
      byte_offset: 0x9CD
      description: CCTL data
    - name: smisc_ctl
      byte_offset: 0x9D0
      description: Miscellaneous control
      fieldset: SMISC_CTL
# - MARK: fieldsets
fieldset/SLIE:
  description: Supervisor Local Interrupt Enable
  fields:
    - name: IMECCI
      description: Enable S-mode slave-port ECC error local interrupt
      bit_offset: 16
      bit_size: 1
    - name: BWEI
      description: Enable S-mode bus read/write transaction error local interrupt
      bit_offset: 17
      bit_size: 1
    - name: PMOVI
      description: Enable S-mode performance monitor overflow local interrupt
      bit_offset: 18
      bit_size: 1
    - name: IMECCDMR
      description: Enable S-mode ECC DMR error local interrupt
      bit_offset: 19
      bit_size: 1
    - name: ACEERR
      description: Enable S-mode ACE error local interrupt
      bit_offset: 24
      bit_size: 1
fieldset/SLIP:
  description: Supervisor Local Interrupt Pending
  fields:
    - name: IMECCI
      description:
      bit_offset: 16
      bit_size: 1
    - name: BWEI
      description:
      bit_offset: 17
      bit_size: 1
    - name: PMOVI
      description:
      bit_offset: 18
      bit_size: 1
    - name: IMECCDMR
      description:
      bit_offset: 19
      bit_size: 1
    - name: ACEERR
      description:
      bit_offset: 24
      bit_size: 1
fieldset/SDCAUSE:
  description: Supervisor Detailed Cause (for imprecise exception/interrupt)
  fields:
    - name: sdcause
      description: Detailed cause for imprecise exception
      bit_offset: 0
      bit_size: 5
    - name: PM
      description: Privilege Mode
      bit_offset: 5
      bit_size: 2
fieldset/SMISC_CTL:
  description: Supervisor Miscellaneous Control Register
  fields:
    - name: ACES
      description: ACE (Access Control Extension) Status
      bit_offset: 4
      bit_size: 2
      enum: ACES
fieldset/SCOUNTER_COMMON:
  description: Machine Counter Fields
  fields:
    - name: CY
      description: Cycle counter
      bit_offset: 0
      bit_size: 1
    - name: IR
      description: Instruction retired counter
      bit_offset: 2
      bit_size: 1
    - name: HPM
      description: Hardware performance monitor 3 to 31
      bit_offset: 3
      bit_size: 1
      array:
        len: 29
        stride: 1
        start_index: 3 # TODO, support this
enum/ACES:
  bit_size: 2
  variants:
    - name: "Off"
      value: 0
    - name: Initial
      value: 1
    - name: Clean
      value: 2
    - name: Dirty
      value: 3