Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nextpnr crash: "terminate called after throwing an instance of 'std::out_of_range'" #136

Closed
sbourdeauducq opened this issue Jul 7, 2019 · 12 comments
Milestone

Comments

@sbourdeauducq
Copy link
Member

sbourdeauducq commented Jul 7, 2019

I'm not sure is this is actually related to nMigen or if this is purely a nextpnr bug, but HeavyX simplesoc_ecp5 no longer works after attempting to use nmigen.build.
I had to update Yosys and nextpnr to get the new I/O system to work, otherwise Yosys would complain about an unknown cell IB.
Now using Yosys YosysHQ/yosys@8455d1f and nextpnr YosysHQ/nextpnr@ff95883.

Repro (without Nix) and error:

$ python simplesoc_ecp5.py simplesoc_ecp5.py test
terminate called after throwing an instance of 'std::out_of_range'
  what():  _Map_base::at
build_top.sh: line 4:  7557 Aborted                 nextpnr-ecp5 --quiet --log top.tim --um-45k --package CABGA381 --speed 8 --json top.json --lpf top.lpf --textcfg top.config
@whitequark
Copy link
Contributor

I had to update Yosys and nextpnr to get the new I/O system to work, otherwise Yosys would complain about an unknown cell IB.

Yes, this is expected. Until we release 0.1, you should always run nMigen against master branch of Yosys and nextpnr. The next version of Yosys, 0.9, is the current target, and I'll make sure every patch required for functionality is merged there.

Repro (without Nix)

Did you attach the repro?

@sbourdeauducq
Copy link
Member Author

sbourdeauducq commented Jul 7, 2019

https://git.m-labs.hk/M-Labs/HeavyX/src/branch/master/examples/simplesoc_ecp5.py
You only need to add minerva and jtagtap from lambdaconcept in addition to the usual packages.

@whitequark
Copy link
Contributor

Can you zip the build directory and attach it here?

@sbourdeauducq
Copy link
Member Author

repro.zip

@whitequark
Copy link
Contributor

That's a bug in nextpnr, I believe.

@whitequark
Copy link
Contributor

See YosysHQ/nextpnr#301.

@whitequark
Copy link
Contributor

@sbourdeauducq Looks like Nix breaks Versioneer:

# Automatically generated by nMigen 0+unknown. Do not edit.

Can you fix that?

@sbourdeauducq
Copy link
Member Author

Yeah, that's because .git is not present in the downloaded sources. It breaks in exactly the same way if you use the "Download ZIP" link on GitHub to get nmigen.

@whitequark
Copy link
Contributor

It breaks in exactly the same way if you use the "Download ZIP" link on GitHub to get nmigen.

It does not, which you can check if you want. The reason is the gitattributes file, which causes the following block in nmigen/_version.py:

def get_keywords():
    """Get the keywords needed to look up the version information."""
    # these strings will be replaced by git during git-archive.
    # setup.py/versioneer.py will grep for the variable names, so they must
    # each be defined on a line of their own. _version.py will just call
    # get_keywords().
    git_refnames = "$Format:%d$"
    git_full = "$Format:%H$"
    git_date = "$Format:%ci$"
    keywords = {"refnames": git_refnames, "full": git_full, "date": git_date}
    return keywords

to be turned into:

def get_keywords():
    """Get the keywords needed to look up the version information."""
    # these strings will be replaced by git during git-archive.
    # setup.py/versioneer.py will grep for the variable names, so they must
    # each be defined on a line of their own. _version.py will just call
    # get_keywords().
    git_refnames = " (HEAD -> master)"
    git_full = "da1f58b7aef99912b32b65fe32cd72b61fd5dc34"
    git_date = "2019-07-07 01:03:59 +0000"
    keywords = {"refnames": git_refnames, "full": git_full, "date": git_date}
    return keywords

So nix should do the same thing then.

@sbourdeauducq
Copy link
Member Author

Interesting, but even though this replacement does happen correctly in both cases, versionneer still breaks on GitHub archives downloaded and extracted manually and those in the Nix store.

nmigen-master> python
>>> import nmigen
>>> nmigen
<module 'nmigen' from '/home/sb/Downloads/nm/nmigen-master/nmigen/__init__.py'>
>>> nmigen.__version__
'0+unknown'
5x2c0kh722dncpbdlyipjxzd3f2kjj2w-source> python
>>> import nmigen
>>> nmigen
<module 'nmigen' from '/nix/store/5x2c0kh722dncpbdlyipjxzd3f2kjj2w-source/nmigen/__init__.py'>
>>> nmigen.__version__
'0+unknown'

@whitequark
Copy link
Contributor

Ah, sorry, my bad. I'll take a look at it myself then.

@sbourdeauducq
Copy link
Member Author

This is also affecting ARTIQ (and leaving .git around with Nix is actually annoying), and I didn't know about this gitattributes thing so I ended up bypassing versioneer.

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

No branches or pull requests

2 participants