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

Subversion Repositories common_components

[/] [common_components/] [trunk/] [common_paged_reg.vhd] - Blame information for rev 5

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 danv
-------------------------------------------------------------------------------
2
--
3
-- Copyright (C) 2009
4
-- ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/>
5
-- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
6
--
7
-- This program is free software: you can redistribute it and/or modify
8
-- it under the terms of the GNU General Public License as published by
9
-- the Free Software Foundation, either version 3 of the License, or
10
-- (at your option) any later version.
11
--
12
-- This program is distributed in the hope that it will be useful,
13
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
14
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
-- GNU General Public License for more details.
16
--
17
-- You should have received a copy of the GNU General Public License
18
-- along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
--
20
-------------------------------------------------------------------------------
21
 
22
-- Purpose: Multi page register
23
-- Description:
24
--   The input wr_dat is written to the first data page. The output out_dat is
25
--   read from the last data page. The wr_en vector determines when the data
26
--   page is passed on to the next data page.
27
-- Remarks:
28
 
29
LIBRARY IEEE, common_pkg_lib;
30
USE IEEE.std_logic_1164.ALL;
31
USE common_pkg_lib.common_pkg.ALL;
32
 
33
ENTITY common_paged_reg IS
34
  GENERIC (
35
    g_data_w     : NATURAL := 8;
36
    g_nof_pages  : NATURAL := 2   -- >= 0
37
  );
38
  PORT (
39
    rst          : IN  STD_LOGIC := '0';
40
    clk          : IN  STD_LOGIC;
41
    wr_en        : IN  STD_LOGIC_VECTOR(g_nof_pages-1 DOWNTO 0);
42
    wr_dat       : IN  STD_LOGIC_VECTOR(g_data_w-1 DOWNTO 0);
43
    out_dat      : OUT STD_LOGIC_VECTOR(g_data_w-1 DOWNTO 0)
44
  );
45
END common_paged_reg;
46
 
47
 
48
ARCHITECTURE str OF common_paged_reg IS
49
 
50
  TYPE t_data IS ARRAY (NATURAL RANGE <>) OF STD_LOGIC_VECTOR(out_dat'RANGE);
51
 
52
  SIGNAL reg_dat  : t_data(g_nof_pages DOWNTO 0) := (OTHERS=>(OTHERS=>'0'));
53
 
54
BEGIN
55
 
56
  -- Wire input to first page and last page to output
57
  reg_dat(g_nof_pages) <= wr_dat;
58
  out_dat              <= reg_dat(0);
59
 
60
  -- Shift the intermediate data pages when enabled
61
  gen_pages : FOR I IN g_nof_pages-1 DOWNTO 0 GENERATE
62
    u_page : ENTITY work.common_pipeline
63
    GENERIC MAP (
64
      g_in_dat_w  => g_data_w,
65
      g_out_dat_w => g_data_w
66
    )
67
    PORT MAP (
68
      rst     => rst,
69
      clk     => clk,
70
      in_en   => wr_en(I),
71
      in_dat  => reg_dat(I+1),
72
      out_dat => reg_dat(I)
73
    );
74
  END GENERATE;
75
 
76
END str;

powered by: WebSVN 2.1.0

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