1 |
3 |
Andrewski |
--------------------------------------------------------------------------------
|
2 |
13 |
Andrewski |
--This file is part of fpga_gpib_controller.
|
3 |
|
|
--
|
4 |
|
|
-- Fpga_gpib_controller is free software: you can redistribute it and/or modify
|
5 |
|
|
-- it under the terms of the GNU General Public License as published by
|
6 |
|
|
-- the Free Software Foundation, either version 3 of the License, or
|
7 |
|
|
-- (at your option) any later version.
|
8 |
|
|
--
|
9 |
|
|
-- Fpga_gpib_controller is distributed in the hope that it will be useful,
|
10 |
|
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 |
|
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12 |
|
|
-- GNU General Public License for more details.
|
13 |
|
|
|
14 |
|
|
-- You should have received a copy of the GNU General Public License
|
15 |
|
|
-- along with Fpga_gpib_controller. If not, see <http://www.gnu.org/licenses/>.
|
16 |
|
|
--------------------------------------------------------------------------------
|
17 |
3 |
Andrewski |
-- Entity: MemoryBlock
|
18 |
|
|
-- Date:2011-11-14
|
19 |
13 |
Andrewski |
-- Author: Andrzej Paluch
|
20 |
3 |
Andrewski |
--
|
21 |
|
|
-- Description ${cursor}
|
22 |
|
|
--------------------------------------------------------------------------------
|
23 |
|
|
library ieee;
|
24 |
|
|
use ieee.std_logic_1164.all;
|
25 |
|
|
use ieee.std_logic_unsigned.all;
|
26 |
|
|
|
27 |
|
|
library UNISIM;
|
28 |
|
|
use UNISIM.vcomponents.all;
|
29 |
|
|
|
30 |
|
|
use work.utilPkg.all;
|
31 |
|
|
use work.helperComponents.all;
|
32 |
|
|
|
33 |
|
|
|
34 |
|
|
entity MemoryBlock is
|
35 |
|
|
port (
|
36 |
|
|
reset : in std_logic;
|
37 |
|
|
clk : in std_logic;
|
38 |
|
|
-------------------------------------------------
|
39 |
|
|
p1_addr : in std_logic_vector(10 downto 0);
|
40 |
|
|
p1_data_in : in std_logic_vector(7 downto 0);
|
41 |
|
|
p1_strobe : in std_logic;
|
42 |
|
|
p1_data_out : out std_logic_vector(7 downto 0);
|
43 |
|
|
-------------------------------------------------
|
44 |
|
|
p2_addr : in std_logic_vector(10 downto 0);
|
45 |
|
|
p2_data_in : in std_logic_vector(7 downto 0);
|
46 |
|
|
p2_strobe : in std_logic;
|
47 |
|
|
p2_data_out : out std_logic_vector(7 downto 0)
|
48 |
|
|
);
|
49 |
|
|
end MemoryBlock;
|
50 |
|
|
|
51 |
|
|
architecture arch of MemoryBlock is
|
52 |
|
|
|
53 |
|
|
constant ADDR_WIDTH : integer := 11;
|
54 |
|
|
constant DATA_WIDTH : integer := 8;
|
55 |
|
|
|
56 |
|
|
|
57 |
|
|
signal m_p1_parity_in, m_p1_parity_out : std_logic_vector(0 downto 0);
|
58 |
|
|
signal m_p1_data_in, m_p1_data_out :
|
59 |
|
|
std_logic_vector((DATA_WIDTH-1) downto 0);
|
60 |
|
|
signal m_p1_addr : std_logic_vector((ADDR_WIDTH-1) downto 0);
|
61 |
|
|
signal m_p1_clk, m_p1_en, m_p1_ssr, m_p1_we : std_logic;
|
62 |
|
|
|
63 |
|
|
signal m_p2_parity_in, m_p2_parity_out : std_logic_vector(0 downto 0);
|
64 |
|
|
signal m_p2_data_in, m_p2_data_out :
|
65 |
|
|
std_logic_vector((DATA_WIDTH-1) downto 0);
|
66 |
|
|
signal m_p2_addr : std_logic_vector((ADDR_WIDTH-1) downto 0);
|
67 |
|
|
signal m_p2_clk, m_p2_en, m_p2_ssr, m_p2_we : std_logic;
|
68 |
|
|
|
69 |
|
|
begin
|
70 |
|
|
|
71 |
|
|
m_p1_en <= '1';
|
72 |
|
|
m_p2_en <= '1';
|
73 |
|
|
|
74 |
|
|
m_p1_ssr <= reset;
|
75 |
|
|
m_p2_ssr <= reset;
|
76 |
|
|
|
77 |
|
|
m_p1_addr <= p1_addr;
|
78 |
|
|
m_p2_addr <= p2_addr;
|
79 |
|
|
|
80 |
|
|
p1_data_out <= m_p1_data_out;
|
81 |
|
|
p2_data_out <= m_p2_data_out;
|
82 |
|
|
|
83 |
|
|
m_p1_data_in <= p1_data_in;
|
84 |
|
|
m_p2_data_in <= p2_data_in;
|
85 |
|
|
|
86 |
|
|
m_p1_clk <= clk;
|
87 |
|
|
m_p2_clk <= clk;
|
88 |
|
|
|
89 |
|
|
m_p1_we <= p1_strobe;
|
90 |
|
|
m_p2_we <= p2_strobe;
|
91 |
|
|
|
92 |
|
|
-- RAMB16_S9_S9: Virtex-II/II-Pro, Spartan-3/3E 2k x 8 + 1 Parity bit Dual-Port RAM
|
93 |
|
|
-- Xilinx HDL Language Template, version 9.1i
|
94 |
|
|
|
95 |
|
|
RAMB16_S9_S9_inst : RAMB16_S9_S9
|
96 |
|
|
generic map (
|
97 |
|
|
INIT_A => X"000", -- Value of output RAM registers on Port A at startup
|
98 |
|
|
INIT_B => X"000", -- Value of output RAM registers on Port B at startup
|
99 |
|
|
SRVAL_A => X"000", -- Port A ouput value upon SSR assertion
|
100 |
|
|
SRVAL_B => X"000", -- Port B ouput value upon SSR assertion
|
101 |
|
|
WRITE_MODE_A => "WRITE_FIRST", -- WRITE_FIRST, READ_FIRST or NO_CHANGE
|
102 |
|
|
WRITE_MODE_B => "WRITE_FIRST", -- WRITE_FIRST, READ_FIRST or NO_CHANGE
|
103 |
|
|
SIM_COLLISION_CHECK => "ALL", -- "NONE", "WARNING", "GENERATE_X_ONLY", "ALL"
|
104 |
|
|
-- The following INIT_xx declarations specify the initial contents of the RAM
|
105 |
|
|
-- Address 0 to 511
|
106 |
|
|
INIT_00 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
107 |
|
|
INIT_01 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
108 |
|
|
INIT_02 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
109 |
|
|
INIT_03 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
110 |
|
|
INIT_04 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
111 |
|
|
INIT_05 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
112 |
|
|
INIT_06 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
113 |
|
|
INIT_07 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
114 |
|
|
INIT_08 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
115 |
|
|
INIT_09 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
116 |
|
|
INIT_0A => X"0000000000000000000000000000000000000000000000000000000000000000",
|
117 |
|
|
INIT_0B => X"0000000000000000000000000000000000000000000000000000000000000000",
|
118 |
|
|
INIT_0C => X"0000000000000000000000000000000000000000000000000000000000000000",
|
119 |
|
|
INIT_0D => X"0000000000000000000000000000000000000000000000000000000000000000",
|
120 |
|
|
INIT_0E => X"0000000000000000000000000000000000000000000000000000000000000000",
|
121 |
|
|
INIT_0F => X"0000000000000000000000000000000000000000000000000000000000000000",
|
122 |
|
|
-- Address 512 to 1023
|
123 |
|
|
INIT_10 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
124 |
|
|
INIT_11 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
125 |
|
|
INIT_12 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
126 |
|
|
INIT_13 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
127 |
|
|
INIT_14 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
128 |
|
|
INIT_15 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
129 |
|
|
INIT_16 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
130 |
|
|
INIT_17 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
131 |
|
|
INIT_18 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
132 |
|
|
INIT_19 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
133 |
|
|
INIT_1A => X"0000000000000000000000000000000000000000000000000000000000000000",
|
134 |
|
|
INIT_1B => X"0000000000000000000000000000000000000000000000000000000000000000",
|
135 |
|
|
INIT_1C => X"0000000000000000000000000000000000000000000000000000000000000000",
|
136 |
|
|
INIT_1D => X"0000000000000000000000000000000000000000000000000000000000000000",
|
137 |
|
|
INIT_1E => X"0000000000000000000000000000000000000000000000000000000000000000",
|
138 |
|
|
INIT_1F => X"0000000000000000000000000000000000000000000000000000000000000000",
|
139 |
|
|
-- Address 1024 to 1535
|
140 |
|
|
INIT_20 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
141 |
|
|
INIT_21 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
142 |
|
|
INIT_22 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
143 |
|
|
INIT_23 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
144 |
|
|
INIT_24 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
145 |
|
|
INIT_25 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
146 |
|
|
INIT_26 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
147 |
|
|
INIT_27 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
148 |
|
|
INIT_28 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
149 |
|
|
INIT_29 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
150 |
|
|
INIT_2A => X"0000000000000000000000000000000000000000000000000000000000000000",
|
151 |
|
|
INIT_2B => X"0000000000000000000000000000000000000000000000000000000000000000",
|
152 |
|
|
INIT_2C => X"0000000000000000000000000000000000000000000000000000000000000000",
|
153 |
|
|
INIT_2D => X"0000000000000000000000000000000000000000000000000000000000000000",
|
154 |
|
|
INIT_2E => X"0000000000000000000000000000000000000000000000000000000000000000",
|
155 |
|
|
INIT_2F => X"0000000000000000000000000000000000000000000000000000000000000000",
|
156 |
|
|
-- Address 1536 to 2047
|
157 |
|
|
INIT_30 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
158 |
|
|
INIT_31 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
159 |
|
|
INIT_32 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
160 |
|
|
INIT_33 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
161 |
|
|
INIT_34 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
162 |
|
|
INIT_35 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
163 |
|
|
INIT_36 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
164 |
|
|
INIT_37 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
165 |
|
|
INIT_38 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
166 |
|
|
INIT_39 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
167 |
|
|
INIT_3A => X"0000000000000000000000000000000000000000000000000000000000000000",
|
168 |
|
|
INIT_3B => X"0000000000000000000000000000000000000000000000000000000000000000",
|
169 |
|
|
INIT_3C => X"0000000000000000000000000000000000000000000000000000000000000000",
|
170 |
|
|
INIT_3D => X"0000000000000000000000000000000000000000000000000000000000000000",
|
171 |
|
|
INIT_3E => X"0000000000000000000000000000000000000000000000000000000000000000",
|
172 |
|
|
INIT_3F => X"0000000000000000000000000000000000000000000000000000000000000000",
|
173 |
|
|
-- The next set of INITP_xx are for the parity bits
|
174 |
|
|
-- Address 0 to 511
|
175 |
|
|
INITP_00 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
176 |
|
|
INITP_01 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
177 |
|
|
-- Address 512 to 1023
|
178 |
|
|
INITP_02 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
179 |
|
|
INITP_03 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
180 |
|
|
-- Address 1024 to 1535
|
181 |
|
|
INITP_04 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
182 |
|
|
INITP_05 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
183 |
|
|
-- Address 1536 to 2047
|
184 |
|
|
INITP_06 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
185 |
|
|
INITP_07 => X"0000000000000000000000000000000000000000000000000000000000000000")
|
186 |
|
|
port map (
|
187 |
|
|
DOA => m_p1_data_out, -- Port A 8-bit Data Output
|
188 |
|
|
DOB => m_p2_data_out, -- Port B 8-bit Data Output
|
189 |
|
|
DOPA => m_p1_parity_out, -- Port A 1-bit Parity Output
|
190 |
|
|
DOPB => m_p2_parity_out, -- Port B 1-bit Parity Output
|
191 |
|
|
ADDRA => m_p1_addr, -- Port A 11-bit Address Input
|
192 |
|
|
ADDRB => m_p2_addr, -- Port B 11-bit Address Input
|
193 |
|
|
CLKA => m_p1_clk, -- Port A Clock
|
194 |
|
|
CLKB => m_p2_clk, -- Port B Clock
|
195 |
|
|
DIA => m_p1_data_in, -- Port A 8-bit Data Input
|
196 |
|
|
DIB => m_p2_data_in, -- Port B 8-bit Data Input
|
197 |
|
|
DIPA => m_p1_parity_in, -- Port A 1-bit parity Input
|
198 |
|
|
DIPB => m_p2_parity_in, -- Port-B 1-bit parity Input
|
199 |
|
|
ENA => m_p1_en, -- Port A RAM Enable Input
|
200 |
|
|
ENB => m_p2_en, -- PortB RAM Enable Input
|
201 |
|
|
SSRA => m_p1_ssr, -- Port A Synchronous Set/Reset Input
|
202 |
|
|
SSRB => m_p2_ssr, -- Port B Synchronous Set/Reset Input
|
203 |
|
|
WEA => m_p1_we, -- Port A Write Enable Input
|
204 |
|
|
WEB => m_p2_we -- Port B Write Enable Input
|
205 |
|
|
);
|
206 |
|
|
|
207 |
|
|
end arch;
|
208 |
|
|
|