w11 - vhd 0.794
W11 CPU core and support modules
Loading...
Searching...
No Matches
ram_1swar_gen_unisim.vhd
Go to the documentation of this file.
1-- $Id: ram_1swar_gen_unisim.vhd 1181 2019-07-08 17:00:50Z mueller $
2-- SPDX-License-Identifier: GPL-3.0-or-later
3-- Copyright 2008- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4--
5------------------------------------------------------------------------------
6-- Module Name: ram_1swar_gen_unisim - syn
7-- Description: Single-Port RAM with with one synchronous write and one
8-- asynchronius read port (as distributed RAM).
9-- Direct instantiation of Xilinx UNISIM primitives
10--
11-- Dependencies: -
12-- Test bench: -
13-- Target Devices: generic Spartan, Virtex
14-- Tool versions: ise 8.1-14.7; viv 2014.4; ghdl 0.18-0.31
15-- Revision History:
16-- Date Rev Version Comment
17-- 2008-03-08 123 1.0.1 use shorter label names
18-- 2008-03-02 122 1.0 Initial version
19--
20------------------------------------------------------------------------------
21
22library ieee;
23use ieee.std_logic_1164.all;
24
25library unisim;
26use unisim.vcomponents.ALL;
27
28use work.slvtypes.all;
29
30entity ram_1swar_gen is -- RAM, 1 sync w asyn r port
31 generic (
32 AWIDTH : positive := 4; -- address port width
33 DWIDTH : positive := 16); -- data port width
34 port (
35 CLK : in slbit; -- clock
36 WE : in slbit; -- write enable
37 ADDR : in slv(AWIDTH-1 downto 0); -- address port
38 DI : in slv(DWIDTH-1 downto 0); -- data in port
39 DO : out slv(DWIDTH-1 downto 0) -- data out port
40 );
42
43
44architecture syn of ram_1swar_gen is
45
46begin
47
48 assert AWIDTH>=4 and AWIDTH<=6
49 report "assert(AWIDTH>=4 and AWIDTH<=6): only 4..6 bit AWIDTH supported"
50 severity failure;
51
52 AW_4: if AWIDTH = 4 generate
53 GL: for i in DWIDTH-1 downto 0 generate
54 MEM : RAM16X1S
55 generic map (
56 INIT => X"0000")
57 port map (
58 O => DO(i),
59 A0 => ADDR(0),
60 A1 => ADDR(1),
61 A2 => ADDR(2),
62 A3 => ADDR(3),
63 D => DI(i),
64 WCLK => CLK,
65 WE => WE
66 );
67 end generate GL;
68 end generate AW_4;
69
70 AW_5: if AWIDTH = 5 generate
71 GL: for i in DWIDTH-1 downto 0 generate
72 MEM : RAM32X1S
73 generic map (
74 INIT => X"00000000")
75 port map (
76 O => DO(i),
77 A0 => ADDR(0),
78 A1 => ADDR(1),
79 A2 => ADDR(2),
80 A3 => ADDR(3),
81 A4 => ADDR(4),
82 D => DI(i),
83 WCLK => CLK,
84 WE => WE
85 );
86 end generate GL;
87 end generate AW_5;
88
89 AW_6: if AWIDTH = 6 generate
90 GL: for i in DWIDTH-1 downto 0 generate
91 MEM : RAM64X1S
92 generic map (
93 INIT => X"0000000000000000")
94 port map (
95 O => DO(i),
96 A0 => ADDR(0),
97 A1 => ADDR(1),
98 A2 => ADDR(2),
99 A3 => ADDR(3),
100 A4 => ADDR(4),
101 A5 => ADDR(5),
102 D => DI(i),
103 WCLK => CLK,
104 WE => WE
105 );
106 end generate GL;
107 end generate AW_6;
108
109end syn;
in ADDR slv( AWIDTH- 1 downto 0)
out DO slv( DWIDTH- 1 downto 0)
AWIDTH positive := 4
in DI slv( DWIDTH- 1 downto 0)
in CLK slbit
in WE slbit
DWIDTH positive := 16
std_logic slbit
Definition: slvtypes.vhd:30
std_logic_vector slv
Definition: slvtypes.vhd:31