From 5094f38dc303ffb483f21916399e293a56c5ac99 Mon Sep 17 00:00:00 2001 From: Bernhard Urban Date: Thu, 29 Oct 2009 16:36:22 +0100 Subject: [PATCH 1/1] bsp3: erster versuch --- bsp3/Angabe/vga_control_arc.vhd | 40 ++++++++++++++++++++++++++++++--- bsp3/Angabe/vga_pak.vhd | 5 ++++- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/bsp3/Angabe/vga_control_arc.vhd b/bsp3/Angabe/vga_control_arc.vhd index 0c4425b..0b33ff9 100644 --- a/bsp3/Angabe/vga_control_arc.vhd +++ b/bsp3/Angabe/vga_control_arc.vhd @@ -40,12 +40,46 @@ architecture behav of vga_control is attribute syn_preserve of behav : architecture is true; - -begin - + DRAW_SQUARE_syn: process(clk, reset) + begin + if (reset = RES_ACT) then -- draw black screen upon reset r <= COLR_OFF; g <= COLR_OFF; b <= COLR_OFF; + elsif (clk'event and clk = '1') then -- synchronous capture + r <= r_next; + g <= g_next; + b <= b_next; + end if; + end process; + + + DRAW_SQUARE_next: process (column_counter, v_enable, h_enable) + begin + if v_enable = ENABLE and h_enable = ENABLE then + if (column_counter >= X_MIN and column_counter < X2_MIN) -- if pixel within the rectangle borders + r_next <= COLR_OFF; + g_next <= COLR_OFF; + b_next <= COLR_ON; + elsif (column_counter >= X2_MIN and column_counter < X3_MIN) -- if pixel within the rectangle borders + r_next <= COLR_OFF; + g_next <= COLR_ON; + b_next <= COLR_ON; + elsif (column_counter >= X3_MIN and column_counter < X_MAX) -- if pixel within the rectangle borders + r_next <= COLR_ON; + g_next <= COLR_OFF; + b_next <= COLR_ON; + else -- if somewhere else on screen... + r_next <= COLR_OFF; + g_next <= COLR_OFF; -- ... draw background color + b_next <= COLR_OFF; + end if; + else -- if out of screen... + r_next <= COLR_OFF; + g_next <= COLR_OFF; -- ... do not activate any color + b_next <= COLR_OFF; -- (black screen) + end if; + end process; end behav; diff --git a/bsp3/Angabe/vga_pak.vhd b/bsp3/Angabe/vga_pak.vhd index 7f59eab..1dff302 100644 --- a/bsp3/Angabe/vga_pak.vhd +++ b/bsp3/Angabe/vga_pak.vhd @@ -52,7 +52,10 @@ package vga_pak is -- define coordinates of rectangle constant X_MIN : std_logic_vector(COL_CNT_WIDTH-1 downto 0) := "0001100100"; -- 100 - constant X_MAX : std_logic_vector(COL_CNT_WIDTH-1 downto 0) := "0011001000"; -- 200 + constant X2_MIN : std_logic_vector(COL_CNT_WIDTH-1 downto 0) := "0010100111"; -- 167 + constant X3_MIN : std_logic_vector(COL_CNT_WIDTH-1 downto 0) := "0011101000"; -- 232 + constant X_MAX : std_logic_vector(COL_CNT_WIDTH-1 downto 0) := "0101110000"; -- 368 + constant Y_MIN : std_logic_vector(LINE_CNT_WIDTH-1 downto 0) := "001100100"; constant Y_MAX : std_logic_vector(LINE_CNT_WIDTH-1 downto 0) := "011001000"; -- 2.25.1