📄 imgctrl.vhd
字号:
------------------------------------------------------------------------
-- imgctrl.vhd -- Image header read control
------------------------------------------------------------------------
-- Author : Kovacs Laszlo - Attila
------------------------------------------------------------------------
-- Software version: Xilinx ISE 7.1.04i
-- WebPack
------------------------------------------------------------------------
-- Reads the image header: the image width, height and
-- the starting address of the data.
------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity imgctrl is
Port ( CLK : in std_logic;
IMGNR : in std_logic_vector(3 downto 0);
--sram
ICRD : out std_logic;
ICDI : in std_logic_vector(7 downto 0);
ICADR : out std_logic_vector(19 downto 0);
--ctrl
SADR : out std_logic_vector(19 downto 0);
IMGW : out std_logic_vector(10 downto 0);
IMGH : out std_logic_vector(10 downto 0));
end imgctrl;
architecture Behavioral of imgctrl is
constant ctrlSTART : std_logic_vector(3 downto 0) := "0000";
constant ctrlDONE : std_logic_vector(3 downto 0) := "1001";
signal ctrlst : std_logic_vector(3 downto 0) := ctrlDONE;
signal iIMGNR : std_logic_vector(3 downto 0) := "0000";
begin
ICADR <= "0000000000000" & iIMGNR & ctrlst(2 downto 0);
ICRD <= '0' when ctrlst = ctrlDONE else '1';
process(CLK)
begin
if rising_edge(CLK) then
if iIMGNR /= IMGNR then
ctrlst <= ctrlSTART;
iIMGNR <= IMGNR;
elsif ctrlst /= ctrlDONE then
ctrlst <= ctrlst + 1;
end if;
end if;
end process;
process(CLK)
begin
if rising_edge(CLK) then
case ctrlst is
when "0010" =>
SADR(19 downto 16) <= ICDI(3 downto 0);
when "0011" =>
SADR(15 downto 8) <= ICDI;
when "0100" =>
SADR(7 downto 0) <= ICDI;
when "0101" =>
IMGW(10 downto 8) <= ICDI(2 downto 0);
when "0110" =>
IMGW(7 downto 0) <= ICDI;
when "0111" =>
IMGH(10 downto 8) <= ICDI(2 downto 0);
when "1000" =>
IMGH(7 downto 0) <= ICDI;
when others =>
end case;
end if;
end process;
end Behavioral;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -