chipsalliance / riscv-dv

Random instruction generator for RISC-V processor verification
Apache License 2.0
1.02k stars 329 forks source link

gcc_compile substitution regex issue #871

Open JJ-Gaisler opened 2 years ago

JJ-Gaisler commented 2 years ago

In the gcc_compile function in run.py there is a re.sub() that removes the C extension when the option "disable_compressed_instr" is selected in the testlist.

if 'gen_opts' in test:
    # Disable compressed instruction
    if re.search('disable_compressed_instr', test['gen_opts']):
        test_isa = re.sub("c", "", test_isa) #problematic line

I had some problems with this substitution when compiling with --isa rv64gc_zba_zbb_zbc_zbs since the second C in zbc is also removed and hence the compile fails. I suggest to add the count argument to re.sub and set it to one.

if 'gen_opts' in test:
    # Disable compressed instruction
    if re.search('disable_compressed_instr', test['gen_opts']):
        test_isa = re.sub("c", "", test_isa, 1) #changed