Skip to content

Commit 4ecc497

Browse files
ZenithalHourlyRatephthinhcyyselfjerryz123
authored
Zk(Zbk, Zkn, Zks)/Zb: Scalar Cryptography/Bitmanip Extension (#2950)
Co-authored-by: phthinh <hung3@e.ntu.edu.sg> Co-authored-by: Yangyu Chen <cyy@cyyself.name> Co-authored-by: Jerry Zhao <jerryz123@berkeley.edu>
1 parent 162257d commit 4ecc497

File tree

19 files changed

+2098
-414
lines changed

19 files changed

+2098
-414
lines changed

.github/workflows/mill-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
runs-on: [self-hosted, linux]
6666
strategy:
6767
matrix:
68-
config: ["DefaultRV32Config,32,RV32IMACZicsr_Zifencei", "DefaultConfig,64,RV64IMACZicsr_Zifencei"]
68+
config: ["DefaultRV32Config,32,RV32IMACZicsr_Zifencei", "DefaultConfig,64,RV64IMACZicsr_Zifencei", "BitManipCryptoConfig,64,RV64IZba_Zbb_Zbc_Zbkb_Zbkc_Zbkx_Zbs_Zknd_Zkne_Zknh_Zksed_Zksh", "BitManipCrypto32Config,32,RV32IZba_Zbb_Zbc_Zbkb_Zbkc_Zbkx_Zbs_Zknd_Zkne_Zknh_Zksed_Zksh"]
6969
steps:
7070
- uses: actions/checkout@v2
7171
with:

build.sc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ object emulator extends mill.Cross[Emulator](
6262
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.DefaultRV32Config"),
6363
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.TinyConfig"),
6464
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.DefaultFP16Config"),
65+
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.BitManipCryptoConfig"),
66+
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.BitManipCrypto32Config"),
6567
// Misc
6668
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.DefaultSmallConfig"),
6769
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.DualBankConfig"),
@@ -337,6 +339,9 @@ object `runnable-arch-test` extends mill.Cross[ArchTest](
337339
// For CI within reasonable time
338340
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.DefaultConfig", "64", "RV64IMACZicsr_Zifencei"),
339341
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.DefaultRV32Config", "32", "RV32IMACZicsr_Zifencei"),
342+
343+
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.BitManipCryptoConfig", "64", "RV64IZba_Zbb_Zbc_Zbkb_Zbkc_Zbkx_Zbs_Zknd_Zkne_Zknh_Zksed_Zksh"),
344+
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.BitManipCrypto32Config", "32", "RV32IZba_Zbb_Zbc_Zbkb_Zbkc_Zbkx_Zbs_Zknd_Zkne_Zknh_Zksed_Zksh"),
340345
)
341346
class ArchTest(top: String, config: String, xlen: String, isa: String) extends Module {
342347
def ispecString = T {

scripts/arch-test/emulator/riscof_emulator.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,30 @@ def build(self, isa_yaml, platform_yaml):
107107
self.isa += 'd'
108108
if "C" in ispec["ISA"]:
109109
self.isa += 'c'
110+
if "Zba" in ispec["ISA"]:
111+
self.isa += '_Zba'
112+
if "Zbb" in ispec["ISA"]:
113+
self.isa += '_Zbb'
114+
if "Zbc" in ispec["ISA"]:
115+
self.isa += '_Zbc'
116+
if "Zbkb" in ispec["ISA"]:
117+
self.isa += '_Zbkb'
118+
if "Zbkc" in ispec["ISA"]:
119+
self.isa += '_Zbkc'
120+
if "Zbkx" in ispec["ISA"]:
121+
self.isa += '_Zbkx'
122+
if "Zbs" in ispec["ISA"]:
123+
self.isa += '_Zbs'
124+
if "Zknd" in ispec["ISA"]:
125+
self.isa += '_Zknd'
126+
if "Zkne" in ispec["ISA"]:
127+
self.isa += '_Zkne'
128+
if "Zknh" in ispec["ISA"]:
129+
self.isa += '_Zknh'
130+
if "Zksed" in ispec["ISA"]:
131+
self.isa += '_Zksed'
132+
if "Zksh" in ispec["ISA"]:
133+
self.isa += '_Zksh'
110134

111135
#TODO: The following assumes you are using the riscv-gcc toolchain. If
112136
# not please change appropriately
@@ -153,7 +177,7 @@ def runTests(self, testList):
153177

154178
# substitute all variables in the compile command that we created in the initialize
155179
# function
156-
cmd = self.compile_cmd.format(testentry['isa'].lower(), test, elf, compile_macros)
180+
cmd = self.compile_cmd.format(self.isa.lower(), test, elf, compile_macros)
157181

158182
# if the user wants to disable running the tests and only compile the tests, then
159183
# the "else" clause is executed below assigning the sim command to simple no action

scripts/arch-test/spike/riscof_spike.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,30 @@ def build(self, isa_yaml, platform_yaml):
107107
self.isa += 'd'
108108
if "C" in ispec["ISA"]:
109109
self.isa += 'c'
110+
if "Zba" in ispec["ISA"]:
111+
self.isa += '_Zba'
112+
if "Zbb" in ispec["ISA"]:
113+
self.isa += '_Zbb'
114+
if "Zbc" in ispec["ISA"]:
115+
self.isa += '_Zbc'
116+
if "Zbkb" in ispec["ISA"]:
117+
self.isa += '_Zbkb'
118+
if "Zbkc" in ispec["ISA"]:
119+
self.isa += '_Zbkc'
120+
if "Zbkx" in ispec["ISA"]:
121+
self.isa += '_Zbkx'
122+
if "Zbs" in ispec["ISA"]:
123+
self.isa += '_Zbs'
124+
if "Zknd" in ispec["ISA"]:
125+
self.isa += '_Zknd'
126+
if "Zkne" in ispec["ISA"]:
127+
self.isa += '_Zkne'
128+
if "Zknh" in ispec["ISA"]:
129+
self.isa += '_Zknh'
130+
if "Zksed" in ispec["ISA"]:
131+
self.isa += '_Zksed'
132+
if "Zksh" in ispec["ISA"]:
133+
self.isa += '_Zksh'
110134

111135
#TODO: The following assumes you are using the riscv-gcc toolchain. If
112136
# not please change appropriately
@@ -153,7 +177,7 @@ def runTests(self, testList):
153177

154178
# substitute all variables in the compile command that we created in the initialize
155179
# function
156-
cmd = self.compile_cmd.format(testentry['isa'].lower(), test, elf, compile_macros)
180+
cmd = self.compile_cmd.format(self.isa.lower(), test, elf, compile_macros)
157181

158182
# if the user wants to disable running the tests and only compile the tests, then
159183
# the "else" clause is executed below assigning the sim command to simple no action

0 commit comments

Comments
 (0)