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

Subversion Repositories leros

[/] [leros/] [trunk/] [vhdl/] [test/] [memfmax.vhd] - Blame information for rev 4

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 martin
--
2
--  Copyright 2011 Martin Schoeberl <masca@imm.dtu.dk>,
3
--                 Technical University of Denmark, DTU Informatics. 
4
--  All rights reserved.
5
--
6
-- Redistribution and use in source and binary forms, with or without
7
-- modification, are permitted provided that the following conditions are met:
8
-- 
9
--    1. Redistributions of source code must retain the above copyright notice,
10
--       this list of conditions and the following disclaimer.
11
-- 
12
--    2. Redistributions in binary form must reproduce the above copyright
13
--       notice, this list of conditions and the following disclaimer in the
14
--       documentation and/or other materials provided with the distribution.
15
-- 
16
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER ``AS IS'' AND ANY EXPRESS
17
-- OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18
-- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
19
-- NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20
-- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21
-- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22
-- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23
-- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25
-- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
-- 
27
-- The views and conclusions contained in the software and documentation are
28
-- those of the authors and should not be interpreted as representing official
29
-- policies, either expressed or implied, of the copyright holder.
30
-- 
31
 
32
--
33
--      Just test fmax of memory with registered input and output
34
--
35
library ieee;
36
use ieee.std_logic_1164.all;
37
use ieee.numeric_std.all;
38
 
39
 
40
entity memfmax is
41
        port (
42
                clk : std_logic;
43
                din : in std_logic_vector(15 downto 0);
44
                rd_addr, wr_addr : in std_logic_vector(7 downto 0);
45
                wr : in std_logic;
46
                dout : out std_logic_vector(15 downto 0)
47
        );
48
end memfmax;
49
 
50
architecture rtl of memfmax is
51
 
52
        signal clk_int : std_logic;
53
 
54
                -- the data ram
55
        constant nwords : integer := 2 ** 8;
56
        type ram_type is array(0 to nwords-1) of std_logic_vector(15 downto 0);
57
        signal ram : ram_type;
58
 
59
        signal wr_reg : std_logic;
60
        signal wrdata, rddata : std_logic_vector(15 downto 0);
61
        signal wraddr, rdaddr : std_logic_vector(7 downto 0);
62
 
63
 
64
 
65
begin
66
 
67
--      -- Altera PLL
68
--      -- assume 20 or 50 MHz input clock
69
--      pll_inst : entity work.pll generic map(
70
--              multiply_by => 20, -- 300 MHz
71
--              divide_by => 1
72
--      )
73
--      port map (
74
--              inclk0   => clk,
75
--              c0       => clk_int
76
--      );
77
 
78
        -- Xilinx DCM
79
        -- input clock is 50 MHz
80
        -- let's go for 200 MHz ;-)
81
        pll_inst : entity work.sp3epll generic map(
82
                multiply_by => 8,
83
                divide_by => 1
84
        )
85
        port map (
86
                CLKIN_IN => clk,
87
                RST_IN => '0',
88
                CLKFX_OUT => clk_int,
89
                CLKIN_IBUFG_OUT => open,
90
                CLK0_OUT => open,
91
                LOCKED_OUT => open
92
        );
93
 
94
process (clk_int)
95
begin
96
        if rising_edge(clk_int) then
97
                if wr_reg='1' then
98
                        ram(to_integer(unsigned(wraddr))) <= wrdata;
99
                end if;
100
                rddata <= ram(to_integer(unsigned(rdaddr)));
101
                wrdata <= din;
102
                rdaddr <= rd_addr;
103
                wraddr <= wr_addr;
104
                wr_reg <= wr;
105
                dout <= rddata;
106
        end if;
107
end process;
108
 
109
end rtl;

powered by: WebSVN 2.1.0

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