Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

generator.py: Drop toint() of integer value #102

Closed
wants to merge 2 commits into from

Conversation

cmuellner
Copy link
Contributor

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.

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.

Signed-off-by: Christoph Müllner <[email protected]>
@cmuellner
Copy link
Contributor Author

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
Copy link
Contributor Author

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

@UmerShahidengr
Copy link
Collaborator

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants