Skip to content

Commit 875af8d

Browse files
Merge branch 'riscv-software-src:main' into Zclsd_extension
2 parents 912cecb + 5cb2bd9 commit 875af8d

File tree

3 files changed

+86
-0
lines changed

3 files changed

+86
-0
lines changed

arch/ext/Zilsd.yaml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
$schema: "ext_schema.json#"
2+
kind: extension
3+
name: Zilsd
4+
long_name: Load/Store Pair for RV32
5+
description: |
6+
This specification adds load and store instructions using register pairs. It does so by reusing existing instruction encodings which are RV64-only. The specification defines 32-bit encodings.
7+
Load and store instructions will use the same definition of even-odd pairs as defined by the Zdinx extension.
8+
The extension improves static code density, by replacing two separate load or store instructions with a single one. In addition, it can provide a performance improvement for implementations that can make use of a wider than XLEN memory interface.
9+
type: unprivileged
10+
versions:
11+
- version: "1.0"
12+
state: ratified
13+
ratification_date: "2025-02"

arch/inst/Zilsd/ld.yaml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# yaml-language-server: $schema=../../../schemas/inst_schema.json
2+
3+
$schema: "inst_schema.json#"
4+
kind: instruction
5+
name: ld
6+
long_name: Load doubleword to even/odd register pair
7+
description: |
8+
Loads a 64-bit value into registers rd and rd+1. The effective address is obtained by adding
9+
register rs1 to the sign-extended 12-bit offset.
10+
definedBy: Zilsd
11+
assembly: rd, offset(rs1)
12+
encoding:
13+
match: -----------------011-----0000011
14+
variables:
15+
- name: rd
16+
location: 11-7
17+
not: [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31]
18+
- name: rs1
19+
location: 19-15
20+
- name: imm
21+
location: 31-20
22+
access:
23+
s: always
24+
u: always
25+
vs: always
26+
vu: always
27+
operation(): |
28+
Bits<XLEN> base = X[rs1];
29+
Bits<XLEN> offset = $signed(imm);
30+
Bits<XLEN> eff_addr = base + offset;
31+
32+
Bits<64> data = read_memory<64>(eff_addr, $encoding);
33+
34+
X[rd] = data[31:0];
35+
X[rd+1] = data[63:32];
36+
sail(): "" #not implemented in the sail model yet

arch/inst/Zilsd/sd.yaml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# yaml-language-server: $schema=../../../schemas/inst_schema.json
2+
3+
$schema: "inst_schema.json#"
4+
kind: instruction
5+
name: sd
6+
long_name: Store doubleword from even/odd register pair
7+
description: |
8+
Stores a 64-bit value from registers rs2 and rs2+1. The effective address is obtained by adding
9+
register rs1 to the sign-extended 12-bit offset.
10+
definedBy: Zilsd
11+
assembly: rs2, offset(rs1)
12+
encoding:
13+
match: -----------------011-----0100011
14+
variables:
15+
- name: rs1
16+
location: 19-15
17+
- name: rs2
18+
not: [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31]
19+
location: 24-20
20+
- name: imm
21+
location: 31-25|11-7
22+
access:
23+
s: always
24+
u: always
25+
vs: always
26+
vu: always
27+
operation(): |
28+
Bits<XLEN> base = X[rs1];
29+
Bits<XLEN> offset = $signed(imm);
30+
Bits<XLEN> eff_addr = base + offset;
31+
32+
Bits<32> lower_word = X[rs2];
33+
Bits<32> upper_word = X[rs2 + 1];
34+
Bits<64> store_data = {upper_word, lower_word};
35+
36+
write_memory<64>(eff_addr, store_data, $encoding);
37+
sail(): "" #not implemented in the sail model yet

0 commit comments

Comments
 (0)