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

Subversion Repositories btc_dsha256

[/] [btc_dsha256/] [trunk/] [rtl/] [vhdl/] [misc/] [sdpram_infer_read_first_outreg.vhd] - Diff between revs 2 and 3

Only display areas with differences | Details | Blame | View Log

Rev 2 Rev 3
-------------------------------------------------------------------------------
------------------------------------------------------------------- 
-- Copyright (c) 2013 VariStream
--                                                               --
-- Author : Yu Peng
--  Copyright (C) 2013 Author and VariStream Studio              --
 
--  Author : Yu Peng                                             --
 
--                                                               -- 
 
--  This source file may be used and distributed without         -- 
 
--  restriction provided that this copyright statement is not    -- 
 
--  removed from the file and that any derivative work contains  -- 
 
--  the original copyright notice and the associated disclaimer. -- 
 
--                                                               -- 
 
--  This source file is free software; you can redistribute it   -- 
 
--  and/or modify it under the terms of the GNU Lesser General   -- 
 
--  Public License as published by the Free Software Foundation; -- 
 
--  either version 2.1 of the License, or (at your option) any   -- 
 
--  later version.                                               -- 
 
--                                                               -- 
 
--  This source is distributed in the hope that it will be       -- 
 
--  useful, but WITHOUT ANY WARRANTY; without even the implied   -- 
 
--  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      -- 
 
--  PURPOSE.  See the GNU Lesser General Public License for more -- 
 
--  details.                                                     -- 
 
--                                                               -- 
 
--  You should have received a copy of the GNU Lesser General    -- 
 
--  Public License along with this source; if not, download it   -- 
 
--  from http://www.opencores.org/lgpl.shtml                     -- 
 
--                                                               -- 
 
------------------------------------------------------------------- 
-- Description:
-- Description:
--   Simple dual-port RAM in read-first mode with output register.
--      Simple dual-port RAM in read-first mode with output 
--   This block infers block RAM or distribute RAM according to value of gADDRESS_WIDTH and gDATA_WIDTH,
--      register.
 
--      This block infers block RAM or distribute RAM according 
 
--      to value of gADDRESS_WIDTH and gDATA_WIDTH.
-- NOTE: 
-- NOTE: 
--   Reset is on data output ONLY.
--   Reset is on data output ONLY.
--   This requirement follows the XST User Guide to synthesize into BRAM.
--      This requirement follows the XST User Guide to synthesize
-------------------------------------------------------------------------------
--      into BRAM.
 
-------------------------------------------------------------------
library ieee;
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_unsigned.all;
 
 
entity sdpram_infer_read_first_outreg is
entity sdpram_infer_read_first_outreg is
    generic (
    generic (
        gADDRESS_WIDTH : integer := 5;
        gADDRESS_WIDTH : integer := 5;
        gDATA_WIDTH : integer := 24
        gDATA_WIDTH : integer := 24
        );
        );
    port (
    port (
        iClk : in std_logic;
        iClk : in std_logic;
        iReset_sync : in std_logic;
        iReset_sync : in std_logic;
        iWe : in std_logic;
        iWe : in std_logic;
        ivWrAddr : in std_logic_vector(gADDRESS_WIDTH-1 downto 0);
        ivWrAddr : in std_logic_vector(gADDRESS_WIDTH-1 downto 0);
                ivRdAddr : in std_logic_vector(gADDRESS_WIDTH-1 downto 0);
                ivRdAddr : in std_logic_vector(gADDRESS_WIDTH-1 downto 0);
        ivDataIn : in std_logic_vector(gDATA_WIDTH-1 downto 0);
        ivDataIn : in std_logic_vector(gDATA_WIDTH-1 downto 0);
        ovDataOut : out std_logic_vector(gDATA_WIDTH-1 downto 0)
        ovDataOut : out std_logic_vector(gDATA_WIDTH-1 downto 0)
        );
        );
end sdpram_infer_read_first_outreg;
end sdpram_infer_read_first_outreg;
 
 
architecture behavioral of sdpram_infer_read_first_outreg is
architecture behavioral of sdpram_infer_read_first_outreg is
    -- Output register
    -- Output register
    signal svDataOut : std_logic_vector (gDATA_WIDTH-1 downto 0) := (others => '0');
    signal svDataOut : std_logic_vector (gDATA_WIDTH-1 downto 0) := (others => '0');
 
 
    -- RAM addressable data array
    -- RAM addressable data array
    type   tRAM is array (2**gADDRESS_WIDTH-1 downto 0) of std_logic_vector (gDATA_WIDTH-1 downto 0);
    type   tRAM is array (2**gADDRESS_WIDTH-1 downto 0) of std_logic_vector (gDATA_WIDTH-1 downto 0);
    signal svRAM : tRAM := (others => (others => '0'));
    signal svRAM : tRAM := (others => (others => '0'));
 
 
begin
begin
    ovDataOut <= svDataOut;
    ovDataOut <= svDataOut;
    process (iClk)
    process (iClk)
    begin
    begin
        if iClk'event and iClk = '1' then
        if iClk'event and iClk = '1' then
            if iWE = '1' then
            if iWE = '1' then
                svRAM(conv_integer(ivWrAddr)) <= ivDataIn;
                svRAM(conv_integer(ivWrAddr)) <= ivDataIn;
            end if;
            end if;
 
 
                        svDataOut <= svRAM(conv_integer(ivRdAddr));
                        svDataOut <= svRAM(conv_integer(ivRdAddr));
        end if;
        end if;
    end process;
    end process;
end behavioral;
end behavioral;
 
 

powered by: WebSVN 2.1.0

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