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

Subversion Repositories motion_estimation_processor

[/] [motion_estimation_processor/] [trunk/] [src_me/] [reference_memory64_dp_large.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 eejlny
----------------------------------------------------------------------------
2
--  This file is a part of the LM VHDL IP LIBRARY
3
--  Copyright (C) 2009 Jose Nunez-Yanez
4
--
5
--  This program is free software; you can redistribute it and/or modify
6
--  it under the terms of the GNU General Public License as published by
7
--  the Free Software Foundation; either version 2 of the License, or
8
--  (at your option) any later version.
9
--
10
--  See the file COPYING for the full details of the license.
11
--
12
--  The license allows free and unlimited use of the library and tools for research and education purposes. 
13
--  The full LM core supports many more advanced motion estimation features and it is available under a 
14
--  low-cost commercial license. See the readme file to learn more or contact us at 
15
--  eejlny@byacom.co.uk or www.byacom.co.uk
16
--------------------------------------
17
--  entity       = reference_memory64_dp 
18
--  version      = 1.0              
19
--  last update  = 08/10/06         
20
--  author       = Jose Nunez       
21
--------------------------------------
22
 
23
 
24
-- wrapper for reference memory remaps addresses
25
 
26
LIBRARY ieee;
27
USE ieee.std_logic_1164.ALL;
28
use IEEE.Numeric_STD.all;
29
use IEEE.std_logic_unsigned."+";
30
use IEEE.std_logic_unsigned."-";
31
use IEEE.std_logic_unsigned."=";
32
 
33
entity reference_memory64_dp_large is
34
        port (
35
        we : in std_logic;
36
        addra: in std_logic_VECTOR(6 downto 0);
37
        addrb: in std_logic_VECTOR(6 downto 0);
38
        addrw : in std_logic_vector(6 downto 0);
39
        clk: in std_logic;
40
        clear : in std_logic;
41
        reset : in std_logic;
42
        dina: in std_logic_VECTOR(63 downto 0);
43
        douta: out std_logic_VECTOR(63 downto 0);
44
        doutb: out std_logic_VECTOR(63 downto 0);
45
        wea: in std_logic_vector(3 downto 0);
46
        rea : in std_logic_vector(3 downto 0);
47
        reb : in std_logic_vector(3 downto 0));
48
end reference_memory64_dp_large;
49
 
50
architecture struct of reference_memory64_dp_large is
51
 
52
component dual_port_component
53
        port (
54
        addra: IN std_logic_VECTOR(7 downto 0);
55
        addrb: IN std_logic_VECTOR(7 downto 0);
56
        clka: IN std_logic;
57
        clkb: IN std_logic;
58
        dina: IN std_logic_VECTOR(63 downto 0);
59
        douta: OUT std_logic_VECTOR(63 downto 0);
60
        doutb: OUT std_logic_VECTOR(63 downto 0);
61
        wea: IN std_logic);
62
end component;
63
 
64
 
65
type memory_read_data is array (0 to 7) of std_logic_vector(63 downto 0);
66
signal read_data1,read_data2 : memory_read_data;
67
type addr_type is array (0 to 7) of std_logic_vector(7 downto 0);
68
signal real_addra,real_addrb : addr_type;
69
signal rrea,rreb : std_logic_vector(2 downto 0);
70
signal wen : std_logic_vector(7 downto 0);
71
 
72
begin
73
 
74
control1: process(addra,addrb,addrw,wea,we,rea,reb)
75
variable vwen : std_logic_vector(7 downto 0);
76
variable vreal_addra,vreal_addrb : addr_type;
77
 
78
begin
79
 
80
vwen := (others => '0');
81
for i in 0 to 7 loop
82
        vreal_addrb(i) := reb(0) & addrb;
83
        if (wea(3 downto 1) = i and we = '1') then
84
                vreal_addra(i) := wea(0) & addrw;
85
                vwen(i) := '1';
86
        else
87
                vreal_addra(i) := rea(0) & addra;
88
        end if;
89
end loop;
90
 
91
real_addra <= vreal_addra;
92
real_addrb <= vreal_addrb;
93
wen <= vwen;
94
 
95
end process;
96
 
97
control2: process(rrea,read_data1)
98
 
99
begin
100
case rrea is
101
        when "000" => douta <= read_data1(0);
102
        when "001" => douta <= read_data1(1);
103
        when "010" => douta <= read_data1(2);
104
        when "011" => douta <= read_data1(3);
105
        when "100" => douta <= read_data1(4);
106
        when "101" => douta <= read_data1(5);
107
        when "110" => douta <= read_data1(6);
108
        when "111" => douta <= read_data1(7);
109
        when others => null;
110
end case;
111
 
112
end process;
113
 
114
control3: process(rreb,read_data1)
115
 
116
begin
117
case rreb is
118
        when "000" => doutb <= read_data2(0);
119
        when "001" => doutb <= read_data2(1);
120
        when "010" => doutb <= read_data2(2);
121
        when "011" => doutb <= read_data2(3);
122
        when "100" => doutb <= read_data2(4);
123
        when "101" => doutb <= read_data2(5);
124
        when "110" => doutb <= read_data2(6);
125
        when "111" => doutb <= read_data2(7);
126
        when others => null;
127
end case;
128
 
129
end process;
130
 
131
memory_components : for i in 0 to 7 generate
132
 
133
dual_port_component_1 : dual_port_component
134
port map (
135
        addra =>real_addra(i),
136
        addrb =>real_addrb(i),
137
        clka =>clk,
138
        clkb =>clk,
139
        dina =>dina,
140
        douta =>read_data1(i),
141
        doutb =>read_data2(i),
142
        wea =>wen(i));
143
end generate;
144
 
145
regs: process (clk,clear)
146
 
147
begin
148
 
149
if (clear = '1') then
150
        rrea <= (others => '0');
151
        rreb <= (others => '0');
152
elsif rising_edge(clk) then
153
        if (reset = '1') then
154
                rrea <= (others => '0');
155
                rreb <= (others => '0');
156
        else
157
                rrea <= rea(3 downto 1);
158
                rreb <= reb(3 downto 1);
159
        end if;
160
end if;
161
end process;
162
 
163
end;

powered by: WebSVN 2.1.0

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