Đồ án Điều khiển tín hiệu bàn phím chuẩn PS2 và tín hiệu VGA dựa trên công nghệ FPGA

Mục Lục Mục Lục. 1 Danh mục hình vẽ. 3 Danh mục bảng. 4 Lời nói đầu. 5 Thuật Ngữ Tiếng Anh. 6 CHƯƠNG I - TỔNG QUAN VỀ FPGA VÀ NGÔN NGỮ VHDL8 1.1 Tổng quan về FPGA8 1.1.1. Lịch sử ra đời của FPGA8 1.1.2. Khái niệm cơ bản và cấu trúc của FPGA8 1.1.3. Các ứng dụng của FPGA11 1.1.4 Ý nghĩa và vai trò của FPGA11 1.1.5 So sánh FPGA với một số mạch lập trình được. 13 1.1.5.1 FPGA với CPLD13 1.1.5.2 FPGA với SoC13 1.1.6 Trình tự thiết kế chip dựa vào FPGA14 1.2 Ngôn ngữ mô tả phần cứng - VHDL17 1.2.1 Đặt vấn đề. 17 1.2.2 Những ưu điểm của phương pháp thiết sử dụng HDL.18 1.2.3. Giới thiệu ngôn ngữ mô tả phần cứng VHDL19 1.2.4 Cấu trúc một mô hình hệ thống mô tả bằng VHDL20 1.2.5 Trình tự thiết kế một chíp dựa trên VHDL23 CHƯƠNG II - GIỚI THIỆU VỀ SPARTAN -3E KIT VÀ ISE 9.2I. 25 2.1 Hãng Xilinx. 25 2.2 Mạch phát triển họ Spartan 3E Kit Board của hãng Xilink. 25 2.2.1 Kiến trúc cơ bản. 25 2.2.2 Các thông số kỹ thuật và một số hình ảnh. 27 2.2.3 Mã số Chip và ý nghĩa của nó.28 2.3 Môi trường lập trình ISE Foundation 9.2i29 2.3.1. Giới thiệu môi trường lập trình ISE.29 2.3.2 Ý nghĩa của bộ công cụ ISE30 2.3.3 Giới thiệu các công cụ lập trình của hãng Xilink. 30 2.3.3.1 ISE 9.2. 30 2.3.3.2 Logic Core 9.2. 31 2.3.3.3 EDK 9.2. 31 2.3.3.4 System Generator 9.2. 31 2.3.4 Sơ lược cách sử dụng phần mềm ISE Foundation 9.2i32 CHƯƠNG III – TÌM HIỂU TÍN HIỆU PS2 VÀ VGA36 3.1 Khái niệm về VGA36 3.1.1 Nguyên lý hoạt động của màn hình. 36 3.1.1.1 Lý thuyết về điểm ảnh. 36 3.1.1.2 Các màu cơ bản. 37 3.1.1.3 Nguyên lý truyền hình cơ bản. 38 3.1.1.4 Các chỉ tiêu của màn hình. 41 3.1.2 VGA43 3.1.3 Các thông số kỹ thuật của VGA43 3.1.4 DB-15 Connector. 44 3.2 Sử dụng cổng VGA của Spartan-3E Kit45 3.2.1 Các chân tín hiệu. 45 3.2.2 Định thời tín hiệu cho chế độ hiển thị VGA 60Hz, 640x480. 47 3.3 Cổng chuột và bàn phím PS/2. 51 CHƯƠNG IV – THIẾT KẾ HỆ THỐNG56 4.1 Phân tích bài toán. 56 4.2 Hiển thị hình ảnh lên màn CRT qua cổng VGA56 4.3 Giao tiếp dữ liệu với bàn phím và mã hóa thành mã ASCII. 58 4.4 Các thành phần ROM và RAM . 73 4.4.1. SRAM . 73 4.4.2 ROM . 74 4.5 Thực thể ghép nối Top – Module. 89 Kết luận và nhận xét. 94 Tài liệu tham khảo. 95 . 54 Lời nói đầu Đất nước ta đang trong thời kỳ đổi mới, công nghiệp hoá, hiện đại hoá, với xu thế hội nhập kinh tế quốc tế. Sự phát triển của các doanh nghiệp, các ngành nghề là hết sức quan trọng, đóng vai trò tiên quyết cho sự vững b­ước đi lên của đất nư­ớc. Ngành Điện tử - Viễn Thông Việt Nam, một trong những ngành có vai trò quan trọng trong kết cấu hạ tầng cơ sở của nền kinh tế quốc dân cũng đang có sự đóng góp lớn lao cho sự lớn mạnh của nền kinh tế, ổn định chính trị và an ninh quốc phòng n­ước nhà. Bởi định hư­ớng đi tắt đón đầu của đất n­ước, công nghệ Điện tử nói chung và công nghệ FPGA nói riêng ngày càng lớn mạnh ở Việt Nam chúng ta. Tính linh động cao trong quá trình thiết kế cho phép FPGA giải quyết những bài toán phức tạp mà trước kia chỉ thực hiện nhờ phần mềm máy tính. Ngoài ra, nhờ mật độ cổng logic cao, FPGA được ứng dụng cho những bài toán đòi hỏi khối lượng tính toán lớn và dùng trong các hệ thống làm việc theo thời gian thực. Những ứng dụng trong thực tế của FPGA rất rộng rãi, bao gồm: Các hệ thống hàng không, vũ trụ, quốc phòng, tiền thiết kế mẫu ASIC (ASIC prototyping), các hệ thống điều khiển trực quan, phân tích nhận dạng ảnh, nhận dạng tiếng nói, mật mã học, mô hình phần cứng máy tính . Đặc biệt, với khả năng tái lập trình, người sử dụng có thể thay đổi lại thiết kế của mình chỉ trong vài giờ Nhờ những đặc điểm mạnh mẽ và ứng dụng thực tiễn của FPGA tôi đã chọn đề tài “Điều khiển tín hiệu bàn phím chuẩn PS2 và tín hiệu VGA dựa trên công nghệ FPGA ”. Tôi xin chân thành cảm ơn các thầy cô giáo đặc biệt là KS. Lê Đình Công đã tận tình hướng dẫn, giúp đỡ tôi, xin cảm ơn gia đình, bạn bè đã động viên để tôi có thể hoàn thành đồ án này một cách tốt đẹp.

