udb 0.1.13 → 0.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. checksums.yaml +4 -4
  2. data/.data/cfgs/example_rv64_with_overlay.yaml +15 -18
  3. data/.data/cfgs/qc_iu.yaml +5 -1
  4. data/.data/cfgs/rv32-riscv-tests.yaml +4 -1
  5. data/.data/cfgs/rv32-vector.yaml +4 -1
  6. data/.data/cfgs/rv64-riscv-tests.yaml +4 -1
  7. data/.data/cfgs/rv64-vector.yaml +4 -1
  8. data/.data/spec/custom/isa/qc_iu/ext/Xqccmi.yaml +107 -36
  9. data/.data/spec/custom/isa/qc_iu/inst/Xqccmi/qc.cm.ilut.yaml +52 -69
  10. data/.data/spec/custom/isa/qc_iu/isa/globals.isa +27 -5
  11. data/.data/spec/schemas/config_schema.json +1 -1
  12. data/.data/spec/schemas/mmr_schema.json +3 -3
  13. data/.data/spec/schemas/schema_defs.json +5 -0
  14. data/.data/spec/std/isa/csr/H/henvcfg.yaml +25 -0
  15. data/.data/spec/std/isa/csr/I/pmpaddr0.yaml +6 -4
  16. data/.data/spec/std/isa/csr/I/pmpaddr1.yaml +6 -4
  17. data/.data/spec/std/isa/csr/I/pmpaddr10.yaml +6 -4
  18. data/.data/spec/std/isa/csr/I/pmpaddr11.yaml +6 -4
  19. data/.data/spec/std/isa/csr/I/pmpaddr12.yaml +6 -4
  20. data/.data/spec/std/isa/csr/I/pmpaddr13.yaml +6 -4
  21. data/.data/spec/std/isa/csr/I/pmpaddr14.yaml +6 -4
  22. data/.data/spec/std/isa/csr/I/pmpaddr15.yaml +6 -4
  23. data/.data/spec/std/isa/csr/I/pmpaddr16.yaml +6 -4
  24. data/.data/spec/std/isa/csr/I/pmpaddr17.yaml +6 -4
  25. data/.data/spec/std/isa/csr/I/pmpaddr18.yaml +6 -4
  26. data/.data/spec/std/isa/csr/I/pmpaddr19.yaml +6 -4
  27. data/.data/spec/std/isa/csr/I/pmpaddr2.yaml +6 -4
  28. data/.data/spec/std/isa/csr/I/pmpaddr20.yaml +6 -4
  29. data/.data/spec/std/isa/csr/I/pmpaddr21.yaml +6 -4
  30. data/.data/spec/std/isa/csr/I/pmpaddr22.yaml +6 -4
  31. data/.data/spec/std/isa/csr/I/pmpaddr23.yaml +6 -4
  32. data/.data/spec/std/isa/csr/I/pmpaddr24.yaml +6 -4
  33. data/.data/spec/std/isa/csr/I/pmpaddr25.yaml +6 -4
  34. data/.data/spec/std/isa/csr/I/pmpaddr26.yaml +6 -4
  35. data/.data/spec/std/isa/csr/I/pmpaddr27.yaml +6 -4
  36. data/.data/spec/std/isa/csr/I/pmpaddr28.yaml +6 -4
  37. data/.data/spec/std/isa/csr/I/pmpaddr29.yaml +6 -4
  38. data/.data/spec/std/isa/csr/I/pmpaddr3.yaml +6 -4
  39. data/.data/spec/std/isa/csr/I/pmpaddr30.yaml +6 -4
  40. data/.data/spec/std/isa/csr/I/pmpaddr31.yaml +6 -4
  41. data/.data/spec/std/isa/csr/I/pmpaddr32.yaml +6 -4
  42. data/.data/spec/std/isa/csr/I/pmpaddr33.yaml +6 -4
  43. data/.data/spec/std/isa/csr/I/pmpaddr34.yaml +6 -4
  44. data/.data/spec/std/isa/csr/I/pmpaddr35.yaml +6 -4
  45. data/.data/spec/std/isa/csr/I/pmpaddr36.yaml +6 -4
  46. data/.data/spec/std/isa/csr/I/pmpaddr37.yaml +6 -4
  47. data/.data/spec/std/isa/csr/I/pmpaddr38.yaml +6 -4
  48. data/.data/spec/std/isa/csr/I/pmpaddr39.yaml +6 -4
  49. data/.data/spec/std/isa/csr/I/pmpaddr4.yaml +6 -4
  50. data/.data/spec/std/isa/csr/I/pmpaddr40.yaml +6 -4
  51. data/.data/spec/std/isa/csr/I/pmpaddr41.yaml +6 -4
  52. data/.data/spec/std/isa/csr/I/pmpaddr42.yaml +6 -4
  53. data/.data/spec/std/isa/csr/I/pmpaddr43.yaml +6 -4
  54. data/.data/spec/std/isa/csr/I/pmpaddr44.yaml +6 -4
  55. data/.data/spec/std/isa/csr/I/pmpaddr45.yaml +6 -4
  56. data/.data/spec/std/isa/csr/I/pmpaddr46.yaml +6 -4
  57. data/.data/spec/std/isa/csr/I/pmpaddr47.yaml +6 -4
  58. data/.data/spec/std/isa/csr/I/pmpaddr48.yaml +6 -4
  59. data/.data/spec/std/isa/csr/I/pmpaddr49.yaml +6 -4
  60. data/.data/spec/std/isa/csr/I/pmpaddr5.yaml +6 -4
  61. data/.data/spec/std/isa/csr/I/pmpaddr50.yaml +6 -4
  62. data/.data/spec/std/isa/csr/I/pmpaddr51.yaml +6 -4
  63. data/.data/spec/std/isa/csr/I/pmpaddr52.yaml +6 -4
  64. data/.data/spec/std/isa/csr/I/pmpaddr53.yaml +6 -4
  65. data/.data/spec/std/isa/csr/I/pmpaddr54.yaml +6 -4
  66. data/.data/spec/std/isa/csr/I/pmpaddr55.yaml +6 -4
  67. data/.data/spec/std/isa/csr/I/pmpaddr56.yaml +6 -4
  68. data/.data/spec/std/isa/csr/I/pmpaddr57.yaml +6 -4
  69. data/.data/spec/std/isa/csr/I/pmpaddr58.yaml +6 -4
  70. data/.data/spec/std/isa/csr/I/pmpaddr59.yaml +6 -4
  71. data/.data/spec/std/isa/csr/I/pmpaddr6.yaml +6 -4
  72. data/.data/spec/std/isa/csr/I/pmpaddr60.yaml +6 -4
  73. data/.data/spec/std/isa/csr/I/pmpaddr61.yaml +6 -4
  74. data/.data/spec/std/isa/csr/I/pmpaddr62.yaml +6 -4
  75. data/.data/spec/std/isa/csr/I/pmpaddr63.yaml +6 -4
  76. data/.data/spec/std/isa/csr/I/pmpaddr7.yaml +6 -4
  77. data/.data/spec/std/isa/csr/I/pmpaddr8.yaml +6 -4
  78. data/.data/spec/std/isa/csr/I/pmpaddr9.yaml +6 -4
  79. data/.data/spec/std/isa/csr/I/pmpaddrN.layout +6 -4
  80. data/.data/spec/std/isa/csr/I/pmpcfg0.yaml +120 -144
  81. data/.data/spec/std/isa/csr/I/pmpcfg1.yaml +60 -72
  82. data/.data/spec/std/isa/csr/I/pmpcfg10.yaml +120 -144
  83. data/.data/spec/std/isa/csr/I/pmpcfg11.yaml +60 -72
  84. data/.data/spec/std/isa/csr/I/pmpcfg12.yaml +120 -144
  85. data/.data/spec/std/isa/csr/I/pmpcfg13.yaml +60 -72
  86. data/.data/spec/std/isa/csr/I/pmpcfg14.yaml +120 -144
  87. data/.data/spec/std/isa/csr/I/pmpcfg15.yaml +60 -72
  88. data/.data/spec/std/isa/csr/I/pmpcfg2.yaml +120 -144
  89. data/.data/spec/std/isa/csr/I/pmpcfg3.yaml +60 -72
  90. data/.data/spec/std/isa/csr/I/pmpcfg4.yaml +120 -144
  91. data/.data/spec/std/isa/csr/I/pmpcfg5.yaml +60 -72
  92. data/.data/spec/std/isa/csr/I/pmpcfg6.yaml +120 -144
  93. data/.data/spec/std/isa/csr/I/pmpcfg7.yaml +60 -72
  94. data/.data/spec/std/isa/csr/I/pmpcfg8.yaml +120 -144
  95. data/.data/spec/std/isa/csr/I/pmpcfg9.yaml +60 -72
  96. data/.data/spec/std/isa/csr/I/pmpcfgN.layout +15 -18
  97. data/.data/spec/std/isa/csr/jvt.yaml +1 -0
  98. data/.data/spec/std/isa/csr/menvcfg.yaml +20 -0
  99. data/.data/spec/std/isa/csr/mstatus.yaml +8 -6
  100. data/.data/spec/std/isa/csr/senvcfg.yaml +26 -0
  101. data/.data/spec/std/isa/inst/B/andn.yaml +10 -12
  102. data/.data/spec/std/isa/inst/B/clmul.yaml +9 -11
  103. data/.data/spec/std/isa/inst/B/clmulh.yaml +9 -11
  104. data/.data/spec/std/isa/inst/B/orn.yaml +9 -11
  105. data/.data/spec/std/isa/inst/B/rev8.yaml +1 -1
  106. data/.data/spec/std/isa/inst/B/rol.yaml +9 -11
  107. data/.data/spec/std/isa/inst/B/rolw.yaml +9 -11
  108. data/.data/spec/std/isa/inst/B/ror.yaml +9 -11
  109. data/.data/spec/std/isa/inst/B/rorw.yaml +9 -11
  110. data/.data/spec/std/isa/inst/B/xnor.yaml +9 -11
  111. data/.data/spec/std/isa/inst/C/c.ldsp.yaml +3 -3
  112. data/.data/spec/std/isa/inst/I/addi.yaml +1 -0
  113. data/.data/spec/std/isa/inst/I/addiw.yaml +1 -0
  114. data/.data/spec/std/isa/inst/I/andi.yaml +1 -0
  115. data/.data/spec/std/isa/inst/I/auipc.yaml +1 -0
  116. data/.data/spec/std/isa/inst/I/lb.yaml +1 -0
  117. data/.data/spec/std/isa/inst/I/lbu.yaml +1 -0
  118. data/.data/spec/std/isa/inst/I/ld.yaml +2 -0
  119. data/.data/spec/std/isa/inst/I/lh.yaml +1 -0
  120. data/.data/spec/std/isa/inst/I/lhu.yaml +1 -0
  121. data/.data/spec/std/isa/inst/I/lui.yaml +1 -0
  122. data/.data/spec/std/isa/inst/I/lw.yaml +1 -0
  123. data/.data/spec/std/isa/inst/I/lwu.yaml +1 -0
  124. data/.data/spec/std/isa/inst/I/ori.yaml +1 -0
  125. data/.data/spec/std/isa/inst/I/sb.yaml +1 -0
  126. data/.data/spec/std/isa/inst/I/sd.yaml +1 -0
  127. data/.data/spec/std/isa/inst/I/sh.yaml +1 -0
  128. data/.data/spec/std/isa/inst/I/slti.yaml +1 -0
  129. data/.data/spec/std/isa/inst/I/sltiu.yaml +1 -0
  130. data/.data/spec/std/isa/inst/I/sw.yaml +1 -0
  131. data/.data/spec/std/isa/inst/I/xori.yaml +1 -0
  132. data/.data/spec/std/isa/inst/V/vadc.vim.yaml +1 -0
  133. data/.data/spec/std/isa/inst/V/vadd.vi.yaml +1 -0
  134. data/.data/spec/std/isa/inst/V/vand.vi.yaml +1 -0
  135. data/.data/spec/std/isa/inst/V/vle8.v.yaml +1 -0
  136. data/.data/spec/std/isa/inst/V/vmadc.vi.yaml +1 -0
  137. data/.data/spec/std/isa/inst/V/vmadc.vim.yaml +1 -0
  138. data/.data/spec/std/isa/inst/V/vmerge.vim.yaml +1 -0
  139. data/.data/spec/std/isa/inst/V/vmseq.vi.yaml +1 -0
  140. data/.data/spec/std/isa/inst/V/vmsgt.vi.yaml +1 -0
  141. data/.data/spec/std/isa/inst/V/vmsgtu.vi.yaml +1 -0
  142. data/.data/spec/std/isa/inst/V/vmsle.vi.yaml +1 -0
  143. data/.data/spec/std/isa/inst/V/vmsleu.vi.yaml +1 -0
  144. data/.data/spec/std/isa/inst/V/vmsne.vi.yaml +1 -0
  145. data/.data/spec/std/isa/inst/V/vor.vi.yaml +1 -0
  146. data/.data/spec/std/isa/inst/V/vrsub.vi.yaml +1 -0
  147. data/.data/spec/std/isa/inst/V/vsadd.vi.yaml +1 -0
  148. data/.data/spec/std/isa/inst/V/vsaddu.vi.yaml +1 -0
  149. data/.data/spec/std/isa/inst/V/vse8.v.yaml +1 -0
  150. data/.data/spec/std/isa/inst/Zawrs/wrs.nto.yaml +4 -2
  151. data/.data/spec/std/isa/inst/Zba/add.uw.yaml +9 -11
  152. data/.data/spec/std/isa/inst/Zbb/orc.b.yaml +1 -1
  153. data/.data/spec/std/isa/inst/Zbkb/brev8.yaml +3 -3
  154. data/.data/spec/std/isa/inst/Zbkb/unzip.yaml +2 -2
  155. data/.data/spec/std/isa/inst/Zbkb/zip.yaml +2 -2
  156. data/.data/spec/std/isa/inst/Zbkx/xperm4.yaml +2 -2
  157. data/.data/spec/std/isa/inst/Zbkx/xperm8.yaml +2 -2
  158. data/.data/spec/std/isa/inst/Zicbop/prefetch.i.yaml +2 -0
  159. data/.data/spec/std/isa/inst/Zicbop/prefetch.r.yaml +2 -0
  160. data/.data/spec/std/isa/inst/Zicbop/prefetch.w.yaml +2 -0
  161. data/.data/spec/std/isa/inst/Zks/sm3p0.yaml +1 -1
  162. data/.data/spec/std/isa/inst/Zks/sm3p1.yaml +1 -1
  163. data/.data/spec/std/isa/inst/Zks/sm4ed.yaml +1 -1
  164. data/.data/spec/std/isa/inst/Zks/sm4ks.yaml +1 -1
  165. data/.data/spec/std/isa/isa/builtin_functions.idl +1 -0
  166. data/.data/spec/std/isa/isa/globals.isa +27 -7
  167. data/.data/spec/std/isa/isa/interrupts.idl +1 -0
  168. data/.data/spec/std/isa/param/HSTATEEN_CONTEXT_TYPE.yaml +1 -0
  169. data/.data/spec/std/isa/param/MSTATEEN_CONTEXT_TYPE.yaml +1 -0
  170. data/.data/spec/std/isa/param/MTVEC_BASE_ALIGNMENT_DIRECT.yaml +1 -0
  171. data/.data/spec/std/isa/param/MTVEC_BASE_ALIGNMENT_VECTORED.yaml +1 -0
  172. data/.data/spec/std/isa/param/NUM_PMP_ENTRIES.yaml +11 -22
  173. data/.data/spec/std/isa/param/NUM_USABLE_PMP_ENTRIES.yaml +35 -0
  174. data/.data/spec/std/isa/param/PMP_NA4_SUPPORTED.yaml +23 -0
  175. data/.data/spec/std/isa/param/PMP_NAPOT_SUPPORTED.yaml +19 -0
  176. data/.data/spec/std/isa/param/{MSTATUS_TVM_IMPLEMENTED.yaml → PMP_TOR_SUPPORTED.yaml} +6 -6
  177. data/.data/spec/std/isa/param/PRECISE_SYNCHRONOUS_EXCEPTIONS.yaml +1 -0
  178. data/.data/spec/std/isa/param/TRAP_ON_EBREAK.yaml +1 -0
  179. data/.data/spec/std/isa/param/TRAP_ON_ECALL_FROM_M.yaml +1 -0
  180. data/.data/spec/std/isa/param/TRAP_ON_SFENCE_VMA_WHEN_SATP_MODE_IS_READ_ONLY.yaml +1 -0
  181. data/.data/spec/std/isa/param/ZAWRS_NTO_IS_NOP.yaml +19 -0
  182. data/lib/udb/ESPRESSO_VERSION +1 -1
  183. data/lib/udb/config.rb +14 -2
  184. data/lib/udb/doc_link.rb +3 -4
  185. data/lib/udb/obj/instruction.rb +1 -1
  186. data/lib/udb/obj/non_isa_specification.rb +22 -100
  187. data/lib/udb/version.rb +1 -1
  188. data/lib/udb/z3.rb +2 -2
  189. metadata +7 -3
