20 lines
557 B
Plaintext
20 lines
557 B
Plaintext
import "/nmigen/cli/main"
|
|
import "/nmigen_dg/*"
|
|
|
|
Blinker = subclass Elaboratable where
|
|
__init__ = ncycles ~> None where
|
|
@ncycles = ncycles
|
|
@out = Signal!
|
|
|
|
elaborate = platform ~> m where with m = Module! =>
|
|
counter = Signal$ range (@ncycles + 1)
|
|
Sync$ Drive counter (counter - 1)
|
|
|
|
When (counter == 0) $ ->
|
|
Sync$ Drive @out (~ @out)
|
|
Sync$ Drive counter @ncycles
|
|
|
|
if __name__ == "__main__" =>
|
|
blinker = Blinker ncycles: 10000000
|
|
main blinker name: "blinker" ports: [blinker.out]
|