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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.74/] [rtl/] [vlib/] [memlib/] [ram_1swar_gen.vhd] - Blame information for rev 2

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 wfjm
-- $Id: ram_1swar_gen.vhd 314 2010-07-09 17:38:41Z mueller $
2
--
3
-- Copyright 2006-2008 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4
--
5
-- This program is free software; you may redistribute and/or modify it under
6
-- the terms of the GNU General Public License as published by the Free
7
-- Software Foundation, either version 2, or at your option any later version.
8
--
9
-- This program is distributed in the hope that it will be useful, but
10
-- WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
11
-- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12
-- for complete details.
13
--
14
------------------------------------------------------------------------------
15
-- Module Name:    ram_1swar_gen - syn
16
-- Description:    Single-Port RAM with with one synchronous write and one
17
--                 asynchronius read port (as distributed RAM).
18
--                 The code is inspired by Xilinx example rams_04.vhd. The
19
--                 'ram_style' attribute is set to 'distributed', this will
20
--                 force in XST a synthesis as distributed RAM.
21
--
22
-- Dependencies:   -
23
-- Test bench:     -
24
-- Target Devices: generic Spartan, Virtex
25
-- Tool versions:  xst 8.1, 8.2, 9.1, 9.2; ghdl 0.18-0.25
26
-- Revision History: 
27
-- Date         Rev Version  Comment
28
-- 2008-03-08   123   1.0.1  use std_logic_arith, not _unsigned; use unsigned()
29
-- 2007-06-03    45   1.0    Initial version 
30
--
31
-- Some synthesis results:
32
-- - 2007-12-31 ise 8.2.03 for xc3s1000-ft256-4:
33
--   AWIDTH DWIDTH  LUTl LUTm   Comments
34
--        4     16     -   16   16*RAM16X1S
35
--        5     16     -   32   16*RAM32X1S
36
--        6     16    18   64   32*RAM32X1S  Note: A(4) via F5MUX, A(5) via LUT
37
------------------------------------------------------------------------------
38
 
39
library ieee;
40
use ieee.std_logic_1164.all;
41
use ieee.std_logic_arith.all;
42
 
43
use work.slvtypes.all;
44
 
45
entity ram_1swar_gen is                 -- RAM, 1 sync w asyn r port
46
  generic (
47
    AWIDTH : positive :=  4;            -- address port width
48
    DWIDTH : positive := 16);           -- data port width
49
  port (
50
    CLK  : in slbit;                    -- clock
51
    WE   : in slbit;                    -- write enable
52
    ADDR : in slv(AWIDTH-1 downto 0);   -- address port
53
    DI   : in slv(DWIDTH-1 downto 0);   -- data in port
54
    DO   : out slv(DWIDTH-1 downto 0)   -- data out port
55
  );
56
end ram_1swar_gen;
57
 
58
 
59
architecture syn of ram_1swar_gen is
60
  constant memsize : positive := 2**AWIDTH;
61
  constant datzero : slv(DWIDTH-1 downto 0) := (others=>'0');
62
  type ram_type is array (memsize-1 downto 0) of slv (DWIDTH-1 downto 0);
63
  signal RAM : ram_type := (others=>datzero);
64
 
65
  attribute ram_style : string;
66
  attribute ram_style of RAM : signal is "distributed";
67
 
68
begin
69
 
70
  proc_clk: process (CLK)
71
  begin
72
    if CLK'event and CLK='1' then
73
      if WE = '1' then
74
        RAM(conv_integer(unsigned(ADDR))) <= DI;
75
      end if;
76
    end if;
77
  end process proc_clk;
78
 
79
  DO <= RAM(conv_integer(unsigned(ADDR)));
80
 
81
end syn;

powered by: WebSVN 2.1.0

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