Fix off-by-one error in vga.dg and add vga.{h,v}blank_begin signals
This commit is contained in:
parent
a9c023eb6a
commit
99504c4026
|
@ -9,7 +9,7 @@ My focus is currently on:
|
||||||
* Effortless dependency management
|
* Effortless dependency management
|
||||||
* Helper functions for inspection and documentation of the design
|
* Helper functions for inspection and documentation of the design
|
||||||
* Helper functions for targeting multiple FPGA platforms and boards
|
* Helper functions for targeting multiple FPGA platforms and boards
|
||||||
* Creating PRs to other projects with stuff i find here
|
* Creating PRs to other projects with stuff I come across here
|
||||||
* Having fun with my FPGA
|
* Having fun with my FPGA
|
||||||
|
|
||||||
# Setup
|
# Setup
|
||||||
|
@ -38,8 +38,8 @@ To reduce the amount of typing:
|
||||||
|
|
||||||
* Diagrams are nice
|
* Diagrams are nice
|
||||||
* Documentation generation would be nice
|
* Documentation generation would be nice
|
||||||
* A central nmigen-pmod library would be nice
|
* A central nmigen-pmod repository would be nice
|
||||||
* A RISCV toolchain would be nice (make socs, and compile C, C++ or Rust)
|
* A RISCV toolchain would be nice (make socs, and compile C, C++ or Rust)
|
||||||
* nextpnr-xray or vtr would be nice
|
* nextpnr-prxray or vpr would be nice
|
||||||
* Batch setup of Vivado would be nice
|
* Batch setup of Vivado would be nice
|
||||||
* Ability to synth on a host accessible with ssh would be nice
|
* Ability to synth on a host accessible with ssh would be nice
|
||||||
|
|
|
@ -19,6 +19,7 @@ Top = subclass Elaboratable where
|
||||||
|
|
||||||
# setup clock
|
# setup clock
|
||||||
pll_config = add_domain_from_pll platform dvi.pix_freq
|
pll_config = add_domain_from_pll platform dvi.pix_freq
|
||||||
|
print pll_config
|
||||||
|
|
||||||
|
|
||||||
# Feed a picture to the DVI controller
|
# Feed a picture to the DVI controller
|
||||||
|
|
|
@ -56,7 +56,7 @@ VGA_TIMINGS = dict' # VGA, SVGA, VESA
|
||||||
# http://martin.hinner.info/vga/timing.html
|
# http://martin.hinner.info/vga/timing.html
|
||||||
|
|
||||||
|
|
||||||
run_gtf = x y fps ->
|
run_gtf = x y fps -> # TODO: pack this dependency with wasmtime?
|
||||||
out = subprocess.run ["gtf", str x, str y, str fps, "-x"]
|
out = subprocess.run ["gtf", str x, str y, str fps, "-x"]
|
||||||
capture_output: True
|
capture_output: True
|
||||||
check: True
|
check: True
|
||||||
|
@ -86,6 +86,8 @@ VgaController = subclass Elaboratable where
|
||||||
@pixel_x = Signal$ range @active_x
|
@pixel_x = Signal$ range @active_x
|
||||||
@pixel_y = Signal$ range @active_y
|
@pixel_y = Signal$ range @active_y
|
||||||
@active = Signal!
|
@active = Signal!
|
||||||
|
@hblank_begin = Signal! # pulsed at start of hblank
|
||||||
|
@vblank_begin = Signal! # pulsed at start of vblank
|
||||||
|
|
||||||
# in
|
# in
|
||||||
@r = Signal$ bitwidth
|
@r = Signal$ bitwidth
|
||||||
|
@ -113,9 +115,9 @@ VgaController = subclass Elaboratable where
|
||||||
@out = platform.request *: @resource
|
@out = platform.request *: @resource
|
||||||
|
|
||||||
# pass along the color data
|
# pass along the color data
|
||||||
Sync$ @out.r ::= @r
|
Comb$ @out.r ::= @r
|
||||||
Sync$ @out.g ::= @g
|
Comb$ @out.g ::= @g
|
||||||
Sync$ @out.b ::= @b
|
Comb$ @out.b ::= @b
|
||||||
|
|
||||||
# position counters
|
# position counters
|
||||||
counter_x = Signal$ range @total_x
|
counter_x = Signal$ range @total_x
|
||||||
|
@ -127,6 +129,9 @@ VgaController = subclass Elaboratable where
|
||||||
When (counter_y == @total_y - 1) $ ->
|
When (counter_y == @total_y - 1) $ ->
|
||||||
Sync$ counter_y ::= 0
|
Sync$ counter_y ::= 0
|
||||||
|
|
||||||
|
Sync$ @hblank_begin ::= ((counter_x == @active_x))
|
||||||
|
Sync$ @vblank_begin ::= ((counter_x == @active_x) & (counter_y == @active_y - 1))
|
||||||
|
|
||||||
# drive vga syncs, data enable and user outputs
|
# drive vga syncs, data enable and user outputs
|
||||||
Comb$ @pixel_x ::= counter_x
|
Comb$ @pixel_x ::= counter_x
|
||||||
Comb$ @pixel_y ::= counter_y
|
Comb$ @pixel_y ::= counter_y
|
||||||
|
|
|
@ -4,7 +4,7 @@ import "/nmigen_dg/*"
|
||||||
import "/subprocess"
|
import "/subprocess"
|
||||||
import "../common/pipeline"
|
import "../common/pipeline"
|
||||||
|
|
||||||
run_icepll = current target ->
|
run_icepll = current target -> # TODO: use yowasp-nextpnr-ice40 if installed
|
||||||
current /= 1e6 # Hz -> MHz
|
current /= 1e6 # Hz -> MHz
|
||||||
target /= 1e6 # Hz -> MHz
|
target /= 1e6 # Hz -> MHz
|
||||||
out = subprocess.run ["icepll", "-i", str current, "-o", str target]
|
out = subprocess.run ["icepll", "-i", str current, "-o", str target]
|
||||||
|
@ -44,7 +44,6 @@ add_domain_from_pll = platform target_freq domain:"sync" -> pll_config where
|
||||||
pll_config = run_icepll
|
pll_config = run_icepll
|
||||||
default_freq
|
default_freq
|
||||||
target_freq
|
target_freq
|
||||||
print pll_config
|
|
||||||
|
|
||||||
pll_clk = Signal!
|
pll_clk = Signal!
|
||||||
pll_lock = Signal!
|
pll_lock = Signal!
|
||||||
|
|
Loading…
Reference in New Issue