Switch to the new .eq operator
This commit is contained in:
@@ -8,11 +8,11 @@ Blinker = subclass Elaboratable where
|
||||
|
||||
elaborate = platform ~> m where with m = Module! =>
|
||||
counter = Signal$ range (@ncycles + 1)
|
||||
Sync$ counter :== counter - 1
|
||||
Sync$ counter ::= counter - 1
|
||||
|
||||
When (counter == 0) $ ->
|
||||
Sync$ @out :== ~ @out
|
||||
Sync$ counter :== @ncycles
|
||||
Sync$ @out ::= ~ @out
|
||||
Sync$ counter ::= @ncycles
|
||||
|
||||
if __name__ == "__main__" =>
|
||||
blinker = Blinker ncycles: 10000000
|
||||
|
||||
@@ -7,14 +7,14 @@ Pulser = subclass Elaboratable where
|
||||
@out = Signal!
|
||||
|
||||
elaborate = platform ~> m where with m = Module! =>
|
||||
Sync$ @out :== 0
|
||||
Sync$ @out ::= 0
|
||||
|
||||
counter = Signal$ range (@ncycles + 1)
|
||||
Sync$ counter :== counter - 1
|
||||
Sync$ counter ::= counter - 1
|
||||
|
||||
When (counter == 0) $ ->
|
||||
Sync$ @out :== HIGH
|
||||
Sync$ counter :== @ncycles
|
||||
Sync$ @out ::= HIGH
|
||||
Sync$ counter ::= @ncycles
|
||||
|
||||
if __name__ == "__main__" =>
|
||||
pulser = Pulser ncycles: 10000000
|
||||
|
||||
@@ -13,11 +13,11 @@ Segment7x2 = subclass Elaboratable where
|
||||
|
||||
elaborate = platform ~> m where with m = Module! =>
|
||||
select = Signal!
|
||||
Sync$ select :== ~select
|
||||
Sync$ select ::= ~select
|
||||
|
||||
seg7 = Submodule$ Segment7!
|
||||
|
||||
Comb$ seg7.number :== if
|
||||
Comb$ seg7.number ::= if
|
||||
@decimal => Mux select
|
||||
@number // 10
|
||||
@number % 10
|
||||
@@ -25,8 +25,8 @@ Segment7x2 = subclass Elaboratable where
|
||||
@number >> 4
|
||||
@number & 0x0f
|
||||
|
||||
Comb$ @segs :== seg7.segs
|
||||
Comb$ @select :== select
|
||||
Comb$ @segs ::= seg7.segs
|
||||
Comb$ @select ::= select
|
||||
|
||||
|
||||
Segment7 = subclass Elaboratable where
|
||||
@@ -36,22 +36,22 @@ Segment7 = subclass Elaboratable where
|
||||
|
||||
elaborate = platform ~> m where with m = Module! =>
|
||||
Switch @number
|
||||
0x0 ,-> Comb$ @segs :== 0b0111111
|
||||
0x1 ,-> Comb$ @segs :== 0b0000110
|
||||
0x2 ,-> Comb$ @segs :== 0b1011011
|
||||
0x3 ,-> Comb$ @segs :== 0b1001111
|
||||
0x4 ,-> Comb$ @segs :== 0b1100110
|
||||
0x5 ,-> Comb$ @segs :== 0b1101101
|
||||
0x6 ,-> Comb$ @segs :== 0b1111101
|
||||
0x7 ,-> Comb$ @segs :== 0b0000111
|
||||
0x8 ,-> Comb$ @segs :== 0b1111111
|
||||
0x9 ,-> Comb$ @segs :== 0b1101111
|
||||
0xa ,-> Comb$ @segs :== 0b1110111
|
||||
0xb ,-> Comb$ @segs :== 0b1111100
|
||||
0xc ,-> Comb$ @segs :== 0b0111001
|
||||
0xd ,-> Comb$ @segs :== 0b1011110
|
||||
0xe ,-> Comb$ @segs :== 0b1111001
|
||||
0xf ,-> Comb$ @segs :== 0b1110001
|
||||
0x0 ,-> Comb$ @segs ::= 0b0111111
|
||||
0x1 ,-> Comb$ @segs ::= 0b0000110
|
||||
0x2 ,-> Comb$ @segs ::= 0b1011011
|
||||
0x3 ,-> Comb$ @segs ::= 0b1001111
|
||||
0x4 ,-> Comb$ @segs ::= 0b1100110
|
||||
0x5 ,-> Comb$ @segs ::= 0b1101101
|
||||
0x6 ,-> Comb$ @segs ::= 0b1111101
|
||||
0x7 ,-> Comb$ @segs ::= 0b0000111
|
||||
0x8 ,-> Comb$ @segs ::= 0b1111111
|
||||
0x9 ,-> Comb$ @segs ::= 0b1101111
|
||||
0xa ,-> Comb$ @segs ::= 0b1110111
|
||||
0xb ,-> Comb$ @segs ::= 0b1111100
|
||||
0xc ,-> Comb$ @segs ::= 0b0111001
|
||||
0xd ,-> Comb$ @segs ::= 0b1011110
|
||||
0xe ,-> Comb$ @segs ::= 0b1111001
|
||||
0xf ,-> Comb$ @segs ::= 0b1110001
|
||||
|
||||
|
||||
if __name__ == "__main__" =>
|
||||
|
||||
@@ -119,34 +119,34 @@ VgaController = subclass Elaboratable where
|
||||
@out = platform.request *: @resource
|
||||
|
||||
# pass along the color data
|
||||
Sync$ @out.r :== @r
|
||||
Sync$ @out.g :== @g
|
||||
Sync$ @out.b :== @b
|
||||
Sync$ @out.r ::= @r
|
||||
Sync$ @out.g ::= @g
|
||||
Sync$ @out.b ::= @b
|
||||
|
||||
# position counters
|
||||
counter_x = Signal$ range @total_x
|
||||
counter_y = Signal$ range @total_y
|
||||
Sync$ counter_x :== counter_x + 1
|
||||
Sync$ counter_x ::= counter_x + 1
|
||||
When (counter_x == @total_x - 1) $ ->
|
||||
Sync$ counter_x :== 0
|
||||
Sync$ counter_y :== counter_y + 1
|
||||
Sync$ counter_x ::= 0
|
||||
Sync$ counter_y ::= counter_y + 1
|
||||
When (counter_y == @total_y - 1) $ ->
|
||||
Sync$ counter_y :== 0
|
||||
Sync$ counter_y ::= 0
|
||||
|
||||
# drive vga syncs, data enable and user outputs
|
||||
Comb$ @pixel_x :== counter_x
|
||||
Comb$ @pixel_y :== counter_y
|
||||
Sync$ @out.hs :== (&)
|
||||
Comb$ @pixel_x ::= counter_x
|
||||
Comb$ @pixel_y ::= counter_y
|
||||
Sync$ @out.hs ::= (&)
|
||||
@active_x + @front_x <= counter_x
|
||||
counter_x < @active_x + @front_x + @sync_x
|
||||
Sync$ @out.vs :== (&)
|
||||
Sync$ @out.vs ::= (&)
|
||||
@active_y + @front_y <= counter_y
|
||||
counter_y < @active_y + @front_y + @sync_y
|
||||
Sync$ @out.de :== (&)
|
||||
Sync$ @out.de ::= (&)
|
||||
counter_x < @active_x
|
||||
counter_y < @active_y
|
||||
|
||||
Comb$ @out.ck :== ClockSignal "sync"
|
||||
Comb$ @out.ck ::= ClockSignal "sync"
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user