nmigen-learning/fpga/icebreaker.dg

33 lines
965 B
Plaintext
Raw Normal View History

import "/nmigen_boards.icebreaker/ICEBreakerPlatform"
import "/nmigen_dg/*"
import "modules/blinker/Blinker"
import "modules/blinker/Pulser"
2020-08-07 00:22:39 +02:00
import "resources/pmod"
Top = subclass Elaboratable where
elaborate = platform ~> m where with m = Module! =>
freq = int platform.default_clk_frequency
@ledr = platform.request "led_r"
@ledg = platform.request "led_g"
2020-08-07 00:22:39 +02:00
@seg7 = platform.request "seven_seg"
@blinker = Blinker$ freq // 3
m.submodules += @blinker
@pulser = Pulser$ freq // 3
m.submodules += @pulser
sync$ drive @ledr @blinker.out
hello = Signal 1 reset: 1
when @pulser.out $ ->
sync$ drive hello ~hello
sync$ drive @ledg hello
if __name__ == "__main__" =>
plat = ICEBreakerPlatform!
2020-08-08 02:27:31 +02:00
plat.add_resources$ pmod.seven_seg pmod: 0 # pmod 1a
plat.add_resources$ pmod.dip_switch8 pmod: 1 # pmod 1b
plat.build Top! do_program: True