1 |
5 |
ktt1 |
--------------------------------------------------------------------------------
|
2 |
|
|
-- _ _ __ ____ --
|
3 |
|
|
-- / / | | / _| | __| --
|
4 |
|
|
-- | |_| | _ _ / / | |_ --
|
5 |
|
|
-- | _ | | | | | | | | _| --
|
6 |
|
|
-- | | | | | |_| | \ \_ | |__ --
|
7 |
|
|
-- |_| |_| \_____| \__| |____| microLab --
|
8 |
|
|
-- --
|
9 |
|
|
-- Bern University of Applied Sciences (BFH) --
|
10 |
|
|
-- Quellgasse 21 --
|
11 |
|
|
-- Room HG 4.33 --
|
12 |
|
|
-- 2501 Biel/Bienne --
|
13 |
|
|
-- Switzerland --
|
14 |
|
|
-- --
|
15 |
|
|
-- http://www.microlab.ch --
|
16 |
|
|
--------------------------------------------------------------------------------
|
17 |
|
|
-- GECKO4com
|
18 |
|
|
--
|
19 |
|
|
-- 2010/2011 Dr. Theo Kluter
|
20 |
|
|
--
|
21 |
|
|
-- This VHDL code is free code: you can redistribute it and/or modify
|
22 |
|
|
-- it under the terms of the GNU General Public License as published by
|
23 |
|
|
-- the Free Software Foundation, either version 3 of the License, or
|
24 |
|
|
-- (at your option) any later version.
|
25 |
|
|
--
|
26 |
|
|
-- This VHDL code is distributed in the hope that it will be useful,
|
27 |
|
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
28 |
|
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
29 |
|
|
-- GNU General Public License for more details.
|
30 |
|
|
-- You should have received a copy of the GNU General Public License
|
31 |
|
|
-- along with these sources. If not, see <http://www.gnu.org/licenses/>.
|
32 |
|
|
--
|
33 |
|
|
|
34 |
|
|
-- IMPORTANT: This core is single byte writable/readable only!
|
35 |
|
|
-- In case of a burst size > 1 a bus_error is generated
|
36 |
|
|
--
|
37 |
|
|
-- Address map:
|
38 |
|
|
-- 0x20 -> read/write fg color
|
39 |
|
|
-- 0x21 -> read/write bg color
|
40 |
|
|
-- 0x22 -> read/write cursor x position
|
41 |
|
|
-- 0x23 -> read/write cursor y position
|
42 |
|
|
-- 0x24 -> write ascii data at cursor position
|
43 |
|
|
-- 0x25 -> write dummy for clear screen
|
44 |
|
|
-- 0x26 -> read buttons
|
45 |
|
|
-- 0x27 -> read hexswitch
|
46 |
|
|
-- 0x28 -> read/write LED0 mode
|
47 |
|
|
-- 0x29 -> read/write LED1 mode
|
48 |
|
|
-- 0x2A -> read/write LED2 mode
|
49 |
|
|
-- 0x2B -> read/write LED3 mode
|
50 |
|
|
-- 0x2C -> read/write LED4 mode
|
51 |
|
|
-- 0x2D -> read/write LED5 mode
|
52 |
|
|
-- 0x2E -> read/write LED6 mode
|
53 |
|
|
-- 0x2F -> read/write LED7 mode
|
54 |
|
|
|
55 |
|
|
-- Definition of the led mode reg:
|
56 |
|
|
-- bit 3 -> 1 => fast blinking/toggle (8Hz)
|
57 |
|
|
-- 0 => slow blinking/toggle (1Hz)
|
58 |
|
|
-- bit 2..0 => 000 LED off
|
59 |
|
|
-- 001 LED off
|
60 |
|
|
-- 010 LED Red
|
61 |
|
|
-- 011 LED Green
|
62 |
|
|
-- 100 LED Red blinking
|
63 |
|
|
-- 101 LED Green blinking
|
64 |
|
|
-- 110 LED Red/Green toggling
|
65 |
|
|
-- 111 LED Red/Green toggling
|
66 |
|
|
|
67 |
|
|
LIBRARY ieee;
|
68 |
|
|
USE ieee.std_logic_1164.all;
|
69 |
|
|
USE ieee.std_logic_arith.all;
|
70 |
|
|
|
71 |
|
|
ENTITY vga_bus IS
|
72 |
|
|
PORT ( clock : IN std_logic;
|
73 |
|
|
reset : IN std_logic;
|
74 |
|
|
msec_tick : IN std_logic;
|
75 |
|
|
|
76 |
|
|
-- Here the bus signals are defined
|
77 |
|
|
n_bus_reset : IN std_logic;
|
78 |
|
|
n_start_transmission : IN std_logic;
|
79 |
|
|
n_end_transmission_in : IN std_logic;
|
80 |
|
|
n_end_transmission_out : OUT std_logic;
|
81 |
|
|
n_data_valid_in : IN std_logic; -- Only for low byte!
|
82 |
|
|
n_data_valid_out : OUT std_logic_vector( 1 DOWNTO 0 );
|
83 |
|
|
data_in : IN std_logic_vector( 7 DOWNTO 0 );
|
84 |
|
|
data_out : OUT std_logic_vector(15 DOWNTO 0 );
|
85 |
|
|
read_n_write : IN std_logic;
|
86 |
|
|
burst_size : IN std_logic_vector( 8 DOWNTO 0 );
|
87 |
|
|
bus_address : IN std_logic_vector( 5 DOWNTO 0 );
|
88 |
|
|
n_start_send : OUT std_logic;
|
89 |
|
|
n_bus_error : OUT std_logic;
|
90 |
|
|
|
91 |
|
|
-- Here the button interface is defined
|
92 |
|
|
n_button_1 : IN std_logic;
|
93 |
|
|
n_button_2 : IN std_logic;
|
94 |
|
|
n_button_3 : IN std_logic;
|
95 |
|
|
hexswitch : IN std_logic_vector( 3 DOWNTO 0 );
|
96 |
|
|
|
97 |
|
|
-- Here the LED interface is defined
|
98 |
|
|
leds_a : OUT std_logic_vector( 7 DOWNTO 0 );
|
99 |
|
|
leds_k : OUT std_logic_vector( 7 DOWNTO 0 );
|
100 |
|
|
|
101 |
|
|
-- Here the VGA interface is defined
|
102 |
|
|
cursor_pos : OUT std_logic_vector( 10 DOWNTO 0 );
|
103 |
|
|
screen_offset : OUT std_logic_vector( 4 DOWNTO 0 );
|
104 |
|
|
fg_color : OUT std_logic_vector( 2 DOWNTO 0 );
|
105 |
|
|
bg_color : OUT std_logic_vector( 2 DOWNTO 0 );
|
106 |
|
|
write_address : OUT std_logic_vector( 10 DOWNTO 0 );
|
107 |
|
|
ascii_data : OUT std_logic_vector( 7 DOWNTO 0 );
|
108 |
|
|
we : OUT std_logic);
|
109 |
|
|
END vga_bus;
|