Skip to content

Commit

Permalink
hook jalr
Browse files Browse the repository at this point in the history
  • Loading branch information
ved-rivos committed Nov 26, 2023
1 parent ba0dc22 commit fc0b599
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions model/riscv_jalr_rmem.sail
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@
/* SUCH DAMAGE. */
/*=======================================================================================*/

/* Zicfilp : Update ELP state */
val zicfilp_update_elp : (regidx, regidx) -> unit

/* The definition for the memory model. */

function clause execute (RISCV_JALR(imm, rs1, rd)) = {
Expand All @@ -76,5 +79,7 @@ function clause execute (RISCV_JALR(imm, rs1, rd)) = {
X(rd) = nextPC; /* compatible with JALR, C.JR and C.JALR */
let newPC : xlenbits = X(rs1) + sign_extend(imm);
nextPC = [newPC with 0 = bitzero]; /* Clear newPC[0] */
/* update ELP if Zicfilp is active */
zicfilp_update_elp(rs1, rd);
RETIRE_SUCCESS
}
5 changes: 5 additions & 0 deletions model/riscv_jalr_seq.sail
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@
/* SUCH DAMAGE. */
/*=======================================================================================*/

/* Zicfilp : Update ELP state */
val zicfilp_update_elp : (regidx, regidx) -> unit

/* The definition for the sequential model. */

function clause execute (RISCV_JALR(imm, rs1, rd)) = {
Expand All @@ -92,6 +95,8 @@ function clause execute (RISCV_JALR(imm, rs1, rd)) = {
} else {
X(rd) = get_next_pc();
set_next_pc(target);
/* update ELP if Zicfilp is active */
zicfilp_update_elp(rs1, rd);
RETIRE_SUCCESS
}
}
Expand Down

0 comments on commit fc0b599

Please sign in to comment.