SURF  1.0
DualPortRam.vhd
Go to the documentation of this file.
1 -------------------------------------------------------------------------------
2 -- File : DualPortRam.vhd
3 -- Company : SLAC National Accelerator Laboratory
4 -- Created : 2013-12-18
5 -- Last update: 2016-05-09
6 -------------------------------------------------------------------------------
7 -- Description: This module infers either Block RAM or distributed RAM
8 -------------------------------------------------------------------------------
9 -- This file is part of 'SLAC Firmware Standard Library'.
10 -- It is subject to the license terms in the LICENSE.txt file found in the
11 -- top-level directory of this distribution and at:
12 -- https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html.
13 -- No part of 'SLAC Firmware Standard Library', including this file,
14 -- may be copied, modified, propagated, or distributed except according to
15 -- the terms contained in the LICENSE.txt file.
16 -------------------------------------------------------------------------------
17 
18 library ieee;
19 use ieee.std_logic_1164.all;
20 use ieee.std_logic_unsigned.all;
21 
22 use work.StdRtlPkg.all;
23 
24 --! @see entity
25  --! @ingroup base_ram
26 entity DualPortRam is
27  -- MODE_G = {"no-change","read-first","write-first"}
28  generic (
29  TPD_G : time := 1 ns;
30  RST_POLARITY_G : sl := '1'; -- '1' for active high rst, '0' for active low
31  BRAM_EN_G : boolean := true;
32  REG_EN_G : boolean := true;
33  DOA_REG_G : boolean := false;
34  DOB_REG_G : boolean := false;
35  MODE_G : string := "read-first";
36  BYTE_WR_EN_G : boolean := false;
37  DATA_WIDTH_G : integer range 1 to (2**24) := 16;
38  BYTE_WIDTH_G : integer := 8; -- If BRAM, should be multiple of 8 or 9
39  ADDR_WIDTH_G : integer range 1 to (2**24) := 4;
40  INIT_G : slv := "0");
41  port (
42  -- Port A
43  clka : in sl := '0';
44  ena : in sl := '1';
45  wea : in sl := '0';
46  weaByte : in slv(wordCount(DATA_WIDTH_G, BYTE_WIDTH_G)-1 downto 0) := (others => '1');
47  rsta : in sl := not(RST_POLARITY_G);
48  addra : in slv(ADDR_WIDTH_G-1 downto 0) := (others => '0');
49  dina : in slv(DATA_WIDTH_G-1 downto 0) := (others => '0');
50  douta : out slv(DATA_WIDTH_G-1 downto 0);
51  regcea : in sl := '1';
52  -- Port B
53  clkb : in sl := '0';
54  enb : in sl := '1';
55  rstb : in sl := not(RST_POLARITY_G);
56  addrb : in slv(ADDR_WIDTH_G-1 downto 0) := (others => '0');
57  doutb : out slv(DATA_WIDTH_G-1 downto 0);
58  regceb : in sl := '1');
59 end DualPortRam;
60 
61 architecture mapping of DualPortRam is
62 
63  constant FORCE_RST_C : sl := not(RST_POLARITY_G);
64 
65 begin
66 
67  GEN_BRAM : if (BRAM_EN_G = true) generate
68  TrueDualPortRam_Inst : entity work.TrueDualPortRam
69  generic map (
70  TPD_G => TPD_G,
74  MODE_G => MODE_G,
79  INIT_G => INIT_G)
80  port map (
81  -- Port A
82  clka => clka,
83  ena => ena,
84  wea => wea,
85  weaByte => weaByte,
86  rsta => rsta,
87  addra => addra,
88  dina => dina,
89  douta => douta,
90  regcea => regcea,
91  -- Port B
92  clkb => clkb,
93  enb => enb,
94  web => '0',
95  rstb => rstb,
96  addrb => addrb,
97  dinb => (others => '0'),
98  doutb => doutb,
99  regceb => regceb);
100  end generate;
101 
102  GEN_LUTRAM : if (BRAM_EN_G = false) generate
103  QuadPortRam_Inst : entity work.QuadPortRam
104  generic map (
105  TPD_G => TPD_G,
107  REG_EN_G => REG_EN_G,
108  MODE_G => MODE_G,
113  INIT_G => INIT_G)
114  port map (
115  -- Port A
116  clka => clka,
117  en_a => ena,
118  wea => wea,
119  weaByte => weaByte,
120  rsta => rsta,
121  addra => addra,
122  dina => dina,
123  douta => douta,
124  -- Port B
125  clkb => clkb,
126  en_b => enb,
127  rstb => rstb,
128  addrb => addrb,
129  doutb => doutb,
130  -- Port C
131  clkc => '0',
132  en_c => '0',
133  rstc => FORCE_RST_C,
134  addrc => (others => '0'),
135  doutc => open,
136  -- Port C
137  clkd => '0',
138  en_d => '0',
139  rstd => FORCE_RST_C,
140  addrd => (others => '0'),
141  doutd => open);
142  end generate;
143 
144 end mapping;
in enbsl := '1'
Definition: DualPortRam.vhd:54
in en_bsl := '1'
Definition: QuadPortRam.vhd:50
in weasl := '0'
Definition: QuadPortRam.vhd:42
in regceasl := '1'
Definition: DualPortRam.vhd:51
BRAM_EN_Gboolean := true
Definition: DualPortRam.vhd:31
in rstdsl :=not ( RST_POLARITY_G)
Definition: QuadPortRam.vhd:63
in dinaslv( DATA_WIDTH_G- 1 downto 0) :=( others => '0')
Definition: QuadPortRam.vhd:46
in weaByteslv( wordCount( DATA_WIDTH_G, BYTE_WIDTH_G)- 1 downto 0) :=( others => '0')
Definition: QuadPortRam.vhd:43
in rstbsl :=not ( RST_POLARITY_G)
ADDR_WIDTH_Ginteger range 1 to ( 2** 24):= 9
in clkasl := '0'
Definition: QuadPortRam.vhd:40
BYTE_WIDTH_Ginteger := 8
Definition: QuadPortRam.vhd:35
BYTE_WR_EN_Gboolean := false
Definition: QuadPortRam.vhd:33
std_logic sl
Definition: StdRtlPkg.vhd:28
TPD_Gtime := 1 ns
sl :=not ( RST_POLARITY_G) FORCE_RST_C
Definition: DualPortRam.vhd:63
out doutbslv( DATA_WIDTH_G- 1 downto 0)
Definition: DualPortRam.vhd:57
in weaByteslv( wordCount( DATA_WIDTH_G, BYTE_WIDTH_G)- 1 downto 0) :=( others => '0')
TPD_Gtime := 1 ns
Definition: DualPortRam.vhd:29
in en_asl := '1'
Definition: QuadPortRam.vhd:41
DATA_WIDTH_Ginteger range 1 to ( 2** 24):= 18
_library_ ieeeieee
Definition: WatchDogRst.vhd:18
BYTE_WR_EN_Gboolean := false
ADDR_WIDTH_Ginteger range 1 to ( 2** 24):= 4
Definition: DualPortRam.vhd:39
ADDR_WIDTH_Ginteger range 1 to ( 2** 24):= 4
Definition: QuadPortRam.vhd:36
MODE_Gstring := "read-first"
Definition: DualPortRam.vhd:35
out doutaslv( DATA_WIDTH_G- 1 downto 0)
out doutdslv( DATA_WIDTH_G- 1 downto 0)
Definition: QuadPortRam.vhd:65
in clkasl := '0'
Definition: DualPortRam.vhd:43
BYTE_WR_EN_Gboolean := false
Definition: DualPortRam.vhd:36
TPD_Gtime := 1 ns
Definition: QuadPortRam.vhd:29
in clkcsl := '0'
Definition: QuadPortRam.vhd:56
out doutaslv( DATA_WIDTH_G- 1 downto 0)
Definition: QuadPortRam.vhd:47
MODE_Gstring := "read-first"
Definition: QuadPortRam.vhd:32
in clkbsl := '0'
Definition: DualPortRam.vhd:53
DOB_REG_Gboolean := false
Definition: DualPortRam.vhd:34
in addraslv( ADDR_WIDTH_G- 1 downto 0) :=( others => '0')
Definition: QuadPortRam.vhd:45
INIT_Gslv := "0"
Definition: DualPortRam.vhd:40
out doutaslv( DATA_WIDTH_G- 1 downto 0)
Definition: DualPortRam.vhd:50
out doutbslv( DATA_WIDTH_G- 1 downto 0)
Definition: QuadPortRam.vhd:53
in enasl := '1'
Definition: DualPortRam.vhd:44
DOB_REG_Gboolean := false
in rstcsl :=not ( RST_POLARITY_G)
Definition: QuadPortRam.vhd:57
out doutcslv( DATA_WIDTH_G- 1 downto 0)
Definition: QuadPortRam.vhd:59
in addrbslv( ADDR_WIDTH_G- 1 downto 0) :=( others => '0')
Definition: DualPortRam.vhd:56
RST_POLARITY_Gsl := '1'
in addrcslv( ADDR_WIDTH_G- 1 downto 0) :=( others => '0')
Definition: QuadPortRam.vhd:58
in regcebsl := '1'
in weaByteslv( wordCount( DATA_WIDTH_G, BYTE_WIDTH_G)- 1 downto 0) :=( others => '1')
Definition: DualPortRam.vhd:46
in weasl := '0'
Definition: DualPortRam.vhd:45
in regceasl := '1'
DATA_WIDTH_Ginteger range 1 to ( 2** 24):= 16
Definition: DualPortRam.vhd:37
INIT_Gslv := "0"
Definition: QuadPortRam.vhd:37
in en_csl := '1'
Definition: QuadPortRam.vhd:55
in rstasl :=not ( RST_POLARITY_G)
Definition: DualPortRam.vhd:47
in clkbsl := '0'
BYTE_WIDTH_Ginteger := 8
Definition: DualPortRam.vhd:38
in addraslv( ADDR_WIDTH_G- 1 downto 0) :=( others => '0')
in dinaslv( DATA_WIDTH_G- 1 downto 0) :=( others => '0')
Definition: DualPortRam.vhd:49
REG_EN_Gboolean := true
Definition: DualPortRam.vhd:32
DOA_REG_Gboolean := false
Definition: DualPortRam.vhd:33
BYTE_WIDTH_Ginteger := 8
DOA_REG_Gboolean := false
in addrdslv( ADDR_WIDTH_G- 1 downto 0) :=( others => '0')
Definition: QuadPortRam.vhd:64
in rstasl :=not ( RST_POLARITY_G)
RST_POLARITY_Gsl := '1'
Definition: QuadPortRam.vhd:30
out doutbslv( DATA_WIDTH_G- 1 downto 0)
in addraslv( ADDR_WIDTH_G- 1 downto 0) :=( others => '0')
Definition: DualPortRam.vhd:48
in addrbslv( ADDR_WIDTH_G- 1 downto 0) :=( others => '0')
Definition: QuadPortRam.vhd:52
MODE_Gstring := "read-first"
in clkasl := '0'
in rstasl :=not ( RST_POLARITY_G)
Definition: QuadPortRam.vhd:44
in rstbsl :=not ( RST_POLARITY_G)
Definition: DualPortRam.vhd:55
in regcebsl := '1'
Definition: DualPortRam.vhd:58
in rstbsl :=not ( RST_POLARITY_G)
Definition: QuadPortRam.vhd:51
REG_EN_Gboolean := true
Definition: QuadPortRam.vhd:31
in clkbsl := '0'
Definition: QuadPortRam.vhd:49
DATA_WIDTH_Ginteger range 1 to ( 2** 24):= 16
Definition: QuadPortRam.vhd:34
in dinaslv( DATA_WIDTH_G- 1 downto 0) :=( others => '0')
in dinbslv( DATA_WIDTH_G- 1 downto 0) :=( others => '0')
std_logic_vector slv
Definition: StdRtlPkg.vhd:29
in clkdsl := '0'
Definition: QuadPortRam.vhd:62
RST_POLARITY_Gsl := '1'
Definition: DualPortRam.vhd:30
in addrbslv( ADDR_WIDTH_G- 1 downto 0) :=( others => '0')
in en_dsl := '1'
Definition: QuadPortRam.vhd:61