|
| 1 | +/*=======================================================================================*/ |
| 2 | +/* This Sail RISC-V architecture model, comprising all files and */ |
| 3 | +/* directories except where otherwise noted is subject the BSD */ |
| 4 | +/* two-clause license in the LICENSE file. */ |
| 5 | +/* */ |
| 6 | +/* SPDX-License-Identifier: BSD-2-Clause */ |
| 7 | +/*=======================================================================================*/ |
| 8 | + |
| 9 | +function clause extensionEnabled(Ext_Zclsd) = true & extensionEnabled(Ext_Zilsd) & extensionEnabled(Ext_Zca) & not(extensionEnabled(Ext_Zcf)) & xlen == 32 |
| 10 | + |
| 11 | +/* ****************************************************************** */ |
| 12 | +union clause ast = C_LDSP_RV32 : (bits(9), regidx) |
| 13 | + |
| 14 | +mapping clause encdec_compressed = C_LDSP_RV32(ui86 @ ui5 @ ui43 @ 0b000, rd) if extensionEnabled(Ext_Zclsd) |
| 15 | + <-> 0b011 @ ui5 : bits(1) @ rd @ ui43 : bits(2) @ ui86 : bits(3) @ 0b10 if extensionEnabled(Ext_Zclsd) |
| 16 | + |
| 17 | +function clause execute (C_LDSP_RV32(imm, rd)) = { |
| 18 | + execute(LOAD_RV32(zero_extend(imm), sp, rd)) |
| 19 | +} |
| 20 | + |
| 21 | +mapping clause assembly = C_LDSP_RV32(uimm, rd) |
| 22 | + if xlen == 32 |
| 23 | + <-> "c.ldsp" ^ spc() ^ reg_name(rd) ^ sep() ^ hex_bits_9(uimm) |
| 24 | + if xlen == 32 |
| 25 | + |
| 26 | +/* ****************************************************************** */ |
| 27 | +union clause ast = C_SDSP_RV32 : (bits(9), regidx) |
| 28 | + |
| 29 | +mapping clause encdec_compressed = C_SDSP_RV32(ui86 @ ui53 @ 0b000, rs2) if extensionEnabled(Ext_Zclsd) |
| 30 | + <-> 0b111 @ ui53 : bits(3) @ ui86 : bits(3) @ rs2 @ 0b10 if extensionEnabled(Ext_Zclsd) |
| 31 | + |
| 32 | +function clause execute (C_SDSP_RV32(uimm, rs2)) = { |
| 33 | + execute(STORE_RV32(zero_extend(uimm), rs2, sp)) |
| 34 | +} |
| 35 | + |
| 36 | +mapping clause assembly = C_SDSP_RV32(uimm, rs2) |
| 37 | + if xlen == 32 |
| 38 | + <-> "c.sdsp" ^ spc() ^ reg_name(rs2) ^ sep() ^ hex_bits_9(uimm) |
| 39 | + if xlen == 32 |
| 40 | + |
| 41 | +/* ****************************************************************** */ |
| 42 | +union clause ast = C_LD_RV32 : (bits(8), cregidx, cregidx) |
| 43 | + |
| 44 | +mapping clause encdec_compressed = C_LD_RV32(ui76 @ ui53 @ 0b000, rs1, rd) if extensionEnabled(Ext_Zclsd) |
| 45 | + <-> 0b011 @ ui53 : bits(3) @ rs1 @ ui76 : bits(2) @ rd @ 0b00 if extensionEnabled(Ext_Zclsd) |
| 46 | + |
| 47 | +function clause execute (C_LD_RV32(uimm, rsc, rdc)) = { |
| 48 | + let rd = creg2reg_idx(rdc); |
| 49 | + let rs = creg2reg_idx(rsc); |
| 50 | + execute(LOAD_RV32(zero_extend(uimm), rs, rd)) |
| 51 | +} |
| 52 | + |
| 53 | +mapping clause assembly = C_LD_RV32(uimm, rsc, rdc) |
| 54 | + if xlen == 32 |
| 55 | + <-> "c.ld" ^ spc() ^ creg_name(rdc) ^ sep() ^ creg_name(rsc) ^ sep() ^ hex_bits_8(uimm) |
| 56 | + if xlen == 32 |
| 57 | + |
| 58 | +/* ****************************************************************** */ |
| 59 | +union clause ast = C_SD_RV32 : (bits(8), cregidx, cregidx) |
| 60 | + |
| 61 | +mapping clause encdec_compressed = C_SD_RV32(ui76 @ ui53 @ 0b000, rs1, rs2) if extensionEnabled(Ext_Zclsd) |
| 62 | + <-> 0b111 @ ui53 : bits(3) @ rs1 @ ui76 : bits(2) @ rs2 @ 0b00 if extensionEnabled(Ext_Zclsd) |
| 63 | + |
| 64 | +function clause execute (C_SD_RV32(uimm, rsc1, rsc2)) = { |
| 65 | + let rs1 = creg2reg_idx(rsc1); |
| 66 | + let rs2 = creg2reg_idx(rsc2); |
| 67 | + execute(STORE_RV32(zero_extend(uimm), rs2, rs1)) |
| 68 | +} |
| 69 | + |
| 70 | +mapping clause assembly = C_SD_RV32(uimm, rsc1, rsc2) |
| 71 | + if xlen == 32 |
| 72 | + <-> "c.sd" ^ spc() ^ creg_name(rsc1) ^ sep() ^ creg_name(rsc2) ^ sep() ^ hex_bits_8(uimm) |
| 73 | + if xlen == 32 |
0 commit comments