⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rom_labirint.vhd

📁 这个是国外大学的项目代码
💻 VHD
字号:
------------------------------------------------------------------------
--  rom_labirint.vhd -- 
------------------------------------------------------------------------
--  Authors : Albert Zemba & Mihai Cucicea
------------------------------------------------------------------------
-- Software version: Xilinx ISE 7.1i 
--                   WebPack
------------------------------------------------------------------------
-- This source file contains the rom_labirint component
------------------------------------------------------------------------
--  Behavioral description
-- It works like a matrix with the indexes row and col 
-- The selected element is the character(the code of the character) 
-- to be generated
-- The matrix represents the labirinth map formed by 
-- 16x16 pixels characters
-- The vga is viewed at 640x480 pixel resolution, wich means we'll have
-- 40x30 characters(each 16x16 pixels) 
------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

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

architecture Behavioral of rom_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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -