Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Zilsd and Zcmlsd extensions #467

Open
wants to merge 34 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
c60f00d
added zilsd tests
lavanyajagan Mar 25, 2024
57b6c9d
updated env
lavanyajagan Mar 25, 2024
493f69a
updated test
lavanyajagan Mar 25, 2024
564a067
fixed load tests
lavanyajagan Mar 25, 2024
3cbd40b
updated test_macros.h
kumaransvyoma Apr 3, 2024
ce8bd9a
added val_comp for rs2_hi in sd inst
kumaransvyoma Apr 5, 2024
c6806ab
fix:added misaligned test for ld and sd
kumaransvyoma Apr 16, 2024
5958155
Merge pull request #1 from vyoma-systems/misalign
lavanyajagan Apr 16, 2024
346a8e5
Merge branch 'riscv-non-isa:dev' into zilsd
lavanyajagan Jun 13, 2024
75460b1
updated source registers and ISA
kumaransvyoma Jun 13, 2024
66fada9
uppdated misaligned ld and sd
kumaransvyoma Jun 13, 2024
f2ea77a
Merge pull request #2 from vyoma-systems/zilsd_main
lavanyajagan Jun 13, 2024
3ad52f7
updated zilsd privilege tests
kumaransvyoma Jul 1, 2024
d037e4f
Merge pull request #3 from vyoma-systems/zilsd_main
lavanyajagan Jul 2, 2024
4418cd8
Merge branch 'riscv-non-isa:dev' into zilsd
lavanyajagan Jul 2, 2024
165578a
updated the use of x0 operand
kumaransvyoma Jul 5, 2024
80200b7
Merge pull request #4 from vyoma-systems/operand_x0
lavanyajagan Jul 19, 2024
deacc8e
Merge branch 'riscv-non-isa:dev' into zilsd
lavanyajagan Jul 19, 2024
729fa5b
Merge branch 'riscv-non-isa:dev' into zilsd
lavanyajagan Jul 26, 2024
76a1b99
Merge branch 'riscv-non-isa:dev' into zilsd
kumaransvyoma Oct 8, 2024
fb42148
Merge branch 'dev' into zilsd
kumaransvyoma Oct 9, 2024
9b0e8ec
updated to new riscv-arch version
kumaransvyoma Oct 10, 2024
652a113
Merge branch 'riscv-non-isa:dev' into zilsd
kumaransvyoma Oct 10, 2024
86c2575
Merge branch 'riscv-non-isa:dev' into zilsd_new
kumaransvyoma Oct 10, 2024
343d81a
Merge pull request #5 from vyoma-systems/zilsd_new
lavanyajagan Oct 10, 2024
77757a2
Merge branch 'riscv-non-isa:dev' into zilsd
kumaransvyoma Oct 14, 2024
d6ca5d2
Merge branch 'riscv-non-isa:dev' into zilsd
kumaransvyoma Oct 22, 2024
543a4fa
Merge branch 'riscv-non-isa:dev' into zilsd
kumaransvyoma Oct 30, 2024
a9df0f5
Merge branch 'dev' into zilsd
jamesbeyond Nov 4, 2024
5ce7939
Merge branch 'riscv-non-isa:dev' into zilsd
kumaransvyoma Nov 6, 2024
7afe034
removed conflicts in coverage.py
kumaransvyoma Nov 7, 2024
4bf2959
Merge branch 'riscv-non-isa:dev' into zilsd
kumaransvyoma Nov 7, 2024
728ba48
Merge branch 'dev' into zilsd
UmerShahidengr Nov 7, 2024
10807f7
Merge branch 'dev' into zilsd
kumaransvyoma Nov 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions coverage/dataset.cgf
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,24 @@ datasets:
x28: 0
x30: 0

pair_regs_zilsd: &pair_regs_zilsd
x0: 0
x2: 0
x4: 0
x6: 0
x8: 0
x10: 0
x12: 0
x14: 0
x16: 0
x18: 0
x20: 0
x22: 0
x24: 0
x26: 0
x28: 0
x30: 0

