OpenCores
URL https://opencores.org/ocsvn/wb_fifo/wb_fifo/trunk

Subversion Repositories wb_fifo

[/] [wb_fifo/] [trunk/] [model/] [vhdl/] [fifo.vhdl] - Diff between revs 3 and 4

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 3 Rev 4
Line 50... Line 50...
architecture rtl of fifo is
architecture rtl of fifo is
        type t_memory is array(memoryDepth-1 downto 0) of i_transactor.t_msg;
        type t_memory is array(memoryDepth-1 downto 0) of i_transactor.t_msg;
        signal memory:t_memory;
        signal memory:t_memory;
        signal ptr:natural range 0 to memoryDepth-1;
        signal ptr:natural range 0 to memoryDepth-1;
 
 
 
        /* FIFO control signalling. */
 
        signal fifoCtrl:t_fifo;
 
 
        /*
        /*
                writeRequest and readRequest are inputs. This indicate that a block is requesting to write to or
                writeRequest and readRequest are inputs. This indicate that a block is requesting to write to or
                        read from the FIFO.
                        read from the FIFO.
                        For write requests, the external block requests to write some data into the FIFO. The data
                        For write requests, the external block requests to write some data into the FIFO. The data
                        is attached as part of the write request (writeRequest.message).
                        is attached as part of the write request (writeRequest.message).
Line 131... Line 134...
        /* TODO recheck pipelining. */
        /* TODO recheck pipelining. */
        process(clk) is begin
        process(clk) is begin
                if falling_edge(clk) then
                if falling_edge(clk) then
                        i_writeRequest <= fifoInterface.writeRequest;
                        i_writeRequest <= fifoInterface.writeRequest;
                        i_readRequest <= fifoInterface.readRequest;
                        i_readRequest <= fifoInterface.readRequest;
                        i_full <= fifoInterface.full;
                        i_full <= fifoCtrl.full;
                        i_empty <= fifoInterface.empty;
                        i_empty <= fifoCtrl.empty;
                end if;
                end if;
        end process;
        end process;
 
 
        fifoInterface.pctFilled<=to_unsigned(ptr*100/(memoryDepth-1), fifoInterface.pctFilled'length);
        fifoCtrl.pctFilled<=to_unsigned(ptr*100/(memoryDepth-1), fifoCtrl.pctFilled'length);
 
 
        process(clk) is begin
        process(clk) is begin
                if rising_edge(clk) then
                if rising_edge(clk) then
                        fifoInterface.nearFull<=true when fifoInterface.pctFilled>=d"75" and fifoInterface.pctFilled<d"100" else false;
                        fifoCtrl.nearFull<=true when fifoCtrl.pctFilled>=d"75" and fifoCtrl.pctFilled<d"100" else false;
                        fifoInterface.full<=true when fifoInterface.pctFilled=d"100" else false;
                        fifoCtrl.full<=true when fifoCtrl.pctFilled=d"100" else false;
                        fifoInterface.nearEmpty<=true when fifoInterface.pctFilled<=d"25" and fifoInterface.pctFilled>d"0" else false;
                        fifoCtrl.nearEmpty<=true when fifoCtrl.pctFilled<=d"25" and fifoCtrl.pctFilled>d"0" else false;
                        fifoInterface.empty<=true when fifoInterface.pctFilled=d"0" else false;
                        fifoCtrl.empty<=true when fifoCtrl.pctFilled=d"0" else false;
                end if;
                end if;
        end process;
        end process;
 
 
        process(clk) is begin
        process(clk) is begin
                if falling_edge(clk) then
                if falling_edge(clk) then
                        fifoInterface.overflow<=fifoInterface.full and write;
                        fifoCtrl.overflow<=fifoCtrl.full and write;
                        fifoInterface.underflow<=fifoInterface.empty and read;
                        fifoCtrl.underflow<=fifoCtrl.empty and read;
                end if;
                end if;
        end process;
        end process;
end architecture rtl;
end architecture rtl;
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.