chipsalliance / rocket-chip

Rocket Chip Generator
Other
3.25k stars 1.13k forks source link

vlsi_rom_gen broken with python3.5 #1991

Open krabo0om opened 5 years ago

krabo0om commented 5 years ago

Type of issue: bug report

If the current behavior is a bug, please provide the steps to reproduce the problem: Run vlsi_rom_gen with python3.5 or higher, e.g., python3.7 scripts/vlsi_rom_gen file.rom.conf file.hex

What is the current behavior? (line numbers are slightly off, because I tinker with the file)

Traceback (most recent call last):
  File "rocket-chip/scripts/vlsi_rom_gen", line 92, in iterate_by_n
    batch += (next(it),)
StopIteration

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

Traceback (most recent call last):
  File "rocket-chip/scripts/vlsi_rom_gen", line 142, in <module>
    main()
  File "rocket-chip/scripts/vlsi_rom_gen", line 138, in main
    **parse_line(line))
  File "rocket-chip/scripts/vlsi_rom_gen", line 118, in parse_line
    for key, val in iterate_by_n(line.split(), 2)}
  File "rocket-chip/scripts/vlsi_rom_gen", line 117, in <dictcomp>
    kwargs = {key: try_cast_int(val)
RuntimeError: generator raised StopIteration

Python 3.5 changed generators slightly (PEP479).

Instead of raising a StopIteration exception, the generator should simply return. Otherwise the script will fail. The raise should therefore be replaced by a return. https://github.com/freechipsproject/rocket-chip/blob/f07a86fe05fb4271231fa8ec5d3809c962156dd3/scripts/vlsi_rom_gen#L96

What is the expected behavior? A successful execution.

Please tell us about your environment:

hirooih commented 3 years ago

The fix in https://github.com/hex-five/multizone-fpga/issues/9 worked for me.