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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.7/] [rtl/] [vlib/] [memlib/] [ram_1swar_1ar_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_1ar_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_1ar_gen - syn
16
-- Description:    Dual-Port RAM with with one synchronous write and two
17
--                 asynchronius read ports (as distributed RAM).
18
--                 The code is inspired by Xilinx example rams_09.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
-- - 2010-06-03 ise 11.4 for xc3s1000-ft256-4:
33
--   AWIDTH DWIDTH  LUTl LUTm   Comments
34
--        4     16     -   32    16*RAM16X1D
35
--        5     16    34   64    32*RAM16X1D
36
--        6     16    68  128    64*RAM16X1D, 32*MUXF5
37
--        7     16   136  256   128*RAM16X1D, 64*MUXF5, 32*MUXF6
38
--        8     16   292  512   256*RAM16X1D,144*MUXF5, 64*MUXF6, 32*MUXF7  
39
-- - 2007-12-31 ise 8.2.03 for xc3s1000-ft256-4:
40
--   {same results as above for AW=4 and 6}
41
------------------------------------------------------------------------------
42
 
43
library ieee;
44
use ieee.std_logic_1164.all;
45
use ieee.std_logic_arith.all;
46
 
47
use work.slvtypes.all;
48
 
49
entity ram_1swar_1ar_gen is             -- RAM, 1 sync w asyn r + 1 asyn r port
50
  generic (
51
    AWIDTH : positive :=  4;            -- address port width
52
    DWIDTH : positive := 16);           -- data port width
53
  port (
54
    CLK   : in slbit;                   -- clock
55
    WE    : in slbit;                   -- write enable (port A)
56
    ADDRA : in slv(AWIDTH-1 downto 0);  -- address port A
57
    ADDRB : in slv(AWIDTH-1 downto 0);  -- address port B
58
    DI    : in slv(DWIDTH-1 downto 0);  -- data in (port A)
59
    DOA   : out slv(DWIDTH-1 downto 0); -- data out port A
60
    DOB   : out slv(DWIDTH-1 downto 0)  -- data out port B
61
  );
62
end ram_1swar_1ar_gen;
63
 
64
 
65
architecture syn of ram_1swar_1ar_gen is
66
  constant memsize : positive := 2**AWIDTH;
67
  constant datzero : slv(DWIDTH-1 downto 0) := (others=>'0');
68
  type ram_type is array (memsize-1 downto 0) of slv (DWIDTH-1 downto 0);
69
  signal RAM : ram_type := (others=>datzero);
70
 
71
  attribute ram_style : string;
72
  attribute ram_style of RAM : signal is "distributed";
73
 
74
begin
75
 
76
  proc_clk: process (CLK)
77
  begin
78
    if CLK'event and CLK='1' then
79
      if WE = '1' then
80
        RAM(conv_integer(unsigned(ADDRA))) <= DI;
81
      end if;
82
    end if;
83
  end process proc_clk;
84
 
85
  DOA <= RAM(conv_integer(unsigned(ADDRA)));
86
  DOB <= RAM(conv_integer(unsigned(ADDRB)));
87
 
88
end syn;

powered by: WebSVN 2.1.0

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