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

Subversion Repositories memory_cores

[/] [memory_cores/] [trunk/] [Mempkg.vhd] - Blame information for rev 25

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 11 khatib
-------------------------------------------------------------------------------
2
-- Title      : Memory Package
3
-- Project    : Memory Cores
4
-------------------------------------------------------------------------------
5
-- File        : MEMPKG.VHD
6
-- Author      : Jamil Khatib  <khatib@ieee.org>
7
-- Organization: OpenIPCore Project
8
-- Created     : 2000/02/29
9
-- Last update : 2000/02/29
10
-- Platform    : 
11
-- Simulators  : Modelsim 5.2EE / Windows98
12
-- Synthesizers: Leonardo / WindowsNT
13
-- Target      : Flex10K
14
-------------------------------------------------------------------------------
15
-- Description: Memory Package
16
-------------------------------------------------------------------------------
17
-- Copyright (c) 2000 Jamil Khatib
18
-- 
19
-- This VHDL design file is an open design; you can redistribute it and/or
20
-- modify it and/or implement it under the terms of the Openip General Public
21
-- License as it is going to be published by the OpenIPCore Organization and
22
-- any coming versions of this license.
23
-- You can check the draft license at
24
-- http://www.openip.org/oc/license.html
25
 
26
-------------------------------------------------------------------------------
27
-- Revisions  :
28 15 khatib
-- Revision Number :   1
29
-- Version         :   0.1
30
-- Date            :   29th Feb 2000
31
-- Modifier        :   Jamil Khatib (khatib@ieee.org)
32
-- Desccription    :   Created
33 11 khatib
--
34
-------------------------------------------------------------------------------
35 15 khatib
-------------------------------------------------------------------------------
36
-- Revisions  :
37
-- Revision Number :   2
38
-- Version         :   0.2
39
-- Date            :   29th Mar 2000
40
-- Modifier        :   Jamil Khatib (khatib@ieee.org)
41
-- Desccription    :   Memory components are added.
42
--
43
-------------------------------------------------------------------------------
44 11 khatib
 
45 15 khatib
library ieee;
46
use ieee.std_logic_1164.all;
47 11 khatib
 
48
package mempkg is
49
 
50 15 khatib
  constant ADD_WIDTH : integer := 8;    -- Address width
51
  constant WIDTH     : integer := 4;    -- Data width
52
 
53 11 khatib
  function slv_2_int (
54 15 khatib
    SLV : std_logic_vector )
55
    return integer;
56 11 khatib
 
57
 
58 15 khatib
  component dpmem2clk
59
 
60
    generic (
61
      ADD_WIDTH :     integer := ADD_WIDTH;  -- Address width
62
      WIDTH     :     integer := WIDTH;  -- Word Width
63
      coretype  :     integer := 0);    -- memory bulding block type
64
 
65
    port (
66
      Wclk      : in  std_logic;        -- write clock
67
      Wen       : in  std_logic;        -- Write Enable
68
      Wadd      : in  std_logic_vector(ADD_WIDTH -1 downto 0);  -- Write Address
69
      Datain    : in  std_logic_vector(WIDTH -1 downto 0);  -- Input Data
70
      Rclk      : in  std_logic;        -- Read clock
71
      Ren       : in  std_logic;        -- Read Enable
72
      Radd      : in  std_logic_vector(ADD_WIDTH -1 downto 0);  -- Read Address
73
      Dataout   : out std_logic_vector(WIDTH -1 downto 0));  -- Output data
74
 
75
  end component;
76
 
77 11 khatib
 
78 15 khatib
  component dpmem
79
    generic (ADD_WIDTH :     integer := 4;
80
             WIDTH     :     integer := 8 );
81
 
82
    port (clk          : in  std_logic;
83
          reset        : in  std_logic;
84
          w_add        : in  std_logic_vector(ADD_WIDTH -1 downto 0 );
85
          r_add        : in  std_logic_vector(ADD_WIDTH -1 downto 0 );
86
          data_in      : in  std_logic_vector(WIDTH - 1 downto 0);
87
          data_out     : out std_logic_vector(WIDTH - 1 downto 0 );
88
          WR           : in  std_logic;
89
          RE           : in  std_logic);
90
  end component;
91
end mempkg;
92
 
93 11 khatib
-------------------------------------------------------------------------------
94
 
95
package body mempkg is
96 15 khatib
 
97 11 khatib
-------------------------------------------------------------------------------
98
  function slv_2_int (
99 15 khatib
    SLV                :     std_logic_vector)  -- std_logic_vector to convert
100
    return integer is
101 11 khatib
 
102 15 khatib
    variable Result    :     integer := 0;  -- conversion result
103
 
104 11 khatib
  begin
105 15 khatib
    for i in SLV'range loop
106
      Result                         := Result * 2;  -- shift the variable to left
107 11 khatib
      case SLV(i) is
108 15 khatib
        when '1' | 'H' => Result     := Result + 1;
109
        when '0' | 'L' => Result     := Result + 0;
110
        when others    => null;
111
      end case;
112
    end loop;
113
 
114
    return Result;
115
  end;
116 11 khatib
-------------------------------------------------------------------------------
117
 
118 15 khatib
end mempkg;
119 11 khatib
 
120 15 khatib
-------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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