|
| 1 | +# yaml-language-server: $schema=../../schemas/csr_schema.json |
| 2 | + |
| 3 | +$schema: "csr_schema.json#" |
| 4 | +kind: csr |
| 5 | +name: vstimecmp |
| 6 | +long_name: Virtual Supervisor Timer Register |
| 7 | +virtual_address: 0x24D |
| 8 | +address: 0x24D |
| 9 | +priv_mode: VS |
| 10 | +definedBy: H |
| 11 | +length: SXLEN |
| 12 | + |
| 13 | +description: |
| 14 | + - id: csr-vstimecmp-purpose |
| 15 | + normative: true |
| 16 | + text: | |
| 17 | + The vstimecmp CSR is a 64-bit register and has 64-bit precision on all RV32 and RV64 systems. |
| 18 | + In RV32 only, accesses to the vstimecmp CSR access the low 32 bits, while accesses to the vstimecmph CSR |
| 19 | + access the high 32 bits of vstimecmp. |
| 20 | +
|
| 21 | + - id: csr-vstimecmp-csr-numbers |
| 22 | + normative: true |
| 23 | + text: | |
| 24 | + The proposed CSR numbers for vstimecmp / vstimecmph are 0x24D / 0x25D (within the Virtual Supervisor |
| 25 | + Registers block of CSRs, and mirroring the CSR numbers for stimecmp/stimecmph). |
| 26 | +
|
| 27 | + - id: csr-vstimecmp-interrupt |
| 28 | + normative: true |
| 29 | + text: | |
| 30 | + A virtual supervisor timer interrupt becomes pending, as reflected in the VSTIP bit in the hip register, |
| 31 | + whenever (time + htimedelta), truncated to 64 bits, contains a value greater than or equal to vstimecmp, |
| 32 | + treating the values as unsigned integers. |
| 33 | + If the result of this comparison changes, it is guaranteed to be reflected in VSTIP eventually, but not necessarily immediately. |
| 34 | + The interrupt remains posted until vstimecmp becomes greater than (time + htimedelta), typically as a result of writing vstimecmp. |
| 35 | + The interrupt will be taken based on the standard interrupt enable and delegation rules while V=1. |
| 36 | +
|
| 37 | + - id: csr-vstimecmp-compat |
| 38 | + normative: false |
| 39 | + text: | |
| 40 | + In systems in which a supervisor execution environment (SEE) implemented by an |
| 41 | + HS-mode hypervisor provides timer facilities via an SBI function call, this SBI call will |
| 42 | + continue to support requests to schedule a timer interrupt. The SEE will simply make |
| 43 | + use of vstimecmp, changing its value as appropriate. This ensures compatibility with |
| 44 | + existing guest VS-mode software that uses this SEE facility, while new VS-mode |
| 45 | + software takes advantage of vstimecmp directly. |
| 46 | +
|
| 47 | +fields: |
| 48 | + VSTIMECMP: |
| 49 | + long_name: Virtual supervisor timer compare value |
| 50 | + location_rv32: 31-0 |
| 51 | + location_rv64: 63-0 |
| 52 | + type: RW |
| 53 | + reset_value: UNDEFINED_LEGAL |
| 54 | + description: | |
| 55 | + The value in vstimecmp is compared with (time + htimedelta), truncated to 64 bits, |
| 56 | + to determine whether a virtual supervisor timer interrupt should be posted in VSTIP. |
0 commit comments