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

Subversion Repositories motion_estimation_processor

[/] [motion_estimation_processor/] [trunk/] [src_me/] [concatenate64.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       = concatenate           --
18
--  version      = 1.0                   --
19
--  last update  = 1/08/06               --
20
--  author       = Jose Nunez            --
21
-------------------------------------------
22
 
23
 
24
-- FUNCTION
25
-- this unit makes sure that 8 valid pixels are assemble depending on byte address 
26
 
27
library ieee;
28
use ieee.std_logic_1164.all;
29
use IEEE.std_logic_unsigned."+";
30
 
31
entity concatenate64 is
32
        port(
33
        addr : in std_logic_vector(2 downto 0);
34
        clk : in std_logic;
35
        clear : in std_logic;
36
        reset : in std_logic;
37
        din : in std_logic_vector(63 downto 0);
38
        din2 : in std_logic_vector(63 downto 0);
39
        dout : out std_logic_vector(63 downto 0);
40
        enable : in std_logic;
41
        enable_hp_inter : in std_logic; -- working in interpolation mode
42
      quick_valid : out std_logic; --as valid but one cycle earlier
43
        valid : out std_logic);  -- indicates when 64 valid bits are in the output
44
end concatenate64;
45
 
46
 
47
architecture behav of concatenate64 is
48
 
49
type register_type is record
50
        data : std_logic_vector(63 downto 0);
51
      valid : std_logic; -- bytes are valid
52
      pipe_din : std_logic_vector(63 downto 0);
53
      pipe_din2 : std_logic_vector(63 downto 0);
54
      pipe_addr : std_logic_vector(2 downto 0);
55
      pipe_enable_hp_inter : std_logic;
56
      pipe_enable : std_logic;
57
end record;
58
 
59
signal r,r_in : register_type;
60
signal din_temp : std_logic_vector(63 downto 0);
61
 
62
begin
63
 
64
 
65
r_in.pipe_din <= din;
66
r_in.pipe_din2 <= din2;
67
r_in.pipe_addr <= addr;
68
r_in.pipe_enable_hp_inter <= enable_hp_inter;
69
r_in.pipe_enable <= enable;
70
r_in.valid <= r.pipe_enable;
71
 
72
 
73
 
74
valid <= '1' when r.valid = '1' else '0';
75
quick_valid <= '1' when r.pipe_enable= '1' else '0';
76
 
77
 
78
shift_data : process(r)
79
 
80
 
81
begin
82
 
83
 
84
   if (r.pipe_enable_hp_inter = '0') then -- when interpolating the good data is at the beginning
85
 
86
        case r.pipe_addr is
87
 
88
           when "000" =>
89
                   din_temp <= r.pipe_din;
90
           when "001" =>
91
                   din_temp <= r.pipe_din(55 downto 0)& r.pipe_din2(63 downto 56);
92
           when "010" =>
93
                   din_temp <= r.pipe_din(47 downto 0) & r.pipe_din2(63 downto 48);
94
           when "011" =>
95
                   din_temp <= r.pipe_din(39 downto 0) & r.pipe_din2(63 downto 40);
96
           when "100" =>
97
                   din_temp <= r.pipe_din(31 downto 0)& r.pipe_din2(63 downto 32);
98
           when "101" =>
99
                   din_temp <= r.pipe_din(23 downto 0)& r.pipe_din2(63 downto 24);
100
           when "110" =>
101
                   din_temp <= r.pipe_din(15 downto 0)& r.pipe_din2(63 downto 16);
102
           when "111" =>
103
                   din_temp <= r.pipe_din(7 downto 0)& r.pipe_din2(63 downto 8);
104
      when others => null;
105
    end case;
106
    else
107
 
108
        case r.pipe_addr is
109
           when "000" =>
110
                din_temp <= r.pipe_din2;
111
           when "001" =>
112
                din_temp <=  r.pipe_din2(55 downto 0) & r.pipe_din(63 downto 56);
113
           when "010" =>
114
              din_temp <= r.pipe_din2(47 downto 0) & r.pipe_din(63 downto 48);
115
           when "011" =>
116
              din_temp <= r.pipe_din2(39 downto 0) & r.pipe_din(63 downto 40);
117
           when "100" =>
118
              din_temp <= r.pipe_din2(31 downto 0) & r.pipe_din(63 downto 32);
119
           when "101" =>
120
                din_temp <= r.pipe_din2(23 downto 0) & r.pipe_din(63 downto 24);
121
           when "110" =>
122
                din_temp <= r.pipe_din2(15 downto 0) & r.pipe_din(63 downto 16);
123
           when "111" =>
124
                din_temp <= r.pipe_din2(7 downto 0) & r.pipe_din(63 downto 8);
125
    when others => null;
126
    end case;
127
    end if;
128
 
129
 
130
end process shift_data;
131
 
132
r_in.data <= din_temp;
133
 
134
dout <= r.data;
135
 
136
 
137
-- sequential part
138
 
139
regs: process (clk,clear)
140
 
141
begin
142
 
143
if (clear = '1') then
144
        r.data <= (others => '0');
145
        r.valid <= '0';
146
      r.pipe_din <= (others => '0');
147
           r.pipe_din2 <= (others => '0');
148
      r.pipe_addr <= (others => '0');
149
      r.pipe_enable_hp_inter <= '0';
150
      r.pipe_enable <= '0';
151
elsif rising_edge(clk) then
152
        if (reset = '1') then
153
                r.data <= (others => '0');
154
                r.valid <= '0';
155
                r.pipe_din <= (others => '0');
156
                 r.pipe_din2 <= (others => '0');
157
            r.pipe_addr <= (others => '0');
158
            r.pipe_enable_hp_inter <= '0';
159
            r.pipe_enable <= '0';
160
        else
161
                r <= r_in;
162
        end if;
163
end if;
164
 
165
end process regs;
166
 
167
 
168
--valid <= r.valid;
169
 
170
end behav; -- end of architecture
171
 
172
 
173
 
174
 
175
 
176
 
177
 

powered by: WebSVN 2.1.0

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