rom2_labirint.vhd

来自「游戏玩家通过控制PS/2键盘上的方向键」· VHDL 代码 · 共 191 行

VHD
191
字号
--------------------------------------------------------------------------------
-- Company: 
-- Engineer:
--
-- Create Date:    08:55:36 05/09/09
-- Design Name:    
-- Module Name:    rom2_labirint - Behavioral
-- Project Name:   
-- Target Device:  
-- Tool versions:  
-- Description:
--
-- Dependencies:
-- 
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
-- 
--------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity rom2_labirint is
	port(row, col : in std_logic_vector(5 downto 0);
			char : out std_logic_vector(2 downto 0)
	);
end rom2_labirint;

architecture Behavioral of rom2_labirint is

type matrice is array(0 to 39) of std_logic_vector(2 downto 0);
type memorie is array (0 to 29) of matrice; 
constant mem : memorie :=
	(  ("001","001","001","001","001","001","001","001","001","001",
			"001","001","001","001","001","001","001","001","001","001",
			"001","001","001","001","001","001","001","001","001","001",
			"001","001","001","001","001","001","001","001","001","001"),    

		("001","000","000","000","001","000","000","000","001","000",
			"000","000","001","000","000","000","001","000","000","000",
			"001","000","000","000","000","000","000","000","000","001",
			"000","000","000","000","000","001","001","001","001","001"),

		("001","001","001","000","001","000","001","000","001","000",
			"001","000","001","000","001","000","001","000","001","000",
			"000","000","000","001","000","000","000","000","001","001",
			"000","000","000","001","000","001","001","001","001","001"),

		("001","000","000","000","000","000","001","000","001","000",
			"001","000","001","000","001","000","001","000","001","000",
			"000","000","000","000","001","001","000","000","000","000",
			"001","000","000","000","000","001","001","001","001","001"),

		("001","000","000","000","000","000","001","000","000","000",
			"001","000","000","000","001","000","000","000","001","001",
			"001","000","000","000","000","000","000","001","000","001",
			"000","000","001","000","000","001","001","001","001","001"),

		("001","001","000","000","001","001","001","001","001","000",
			"001","001","001","001","001","001","001","001","001","000",
			"000","000","001","001","000","000","000","000","000","000",
			"000","000","001","000","000","001","001","001","001","001"),
		
		("001","001","000","000","000","000","000","000","000","000",
			"000","000","000","000","000","001","000","000","001","000",
			"001","000","000","000","000","001","000","001","001","000",
			"000","001","000","001","001","001","001","001","001","001"),

		("001","001","000","001","001","001","001","001","000","001",
			"001","001","001","001","001","001","001","000","001","000",
			"000","000","000","001","000","001","000","000","000","001",
			"000","000","000","000","000","001","000","001","000","001"),

		("001","001","000","000","001","000","001","000","000","000",
			"000","000","000","001","000","000","000","000","001","000",
			"001","000","000","000","000","000","000","000","001","000",
			"000","001","000","001","000","001","001","001","000","001"),

		("001","000","000","000","001","000","001","000","000","000",
			"001","000","000","000","000","001","000","001","001","000",
			"001","000","001","000","001","000","000","000","000","001",
			"000","000","000","001","000","001","000","000","000","001"),

		("001","000","000","001","000","000","000","000","001","000",
			"000","001","000","000","001","001","000","000","001","000",
			"001","000","000","000","001","001","000","001","000","001",
			"000","000","000","001","000","000","000","000","001","001"),

		("001","000","000","000","000","000","001","001","000","001",
			"000","001","001","000","000","001","000","000","000","000",
			"000","001","000","001","001","001","000","001","000","000",
			"000","000","000","001","001","001","001","000","000","001"),

		("001","000","001","001","000","000","000","001","000","000",
			"001","001","000","000","000","001","000","001","001","001",
			"001","001","000","001","000","000","000","000","001","001",
			"000","001","001","000","000","000","000","000","000","001"),

		("001","000","000","000","001","000","000","001","000","001",
			"001","000","000","000","001","000","000","000","001","000",
			"000","000","000","001","001","001","001","000","001","000",
			"000","001","000","000","001","000","000","000","001","001"),

		("001","000","000","000","000","000","000","000","000","000",
			"000","001","000","000","000","001","001","001","000","000",
			"000","000","000","000","000","001","000","001","001","001",
			"000","001","000","001","000","000","000","000","000","001"),

		("001","001","001","001","000","001","000","001","001","000",
			"001","001","001","001","001","001","000","000","001","000",
			"000","000","000","000","001","000","001","000","001","000",
			"001","001","001","001","001","000","001","000","000","001"),

		("001","000","000","000","000","000","000","000","000","001",
			"000","000","000","001","000","000","000","000","000","000",
			"000","000","000","000","000","000","000","000","001","000",
			"000","000","000","000","001","000","000","001","001","001"),

		("001","000","000","001","001","001","000","001","001","001",
			"000","001","000","001","001","001","001","001","001","001",
			"001","000","001","000","000","001","000","001","000","001",
			"001","000","001","000","001","000","001","000","000","001"),

		("001","000","000","000","000","000","000","000","000","000",
			"001","000","000","000","000","001","000","000","000","000",
			"000","000","000","000","000","000","000","000","000","000",
			"001","000","001","000","001","000","000","001","000","001"),

   	("001","000","001","001","000","001","001","001","001","001",
			"000","001","000","000","000","001","001","000","000","000",
			"001","000","000","000","000","000","001","000","000","000",
			"001","000","000","000","001","000","000","001","000","001"),

		("001","000","001","001","001","000","000","000","001","000",
			"000","000","000","000","001","000","000","000","000","000",
			"000","000","000","000","000","000","000","001","000","000",
			"000","001","001","001","001","000","000","000","000","001"),

		("001","000","000","000","001","000","000","000","000","000",
			"000","000","001","001","001","001","001","001","001","000",
			"000","000","000","001","000","000","000","000","001","001",
			"001","000","000","001","001","000","001","000","001","001"),

		("001","001","000","000","001","000","001","000","000","001",
			"000","000","001","001","000","000","000","000","001","001",
			"000","001","000","000","001","000","001","000","000","000",
			"000","000","000","000","000","000","000","000","000","001"),

		("001","000","000","000","000","000","000","000","000","000",
			"000","001","001","000","000","001","001","000","000","001",
			"001","000","001","001","000","000","000","001","000","000",
			"001","001","001","001","001","000","000","000","000","001"),

		("001","000","001","000","001","000","000","001","001","001",
			"000","001","000","000","001","001","001","001","000","000",
			"000","001","000","000","000","000","000","000","001","001",
			"000","000","000","000","001","000","001","000","000","001"),

		("001","000","001","001","001","000","000","000","000","001",
			"000","000","000","001","001","000","000","001","001","001",
			"000","001","000","001","001","000","001","000","000","001",
			"000","000","000","000","000","000","001","001","000","001"),

		("001","000","000","000","001","001","000","001","000","000",
			"000","001","001","001","001","000","000","001","000","000",
			"000","000","000","001","000","000","000","001","001","000",
			"000","000","000","001","000","001","000","000","000","001"),

		("001","000","000","000","000","000","000","000","000","000",
			"001","000","000","000","000","000","000","001","000","000",
			"000","001","000","000","001","000","000","000","000","000",
			"001","000","000","000","001","000","000","000","000","001"),

		("001","001","001","001","001","001","001","001","000","000",
			"000","000","000","000","000","001","000","000","000","000",
			"000","000","000","000","000","001","000","001","000","000",
			"000","000","000","000","000","000","000","000","010","001"),

		("001","001","001","001","001","001","001","001","001","001",
			"001","001","001","001","001","001","001","001","001","001",
			"001","001","001","001","001","001","001","001","001","001",
			"001","001","001","001","001","001","001","001","001","001")
	);
 
begin
	char <= mem(conv_integer(row))(conv_integer(col)); 

end Behavioral;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?