diff --git a/fpga/icebreaker_vga.dg b/fpga/icebreaker_vga.dg index 376f010..bcfa6a9 100644 --- a/fpga/icebreaker_vga.dg +++ b/fpga/icebreaker_vga.dg @@ -40,10 +40,14 @@ run_icepll = current target -> Top = subclass Elaboratable where + __init__ = x y ~> None where + @x = x + @y = y + elaborate = platform ~> m where with m = Module! => # Configure DVI controller - dvi = Submodule$ DviController12 x:800 y:480 fps:60 + dvi = Submodule$ DviController12 @x @y fps:60 # setup clock @@ -94,13 +98,13 @@ Top = subclass Elaboratable where Sync$ dvi.r :== 0x0 Sync$ dvi.g :== 0x0 Sync$ dvi.b :== 0x0 - cx = to_signed dvi.pixel_x - (800//2) - cy = to_signed dvi.pixel_y - (480//2) + cx = to_signed dvi.pixel_x - (@x // 2) + cy = to_signed dvi.pixel_y - (@y // 2) rx = cx*cx ry = cy*cy - tx1 = (dvi.pixel_x - scroll) & (1<<5) - ty1 = (dvi.pixel_y - scroll) & (1<<5) - tx2 = (dvi.pixel_x + scroll) & (1<<6) + tx1 = (dvi.pixel_x - scroll ) & (1<<5) + ty1 = (dvi.pixel_y - scroll ) & (1<<5) + tx2 = (dvi.pixel_x + scroll ) & (1<<6) ty2 = (dvi.pixel_y + scroll + 40) & (1<<6) When rx + ry < 200**2 ,-> @@ -118,4 +122,4 @@ if __name__ == "__main__" => plat = ICEBreakerPlatform! plat.add_resources$ pmod.dvi_12bit 0 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"