@@ -38,21 +38,13 @@ fields:
38
38
  h! L ! 7 ! Locks the entry from further modification. Additionally, when set, PMP checks also apply to M-mode for the entry.
39
39
  h! MT ! 6:5 ! When the `Smpmpmt` extension is implemented, MT (Memory Type) is a WARL field that overrides the memory type for accesses that match this PMP entry. See the `Smpmpmt` extension definition for encodings. When the `Smpmpmt` extension is not implemented, MT is _Reserved_ Writes shall be ignored.
40
40
  h! A ! 4:3
41
- a! Address matching mode. One of:
41
+ a! Address matching mode. Encodings:
42
42
 
43
- [when="PMP_GRANULARITY < 2"]
44
43
  * *OFF* (0) - Null region (disabled)
45
44
  * *TOR* (1) - Top of range
46
45
  * *NA4* (2) - Naturally aligned four-byte region
47
46
  * *NAPOT* (3) - Naturally aligned power of two
48
47
 
49
- [when="PMP_GRANULARITY >= 2"]
50
- * *OFF* (0) - Null region (disabled)
51
- * *TOR* (1) - Top of range
52
- * *NAPOT* (3) - Naturally aligned power of two
53
-
54
- [when="PMP_GRANULARITY >= 2"]
55
- Naturally aligned four-byte region, *NA4* (2), is not valid (not needed when the PMP granularity is larger than 4 bytes).
56
48
 
