uart_rx: ein prozessmodell. spart weitere 3 logic elements :P
[hwmod.git] / src / textmode_vga / textmode_vga_component_pkg.vhd
1 -------------------------------------------------------------------------\r
2 --\r
3 -- Filename: textmode_vga_component_pkg.vhd\r
4 -- =========\r
5 --\r
6 -- Short Description:\r
7 -- ==================\r
8 --   This package contains the declaration of all componets\r
9 --   used within the textmode VGA controller implementation.\r
10 --\r
11 -------------------------------------------------------------------------\r
12 \r
13 library ieee;
14 use ieee.std_logic_1164.all;
15 use ieee.numeric_std.all;
16 use work.math_pkg.all;
17 use work.textmode_vga_pkg.all;
18 use work.font_pkg.all;
19 use work.textmode_vga_platform_dependent_pkg.all;
20
21 package textmode_vga_component_pkg is
22   component textmode_vga_h_sm is
23     port
24     (
25       sys_clk, sys_res_n : in std_logic;
26     
27       background_color : in std_logic_vector(RED_BITS + GREEN_BITS + BLUE_BITS - 1 downto 0);
28
29       char_cnt         : out std_logic_vector(log2c(COLUMN_COUNT) - 1 downto 0);
30       char_line_cnt    : in  std_logic_vector(log2c(LINE_COUNT) - 1 downto 0);
31       cursor_column    : in  std_logic_vector(log2c(COLUMN_COUNT) - 1 downto 0);
32       cursor_line      : in  std_logic_vector(log2c(LINE_COUNT) - 1 downto 0);
33       cursor_color     : in  std_logic_vector(RED_BITS + GREEN_BITS + BLUE_BITS - 1 downto 0);
34       cursor_state     : in  CURSOR_STATE_TYPE;
35       decoded_char     : in  std_logic_vector(0 to CHAR_WIDTH - 1);
36       color            : in  std_logic_vector(RED_BITS + GREEN_BITS + BLUE_BITS - 1 downto 0);
37     
38       is_data_line : in std_logic;
39       is_eol : out std_logic;
40     
41       hsync_n : out std_logic;
42       rgb : out std_logic_vector(RED_BITS + GREEN_BITS + BLUE_BITS - 1 downto 0);
43       blink : in std_logic
44     );
45   end component textmode_vga_h_sm;
46   
47   component textmode_vga_v_sm is
48     port
49     (
50       sys_clk, sys_res_n : in std_logic;
51
52       is_data_line : out std_logic;
53       char_line_cnt : out std_logic_vector(log2c(LINE_COUNT) - 1 downto 0);
54       char_height_pixel : out std_logic_vector(log2c(CHAR_HEIGHT) - 1 downto 0);
55       is_eol : in std_logic;
56   
57       vsync_n : out std_logic
58     );
59   end component textmode_vga_v_sm;
60
61   component textmode_vga is
62     generic
63     (
64       VGA_CLK_FREQ : integer;
65       BLINK_INTERVAL_MS : integer;
66       SYNC_STAGES : integer
67     );
68     port
69     (
70       sys_clk, sys_res_n : in std_logic;
71       command : in std_logic_vector(COMMAND_SIZE - 1 downto 0);
72       command_data : in std_logic_vector(3 * COLOR_SIZE + CHAR_SIZE - 1 downto 0);
73       free : out std_logic;
74
75       vga_clk, vga_res_n : in std_logic;    
76       vsync_n : out std_logic;
77       hsync_n : out std_logic;
78       r : out std_logic_vector(RED_BITS - 1 downto 0);
79       g : out std_logic_vector(GREEN_BITS - 1 downto 0);
80       b : out std_logic_vector(BLUE_BITS - 1 downto 0)
81     );
82   end component textmode_vga;
83
84   component video_memory is
85     generic
86     (
87       DATA_WIDTH     : integer;
88       ROW_ADDR_WIDTH : integer;
89       COL_ADDR_WIDTH : integer
90     );
91     port
92     (
93       vga_clk : in  std_logic;    
94       vga_row_address    : in  std_logic_vector(ROW_ADDR_WIDTH - 1 downto 0);
95       vga_col_address    : in  std_logic_vector(COL_ADDR_WIDTH - 1 downto 0);
96       vga_data           : out std_logic_vector(DATA_WIDTH - 1 downto 0);
97       sm_row_address  : in  std_logic_vector(ROW_ADDR_WIDTH - 1 downto 0);
98       sm_col_address  : in  std_logic_vector(COL_ADDR_WIDTH - 1 downto 0);
99       sm_data         : in  std_logic_vector(DATA_WIDTH - 1 downto 0);
100       sm_wr           : in  std_logic;
101       sm_scroll_address     : in  std_logic_vector(ROW_ADDR_WIDTH - 1 downto 0)
102     );
103   end component video_memory;
104
105   component pll is
106     port
107     (
108       inclk0 : in std_logic;
109       c0 : out std_logic 
110     );
111   end component pll;
112
113   component console_sm is
114     port
115     (
116       vga_clk, vga_res_n : in std_logic;
117       command : in std_logic_vector(COMMAND_SIZE - 1 downto 0);
118       command_data : in std_logic_vector(3 * COLOR_SIZE + CHAR_SIZE - 1 downto 0);
119       command_req : in std_logic;
120       ack : out std_logic;
121
122       column_address : out std_logic_vector(log2c(COLUMN_COUNT) - 1 downto 0);
123       row_address : out std_logic_vector(log2c(LINE_COUNT) - 1 downto 0);
124       data : out std_logic_vector(RED_BITS + GREEN_BITS + BLUE_BITS + CHAR_SIZE - 1 downto 0);
125       wr : out std_logic;
126       scroll_address : out std_logic_vector(log2c(LINE_COUNT) - 1 downto 0);
127       background_color : out std_logic_vector(RED_BITS + GREEN_BITS + BLUE_BITS - 1 downto 0);
128       cursor_color     : out std_logic_vector(RED_BITS + GREEN_BITS + BLUE_BITS - 1 downto 0);
129       cursor_state     : out CURSOR_STATE_TYPE
130     ); 
131   end component console_sm;
132
133   component font_rom is
134     port
135     (
136       vga_clk : in std_logic;
137       char : in std_logic_vector(log2c(CHAR_COUNT) - 1 downto 0);
138       char_height_pixel : in std_logic_vector(log2c(CHAR_HEIGHT) - 1 downto 0);
139       decoded_char : out std_logic_vector(0 to CHAR_WIDTH - 1)
140     );
141   end component font_rom;
142
143   component console_sm_sync is
144     generic
145     (
146       SYNC_STAGES    : integer
147     );
148     port
149     (
150       sys_clk, sys_res_n : in std_logic;
151       command_sys : in std_logic_vector(COMMAND_SIZE - 1 downto 0);
152       command_data_sys : in std_logic_vector(3 * COLOR_SIZE + CHAR_SIZE - 1 downto 0);
153       free_sys : out std_logic;
154       
155       vga_clk, vga_res_n : in std_logic;
156       command_vga : out std_logic_vector(COMMAND_SIZE - 1 downto 0);
157       command_data_vga : out std_logic_vector(3 * COLOR_SIZE + CHAR_SIZE - 1 downto 0);
158       command_req_vga : out std_logic;
159       ack_vga : in std_logic
160     );
161   end component console_sm_sync;
162
163   component interval is
164     generic
165     (
166       CLK_FREQ : integer;
167       INTERVAL_TIME_MS : integer
168     );
169     port
170     (
171       clk : in std_logic;
172       res_n : in std_logic;
173       active : out std_logic
174     );
175   end component interval;
176 end package textmode_vga_component_pkg;