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

Subversion Repositories mkjpeg

[/] [mkjpeg/] [trunk/] [tb/] [vhdl/] [RAMSIM.VHD] - Blame information for rev 72

Go to most recent revision | 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 RAMSIM 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 RAMSIM;
43
 
44
architecture RTL of RAMSIM is
45
  type mem_type is array ((2**RAMADDR_W)-1 downto 0) of
46
                              STD_LOGIC_VECTOR(RAMDATA_W-1 downto 0);
47
 
48
  signal read_addr              : STD_LOGIC_VECTOR(RAMADDR_W-1 downto 0);
49
 
50
begin
51
 
52
 
53
  -------------------------------------------------------------------------------
54
  read_proc: -- register read address
55
  -------------------------------------------------------------------------------
56
  process (clk)
57
  begin
58
    if clk = '1' and clk'event then
59
      read_addr <= raddr;
60
    end if;
61
  end process;
62
 
63
  -------------------------------------------------------------------------------
64
  write_proc: --write access
65
  -------------------------------------------------------------------------------
66
  process (clk)
67
    variable mem                    : mem_type;
68
  begin
69
    if clk = '1' and clk'event then
70
      if we = '1'  then
71
        mem(TO_INTEGER(UNSIGNED(waddr))) := d;
72
      end if;
73
      q <= mem(TO_INTEGER(UNSIGNED(raddr)));
74
    end if;
75
  end process;
76
 
77
end RTL;

powered by: WebSVN 2.1.0

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