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

Subversion Repositories pulse_processing_algorithm

[/] [pulse_processing_algorithm/] [ddr_address_generator.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 panda_emc
-----------------------------------------------------------------------------------------------
2
--
3
--    Copyright (C) 2011 Peter Lemmens, PANDA collaboration
4
--              p.j.j.lemmens@rug.nl
5
--    http://www-panda.gsi.de
6
--
7
--    As a reference, please use:
8
--    E. Guliyev, M. Kavatsyuk, P.J.J. Lemmens, G. Tambave, H. Loehner,
9
--    "VHDL Implementation of Feature-Extraction Algorithm for the PANDA Electromagnetic Calorimeter"
10
--    Nuclear Inst. and Methods in Physics Research, A ....
11
--
12
--
13
--    This program is free software; you can redistribute it and/or modify
14
--    it under the terms of the GNU Lesser General Public License as published by
15
--    the Free Software Foundation; either version 3 of the License, or
16
--    (at your option) any later version.
17
--
18
--    This program is distributed in the hope that it will be useful,
19
--    but WITHOUT ANY WARRANTY; without even the implied warranty of
20
--    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
--    GNU Lesser General Public License for more details.
22
--
23
--    You should have received a copy of the GNU General Public License
24
--    along with this program; if not, write to the Free Software
25
--    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
26
--
27
-----------------------------------------------------------------------------------------------
28
-- Company              :       KVI (Kernfysisch Versneller Instituut  -- Groningen, The Netherlands    
29
-- Author               :       P.J.J. Lemmens
30
-- Design Name  :       Feature Extraction
31
-- Module Name  :       adc_flow_control.vhd
32
-- Description  :       The SIS3301/2 shares memory between the ADCs and VME. On the adc side
33
--                                              each controlling fpga gets a base address and a chunk of memory to write into.
34
--                                              The memory is not directly written into but through a pair of FIFOs; one
35
--                                              for the data (32bit) and one for the address(32 bit) to which you want to
36
--                                              write. This module builds 32-bit words for the data fifo from 16-bit words
37
--                                              of data from the signal-processing. This module provides the addresses from
38
--                                              the base-address to the end of the ringbuffer (baseaddress + buffersize)
39
--                                              When reset, restarted or reprogrammed, the address-generator is reset,
40
--                                              beginning at the base-address.
41
--                                              
42
-----------------------------------------------------------------------------------------------
43
library IEEE;
44
use IEEE.STD_LOGIC_1164.ALL;
45
use IEEE.STD_LOGIC_ARITH.ALL;
46
use IEEE.STD_LOGIC_UNSIGNED.ALL;
47
 
48
entity ddr_address_generator is
49
        port(   clk                                     : in    std_logic;
50
                        rst                                     : in    std_logic;
51
                        enable                          : in    std_logic;
52
                        program                         : in    std_logic;
53
                        restart                         : in    std_logic;
54
                        base_address_in : in    std_logic_vector;
55
                        buffersize_in           : in    std_logic_vector;
56
                        address_out                     : out   std_logic_vector
57
                );
58
end ddr_address_generator;
59
 
60
architecture Behavioral of ddr_address_generator is
61
 
62
        constant WIDTH                          : natural       := base_address_in'length;
63
 
64
        signal clk_S                            : std_logic := '0';
65
   signal rst_S                         : std_logic := '1';
66
        signal enable_S                 : std_logic := '0';
67
        signal program_S                        : std_logic := '0';
68
   signal restart_S                     : std_logic := '1';
69
        signal base_address_S   : std_logic_vector(WIDTH - 1 downto 0) := (others => '0');
70
        signal buffersize_S             : std_logic_vector(WIDTH - 1 downto 0) := (others => '0');
71
        signal max_address_S            : std_logic_vector(WIDTH - 1 downto 0) := (others => '0');
72
        signal address_out_S            : std_logic_vector(WIDTH - 1 downto 0) := (others => '0');
73
 
74
begin
75
 
76
        clk_S                                                                   <= clk;
77
        rst_S                                                                   <= rst;
78
        enable_S                                                                <= enable;
79
        program_S                                                       <=      program;
80
        restart_S                                                       <= restart;
81
        base_address_S                                          <= base_address_in;
82
        buffersize_S                                            <= buffersize_in;
83
        address_out                                                     <= address_out_S;
84
 
85
        address_gen     : process(clk_S)
86
        begin
87
                if rising_edge(clk_S) then
88
                        if (rst_S = '1') or (program_S = '1') or (restart_S = '1') then
89
                                address_out_S   <= base_address_S;
90
                                max_address_S   <= conv_std_logic_vector((conv_integer(base_address_S) + conv_integer(buffersize_S) - 1), 32);
91
                        else
92
                                if (enable_S = '1') then
93
                                        if (address_out_S = max_address_S) then
94
                                                address_out_S   <= base_address_S;
95
                                        else
96
                                                address_out_S   <= address_out_S + 1;
97
                                        end if;
98
                                end if;
99
                        end if;
100
                end if;
101
        end process;
102
 
103
end Behavioral;

powered by: WebSVN 2.1.0

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