aboutsummaryrefslogtreecommitdiff
path: root/src/vga
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2021-06-05 12:01:24 +0000
committerrodri <rgl@antares-labs.eu>2021-06-05 12:01:24 +0000
commit633a02454fd60da2e5a89fcc8ce82cb31044e0ac (patch)
treee9dd0abfef45ddaefdff01bcd586ceff9819332b /src/vga
downloadfpgatoys-633a02454fd60da2e5a89fcc8ce82cb31044e0ac.tar.gz
fpgatoys-633a02454fd60da2e5a89fcc8ce82cb31044e0ac.tar.bz2
fpgatoys-633a02454fd60da2e5a89fcc8ce82cb31044e0ac.zip
public release.HEADmaster
Diffstat (limited to 'src/vga')
-rw-r--r--src/vga/vga.qsf72
-rw-r--r--src/vga/vga.v44
2 files changed, 116 insertions, 0 deletions
diff --git a/src/vga/vga.qsf b/src/vga/vga.qsf
new file mode 100644
index 0000000..6b41767
--- /dev/null
+++ b/src/vga/vga.qsf
@@ -0,0 +1,72 @@
+# -------------------------------------------------------------------------- #
+#
+# Copyright (C) 2018 Intel Corporation. All rights reserved.
+# Your use of Intel Corporation's design tools, logic functions
+# and other software and tools, and its AMPP partner logic
+# functions, and any output files from any of the foregoing
+# (including device programming or simulation files), and any
+# associated documentation or information are expressly subject
+# to the terms and conditions of the Intel Program License
+# Subscription Agreement, the Intel Quartus Prime License Agreement,
+# the Intel FPGA IP License Agreement, or other applicable license
+# agreement, including, without limitation, that your use is for
+# the sole purpose of programming logic devices manufactured by
+# Intel and sold by Intel or its authorized distributors. Please
+# refer to the applicable agreement for further details.
+#
+# -------------------------------------------------------------------------- #
+#
+# Quartus Prime
+# Version 18.0.0 Build 614 04/24/2018 SJ Lite Edition
+# Date created = 11:28:26 July 15, 2018
+#
+# -------------------------------------------------------------------------- #
+#
+# Notes:
+#
+# 1) The default values for assignments are stored in the file:
+# vga_assignment_defaults.qdf
+# If this file doesn't exist, see file:
+# assignment_defaults.qdf
+#
+# 2) Altera recommends that you do not modify this file. This
+# file is updated automatically by the Quartus Prime software
+# and any changes you make may be lost or overwritten.
+#
+# -------------------------------------------------------------------------- #
+
+
+set_global_assignment -name FAMILY "Cyclone IV E"
+set_global_assignment -name DEVICE EP4CE6E22C8
+set_global_assignment -name TOP_LEVEL_ENTITY vga
+set_global_assignment -name ORIGINAL_QUARTUS_VERSION 18.0.0
+set_global_assignment -name PROJECT_CREATION_TIME_DATE "11:28:26 JULY 15, 2018"
+set_global_assignment -name LAST_QUARTUS_VERSION "18.0.0 Lite Edition"
+set_global_assignment -name PROJECT_OUTPUT_DIRECTORY output_files
+set_global_assignment -name MIN_CORE_JUNCTION_TEMP 0
+set_global_assignment -name MAX_CORE_JUNCTION_TEMP 85
+set_global_assignment -name ERROR_CHECK_FREQUENCY_DIVISOR 1
+set_global_assignment -name NOMINAL_CORE_SUPPLY_VOLTAGE 1.2V
+set_global_assignment -name PARTITION_NETLIST_TYPE SOURCE -section_id Top
+set_global_assignment -name PARTITION_FITTER_PRESERVATION_LEVEL PLACEMENT_AND_ROUTING -section_id Top
+set_global_assignment -name PARTITION_COLOR 16764057 -section_id Top
+set_location_assignment PIN_23 -to clk
+set_location_assignment PIN_101 -to hsync
+set_location_assignment PIN_103 -to vsync
+set_location_assignment PIN_106 -to r
+set_location_assignment PIN_105 -to g
+set_location_assignment PIN_104 -to b
+set_global_assignment -name ENABLE_OCT_DONE OFF
+set_global_assignment -name ENABLE_CONFIGURATION_PINS OFF
+set_global_assignment -name ENABLE_BOOT_SEL_PIN OFF
+set_global_assignment -name USE_CONFIGURATION_DEVICE OFF
+set_global_assignment -name CRC_ERROR_OPEN_DRAIN OFF
+set_global_assignment -name CYCLONEII_RESERVE_NCEO_AFTER_CONFIGURATION "USE AS REGULAR IO"
+set_global_assignment -name OUTPUT_IO_TIMING_NEAR_END_VMEAS "HALF VCCIO" -rise
+set_global_assignment -name OUTPUT_IO_TIMING_NEAR_END_VMEAS "HALF VCCIO" -fall
+set_global_assignment -name OUTPUT_IO_TIMING_FAR_END_VMEAS "HALF SIGNAL SWING" -rise
+set_global_assignment -name OUTPUT_IO_TIMING_FAR_END_VMEAS "HALF SIGNAL SWING" -fall
+set_global_assignment -name POWER_PRESET_COOLING_SOLUTION "23 MM HEAT SINK WITH 200 LFPM AIRFLOW"
+set_global_assignment -name POWER_BOARD_THERMAL_MODEL "NONE (CONSERVATIVE)"
+set_global_assignment -name VERILOG_FILE vga.v
+set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top \ No newline at end of file
diff --git a/src/vga/vga.v b/src/vga/vga.v
new file mode 100644
index 0000000..da9de58
--- /dev/null
+++ b/src/vga/vga.v
@@ -0,0 +1,44 @@
+module vga(
+ input wire clk,
+ output wire hsync,
+ output wire vsync,
+ output wire r,
+ output wire g,
+ output wire b
+);
+
+reg[9:0] hcnt;
+reg[9:0] vcnt;
+reg div;
+reg hpulse;
+reg vpulse;
+
+wire linedone = hcnt == (800-1);
+wire screendone = vcnt == (525-1);
+
+always @(posedge clk)
+ div <= div + 1;
+
+always @(posedge div) begin
+if(linedone) begin
+ hcnt <= 0;
+ vcnt <= vcnt + 1;
+end
+else
+ hcnt <= hcnt + 1;
+if(screendone)
+ vcnt <= 0;
+end
+
+always @(posedge div) begin
+ hpulse <= hcnt[9:4] == 0;
+ vpulse <= vcnt == 0;
+end
+
+assign hsync = ~hpulse;
+assign vsync = ~vpulse;
+assign r = vcnt[3] | hcnt & 1;
+assign g = vcnt[3] | hcnt & 1;
+assign b = vcnt[3] | hcnt & 1;
+
+endmodule \ No newline at end of file