- Config File:
8default_signal_polarity = '1'
9default_voltage_standard = 3.
3V
10pinout_filename = PINOUT.xdc
11default_time_units = ms
12alias srr is state_reg_rec(0);
13alias state_reg : integer is state_reg_rec(0).state_reg;
16output blue(4) = B7, C7, D7, D8
17output green(4) = C6, A5, B6, A6
19output red(4) = A3, B4, C5, A4
- VHDL Code:
2use ieee.std_logic_1164.
all;
3use ieee.numeric_std.
all;
4use ieee.std_logic_unsigned.
all;
5use work.user_defs_pkg.
all;
6use work.speakhdl_api_pkg.
all;
9entity vga_controller
is
11 generic (this_sm : integer := -1);
15 sm_input : in std_logic_vector(-1 downto 0);
16 sm_output : out std_logic_vector(13 downto 0);
17 sm_io : inout std_logic_vector(-1 downto 0);
18 next_state_rec : out nsr_array(0 to 0);
19 state_reg_rec : in srr_array(0 to 0)
22end entity vga_controller;
25architecture arch
of vga_controller
is
27 alias blue : std_logic_vector(3 downto 0) is sm_output(3 downto 0);
28 alias green : std_logic_vector(3 downto 0) is sm_output(7 downto 4);
29 alias h_sync : std_logic is sm_output(8);
30 alias red : std_logic_vector(3 downto 0) is sm_output(12 downto 9);
31 alias v_sync : std_logic is sm_output(13);
32 alias srr is state_reg_rec(0);
33 alias state_reg : integer is state_reg_rec(0).state_reg;
34 signal h_enable : std_logic;
35 signal v_enable : std_logic;
36 signal video_on : std_logic;
41 blue(3 downto 0) <= (others => '0');
43 green(3 downto 0) <= (others => '0') when (video_on = '0') else
44 (others => '1') when (to_unsigned(srr.counter(1).value, 7)(6) = '0') else
47 h_sync <= '0' when (srr.counter(0).value < us(5.
12)) else
50 red(3 downto 0) <= (others => '0') when (video_on = '0') else
51 (others => '1') when (to_unsigned(srr.counter(1).value, 7)(6) = '1') else
54 v_sync <= '0' when (srr.counter(1).value < ms(0.
064)) else
59 h_enable <= '0' when (srr.counter(0).value < us(5.
76)) else
60 '0' when (srr.counter(0).value > us(31.
36)) else
63 v_enable <= '0' when (srr.counter(1).value < ms(0.
992)) else
64 '0' when (srr.counter(1).value > ms(16.
352)) else
67 video_on <= '1' when (h_enable = '1' and v_enable = '1') else
79 RESOURCE_SELECT( sys_clk, next_state_rec, state_reg_rec );
81 CONFIGURE_COUNTER( 0, us(32.
0), no_trans, next_state_rec, state_reg_rec );
82 CONFIGURE_COUNTER( 1, ms(16.
672), no_trans, next_state_rec, state_reg_rec );
- See also
- led_blink_example
-
sseg_display_example
-
uart_loopback_example