riscv-ctg icon indicating copy to clipboard operation
riscv-ctg copied to clipboard

generator.py: Drop toint() of integer value

Open cmuellner opened this issue 1 year ago • 2 comments

The recently introduced toint() function does not accept arguments of type int and will trigger an exception in this case. This leads to an always crashing code path in generator.py, where rm_dict[] maps the rounding mode string to an integer, that is then passed to toint().

There are several ways to address this (e.g. mapping to a string, or making toint() more robust), but dropping the call to toint() is obviously the right thing to do.

cmuellner avatar Jan 16 '24 21:01 cmuellner

The relevant exception is:

Traceback (most recent call last):
  File "/usr/lib64/python3.12/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
                    ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/multiprocessing/pool.py", line 51, in starmapstar
    return list(itertools.starmap(args[0], args[1]))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cm/src/riscv-ctg/zfa/riscv_ctg/ctg.py", line 79, in create_test
    gen_test(op_node, opcode)
  File "/home/cm/src/riscv-ctg/zfa/riscv_ctg/ctg.py", line 52, in gen_test
    gen.gen_inst(op_comb, val_comb, node)))))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cm/src/riscv-ctg/zfa/riscv_ctg/generator.py", line 883, in gen_inst
    cover_hits = eval_inst_coverage(cgf,instr)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cm/src/riscv-ctg/zfa/riscv_ctg/generator.py", line 823, in eval_inst_coverage                            
    var_dict['rm_val'] = toint(rm_dict[instr['rm_val']])
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cm/src/riscv-ctg/zfa/riscv_ctg/generator.py", line 47, in toint
    if '0x' in x:
       ^^^^^^^^^
TypeError: argument of type 'int' is not iterable

cmuellner avatar Jan 16 '24 21:01 cmuellner

The issue was introduced in #75 (which addressed #66 and #72).

cmuellner avatar Jan 16 '24 21:01 cmuellner

The changes proposed in this PR have already been parked via some other PR so there is nothing new to be added. Closing this one.

UmerShahidengr avatar Jul 18 '24 09:07 UmerShahidengr