如何在斯巴达3e fpga中播放小视频?

Joe*_*Joe 6 memory image-processing fpga video-processing vhdl

通过使用cosmiac教程13 http://www.cosmiac.org/tutorial_13.html和ISE 10.1,pdf文件显示了如何生成图像,您可以通过单击第一个.zip文件来下载项目.在项目结束时它说...现在尝试用类似的方法流式传输一个小视频.注意:需要适当地修改Matlab文件以获取像素信息,并且需要使用reader.vhd来修改所使用的视频规范.还需要获得仅使用8种颜色(可以用Spartan-3E板表示)的视频,以获得干净的输出.

我的问题是......如果我有matlab .coe文件(视频帧),我是否使用单个端口ram(核心内存生成器中的哪种类型的ram)来传输小视频?以及如何修改下面的阅读器?

让我们说我从2帧开始(2张图片).我想像一个视频一样背靠背地显示它或者在另一个顶部显示它(更容易).

要记住的事情...... vhdl编程语言,Xilinx是任何版本(我都可以更新),Xilinx Impact.

---------------------------------------------------------------------------------
-- File Name: reader.vhd
----------------------------------------------------------------------------------

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;


entity reader is
Port ( clk, reset : in  STD_LOGIC;
       row : in  STD_LOGIC_VECTOR (9 downto 0);
       col : in  STD_LOGIC_VECTOR (9 downto 0);
       addr : out  STD_LOGIC_VECTOR (15 downto 0);
       ennormal, enencryp : out std_logic;
          datain : in  STD_LOGIC_VECTOR (2 downto 0);
          dataout : out  STD_LOGIC_VECTOR (2 downto 0));
end reader;

architecture Behavioral of reader is

constant vtop : integer := 128;
constant vbottom : integer := 351;

constant htop1 : integer := 64;
constant hbottom1 : integer := 287;
constant htop2 : integer := 352;
constant hbottom2 : integer := 575;

signal addr_normal : STD_LOGIC_VECTOR (15 downto 0) := (others => '0');
signal addr_encryp : STD_LOGIC_VECTOR (15 downto 0) := (others => '0');

signal en_normal : std_logic := '0';
signal en_encryp : std_logic := '0';

begin

ens : process (clk, reset)
begin
    if reset = '1' then
            en_normal <= '0';
            en_encryp <= '0';       

    elsif clk'event and clk='1' then

            if (row >= vtop) and (row <= vbottom) then

                if (col >= htop1) and (col <= hbottom1) then
                        en_normal <= '1';
                        en_encryp <= '0';
                elsif (col >= htop2) and (col <= hbottom2) then
                        en_normal <= '0';
                        en_encryp <= '1';
                else
                        en_normal <= '0';
                        en_encryp <= '0';
                end if;

            else
                    en_normal <= '0';
                    en_encryp <= '0';
            end if;

    end if;

end process ens;

c_normal: process (clk, reset)
begin
        if reset = '1' then

            addr_normal <= (others => '0');

        elsif clk'event and clk='1' then

            if en_normal = '1' then

                if addr_normal = 50175 then
                    addr_normal <= (others => '0');
                else
                    addr_normal <= addr_normal + 1;
                end if;

            end if;
        end if;
end process c_normal;

c_encryp: process (clk, reset)
begin
        if reset = '1' then

            addr_encryp <= (others => '0');

        elsif clk'event and clk='1' then

            if en_encryp = '1' then

                if addr_encryp = 50175 then
                    addr_encryp <= (others => '0');
                else
                    addr_encryp <= addr_encryp + 1;
                end if;

            end if;
        end if;
end process c_encryp;

addr <= addr_normal when (en_normal = '1') else addr_encryp;

dataout <= datain;

ennormal <= en_normal;
enencryp <= en_encryp;

end Behavioral;
Run Code Online (Sandbox Code Playgroud)

小智 -1

当大多数人谈论视频时,他们指的是大量数据。比 15 年低端 FPGA 作为 Block RAM 可能包含的数据多得多。即使考虑到压缩。特别是考虑到压缩,因为该 FPGA 几乎无法解码任何高效的视频编解码器。

因此,除非您尝试做一些非常复古或异国情调(或两者兼而有之)的事情,否则我不建议将视频存储在 BRAM 中。寻找带有 DRAM 控制器的 FPGA,并使用外部 DDR1/2/3/任何其他设备。

回到你的问题,如果你打算将视频存储在 BRAM 中,你可以将其设置为具有默认值的单端口 ROM,只需在 block ram 生成器 GUI 中添加你的 coe 文件即可。问题是,你打算如何输出视频?您是否连接了 RGB/VGA 显示器?或者带有模拟电视的 NTSC 编码器?还是HDMI?您需要一个控制器来输出视频,在某些情况下,它可能不适合您的 FPGA。