<_whitenotifier-e>
[YoWASP/yowasp.github.io] whitequark 8b2c251 - Fix issues with badge styling.
sakirious has joined #amaranth-lang
stevenjl has joined #amaranth-lang
Vonter has quit [Ping timeout: 272 seconds]
Vonter has joined #amaranth-lang
Sarayan has joined #amaranth-lang
<Sarayan>
Oh, I wasn't here, hi everyone
<Sarayan>
I'm looking for some advice. Say I want to write some modules simulating the 6502, 65c02, etc. Since they're in the same family I'd like to put the code in a cpu/m6502 directory. How should I organize the directory contents so that there is not *that* many redundancies in the python side?
<Sarayan>
Because right now I don't see how to avoid "from cpu.m6502.m6502 import m6502"
<Sarayan>
(with a m6502 module in a m6502.py file in the directory)
<adamgreig[m]>
you can re-export at each layer, so that you can just "from cpu import m6502" for instance?
<adamgreig[m]>
the file is the module though
rektide has quit [Ping timeout: 256 seconds]
<adamgreig[m]>
so if you have `mypackage/cpu/m6502.py` containing `class M6502` you'd "from .cpu.m6502 import M6502"
<adamgreig[m]>
sorry, I guess you maybe mean an amaranth gateware module aka elaboratable rather than a Python module?
<Sarayan>
No, I'd rather have mypackage/cpu/m6502/something.py, because eventually there's going to be a lot of cpu families
<Sarayan>
yeah, an elaboratable in the end
<Sarayan>
and a lot of cpus in each family
<adamgreig[m]>
sure, so then in `m6502/__init__.py` you can have `from m65c02 import M65C02` and other code can say `from cpu.m6502 import M65C02`
<Sarayan>
ahhhh, nice trick with __init__.py
<adamgreig[m]>
(and also have `m6502/m65c02.py` containing `class M65C02:`
<Sarayan>
sure
<Sarayan>
I could even have a cpu/__init__.py with a from m6502 import * and drop one layer from the main code?
<Sarayan>
e.g. from cpu import M65C02
<adamgreig[m]>
yea
<adamgreig[m]>
that's common in python to organise things