udb 0.1.9 → 0.1.13

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 (275) hide show
  1. checksums.yaml +4 -4
  2. data/.data/cfgs/example_rv64_with_overlay.yaml +5 -2
  3. data/.data/cfgs/mc100-32-full-example.yaml +1 -0
  4. data/.data/cfgs/profile/README.adoc +10 -0
  5. data/.data/cfgs/profile/RVA20S64.yaml +26 -6
  6. data/.data/cfgs/profile/RVA20U64.yaml +18 -4
  7. data/.data/cfgs/profile/RVA22S64.yaml +27 -7
  8. data/.data/cfgs/profile/RVA22U64.yaml +18 -4
  9. data/.data/cfgs/profile/RVA23S64.yaml +61 -7
  10. data/.data/cfgs/profile/RVA23U64.yaml +36 -4
  11. data/.data/cfgs/profile/RVB23S64.yaml +27 -7
  12. data/.data/cfgs/profile/RVB23U64.yaml +18 -4
  13. data/.data/cfgs/profile/RVI20U32.yaml +10 -4
  14. data/.data/cfgs/profile/RVI20U64.yaml +10 -4
  15. data/.data/cfgs/qc_iu.yaml +4 -1
  16. data/.data/cfgs/rv32-riscv-tests.yaml +2 -1
  17. data/.data/cfgs/rv32-vector.yaml +2 -1
  18. data/.data/cfgs/rv64-riscv-tests.yaml +2 -1
  19. data/.data/cfgs/rv64-vector.yaml +2 -1
  20. data/.data/spec/custom/isa/qc_iu/csr/Smrnmi/mnepc.yaml +17 -0
  21. data/.data/spec/custom/isa/qc_iu/csr/Xqccmi/qc.itba.yaml +45 -0
  22. data/.data/spec/custom/isa/qc_iu/csr/Xqccmi/qc.itdec.yaml +39 -0
  23. data/.data/spec/custom/isa/qc_iu/csr/jvt.yaml +11 -0
  24. data/.data/spec/custom/isa/qc_iu/csr/mepc.yaml +16 -0
  25. data/.data/spec/custom/isa/qc_iu/ext/Xqccmi.yaml +219 -0
  26. data/.data/spec/custom/isa/qc_iu/ext/Xqccmt.yaml +127 -0
  27. data/.data/spec/custom/isa/qc_iu/inst/Xqccmi/qc.cm.ilut.yaml +153 -0
  28. data/.data/spec/custom/isa/qc_iu/inst/Xqccmt/qc.cm.jalt.yaml +84 -0
  29. data/.data/spec/custom/isa/qc_iu/inst/Xqccmt/qc.cm.jt.yaml +60 -0
  30. data/.data/spec/custom/isa/qc_iu/isa/globals.isa +112 -0
  31. data/.data/spec/schemas/config_schema.json +219 -26
  32. data/.data/spec/schemas/csr_schema.json +0 -6
  33. data/.data/spec/schemas/ext_schema.json +80 -24
  34. data/.data/spec/schemas/inst_schema.json +0 -3
  35. data/.data/spec/schemas/profile_release_schema.json +1 -1
  36. data/.data/spec/schemas/profile_schema.json +0 -3
  37. data/.data/spec/schemas/register_file_schema.json +8 -3
  38. data/.data/spec/schemas/schema_defs.json +8 -27
  39. data/.data/spec/std/isa/csr/I/pmpcfg0.yaml +8 -8
  40. data/.data/spec/std/isa/csr/I/pmpcfg1.yaml +4 -4
  41. data/.data/spec/std/isa/csr/I/pmpcfg10.yaml +8 -8
  42. data/.data/spec/std/isa/csr/I/pmpcfg11.yaml +4 -4
  43. data/.data/spec/std/isa/csr/I/pmpcfg12.yaml +8 -8
  44. data/.data/spec/std/isa/csr/I/pmpcfg13.yaml +4 -4
  45. data/.data/spec/std/isa/csr/I/pmpcfg14.yaml +8 -8
  46. data/.data/spec/std/isa/csr/I/pmpcfg15.yaml +4 -4
  47. data/.data/spec/std/isa/csr/I/pmpcfg2.yaml +8 -8
  48. data/.data/spec/std/isa/csr/I/pmpcfg3.yaml +4 -4
  49. data/.data/spec/std/isa/csr/I/pmpcfg4.yaml +8 -8
  50. data/.data/spec/std/isa/csr/I/pmpcfg5.yaml +4 -4
  51. data/.data/spec/std/isa/csr/I/pmpcfg6.yaml +8 -8
  52. data/.data/spec/std/isa/csr/I/pmpcfg7.yaml +4 -4
  53. data/.data/spec/std/isa/csr/I/pmpcfg8.yaml +8 -8
  54. data/.data/spec/std/isa/csr/I/pmpcfg9.yaml +4 -4
  55. data/.data/spec/std/isa/csr/I/pmpcfgN.layout +1 -1
  56. data/.data/spec/std/isa/csr/Zicntr/mcountinhibit.layout +6 -2
  57. data/.data/spec/std/isa/csr/Zicntr/mcountinhibit.yaml +6 -2
  58. data/.data/spec/std/isa/csr/hstatus.yaml +16 -0
  59. data/.data/spec/std/isa/csr/mcycleh.yaml +1 -1
  60. data/.data/spec/std/isa/csr/misa.yaml +0 -12
  61. data/.data/spec/std/isa/csr/mstatus.yaml +38 -0
  62. data/.data/spec/std/isa/csr/mstatush.yaml +17 -15
  63. data/.data/spec/std/isa/csr/senvcfg.yaml +16 -0
  64. data/.data/spec/std/isa/csr/sstatus.yaml +12 -0
  65. data/.data/spec/std/isa/csr/vsstatus.yaml +24 -0
  66. data/.data/spec/std/isa/ext/A.yaml +5 -7
  67. data/.data/spec/std/isa/ext/S.yaml +12 -0
  68. data/.data/spec/std/isa/ext/Smpmpmt.yaml +52 -0
  69. data/.data/spec/std/isa/ext/Sv32.yaml +7 -19
  70. data/.data/spec/std/isa/ext/Sv39.yaml +7 -19
  71. data/.data/spec/std/isa/ext/Sv48.yaml +4 -20
  72. data/.data/spec/std/isa/ext/Sv57.yaml +4 -20
  73. data/.data/spec/std/isa/ext/Svukte.yaml +71 -0
  74. data/.data/spec/std/isa/ext/Zawrs.yaml +1 -1
  75. data/.data/spec/std/isa/ext/Zihpm.yaml +0 -12
  76. data/.data/spec/std/isa/inst/C/c.addi.yaml +1 -0
  77. data/.data/spec/std/isa/inst/C/c.addi16sp.yaml +1 -0
  78. data/.data/spec/std/isa/inst/C/c.addiw.yaml +1 -0
  79. data/.data/spec/std/isa/inst/C/c.andi.yaml +1 -0
  80. data/.data/spec/std/isa/inst/C/c.ldsp.yaml +1 -1
  81. data/.data/spec/std/isa/inst/C/c.li.yaml +1 -0
  82. data/.data/spec/std/isa/inst/C/c.lui.yaml +1 -0
  83. data/.data/spec/std/isa/inst/C/c.mv.yaml +1 -1
  84. data/.data/spec/std/isa/inst/C/c.sdsp.yaml +1 -1
  85. data/.data/spec/std/isa/inst/D/fsgnj.d.yaml +3 -0
  86. data/.data/spec/std/isa/inst/D/fsgnjn.d.yaml +3 -0
  87. data/.data/spec/std/isa/inst/D/fsgnjx.d.yaml +3 -0
  88. data/.data/spec/std/isa/inst/F/fadd.s.yaml +5 -5
  89. data/.data/spec/std/isa/inst/F/fclass.s.yaml +2 -2
  90. data/.data/spec/std/isa/inst/F/fcvt.l.s.yaml +1 -1
  91. data/.data/spec/std/isa/inst/F/fcvt.lu.s.yaml +1 -1
  92. data/.data/spec/std/isa/inst/F/fcvt.s.l.yaml +1 -1
  93. data/.data/spec/std/isa/inst/F/fcvt.s.lu.yaml +1 -1
  94. data/.data/spec/std/isa/inst/F/fcvt.s.w.yaml +1 -1
  95. data/.data/spec/std/isa/inst/F/fcvt.s.wu.yaml +1 -1
  96. data/.data/spec/std/isa/inst/F/fcvt.w.s.yaml +1 -1
  97. data/.data/spec/std/isa/inst/F/fcvt.wu.s.yaml +1 -1
  98. data/.data/spec/std/isa/inst/F/fdiv.s.yaml +1 -1
  99. data/.data/spec/std/isa/inst/F/feq.s.yaml +2 -2
  100. data/.data/spec/std/isa/inst/F/fle.s.yaml +2 -2
  101. data/.data/spec/std/isa/inst/F/fleq.s.yaml +2 -2
  102. data/.data/spec/std/isa/inst/F/flt.s.yaml +2 -2
  103. data/.data/spec/std/isa/inst/F/fltq.s.yaml +2 -2
  104. data/.data/spec/std/isa/inst/F/flw.yaml +2 -2
  105. data/.data/spec/std/isa/inst/F/fmadd.s.yaml +1 -1
  106. data/.data/spec/std/isa/inst/F/fmax.s.yaml +6 -6
  107. data/.data/spec/std/isa/inst/F/fmin.s.yaml +6 -6
  108. data/.data/spec/std/isa/inst/F/fmsub.s.yaml +1 -1
  109. data/.data/spec/std/isa/inst/F/fmul.s.yaml +1 -1
  110. data/.data/spec/std/isa/inst/F/fmv.w.x.yaml +2 -2
  111. data/.data/spec/std/isa/inst/F/fmv.x.w.yaml +1 -1
  112. data/.data/spec/std/isa/inst/F/fnmadd.s.yaml +2 -2
  113. data/.data/spec/std/isa/inst/F/fnmsub.s.yaml +1 -1
  114. data/.data/spec/std/isa/inst/F/fsgnj.s.yaml +4 -4
  115. data/.data/spec/std/isa/inst/F/fsgnjn.s.yaml +3 -3
  116. data/.data/spec/std/isa/inst/F/fsgnjx.s.yaml +4 -4
  117. data/.data/spec/std/isa/inst/F/fsqrt.s.yaml +1 -1
  118. data/.data/spec/std/isa/inst/F/fsub.s.yaml +1 -1
  119. data/.data/spec/std/isa/inst/F/fsw.yaml +1 -1
  120. data/.data/spec/std/isa/inst/I/addi.yaml +1 -1
  121. data/.data/spec/std/isa/inst/I/addiw.yaml +1 -1
  122. data/.data/spec/std/isa/inst/I/andi.yaml +1 -1
  123. data/.data/spec/std/isa/inst/I/beq.yaml +1 -1
  124. data/.data/spec/std/isa/inst/I/bge.yaml +4 -2
  125. data/.data/spec/std/isa/inst/I/bgeu.yaml +3 -0
  126. data/.data/spec/std/isa/inst/I/blt.yaml +4 -2
  127. data/.data/spec/std/isa/inst/I/bltu.yaml +3 -0
  128. data/.data/spec/std/isa/inst/I/bne.yaml +1 -1
  129. data/.data/spec/std/isa/inst/I/slt.yaml +2 -2
  130. data/.data/spec/std/isa/inst/I/sltiu.yaml +1 -1
  131. data/.data/spec/std/isa/inst/I/sltu.yaml +1 -1
  132. data/.data/spec/std/isa/inst/I/sub.yaml +1 -1
  133. data/.data/spec/std/isa/inst/I/subw.yaml +1 -1
  134. data/.data/spec/std/isa/inst/I/xori.yaml +1 -1
  135. data/.data/spec/std/isa/inst/M/mul.yaml +0 -19
  136. data/.data/spec/std/isa/inst/Q/fsgnj.q.yaml +1 -1
  137. data/.data/spec/std/isa/inst/S/sret.yaml +3 -1
  138. data/.data/spec/std/isa/inst/V/vadd.vv.yaml +1 -5
  139. data/.data/spec/std/isa/inst/V/vfsgnjn.vv.yaml +3 -0
  140. data/.data/spec/std/isa/inst/V/vfsgnjx.vv.yaml +3 -0
  141. data/.data/spec/std/isa/inst/V/vl1re8.v.yaml +3 -0
  142. data/.data/spec/std/isa/inst/V/vl2re8.v.yaml +3 -0
  143. data/.data/spec/std/isa/inst/V/vl4re8.v.yaml +3 -0
  144. data/.data/spec/std/isa/inst/V/vl8re8.v.yaml +3 -0
  145. data/.data/spec/std/isa/inst/V/vle8.v.yaml +3 -8
  146. data/.data/spec/std/isa/inst/V/vmand.mm.yaml +3 -0
  147. data/.data/spec/std/isa/inst/V/vmfle.vv.yaml +3 -0
  148. data/.data/spec/std/isa/inst/V/vmflt.vv.yaml +3 -0
  149. data/.data/spec/std/isa/inst/V/vmnand.mm.yaml +3 -0
  150. data/.data/spec/std/isa/inst/V/vmsgt.vi.yaml +3 -0
  151. data/.data/spec/std/isa/inst/V/vmsgtu.vi.yaml +3 -0
  152. data/.data/spec/std/isa/inst/V/vmsle.vi.yaml +3 -0
  153. data/.data/spec/std/isa/inst/V/vmsle.vv.yaml +3 -0
  154. data/.data/spec/std/isa/inst/V/vmsleu.vi.yaml +3 -0
  155. data/.data/spec/std/isa/inst/V/vmsleu.vv.yaml +3 -0
  156. data/.data/spec/std/isa/inst/V/vmslt.vv.yaml +3 -0
  157. data/.data/spec/std/isa/inst/V/vmsltu.vv.yaml +3 -0
  158. data/.data/spec/std/isa/inst/V/vmv.v.i.yaml +2 -13
  159. data/.data/spec/std/isa/inst/V/vmv.x.s.yaml +1 -1
  160. data/.data/spec/std/isa/inst/V/vmxnor.mm.yaml +3 -0
  161. data/.data/spec/std/isa/inst/V/vmxor.mm.yaml +3 -0
  162. data/.data/spec/std/isa/inst/V/vnsrl.wx.yaml +3 -0
  163. data/.data/spec/std/isa/inst/V/vrsub.vx.yaml +3 -0
  164. data/.data/spec/std/isa/inst/V/vse8.v.yaml +3 -4
  165. data/.data/spec/std/isa/inst/V/vwadd.vx.yaml +3 -0
  166. data/.data/spec/std/isa/inst/V/vwaddu.vx.yaml +3 -0
  167. data/.data/spec/std/isa/inst/V/vxor.vi.yaml +4 -0
  168. data/.data/spec/std/isa/inst/Zalasr/lSIZE.AQRL.layout +40 -5
  169. data/.data/spec/std/isa/inst/Zalasr/lb.aq.yaml +17 -1
  170. data/.data/spec/std/isa/inst/Zalasr/lb.aqrl.yaml +17 -1
  171. data/.data/spec/std/isa/inst/Zalasr/ld.aq.yaml +17 -1
  172. data/.data/spec/std/isa/inst/Zalasr/ld.aqrl.yaml +17 -1
  173. data/.data/spec/std/isa/inst/Zalasr/lh.aq.yaml +17 -1
  174. data/.data/spec/std/isa/inst/Zalasr/lh.aqrl.yaml +17 -1
  175. data/.data/spec/std/isa/inst/Zalasr/lw.aq.yaml +17 -1
  176. data/.data/spec/std/isa/inst/Zalasr/lw.aqrl.yaml +17 -1
  177. data/.data/spec/std/isa/inst/Zalasr/sSIZE.AQRL.layout +46 -5
  178. data/.data/spec/std/isa/inst/Zalasr/sb.aqrl.yaml +16 -1
  179. data/.data/spec/std/isa/inst/Zalasr/sb.rl.yaml +16 -1
  180. data/.data/spec/std/isa/inst/Zalasr/sd.aqrl.yaml +16 -1
  181. data/.data/spec/std/isa/inst/Zalasr/sd.rl.yaml +16 -1
  182. data/.data/spec/std/isa/inst/Zalasr/sh.aqrl.yaml +16 -1
  183. data/.data/spec/std/isa/inst/Zalasr/sh.rl.yaml +16 -1
  184. data/.data/spec/std/isa/inst/Zalasr/sw.aqrl.yaml +16 -1
  185. data/.data/spec/std/isa/inst/Zalasr/sw.rl.yaml +16 -1
  186. data/.data/spec/std/isa/inst/Zbkb/packw.yaml +1 -1
  187. data/.data/spec/std/isa/inst/Zcd/c.fld.yaml +1 -1
  188. data/.data/spec/std/isa/inst/Zcd/c.fldsp.yaml +1 -1
  189. data/.data/spec/std/isa/inst/Zcd/c.fsdsp.yaml +1 -1
  190. data/.data/spec/std/isa/inst/Zcf/c.flwsp.yaml +1 -1
  191. data/.data/spec/std/isa/inst/Zcf/c.fswsp.yaml +1 -1
  192. data/.data/spec/std/isa/inst/Zcmp/cm.pop.yaml +1 -1
  193. data/.data/spec/std/isa/inst/Zcmp/cm.popret.yaml +1 -1
  194. data/.data/spec/std/isa/inst/Zcmp/cm.popretz.yaml +1 -1
  195. data/.data/spec/std/isa/inst/Zcmp/cm.push.yaml +2 -3
  196. data/.data/spec/std/isa/inst/Zfa/fround.s.yaml +1 -1
  197. data/.data/spec/std/isa/inst/Zfh/fcvt.h.s.yaml +6 -6
  198. data/.data/spec/std/isa/inst/Zfh/fcvt.s.h.yaml +5 -5
  199. data/.data/spec/std/isa/inst/Zfh/flh.yaml +1 -1
  200. data/.data/spec/std/isa/inst/Zfh/fmv.h.x.yaml +1 -1
  201. data/.data/spec/std/isa/inst/Zfh/fmv.x.h.yaml +1 -1
  202. data/.data/spec/std/isa/inst/Zfh/fsh.yaml +1 -1
  203. data/.data/spec/std/isa/inst/Zicsr/csrrc.yaml +1 -1
  204. data/.data/spec/std/isa/inst/Zicsr/csrrci.yaml +1 -1
  205. data/.data/spec/std/isa/inst/Zicsr/csrrs.yaml +2 -2
  206. data/.data/spec/std/isa/inst/Zicsr/csrrsi.yaml +1 -1
  207. data/.data/spec/std/isa/inst/Zicsr/csrrw.yaml +1 -1
  208. data/.data/spec/std/isa/inst/Zicsr/csrrwi.yaml +1 -1
  209. data/.data/spec/std/isa/isa/builtin_functions.idl +17 -0
  210. data/.data/spec/std/isa/isa/fp.idl +1 -5
  211. data/.data/spec/std/isa/isa/globals.isa +45 -14
  212. data/.data/spec/std/isa/isa/vec.idl +1 -2
  213. data/.data/spec/std/isa/manual_version/isa/20240411/isa_20240411.yaml +5 -5
  214. data/.data/spec/std/isa/param/COUNTINHIBIT_EN.yaml +8 -2
  215. data/.data/spec/std/isa/param/JVT_BASE_MASK.yaml +1 -1
  216. data/.data/spec/std/isa/param/MCOUNTINHIBIT_IMPLEMENTED.yaml +25 -0
  217. data/.data/spec/std/isa/param/MTVEC_MODES.yaml +10 -3
  218. data/.data/spec/std/isa/param/VLEN.yaml +2 -0
  219. data/.data/spec/std/isa/profile/RVA20S64.yaml +11 -4
  220. data/.data/spec/std/isa/profile/RVA20U64.yaml +14 -5
  221. data/.data/spec/std/isa/profile/RVA22S64.yaml +14 -3
  222. data/.data/spec/std/isa/profile/RVA22U64.yaml +8 -1
  223. data/.data/spec/std/isa/profile/RVA23S64.yaml +13 -0
  224. data/.data/spec/std/isa/profile/RVA23U64.yaml +15 -1
  225. data/.data/spec/std/isa/profile/RVB23S64.yaml +15 -3
  226. data/.data/spec/std/isa/profile/RVB23U64.yaml +8 -1
  227. data/.data/spec/std/isa/profile/RVI20U32.yaml +8 -1
  228. data/.data/spec/std/isa/profile/RVI20U64.yaml +7 -0
  229. data/.data/spec/std/isa/register_file/F.yaml +3 -2
  230. data/.data/spec/std/isa/register_file/V.yaml +2 -2
  231. data/.data/spec/std/isa/register_file/X.yaml +2 -1
  232. data/lib/udb/architecture.rb +4 -25
  233. data/lib/udb/cfg_arch.rb +171 -59
  234. data/lib/udb/cli.rb +10 -1
  235. data/lib/udb/condition.rb +38 -37
  236. data/lib/udb/config.rb +72 -6
  237. data/lib/udb/logic.rb +29 -56
  238. data/lib/udb/obj/csr.rb +23 -5
  239. data/lib/udb/obj/csr_field.rb +36 -21
  240. data/lib/udb/obj/database_obj.rb +2 -5
  241. data/lib/udb/obj/extension.rb +0 -3
  242. data/lib/udb/obj/instruction.rb +1 -4
  243. data/lib/udb/obj/portfolio.rb +75 -20
  244. data/lib/udb/obj/profile.rb +0 -4
  245. data/lib/udb/obj/register_file.rb +63 -2
  246. data/lib/udb/portfolio_design.rb +3 -6
  247. data/lib/udb/resolver.rb +84 -23
  248. data/lib/udb/version.rb +1 -1
  249. data/lib/udb/version_spec.rb +8 -0
  250. data/lib/udb/z3.rb +23 -0
  251. data/lib/udb.rb +0 -3
  252. metadata +25 -37
  253. data/.data/cfgs/profile/RVA23M64.yaml +0 -159
  254. data/.data/cfgs/profile/RVB23M64.yaml +0 -149
  255. data/.data/spec/schemas/proc_cert_class_schema.json +0 -35
  256. data/.data/spec/schemas/proc_cert_model_schema.json +0 -336
  257. data/.data/spec/std/isa/proc_cert_class/AC.yaml +0 -13
  258. data/.data/spec/std/isa/proc_cert_class/MC.yaml +0 -13
  259. data/.data/spec/std/isa/proc_cert_class/RVI.yaml +0 -16
  260. data/.data/spec/std/isa/proc_cert_model/AC100.yaml +0 -72
  261. data/.data/spec/std/isa/proc_cert_model/AC200.yaml +0 -58
  262. data/.data/spec/std/isa/proc_cert_model/MC100-32.yaml +0 -155
  263. data/.data/spec/std/isa/proc_cert_model/MC100-64.yaml +0 -21
  264. data/.data/spec/std/isa/proc_cert_model/MC200-32.yaml +0 -60
  265. data/.data/spec/std/isa/proc_cert_model/MC200-64.yaml +0 -21
  266. data/.data/spec/std/isa/proc_cert_model/MC300-32.yaml +0 -40
  267. data/.data/spec/std/isa/proc_cert_model/MC300-64.yaml +0 -21
  268. data/.data/spec/std/isa/proc_cert_model/RVI20-32.yaml +0 -39
  269. data/.data/spec/std/isa/proc_cert_model/RVI20-64.yaml +0 -19
  270. data/.data/spec/std/isa/profile/RVA23M64.yaml +0 -24
  271. data/.data/spec/std/isa/profile/RVB23M64.yaml +0 -86
  272. data/lib/udb/cert_normative_rule.rb +0 -41
  273. data/lib/udb/obj/certifiable_obj.rb +0 -21
  274. data/lib/udb/obj/certificate.rb +0 -230
  275. data/lib/udb/proc_cert_design.rb +0 -77
