Use Segment7 in the icebreaker top

This commit is contained in:
Peder Bergebakken Sundt 2020-08-09 21:57:26 +02:00
parent beb63dcf84
commit e7d54f249e
1 changed files with 19 additions and 9 deletions

View File

@ -2,6 +2,7 @@ import "/nmigen_boards.icebreaker/ICEBreakerPlatform"
import "/nmigen_dg/*" import "/nmigen_dg/*"
import "modules/blinker/Blinker" import "modules/blinker/Blinker"
import "modules/pulser/Pulser" import "modules/pulser/Pulser"
import "modules/segment7/Segment7"
import "resources/pmod" import "resources/pmod"
Top = subclass Elaboratable where Top = subclass Elaboratable where
@ -12,18 +13,27 @@ Top = subclass Elaboratable where
@ledg = platform.request "led_g" @ledg = platform.request "led_g"
@seg7 = platform.request "seven_seg" @seg7 = platform.request "seven_seg"
@blinker = Blinker$ freq // 3 blinker = (Submodule$ Blinker$ freq // 3 ).out
m.submodules += @blinker pulser = (Submodule$ Pulser$ freq // 10).out
seg7 = Submodule$ Segment7!
@pulser = Pulser$ freq // 3 Comb$ Drive @ledr blinker
m.submodules += @pulser
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__" => if __name__ == "__main__" =>
plat = ICEBreakerPlatform! plat = ICEBreakerPlatform!