Hook up the VGA controller in top, draw a circle
This commit is contained in:
parent
b38296538f
commit
0d02304dcf
|
@ -5,6 +5,8 @@ import "/nmigen_dg/*"
|
|||
import "/subprocess"
|
||||
import "/sys"
|
||||
import "common/pipeline"
|
||||
import "common/to_signed"
|
||||
import "modules/vga/DviController12"
|
||||
import "resources/pmod"
|
||||
|
||||
|
||||
|
@ -40,6 +42,9 @@ run_icepll = current target ->
|
|||
Top = subclass Elaboratable where
|
||||
elaborate = platform ~> m where with m = Module! =>
|
||||
|
||||
# Configure DVI controller
|
||||
dvi = Submodule$ DviController12 x:800 y:480 fps:60
|
||||
|
||||
# setup clock
|
||||
|
||||
default_clk = platform.request platform.default_clk dir:"-"
|
||||
|
@ -50,7 +55,7 @@ Top = subclass Elaboratable where
|
|||
|
||||
pll_config = run_icepll
|
||||
default_freq
|
||||
40e6
|
||||
dvi.pix_freq
|
||||
print dvi.timings
|
||||
print pll_config
|
||||
|
||||
|
@ -86,9 +91,20 @@ Top = subclass Elaboratable where
|
|||
Comb$ platform.request "led_g" :== ~state
|
||||
|
||||
|
||||
# Feed a pciture to the DVI controller
|
||||
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)
|
||||
When (cx*cx + cy*cy < 150**2) $ ->
|
||||
Sync$ dvi.r :== 0xF
|
||||
Sync$ dvi.g :== 0xF
|
||||
Sync$ dvi.b :== 0xF
|
||||
|
||||
|
||||
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)
|
||||
plat.build Top! do_program: ("--flash" in sys.argv) synth_opts: "-dsp"
|
||||
|
|
Loading…
Reference in New Issue