http://skycanny.21ic.org

 
载入中...

他们彼此深信,是瞬间迸发的热情让他们相遇。这样的确定是美丽的,但变幻无常更为美丽
载入中...

留言簿

公告

2007-2-5 22:48:00
同步FIFO之VHDL描述5(大结局)1

同步FIFOVHDL描述5

       昨天晚上把所有的模块描述都完成了,同时还完成了双端口RAM的后仿真,从目前的仿真结果来看,应该没有什么问题。今天的任务就是把这些模块组装起来并完成前后仿真,这样同步FIFOVHDL描述就算全部完成了。按照前面的思路和框图,把这些模块组装起来应该很简单,下面就直接给出VHDL代码。当然组装的过程还要排查除了双口RAM以外电路的代码描述有没有问题,如果有问题的话就就地改正了,呵呵。

       在代码的集成和仿真的时候还真发现了一些问题,主要包括数据的寄存,以及空满状态判断上,最后的代码使用Quartus II6.0综合和布局布线,选用的是CycloneII系列的器件,并用Modelsim进行了功能仿真和时序仿真,两种仿真均通过。下面主要是集成的定层文件和时序仿真图(图1,图2,图3,图4,图5

 

---------------------------------------------------------------------------------------------------------

-- Designer            :      skycanny

-- Date                  :      2007-2-4

-- Description :      Synchronous FIFO created by VHDL

library ieee;

use ieee.std_logic_1164.all;

use ieee.std_logic_unsigned.all;

use ieee.std_logic_arith.all;

 

entity sfifo is

       generic

       (

              width      :      positive   := 16;

              depth      :      positive   := 8

       );

       port

       (

              clk          :      in     std_logic;

              rst          :      in     std_logic;

              wq          :      in     std_logic;

              rq           :      in     std_logic;

              data :      in     std_logic_vector(width - 1 downto 0);

              q            :      out   std_logic_vector(width - 1 downto 0);

              empty     :      out   std_logic;

              full   :      out   std_logic

       );

end entity sfifo;

-----------------------------------------------------------------------------------------------------------

architecture structure of sfifo is

signal      empty_t   :      std_logic;

signal      full_t       :      std_logic;

signal      wr_pt      :      std_logic_vector(depth - 1 downto 0);

signal      rd_pt       :      std_logic_vector(depth - 1 downto 0);

signal      wr          :      std_logic;

signal      rd           :      std_logic;

component write_pointer

       generic

       (

              depth      :      positive   :=8  

       );

       port

       (

              clk          :      in     std_logic;

              rst          :      in     std_logic;

              wq          :      in     std_logic;

              full          :      in     std_logic;

              wr          :      out   std_logic;

              wr_pt      :      out   std_logic_vector(depth - 1 downto 0)         

       );

end component;

component read_pointer

       generic

       (

              depth      :      positive   :=8  

       );

       port

       (

              clk          :      in     std_logic;

              rst          :      in     std_logic;

              rq           :      in     std_logic;

              empty     :      in     std_logic;

              rd           :      out   std_logic;

              rd_pt       :      out   std_logic_vector(depth - 1 downto 0)         

       );

end component;

 

component judge_status

       generic

       (

              depth      :      positive :=8

       );

       port

       (

              clk          :      in     std_logic;

              rst          :      in     std_logic;

              wr_pt      :      in     std_logic_vector(depth - 1 downto 0);

              rd_pt       :      in     std_logic_vector(depth - 1 downto 0);

              empty     :      out   std_logic;

              full   :      out   std_logic

       );

end component;

component dualram

       generic

       (

              width      :      positive   := 16;

              depth      :      positive   := 8

       );

       port

       (

              ------------------------- port a is only for writing -------------------------------

              clka :      in     std_logic;

              wr          :      in     std_logic;

              addra      :      in     std_logic_vector(depth - 1 downto 0);

              datain      :      in     std_logic_vector(width - 1 downto 0);

              ------------------------------------------------------------------------------------

              ------------------------- port b is only for reading -------------------------------

              clkb :      in     std_logic;

              rd           :      in     std_logic;

              addrb      :      in     std_logic_vector(depth - 1 downto 0);

              dataout    :      out   std_logic_vector(width - 1 downto 0)         

              ------------------------------------------------------------------------------------

       );

end component;

posted @ 2007-2-5 22:48:00 skycanny 阅读全文 | 回复(0) | 引用通告 | 编辑
  • 标签:FIFO VHDL 
  • 发表评论:
    载入中...