icebreaker_vga: Set vga resolution with arguments

This commit is contained in:
Peder Bergebakken Sundt 2020-08-16 23:47:35 +02:00
parent 31894085ff
commit 385d19e9c4
1 changed files with 11 additions and 7 deletions

View File

@ -40,10 +40,14 @@ run_icepll = current target ->
Top = subclass Elaboratable where Top = subclass Elaboratable where
__init__ = x y ~> None where
@x = x
@y = y
elaborate = platform ~> m where with m = Module! => elaborate = platform ~> m where with m = Module! =>
# Configure DVI controller # Configure DVI controller
dvi = Submodule$ DviController12 x:800 y:480 fps:60 dvi = Submodule$ DviController12 @x @y fps:60
# setup clock # setup clock
@ -94,13 +98,13 @@ Top = subclass Elaboratable where
Sync$ dvi.r :== 0x0 Sync$ dvi.r :== 0x0
Sync$ dvi.g :== 0x0 Sync$ dvi.g :== 0x0
Sync$ dvi.b :== 0x0 Sync$ dvi.b :== 0x0
cx = to_signed dvi.pixel_x - (800//2) cx = to_signed dvi.pixel_x - (@x // 2)
cy = to_signed dvi.pixel_y - (480//2) cy = to_signed dvi.pixel_y - (@y // 2)
rx = cx*cx rx = cx*cx
ry = cy*cy ry = cy*cy
tx1 = (dvi.pixel_x - scroll) & (1<<5) tx1 = (dvi.pixel_x - scroll ) & (1<<5)
ty1 = (dvi.pixel_y - scroll) & (1<<5) ty1 = (dvi.pixel_y - scroll ) & (1<<5)
tx2 = (dvi.pixel_x + scroll) & (1<<6) tx2 = (dvi.pixel_x + scroll ) & (1<<6)
ty2 = (dvi.pixel_y + scroll + 40) & (1<<6) ty2 = (dvi.pixel_y + scroll + 40) & (1<<6)
When When
rx + ry < 200**2 ,-> rx + ry < 200**2 ,->
@ -118,4 +122,4 @@ if __name__ == "__main__" =>
plat = ICEBreakerPlatform! plat = ICEBreakerPlatform!
plat.add_resources$ pmod.dvi_12bit 0 plat.add_resources$ pmod.dvi_12bit 0
plat.add_resources$ plat.break_off_pmod plat.add_resources$ plat.break_off_pmod
plat.build Top! do_program: ("--flash" in sys.argv) synth_opts: "-dsp" plat.build (Top 800 480) do_program: ("--flash" in sys.argv) synth_opts: "-dsp"