riscv-non-isa/riscv-arch-test

Compiling Zca tests

Closed this issue · 6 comments

I'm trying to build the new Zcb tests from PR364. I need to modify the ISA string in my spike_rv32gc_isa.yaml. I can't seem to find an ISA string that is accepted by riscof. I believe I've fully updated riscof, but maybe there is something I've missed. For example, each of the following ISA strings produces a message like the one below when I add Zca or Zcb. I've tried many permutations. Has anyone done this successfully?

I'm facing the same difficulty adding Zicboz for the cmo.zero tests.

David Harris

  ISA: RV32IMAFDCZicsr_Zifencei_Zba_Zbb_Zbc_Zbkb_Zbs_Zca
  ISA: RV32IMAFDCZicsr_Zifencei_Zba_Zbb_Zbc_Zbkb_Zbs_Zca_Zcb
   ISA: RV32IMAFDCZicsr_Zifencei_Zba_Zbb_Zbc_Zbkb_Zbs_Zcb
 ISA: RV32IMAFDCZcb


ERROR | Error in /home/harris/cvw/tests/riscof/spike/spike_rv32gc_isa.yaml.
   ERROR |  ISA:
   ERROR |   - Input ISA string does not match regex
   ERROR |   - Input ISA string : RV32IMAFDCZcb does not match accepted canonical ordering
   ERROR |  misa:
   ERROR |   - {'reset-val': ['reset value does not match with extensions enabled']}
m
``

Hi Prof Harris,
I think this is not the issue with the ISA string for spike. Using an older version of riscv-config may cause this error because riscv-config is used to validate the ISA string inside riscof (and it is installed as part of riscof installation). Support for zce is added in riscv-config in PR129. Updating the riscv-config (pip3 install -U riscv_config) may resolve this error.
This update and the spike ISA string of RV32IMAFDCZicsr_Zifencei_Zca_Zcb_Zba_Zbb_Zbc_Zbs and misa resel-val of 0x4000112D works for me (other permutations of string may also work).

Oh, and the build function of riscof python plugin for spike also needs to be updated (if not already) with the following (after this line)

      self.isa = 'rv' + self.xlen
      if "I" in ispec["ISA"]:
          self.isa += 'i'
      if "M" in ispec["ISA"]:
          self.isa += 'm'
      if "A" in ispec["ISA"]:
          self.isa += 'a'
      if "F" in ispec["ISA"]:
          self.isa += 'f'
      if "D" in ispec["ISA"]:
          self.isa += 'd'
      if "C" in ispec["ISA"]:
          self.isa += 'c'
      if "Zca" in ispec["ISA"]:
          self.isa += '_zca' 
      if "Zcb" in ispec["ISA"]:
          self.isa += '_zcb'  
      if "Zba" in ispec["ISA"]:
          self.isa += '_zba'
      if "Zbb" in ispec["ISA"]:
          self.isa += '_zbb'
      if "Zbc" in ispec["ISA"]:
          self.isa += '_zbc'    
      if "Zbs" in ispec["ISA"]:
          self.isa += '_zbs'

Also, it looks like the cgf hasn't yet been pushed into riscv-ctg. It would be great to fix the check ISA there so the same problem doesn't show up if the tests are regenerated.

// This file was generated by riscv_ctg (https://github.com/riscv-software-src/riscv-ctg)
// version   : 0.11.1
// timestamp : Tue Jun 20 09:44:07 2023 GMT
// usage     : riscv_ctg \
//                  -- cgf //                  --cgf /home/abd/abd-data/riscv-ctg/sample_cgfs/dataset.cgf \
//                  --cgf /home/abd/abd-data/riscv-ctg/sample_cgfs/rv64i_zcb.cgf \

GCC 13.2.0 supports Zcb but Sail does not yet accept the PR for Zcb.

riscv/sail-riscv#322

Sail now has Zcb support. Note that --enable-zcb must be provided to Sail to use it. This implies modifying riscof/sail_cSim/riscof_sail_cSim.py to pass this flag.

riscv/sail-riscv#322

See
https://github.com/openhwgroup/cvw/blob/main/tests/riscof/sail_cSim/riscof_sail_cSim.py
for an implementation of passing the flag.