From e7d54f249e6ee509bafb59dd82115145eb217dc9 Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Sun, 9 Aug 2020 21:57:26 +0200 Subject: [PATCH] Use Segment7 in the icebreaker top --- fpga/icebreaker.dg | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/fpga/icebreaker.dg b/fpga/icebreaker.dg index 0f0f471..30052b9 100644 --- a/fpga/icebreaker.dg +++ b/fpga/icebreaker.dg @@ -2,6 +2,7 @@ import "/nmigen_boards.icebreaker/ICEBreakerPlatform" import "/nmigen_dg/*" import "modules/blinker/Blinker" import "modules/pulser/Pulser" +import "modules/segment7/Segment7" import "resources/pmod" Top = subclass Elaboratable where @@ -12,18 +13,27 @@ Top = subclass Elaboratable where @ledg = platform.request "led_g" @seg7 = platform.request "seven_seg" - @blinker = Blinker$ freq // 3 - m.submodules += @blinker + blinker = (Submodule$ Blinker$ freq // 3 ).out + pulser = (Submodule$ Pulser$ freq // 10).out + seg7 = Submodule$ Segment7! - @pulser = Pulser$ freq // 3 - m.submodules += @pulser + Comb$ Drive @ledr blinker + + ff = Signal 1 reset: 1 + When pulser $ -> + Sync$ Drive ff ~ff + + Comb$ Drive @ledg ff + + counter = Signal 8 + Comb$ Drive seg7.number counter + Comb$ Drive @seg7 seg7.pmod + + When pulser $ -> + Sync$ Drive ff ~ff + Sync$ Drive counter (counter + 1) - 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!