Skip to content

Commit

Permalink
Add (C_)BGE and C_SW and correct LUI (#1588)
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-j-griffin authored Jun 9, 2023
1 parent 4c5e01a commit 511b64c
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions plugins/riscv/semantics/riscv.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,7 @@
(set$ dst src))

(defun C_LUI (dst imm)
(set$ dst (lshift (cast-signed
(- (word-width) 12)
(cast-low 6 imm))
12)))
(set$ dst (lshift imm 12)))

(defun AUIPC (dst off)
(set$ dst (+ (get-program-counter) off)))
Expand Down Expand Up @@ -86,6 +83,9 @@
(defun LW (dst reg off)
(load-word cast-signed 2 dst reg off))

(defun C_LW (dst reg off)
(load-word cast-signed 2 dst reg off))

(defun LH (dst reg off)
(load-word cast-signed 4 dst reg off))

Expand Down Expand Up @@ -194,6 +194,9 @@
(defun BNE (rs1 rs2 off)
(conditional-jump (/= rs1 rs2) off))

(defun BGE (rs1 rs2 off)
(conditional-jump (>= rs1 rs2) off))

(defun C_BEQ (rs1 rs2 off)
(conditional-jump (= rs1 rs2) off))

Expand All @@ -203,6 +206,9 @@
(defun C_BNE (rs1 rs2 off)
(conditional-jump (/= rs1 rs2) off))

(defun C_BGE (rs1 rs2 off)
(conditional-jump (>= rs1 rs2) off))

(defun BEQZ (rs1 off)
(conditional-jump (is-zero rs1) off))

Expand Down

0 comments on commit 511b64c

Please sign in to comment.