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

Subversion Repositories w11

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

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

Line No. Rev Author Line
1 13 wfjm
-- $Id: ram_1swar_gen.vhd 422 2011-11-10 18:44:06Z mueller $
2 2 wfjm
--
3 13 wfjm
-- Copyright 2006-2011 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4 2 wfjm
--
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 13 wfjm
-- Tool versions:  xst 8.2, 9.1, 9.2, 13.1; ghdl 0.18-0.29
26 2 wfjm
-- Revision History: 
27
-- Date         Rev Version  Comment
28 13 wfjm
-- 2011-11-08   422   1.0.2  now numeric_std clean
29
-- 2008-03-08   123   1.0.1  use std_..._arith, not _unsigned; use unsigned()
30 2 wfjm
-- 2007-06-03    45   1.0    Initial version 
31
--
32
-- Some synthesis results:
33
-- - 2007-12-31 ise 8.2.03 for xc3s1000-ft256-4:
34
--   AWIDTH DWIDTH  LUTl LUTm   Comments
35
--        4     16     -   16   16*RAM16X1S
36
--        5     16     -   32   16*RAM32X1S
37
--        6     16    18   64   32*RAM32X1S  Note: A(4) via F5MUX, A(5) via LUT
38
------------------------------------------------------------------------------
39
 
40
library ieee;
41
use ieee.std_logic_1164.all;
42 13 wfjm
use ieee.numeric_std.all;
43 2 wfjm
 
44
use work.slvtypes.all;
45
 
46
entity ram_1swar_gen is                 -- RAM, 1 sync w asyn r port
47
  generic (
48
    AWIDTH : positive :=  4;            -- address port width
49
    DWIDTH : positive := 16);           -- data port width
50
  port (
51
    CLK  : in slbit;                    -- clock
52
    WE   : in slbit;                    -- write enable
53
    ADDR : in slv(AWIDTH-1 downto 0);   -- address port
54
    DI   : in slv(DWIDTH-1 downto 0);   -- data in port
55
    DO   : out slv(DWIDTH-1 downto 0)   -- data out port
56
  );
57
end ram_1swar_gen;
58
 
59
 
60
architecture syn of ram_1swar_gen is
61
  constant memsize : positive := 2**AWIDTH;
62
  constant datzero : slv(DWIDTH-1 downto 0) := (others=>'0');
63
  type ram_type is array (memsize-1 downto 0) of slv (DWIDTH-1 downto 0);
64
  signal RAM : ram_type := (others=>datzero);
65
 
66
  attribute ram_style : string;
67
  attribute ram_style of RAM : signal is "distributed";
68
 
69
begin
70
 
71
  proc_clk: process (CLK)
72
  begin
73 13 wfjm
    if rising_edge(CLK) then
74 2 wfjm
      if WE = '1' then
75 13 wfjm
        RAM(to_integer(unsigned(ADDR))) <= DI;
76 2 wfjm
      end if;
77
    end if;
78
  end process proc_clk;
79
 
80 13 wfjm
  DO <= RAM(to_integer(unsigned(ADDR)));
81 2 wfjm
 
82
end syn;

powered by: WebSVN 2.1.0

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