57
49
  h! X ! 2 ! When clear, instruction fetches cause an `Access Fault` for the matching region and privilege mode.
58
50
  h! W ! 1 ! When clear, stores and AMOs cause an `Access Fault` for the matching region and privilege mode.
@@ -61,23 +53,28 @@ fields:
61
53
 
62
54
  The combination of R = 0, W = 1 is reserved.
63
55
  type(): |
64
- if (NUM_PMP_ENTRIES > 36) {
56
+ if (NUM_USABLE_PMP_ENTRIES > 36) {
65
57
  return CsrFieldType::RWR;
66
58
  } else {
59
+ # entry is either not implemented or implemented as read-only zero
67
60
  return CsrFieldType::RO;
68
61
  }
69
62
  reset_value(): |
70
63
  return 0;
71
64
  sw_write(csr_value): |
72
- if ((CSR[pmpcfg9].pmp36cfg & 0x80) == 0) {
73
- # entry is not locked
74
- if (!(((csr_value.pmp36cfg & 0x1) == 0) && ((csr_value.pmp36cfg & 0x2) == 0x2))) {
75
- # not R = 0, W =1, which is reserved
76
- if ((PMP_GRANULARITY < 2) ||
77
- ((csr_value.pmp36cfg & 0x18) != 0x10)) {
78
- # NA4 is not allowed when PMP granularity is larger than 4 bytes
79
- return csr_value.pmp36cfg;
65
+ if (NUM_USABLE_PMP_ENTRIES > 36 && (CSR[pmpcfg9].pmp36cfg & 0x80) == 0) {
66
+ # entry is usable and not locked
67
+ Bits<8> new_cfg = csr_value.pmp36cfg;
68
+ Bits<2> a_mode = (new_cfg & 0x18) >> 3;
69
+ if (!(((new_cfg & 0x1) == 0) && ((new_cfg & 0x2) == 0x2))) {
70
+ # not R = 0, W = 1, which is reserved
71
+ if (((a_mode == 0x1) && !PMP_TOR_SUPPORTED) ||
72
+ ((a_mode == 0x2) && !PMP_NA4_SUPPORTED) ||
73
+ ((a_mode == 0x3) && !PMP_NAPOT_SUPPORTED)) {
74
+ # unsupported address matching mode; keep old value
75
+ return CSR[pmpcfg9].pmp36cfg;
80
76
  }
77
+ return new_cfg;
81
78
  }
82
79
  }
83
80
  # fall through: keep old value
@@ -96,21 +93,13 @@ fields:
96
93
  h! L ! 15 ! Locks the entry from further modification. Additionally, when set, PMP checks also apply to M-mode for the entry.
97
94
  h! MT ! 14:13 ! When the `Smpmpmt` extension is implemented, MT (Memory Type) is a WARL field that overrides the memory type for accesses that match this PMP entry. See the `Smpmpmt` extension definition for encodings. When the `Smpmpmt` extension is not implemented, MT is _Reserved_ Writes shall be ignored.
98
95
  h! A ! 12:11
99
- a! Address matching mode. One of:
96
+ a! Address matching mode. Encodings:
100
97
 
101
- [when="PMP_GRANULARITY < 2"]
102
98
  * *OFF* (0) - Null region (disabled)
103
99
  * *TOR* (1) - Top of range
104
100
  * *NA4* (2) - Naturally aligned four-byte region
105
101
  * *NAPOT* (3) - Naturally aligned power of two
106
102
 
107
- [when="PMP_GRANULARITY >= 2"]
108
- * *OFF* (0) - Null region (disabled)
109
- * *TOR* (1) - Top of range
110
- * *NAPOT* (3) - Naturally aligned power of two
111
-
112
- [when="PMP_GRANULARITY >= 2"]
113
- Naturally aligned four-byte region, *NA4* (2), is not valid (not needed when the PMP granularity is larger than 4 bytes).
114
103
 
115
104
  h! X ! 10 ! When clear, instruction fetches cause an `Access Fault` for the matching region and privilege mode.
116
105
  h! W ! 9 ! When clear, stores and AMOs cause an `Access Fault` for the matching region and privilege mode.
@@ -119,23 +108,28 @@ fields:
119
108
 
120
109
  The combination of R = 0, W = 1 is reserved.
121
110
  type(): |
122
- if (NUM_PMP_ENTRIES > 37) {
111
+ if (NUM_USABLE_PMP_ENTRIES > 37) {
123
112
  return CsrFieldType::RWR;
124
113
  } else {
114
+ # entry is either not implemented or implemented as read-only zero
125
115
  return CsrFieldType::RO;
126
116
  }
127
117
  reset_value(): |
128
118
  return 0;
129
119
  sw_write(csr_value): |
130
- if ((CSR[pmpcfg9].pmp37cfg & 0x80) == 0) {
131
- # entry is not locked
132
- if (!(((csr_value.pmp37cfg & 0x1) == 0) && ((csr_value.pmp37cfg & 0x2) == 0x2))) {
133
- # not R = 0, W =1, which is reserved
134
- if ((PMP_GRANULARITY < 2) ||
135
- ((csr_value.pmp37cfg & 0x18) != 0x10)) {
136
- # NA4 is not allowed when PMP granularity is larger than 4 bytes
137
- return csr_value.pmp37cfg;
120
+ if (NUM_USABLE_PMP_ENTRIES > 37 && (CSR[pmpcfg9].pmp37cfg & 0x80) == 0) {
121
+ # entry is usable and not locked
122
+ Bits<8> new_cfg = csr_value.pmp37cfg;
123
+ Bits<2> a_mode = (new_cfg & 0x18) >> 3;
124
+ if (!(((new_cfg & 0x1) == 0) && ((new_cfg & 0x2) == 0x2))) {
125
+ # not R = 0, W = 1, which is reserved
126
+ if (((a_mode == 0x1) && !PMP_TOR_SUPPORTED) ||
127
+ ((a_mode == 0x2) && !PMP_NA4_SUPPORTED) ||
128
+ ((a_mode == 0x3) && !PMP_NAPOT_SUPPORTED)) {
129
+ # unsupported address matching mode; keep old value
130
+ return CSR[pmpcfg9].pmp37cfg;
138
131
  }
132
+ return new_cfg;
139
133
  }
140
134
  }
141
135
  # fall through: keep old value
@@ -154,21 +148,13 @@ fields:
154
148
  h! L ! 23 ! Locks the entry from further modification. Additionally, when set, PMP checks also apply to M-mode for the entry.
155
149
  h! MT ! 22:21 ! When the `Smpmpmt` extension is implemented, MT (Memory Type) is a WARL field that overrides the memory type for accesses that match this PMP entry. See the `Smpmpmt` extension definition for encodings. When the `Smpmpmt` extension is not implemented, MT is _Reserved_ Writes shall be ignored.
156
150
  h! A ! 20:19
157
- a! Address matching mode. One of:
151
+ a! Address matching mode. Encodings:
158
152
 
159
- [when="PMP_GRANULARITY < 2"]
160
153
  * *OFF* (0) - Null region (disabled)
161
154
  * *TOR* (1) - Top of range
162
155
  * *NA4* (2) - Naturally aligned four-byte region
163
156
  * *NAPOT* (3) - Naturally aligned power of two
164
157
 
165
- [when="PMP_GRANULARITY >= 2"]
166
- * *OFF* (0) - Null region (disabled)
167
- * *TOR* (1) - Top of range
168
- * *NAPOT* (3) - Naturally aligned power of two
169
-
170
- [when="PMP_GRANULARITY >= 2"]
171
- Naturally aligned four-byte region, *NA4* (2), is not valid (not needed when the PMP granularity is larger than 4 bytes).
172
158
 
173
159
  h! X ! 18 ! When clear, instruction fetches cause an `Access Fault` for the matching region and privilege mode.
174
160
  h! W ! 17 ! When clear, stores and AMOs cause an `Access Fault` for the matching region and privilege mode.
@@ -177,23 +163,28 @@ fields:
177
163
 
178
164
  The combination of R = 0, W = 1 is reserved.
179
165
  type(): |
180
- if (NUM_PMP_ENTRIES > 38) {
166
+ if (NUM_USABLE_PMP_ENTRIES > 38) {
181
167
  return CsrFieldType::RWR;
182
168
  } else {
169
+ # entry is either not implemented or implemented as read-only zero
183
170
  return CsrFieldType::RO;
184
171
  }
185
172
  reset_value(): |
186
173
  return 0;
187
174
  sw_write(csr_value): |
188
- if ((CSR[pmpcfg9].pmp38cfg & 0x80) == 0) {
189
- # entry is not locked
190
- if (!(((csr_value.pmp38cfg & 0x1) == 0) && ((csr_value.pmp38cfg & 0x2) == 0x2))) {
191
- # not R = 0, W =1, which is reserved
192
- if ((PMP_GRANULARITY < 2) ||
193
- ((csr_value.pmp38cfg & 0x18) != 0x10)) {
194
- # NA4 is not allowed when PMP granularity is larger than 4 bytes
195
- return csr_value.pmp38cfg;
175
+ if (NUM_USABLE_PMP_ENTRIES > 38 && (CSR[pmpcfg9].pmp38cfg & 0x80) == 0) {
176
+ # entry is usable and not locked
177
+ Bits<8> new_cfg = csr_value.pmp38cfg;
178
+ Bits<2> a_mode = (new_cfg & 0x18) >> 3;
179
+ if (!(((new_cfg & 0x1) == 0) && ((new_cfg & 0x2) == 0x2))) {
180
+ # not R = 0, W = 1, which is reserved
181
+ if (((a_mode == 0x1) && !PMP_TOR_SUPPORTED) ||
182
+ ((a_mode == 0x2) && !PMP_NA4_SUPPORTED) ||
183
+ ((a_mode == 0x3) && !PMP_NAPOT_SUPPORTED)) {
184
+ # unsupported address matching mode; keep old value
185
+ return CSR[pmpcfg9].pmp38cfg;
196
186
  }
187
+ return new_cfg;
197
188
  }
198
189
  }
199
190
  # fall through: keep old value
@@ -212,21 +203,13 @@ fields:
212
203
  h! L ! 31 ! Locks the entry from further modification. Additionally, when set, PMP checks also apply to M-mode for the entry.
213
204
  h! MT ! 30:29 ! When the `Smpmpmt` extension is implemented, MT (Memory Type) is a WARL field that overrides the memory type for accesses that match this PMP entry. See the `Smpmpmt` extension definition for encodings. When the `Smpmpmt` extension is not implemented, MT is _Reserved_ Writes shall be ignored.
214
205
  h! A ! 28:27
215
- a! Address matching mode. One of:
206
+ a! Address matching mode. Encodings:
216
207
 
217
- [when="PMP_GRANULARITY < 2"]
218
208
  * *OFF* (0) - Null region (disabled)
219
209
  * *TOR* (1) - Top of range
220
210
  * *NA4* (2) - Naturally aligned four-byte region
221
211
  * *NAPOT* (3) - Naturally aligned power of two
222
212
 
223
- [when="PMP_GRANULARITY >= 2"]
224
- * *OFF* (0) - Null region (disabled)
225
- * *TOR* (1) - Top of range
226
- * *NAPOT* (3) - Naturally aligned power of two
227
-
228
- [when="PMP_GRANULARITY >= 2"]
229
- Naturally aligned four-byte region, *NA4* (2), is not valid (not needed when the PMP granularity is larger than 4 bytes).
230
213
 
231
214
  h! X ! 26 ! When clear, instruction fetches cause an `Access Fault` for the matching region and privilege mode.
232
215
  h! W ! 25 ! When clear, stores and AMOs cause an `Access Fault` for the matching region and privilege mode.
@@ -235,23 +218,28 @@ fields:
235
218
 
236
219
  The combination of R = 0, W = 1 is reserved.
237
220
  type(): |
238
- if (NUM_PMP_ENTRIES > 39) {
221
+ if (NUM_USABLE_PMP_ENTRIES > 39) {
239
222
  return CsrFieldType::RWR;
240
223
  } else {
224
+ # entry is either not implemented or implemented as read-only zero
241
225
  return CsrFieldType::RO;
242
226
  }
243
227
  reset_value(): |
244
228
  return 0;
245
229
  sw_write(csr_value): |
246
- if ((CSR[pmpcfg9].pmp39cfg & 0x80) == 0) {
247
- # entry is not locked
248
- if (!(((csr_value.pmp39cfg & 0x1) == 0) && ((csr_value.pmp39cfg & 0x2) == 0x2))) {
249
- # not R = 0, W =1, which is reserved
250
- if ((PMP_GRANULARITY < 2) ||
251
- ((csr_value.pmp39cfg & 0x18) != 0x10)) {
252
- # NA4 is not allowed when PMP granularity is larger than 4 bytes
253
- return csr_value.pmp39cfg;
230
+ if (NUM_USABLE_PMP_ENTRIES > 39 && (CSR[pmpcfg9].pmp39cfg & 0x80) == 0) {
231
+ # entry is usable and not locked
232
+ Bits<8> new_cfg = csr_value.pmp39cfg;
233
+ Bits<2> a_mode = (new_cfg & 0x18) >> 3;
234
+ if (!(((new_cfg & 0x1) == 0) && ((new_cfg & 0x2) == 0x2))) {
235
+ # not R = 0, W = 1, which is reserved
236
+ if (((a_mode == 0x1) && !PMP_TOR_SUPPORTED) ||
237
+ ((a_mode == 0x2) && !PMP_NA4_SUPPORTED) ||
238
+ ((a_mode == 0x3) && !PMP_NAPOT_SUPPORTED)) {
239
+ # unsupported address matching mode; keep old value
240
+ return CSR[pmpcfg9].pmp39cfg;
254
241
  }
242
+ return new_cfg;
255
243
  }
256
244
  }
257
245
  # fall through: keep old value
@@ -50,21 +50,13 @@ fields:
50
50
  h! L ! <%= ((i+1)*8)-1 %> ! Locks the entry from further modification. Additionally, when set, PMP checks also apply to M-mode for the entry.
51
51
  h! MT ! <%= ((i+1)*8)-2 %>:<%= ((i+1)*8)-3 %> ! When the `Smpmpmt` extension is implemented, MT (Memory Type) is a WARL field that overrides the memory type for accesses that match this PMP entry. See the `Smpmpmt` extension definition for encodings. When the `Smpmpmt` extension is not implemented, MT is _Reserved_ Writes shall be ignored.
52
52
  h! A ! <%= ((i+1)*8)-4 %>:<%= ((i+1)*8)-5 %>
53
- a! Address matching mode. One of:
53
+ a! Address matching mode. Encodings:
54
54
 
55
- [when="PMP_GRANULARITY < 2"]
56
55
  * *OFF* (0) - Null region (disabled)
57
56
  * *TOR* (1) - Top of range
58
57
  * *NA4* (2) - Naturally aligned four-byte region
59
58
  * *NAPOT* (3) - Naturally aligned power of two
60
59
 
61
- [when="PMP_GRANULARITY >= 2"]
62
- * *OFF* (0) - Null region (disabled)
63
- * *TOR* (1) - Top of range
64
- * *NAPOT* (3) - Naturally aligned power of two
65
-
66
- [when="PMP_GRANULARITY >= 2"]
67
- Naturally aligned four-byte region, *NA4* (2), is not valid (not needed when the PMP granularity is larger than 4 bytes).
68
60
 
69
61
  h! X ! <%= ((i)*8)+2 %> ! When clear, instruction fetches cause an `Access Fault` for the matching region and privilege mode.
70
62
  h! W ! <%= ((i)*8)+1 %> ! When clear, stores and AMOs cause an `Access Fault` for the matching region and privilege mode.
@@ -73,23 +65,28 @@ fields:
73
65
 
74
66
  The combination of R = 0, W = 1 is reserved.
75
67
  type(): |
76
- if (NUM_PMP_ENTRIES > <%= pmpcfg_num*4 + i %>) {
68
+ if (NUM_USABLE_PMP_ENTRIES > <%= pmpcfg_num*4 + i %>) {
77
69
  return CsrFieldType::RWR;
78
70
  } else {
71
+ # entry is either not implemented or implemented as read-only zero
79
72
  return CsrFieldType::RO;
80
73
  }
81
74
  reset_value(): |
82
75
  return 0;
83
76
  sw_write(csr_value): |
84
- if (<%- if i > 4 -%>(xlen() == 64) && <%- end -%>(CSR[<%= "pmpcfg#{pmpcfg_num}" %>].pmp<%= pmpcfg_num*4 + i %>cfg & 0x80) == 0) {
85
- # entry is not locked
86
- if (!(((csr_value.pmp<%= pmpcfg_num*4 + i %>cfg & 0x1) == 0) && ((csr_value.pmp<%= pmpcfg_num*4 + i %>cfg & 0x2) == 0x2))) {
87
- # not R = 0, W =1, which is reserved
88
- if ((PMP_GRANULARITY < 2) ||
89
- ((csr_value.pmp<%= pmpcfg_num*4 + i %>cfg & 0x18) != 0x10)) {
90
- # NA4 is not allowed when PMP granularity is larger than 4 bytes
91
- return csr_value.pmp<%= pmpcfg_num*4 + i %>cfg;
77
+ if (<%- if i > 4 -%>(xlen() == 64) && <%- end -%>NUM_USABLE_PMP_ENTRIES > <%= pmpcfg_num*4 + i %> && (CSR[<%= "pmpcfg#{pmpcfg_num}" %>].pmp<%= pmpcfg_num*4 + i %>cfg & 0x80) == 0) {
78
+ # entry is usable and not locked
79
+ Bits<8> new_cfg = csr_value.pmp<%= pmpcfg_num*4 + i %>cfg;
80
+ Bits<2> a_mode = (new_cfg & 0x18) >> 3;
81
+ if (!(((new_cfg & 0x1) == 0) && ((new_cfg & 0x2) == 0x2))) {
82
+ # not R = 0, W = 1, which is reserved
83
+ if (((a_mode == 0x1) && !PMP_TOR_SUPPORTED) ||
84
+ ((a_mode == 0x2) && !PMP_NA4_SUPPORTED) ||
85
+ ((a_mode == 0x3) && !PMP_NAPOT_SUPPORTED)) {
86
+ # unsupported address matching mode; keep old value
87
+ return CSR[<%= "pmpcfg#{pmpcfg_num}" %>].pmp<%= pmpcfg_num*4 + i %>cfg;
92
88
  }
89
+ return new_cfg;
93
90
  }
94
91
  }
95
92
  # fall through: keep old value
@@ -56,6 +56,7 @@ fields:
56
56
  && (CSR[sstateen0].JVT == 1'b0 || CSR[hstateen0].JVT == 1'b0) )) {
57
57
 
58
58
  unimplemented_csr($encoding);
59
+ return 0;
59
60
  }
60
61
  else {
61
62
  if (JVT_BASE_TYPE == "custom") {
@@ -296,6 +296,26 @@ fields:
296
296
  name: Zicfiss
297
297
  type: RW
298
298
  reset_value: UNDEFINED_LEGAL
299
+ LPE:
300
+ location: 2
301
+ description: |
302
+ *Landing Pad Enable*
303
+
304
+ When the LPE field is set to 1 and S-mode is implemented, the Zicfilp
305
+ extension is enabled in S-mode. If the LPE field is set to 1 and S-mode
306
+ is not implemented, the Zicfilp extension is enabled in U-mode. When the
307
+ LPE field is 0, the Zicfilp extension is not enabled in S-mode (or U-mode
308
+ if S-mode is not implemented), and the following rules apply:
309
+
310
+ * The hart does not update the `ELP` state; it remains as `NO_LP_EXPECTED`.
311
+ * The `LPAD` instruction operates as a no-op.
312
+
313
+ When `menvcfg.LPE` is 0, `henvcfg.LPE` and `senvcfg.LPE` are read-only zero.
314
+ definedBy:
315
+ extension:
316
+ name: Zicfilp
317
+ type: RW
318
+ reset_value: UNDEFINED_LEGAL
299
319
  FIOM:
300
320
  location: 0
301
321
  description: |
@@ -328,6 +328,8 @@ fields:
328
328
  type(): |
329
329
  if (CSR[misa].S == 1'b0) {
330
330
  return CsrFieldType::RO;
331
+ } else if (!(implemented?(ExtensionName::Sv32) || implemented?(ExtensionName::Sv39) || implemented?(ExtensionName::Sv48) || implemented?(ExtensionName::Sv57))) {
332
+ return CsrFieldType::RO;
331
333
  } else {
332
334
  return CsrFieldType::RW;
333
335
  }
@@ -337,18 +339,18 @@ fields:
337
339
  reset_value(): |
338
340
  if (CSR[misa].S == 1'b0) {
339
341
  return 0;
340
- } else if (MSTATUS_TVM_IMPLEMENTED) {
341
- return UNDEFINED_LEGAL;
342
- } else {
342
+ } else if (!(implemented?(ExtensionName::Sv32) || implemented?(ExtensionName::Sv39) || implemented?(ExtensionName::Sv48) || implemented?(ExtensionName::Sv57))) {
343
343
  return 0;
344
+ } else {
345
+ return UNDEFINED_LEGAL;
344
346
  }
345
347
  sw_write(csr_value): |
346
348
  if (CSR[misa].S == 1'b0) {
347
349
  return 0;
348
- } else if (MSTATUS_TVM_IMPLEMENTED) {
349
- return csr_value.TVM;
350
- } else {
350
+ } else if (!(implemented?(ExtensionName::Sv32) || implemented?(ExtensionName::Sv39) || implemented?(ExtensionName::Sv48) || implemented?(ExtensionName::Sv57))) {
351
351
  return 0;
352
+ } else {
353
+ return csr_value.TVM;
352
354
  }
353
355
  MXR:
354
356
  location: 19
@@ -165,6 +165,28 @@ fields:
165
165
  return 0;
166
166
  }
167
167
  return csr_value.SSE;
168
+ LPE:
169
+ location: 2
170
+ description: |
171
+ *Landing Pad Enable*
172
+
173
+ When the LPE field is set to 1 and `menvcfg.LPE` is 1, the Zicfilp extension
174
+ is enabled in U/VU-mode. Read-only zero when `menvcfg.LPE` is 0. When the LPE
175
+ field is 0, the Zicfilp extension is not enabled in U/VU-mode and the following
176
+ rules apply:
177
+
178
+ * The hart does not update the `ELP` state; it remains as `NO_LP_EXPECTED`.
179
+ * The `LPAD` instruction operates as a no-op.
180
+ definedBy:
181
+ extension:
182
+ name: Zicfilp
183
+ type: RW
184
+ reset_value: UNDEFINED_LEGAL
185
+ sw_write(csr_value): |
186
+ if (CSR[menvcfg].LPE == 0) {
187
+ return 0;
188
+ }
189
+ return csr_value.LPE;
168
190
  FIOM:
169
191
  location: 0
170
192
  description: |
@@ -202,4 +224,8 @@ sw_read(): |
202
224
  # senvcfg.SSE must read-as-zero
203
225
  value = value & ~(1 `<< 3);
204
226
  }
227
+ if (implemented?(ExtensionName::Zicfilp) && CSR[menvcfg].LPE == 0) {
228
+ # senvcfg.LPE must read-as-zero when menvcfg.LPE is 0
229
+ value = value & ~(1 `<< 2);
230
+ }
205
231
  return value;
@@ -16,17 +16,15 @@ definedBy:
16
16
  - name: Zbb
17
17
  - name: Zbkb
18
18
  assembly: xd, xs1, xs2
19
- format:
20
- $inherits:
21
- - inst_subtype/R/R-x.yaml#/data
22
- opcodes:
23
- funct7:
24
- display_name: ANDN
25
- value: 0b0100000
26
- funct3:
27
- display_name: ANDN
28
- value: 0b111
29
- opcode: { $inherits: inst_opcode/OP.yaml#/data }
19
+ encoding:
20
+ match: 0100000----------111-----0110011
21
+ variables:
22
+ - name: xs2
23
+ location: 24-20
24
+ - name: xs1
25
+ location: 19-15
26
+ - name: xd
27
+ location: 11-7
30
28
  access:
31
29
  s: always
32
30
  u: always
@@ -38,4 +36,4 @@ operation(): |
38
36
  raise (ExceptionCode::IllegalInstruction, mode(), $encoding);
39
37
  }
40
38
 
41
- X[xd] = X[xs2] & ~X[xs1];
39
+ X[xd] = X[xs1] & ~X[xs2];
@@ -15,17 +15,15 @@ definedBy:
15
15
  - name: Zbc
16
16
  - name: Zbkc
17
17
  assembly: xd, xs1, xs2
18
- format:
19
- $inherits:
20
- - inst_subtype/R/R-x.yaml#/data
21
- opcodes:
22
- funct7:
23
- display_name: CLMUL
24
- value: 0b0000101
25
- funct3:
26
- display_name: CLMUL
27
- value: 0b001
28
- opcode: { $inherits: inst_opcode/OP.yaml#/data }
18
+ encoding:
19
+ match: 0000101----------001-----0110011
20
+ variables:
21
+ - name: xs2
22
+ location: 24-20
23
+ - name: xs1
24
+ location: 19-15
25
+ - name: xd
26
+ location: 11-7
29
27
  access:
30
28
  s: always
31
29
  u: always
@@ -15,17 +15,15 @@ definedBy:
15
15
  - name: Zbc
16
16
  - name: Zbkc
17
17
  assembly: xd, xs1, xs2
18
- format:
19
- $inherits:
20
- - inst_subtype/R/R-x.yaml#/data
21
- opcodes:
22
- funct7:
23
- display_name: CLMUL
24
- value: 0b0000101
25
- funct3:
26
- display_name: CLMULH
27
- value: 0b011
28
- opcode: { $inherits: inst_opcode/OP.yaml#/data }
18
+ encoding:
19
+ match: 0000101----------011-----0110011
20
+ variables:
21
+ - name: xs2
22
+ location: 24-20
23
+ - name: xs1
24
+ location: 19-15
25
+ - name: xd
26
+ location: 11-7
29
27
  access:
30
28
  s: always
31
29
  u: always
@@ -15,17 +15,15 @@ definedBy:
15
15
  - name: Zbb
16
16
  - name: Zbkb
17
17
  assembly: xd, xs1, xs2
18
- format:
19
- $inherits:
20
- - inst_subtype/R/R-x.yaml#/data
21
- opcodes:
22
- funct7:
23
- display_name: ORN
24
- value: 0b0100000
25
- funct3:
26
- display_name: ORN
27
- value: 0b110
28
- opcode: { $inherits: inst_opcode/OP.yaml#/data }
18
+ encoding:
19
+ match: 0100000----------110-----0110011
20
+ variables:
21
+ - name: xs2
22
+ location: 24-20
23
+ - name: xs1
24
+ location: 19-15
25
+ - name: xd
26
+ location: 11-7
29
27
  access:
30
28
  s: always
31
29
  u: always
@@ -54,7 +54,7 @@ operation(): |
54
54
 
55
55
  XReg j = xlen() - 1;
56
56
 
57
- for (U32 i=0; i<(xlen()-8); i = i+8) {
57
+ for (U32 i=0; i < xlen(); i = i+8) {
58
58
  output[(i+7):i] = input[j:(j-7)];
59
59
  j = j - 8;
60
60
  }
@@ -15,17 +15,15 @@ definedBy:
15
15
  - name: Zbb
16
16
  - name: Zbkb
17
17
  assembly: xd, xs1, xs2
18
- format:
19
- $inherits:
20
- - inst_subtype/R/R-x.yaml#/data
21
- opcodes:
22
- funct7:
23
- display_name: ROL
24
- value: 0b0110000
25
- funct3:
26
- display_name: ROL
27
- value: 0b001
28
- opcode: { $inherits: inst_opcode/OP.yaml#/data }
18
+ encoding:
19
+ match: 0110000----------001-----0110011
20
+ variables:
21
+ - name: xs2
22
+ location: 24-20
23
+ - name: xs1
24
+ location: 19-15
25
+ - name: xd
26
+ location: 11-7
29
27
  access:
30
28
  s: always
31
29
  u: always
@@ -18,17 +18,15 @@ definedBy:
18
18
  - name: Zbb
19
19
  - name: Zbkb
20
20
  assembly: xd, xs1, xs2
21
- format:
22
- $inherits:
23
- - inst_subtype/R/R-x.yaml#/data
24
- opcodes:
25
- funct7:
26
- display_name: ROLW
27
- value: 0b0110000
28
- funct3:
29
- display_name: ROLW
30
- value: 0b001
31
- opcode: { $inherits: inst_opcode/OP-32.yaml#/data }
21
+ encoding:
22
+ match: 0110000----------001-----0111011
23
+ variables:
24
+ - name: xs2
25
+ location: 24-20
26
+ - name: xs1
27
+ location: 19-15
28
+ - name: xd
29
+ location: 11-7
32
30
  access:
33
31
  s: always
34
32
  u: always
@@ -15,17 +15,15 @@ definedBy:
15
15
  - name: Zbb
16
16
  - name: Zbkb
17
17
  assembly: xd, xs1, xs2
18
- format:
19
- $inherits:
20
- - inst_subtype/R/R-x.yaml#/data
21
- opcodes:
22
- funct7:
23
- display_name: ROR
24
- value: 0b0110000
25
- funct3:
26
- display_name: ROR
27
- value: 0b101
28
- opcode: { $inherits: inst_opcode/OP.yaml#/data }
18
+ encoding:
19
+ match: 0110000----------101-----0110011
20
+ variables:
21
+ - name: xs2
22
+ location: 24-20
23
+ - name: xs1
24
+ location: 19-15
25
+ - name: xd
26
+ location: 11-7
29
27
  access:
30
28
  s: always
31
29
  u: always
@@ -19,17 +19,15 @@ definedBy:
19
19
  - name: Zbb
20
20
  - name: Zbkb
21
21
  assembly: xd, xs1, xs2
22
- format:
23
- $inherits:
24
- - inst_subtype/R/R-x.yaml#/data
25
- opcodes:
26
- funct7:
27
- display_name: RORW
28
- value: 0b0110000
29
- funct3:
30
- display_name: RORW
31
- value: 0b101
32
- opcode: { $inherits: inst_opcode/OP-32.yaml#/data }
22
+ encoding:
23
+ match: 0110000----------101-----0111011
24
+ variables:
25
+ - name: xs2
26
+ location: 24-20
27
+ - name: xs1
28
+ location: 19-15
29
+ - name: xd
30
+ location: 11-7
33
31
  access:
34
32
  s: always
35
33
  u: always