2 from nmigen
.cli
import main
5 class Counter(Elaboratable
):
6 def __init__(self
, width
):
7 self
.v
= Signal(width
, reset
=2**width
-1)
10 def elaborate(self
, platform
):
12 m
.d
.sync
+= self
.v
.eq(self
.v
+ 1)
13 m
.d
.comb
+= self
.o
.eq(self
.v
[-1])
17 ctr
= Counter(width
=16)
18 if __name__
== "__main__":
19 main(ctr
, ports
=[ctr
.o
])