c_regs: &c_regs
x8: 0
x9: 0
Expand Down Expand Up @@ -246,6 +264,28 @@ datasets:
x30: 0
x31: 0

c_pair_regs: &c_pair_regs
x8: 0
x10: 0
x12: 0
x14: 0

c_pair_regs_mx2: &c_pair_regs_mx2
x4: 0
x6: 0
x8: 0
x10: 0
x12: 0
x14: 0
x16: 0
x18: 0
x20: 0
x22: 0
x24: 0
x26: 0
x28: 0
x30: 0

cbfmt_immval_sgn: &cbfmt_immval_sgn
'imm_val == (-2**(6-1))': 0
'imm_val == 0': 0
Expand Down
128 changes: 128 additions & 0 deletions coverage/zilsd/rv32zilsd.cgf
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# See License https://gitlab.com/vyoma_systems/common/-/blob/main/LICENSE.BSD3.vyoma for more details

ld:
config:
- check ISA:=regex(.*I.*Zilsd.*)
opcode:
ldz: 0
rs1:
<<: *all_regs_mx0
rd:
<<: *pair_regs_zilsd
op_comb:
<<: *ifmt_op_comb
val_comb:
'ea_align == 0 and (imm_val % 8) == 0': 0
'ea_align == 0 and (imm_val % 8) == 1': 0
'ea_align == 0 and (imm_val % 8) == 2': 0
'ea_align == 0 and (imm_val % 8) == 3': 0
'ea_align == 0 and (imm_val % 8) == 4': 0
'ea_align == 0 and (imm_val % 8) == 5': 0
'ea_align == 0 and (imm_val % 8) == 6': 0
'ea_align == 0 and (imm_val % 8) == 7': 0
'imm_val > 0': 0
'imm_val < 0': 0
'imm_val == 0': 0


sd:
config:
- check ISA:=regex(.*I.*Zilsd.*)
opcode:
sdz: 0
rs1:
<<: *all_regs_mx0
rs2:
<<: *pair_regs_zilsd
op_comb:
'rs1 != rs2': 0
val_comb:
'ea_align == 0 and (imm_val % 8) == 0': 0
'ea_align == 0 and (imm_val % 8) == 1': 0
'ea_align == 0 and (imm_val % 8) == 2': 0
'ea_align == 0 and (imm_val % 8) == 3': 0
'ea_align == 0 and (imm_val % 8) == 4': 0
'ea_align == 0 and (imm_val % 8) == 5': 0
'ea_align == 0 and (imm_val % 8) == 6': 0
'ea_align == 0 and (imm_val % 8) == 7': 0
'imm_val > 0': 0
'imm_val < 0': 0
'imm_val == 0': 0
<<: [ *base_rs2val_sgn]
abstract_comb:
<<: [*rs2val_walking]



cldsp:
config:
- check ISA:=regex(.*I.*C.*Zilsd.*Zclsd.*)
opcode:
c.ldspz: 0
rd:
<<: *pair_regs
val_comb:
'imm_val > 0': 0
'imm_val == 0': 0
abstract_comb:
'walking_ones("imm_val",6,False, scale_func = lambda x: x*8)': 0
'walking_zeros("imm_val",6,False, scale_func = lambda x: x*8)': 0
'alternate("imm_val",6, False,scale_func = lambda x: x*8)': 0

csdsp:
config:
- check ISA:=regex(.*I.*C.*Zilsd.*Zclsd.*)
opcode:
c.sdspz: 0
rs2:
<<: *pair_regs_zilsd
val_comb:
'imm_val > 0': 0
'imm_val == 0': 0
<<: [ *base_rs2val_sgn]
abstract_comb:
<<: [*rs2val_walking]
'walking_ones("imm_val",6,False, scale_func = lambda x: x*8)': 0
'walking_zeros("imm_val",6,False, scale_func = lambda x: x*8)': 0
'alternate("imm_val",6, False,scale_func = lambda x: x*8)': 0

