@h.module
class M:
i = h.Input()
o = h.Output()
s = h.Signal()
There is a similar-looking, but not-working, alternative one might write like so:
@h.module
class M:
h.Input(name="i")
h.Output(name="o")
h.Signal(name="s")
That "works", in the sense that Python will compile and execute it. But it is highly unlikely to be what the author intended. In the latter case the hdl21.ModuleM is empty.
Note I do not think the latter should "work". It would be nice to produce some kinda error or feedback though.
But - either "working" or just producing the error would seem to require some tracking of execution context, which I don't love.
Maybe something better will come up.
Example:
There is a similar-looking, but not-working, alternative one might write like so:
That "works", in the sense that Python will compile and execute it. But it is highly unlikely to be what the author intended. In the latter case the
hdl21.Module
M
is empty.Note I do not think the latter should "work". It would be nice to produce some kinda error or feedback though.
But - either "working" or just producing the error would seem to require some tracking of execution context, which I don't love.
Maybe something better will come up.