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

Subversion Repositories image_component_labeling_and_feature_extraction

[/] [image_component_labeling_and_feature_extraction/] [trunk/] [line_bufferXB.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 malikpearl
------------------------------------------------------------------------------------
2
-- Company: 
3
-- Engineer:             Benny Thörnberg
4
-- 
5
-- Create Date:    14:12:25 04/11/2008 
6
-- Design Name: 
7
-- Module Name:    line_buffer_Xb - Behavioral 
8
-- Project Name: 
9
-- Target Devices: 
10
-- Tool versions: 
11
-- Description: 
12
--
13
-- Dependencies: 
14
--
15
-- Revision: 
16
-- Revision 0.01 - File Created
17
-- Additional Comments: 
18
--
19
----------------------------------------------------------------------------------
20
library IEEE;
21
use IEEE.STD_LOGIC_1164.ALL;
22
use IEEE.STD_LOGIC_ARITH.ALL;
23
use IEEE.STD_LOGIC_UNSIGNED.ALL;
24
 
25
---- Uncomment the following library declaration if instantiating
26
---- any Xilinx primitives in this code.
27
library UNISIM;
28
use UNISIM.VComponents.all;
29
 
30
-- This entity constitutes a FIFO-register that can be used for storage of line delays 
31
-- for image processing. It is implemented as a circular buffer using one single pointer.
32
-- The address for this pointer must be driven externally by the interface signal "pointer". 
33
-- Data is first read from the memory location referenced by "pointer" to "odata" on the falling 
34
-- clock edge and then data is written to the same location from "idata" on the rising clock edge.
35
-- An additional register on the data output is clocked on the rising clockedge such that data output
36
-- appears on the output on rising edge allthough it is read on the falling edge.
37
-- The maximum size of the final line buffer is 1025 by 8 bits. The size of this line buffer can be
38
-- any size ranging from 1 to 1025 depending on the sequence of addressses driven on "pointer".
39
 
40
entity line_buffer_Xb is
41
        generic (
42
                CODE_WIDTH      : integer := 10;
43
                ADDRESS_BITS : integer := 10
44
                );
45
    Port ( idata : in  STD_LOGIC_VECTOR (CODE_WIDTH-1 downto 0); -- input data port
46
           odata : out  STD_LOGIC_VECTOR (CODE_WIDTH-1 downto 0); -- output data port
47
                          pointer : in STD_LOGIC_VECTOR (ADDRESS_BITS-1 downto 0); -- reference to a memory location
48
           ena : in  STD_LOGIC; -- must be high to enable shifting of data
49
           clk : in  STD_LOGIC);
50
end line_buffer_Xb;
51
 
52
architecture behave of line_buffer_Xb is
53
 
54
type ram_type is array((2**ADDRESS_BITS)-1 downto 0) of std_logic_vector(CODE_WIDTH-1 downto 0);
55
signal ram_array : ram_type:=(others=>(others=>'0'));
56
begin
57
 
58
  process(clk)
59
  begin
60
    if clk'event and clk ='1' then
61
      odata <= ram_array(conv_integer(pointer));
62
      if ena='1' then
63
        ram_array(conv_integer(pointer)) <= idata;
64
      end if;
65
    end if;
66
 
67
  end process;
68
end behave;
69
 
70
 

powered by: WebSVN 2.1.0

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