cld:
config:
- check ISA:=regex(.*I.*C.*Zilsd.*Zclsd.*)
opcode:
c.ldz: 0
rs1:
<<: *c_regs
rd:
<<: *c_pair_regs
op_comb:
'rs1 == rd': 0
'rs1 != rd': 0
val_comb:
'imm_val > 0': 0
'imm_val == 0': 0
abstract_comb:
'walking_ones("imm_val",5,False, scale_func = lambda x: x*8)': 0
'walking_zeros("imm_val",5,False, scale_func = lambda x: x*8)': 0
'alternate("imm_val",5, False,scale_func = lambda x: x*8)': 0

csd:
config:
- check ISA:=regex(.*I.*C.*Zilsd.*Zclsd.*)
opcode:
c.sdz: 0
rs1:
<<: *c_regs
rs2:
<<: *c_pair_regs
op_comb:
'rs1 != rs2': 0
val_comb:
'imm_val > 0': 0
'imm_val == 0': 0
<<: [ *base_rs2val_sgn]
abstract_comb:
<<: [*rs2val_walking]
'walking_ones("imm_val",5,False, scale_func = lambda x: x*8)': 0
'walking_zeros("imm_val",5,False, scale_func = lambda x: x*8)': 0
'alternate("imm_val",5, False,scale_func = lambda x: x*8)': 0
39 changes: 39 additions & 0 deletions coverage/zilsd/rv32zilsd_priv.cgf
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
misalign-sd:
config:
- check ISA:=regex(.*I.*Zilsd.*); check hw_data_misaligned_support:=True
- check ISA:=regex(.*I.*Zicsr.*Zilsd.); check hw_data_misaligned_support:=False; def rvtest_mtrap_routine=True
cond: check ISA:=regex(.*32.*I.*Zicsr.*)
mnemonics:
sdz: 0
rs1:
<<: *all_regs_mx0
rs2:
<<: *pair_regs_zilsd
val_comb:
'ea_align == 1': 0
'ea_align == 2': 0
'ea_align == 3': 0
'ea_align == 4': 0
'ea_align == 5': 0
'ea_align == 6': 0
'ea_align == 7': 0

misalign-ld:
config:
- check ISA:=regex(.*I.*Zilsd.*); check hw_data_misaligned_support:=True
- check ISA:=regex(.*I.*Zicsr.*Zilsd.); check hw_data_misaligned_support:=False; def rvtest_mtrap_routine=True
cond: check ISA:=regex(.*32.*I.*Zicsr.*)
mnemonics:
ldz: 0
rs1:
<<: *all_regs_mx0
rd:
<<: *pair_regs_zilsd
val_comb:
'ea_align == 1': 0
'ea_align == 2': 0
'ea_align == 3': 0
'ea_align == 4': 0
'ea_align == 5': 0
'ea_align == 6': 0
'ea_align == 7': 0
8 changes: 6 additions & 2 deletions riscof-plugins/rv32/sail_cSim/env/model_test.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef _COMPLIANCE_MODEL_H
#define _COMPLIANCE_MODEL_H

#if XLEN == 64
#define ALIGNMENT 4
#else
#define ALIGNMENT 2
#endif
#define RVMODEL_DATA_SECTION \
.pushsection .tohost,"aw",@progbits; \
.align 8; .global tohost; tohost: .dword 0; \
Expand All @@ -23,7 +27,7 @@ li x1, 1 ;\
//RV_COMPLIANCE_DATA_BEGIN
#define RVMODEL_DATA_BEGIN ;\
RVMODEL_DATA_SECTION ;\
.align 4 ;\
.align ALIGNMENT;\
.global begin_signature ;\
begin_signature:

Expand Down
19 changes: 14 additions & 5 deletions riscof-plugins/rv32/sail_cSim/riscof_sail_cSim.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ def build(self, isa_yaml, platform_yaml):
self.isa += 'f'
if "D" in ispec["ISA"]:
self.isa += 'd'
if "Zilsd" in ispec["ISA"]:
self.isa += 'Zilsd'
self.zilsdflg = True
if "Zclsd" in ispec["ISA"]:
self.isa += '_Zclsd'
objdump = "riscv{0}-unknown-elf-objdump".format(self.xlen)
if not self.docker:
if shutil.which(objdump) is None:
Expand Down Expand Up @@ -133,9 +138,13 @@ def runTests(self, testList, cgf_file=None, header_file= None):

