whitequark[cis] changed the topic of #amaranth-lang to: Amaranth hardware definition language · weekly meetings: Amaranth each Mon 1700 UTC, Amaranth SoC each Fri 1700 UTC · code https://github.com/amaranth-lang · logs https://libera.irclog.whitequark.org/amaranth-lang · Matrix #amaranth-lang:matrix.org
<cr1901> Disregard... not the problem
<_whitenotifier> [YoWASP/yosys] whitequark pushed 1 commit to develop [+0/-0/±1] https://github.com/YoWASP/yosys/compare/67b4ef43da93...c4df91a800b9
<_whitenotifier> [YoWASP/yosys] whitequark c4df91a - Update dependencies.
notgull has quit [Ping timeout: 248 seconds]
notgull has joined #amaranth-lang
mcc111[m] has joined #amaranth-lang
Degi_ has joined #amaranth-lang
Degi has quit [Ping timeout: 260 seconds]
Degi_ is now known as Degi
<whitequark[cis]1> mcc111: o/
<whitequark[cis]1> I've still not caught up with backlog
<whitequark[cis]1> in a hour or so
<mcc111[m]> Oh, sorry, I thought the line of text I'd sent along with it had been sent. It was: "Was reading Analogue's instructions on how to build their sample file and encountered an actual "Draw the rest of the owl" line "
<mcc111[m]> I then told Quartus Lite to create an empty project. It went into Windows "not responding" state and stayed there for half an hour until I killed it D:
<mcc111[m]> I am not asking for help yet mind you! But I might soon
<mcc111[m]> s/soon/tomorrow/
<mcc111[m]> I guess one short question: Is any of a .qsf, .qpf, a .sdc, a .qip, or a .mif file indicative of a quartus file already resident in a directory?
<mcc111[m]> hm, it let me open the .qpf…
<cr1901> I wish it hadn't been literally 10 years since I used Quartus, otherwise I'd probably be able to help :(
<mcc111[m]> It built… something. I'm gonna ask the people who've actually used this device at this point
<mcc111[m]> as i'm about to hit a weird bespoke packaging system
Lord_Nightmare has quit [Quit: ZNC - http://znc.in]
Lord_Nightmare has joined #amaranth-lang
pbsds has quit [Quit: The Lounge - https://thelounge.chat]
pbsds has joined #amaranth-lang
omnitechnomancer has joined #amaranth-lang
<omnitechnomancer> I believe the .mif is one of the bitstream programming formats the rest I can't remember what they do
feldim2425 has quit [Ping timeout: 240 seconds]
feldim2425 has joined #amaranth-lang
<cr1901> https://github.com/cr1901/efbutils/blob/rearrange/tests/test_fusesoc_gen.py How to test fusesoc generation in an Amaranth library (my version at least)
<cr1901> it's a bit of a hack, because I use a single entry point for all fusesoc generation (due to limitations in fusesoc). But... I've split it so it's possible to either use this repo as part of fusesoc or generate your own Verilog via CLI at-will
<whitequark[cis]1> about halfway there with the template repo rework
<cr1901> Ack. I am stopping for tonight (midnight here and have to be up tomorrow semi-early). Tyvm for your effort!
trabucay1e is now known as trabucayre
richlatticefae[m has joined #amaranth-lang
<richlatticefae[m> Same
<whitequark[cis]1> what is wrong with pytest
<whitequark[cis]1> why does it do something really questionable with sys.path?
<whitequark[cis]1> oh
<whitequark[cis]1> oh it doesn't, that was a standard python behavior (wrong pytest binary being executed); pytest's path manipulation was a red herring
<_whitenotifier> [amaranth-lang/template-fpga] whitequark pushed 3 commits to main [+5/-0/±8] https://github.com/amaranth-lang/template-fpga/compare/4c493bb69b9e...79b6ebc056af
<_whitenotifier> [amaranth-lang/template-fpga] whitequark ed730e0 - Add support for Gowin based boards.
<_whitenotifier> [amaranth-lang/template-fpga] whitequark 5ce33d9 - Expand to use pytest.
<_whitenotifier> [amaranth-lang/template-fpga] whitequark 79b6ebc - Add CI configuration.
<whitequark[cis]1> cr1901: enjoy https://github.com/amaranth-lang/template-fpga
<_whitenotifier> [amaranth-lang/template-fpga] whitequark pushed 1 commit to main [+1/-0/±0] https://github.com/amaranth-lang/template-fpga/compare/79b6ebc056af...19ea3f828cde
<_whitenotifier> [amaranth-lang/template-fpga] whitequark 19ea3f8 - Add CI configuration.
<_whitenotifier> [amaranth-lang/template-fpga] whitequark pushed 2 commits to main [+4/-1/±3] https://github.com/amaranth-lang/template-fpga/compare/19ea3f828cde...f397e405961c
<_whitenotifier> [amaranth-lang/template-fpga] whitequark bc2d92f - Expand to use pytest.
<_whitenotifier> [amaranth-lang/template-fpga] whitequark f397e40 - Add CI configuration.
<_whitenotifier> [amaranth] whitequark commented on issue #899: Memory generates an empty Verilog wrport module that Vivado considers a black box - https://github.com/amaranth-lang/amaranth/issues/899#issuecomment-1705951181
<_whitenotifier> [amaranth] whitequark opened pull request #901: back.rtlil: do not translate empty subfragments at all. - https://github.com/amaranth-lang/amaranth/pull/901
<_whitenotifier> [amaranth] whitequark commented on issue #899: Memory generates an empty Verilog wrport module that Vivado considers a black box - https://github.com/amaranth-lang/amaranth/issues/899#issuecomment-1705957194
<galibert[m]> mif is the memory initialiser format
<_whitenotifier> [amaranth] codecov[bot] commented on pull request #901: back.rtlil: do not translate empty subfragments at all. - https://github.com/amaranth-lang/amaranth/pull/901#issuecomment-1705972214
<_whitenotifier> [amaranth-lang/amaranth] github-merge-queue[bot] pushed 1 commit to gh-readonly-queue/main/pr-901-4e078322a04042b5f840006c200f123c3c42273b [+0/-0/±1] https://github.com/amaranth-lang/amaranth/commit/525c7e2be03c
<_whitenotifier> [amaranth-lang/amaranth] whitequark 525c7e2 - back.rtlil: do not translate empty subfragments at all.
<_whitenotifier> [amaranth] github-merge-queue[bot] created branch gh-readonly-queue/main/pr-901-4e078322a04042b5f840006c200f123c3c42273b - https://github.com/amaranth-lang/amaranth
<_whitenotifier> [amaranth-lang/amaranth] github-merge-queue[bot] pushed 1 commit to main [+0/-0/±1] https://github.com/amaranth-lang/amaranth/compare/4e078322a040...525c7e2be03c
<_whitenotifier> [amaranth-lang/amaranth] whitequark 525c7e2 - back.rtlil: do not translate empty subfragments at all.
<_whitenotifier> [amaranth-lang/amaranth] github-merge-queue[bot] deleted branch gh-readonly-queue/main/pr-901-4e078322a04042b5f840006c200f123c3c42273b
<_whitenotifier> [amaranth] whitequark closed pull request #901: back.rtlil: do not translate empty subfragments at all. - https://github.com/amaranth-lang/amaranth/pull/901
<_whitenotifier> [amaranth] github-merge-queue[bot] deleted branch gh-readonly-queue/main/pr-901-4e078322a04042b5f840006c200f123c3c42273b - https://github.com/amaranth-lang/amaranth
<_whitenotifier> [amaranth] whitequark closed issue #899: Memory generates an empty Verilog wrport module that Vivado considers a black box - https://github.com/amaranth-lang/amaranth/issues/899
<_whitenotifier> [amaranth-lang/amaranth-lang.github.io] whitequark pushed 1 commit to main [+0/-0/±32] https://github.com/amaranth-lang/amaranth-lang.github.io/compare/cf414465290a...c70e52ae2dff
<_whitenotifier> [amaranth-lang/amaranth-lang.github.io] github-merge-queue[bot] c70e52a - Deploying to main from @ amaranth-lang/amaranth@525c7e2be03c5f8e2e4702e57f1b4bd54515cb85 🚀
<_whitenotifier> [amaranth] whitequark opened pull request #902: Fix a few issues in memory lowering - https://github.com/amaranth-lang/amaranth/pull/902
<_whitenotifier> [amaranth] codecov[bot] commented on pull request #902: Fix a few issues in memory lowering - https://github.com/amaranth-lang/amaranth/pull/902#issuecomment-1706035173
<_whitenotifier> [amaranth] whitequark commented on pull request #900: Add a strobe generator (rfc #26) - https://github.com/amaranth-lang/amaranth/pull/900#issuecomment-1706041735
mwk has quit [Ping timeout: 258 seconds]
mwk has joined #amaranth-lang
anuejn has quit [Server closed connection]
anuejn has joined #amaranth-lang
Degi_ has joined #amaranth-lang
Degi has quit [Ping timeout: 255 seconds]
Degi_ has quit [Ping timeout: 245 seconds]
Degi has joined #amaranth-lang
Degi has quit [Ping timeout: 248 seconds]
Degi has joined #amaranth-lang
Degi has quit [Ping timeout: 255 seconds]
diegohm[m] has joined #amaranth-lang
<diegohm[m]> Should Value.cast(flipped(Record(...))) work? Should it be equal to Value.cast(Record(...))?
Degi has joined #amaranth-lang
gruetzkopf has quit [Remote host closed the connection]
gruetzkopf has joined #amaranth-lang
<whitequark[cis]1> diegohm: specifically `Record` or `Pin`?
<diegohm[m]> yes, a Pin in particular
<diegohm[m]> * a Pin in particular
<whitequark[cis]1> a Pin should not ever be cast to a value
<diegohm[m]> I understand. I'm asking because there's code in `luna` that breaks with:... (full message at <https://catircservices.org/_matrix/media/v3/download/catircservices.org/IKOXLPIOSmiDRJTSmhrPqsGx>)
<whitequark[cis]1> led_out = Cat([platform.request("led", i, dir="o").o for i in range(0, 6)])
<whitequark[cis]1> (see the .o)
<diegohm[m]> yes, I fixed an error somewhere else with the same approach, thanks
<whitequark[cis]1> this will need a changelog entry, I think
<diegohm[m]> I guess that code was never intended to work without referring to the actual signals, so I'll try to find all instances
<whitequark[cis]1> yes, it was a common error and one of the core reasons behind the redesign
<_whitenotifier> [amaranth] mwkmwkmwk reviewed pull request #902 commit - https://github.com/amaranth-lang/amaranth/pull/902#discussion_r1315849349
<_whitenotifier> [amaranth] mwkmwkmwk reviewed pull request #902 commit - https://github.com/amaranth-lang/amaranth/pull/902#discussion_r1315850936
<_whitenotifier> [amaranth] whitequark reviewed pull request #902 commit - https://github.com/amaranth-lang/amaranth/pull/902#discussion_r1315853923
<_whitenotifier> [amaranth-soc] jfng closed pull request #48: wishbone.bus: migrate to lib.wiring interfaces. - https://github.com/amaranth-lang/amaranth-soc/pull/48
<_whitenotifier> [amaranth-soc] jfng opened pull request #49: Migrate bus primitives to `amaranth.lib.wiring` - https://github.com/amaranth-lang/amaranth-soc/pull/49
<_whitenotifier> [amaranth] mwkmwkmwk reviewed pull request #902 commit - https://github.com/amaranth-lang/amaranth/pull/902#discussion_r1315876131
<_whitenotifier> [amaranth] whitequark reviewed pull request #902 commit - https://github.com/amaranth-lang/amaranth/pull/902#discussion_r1315882106
<_whitenotifier> [amaranth] whitequark reviewed pull request #902 commit - https://github.com/amaranth-lang/amaranth/pull/902#discussion_r1315882866
<_whitenotifier> [amaranth-lang/amaranth] github-merge-queue[bot] pushed 2 commits to gh-readonly-queue/main/pr-902-525c7e2be03c5f8e2e4702e57f1b4bd54515cb85 [+0/-0/±2] https://github.com/amaranth-lang/amaranth/compare/c53eee961cd7^...6683c3a91625
<_whitenotifier> [amaranth-lang/amaranth] whitequark c53eee9 - back.rtlil: fix `MEMID` parameter to match `$mem_v2` cell name.
<_whitenotifier> [amaranth-lang/amaranth] whitequark 6683c3a - hdl.mem: fix `INIT` parameter of emitted `$mem_v2` cell.
<_whitenotifier> [amaranth] github-merge-queue[bot] created branch gh-readonly-queue/main/pr-902-525c7e2be03c5f8e2e4702e57f1b4bd54515cb85 - https://github.com/amaranth-lang/amaranth
<_whitenotifier> [amaranth-lang/amaranth] github-merge-queue[bot] pushed 2 commits to main [+0/-0/±2] https://github.com/amaranth-lang/amaranth/compare/525c7e2be03c...6683c3a91625
<_whitenotifier> [amaranth-lang/amaranth] whitequark c53eee9 - back.rtlil: fix `MEMID` parameter to match `$mem_v2` cell name.
<_whitenotifier> [amaranth-lang/amaranth] whitequark 6683c3a - hdl.mem: fix `INIT` parameter of emitted `$mem_v2` cell.
<_whitenotifier> [amaranth-lang/amaranth] github-merge-queue[bot] deleted branch gh-readonly-queue/main/pr-902-525c7e2be03c5f8e2e4702e57f1b4bd54515cb85
<_whitenotifier> [amaranth] github-merge-queue[bot] deleted branch gh-readonly-queue/main/pr-902-525c7e2be03c5f8e2e4702e57f1b4bd54515cb85 - https://github.com/amaranth-lang/amaranth
<_whitenotifier> [amaranth] whitequark closed pull request #902: Fix a few issues in memory lowering - https://github.com/amaranth-lang/amaranth/pull/902
<_whitenotifier> [amaranth-lang/amaranth-lang.github.io] whitequark pushed 1 commit to main [+0/-0/±32] https://github.com/amaranth-lang/amaranth-lang.github.io/compare/c70e52ae2dff...84fd6de6f85e
<_whitenotifier> [amaranth-lang/amaranth-lang.github.io] github-merge-queue[bot] 84fd6de - Deploying to main from @ amaranth-lang/amaranth@6683c3a916257d629ba91cd0b2568d829edb5cc6 🚀
<whitequark[cis]1> I'm actually going to expand that PR a bit more with deprecation warnings
<whitequark[cis]1> so I could add one on platform.request("x").eq(...) but not the other way around (it's mired in python metaclasses)
<_whitenotifier> [amaranth] codecov[bot] commented on pull request #903: docs/changes: call out backwards incompatibility with `Pin` - https://github.com/amaranth-lang/amaranth/pull/903#issuecomment-1706651331
nak has quit [Quit: Bye]
nak has joined #amaranth-lang
<_whitenotifier> [amaranth-lang/amaranth] github-merge-queue[bot] pushed 2 commits to gh-readonly-queue/main/pr-903-6683c3a916257d629ba91cd0b2568d829edb5cc6 [+0/-0/±2] https://github.com/amaranth-lang/amaranth/compare/1d3a62093bff^...a9d03805fff8
<_whitenotifier> [amaranth-lang/amaranth] whitequark 1d3a620 - docs/changes: call out backwards incompatibility with `Pin`.
<_whitenotifier> [amaranth-lang/amaranth] whitequark a9d0380 - lib.io: add a deprecation warning on `Pin.eq`.
<_whitenotifier> [amaranth] github-merge-queue[bot] created branch gh-readonly-queue/main/pr-903-6683c3a916257d629ba91cd0b2568d829edb5cc6 - https://github.com/amaranth-lang/amaranth
<_whitenotifier> [amaranth-lang/amaranth] github-merge-queue[bot] deleted branch gh-readonly-queue/main/pr-903-6683c3a916257d629ba91cd0b2568d829edb5cc6
<_whitenotifier> [amaranth-lang/amaranth] github-merge-queue[bot] pushed 2 commits to main [+0/-0/±2] https://github.com/amaranth-lang/amaranth/compare/6683c3a91625...a9d03805fff8
<_whitenotifier> [amaranth-lang/amaranth] whitequark 1d3a620 - docs/changes: call out backwards incompatibility with `Pin`.
<_whitenotifier> [amaranth-lang/amaranth] whitequark a9d0380 - lib.io: add a deprecation warning on `Pin.eq`.
<_whitenotifier> [amaranth] whitequark closed pull request #903: docs/changes: call out backwards incompatibility with `Pin` - https://github.com/amaranth-lang/amaranth/pull/903
<_whitenotifier> [amaranth] github-merge-queue[bot] deleted branch gh-readonly-queue/main/pr-903-6683c3a916257d629ba91cd0b2568d829edb5cc6 - https://github.com/amaranth-lang/amaranth
<_whitenotifier> [amaranth-lang/amaranth-lang.github.io] whitequark pushed 1 commit to main [+0/-0/±36] https://github.com/amaranth-lang/amaranth-lang.github.io/compare/84fd6de6f85e...979a2ddbc740
<_whitenotifier> [amaranth-lang/amaranth-lang.github.io] github-merge-queue[bot] 979a2dd - Deploying to main from @ amaranth-lang/amaranth@a9d03805fff8c3d4f6769320323dbf44619fe422 🚀
<crzwdjk> Calling .eq on a Pin was both a common pattern and led to some inscrutable bugs for me, happy that that trap has been removed
<cr1901> whitequark[cis]1: Tyvm, will apply to my code immediately once I get back from errand
<_whitenotifier> [amaranth-soc] whitequark reviewed pull request #49 commit - https://github.com/amaranth-lang/amaranth-soc/pull/49#discussion_r1316030830
<_whitenotifier> [amaranth-soc] whitequark reviewed pull request #49 commit - https://github.com/amaranth-lang/amaranth-soc/pull/49#discussion_r1316017642
<_whitenotifier> [amaranth-soc] whitequark reviewed pull request #49 commit - https://github.com/amaranth-lang/amaranth-soc/pull/49#discussion_r1316034299
<_whitenotifier> [amaranth-soc] whitequark reviewed pull request #49 commit - https://github.com/amaranth-lang/amaranth-soc/pull/49#discussion_r1316032621
<_whitenotifier> [amaranth-soc] jfng reviewed pull request #49 commit - https://github.com/amaranth-lang/amaranth-soc/pull/49#discussion_r1316046512
<_whitenotifier> [amaranth-soc] whitequark reviewed pull request #49 commit - https://github.com/amaranth-lang/amaranth-soc/pull/49#discussion_r1316048364
<cr1901> Is src/pkgname/__init__.py the new way to do python packages now?
<whitequark[cis]1> yeah
<whitequark[cis]1> Amaranth doesn't do it itself and probably won't, but I'm happy to recommend whatever the community best practice is in the template repo
<cr1901> Does python -m "module.submodule" still work if I do the src/ layout, or is "python -m" one of the things the community is moving away from?
* cr1901 will prob spend today learning PDM, now that he corrected most of yesterday's breakage
<whitequark[cis]1> python -m loads modules from PYTHONPATH
<whitequark[cis]1> by default PYTHONPATH includes .
<whitequark[cis]1> this obviously does not work with an src/ layout
<whitequark[cis]1> however, you would be using PDM anyway, since you want your dependencies on PYTHONPATH
<whitequark[cis]1> in this case, you can run pdm run python -m ... which works fine, since the package itself is installed in executable mode
<cr1901> Oh so it's like "cargo run"
<whitequark[cis]1> sorta?
<whitequark[cis]1> it runs any executable
<whitequark[cis]1> doesn't have to be python
<cr1901> Cool... the template "just works", even in my screwed-up Python setup (aside from a single minor bug which isn't relevant to anyone but me and I can work around)
<cr1901> Is there a "user-supplied" version of .env.toolchain (so that I can use my already-install nextpnr, etc)?
<whitequark[cis]1> yep that was the idea when shipping it ^^
<whitequark[cis]1> cr1901: hm, no; the template offers you two options
<whitequark[cis]1> the option that's in the template as it's shipped is to use yowasp binaries checked into your version control
<whitequark[cis]1> the option you can exercise by removing .env.toolchain and yowasp-* from dependencies is to use system binaries
<whitequark[cis]1> i see these two as completely separate
<whitequark[cis]1> if you want to have your yowasp binaries be installed system-wide you do need to set the environment vars in your shell init file
<cr1901> Indeed, I'll probably exercise that option to use my system binaries (the WASM binaries are very cool, just using the system binaries is what I'm used to :P)
<adamgreig[m]> I don't love the extra src/ folder, feels a bit java-y :p
<adamgreig[m]> I guess it makes some sense when you split your things between multiple packages and/or if you want . on the pythonpath without putting all the modules on it though, but still
<whitequark[cis]1> adamgreig: I was following the pytest recommendation
<whitequark[cis]1> I think it might be nice for newcomers since it tells you exactly where your stuff is
<cr1901> Yea, that was the pytest recommendation I explicitly avoided, but my rationale might be off 1/2
<adamgreig[m]> yea, it's motived by https://blog.ionelmc.ro/2014/05/25/python-packaging/#the-structure%3E and it's fair enough etc
<adamgreig[m]> but I don't love that it's useful because I think it looks ugly
<cr1901> I expect a user of efbutils to be able to run e.g. "python -m efbutils.gen.page_buffer" and have that spit out a Verilog core
<cr1901> I could work around this by making a unified entry point, say, efbutils-gen.exe
<cr1901> But I think running a module as a binary is neat (and amaranth-boards also does it)
<whitequark[cis]1> cr1901: if you are using PDM it is not enough for them to do that no matter what
<whitequark[cis]1> it has to be prefixed with pdm run
<whitequark[cis]1> and once that's the case, you can continue using python -m efbutils.gen.page_buffer
<whitequark[cis]1> this is assuming the end user does not install the package
<whitequark[cis]1> if they do install the package, the two remaining options (not involving pip --break-system-packages) are install it in a venv manually (which is equivalent to using PDM here) and install it with pipx (which requires you to add an entry point)
<whitequark[cis]1> bare python -m works like that in two cases (without --break-system-packages): where it is run in a venv, and where the module is in a system package
<whitequark[cis]1> does that make sense?
<cr1901> I've never used pipx, so I'll take your word for it. But I see what you mean now; once you opt into PDM, you need to use PDM as the entry point for any application code you write in Python.
<cr1901> Unless you install the package, which will likely break shit w/o a venv
<whitequark[cis]1> yes, exactly
<cr1901> or the pipx thing you suggest that I've never tried
<whitequark[cis]1> pipx is just another tool that makes a venv for you
<whitequark[cis]1> the difference from pdm is that it installs the entry points system-wide and not only inside the venv
<adamgreig[m]> you should be able to "pip install ." even if you're using pdm, right? at least you can with poetry
<adamgreig[m]> and then you could "python -m bla" too
<adamgreig[m]> or if you happen to have all the dependencies installed system-wide anyway, you can "python -m bla" from inside src/ too I suppose, but that's not really something to suggest
<whitequark[cis]1> adamgreig: not anymore, really
<adamgreig[m]> doesn't pdm's pyproject.toml work with pip? surely you need that to be able to publish and install it from pypi?
<whitequark[cis]1> this is what i get on latest debian
<adamgreig[m]> is that debian's pip or upstream pip?
<whitequark[cis]1> this is an upstream pip feature
<cr1901> I'm targeting the hypothetical use case where "someone needs to interface to MachXO2 EFB, and they decided to use my Python package in a Verilog codebase" 1/2
<adamgreig[m]> interesting, ok, hadn't seen that before from my pip
<whitequark[cis]1> the message comes from debian, but it's just a text file somewhere in the site-packages
<whitequark[cis]1> the change is fairly recent
<adamgreig[m]> does it complain the same if you try and pip install an application or library from pypi?
<whitequark[cis]1> yes
<whitequark[cis]1> even with --user
<adamgreig[m]> wow, that's gonna break a lot of things lol
<whitequark[cis]1> and regretfully, the complaint is accurate
<whitequark[cis]1> i have broken my system packages by doing pip --user installs before and it was a pain to debug
<whitequark[cis]1> (because user installs supersede system installs in loading order)
<adamgreig[m]> even so
<whitequark[cis]1> adamgreig[m]: I think things were broken before, tbh
<whitequark[cis]1> this is just making the breakage obvious
<cr1901> They have two options: Integrate w/ Fusesoc using core files I provide, or generate an e.g. EFB instance on the command-line. How do I make this easy for the end user, preferably without them needing to "chdir efbutils" each time they need to regenerate Verilog IP?
<whitequark[cis]1> cr1901: this use case is explicitly something I consider desirable to cover
<whitequark[cis]1> adamgreig: https://peps.python.org/pep-0668/
* cr1901 nods
<adamgreig[m]> do you only see it on recent distributions then?
<cr1901> I don't _think_ the core files will need to be rewritten, b/c the gen.py entry point to Fusesoc dynamically modifies sys.path; gen.py knows where the efbutils module lives relative to itself.
<whitequark[cis]1> adamgreig: yes
<cr1901> (And this fact remains true even if I swap to a src/-based tree)
<whitequark[cis]1> cr1901: okay, this is something that I want to see in core Amaranth eventually (at least the Verilog part, not sure about FuseSoC)
<whitequark[cis]1> it will need an RFC, I think we might as well brainstorm the approach now
* cr1901 nods
<whitequark[cis]1> I think it would be nice to have a single unified runner that lets you take an Amaranth component, configure it, and get Verilog or RTLIL or what you have out of it, without writing a single line of Python
<whitequark[cis]1> I'm not sure what a "core file" is exactly so I'll leave that for later
<whitequark[cis]1> for Verilog, we currently have one half of the story
<whitequark[cis]1> obviously it is ridiculous to ask the end user to provide the list of ports, but we solved this by making verilog.convert aware of component ports
<galibert[m]> Yeah, signatures is a way better story there
<whitequark[cis]1> however this does not cover constructor arguments, which are just as crucial
<cr1901> How do you "name" the component that Amaranth should generate Verilog for? Using Python module syntax (and an importlib call inside digests it)?
<whitequark[cis]1> there are two options
<whitequark[cis]1> the first one is exactly what you said
<whitequark[cis]1> the second one is making use of the "entry points" functionality to tell Amaranth that a Python class is available for generation under some other name
<whitequark[cis]1> "entry points" are mostly useful because you can enumerate them (unlike stuff in random Python files, which you can't reasonably load due to side effects)
<whitequark[cis]1> however in this case we're pretty sure already exactly what we want to load, meaning it's fine to just use that directly
<whitequark[cis]1> so it would be something like amaranth generate verilog efbutils.page_buffer page_buffer.v
<cr1901> What would an entry point invocation look like? Do you have to install your package (as a system dep) for that to work? Or would you still "somehow" feed that entry point to the unified Verilog generator?
<whitequark[cis]1> you do have to install the package for entry points to work, as opposed to just having it importable
<whitequark[cis]1> I think entry points are probably not the right choice here
<cr1901> Agreed, especially considering that PDM applications (the best practice we want to encourage)... kinda discourage that
<whitequark[cis]1> * so it would be something like amaranth generate verilog efbutils.page_buffer.PageBuffer page_buffer.v
<whitequark[cis]1> with pdm it would be like pdm amaranth generate verilog efbutils.page_buffer.PageBuffer page_buffer.v
<cr1901> Yes that's reasonable. I'm sure pdm and verilog trees (for a mixed project) can coexist just fine
<cr1901> you'd put "pdm amaranth generate..." as a step in your top-level build script (or regen manually as needed without having to deal with pesky paths)
<whitequark[cis]1> yeah
<whitequark[cis]1> we can actually do something interesting here
<whitequark[cis]1> pdm amaranth generate verilog efbutils.page_buffer.PageBuffer page_buffer.v --dep page_buffer.d
<whitequark[cis]1> generate a Make-style dependency file
<cr1901> that's kickass
<galibert[m]> would that be cmake/ninja-compatible too?
<cr1901> I might put that as a separate RFC, but I do like the idea
<galibert[m]> or it that yet another can of worms?
<whitequark[cis]1> ninja requires a generator in front of it to alter the dependency graph, iirc
<whitequark[cis]1> one sec
<whitequark[cis]1> aha, no, ninja can read Make-style files https://ninja-build.org/manual.html#ref_headers
<galibert[m]> cool
<cr1901> And so can cargo for that matter. It's a minimum common denominator
<whitequark[cis]1> CMake can also do this via add_custom_command(DEPFILE)
<whitequark[cis]1> cr1901: want me to prototype the `amaranth generate verilog` command?
<cr1901> whitequark[cis]1: If it is not too much work, and you want to do it, yes. I haven't started the PDM port yet; improving gen is a better thing for me to work on rn.
<whitequark[cis]1> yea sure i was curious how it'd use in practice for some time
<whitequark[cis]1> btw, I think I can make --deps work even with completely unrelated files
<whitequark[cis]1> like not just python modules, but any data files you open
<cr1901> Huh ._.
<cr1901> I can explain the fusesoc side of things as well if you want (it is, in fact a natural extension of "amaranth generate verilog", but you have to deal w/ a fusesoc quirk)
<whitequark[cis]1> sure why not
<cr1901> Okay the first thing about fusesoc is: it works, it's a package manager, it works fine IME. No need to reinvent the wheel there. It has a few rough edges, only one of them is relevant here. I think olofk has an unsaid feature freeze for fusesoc right now due to work/needing a break.
<cr1901> With that in mind... 1/2
<cr1901> For amaranth, you specify "how do I generate Verilog code?" to fusesoc using a generator: https://github.com/cr1901/efbutils/blob/rearrange/cores/ufm_reader.core#L173-L192
<cr1901> Using the linked code as an example, a generator will be run like the following: "python3 gen.py autogenerated_yaml_file_baed_on_parameter_settings_and_other_stuff"
<cr1901> This is unfortunately, hardcoded. You get a single interpreter argument, a single script argument, and a YAML file with everything else. I don't know how to work around that for "amaranth generate verilog"
<whitequark[cis]1> cr1901: that (the overall file not just the lines) looks like a build system to me?
<galibert[m]> it's more gentoo than arch I guess? :-)
<cr1901> Well, yes, fusesoc is both a package manager and build system. I'm focusing on the package management part b/c that's the only part relevant to Amaranth
<galibert[m]> more seriously, it's the side effect of lto-in-practice?
<whitequark[cis]1> so much for not reinventing the wheel >_>
<cr1901> I use it as a build system rn instead of Amaranth b/c of inertia :P
<whitequark[cis]1> (not a complaint towards you)
<cr1901> I understand. I can elaborate on the inertia part later
<whitequark[cis]1> sure!
<cr1901> >I don't know how to work around that for "amaranth generate verilog" <-- so I cheat a bit to make fusesoc gen work for my codebase right now, b/c of the input argument limitation.
<whitequark[cis]1> work around what?
<whitequark[cis]1> oh sorry I missed a message
<whitequark[cis]1> I think this just needs to be fixed in fusesoc?
<cr1901> Yea, I think so too. I just don't know if olofk has bandwidth for fixes. I can talk to him.
<cr1901> I already know from nightmares about a certain snake package manager that NONE of use want to maintain one. I think reusing pip with PDM solves the amaranth-depends-on-amaranth side of things, "amaranth generate verilog" will solve the "verilog-depends-on-amaranth" side of things, and "fusesoc" can help solve the "amaranth-depends-on-verilog" and "verilog-depends-on-amaranth" cases as well
<cr1901> (s/verilog/vhdl/ as well)
<whitequark[cis]1> RIIA (rewrite it in Amaranth)
<cr1901> I did my part :P
<whitequark[cis]1> haha, fair
<cr1901> Btw, re: inertia re: switching to Amaranth... uhhh, it boils down to "It's easier for me to reuse and/or write new PCFs than it is to create temporary board files": https://github.com/cr1901/efbutils/blob/rearrange/cores/ufm_reader/data/lcmxo2_7000he_b_evn.lpf vs https://github.com/amaranth-lang/amaranth-boards/pull/214/files
<cr1901> Not _much_ extra work mind you, but enough for me to be like "okay I'll just put the I/O I need and call it a day" :P
<whitequark[cis]1> oh haha, I wonder if we could make it easier to make board files
<whitequark[cis]1> maybe a web UI or something
<cr1901> Oh, and this probably doesn't matter in practice, but Amaranth will manually instantiate a GSR and create a global reset, whereas I don't in my code current, and can't tell offhand whether Diamond bothers (IIRC it actually does NOT infer a GSR for sync resets, but Amaranth adds logic to make a sync reset work w/ GSR)
<cr1901> Web UI would be interesting/cool. I could also just not be lazy lmao
<whitequark[cis]1> Diamond does not infer GSR
<cr1901> One of their APNOTEs says it does. I'll see if I can find it (and if I misread well I'm wrong then :P)
<whitequark[cis]1> huh, interesting
<whitequark[cis]1> I might be wrong
<cr1901> HowtouseGSRPURandTSALL.PDF <-- It was ISPLever, whoops
<cr1901> Of course it was worth the RIIA, but honestly it was also worth doing the initial EFButils in Verilog. For better or worse, it took me a while to get a handle on how to interface with the EFB and how to consistently write to/read from it. I caved and used Lattice Reveal at least once :P.
* cr1901 started in Diamond, moved everything to fusesoc, and now it's a fusesoc/Amaranth hybrid
<whitequark[cis]1> cr1901: done, testing with your code now
<cr1901> Cool, on standby. Which branch? main or rearrange?
<whitequark[cis]1> rearrange
<cr1901> oh wow :o...
<whitequark[cis]1> that was really easy
<whitequark[cis]1> and it includes files you read using with open("data.txt"):
<whitequark[cis]1> moreover, if you spawn a subprocess for example, the target will be marked as .PHONY:
<cr1901> This is quite a hell of a feature you've coded up :)
<whitequark[cis]1> 22 lines of code
<_whitenotifier> [amaranth] whitequark opened pull request #904: amaranth_cli: prototype - https://github.com/amaranth-lang/amaranth/pull/904
<cr1901> 22+100*?
<whitequark[cis]1> 100*?
<_whitenotifier> [amaranth] whitequark edited pull request #904: amaranth_cli: prototype - https://github.com/amaranth-lang/amaranth/pull/904
<cr1901> you said 22 lines of code... the PR is 122 lines
<_whitenotifier> [amaranth] whitequark edited pull request #904: Prototype a new CLI - https://github.com/amaranth-lang/amaranth/pull/904
<whitequark[cis]1> 22 lines dedicated to the dependency tracking
<cr1901> oooooooh
<_whitenotifier> [amaranth] codecov[bot] commented on pull request #904: Prototype a new CLI - https://github.com/amaranth-lang/amaranth/pull/904#issuecomment-1707344479
<_whitenotifier> [amaranth-boards] mcclure opened pull request #234: Dadamachines Doppler board file - https://github.com/amaranth-lang/amaranth-boards/pull/234
<whitequark[cis]1> also i just made it smaller :)
<whitequark[cis]1> the .d files are pretty readable by the way
<whitequark[cis]1> the METADATA file at the top is present because amaranth reads its own version (for amaranth.__version__) and this is accounted for
<mcc111[m]> OK i finally added the PR for the Doppler board file I was using a couple weeks back.
<cr1901> Veeery nice :D!
<whitequark[cis]1> you can do like, with open(".git/HEAD") as head: head.read() and it would get recorded
<cr1901> How do I set parameters/args for the Amaranth Elaboratable to be converted (perfectly fine rn if the answer is "you don't")?
<mcc111[m]> whitequark[cis]1: is this using dulwich
<whitequark[cis]1> dulwich?
<mcc111[m]> sorry, i misread what you were doing here
<mcc111[m]> didn't delete fast enough!
<whitequark[cis]1> so it would actually do the right thing if you used dulwich
<whitequark[cis]1> unless you used the C extension
<mcc111[m]> that's normally how i would interact with git from python
<whitequark[cis]1> like, lemme try and do it
<mcc111[m]> but i wasn't thinking simply enough
<whitequark[cis]1> so this required a minor change
<whitequark[cis]1> but, now i get
<whitequark[cis]1> does the right thing!
<cr1901> TIL about dulwich
<_whitenotifier> [amaranth-boards] whitequark reviewed pull request #234 commit - https://github.com/amaranth-lang/amaranth-boards/pull/234#discussion_r1316444798
<_whitenotifier> [amaranth-boards] whitequark reviewed pull request #234 commit - https://github.com/amaranth-lang/amaranth-boards/pull/234#discussion_r1316445351
<_whitenotifier> [amaranth-boards] whitequark reviewed pull request #234 commit - https://github.com/amaranth-lang/amaranth-boards/pull/234#discussion_r1316443253
<_whitenotifier> [amaranth-boards] whitequark reviewed pull request #234 commit - https://github.com/amaranth-lang/amaranth-boards/pull/234#discussion_r1316459715
<_whitenotifier> [amaranth-boards] whitequark reviewed pull request #234 commit - https://github.com/amaranth-lang/amaranth-boards/pull/234#discussion_r1316446341
<_whitenotifier> [amaranth-boards] whitequark reviewed pull request #234 commit - https://github.com/amaranth-lang/amaranth-boards/pull/234#discussion_r1316444408
<whitequark[cis]1> cr1901: for now parameters aren't supported
<whitequark[cis]1> getting help text and diagnostics right in every case is a lot
<cr1901> No problem, it's still a nice chunk of code I can remove
<whitequark[cis]1> do you need parameters somewhere?
<whitequark[cis]1> AFAICT you never have parameterized elaboratables in efbutils
<cr1901> I have not hooked up the "Verilog without fusesoc" side of things yet: https://github.com/cr1901/efbutils/blob/rearrange/efbutils/gen/efb.py#L10-L13
<cr1901> See, the plan before today was "create some adhoc CLI to convert command line options to the dicts I actually use to populate the EFB Component's constructor
<whitequark[cis]1> ah, hm
<cr1901> Althought not represented in the code as-is, I would have a way to distinguish "I want to generate for fusesoc" from "I want to generate standalone verilog"
<whitequark[cis]1> let me do something real quick
<cr1901> (Emphasis on "not represented in the code as-is")
<whitequark[cis]1> okay this now works: amaranth g amaranth.lib.fifo:SyncFIFO -p width 16 -p depth 128 verilog -v -
<whitequark[cis]1> (in the branch)
<cr1901> Very nice :D
<whitequark[cis]1> it uses type annotations to convert from strings to whatever you accept
<cr1901> Most excellent :D
* cr1901 is trying to fix a PDM bug, and then he'll try out the functionality
<whitequark[cis]1> which bug
<cr1901> Well, there's two and they're both msys2-related things (one about the git binary returning Unix-style paths, another one about virtualenv respecting the /bin /lib hierarchy on Windows sometimes)
<cr1901> latter is a very easy two line patch (check for /bin /lib on Windows). The first... eeeeeehhh lmfao
FFY00 has quit [Remote host closed the connection]
FFY00 has joined #amaranth-lang