doc95 trang | Chia sẻ: lvcdongnoi | Lượt xem: 3791 | Lượt tải: 5download
Bạn đang xem trước 20 trang tài liệu Đồ án Điều khiển tín hiệu bàn phím chuẩn PS2 và tín hiệu VGA dựa trên công nghệ FPGA, để xem tài liệu hoàn chỉnh bạn click vào nút DOWNLOAD ở trên
_ack; else m2_state <= m2_next_state; end if; end if; end process; m2_state_logic : process(m2_state, rx_output_strobe, rx_read) begin case (m2_state) is when m2_rx_data_ready_ack => rx_data_ready <= '0'; if (rx_output_strobe = '1') then m2_next_state <= m2_rx_data_ready; else m2_next_state <= m2_rx_data_ready_ack; end if; when m2_rx_data_ready => rx_data_ready <= '1'; if (rx_read = '1') then m2_next_state <= m2_rx_data_ready_ack; else m2_next_state <= m2_rx_data_ready; end if; when others => m2_next_state <= m2_rx_data_ready_ack; end case; end process; -- Bo dem bit bit_counter: process(clk, reset, m1_state, bit_count ) begin if clk'event and clk = '1' then if ( reset = '1' ) or ( rx_shifting_done = '1' ) or (m1_state = m1_tx_wait_keyboard_ack) then bit_count <= "0000"; elsif (timer_60usec_done = '1' ) and (m1_state = m1_rx_clk_h) and (ps2_clk_s = '1') then bit_count <= "0000"; elsif (m1_state = m1_rx_falling_edge_marker) or (m1_state = m1_tx_rising_edge_marker) then bit_count <= bit_count + 1; end if; end if; end process; assign: process( bit_count, tx_write, tx_write_ack_o, m1_state ) begin if (bit_count = TOTAL_BITS) then rx_shifting_done <= '1'; else rx_shifting_done <= '0'; end if; if (bit_count = (TOTAL_BITS-1)) then tx_shifting_done <= '1'; else tx_shifting_done <= '0'; end if; if ((tx_write = '1') and (m1_state = m1_rx_clk_h)) or ((tx_write = '1') and (m1_state = m1_rx_clk_l)) then tx_write_ack_o <= '1'; else tx_write_ack_o <= '0'; end if; tx_write_ack <= tx_write_ack_o; end process; -- Ma parity. tx_parity_bit <= not( tx_data(7) xor tx_data(6) xor tx_data(5) xor tx_data(4) xor tx_data(7) xor tx_data(6) xor tx_data(5) xor tx_data(4) ); -- Thanh ghi dich q_shift : process(clk, tx_write_ack_o, tx_parity_bit, tx_data, m1_state, q, ps2_data_s, rx_shifting_done ) begin if clk'event and clk='1' then if (reset = '1') then q <= "00000000000"; elsif (tx_write_ack_o = '1') then q <= "1" & tx_parity_bit & tx_data & "0"; elsif ( (m1_state = m1_rx_falling_edge_marker) or (m1_state = m1_tx_rising_edge_marker) ) then q <= ps2_data_s & q((TOTAL_BITS-1) downto 1); end if; end if; if (q(8 downto 1) = EXTEND_CODE) and (rx_shifting_done = '1') then extended <= '1'; else extended <= '0'; end if; if (q(8 downto 1) = RELEASE_CODE) and (rx_shifting_done = '1') then released <= '1'; else released <= '0'; end if; end process; timer60usec: process(clk, enable_timer_60usec, timer_60usec_count) begin if clk'event and clk = '1' then if (enable_timer_60usec = '0') then timer_60usec_count <= "0000000000"; elsif (timer_60usec_done = '0') then timer_60usec_count <= timer_60usec_count + 1; end if; end if; if (timer_60usec_count = (TIMER_60USEC_VALUE_PP - 1)) then timer_60usec_done <= '1'; else timer_60usec_done <= '0'; end if; end process; timer5usec : process(clk, enable_timer_5usec, timer_5usec_count ) begin if clk'event and clk = '1' then if (enable_timer_5usec = '0') then timer_5usec_count <= "000000"; elsif (timer_5usec_done = '0') then timer_5usec_count <= timer_5usec_count + 1; end if; end if; if( timer_5usec_count = (TIMER_5USEC_VALUE_PP - 1)) then timer_5usec_done <= '1'; else timer_5usec_done <= '0'; end if; end process; special_scan : process(clk, reset, rx_output_event, rx_shifting_done, extended, released ) begin if clk'event and clk='1' then if (reset = '1') or (rx_output_event = '1') then hold_extended <= '0'; hold_released <= '0'; else if (rx_shifting_done = '1') and (extended = '1') then hold_extended <= '1'; end if; if (rx_shifting_done = '1') and (released = '1') then hold_released <= '1'; end if; end if; end if; end process; left_shift_proc : process(clk, reset, q, rx_shifting_done, hold_released ) begin if clk'event and clk = '1' then if (reset = '1') then left_shift_key <= '0'; elsif (q(8 downto 1) = LEFT_SHIFT) and (rx_shifting_done = '1') and (hold_released = '0') then left_shift_key <= '1'; elsif (q(8 downto 1) = LEFT_SHIFT) and (rx_shifting_done = '1') and (hold_released = '1') then left_shift_key <= '0'; end if; end if; end process; right_shift_proc : process(clk, reset, q, rx_shifting_done, hold_released ) begin if clk'event and clk = '1' then if (reset = '1') then right_shift_key <= '0'; elsif (q(8 downto 1) = RIGHT_SHIFT) and (rx_shifting_done = '1') and (hold_released = '0') then right_shift_key <= '1'; elsif (q(8 downto 1) = RIGHT_SHIFT) and (rx_shifting_done = '1') and (hold_released = '1') then right_shift_key <= '0'; end if; end if; end process; shift_key_on <= left_shift_key or right_shift_key; rx_shift_key_on <= shift_key_on; special_scan_proc : process(clk, reset, hold_extended, hold_released, q, ascii ) begin if clk'event and clk = '1' then if (reset = '1') then rx_extended <= '0'; rx_released <= '0'; rx_ascii <= "00000000"; elsif (rx_output_strobe = '1') then rx_extended <= hold_extended; rx_released <= hold_released; rx_ascii <= ascii; end if; end if; end process; rx_output_proc : process( rx_shifting_done, extended, released, q ) begin if (rx_shifting_done = '1') and (extended = '0') and (released = '0') then rx_output_event <= '1'; else rx_output_event <= '0'; end if; if (rx_shifting_done = '1') and (extended = '0') and (released = '0') and ( (TRAP_SHIFT_KEYS_PP = 0) or ( (q(8 downto 1) /= RIGHT_SHIFT) and (q(8 downto 1) /= LEFT_SHIFT) ) )then rx_output_strobe <= '1'; else rx_output_strobe <= '0'; end if; end process; -- Chuyen doi sang ma ASCII -- Sap xep theo thu tu tang dan cua ma ASCII shift_key_plus_code <= "000" & shift_key_on & q(8 downto 1); shift_map : process( shift_key_plus_code ) begin case (shift_key_plus_code) is when x"066" => ascii <= x"08"; -- Backspace when x"166" => ascii <= x"08"; -- Backspace when x"00d" => ascii <= x"09"; -- Horizontal Tab when x"10d" => ascii <= x"09"; -- Horizontal Tab when x"05a" => ascii <= x"0d"; -- Carriage return ("enter" key) when x"15a" => ascii <= x"0d"; -- Carriage return ("enter" key) when x"076" => ascii <= x"1b"; -- Escape ("esc" key) when x"176" => ascii <= x"1b"; -- Escape ("esc" key) when x"029" => ascii <= x"20"; -- Space when x"129" => ascii <= x"20"; -- Space when x"116" => ascii <= x"21"; -- ! when x"152" => ascii <= x"22"; -- " when x"126" => ascii <= x"23"; -- # when x"125" => ascii <= x"24"; -- $ when x"12e" => ascii <= x"25"; -- % when x"13d" => ascii <= x"26"; -- & when x"052" => ascii <= x"27"; -- ' when x"146" => ascii <= x"28"; -- ( when x"145" => ascii <= x"29"; -- ) when x"13e" => ascii <= x"2a"; -- * when x"155" => ascii <= x"2b"; -- + when x"041" => ascii <= x"2c"; -- , when x"04e" => ascii <= x"2d"; -- - when x"049" => ascii <= x"2e"; -- . when x"04a" => ascii <= x"2f"; -- / when x"045" => ascii <= x"30"; -- 0 when x"016" => ascii <= x"31"; -- 1 when x"01e" => ascii <= x"32"; -- 2 when x"026" => ascii <= x"33"; -- 3 when x"025" => ascii <= x"34"; -- 4 when x"02e" => ascii <= x"35"; -- 5 when x"036" => ascii <= x"36"; -- 6 when x"03d" => ascii <= x"37"; -- 7 when x"03e" => ascii <= x"38"; -- 8 when x"046" => ascii <= x"39"; -- 9 when x"14c" => ascii <= x"3a"; -- : when x"04c" => ascii <= x"3b"; -- ; when x"141" => ascii <= x"3c"; -- < when x"055" => ascii <= x"3d"; -- = when x"149" => ascii when x"14a" => ascii <= x"3f"; -- ? when x"11e" => ascii <= x"40"; -- @ when x"11c" => ascii <= x"41"; -- A when x"132" => ascii <= x"42"; -- B when x"121" => ascii <= x"43"; -- C when x"123" => ascii <= x"44"; -- D when x"124" => ascii <= x"45"; -- E when x"12b" => ascii <= x"46"; -- F when x"134" => ascii <= x"47"; -- G when x"133" => ascii <= x"48"; -- H when x"143" => ascii <= x"49"; -- I when x"13b" => ascii <= x"4a"; -- J when x"142" => ascii <= x"4b"; -- K when x"14b" => ascii <= x"4c"; -- L when x"13a" => ascii <= x"4d"; -- M when x"131" => ascii <= x"4e"; -- N when x"144" => ascii <= x"4f"; -- O when x"14d" => ascii <= x"50"; -- P when x"115" => ascii <= x"51"; -- Q when x"12d" => ascii <= x"52"; -- R when x"11b" => ascii <= x"53"; -- S when x"12c" => ascii <= x"54"; -- T when x"13c" => ascii <= x"55"; -- U when x"12a" => ascii <= x"56"; -- V when x"11d" => ascii <= x"57"; -- W when x"122" => ascii <= x"58"; -- X when x"135" => ascii <= x"59"; -- Y when x"11a" => ascii <= x"5a"; -- Z when x"054" => ascii <= x"5b"; -- [ when x"05d" => ascii <= x"5c"; -- \ when x"05b" => ascii <= x"5d"; -- ] when x"136" => ascii <= x"5e"; -- ^ when x"14e" => ascii <= x"5f"; -- _ when x"00e" => ascii <= x"60"; -- ` when x"01c" => ascii <= x"61"; -- a when x"032" => ascii <= x"62"; -- b when x"021" => ascii <= x"63"; -- c when x"023" => ascii <= x"64"; -- d when x"024" => ascii <= x"65"; -- e when x"02b" => ascii <= x"66"; -- f when x"034" => ascii <= x"67"; -- g when x"033" => ascii <= x"68"; -- h when x"043" => ascii <= x"69"; -- i when x"03b" => ascii <= x"6a"; -- j when x"042" => ascii <= x"6b"; -- k when x"04b" => ascii <= x"6c"; -- l when x"03a" => ascii <= x"6d"; -- m when x"031" => ascii <= x"6e"; -- n when x"044" => ascii <= x"6f"; -- o when x"04d" => ascii <= x"70"; -- p when x"015" => ascii <= x"71"; -- q when x"02d" => ascii <= x"72"; -- r when x"01b" => ascii <= x"73"; -- s when x"02c" => ascii <= x"74"; -- t when x"03c" => ascii <= x"75"; -- u when x"02a" => ascii <= x"76"; -- v when x"01d" => ascii <= x"77"; -- w when x"022" => ascii <= x"78"; -- x when x"035" => ascii <= x"79"; -- y when x"01a" => ascii <= x"7a"; -- z when x"154" => ascii <= x"7b"; -- { when x"15d" => ascii <= x"7c"; -- | when x"15b" => ascii <= x"7d"; -- } when x"10e" => ascii <= x"7e"; -- ~ when x"071" => ascii <= x"7f"; -- (Delete hoac DEL) when x"171" => ascii <= x"7f"; -- (Delete hoac DEL) when others => ascii <= x"2e"; -- '.' end case; end process; end Behavioral; 4.4 Các thành phần ROM và RAM 4.4.1. SRAM Sử dụng SRAM làm bộ nhớ lưu trữ những mã ASCII các ký tự đã nhập từ bàn phím. SRAM được xây dựng từ bộ CORE Generator của Xilink : Hình 4.1 Xây dựng SRAM từ CORE Generator Các thông số tạo SRAM như hình : Hình 4.2 Thông số khởi tạo SRAM Kiến trúc VHDL của RAM đã được bộ tạo Core xử lý theo các thông số đầu vào, việc sử dụng chỉ là gán chân và điều khiển địa chỉ để đọc và ghi RAM. 4.4.2 ROM Bộ nhớ ROM lưu trữ các ảnh 8 x 8 bits ảnh của một ký tự tương ứng với mã ASCII. ROM được sử dụng để nhập vào là mã ASCII và xuất ra là ma trận ảnh ký tự tương ứng. Trong kiến trúc ROM, địa chỉ lấy dữ liệu được mã hóa cho mỗi ký tự là 8 dòng địa chỉ bằng công thức “Mã ASCII”XXX, trong đó XXX là 3 bit dùng để đếm từ “000” đến “111” Sau đây là kiến trúc thực thể Char_ROM : File : Char_ROM.vhd LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.all; USE IEEE.STD_LOGIC_ARITH.all; USE IEEE.STD_LOGIC_UNSIGNED.all; ENTITY Char_ROM IS PORT( character_address : IN STD_LOGIC_VECTOR(7 DOWNTO 0); font_row, font_col : IN STD_LOGIC_VECTOR(2 DOWNTO 0); rom_mux_output : OUT STD_LOGIC ); END Char_ROM; ARCHITECTURE a OF Char_ROM IS SIGNAL rom_data : STD_LOGIC_VECTOR(7 DOWNTO 0); SIGNAL rom_address : STD_LOGIC_VECTOR(10 DOWNTO 0); BEGIN With rom_address select --@ rom_data <= "00111100" when "01000000000", "01100110" when "01000000001", "01101110" when "01000000010", "01101110" when "01000000011", "01100000" when "01000000100", "01100010" when "01000000101", "00111100" when "01000000110", "00000000" when "01000000111", --A "00011000" when "01000001000", "00111100" when "01000001001", "01100110" when "01000001010", "01111110" when "01000001011", "01100110" when "01000001100", "01100110" when "01000001101", "01100110" when "01000001110", "00000000" when "01000001111", --B "01111100" when "01000010000", "01100110" when "01000010001", "01100110" when "01000010010", "01111100" when "01000010011", "01100110" when "01000010100", "01100110" when "01000010101", "01111100" when "01000010110", "00000000" when "01000010111", --C "00111100" when "01000011000", "01100110" when "01000011001", "01100000" when "01000011010", "01100000" when "01000011011", "01100000" when "01000011100", "01100110" when "01000011101", "00111100" when "01000011110", "00000000" when "01000011111", --D "01111000" when "01000100000", "01101100" when "01000100001", "01100110" when "01000100010", "01100110" when "01000100011", "01100110" when "01000100100", "01101100" when "01000100101", "01111000" when "01000100110", "00000000" when "01000100111", --E "01111110" when "01000101000", "01100000" when "01000101001", "01100000" when "01000101010", "01111000" when "01000101011", "01100000" when "01000101100", "01100000" when "01000101101", "01111110" when "01000101110", "00000000" when "01000101111", --F "01111110" when "01000110000",--0 "01100000" when "01000110001",--1 "01100000" when "01000110010",--2 "01111000" when "01000110011",--3 "01100000" when "01000110100",--4 "01100000" when "01000110101",--5 "01100000" when "01000110110",--6 "00000000" when "01000110111",--7 --G "00111100" when "01000111000",--0 "01100110" when "01000111001",--1 "01100000" when "01000111010",--2 "01101110" when "01000111011",--3 "01100110" when "01000111100",--4 "01100110" when "01000111101",--5 "00111100" when "01000111110",--6 "00000000" when "01000111111",--7 --H "01100110" when "01001000000",--0 "01100110" when "01001000001",--1 "01100110" when "01001000010",--2 "01111110" when "01001000011",--3 "01100110" when "01001000100",--4 "01100110" when "01001000101",--5 "01100110" when "01001000110",--6 "00000000" when "01001000111",--7 --I "00111100" when "01001001000",--0 "00011000" when "01001001001",--1 "00011000" when "01001001010",--2 "00011000" when "01001001011",--3 "00011000" when "01001001100",--4 "00011000" when "01001001101",--5 "00111100" when "01001001110",--6 "00000000" when "01001001111",--7 --J "00011110" when "01001010000",--0 "00001100" when "01001010001",--1 "00001100" when "01001010010",--2 "00001100" when "01001010011",--3 "00001100" when "01001010100",--4 "01101100" when "01001010101",--5 "00111000" when "01001010110",--6 "00000000" when "01001010111",--7 --K "01100110" when "01001011000",--0 "01101100" when "01001011001",--1 "01111000" when "01001011010",--2 "01110000" when "01001011011",--3 "01111000" when "01001011100",--4 "01101100" when "01001011101",--5 "01100110" when "01001011110",--6 "00000000" when "01001011111",--7 --L "01100000" when "01001100000",--0 "01100000" when "01001100001",--1 "01100000" when "01001100010",--2 "01100000" when "01001100011",--3 "01100000" when "01001100100",--4 "01100000" when "01001100101",--5 "01111110" when "01001100110",--6 "00000000" when "01001100111",--7 --M "01100011" when "01001101000",--0 "01110111" when "01001101001",--1 "01111111" when "01001101010",--2 "01101011" when "01001101011",--3 "01100011" when "01001101100",--4 "01100011" when "01001101101",--5 "01100011" when "01001101110",--6 "00000000" when "01001101111",--7 --N "01100110" when "01001110000",--0 "01100110" when "01001110001",--1 "01111110" when "01001110010",--2 "01111110" when "01001110011",--3 "01101110" when "01001110100",--4 "01100110" when "01001110101",--5 "01100110" when "01001110110",--6 "00000000" when "01001110111",--7 --O "00111100" when "01001111000",--0 "01100110" when "01001111001",--1 "01100110" when "01001111010",--2 "01100110" when "01001111011",--3 "01100110" when "01001111100",--4 "01100110" when "01001111101",--5 "00111100" when "01001111110",--6 "00000000" when "01001111111",--7 --P "01111100" when "01010000000",--0 "01100110" when "01010000001",--1 "01100110" when "01010000010",--2 "01111100" when "01010000011",--3 "01100000" when "01010000100",--4 "01100000" when "01010000101",--5 "01100000" when "01010000110",--6 "00000000" when "01010000111",--7 --Q "00111100" when "01010001000",--0 "01100110" when "01010001001",--1 "01100110" when "01010001010",--2 "01100110" when "01010001011",--3 "01100110" when "01010001100",--4 "00111100" when "01010001101",--5 "00001110" when "01010001110",--6 "00000000" when "01010001111",--7 --R "01111100" when "01010010000",--0 "01100110" when "01010010001",--1 "01100110" when "01010010010",--2 "01111100" when "01010010011",--3 "01111000" when "01010010100",--4 "01101100" when "01010010101",--5 "01100110" when "01010010110",--6 "00000000" when "01010010111",--7 --S "00111100" when "01010011000",--0 "01100110" when "01010011001",--1 "01100000" when "01010011010",--2 "00111100" when "01010011011",--3 "00000110" when "01010011100",--4 "01100110" when "01010011101",--5 "00111100" when "01010011110",--6 "00000000" when "01010011111",--7 --T "01111110" when "01010100000",--0 "00011000" when "01010100001",--1 "00011000" when "01010100010",--2 "00011000" when "01010100011",--3 "00011000" when "01010100100",--4 "00011000" when "01010100101",--5 "00011000" when "01010100110",--6 "00000000" when "01010100111",--7 --U "01100110" when "01010101000",--0 "01100110" when "01010101001",--1 "01100110" when "01010101010",--2 "01100110" when "01010101011",--3 "01100110" when "01010101100",--4 "01100110" when "01010101101",--5 "00111100" when "01010101110",--6 "00000000" when "01010101111",--7 --V "01100110" when "01010110000",--0 "01100110" when "01010110001",--1 "01100110" when "01010110010",--2 "01100110" when "01010110011",--3 "01100110" when "01010110100",--4 "00111100" when "01010110101",--5 "00011000" when "01010110110",--6 "00000000" when "01010110111",--7 --W "01100011" when "01010111000",--0 "01100011" when "01010111001",--1 "01100011" when "01010111010",--2 "01101011" when "01010111011",--3 "01111111" when "01010111100",--4 "01110111" when "01010111101",--5 "01100011" when "01010111110",--6 "00000000" when "01010111111",--7 --X "01100110" when "01011000000",--0 "01100110" when "01011000001",--1 "00111100" when "01011000010",--2 "00011000" when "01011000011",--3 "00111100" when "01011000100",--4 "01100110" when "01011000101",--5 "01100110" when "01011000110",--6 "00000000" when "01011000111",--7 --Y "01100110" when "01011001000",--0 "01100110" when "01011001001",--1 "01100110" when "01011001010",--2 "00111100" when "01011001011",--3 "00011000" when "01011001100",--4 "00011000" when "01011001101",--5 "00011000" when "01011001110",--6 "00000000" when "01011001111",--7 --Z "01111110" when "01011010000",--0 "00000110" when "01011010001",--1 "00001100" when "01011010010",--2 "00011000" when "01011010011",--3 "00110000" when "01011010100",--4 "01100000" when "01011010101",--5 "01111110" when "01011010110",--6 "00000000" when "01011010111",--7 --[ "00111100" when "01011011000",--0 "00110000" when "01011011001",--1 "00110000" when "01011011010",--2 "00110000" when "01011011011",--3 "00110000" when "01011011100",--4 "00110000" when "01011011101",--5 "00111100" when "01011011110",--6 "00000000" when "01011011111",--7 --\-- "00000000" when "01011100000",--0 "11000000" when "01011100001",--1 "01100000" when "01011100010",--2 "00110000" when "01011100011",--3 "00011000" when "01011100100",--4 "00001100" when "01011100101",--5 "00000110" when "01011100110",--6 "00000000" when "01011100111",--7 --] "00111100" when "01011101000",--0 "00001100" when "01011101001",--1 "00001100" when "01011101010",--2 "00001100" when "01011101011",--3 "00001100" when "01011101100",--4 "00001100" when "01011101101",--5 "00111100" when "01011101110",--6 "00000000" when "01011101111",--7 --^ "00000000" when "01011110000",--0 "00011000" when "01011110001",--1 "00111100" when "01011110010",--2 "01100110" when "01011110011",--3 "00000000" when "01011110100",--4 "00000000" when "01011110101",--5 "00000000" when "01011110110",--6 "00000000" when "01011110111",--7 --_ "00000000" when "01011111000",--0 "00000000" when "01011111001",--1 "00000000" when "01011111010",--2 "00000000" when "01011111011",--3 "00000000" when "01011111100",--4 "00000000" when "01011111101",--5 "01111110" when "01011111110",--6 "00000000" when "01011111111",--7 --SPACE "00000000" when "00100000000",--0 "00000000" when "00100000001",--1 "00000000" when "00100000010",--2 "00000000" when "00100000011",--3 "00000000" when "00100000100",--4 "00000000" when "00100000101",--5 "00000000" when "00100000110",--6 "00000000" when "00100000111",--7 --! "00011000" when "00100001000",--0 "00011000" when "00100001001",--1 "00011000" when "00100001010",--2 "00011000" when "00100001011",--3 "00000000" when "00100001100",--4 "00000000" when "00100001101",--5 "00011000" when "00100001110",--6 "00000000" when "00100001111",--7 --" "01100110" when "00100010000",--0 "01100110" when "00100010001",--1 "01100110" when "00100010010",--2 "00000000" when "00100010011",--3 "00000000" when "00100010100",--4 "00000000" when "00100010101",--5 "00000000" when "00100010110",--6 "00000000" when "00100010111",--7 --# "01100110" when "00100011000",--0 "01100110" when "00100011001",--1 "11111111" when "00100011010",--2 "01100110" when "00100011011",--3 "11111111" when "00100011100",--4 "01100110" when "00100011101",--5 "01100110" when "00100011110",--6 "00000000" when "00100011111",--7 --$ "00011000" when "00100100000",--0 "00111110" when "00100100001",--1 "01100000" when "00100100010",--2 "00111100" when "00100100011",--3 "00000110" when "00100100100",--4 "01111100" when "00100100101",--5 "00011000" when "00100100110",--6 "00000000" when "00100100111",--7 --% "01100010" when "00100101000",--0 "01100110" when "00100101001",--1 "00001100" when "00100101010",--2 "00011000" when "00100101011",--3 "00110000" when "00100101100",--4 "01100110" when "00100101101",--5 "01000110" when "00100101110",--6 "00000000" when "00100101111",--7 --& "00111100" when "00100110000",--0 "01100110" when "00100110001",--1 "00111100" when "00100110010",--2 "00111000" when "00100110011",--3 "01100111" when "00100110100",--4 "01100110" when "00100110101",--5 "00111111" when "00100110110",--6 "00000000" when "00100110111",--7 --' "00000110" when "00100111000",--0 "00001100" when "00100111001",--1 "00011000" when "00100111010",--2 "00000000" when "00100111011",--3 "00000000" when "00100111100",--4 "00000000" when "00100111101",--5 "00000000" when "00100111110",--6 "00000000" when "00100111111",--7 --( "00001100" when "00101000000",--0 "00011000" when "00101000001",--1 "00110000" when "00101000010",--2 "00110000" when "00101000011",--3 "00110000" when "00101000100",--4 "00011000" when "00101000101",--5 "00001100" when "00101000110",--6 "00000000" when "00101000111",--7 --) "00110000" when "00101001000",--0 "00011000" when "00101001001",--1 "00001100" when "00101001010",--2 "00001100" when "00101001011",--3 "00001100" when "00101001100",--4 "00011000" when "00101001101",--5 "00110000" when "00101001110",--6 "00000000" when "00101001111",--7 --* "00000000" when "00101010000",--0 "01100110" when "00101010001",--1 "00111100" when "00101010010",--2 "11111111" when "00101010011",--3 "00111100" when "00101010100",--4 "01100110" when "00101010101",--5 "00000000" when "00101010110",--6 "00000000" when "00101010111",--7 --+ "00000000" when "00101011000",--0 "00011000" when "00101011001",--1 "00011000" when "00101011010",--2 "01111110" when "00101011011",--3 "00011000" when "00101011100",--4 "00011000" when "00101011101",--5 "00000000" when "00101011110",--6 "00000000" when "00101011111",--7 --, "00000000" when "00101100000",--0 "00000000" when "00101100001",--1 "00000000" when "00101100010",--2 "00000000" when "00101100011",--3 "00000000" when "00101100100",--4 "00011000" when "00101100101",--5 "00011000" when "00101100110",--6 "00110000" when "00101100111",--7 --- "00000000" when "00101101000",--0 "00000000" when "00101101001",--1 "00000000" when "00101101010",--2 "01111110" when "00101101011",--3 "00000000" when "00101101100",--4 "00000000" when "00101101101",--5 "00000000" when "00101101110",--6 "00000000" when "00101101111",--7 --. "00000000" when "00101110000",--0 "00000000" when "00101110001",--1 "00000000" when "00101110010",--2 "00000000" when "00101110011",--3 "00000000" when "00101110100",--4 "00000000" when "00101110101",--5 "00011000" when "00101110110",--6 "00000000" when "00101110111",--7 --/ "00000000" when "00101111000",--0 "00000011" when "00101111001",--1 "00000110" when "00101111010",--2 "00001100" when "00101111011",--3 "00011000" when "00101111100",--4 "00110000" when "00101111101",--5 "01100000" when "00101111110",--6 "00000000" when "00101111111",--7 --0 "00111100" when "00110000000",--0 "01100110" when "00110000001",--1 "01101110" when "00110000010",--2 "01110110" when "00110000011",--3 "01100110" when "00110000100",--4 "01100110" when "00110000101",--5 "00111100" when "00110000110",--6 "00000000" when "00110000111",--7 --1 "00011000" when "00110001000",--0 "00011000" when "00110001001",--1 "00111000" when "00110001010",--2 "00011000" when "00110001011",--3 "00011000" when "00110001100",--4 "00011000" when "00110001101",--5 "01111110" when "00110001110",--6 "00000000" when "00110001111",--7 --2 "00111100" when "00110010000",--0 "01100110" when "00110010001",--1 "00000110" when "00110010010",--2 "00001100" when "00110010011",--3 "00110000" when "00110010100",--4 "01100000" when "00110010101",--5 "01111110" when "00110010110",--6 "00000000" when "00110010111",--7 --3 "00111100" when "00110011000",--0 "01100110" when "00110011001",--1 "00000110" when "00110011010",--2 "00011100" when "00110011011",--3 "00000110" when "00110011100",--4 "01100110" when "00110011101",--5 "00111100" when "00110011110",--6 "00000000" when "00110011111",--7 --4 "00000110" when "00110100000",--0 "00001110" when "00110100001",--1 "00011110" when "00110100010",--2 "01100110" when "00110100011",--3 "01111111" when "00110100100",--4 "00000110" when "00110100101",--5 "00000110" when "00110100110",--6 "00000000" when "00110100111",--7 --5 "01111110" when "00110101000",--0 "01100000" when "00110101001",--1 "01111100" when "00110101010",--2 "00000110" when "00110101011",--3 "00000110" when "00110101100",--4 "01100110" when "00110101101",--5 "00111100" when "00110101110",--6 "00000000" when "00110101111",--7 --6 "00111100" when "00110110000",--0 "01100110" when "00110110001",--1 "01100000" when "00110110010",--2 "01111100" when "00110110011",--3 "01100110" when "00110110100",--4 "01100110" when "00110110101",--5 "00111100" when "00110110110",--6 "00000000" when "00110110111",--7 --7 "01111110" when "00110111000",--0 "01100110" when "00110111001",--1 "00001100" when "00110111010",--2 "00011000" when "00110111011",--3 "00011000" when "00110111100",--4 "00011000" when "00110111101",--5 "00011000" when "00110111110",--6 "00000000" when "00110111111",--7 --8 "00111100" when "00111000000",--0 "01100110" when "00111000001",--1 "01100110" when "00111000010",--2 "00111100" when "00111000011",--3 "01100110" when "00111000100",--4 "01100110" when "00111000101",--5 "00111100" when "00111000110",--6 "00000000" when "00111000111",--7 --9 "00111100" when "00111001000",--0 "01100110" when "00111001001",--1 "01100110" when "00111001010",--2 "00111110" when "00111001011",--3 "00000110" when "00111001100",--4 "01100110" when "00111001101",--5 "00111100" when "00111001110",--6 "00000000" when "00111001111",--7 --: "00000000" when "00111010000",--0 "00000000" when "00111010001",--1 "01100000" when "00111010010",--2 "01100000" when "00111010011",--3 "00000000" when "00111010100",--4 "01100000" when "00111010101",--5 "01100000" when "00111010110",--6 "00000000" when "00111010111",--7 --; "00000000" when "00111011000",--0 "00000000" when "00111011001",--1 "01100000" when "00111011010",--2 "01100000" when "00111011011",--3 "00000000" when "00111011100",--4 "01100000" when "00111011101",--5 "01100000" when "00111011110",--6 "11000000" when "00111011111",--7 --< "00000000" when "00111100000",--0 "00000110" when "00111100001",--1 "00011000" when "00111100010",--2 "01100000" when "00111100011",--3 "00011000" when "00111100100",--4 "00000110" when "00111100101",--5 "00000000" when "00111100110",--6 "00000000" when "00111100111",--7 --= "00000000" when "00111101000",--0 "00000000" when "00111101001",--1 "01111110" when "00111101010",--2 "00000000" when "00111101011",--3 "01111110" when "00111101100",--4 "00000000" when "00111101101",--5 "00000000" when "00111101110",--6 "00000000" when "00111101111",--7 --> "00000000" when "00111110000",--0 "01100000" when "00111110001",--1 "00011000" when "00111110010",--2 "00000110" when "00111110011",--3 "00011000" when "00111110100",--4 "01100000" when "00111110101",--5 "00000000" when "00111110110",--6 "00000000" when "00111110111",--7 --? "00111100" when "00111111000",--0 "11000110" when "00111111001",--1 "00000110" when "00111111010",--2 "00001100" when "00111111011",--3 "00011000" when "00111111100",--4 "00000000" when "00111111101",--5 "00011000" when "00111111110",--6 "00000000" when "00111111111",--7 --` "01100000" when "01100000000", "00110000" when "01100000001", "00011000" when "01100000010", "00000000" when "01100000011", "00000000" when "01100000100", "00000000" when "01100000101", "00000000" when "01100000110", "00000000" when "01100000111", --a "00000000" when "01100001000", "00000000" when "01100001001", "00111100" when "01100001010", "00000110" when "01100001011", "00111110" when "01100001100", "01100110" when "01100001101", "00111110" when "01100001110", "00000000" when "01100001111", --b "01100000" when "01100010000", "01100000" when "01100010001", "01111100" when "01100010010", "01100110" when "01100010011", "01100110" when "01100010100", "01100110" when "01100010101", "01111100" when "01100010110", "00000000" when "01100010111", --c "00000000" when "01100011000", "00000000" when "01100011001", "00111100" when "01100011010", "01100110" when "01100011011", "01100000" when "01100011100", "01100110" when "01100011101", "00111100" when "01100011110", "00000000" when "01100011111", --d "00000110" when "01100100000", "00000110" when "01100100001", "00111110" when "01100100010", "01100110" when "01100100011", "01100110" when "01100100100", "01100110" when "01100100101", "00111110" when "01100100110", "00000000" when "01100100111", --e "00000000" when "01100101000", "00000000" when "01100101001", "00111100" when "01100101010", "01100110" when "01100101011", "01111110" when "01100101100", "01100000" when "01100101101", "00111110" when "01100101110", "00000000" when "01100101111", --f "00011100" when "01100110000",--0 "00110000" when "01100110001",--1 "00110000" when "01100110010",--2 "01111100" when "01100110011",--3 "00110000" when "01100110100",--4 "00110000" when "01100110101",--5 "00110000" when "01100110110",--6 "00000000" when "01100110111",--7 --g "00000000" when "01100111000",--0 "00000000" when "01100111001",--1 "00111110" when "01100111010",--2 "01100110" when "01100111011",--3 "01100110" when "01100111100",--4 "00111110" when "01100111101",--5 "00000110" when "01100111110",--6 "01111100" when "01100111111",--7 --h "01100000" when "01101000000",--0 "01100000" when "01101000001",--1 "01111100" when "01101000010",--2 "01100110" when "01101000011",--3 "01100110" when "01101000100",--4 "01100110" when "01101000101",--5 "01100110" when "01101000110",--6 "00000000" when "01101000111",--7 --i "00011000" when "01101001000",--0 "00000000" when "01101001001",--1 "00011000" when "01101001010",--2 "00011000" when "01101001011",--3 "00011000" when "01101001100",--4 "00011000" when "01101001101",--5 "00011000" when "01101001110",--6 "00000000" when "01101001111",--7 --j "00001100" when "01101010000",--0 "00000000" when "01101010001",--1 "00001100" when "01101010010",--2 "00001100" when "01101010011",--3 "00001100" when "01101010100",--4 "00001100" when "01101010101",--5 "01101100" when "01101010110",--6 "00111000" when "01101010111",--7 --k "01100000" when "01101011000",--0 "01100000" when "01101011001",--1 "01100110" when "01101011010",--2 "01101100" when "01101011011",--3 "01111000" when "01101011100",--4 "01101100" when "01101011101",--5 "01100110" when "01101011110",--6 "00000000" when "01101011111",--7 --l "00111000" when "01101100000",--0 "00011000" when "01101100001",--1 "00011000" when "01101100010",--2 "00011000" when "01101100011",--3 "00011000" when "01101100100",--4 "00011000" when "01101100101",--5 "00111100" when "01101100110",--6 "00000000" when "01101100111",--7 --m "00000000" when "01101101000",--0 "00000000" when "01101101001",--1 "11110110" when "01101101010",--2 "11011011" when "01101101011",--3 "11011011" when "01101101100",--4 "11011011" when "01101101101",--5 "11011011" when "01101101110",--6 "00000000" when "01101101111",--7 --n "00000000" when "01101110000",--0 "00000000" when "01101110001",--1 "01111100" when "01101110010",--2 "01100110" when "01101110011",--3 "01100110" when "01101110100",--4 "01100110" when "01101110101",--5 "01100110" when "01101110110",--6 "00000000" when "01101110111",--7 --o "00000000" when "01101111000",--0 "00000000" when "01101111001",--1 "00111100" when "01101111010",--2 "01100110" when "01101111011",--3 "01100110" when "01101111100",--4 "01100110" when "01101111101",--5 "00111100" when "01101111110",--6 "00000000" when "01101111111",--7 --p "00000000" when "01110000000",--0 "00000000" when "01110000001",--1 "01111100" when "01110000010",--2 "01100110" when "01110000011",--3 "01100110" when "01110000100",--4 "01111100" when "01110000101",--5 "01100000" when "01110000110",--6 "01100000" when "01110000111",--7 --q "00000000" when "01110001000",--0 "00000000" when "01110001001",--1 "00111110" when "01110001010",--2 "01100110" when "01110001011",--3 "01100110" when "01110001100",--4 "00111110" when "01110001101",--5 "00000110" when "01110001110",--6 "00000110" when "01110001111",--7 --r "00000000" when "01110010000",--0 "00000000" when "01110010001",--1 "01101100" when "01110010010",--2 "01111000" when "01110010011",--3 "01100000" when "01110010100",--4 "01100000" when "01110010101",--5 "01100000" when "01110010110",--6 "00000000" when "01110010111",--7 --s "00000000" when "01110011000",--0 "00000000" when "01110011001",--1 "00111110" when "01110011010",--2 "01100000" when "01110011011",--3 "00111100" when "01110011100",--4 "00000110" when "01110011101",--5 "01111100" when "01110011110",--6 "00000000" when "01110011111",--7 --t "00000000" when "01110100000",--0 "00110000" when "01110100001",--1 "01111100" when "01110100010",--2 "00110000" when "01110100011",--3 "00110000" when "01110100100",--4 "00110000" when "01110100101",--5 "00011100" when "01110100110",--6 "00000000" when "01110100111",--7 --u "00000000" when "01110101000",--0 "00000000" when "01110101001",--1 "01100110" when "01110101010",--2 "01100110" when "01110101011",--3 "01100110" when "01110101100",--4 "01100110" when "01110101101",--5 "00111110" when "01110101110",--6 "00000000" when "01110101111",--7 --v "00000000" when "01110110000",--0 "00000000" when "01110110001",--1 "01100110" when "01110110010",--2 "01100110" when "01110110011",--3 "01100110" when "01110110100",--4 "00111100" when "01110110101",--5 "00011000" when "01110110110",--6 "00000000" when "01110110111",--7 --w "00000000" when "01110111000",--0 "00000000" when "01110111001",--1 "11000011" when "01110111010",--2 "11000011" when "01110111011",--3 "11011011" when "01110111100",--4 "11011011" when "01110111101",--5 "01100110" when "01110111110",--6 "00000000" when "01110111111",--7 --x "00000000" when "01111000000",--0 "00000000" when "01111000001",--1 "01100110" when "01111000010",--2 "00011000" when "01111000011",--3 "00011000" when "01111000100",--4 "00011000" when "01111000101",--5 "01100110" when "01111000110",--6 "00000000" when "01111000111",--7 --y "00000000" when "01111001000",--0 "00000000" when "01111001001",--1 "01100110" when "01111001010",--2 "01100110" when "01111001011",--3 "01100110" when "01111001100",--4 "00111110" when "01111001101",--5 "00000110" when "01111001110",--6 "00111100" when "01111001111",--7 --z "00000000" when "01111010000",--0 "00000000" when "01111010001",--1 "01111110" when "01111010010",--2 "00001100" when "01111010011",--3 "00011000" when "01111010100",--4 "00110000" when "01111010101",--5 "01111110" when "01111010110",--6 "00000000" when "01111010111",--7 --{ "00011000" when "01111011000",--0 "00110000" when "01111011001",--1 "00110000" when "01111011010",--2 "01110000" when "01111011011",--3 "00110000" when "01111011100",--4 "00110000" when "01111011101",--5 "00011000" when "01111011110",--6 "00000000" when "01111011111",--7 --| "00011000" when "01111100000",--0 "00011000" when "01111100001",--1 "00011000" when "01111100010",--2 "00011000" when "01111100011",--3 "00011000" when "01111100100",--4 "00011000" when "01111100101",--5 "00011000" when "01111100110",--6 "00000000" when "01111100111",--7 --} "00011000" when "01111101000",--0 "00001100" when "01111101001",--1 "00001100" when "01111101010",--2 "00001110" when "01111101011",--3 "00001100" when "01111101100",--4 "00001100" when "01111101101",--5 "00011000" when "01111101110",--6 "00000000" when "01111101111",--7 --~ "00000000" when "01111110000",--0 "00000000" when "01111110001",--1 "01110000" when "01111110010",--2 "11011011" when "01111110011",--3 "00001110" when "01111110100",--4 "00000000" when "01111110101",--5 "00000000" when "01111110110",--6 "00000000" when "01111110111",--7 -- "00000000" when others; rom_address <= character_address & font_row; rom_mux_output <= rom_data ( (CONV_INTEGER(NOT font_col(2 DOWNTO 0)))); END a; 4.5 Thực thể ghép nối Top – Module Đây là thực thể ghép nối tất cả các module thành phần. Trong kiến trúc thực thể có một process nhằm hiện lên trên màn CRT một màu nền khá ấn tượng. File : PS2toVGA.vhd LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.all; USE IEEE.STD_LOGIC_ARITH.all; USE IEEE.STD_LOGIC_UNSIGNED.all; entity hientextvga is port ( clock_50 : in std_logic; ps2_clk : inout std_logic; ps2_data : inout std_logic; reset : in std_logic; red,green,blue : out std_logic; h_sync,v_sync : out std_logic ); end hientextvga; architecture Behavioral of hientextvga is -----------------char_rom coponent------------------------------------------ component char_rom is port( character_address : in std_logic_vector(7 downto 0); font_row,font_col : in std_logic_vector(2 downto 0); rom_mux_output : out std_logic); end component; -----------------vga_sync component------------------------------------------- component vga_sync is port( clock_50mhz,mux : in std_logic; horiz_sync_out,vert_sync_out: out std_logic; pixel_row : out std_logic_vector(9 downto 0); pixel_column : out std_logic_vector(9 downto 0); sync,clock : out std_logic); end component; -----------------------char_value component------------------------------------ COMPONENT char_value is port (pixel_row, pixel_col : in std_logic_vector(9 downto 4); ram_data : in std_logic_vector(7 downto 0); ready : in std_logic; ram_add : out std_logic_vector(6 downto 0); WE,CE : out std_logic; char : out std_logic_vector(7 downto 0)); end component; -----------------------RAM component-------------------------------------------- COMPONENT SRAM IS port ( addr: IN std_logic_VECTOR(6 downto 0); clk: IN std_logic; din: IN std_logic_VECTOR(7 downto 0); dout: OUT std_logic_VECTOR(7 downto 0); en: IN std_logic; we: IN std_logic ); END component; ------------------------------------------------------------------------------- COMPONENT ps2_keyboard_interface IS port ( clk : in std_logic; reset : in std_logic; ps2_clk : inout std_logic; ps2_data : inout std_logic; rx_extended : out std_logic; rx_released : out std_logic; rx_shift_key_on : out std_logic; rx_ascii : out std_logic_vector(7 downto 0); rx_data_ready : out std_logic; rx_read : in std_logic; tx_data : in std_logic_vector(7 downto 0); tx_write : in std_logic; tx_write_ack : out std_logic; tx_error_no_keyboard_ack : out std_logic ); END component; --===================================================================== signal pixel_roww : std_logic_vector(9 downto 0); signal pixel_columnn : std_logic_vector(9 downto 0); signal rom_mux : std_logic; signal char_add : std_logic_vector(7 downto 0); signal diachi_kytu : std_logic_vector(7 downto 0); signal vga_red,vga_green,vga_blue : std_logic_vector(0 to 9); signal blank,sync,clk : std_logic; signal sram_addr : std_logic_vector(6 downto 0); signal sram_dq : std_logic_vector(7 downto 0); signal sram_WE_n,sram_CE_n : std_logic; signal rx_extended : std_logic; signal rx_released : std_logic; signal rx_shift_key_on : std_logic; signal rx_ascii : std_logic_vector(7 downto 0); signal rx_data_ready : std_logic; signal rx_read : std_logic; signal tx_data : std_logic_vector(7 downto 0); signal tx_write : std_logic; signal tx_write_ack : std_logic; signal tx_error_no_keyboard_ack : std_logic ; begin vga : vga_sync port map ( clock_50mhz => clock_50, mux => rom_mux, horiz_sync_out => h_sync, vert_sync_out => v_sync, pixel_row => pixel_roww, pixel_column => pixel_columnn, sync => sync, clock => clk ); char : char_rom port map ( char_add, pixel_roww(3 downto 1), pixel_columnn(3 downto 1), rom_mux ); value : char_value port map ( pixel_roww(9 downto 4), pixel_columnn(9 downto 4), sram_dq, rx_data_ready, sram_addr, sram_we_n, sram_ce_n, char_add -- Mã ASCII ); -- VGA RAM RAM : SRAM port map ( addr => sram_addr, clk => clock_50, din => rx_ascii, dout => sram_dq, en => sram_CE_n, we => sram_WE_n ); ------------------------------------------------------------------------------ -- Giao dien ban phim Banphim: ps2_keyboard_interface port map ( clk => clock_50, reset => reset, ps2_clk => ps2_clk, ps2_data => ps2_data , rx_extended => rx_extended , rx_released => rx_released, rx_shift_key_on => rx_shift_key_on , rx_ascii => rx_ascii, rx_data_ready => rx_data_ready, rx_read => rx_read , tx_data => tx_data , tx_write => tx_write , tx_write_ack => tx_write_ack , tx_error_no_keyboard_ack => tx_error_no_keyboard_ack ); -- XU LY MAU SAC PROCESS (pixel_roww(9 downto 4),pixel_columnn(9 downto 4)) begin IF (pixel_roww(9 downto 4) = 8) or (pixel_roww(9 downto 4) = 16) then if rom_mux = '1' then red <= '1'; green <= '1'; blue <= '0'; else red <= '0'; green <= '0'; blue <= '1'; end if; elsif (pixel_roww(9 downto 4) = 10) or (pixel_roww(9 downto 4) = 11) or (pixel_roww(9 downto 4) = 12) or (pixel_roww(9 downto 4) = 13) or (pixel_roww(9 downto 4) = 18) or (pixel_roww(9 downto 4) = 19) or (pixel_roww(9 downto 4) = 20) or (pixel_roww(9 downto 4) = 21) then if rom_mux = '1' then red <= '1'; green <= '1'; blue <= '1'; else red <= '0'; green <= '0'; blue <= '1'; end if; elsif (pixel_roww(9 downto 4) = 9) or (pixel_roww(9 downto 4) = 17) or (pixel_roww(9 downto 4) = 14) or (pixel_roww(9 downto 4) = 15) then red <= '0'; green <= '0'; blue <= '1'; else red <= '0'; green <= '1'; blue <= '0'; end if; end process; end Behavioral; KẾT LUẬN VÀ NHẬN XÉT Trong các giải pháp phần cứng cho việc xây dựng hệ thống điều khiển, có thể thầy FPGA là một trong những giải pháp khá phù hợp. Với FPGA, chúng ta có thể thiết kế hệ thống theo từng khối hoạt động song song, cho phép tăng tốc độ xử lý lên nhiều lần so với xử lý tuần tự. Điều này là rất quan trọng đối với những hệ thống đòi hỏi tốc độ xử lý nhanh, chẳng hạn như những cánh tay robot gắp đồ vật đang chuyển động nhanh. Trong đồ án này, mới chỉ mang tính chất tìm hiểu về FPGA nên khó có thể nêu bật được khả năng mạnh mẽ của công nghệ này. Nhưng đối với tôi, đây lại gần như là vạch xuất phát cho các quá trình tiếp theo. Khi đã tìm đầy đủ, việc thiết kế ra các hệ thống xử lý mang tầm xa hơn như : Hệ thống xử lý tín hiệu trong viễn thông, các hệ thống điều khiển từ xa, nhận dạng hình ảnh, giọng nói ..v.v. là hoàn toàn có thể thực hiện được. Tất cả các tiện ích nêu trên đều để phục vụ vì lợi ích chung của cộng đồng, giúp cho ngành Điện tử Việt Nam ngày càng lớn mạnh. Riêng về bản thân, qua quá trình thực hiện đồ án này, tôi cảm thấy đã học được rất nhiều điều. Thứ nhất là kỹ năng tự nghiên cứu trong những lĩnh vực còn hết sức mới mẻ đối với sinh viên Điện tử - Viễn thông : Khả năng tìm hiểu và thiết kế các mạch điều khiển trên nền tảng những kiến thức cơ sở đã học được ở nhà trường. Thứ hai là kỹ năng làm việc có kế hoạch : bằng việc phân bổ thời gian hợp lý, tôi đã chia tách công việc ra một cách khá cân bằng, đảm bảo được tiến độ thiết kế, để thực hiện đồ án một cách tốt nhất trong khả năng có thể. Và sau cùng, đây là một trong những kỹ năng quan trọng nhất cho công việc của một kỹ sư về sau : Đó là kỹ năng trình bày những ý tưởng, hiểu biết và kiến thức của mình vào một đồ án, nhằm truyền tải một cách đầy đủ nhất có thể những gì mình hiểu về lĩnh vực mà mình đang nghiên cứu. Cuối cùng, cũng phải nói rằng dù đã cố gắng rất nhiều, nhưng tôi vẫn không tránh khỏi những sai sót, trong việc xây dựng hệ thống, trong việc trình bày đồ án. Nhưng tôi vẫn luôn ý thức được rằng, những sai sót ấy cũng là một cơ hội cho để rèn luyện kỹ năng của mình : Kỹ năng sửa chữa những sai sót và khiếm khuyết, để thực hiện những đề tài, dự án về sau một cách hoàn chỉnh hơn. Đó tất cả là nhờ sự theo dõi, hướng dẫn, phản biện tận tình và nghiêm túc của các thầy, cô trong hội đồng bảo vệ. Tôi xin chân thành cảm ơn các thầy cô vì sự tận tụy ấy ! Tôi xin chân thành cảm ơn ! TÀI LIỆU THAM KHẢO 1/ PS2 keyboard interface by VHDL Tác giả : John Clayton, 2004 2/ Rapid Prototyping of Digital Systems Tác giả : James O.Hamblen và Michael D. Furman 3/ Thiết kế mạch số với VHDL và Verilog Tác giả : Tống Văn On Nhà xuất bản lao động xã hội, 2007. 4/ Diễn đàn Điện Tử Việt Nam 5/ Website về Spartan-3E Starter Kit Board 6/ Bách khoa toàn thư mở Wikipedia

Các file đính kèm theo tài liệu này:

  • docDo an tot nghiep Kip 2009 FPGA small.doc