w11 - vhd 0.794
W11 CPU core and support modules
Loading...
Searching...
No Matches
ram_1swar_1ar_gen.vhd
Go to the documentation of this file.
1-- $Id: ram_1swar_1ar_gen.vhd 1181 2019-07-08 17:00:50Z mueller $
2-- SPDX-License-Identifier: GPL-3.0-or-later
3-- Copyright 2006-2011 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4--
5------------------------------------------------------------------------------
6-- Module Name: ram_1swar_1ar_gen - syn
7-- Description: Dual-Port RAM with with one synchronous write and two
8-- asynchronius read ports (as distributed RAM).
9-- The code is inspired by Xilinx example rams_09.vhd. The
10-- 'ram_style' attribute is set to 'distributed', this will
11-- force in XST a synthesis as distributed RAM.
12--
13-- Dependencies: -
14-- Test bench: -
15-- Target Devices: generic Spartan, Virtex
16-- Tool versions: xst 8.1-14.7; ghdl 0.18-0.31
17-- Revision History:
18-- Date Rev Version Comment
19-- 2011-11-08 422 1.0.2 now numeric_std clean
20-- 2008-03-08 123 1.0.1 use std_..._arith, not _unsigned; use unsigned()
21-- 2007-06-03 45 1.0 Initial version
22--
23-- Some synthesis results:
24-- - 2010-06-03 (r123) with ise 11.4 for xc3s1000-ft256-4:
25-- AWIDTH DWIDTH LUTl LUTm RAM16X1D MUXF5 MUXF6 MUXF7
26-- 4 16 - 32 16 0 0 0
27-- 5 16 34 64 32 0 0 0
28-- 6 16 68 128 64 32 0 0
29-- 7 16 136 256 128 64 32 0
30-- 8 16 292 512 256 144 64 32
31-- - 2007-12-31 ise 8.2.03 for xc3s1000-ft256-4:
32-- {same results as above for AW=4 and 6}
33------------------------------------------------------------------------------
34
35library ieee;
36use ieee.std_logic_1164.all;
37use ieee.numeric_std.all;
38
39use work.slvtypes.all;
40
41entity ram_1swar_1ar_gen is -- RAM, 1 sync w asyn r + 1 asyn r port
42 generic (
43 AWIDTH : positive := 4; -- address port width
44 DWIDTH : positive := 16); -- data port width
45 port (
46 CLK : in slbit; -- clock
47 WE : in slbit; -- write enable (port A)
48 ADDRA : in slv(AWIDTH-1 downto 0); -- address port A
49 ADDRB : in slv(AWIDTH-1 downto 0); -- address port B
50 DI : in slv(DWIDTH-1 downto 0); -- data in (port A)
51 DOA : out slv(DWIDTH-1 downto 0); -- data out port A
52 DOB : out slv(DWIDTH-1 downto 0) -- data out port B
53 );
55
56
57architecture syn of ram_1swar_1ar_gen is
58 constant memsize : positive := 2**AWIDTH;
59 constant datzero : slv(DWIDTH-1 downto 0) := (others=>'0');
60 type ram_type is array (memsize-1 downto 0) of slv (DWIDTH-1 downto 0);
61 signal RAM : ram_type := (others=>datzero);
62
63 attribute ram_style : string;
64 attribute ram_style of RAM : signal is "distributed";
65
66begin
67
68 proc_clk: process (CLK)
69 begin
70 if rising_edge(CLK) then
71 if WE = '1' then
72 RAM(to_integer(unsigned(ADDRA))) <= DI;
73 end if;
74 end if;
75 end process proc_clk;
76
77 DOA <= RAM(to_integer(unsigned(ADDRA)));
78 DOB <= RAM(to_integer(unsigned(ADDRB)));
79
80end syn;
( memsize- 1 downto 0) slv( DWIDTH- 1 downto 0) ram_type
positive := 2** AWIDTH memsize
ram_type :=( others => datzero) RAM
slv( DWIDTH- 1 downto 0) :=( others => '0') datzero
AWIDTH positive := 4
in DI slv( DWIDTH- 1 downto 0)
in ADDRB slv( AWIDTH- 1 downto 0)
in ADDRA slv( AWIDTH- 1 downto 0)
out DOB slv( DWIDTH- 1 downto 0)
out DOA slv( DWIDTH- 1 downto 0)
DWIDTH positive := 16
std_logic slbit
Definition: slvtypes.vhd:30
std_logic_vector slv
Definition: slvtypes.vhd:31