execute += self.objdump_cmd.format(elf, self.xlen, 'ref.disass')
sig_file = os.path.join(test_dir, self.name[:-1] + ".signature")

execute += self.sail_exe[self.xlen] + ' -i -v --trace=step --pmp-count=16 --pmp-grain=0 --test-signature={0} {1} > {2}.log 2>&1;'.format(sig_file, elf, test_name)

cmd = ''
if "Zilsd" in self.isa:
cmd = cmd + ' --enable-zilsd'
if "Zclsd" in self.isa:
cmd = cmd + ' --enable-zclsd'
execute += self.sail_exe[self.xlen] + cmd + ' -i -v --trace=step --pmp-count=16 --pmp-grain=0 --test-signature={0} {1} > {2}.log 2>&1;'.format(sig_file, elf, test_name)
execute += f'perl -pi -e \'s/^\[/\\n\\n\[/\' {test_name}.log;'
cov_str = ' '
for label in testentry['coverage_labels']:
cov_str+=' -l '+label
Expand All @@ -153,8 +162,8 @@ def runTests(self, testList, cgf_file=None, header_file= None):
-t {0}.log --parser-name c_sail -o coverage.rpt \
--sig-label begin_signature end_signature \
--test-label rvtest_code_begin rvtest_code_end \
-e ref.elf -c {1} -x{2} {3} {4} {5};'.format(\
test_name, ' -c '.join(cgf_file), self.xlen, cov_str, header_file_flag, cgf_mac)
-e ref.elf -c {1} --zilsdFlg {6} -x{2} {3} {4} {5};'.format(\
test_name, ' -c '.join(cgf_file), self.xlen, cov_str, header_file_flag, cgf_mac,self.zilsdflg)
else:
coverage_cmd = ''

Expand Down
5 changes: 5 additions & 0 deletions riscof-plugins/rv32/spike_simple/riscof_spike_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ def build(self, isa_yaml, platform_yaml):
self.isa += 'd'
if "C" in ispec["ISA"]:
self.isa += 'c'
if "Zilsd" in ispec["ISA"]:
self.isa += 'Zilsd'
# self.zilsdflg = True
if "Zclsd" in ispec["ISA"]:
self.isa += '_Zclsd'

#TODO: The following assumes you are using the riscv-gcc toolchain. If
# not please change appropriately
Expand Down
2 changes: 1 addition & 1 deletion riscv-ctg/riscv_ctg/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def gen_bitmanip_dataset(bit_width,sign=True):
# increment each value in dataset, increment each value in dataset, add them to the dataset
return dataset + [x - 1 for x in dataset] + [x+1 for x in dataset] + dataset0

template_fnames = ["template.yaml","imc.yaml","fd.yaml","inx.yaml"]
template_fnames = ["template.yaml","imc.yaml","fd.yaml","inx.yaml","zilsd.yaml"]

template_files = [os.path.join(root,"data/"+f) for f in template_fnames]

Expand Down
5 changes: 4 additions & 1 deletion riscv-ctg/riscv_ctg/data/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ metadata:
c_regs: &c_regs "['x'+str(x) for x in range(8,16)]"
pair_regs: &pair_regs "['x'+str(x) for x in range(2,32 if 'e' not in base_isa else 16, 2 if xlen == 32 else 1)]"
rv32rv64pair_regs: &rv32rv64pair_regs "['x'+str(x) for x in range(2,30 if 'e' not in base_isa else 16, 2)]"

pair_regs_zclsd: &pair_regs_zclsd "['x'+str(x) for x in range(2,31 if 'e' not in base_isa else 16, 2 if xlen == 32 else 1)]"
pair_regs_zilsd: &pair_regs_zilsd "['x'+str(x) for x in range(0,31 if 'e' not in base_isa else 16, 2 if xlen == 32 else 1)]"
c_pair_regs: &c_pair_regs "['x'+str(x) for x in range(8,16,2)]"

aes32dsi:
sig:
stride: 1
Expand Down
Loading