@@ -34,6 +34,6 @@ operation(): |
34
34
  VectorState state = vector_state();
35
35
 
36
36
  # vmv.x.s copies element 0 of vs2 to xd, sign-extending to XLEN
37
- X[xd] = $signed(v[vs2][state.sew-1:0]);
37
+ X[xd] = $signed(V[vs2][state.sew-1:0]);
38
38
 
39
39
  CSR[vstart].VALUE = 0;
@@ -27,5 +27,8 @@ access:
27
27
  u: always
28
28
  vs: always
29
29
  vu: always
30
+ pseudoinstructions:
31
+ - when: (vs2 == vs1) && (vd == vs2)
32
+ to: vmset.m vd
30
33
  data_independent_timing: false
31
34
  operation(): |
@@ -27,5 +27,8 @@ access:
27
27
  u: always
28
28
  vs: always
29
29
  vu: always
30
+ pseudoinstructions:
31
+ - when: (vs2 == vs1) && (vd == vs2)
32
+ to: vmclr.m vd
30
33
  data_independent_timing: false
31
34
  operation(): |
@@ -29,5 +29,8 @@ access:
29
29
  u: always
30
30
  vs: always
31
31
  vu: always
32
+ pseudoinstructions:
33
+ - when: xs1 == 0
34
+ to: vncvt.x.x.w vd, vs2, vm
32
35
  data_independent_timing: false
