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

Subversion Repositories mkjpeg

[/] [mkjpeg/] [trunk/] [design/] [BufFifo/] [SUB_RAMZ.VHD] - Blame information for rev 30

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 mikel262
--------------------------------------------------------------------------------
2
--                                                                            --
3
--                          V H D L    F I L E                                --
4
--                          COPYRIGHT (C) 2006                                --
5
--                                                                            --
6
--------------------------------------------------------------------------------
7
--                                                                            --
8
-- Title       : SUB_RAMZ                                                         --
9
-- Design      : EV_JPEG_ENC                                                         --
10
-- Author      : Michal Krepa                                                 --                                                             --                                                           --
11
--                                                                            --
12
--------------------------------------------------------------------------------
13
--
14
-- File        : SUB_RAMZ.VHD
15
-- Created     : 22/03/2009
16
--
17
--------------------------------------------------------------------------------
18
--
19
--  Description : RAM memory simulation model
20
--
21
--------------------------------------------------------------------------------
22
 
23
library IEEE;
24
  use IEEE.STD_LOGIC_1164.all;
25
  use IEEE.NUMERIC_STD.all;
26
 
27
entity SUB_RAMZ is
28
  generic
29
    (
30
      RAMADDR_W     : INTEGER := 6;
31
      RAMDATA_W     : INTEGER := 12
32
    );
33
  port (
34
        d                 : in  STD_LOGIC_VECTOR(RAMDATA_W-1 downto 0);
35
        waddr             : in  STD_LOGIC_VECTOR(RAMADDR_W-1 downto 0);
36
        raddr             : in  STD_LOGIC_VECTOR(RAMADDR_W-1 downto 0);
37
        we                : in  STD_LOGIC;
38
        clk               : in  STD_LOGIC;
39
 
40
        q                 : out STD_LOGIC_VECTOR(RAMDATA_W-1 downto 0)
41
  );
42
end SUB_RAMZ;
43
 
44
architecture RTL of SUB_RAMZ is
45
  type mem_type is array ((2**RAMADDR_W)-1 downto 0) of
46
                              STD_LOGIC_VECTOR(RAMDATA_W-1 downto 0);
47
  signal mem                    : mem_type;
48
  signal read_addr              : STD_LOGIC_VECTOR(RAMADDR_W-1 downto 0);
49
 
50
  --attribute ram_style: string;
51
  --attribute ram_style of mem : signal is "distributed";
52
 
53
 
54
begin
55
 
56
  -------------------------------------------------------------------------------
57
  q_sg:
58
  -------------------------------------------------------------------------------
59
  q <= mem(TO_INTEGER(UNSIGNED(read_addr)));
60
 
61
  -------------------------------------------------------------------------------
62
  read_proc: -- register read address
63
  -------------------------------------------------------------------------------
64
  process (clk)
65
  begin
66
    if clk = '1' and clk'event then
67
      read_addr <= raddr;
68
    end if;
69
  end process;
70
 
71
  -------------------------------------------------------------------------------
72
  write_proc: --write access
73
  -------------------------------------------------------------------------------
74
  process (clk) begin
75
    if clk = '1' and clk'event then
76
      if we = '1'  then
77
        mem(TO_INTEGER(UNSIGNED(waddr))) <= d;
78
      end if;
79
    end if;
80
  end process;
81
 
82
end RTL;

powered by: WebSVN 2.1.0

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