riscv-software-src / riscv-isac

BSD 3-Clause "New" or "Revised" License
31 stars 55 forks source link

KeyError: 'inxFlag' when try to generating RV32H #95

Closed Pagerd closed 3 days ago

Pagerd commented 2 weeks ago

after pr #94,isac still reports an error when executing RV32H tests


pager@pager-virtual-machine:~/Desktop/work/riscv-ctg$ riscv_ctg                --cgf ./sample_cgfs/dataset.cgf  --cgf ./sample_cgfs/sample_cgfs_fext/RV32H/rv32h_fcvt.d.h.cgf --base-isa rv32i
multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/usr/lib/python3.10/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/usr/lib/python3.10/multiprocessing/pool.py", line 51, in starmapstar
    return list(itertools.starmap(args[0], args[1]))
  File "/home/pager/.local/lib/python3.10/site-packages/riscv_ctg/ctg.py", line 79, in create_test
    gen_test(op_node, opcode)
  File "/home/pager/.local/lib/python3.10/site-packages/riscv_ctg/ctg.py", line 52, in gen_test
    gen.gen_inst(op_comb, val_comb, node)))))
  File "/home/pager/.local/lib/python3.10/site-packages/riscv_ctg/generator.py", line 939, in gen_inst
    cover_hits = eval_inst_coverage(cgf,instr)
  File "/home/pager/.local/lib/python3.10/site-packages/riscv_ctg/generator.py", line 891, in eval_inst_coverage
    ext_specific_vars = instr_obj.evaluate_instr_var("ext_specific_vars", {**var_dict, 'flen': self.flen, 'iflen': self.iflen}, None, {'fcsr': hex(var_dict.get('fcsr', 0))})
  File "/home/pager/.local/lib/python3.10/site-packages/riscv_isac/InstructionObject.py", line 351, in evaluate_instr_var
    return func(self, *args)
  File "/home/pager/.local/lib/python3.10/site-packages/riscv_isac/InstructionObject.py", line 601, in evaluate_f_ext_sem
    self.evaluate_reg_sem_f_ext(instr_vars['rs1_val'], instr_vars['flen'], instr_vars['iflen'], "1", f_ext_vars, instr_vars['inxFlag'], instr_vars['xlen'])
KeyError: 'inxFlag'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/pager/.local/bin/riscv_ctg", line 8, in <module>
    sys.exit(cli())
  File "/usr/lib/python3/dist-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/home/pager/.local/lib/python3.10/site-packages/riscv_ctg/main.py", line 30, in cli
    ctg(verbose, out_dir, randomize ,xlen, int(flen), cgf,procs,base_isa,inst,z_inx)
  File "/home/pager/.local/lib/python3.10/site-packages/riscv_ctg/ctg.py", line 137, in ctg
    results = pool.starmap(create_test, [(usage_str, node,label,base_isa,max_inst, op_template,
  File "/usr/lib/python3.10/multiprocessing/pool.py", line 375, in starmap
    return self._map_async(func, iterable, starmapstar, chunksize).get()
  File "/usr/lib/python3.10/multiprocessing/pool.py", line 774, in get
    raise self._value
KeyError: 'inxFlag'
UmerShahidengr commented 2 weeks ago

I guess riscv-ctg is broken too because of this new flag. riscv-ctg is the test generator, so that should be the better place to post this issue. riscv-isac is the coverage tool, it has no relationship with test generation. Thanks for pointing that out. I have noted this issue, I will check ctg source code to rectify this issue.

Pagerd commented 1 week ago

Yes, the problem is from ctg. I did not add --z-inx True to the command, but after adding it, new problems appeared.

pager@pager-virtual-machine:~/Desktop/work/riscv-ctg$ riscv_ctg --base-isa rv32i --flen 32 --cgf ./sample_cgfs/dataset.cgf --cgf ./sample_cgfs/sample_cgfs_fext/RV32H/rv32h_fcvt.d.h.cgf -d ./tests/ -v debug --z-inx True
    INFO | ****** RISC-V Compliance Test Generator 0.12.2 *******
    INFO | Copyright (c) 2020, InCore Semiconductors Pvt. Ltd.
    INFO | All Rights Reserved.
    INFO | Copying env folder to Output directory.
   DEBUG | Generated   24 16-bit coverpoints using Model B1 for fcvt.d.h !
   DEBUG | Generated    8 16-bit coverpoints using Model B22 for fcvt.d !
   DEBUG | Generated   45 16-bit coverpoints using Model B23 for fcvt.d !
   DEBUG | Generated  160 16-bit coverpoints using Model B24 for fcvt.d !
   DEBUG | Generated    8 16-bit coverpoints using Model B27 for fcvt.d !
   DEBUG | Generated   28 16-bit coverpoints using Model B28 for fcvt.d !
   DEBUG | Generated   80 16-bit coverpoints using Model B29 for fcvt.d.h !
 WARNING | Neither mnemonics nor csr_comb node not found in covergroup: datasets
 WARNING | fcvt.d.h not found in template file. Skipping
 WARNING | fcvt.d.h not found in template file. Skipping
 WARNING | fcvt.d.h not found in template file. Skipping
 WARNING | fcvt.d.h not found in template file. Skipping
 WARNING | fcvt.d.h not found in template file. Skipping
 WARNING | fcvt.d.h not found in template file. Skipping
 WARNING | fcvt.d.h not found in template file. Skipping

It seems that when --z-inx True, the nodes in fd.yaml will be deleted, but the fcvt.d.h instructions in Zfh are in fd.yaml, so no test cases can be generated