33
36
  operation(): |
@@ -29,5 +29,8 @@ access:
29
29
  u: always
30
30
  vs: always
31
31
  vu: always
32
+ pseudoinstructions:
33
+ - when: xs1 == 0
34
+ to: vneg.v vd, vs2, vm
32
35
  data_independent_timing: true
33
36
  operation(): |
@@ -31,9 +31,8 @@ data_independent_timing: false
31
31
  operation(): |
32
32
  XReg virtual_address = X[xs1];
33
33
  # "A simple in-order implementation can ignore the settings and simply execute all vector instructions using the undisturbed policy"
34
- for (U32 i = 0; i < CSR[vl].VALUE; i++) {
35
- U32 start_bit_pos = (CSR[vstart].VALUE + i) * 8;
34
+ for (U32 i = CSR[vstart].VALUE; i < CSR[vl].VALUE; i++) {
35
+ U32 start_bit_pos = i * 8;
36
36
  U32 end_bit_pos = start_bit_pos + 7;
37
- write_memory(8, virtual_address, v[vs3][end_bit_pos:start_bit_pos], $encoding);
38
- virtual_address = virtual_address + 1;
37
+ write_memory(8, virtual_address + i, V[vs3][end_bit_pos:start_bit_pos], $encoding);
39
38
  }
@@ -29,5 +29,8 @@ access:
29
29
  u: always
30
30
  vs: always
31
31
  vu: always
32
+ pseudoinstructions:
33
+ - when: xs1 == 0
34
+ to: vwcvt.x.x.v vd, vs2, vm
32
35
  data_independent_timing: true
33
36
  operation(): |
@@ -29,5 +29,8 @@ access:
29
29
  u: always
30
30
  vs: always
31
31
  vu: always
32
+ pseudoinstructions:
33
+ - when: xs1 == 0
34
+ to: vwcvtu.x.x.v vd, vs2, vm
32
35
  data_independent_timing: true
33
36
  operation(): |
@@ -22,6 +22,7 @@ encoding:
22
22
  location: 24-20
23
23
  - name: imm
24
24
  location: 19-15
25
+ sign_extend: true
25
26
  - name: vd
26
27
  location: 11-7
27
28
  access:
@@ -29,5 +30,8 @@ access:
29
30
  u: always
30
31
  vs: always
31
32
  vu: always
33
+ pseudoinstructions:
34
+ - when: imm == -1
35
+ to: vnot.v vd, vs2, vm
32
36
  data_independent_timing: false
33
37
  operation(): |
@@ -7,10 +7,10 @@
7
7
  raise "'rl' must be defined as true or false" unless [true, false].include?(rl)
8
8
 
9
9
  size_info = {
10
- "b" => { funct3: "000", long_name_suffix: "Byte" },
11
- "h" => { funct3: "001", long_name_suffix: "Halfword" },
12
- "w" => { funct3: "010", long_name_suffix: "Word" },
13
- "d" => { funct3: "011", long_name_suffix: "Doubleword" }
10
+ "b" => { funct3: "000", long_name_suffix: "Byte", bits: 8 },
11
+ "h" => { funct3: "001", long_name_suffix: "Halfword", bits: 16 },
12
+ "w" => { funct3: "010", long_name_suffix: "Word", bits: 32 },
13
+ "d" => { funct3: "011", long_name_suffix: "Doubleword", bits: 64 }
14
14
  }
15
15
 
16
16
  current_size = size_info[size]
@@ -19,6 +19,11 @@
19
19
  rl_bit = rl ? "1" : "0"
20
20
  acquire_suffix = " Acquire"
21
21
  release_suffix = rl ? " Release" : ""
22
+
23
+ aq_bit_val = "1'b1"
24
+ rl_bit_val = rl ? "1'b1" : "1'b0"
25
+
26
+ alignment_bytes = current_size[:bits] / 8
22
27
  -%>
23
28
 
24
29
  $schema: "inst_schema.json#"
@@ -26,7 +31,30 @@ kind: instruction
26
31
  name: l<%= size %><%= aq_rl_suffix %>
27
32
  long_name: Load <%= current_size[:long_name_suffix] %><%= acquire_suffix %><%= release_suffix %>
28
33
  description: |
29
- No description available.
34
+ Load <%= current_size[:bits] %> bits of data from the address in `xs1` into register `xd`, sign-extending
35
+ the result to XLEN bits.
36
+ <% if rl -%>
37
+
38
+ This instruction has both acquire and release semantics. No subsequent memory
39
+ operations (in program order) from this hart can be observed to occur before
40
+ this load completes, and no previous memory operations can be observed to occur
41
+ after this load completes.
42
+ <% else -%>
43
+
44
+ This instruction has acquire semantics, which means that no subsequent memory
45
+ operations (in program order) from this hart can be observed to occur before
46
+ this load completes. Acquire semantics provide ordering guarantees useful for
47
+ synchronization, such as reading a lock variable.
48
+ <% end -%>
49
+ <% if current_size[:bits] == 8 -%>
50
+
51
+ The address must be naturally aligned; if not, an address-misaligned or
52
+ access-fault exception will be raised.
53
+ <% else -%>
54
+
55
+ The address must be naturally aligned (<%= alignment_bytes %>-byte aligned); if not, an
56
+ address-misaligned or access-fault exception will be raised.
57
+ <% end -%>
30
58
  definedBy:
31
59
  extension:
32
60
  name: Zalasr
@@ -45,3 +73,10 @@ access:
45
73
  vu: always
46
74
  data_independent_timing: false
47
75
  operation(): |
76
+ XReg virtual_address = X[xs1];
77
+
78
+ if (!is_naturally_aligned(<%= current_size[:bits] %>, virtual_address)) {
79
+ raise(ExceptionCode::LoadAddressMisaligned, mode(), virtual_address);
80
+ }
81
+
82
+ X[xd] = sext(read_memory_aligned(<%= current_size[:bits] %>, virtual_address, $encoding, <%= aq_bit_val %>, <%= rl_bit_val %>), <%= current_size[:bits] %>);
@@ -11,7 +11,16 @@ kind: instruction
11
11
  name: lb.aq
12
12
  long_name: Load Byte Acquire
13
13
  description: |
14
- No description available.
14
+ Load 8 bits of data from the address in `xs1` into register `xd`, sign-extending
15
+ the result to XLEN bits.
16
+
17
+ This instruction has acquire semantics, which means that no subsequent memory
18
+ operations (in program order) from this hart can be observed to occur before
19
+ this load completes. Acquire semantics provide ordering guarantees useful for
20
+ synchronization, such as reading a lock variable.
21
+
22
+ The address must be naturally aligned; if not, an address-misaligned or
23
+ access-fault exception will be raised.
15
24
  definedBy:
16
25
  extension:
17
26
  name: Zalasr
@@ -30,3 +39,10 @@ access:
30
39
  vu: always
31
40
  data_independent_timing: false
32
41
  operation(): |
42
+ XReg virtual_address = X[xs1];
43
+
44
+ if (!is_naturally_aligned(8, virtual_address)) {
45
+ raise(ExceptionCode::LoadAddressMisaligned, mode(), virtual_address);
46
+ }
47
+
48
+ X[xd] = sext(read_memory_aligned(8, virtual_address, $encoding, 1'b1, 1'b0), 8);
@@ -11,7 +11,16 @@ kind: instruction
11
11
  name: lb.aqrl
12
12
  long_name: Load Byte Acquire Release
13
13
  description: |
14
- No description available.
14
+ Load 8 bits of data from the address in `xs1` into register `xd`, sign-extending
15
+ the result to XLEN bits.
16
+
17
+ This instruction has both acquire and release semantics. No subsequent memory
18
+ operations (in program order) from this hart can be observed to occur before
19
+ this load completes, and no previous memory operations can be observed to occur
20
+ after this load completes.
21
+
22
+ The address must be naturally aligned; if not, an address-misaligned or
23
+ access-fault exception will be raised.
15
24
  definedBy:
16
25
  extension:
17
26
  name: Zalasr
@@ -30,3 +39,10 @@ access:
30
39
  vu: always
31
40
  data_independent_timing: false
32
41
  operation(): |
42
+ XReg virtual_address = X[xs1];
43
+
44
+ if (!is_naturally_aligned(8, virtual_address)) {
45
+ raise(ExceptionCode::LoadAddressMisaligned, mode(), virtual_address);
46
+ }
47
+
48
+ X[xd] = sext(read_memory_aligned(8, virtual_address, $encoding, 1'b1, 1'b1), 8);
@@ -11,7 +11,16 @@ kind: instruction
11
11
  name: ld.aq
12
12
  long_name: Load Doubleword Acquire
13
13
  description: |
14
- No description available.
14
+ Load 64 bits of data from the address in `xs1` into register `xd`, sign-extending
15
+ the result to XLEN bits.
16
+
17
+ This instruction has acquire semantics, which means that no subsequent memory
18
+ operations (in program order) from this hart can be observed to occur before
19
+ this load completes. Acquire semantics provide ordering guarantees useful for
20
+ synchronization, such as reading a lock variable.
21
+
22
+ The address must be naturally aligned (8-byte aligned); if not, an
23
+ address-misaligned or access-fault exception will be raised.
15
24
  definedBy:
16
25
  extension:
17
26
  name: Zalasr
@@ -30,3 +39,10 @@ access:
30
39
  vu: always
31
40
  data_independent_timing: false
32
41
  operation(): |
42
+ XReg virtual_address = X[xs1];
43
+
44
+ if (!is_naturally_aligned(64, virtual_address)) {
45
+ raise(ExceptionCode::LoadAddressMisaligned, mode(), virtual_address);
46
+ }
47
+
48
+ X[xd] = sext(read_memory_aligned(64, virtual_address, $encoding, 1'b1, 1'b0), 64);
@@ -11,7 +11,16 @@ kind: instruction
11
11
  name: ld.aqrl
12
12
  long_name: Load Doubleword Acquire Release
13
13
  description: |
14
- No description available.
14
+ Load 64 bits of data from the address in `xs1` into register `xd`, sign-extending
15
+ the result to XLEN bits.
16
+
17
+ This instruction has both acquire and release semantics. No subsequent memory
18
+ operations (in program order) from this hart can be observed to occur before
19
+ this load completes, and no previous memory operations can be observed to occur
20
+ after this load completes.
21
+
22
+ The address must be naturally aligned (8-byte aligned); if not, an
23
+ address-misaligned or access-fault exception will be raised.
15
24
  definedBy:
16
25
  extension:
17
26
  name: Zalasr
@@ -30,3 +39,10 @@ access:
30
39
  vu: always
31
40
  data_independent_timing: false
32
41
  operation(): |
42
+ XReg virtual_address = X[xs1];
43
+
44
+ if (!is_naturally_aligned(64, virtual_address)) {
45
+ raise(ExceptionCode::LoadAddressMisaligned, mode(), virtual_address);
46
+ }
47
+
48
+ X[xd] = sext(read_memory_aligned(64, virtual_address, $encoding, 1'b1, 1'b1), 64);
@@ -11,7 +11,16 @@ kind: instruction
11
11
  name: lh.aq
12
12
  long_name: Load Halfword Acquire
13
13
  description: |
14
- No description available.
14
+ Load 16 bits of data from the address in `xs1` into register `xd`, sign-extending
15
+ the result to XLEN bits.
16
+
17
+ This instruction has acquire semantics, which means that no subsequent memory
18
+ operations (in program order) from this hart can be observed to occur before
19
+ this load completes. Acquire semantics provide ordering guarantees useful for
20
+ synchronization, such as reading a lock variable.
21
+
22
+ The address must be naturally aligned (2-byte aligned); if not, an
23
+ address-misaligned or access-fault exception will be raised.
15
24
  definedBy:
16
25
  extension:
17
26
  name: Zalasr
@@ -30,3 +39,10 @@ access:
30
39
  vu: always
31
40
  data_independent_timing: false
32
41
  operation(): |
42
+ XReg virtual_address = X[xs1];
43
+
44
+ if (!is_naturally_aligned(16, virtual_address)) {
45
+ raise(ExceptionCode::LoadAddressMisaligned, mode(), virtual_address);
46
+ }
47
+
48
+ X[xd] = sext(read_memory_aligned(16, virtual_address, $encoding, 1'b1, 1'b0), 16);
@@ -11,7 +11,16 @@ kind: instruction
11
11
  name: lh.aqrl
12
12
  long_name: Load Halfword Acquire Release
13
13
  description: |
14
- No description available.
14
+ Load 16 bits of data from the address in `xs1` into register `xd`, sign-extending
15
+ the result to XLEN bits.
16
+
17
+ This instruction has both acquire and release semantics. No subsequent memory
18
+ operations (in program order) from this hart can be observed to occur before
19
+ this load completes, and no previous memory operations can be observed to occur
20
+ after this load completes.
21
+
22
+ The address must be naturally aligned (2-byte aligned); if not, an
23
+ address-misaligned or access-fault exception will be raised.
15
24
  definedBy:
16
25
  extension:
17
26
  name: Zalasr
@@ -30,3 +39,10 @@ access:
30
39
  vu: always
31
40
  data_independent_timing: false
32
41
  operation(): |
42
+ XReg virtual_address = X[xs1];
43
+
44
+ if (!is_naturally_aligned(16, virtual_address)) {
45
+ raise(ExceptionCode::LoadAddressMisaligned, mode(), virtual_address);
46
+ }
47
+
48
+ X[xd] = sext(read_memory_aligned(16, virtual_address, $encoding, 1'b1, 1'b1), 16);
@@ -11,7 +11,16 @@ kind: instruction
11
11
  name: lw.aq
12
12
  long_name: Load Word Acquire
13
13
  description: |
14
- No description available.
14
+ Load 32 bits of data from the address in `xs1` into register `xd`, sign-extending
15
+ the result to XLEN bits.
16
+
17
+ This instruction has acquire semantics, which means that no subsequent memory
18
+ operations (in program order) from this hart can be observed to occur before
19
+ this load completes. Acquire semantics provide ordering guarantees useful for
20
+ synchronization, such as reading a lock variable.
21
+
22
+ The address must be naturally aligned (4-byte aligned); if not, an
23
+ address-misaligned or access-fault exception will be raised.
15
24
  definedBy:
16
25
  extension:
17
26
  name: Zalasr
@@ -30,3 +39,10 @@ access:
30
39
  vu: always
31
40
  data_independent_timing: false
32
41
  operation(): |
42
+ XReg virtual_address = X[xs1];
43
+
44
+ if (!is_naturally_aligned(32, virtual_address)) {
45
+ raise(ExceptionCode::LoadAddressMisaligned, mode(), virtual_address);
46
+ }
47
+
48
+ X[xd] = sext(read_memory_aligned(32, virtual_address, $encoding, 1'b1, 1'b0), 32);
@@ -11,7 +11,16 @@ kind: instruction
11
11
  name: lw.aqrl
12
12
  long_name: Load Word Acquire Release
13
13
  description: |
14
- No description available.
14
+ Load 32 bits of data from the address in `xs1` into register `xd`, sign-extending
15
+ the result to XLEN bits.
16
+
17
+ This instruction has both acquire and release semantics. No subsequent memory
18
+ operations (in program order) from this hart can be observed to occur before
19
+ this load completes, and no previous memory operations can be observed to occur
20
+ after this load completes.
21
+
22
+ The address must be naturally aligned (4-byte aligned); if not, an
23
+ address-misaligned or access-fault exception will be raised.
15
24
  definedBy:
16
25
  extension:
17
26
  name: Zalasr
@@ -30,3 +39,10 @@ access:
30
39
  vu: always
31
40
  data_independent_timing: false
32
41
  operation(): |
42
+ XReg virtual_address = X[xs1];
43
+
44
+ if (!is_naturally_aligned(32, virtual_address)) {
45
+ raise(ExceptionCode::LoadAddressMisaligned, mode(), virtual_address);
46
+ }
47
+
48
+ X[xd] = sext(read_memory_aligned(32, virtual_address, $encoding, 1'b1, 1'b1), 32);
@@ -7,10 +7,10 @@
7
7
  raise "'aq' must be defined as true or false" unless [true, false].include?(aq)
8
8
 
9
9
  size_info = {
10
- "b" => { funct3: "000", long_name_suffix: "Byte" },
11
- "h" => { funct3: "001", long_name_suffix: "Halfword" },
12
- "w" => { funct3: "010", long_name_suffix: "Word" },
13
- "d" => { funct3: "011", long_name_suffix: "Doubleword" }
10
+ "b" => { funct3: "000", long_name_suffix: "Byte", bits: 8 },
11
+ "h" => { funct3: "001", long_name_suffix: "Halfword", bits: 16 },
12
+ "w" => { funct3: "010", long_name_suffix: "Word", bits: 32 },
13
+ "d" => { funct3: "011", long_name_suffix: "Doubleword", bits: 64 }
14
14
  }
15
15
 
16
16
  current_size = size_info[size]
@@ -19,6 +19,18 @@
19
19
  aq_bit = aq ? "1" : "0"
20
20
  acquire_suffix = aq ? " Acquire" : ""
21
21
  release_suffix = " Release"
22
+
23
+ aq_bit_val = aq ? "1'b1" : "1'b0"
24
+ rl_bit_val = "1'b1"
25
+
26
+ alignment_bytes = current_size[:bits] / 8
27
+
28
+ store_slice = case size
29
+ when "b" then "[7:0]"
30
+ when "h" then "[15:0]"
31
+ when "w" then "[31:0]"
32
+ when "d" then ""
33
+ end
22
34
  -%>
23
35
 
24
36
  $schema: "inst_schema.json#"
@@ -26,7 +38,29 @@ kind: instruction
26
38
  name: s<%= size %><%= aq_rl_suffix %>
27
39
  long_name: Store <%= current_size[:long_name_suffix] %><%= acquire_suffix %><%= release_suffix %>
28
40
  description: |
29
- No description available.
41
+ Store the lowest <%= current_size[:bits] %> bits of register `xs2` to the address in `xs1`.
42
+ <% if aq -%>
43
+
44
+ This instruction has both acquire and release semantics. No subsequent memory
45
+ operations (in program order) from this hart can be observed to occur before
46
+ this store completes, and no previous memory operations can be observed to occur
47
+ after this store completes.
48
+ <% else -%>
49
+
50
+ This instruction has release semantics, which means that no previous memory
51
+ operations (in program order) from this hart can be observed to occur after
52
+ this store completes. Release semantics provide ordering guarantees useful for
53
+ synchronization, such as writing a lock variable to release it.
54
+ <% end -%>
55
+ <% if current_size[:bits] == 8 -%>
56
+
57
+ The address must be naturally aligned; if not, an address-misaligned or
58
+ access-fault exception will be raised.
59
+ <% else -%>
60
+
61
+ The address must be naturally aligned (<%= alignment_bytes %>-byte aligned); if not, an
62
+ address-misaligned or access-fault exception will be raised.
63
+ <% end -%>
30
64
  definedBy:
31
65
  extension:
32
66
  name: Zalasr
@@ -45,3 +79,10 @@ access:
45
79
  vu: always
46
80
  data_independent_timing: false
47
81
  operation(): |
82
+ XReg virtual_address = X[xs1];
83
+
84
+ if (!is_naturally_aligned(<%= current_size[:bits] %>, virtual_address)) {
85
+ raise(ExceptionCode::StoreAmoAddressMisaligned, mode(), virtual_address);
86
+ }
87
+
88
+ write_memory_aligned(<%= current_size[:bits] %>, virtual_address, X[xs2]<%= store_slice %>, $encoding, <%= aq_bit_val %>, <%= rl_bit_val %>);
@@ -11,7 +11,15 @@ kind: instruction
11
11
  name: sb.aqrl
12
12
  long_name: Store Byte Acquire Release
13
13
  description: |
14
- No description available.
14
+ Store the lowest 8 bits of register `xs2` to the address in `xs1`.
15
+
16
+ This instruction has both acquire and release semantics. No subsequent memory
17
+ operations (in program order) from this hart can be observed to occur before
18
+ this store completes, and no previous memory operations can be observed to occur
19
+ after this store completes.
20
+
21
+ The address must be naturally aligned; if not, an address-misaligned or
22
+ access-fault exception will be raised.
15
23
  definedBy:
16
24
  extension:
17
25
  name: Zalasr
@@ -30,3 +38,10 @@ access:
30
38
  vu: always
31
39
  data_independent_timing: false
32
40
  operation(): |
41
+ XReg virtual_address = X[xs1];
42
+
43
+ if (!is_naturally_aligned(8, virtual_address)) {
44
+ raise(ExceptionCode::StoreAmoAddressMisaligned, mode(), virtual_address);
45
+ }
46
+
47
+ write_memory_aligned(8, virtual_address, X[xs2][7:0], $encoding, 1'b1, 1'b1);
@@ -11,7 +11,15 @@ kind: instruction
11
11
  name: sb.rl
12
12
  long_name: Store Byte Release
13
13
  description: |
14
- No description available.
14
+ Store the lowest 8 bits of register `xs2` to the address in `xs1`.
15
+
16
+ This instruction has release semantics, which means that no previous memory
17
+ operations (in program order) from this hart can be observed to occur after
18
+ this store completes. Release semantics provide ordering guarantees useful for
19
+ synchronization, such as writing a lock variable to release it.
20
+
21
+ The address must be naturally aligned; if not, an address-misaligned or
22
+ access-fault exception will be raised.
15
23
  definedBy:
16
24
  extension:
17
25
  name: Zalasr
@@ -30,3 +38,10 @@ access:
30
38
  vu: always
31
39
  data_independent_timing: false
32
40
  operation(): |
41
+ XReg virtual_address = X[xs1];
42
+
43
+ if (!is_naturally_aligned(8, virtual_address)) {
44
+ raise(ExceptionCode::StoreAmoAddressMisaligned, mode(), virtual_address);
45
+ }
46
+
47
+ write_memory_aligned(8, virtual_address, X[xs2][7:0], $encoding, 1'b0, 1'b1);
@@ -11,7 +11,15 @@ kind: instruction
11
11
  name: sd.aqrl
12
12
  long_name: Store Doubleword Acquire Release
13
13
  description: |
14
- No description available.
14
+ Store the lowest 64 bits of register `xs2` to the address in `xs1`.
15
+
16
+ This instruction has both acquire and release semantics. No subsequent memory
17
+ operations (in program order) from this hart can be observed to occur before
18
+ this store completes, and no previous memory operations can be observed to occur
19
+ after this store completes.
20
+
21
+ The address must be naturally aligned (8-byte aligned); if not, an
22
+ address-misaligned or access-fault exception will be raised.
15
23
  definedBy:
16
24
  extension:
17
25
  name: Zalasr
@@ -30,3 +38,10 @@ access:
30
38
  vu: always
31
39
  data_independent_timing: false
32
40
  operation(): |
41
+ XReg virtual_address = X[xs1];
42
+
43
+ if (!is_naturally_aligned(64, virtual_address)) {
44
+ raise(ExceptionCode::StoreAmoAddressMisaligned, mode(), virtual_address);
45
+ }
46
+
47
+ write_memory_aligned(64, virtual_address, X[xs2], $encoding, 1'b1, 1'b1);
@@ -11,7 +11,15 @@ kind: instruction
11
11
  name: sd.rl
12
12
  long_name: Store Doubleword Release
13
13
  description: |
14
- No description available.
14
+ Store the lowest 64 bits of register `xs2` to the address in `xs1`.
15
+
16
+ This instruction has release semantics, which means that no previous memory
17
+ operations (in program order) from this hart can be observed to occur after
18
+ this store completes. Release semantics provide ordering guarantees useful for
19
+ synchronization, such as writing a lock variable to release it.
20
+
21
+ The address must be naturally aligned (8-byte aligned); if not, an
22
+ address-misaligned or access-fault exception will be raised.
15
23
  definedBy:
16
24
  extension:
17
25
  name: Zalasr
@@ -30,3 +38,10 @@ access:
30
38
  vu: always
31
39
  data_independent_timing: false
32
40
  operation(): |
41
+ XReg virtual_address = X[xs1];
42
+
43
+ if (!is_naturally_aligned(64, virtual_address)) {
44
+ raise(ExceptionCode::StoreAmoAddressMisaligned, mode(), virtual_address);
45
+ }
46
+
47
+ write_memory_aligned(64, virtual_address, X[xs2], $encoding, 1'b0, 1'b1);
@@ -11,7 +11,15 @@ kind: instruction
11
11
  name: sh.aqrl
12
12
  long_name: Store Halfword Acquire Release
13
13
  description: |
14
- No description available.
14
+ Store the lowest 16 bits of register `xs2` to the address in `xs1`.
15
+
16
+ This instruction has both acquire and release semantics. No subsequent memory
17
+ operations (in program order) from this hart can be observed to occur before
18
+ this store completes, and no previous memory operations can be observed to occur
19
+ after this store completes.
20
+
21
+ The address must be naturally aligned (2-byte aligned); if not, an
22
+ address-misaligned or access-fault exception will be raised.
15
23
  definedBy:
16
24
  extension:
17
25
  name: Zalasr
@@ -30,3 +38,10 @@ access:
30
38
  vu: always
31
39
  data_independent_timing: false
32
40
  operation(): |
41
+ XReg virtual_address = X[xs1];
42
+
43
+ if (!is_naturally_aligned(16, virtual_address)) {
44
+ raise(ExceptionCode::StoreAmoAddressMisaligned, mode(), virtual_address);
45
+ }
46
+
47
+ write_memory_aligned(16, virtual_address, X[xs2][15:0], $encoding, 1'b1, 1'b1);
@@ -11,7 +11,15 @@ kind: instruction
11
11
  name: sh.rl
12
12
  long_name: Store Halfword Release
13
13
  description: |
14
- No description available.
14
+ Store the lowest 16 bits of register `xs2` to the address in `xs1`.
15
+
16
+ This instruction has release semantics, which means that no previous memory
17
+ operations (in program order) from this hart can be observed to occur after
18
+ this store completes. Release semantics provide ordering guarantees useful for
19
+ synchronization, such as writing a lock variable to release it.
20
+
21
+ The address must be naturally aligned (2-byte aligned); if not, an
22
+ address-misaligned or access-fault exception will be raised.
15
23
  definedBy:
16
24
  extension:
17
25
  name: Zalasr
@@ -30,3 +38,10 @@ access:
30
38
  vu: always
31
39
  data_independent_timing: false
32
40
  operation(): |
41
+ XReg virtual_address = X[xs1];
42
+
43
+ if (!is_naturally_aligned(16, virtual_address)) {
44
+ raise(ExceptionCode::StoreAmoAddressMisaligned, mode(), virtual_address);
45
+ }
46
+
47
+ write_memory_aligned(16, virtual_address, X[xs2][15:0], $encoding, 1'b0, 1'b1);