Arrays 用于数据缓冲区的VHDL三维数组
我为这个RAM设计的2D阵列工作得非常好。现在我的任务是在读取数据之前处理多个触发器。所以现在我试图在我的RAM中建立一个数据缓冲区,这样当多个触发器触发时,它可以存储数据,以后可以读取。我只是想知道两件事: 1) 这就是设置三维阵列的方式吗?关于它们的信息并不多 2) 是否有更好的方法为我的数据创建缓冲区 数据格式为:数据[buff_num][word_num][binary] 每个字是32位,通常有14个字,我想我已经使缓冲区有8位深了Arrays 用于数据缓冲区的VHDL三维数组,arrays,3d,vhdl,Arrays,3d,Vhdl,我为这个RAM设计的2D阵列工作得非常好。现在我的任务是在读取数据之前处理多个触发器。所以现在我试图在我的RAM中建立一个数据缓冲区,这样当多个触发器触发时,它可以存储数据,以后可以读取。我只是想知道两件事: 1) 这就是设置三维阵列的方式吗?关于它们的信息并不多 2) 是否有更好的方法为我的数据创建缓冲区 数据格式为:数据[buff_num][word_num][binary] 每个字是32位,通常有14个字,我想我已经使缓冲区有8位深了 library IEEE; use IEEE.STD_
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use ieee.numeric_std.all;
entity ipbus_dpram is
generic(
ADDR_WIDTH: natural
);
port(
clk: in std_logic;
rst: in std_logic;
rclk: in std_logic;
we: in std_logic := '0';
d: in std_logic_vector(31 downto 0);
rdata: out std_logic_vector(ADDR_WIDTH - 1 downto 0);
addr: in std_logic_vector(ADDR_WIDTH - 1 downto 0);
w_addr: out std_logic(ADDR_WIDTH - 1 downto 0);
w_buf_shift: in std_logic;
en_write: in std_logic;
);
end ipbus_dpram;
architecture rtl of ipbus_dpram is
type ram_array is array(7 downto 0, 13 downto 0) of std_logic_vector(31 downto 0);
shared variable ram: ram_array;
signal w_shel, r_shel : integer;
signal sel, wsel: integer;
signal ack: std_logic;
signal w_shift: unsigned(7 downto 0);
signal r_shift: unsigned(7 downto 0);
begin
sel <= to_integer(unsigned(r_addr(addr_width-1 downto 0)));
process(clk)
begin
if rising_edge(clk) then
rdata <= ram(r_shel, sel);
if (en_write='1') then
r_shel <= to_integer(unsigned(r_shift));
r_shift <= r_shift +1;
end if;
end if;
end process;
wsel <= to_integer(unsigned(addr));
process(rclk)
begin
if rising_edge(rclk) then
if we = '1' then
ram(w_shel, wsel) := d;
end if;
if w_buf_shift = '1' then
w_shel <= to_integer(unsigned(w_shift));
w_shift <= w_shift + 1;
end if;
end if;
end process;
end rtl;
IEEE库;
使用IEEE.STD_LOGIC_1164.ALL;
使用ieee.numeric_std.all;
实体ipbus_dpram是
一般的(
地址宽度:自然宽度
);
港口(
clk:标准逻辑中;
rst:标准逻辑中;
rclk:标准逻辑中;
we:在标准逻辑中:='0';
d:标准逻辑向量(31到0);
rdata:out标准逻辑向量(加法宽度-1到0);
addr:在标准逻辑向量中(addr\u宽度-1到0);
w_addr:out标准逻辑(addr_宽度-1向下至0);
w_buf_移位:在标准逻辑中;
en_写入:标准逻辑;
);
结束ipbus_dpram;
ipbus_dpram的体系结构rtl是
类型ram_数组是标准_逻辑_向量(31向下到0)的数组(7向下到0,13向下到0);
共享变量ram:ram_阵列;
信号w_shel,r_shel:整数;
信号sel,wsel:整数;
信号确认:标准逻辑;
信号w_移位:无符号(7向下至0);
信号r_移位:无符号(7向下至0);
开始
哇。。。这是一个巨大的寄存器数量,你正试图合成!一个2^8=256宽2^14=16384长32深的3D向量=134217728寄存器!你需要一艘更大的船。实际上,你需要一艘还不存在的船。也许有一天,他们会构建一个足够大的FPGA来满足您的需求,但可惜那天不是今天
您需要更智能地存储数据。您需要使用片外存储,如DRAM或SRAM,或者需要使用FIFO临时缓冲数据 你能大致解释一下在这种情况下我会如何使用FIFO吗?FIFO=先进先出。查看如何使用现有的FPGA结构创建FIFO,因为lattice、xilinx和actel都略有不同。您需要有一个进程单独负责向FIFO写入数据,另一个进程单独负责从FIFO读取数据。我通常把它们放在两个单独的文件中,只是为了保持整洁。关于FIFO的几个注意事项:1。您决不能写入完整的FIFO 2。你绝不能从空的FIFO中读取祝你好运!因此,如果我有14*32位的字进入FIFO,那么可以将这些数组堆叠在一起吗?我会完全放弃数组的想法。将其视为光栅图像。从图像的左上角进入FIFO的数据流读起来就像一本书,一直读到右下角。只有在需要对数据进行非顺序访问时,才应使用RAM。如果您以与输入相同的顺序读取数据,则意味着您应该使用FIFO。