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

Subversion Repositories mkjpeg

[/] [mkjpeg/] [trunk/] [design/] [common/] [RAMZ.VHD] - Blame information for rev 25

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 25 mikel262
--------------------------------------------------------------------------------
2
--                                                                            --
3
--                          V H D L    F I L E                                --
4
--                          COPYRIGHT (C) 2006                                --
5
--                                                                            --
6
--------------------------------------------------------------------------------
7
--                                                                            --
8
-- Title       : RAMZ                                                         --
9
-- Design      : MDCT                                                         --
10
-- Author      : Michal Krepa                                                 --                                                             --                                                           --
11
--                                                                            --
12
--------------------------------------------------------------------------------
13
--
14
-- File        : RAMZ.VHD
15
-- Created     : Sat Mar 5 7:37 2006
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 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 RAMZ;
43
 
44
architecture RTL of 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
begin
51
 
52
  -------------------------------------------------------------------------------
53
  q_sg:
54
  -------------------------------------------------------------------------------
55
  q <= mem(TO_INTEGER(UNSIGNED(read_addr)));
56
 
57
  -------------------------------------------------------------------------------
58
  read_proc: -- register read address
59
  -------------------------------------------------------------------------------
60
  process (clk)
61
  begin
62
    if clk = '1' and clk'event then
63
      read_addr <= raddr;
64
    end if;
65
  end process;
66
 
67
  -------------------------------------------------------------------------------
68
  write_proc: --write access
69
  -------------------------------------------------------------------------------
70
  process (clk) begin
71
    if clk = '1' and clk'event then
72
      if we = '1'  then
73
        mem(TO_INTEGER(UNSIGNED(waddr))) <= d;
74
      end if;
75
    end if;
76
  end process;
77
 
78
end RTL;

powered by: WebSVN 2.1.0

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