amaranth/examples/inst.py
whitequark 44711b7d08 hdl.ir: detect elaboratables that are created but not used.
Requres every elaboratable to inherit from Elaboratable, but still
accepts ones that do not, with a warning.

Fixes #3.
2019-04-21 08:52:57 +00:00

27 lines
627 B
Python

from nmigen import *
from nmigen.cli import main
class System(Elaboratable):
def __init__(self):
self.adr = Signal(16)
self.dat_r = Signal(8)
self.dat_w = Signal(8)
self.we = Signal()
def elaborate(self, platform):
m = Module()
m.submodules.cpu = Instance("CPU",
p_RESET_ADDR=0xfff0,
i_d_adr =self.adr,
i_d_dat_r=self.dat_r,
o_d_dat_w=self.dat_w,
i_d_we =self.we,
)
return m
if __name__ == "__main__":
sys = System()
main(sys, ports=[sys.adr, sys.dat_r, sys.dat_w, sys.we])