aboutsummaryrefslogtreecommitdiff
path: root/model/riscv_insts_svinval.sail
blob: 168fb17ff08071b991e3cf8835d1c57514253524 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*=======================================================================================*/
/*  This Sail RISC-V architecture model, comprising all files and                        */
/*  directories except where otherwise noted is subject the BSD                          */
/*  two-clause license in the LICENSE file.                                              */
/*                                                                                       */
/*  SPDX-License-Identifier: BSD-2-Clause                                                */
/*=======================================================================================*/

union clause ast = SINVAL_VMA : (regidx, regidx)

mapping clause encdec =
      SINVAL_VMA(rs1, rs2)                                                  if haveSvinval()
  <-> 0b0001011 @ rs2 : regidx @ rs1 : regidx @ 0b000 @ 0b00000 @ 0b1110011 if haveSvinval()

function clause execute SINVAL_VMA(rs1, rs2) = {
  execute(SFENCE_VMA(rs1, rs2))
}

mapping clause assembly = SINVAL_VMA(rs1, rs2)
  <-> "sinval.vma" ^ spc() ^ reg_name(rs1) ^ sep() ^ reg_name(rs2)

/* ****************************************************************** */

union clause ast = SFENCE_W_INVAL : unit

mapping clause encdec =
      SFENCE_W_INVAL()                                            if haveSvinval()
  <-> 0b0001100 @ 0b00000 @ 0b00000 @ 0b000 @ 0b00000 @ 0b1110011 if haveSvinval()

function clause execute SFENCE_W_INVAL() = {
  if cur_privilege == User
  then { handle_illegal(); RETIRE_FAIL }
  else { RETIRE_SUCCESS } // Implemented as no-op as all memory operations are visible immediately the current Sail model
}

mapping clause assembly = SFENCE_W_INVAL() <-> "sfence.w.inval"

/* ****************************************************************** */

union clause ast = SFENCE_INVAL_IR : unit

mapping clause encdec =
      SFENCE_INVAL_IR()                                           if haveSvinval()
  <-> 0b0001100 @ 0b00001 @ 0b00000 @ 0b000 @ 0b00000 @ 0b1110011 if haveSvinval()

function clause execute SFENCE_INVAL_IR() = {
  if cur_privilege == User
  then { handle_illegal(); RETIRE_FAIL }
  else { RETIRE_SUCCESS } // Implemented as no-op as all memory operations are visible immediately in current Sail model
}

mapping clause assembly = SFENCE_INVAL_IR() <-> "sfence.inval.ir"