Permalink
Cannot retrieve contributors at this time
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
25 lines (19 sloc)
595 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from nmigen import * | |
class TestLEDModule( Elaboratable ): | |
def __init__( self ): | |
self.count = Signal( 32, reset = 0 ) | |
def elaborate( self, platform ): | |
m = Module() | |
m.d.sync += self.count.eq( self.count + 1 ) | |
if platform is not None: | |
grn_led = platform.request( 'led_g', 0 ) | |
blu_led = platform.request( 'led_b', 0 ) | |
m.d.comb += [ | |
grn_led.o.eq( self.count[ 20 ] ), | |
blu_led.o.eq( ~grn_led.o ) | |
] | |
return m | |
from nmigen_boards.upduino_v2 import * | |
if __name__ == "__main__": | |
dut = TestLEDModule() | |
UpduinoV2Platform().build( dut ) |