同步FIFO之VHDL描述3
今天又重新安装了UltraEdit, Quartus II6.0和Modelsim SE 6.0,这次安装以后系统没有发现什么异常。另外还安装了紫光的拼音输入法,用习惯了这个,微软呀,智能ABC这些都用不太习惯。最后把系统备份了一下,以免将来出了什么问题还可以还原一下,呵呵。
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
还是接着昨天的《同步FIFO之VHDL描述》。突然发现用于实现FIFO的RAM必须是真正意义上的双口RAM,也就是读写可以同时进行的,以前只是用VHDL描述过单端口的RAM,双口RAM还没有描述过,不过曾经看到过Xilinx FPGA/CPLD的开发工具ISE的Core Genertor好像提供双口RAM的软核,所以我想用HDL语言也就应该可以描述从而调用双口RAM,这个等到具体写双口RAM的RTL代码的时候再研究。还有一个问题就是FIFO的读写请求控制信号必须要控制FIFO读写指针的产生电路,只有读写信号信号有效的时候,FIFO读写指针才能是有效的,负责是无效而且要保持不变,这个容易理解。
今天,就先完成写指针产生和管理电路的RTL代码吧,其实很简单,就是一个二进制计数器。下面就是VHDL的代码,大家看看有没有什么问题。
-----------------------------------------------------------------------------------------------------------
-- Designer : skycanny
-- Date : 2007-2-2
-- Description : write_pointer is created
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
entity write_pointer is
generic
(
depth : positive
);
port
(
clk : in std_logic;
rst : in std_logic;
wq : in std_logic;
wr_pt : out std_logic_vector(depth - 1 downto 0)
);
architecture RTL of write_pointer is
signal wr_pt_t : std_logic_vector(depth - 1 downto 0); -- writer pointer counter
begin
process(rst, clk)
begin
if rst = '0' then
wr_pt_t <= (others => '0');
elsif clk'event and clk = '1' then
if wq = '0' then
wr_pt_t <= wr_pt_t + 1;
end if;
end process;
wr_pt <= wr_pt_t;
end RTL;
------------------------------------------------------------------------------------------------------------
今天就到这里吧,欢迎大家访问skyanny的笔记(副站) ,最后还是希望大家能投宝贵的一票,谢谢!
用户1402107 2010-6-25 14:43
ash_riple_768180695 2007-2-5 14:01