From 6534dd597d88366cb54d619054554dcee2cc3b16 Mon Sep 17 00:00:00 2001 From: Linda Njau Date: Tue, 23 Jul 2024 12:17:25 +0300 Subject: [PATCH] Add names for base instructions --- model/riscv_insts_base.sail | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/model/riscv_insts_base.sail b/model/riscv_insts_base.sail index bc435e53b..fb4188d65 100644 --- a/model/riscv_insts_base.sail +++ b/model/riscv_insts_base.sail @@ -32,7 +32,9 @@ function clause execute UTYPE(imm, rd, op) = { } mapping utype_mnemonic : uop <-> string = { + $[name "load upper immediate"] RISCV_LUI <-> "lui", + $[name "add upper immediate to PC"] RISCV_AUIPC <-> "auipc" } @@ -40,6 +42,7 @@ mapping clause assembly = UTYPE(imm, rd, op) <-> utype_mnemonic(op) ^ spc() ^ reg_name(rd) ^ sep() ^ hex_bits_signed_20(imm) /* ****************************************************************** */ +$[name "jump and link"] union clause ast = RISCV_JAL : (bits(21), regidx) mapping clause encdec = RISCV_JAL(imm_19 @ imm_7_0 @ imm_8 @ imm_18_13 @ imm_12_9 @ 0b0, rd) @@ -349,15 +352,25 @@ function clause execute (RTYPE(rs2, rs1, rd, op)) = { } mapping rtype_mnemonic : rop <-> string = { + $[name "add"] RISCV_ADD <-> "add", + $[name "set less than"] RISCV_SLT <-> "slt", + $[name "set less than (unsigned)"] RISCV_SLTU <-> "sltu", + $[name "AND"] RISCV_AND <-> "and", + $[name "OR"] RISCV_OR <-> "or", + $[name "exclusive XOR"] RISCV_XOR <-> "xor", + $[name "shift left (logical)"] RISCV_SLL <-> "sll", + $[name "shift right (logical)"] RISCV_SRL <-> "srl", + $[name "subtract"] RISCV_SUB <-> "sub", + $[name "shift right (arithmetic)"] RISCV_SRA <-> "sra" } @@ -576,10 +589,15 @@ function clause execute (RTYPEW(rs2, rs1, rd, op)) = { } mapping rtypew_mnemonic : ropw <-> string = { + $[name "add word (RV64)"] RISCV_ADDW <-> "addw", + $[name "subtract word (RV64)"] RISCV_SUBW <-> "subw", + $[name "shift left (logical) word (RV64)"] RISCV_SLLW <-> "sllw", + $[name "shift right (logical) word (RV64)"] RISCV_SRLW <-> "srlw", + $[name "shift right (arithmetic) word (RV64)"] RISCV_SRAW <-> "sraw" }