📄 brick.vhd
字号:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity brick is
Port ( clk : in std_logic;
reset : in std_logic;
hcnt : in integer ;
vcnt : in integer ;
brick_rgb : out std_logic_vector(2 downto 0));
end brick;
architecture Behavioral of brick is
--------------------------------------------------------------------
CONSTANT BRICK_WIDTH : INTEGER :=40;
CONSTANT BRICK_LEN : INTEGER :=50;
CONSTANT BRICK_AX: INTEGER :=130;
CONSTANT BRICK_BX: INTEGER :=320;
CONSTANT BRICK_CX: INTEGER :=510;
CONSTANT BRICK_Y : INTEGER :=100;
---------------------------------------------------------------------
begin
drawmount: process(clk,hcnt,vcnt,reset)
begin
if (reset='0') then
brick_rgb <= "000";
elsif (clk'event and clk='1') then
if ((hcnt>=BRICK_AX- BRICK_LEN and hcnt<=BRICK_AX- BRICK_LEN) and (vcnt>=BRICK_Y - BRICK_WIDTH and vcnt<=BRICK_Y + BRICK_WIDTH))
or ((hcnt>=BRICK_BX- BRICK_LEN and hcnt<=BRICK_BX- BRICK_LEN) and (vcnt>=BRICK_Y - BRICK_WIDTH and vcnt<=BRICK_Y + BRICK_WIDTH)) or ((hcnt>=BRICK_CX- BRICK_LEN and hcnt<=BRICK_CX- BRICK_LEN) and (vcnt>=BRICK_Y - BRICK_WIDTH and vcnt<=BRICK_Y + BRICK_WIDTH))
then
brick_rgb <= "001";
else
brick_rgb <= "000";
end if;
end if;
end process;
end Behavioral;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -