From be49d9a9a82ad506d0cedca34bbdac3777777ae9 Mon Sep 17 00:00:00 2001 From: Pan Li Date: Mon, 18 Dec 2023 20:45:53 +0800 Subject: Fix one bug of spike varch elen According to the ISA, the zve32/zve64 xdf decides the elen of the RVV. Thus we should pick up extension instead of xlen for spike varch generation. Signed-off-by: Pan Li --- scripts/march-to-cpu-opt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/march-to-cpu-opt b/scripts/march-to-cpu-opt index f6777f4..653dc49 100755 --- a/scripts/march-to-cpu-opt +++ b/scripts/march-to-cpu-opt @@ -41,6 +41,7 @@ SPIKE_EXT_NOT_ALLOWED = [ CPU_OPTIONS = { "xlen": "", "vlen": "", + "elen": "", "extensions": [], } @@ -146,6 +147,14 @@ def get_vlen(ext_dict): vlen = max(vlen, zvelen) return vlen +def get_elen(ext_dict): + elen = 32 + + if "zve64x" in ext_dict or "zve64f" in ext_dict or "zve64d" in ext_dict: + elen = 64 + + return elen + def print_qemu_cpu(): cpu_options = [] cpu_options.append("rv{0}".format(CPU_OPTIONS['xlen'])) @@ -186,7 +195,7 @@ def print_spike_varch(): if not CPU_OPTIONS['vlen']: return "" - return "vlen:{0},elen:{1}".format(CPU_OPTIONS['vlen'], CPU_OPTIONS['xlen']) + return "vlen:{0},elen:{1}".format(CPU_OPTIONS['vlen'], CPU_OPTIONS['elen']) class TestArchStringParse(unittest.TestCase): def _test(self, arch, expected_arch_list, expected_vlen=0): @@ -256,6 +265,7 @@ def parse_elf_file(elf_file_path): CPU_OPTIONS["extensions"] = extensions CPU_OPTIONS["vlen"] = get_vlen(extension_dict) + CPU_OPTIONS["elen"] = get_elen(extension_dict) CPU_OPTIONS["xlen"] = get_xlen(elf_file_path) def main(argv): -- cgit v1.1