| 1 |
31 |
robfinch |
// ============================================================================
|
| 2 |
|
|
// __
|
| 3 |
32 |
robfinch |
// \\__/ o\ (C) 2018-2023 Robert Finch, Waterloo
|
| 4 |
31 |
robfinch |
// \ __ / All rights reserved.
|
| 5 |
|
|
// \/_// robfinch@finitron.ca
|
| 6 |
|
|
// ||
|
| 7 |
|
|
//
|
| 8 |
|
|
//
|
| 9 |
|
|
// BSD 3-Clause License
|
| 10 |
|
|
// Redistribution and use in source and binary forms, with or without
|
| 11 |
|
|
// modification, are permitted provided that the following conditions are met:
|
| 12 |
|
|
//
|
| 13 |
|
|
// 1. Redistributions of source code must retain the above copyright notice, this
|
| 14 |
|
|
// list of conditions and the following disclaimer.
|
| 15 |
|
|
//
|
| 16 |
|
|
// 2. Redistributions in binary form must reproduce the above copyright notice,
|
| 17 |
|
|
// this list of conditions and the following disclaimer in the documentation
|
| 18 |
|
|
// and/or other materials provided with the distribution.
|
| 19 |
|
|
//
|
| 20 |
|
|
// 3. Neither the name of the copyright holder nor the names of its
|
| 21 |
|
|
// contributors may be used to endorse or promote products derived from
|
| 22 |
|
|
// this software without specific prior written permission.
|
| 23 |
|
|
//
|
| 24 |
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
| 25 |
|
|
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| 26 |
|
|
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
| 27 |
|
|
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
| 28 |
|
|
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
| 29 |
|
|
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
| 30 |
|
|
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
| 31 |
|
|
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
| 32 |
|
|
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 33 |
|
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 34 |
|
|
//
|
| 35 |
|
|
// ============================================================================
|
| 36 |
|
|
//
|
| 37 |
32 |
robfinch |
`define VENDOR_XILINX
|
| 38 |
|
|
|
| 39 |
31 |
robfinch |
module rfTextScreenRam(clka_i, csa_i, wea_i, sela_i, adra_i, data_i, data_o,
|
| 40 |
|
|
clkb_i, csb_i, web_i, selb_i, adrb_i, datb_i, datb_o);
|
| 41 |
|
|
input clka_i;
|
| 42 |
|
|
input csa_i;
|
| 43 |
|
|
input wea_i;
|
| 44 |
|
|
input [7:0] sela_i;
|
| 45 |
32 |
robfinch |
input [16:3] adra_i;
|
| 46 |
31 |
robfinch |
input [63:0] data_i;
|
| 47 |
|
|
output [63:0] data_o;
|
| 48 |
|
|
input clkb_i;
|
| 49 |
|
|
input csb_i;
|
| 50 |
|
|
input web_i;
|
| 51 |
|
|
input [7:0] selb_i;
|
| 52 |
32 |
robfinch |
input [16:3] adrb_i;
|
| 53 |
31 |
robfinch |
input [63:0] datb_i;
|
| 54 |
|
|
output [63:0] datb_o;
|
| 55 |
32 |
robfinch |
parameter TEXT_CELL_COUNT = 16384;
|
| 56 |
|
|
localparam AWID = $clog2(TEXT_CELL_COUNT);
|
| 57 |
31 |
robfinch |
|
| 58 |
|
|
// xpm_memory_tdpram: True Dual Port RAM
|
| 59 |
|
|
// Xilinx Parameterized Macro, version 2020.2
|
| 60 |
|
|
`ifdef VENDOR_XILINX
|
| 61 |
|
|
|
| 62 |
|
|
xpm_memory_tdpram #(
|
| 63 |
32 |
robfinch |
.ADDR_WIDTH_A(AWID),
|
| 64 |
|
|
.ADDR_WIDTH_B(AWID),
|
| 65 |
31 |
robfinch |
.AUTO_SLEEP_TIME(0),
|
| 66 |
|
|
.BYTE_WRITE_WIDTH_A(8),
|
| 67 |
|
|
.BYTE_WRITE_WIDTH_B(8),
|
| 68 |
|
|
.CASCADE_HEIGHT(0),
|
| 69 |
|
|
.CLOCKING_MODE("independent_clock"), // String
|
| 70 |
|
|
.ECC_MODE("no_ecc"), // String
|
| 71 |
|
|
.MEMORY_INIT_FILE("none"), // String
|
| 72 |
|
|
.MEMORY_INIT_PARAM("0"), // String
|
| 73 |
|
|
.MEMORY_OPTIMIZATION("true"), // String
|
| 74 |
|
|
.MEMORY_PRIMITIVE("block"), // String
|
| 75 |
32 |
robfinch |
.MEMORY_SIZE(TEXT_CELL_COUNT*64),
|
| 76 |
31 |
robfinch |
.MESSAGE_CONTROL(0),
|
| 77 |
|
|
.READ_DATA_WIDTH_A(64),
|
| 78 |
|
|
.READ_DATA_WIDTH_B(64),
|
| 79 |
|
|
.READ_LATENCY_A(2),
|
| 80 |
|
|
.READ_LATENCY_B(1),
|
| 81 |
|
|
.READ_RESET_VALUE_A("0"), // String
|
| 82 |
|
|
.READ_RESET_VALUE_B("0"), // String
|
| 83 |
|
|
.RST_MODE_A("SYNC"), // String
|
| 84 |
|
|
.RST_MODE_B("SYNC"), // String
|
| 85 |
|
|
.SIM_ASSERT_CHK(0), // DECIMAL; 0=disable simulation messages, 1=enable simulation messages
|
| 86 |
|
|
.USE_EMBEDDED_CONSTRAINT(0), // DECIMAL
|
| 87 |
|
|
.USE_MEM_INIT(1),
|
| 88 |
|
|
.WAKEUP_TIME("disable_sleep"), // String
|
| 89 |
|
|
.WRITE_DATA_WIDTH_A(64),
|
| 90 |
|
|
.WRITE_DATA_WIDTH_B(64),
|
| 91 |
|
|
.WRITE_MODE_A("no_change"), // String
|
| 92 |
|
|
.WRITE_MODE_B("no_change") // String
|
| 93 |
|
|
)
|
| 94 |
|
|
xpm_memory_tdpram_inst (
|
| 95 |
|
|
.dbiterra(), // 1-bit output: Status signal to indicate double bit error occurrence
|
| 96 |
|
|
// on the data output of port A.
|
| 97 |
|
|
|
| 98 |
|
|
.dbiterrb(), // 1-bit output: Status signal to indicate double bit error occurrence
|
| 99 |
|
|
// on the data output of port A.
|
| 100 |
|
|
|
| 101 |
|
|
.douta(data_o), // READ_DATA_WIDTH_A-bit output: Data output for port A read operations.
|
| 102 |
|
|
.doutb(datb_o), // READ_DATA_WIDTH_B-bit output: Data output for port B read operations.
|
| 103 |
|
|
.sbiterra(), // 1-bit output: Status signal to indicate single bit error occurrence
|
| 104 |
|
|
// on the data output of port A.
|
| 105 |
|
|
|
| 106 |
|
|
.sbiterrb(), // 1-bit output: Status signal to indicate single bit error occurrence
|
| 107 |
|
|
// on the data output of port B.
|
| 108 |
|
|
|
| 109 |
|
|
.addra(adra_i), // ADDR_WIDTH_A-bit input: Address for port A write and read operations.
|
| 110 |
|
|
.addrb(adrb_i), // ADDR_WIDTH_B-bit input: Address for port B write and read operations.
|
| 111 |
|
|
.clka(clka_i), // 1-bit input: Clock signal for port A. Also clocks port B when
|
| 112 |
|
|
// parameter CLOCKING_MODE is "common_clock".
|
| 113 |
|
|
|
| 114 |
|
|
.clkb(clkb_i), // 1-bit input: Clock signal for port B when parameter CLOCKING_MODE is
|
| 115 |
|
|
// "independent_clock". Unused when parameter CLOCKING_MODE is
|
| 116 |
|
|
// "common_clock".
|
| 117 |
|
|
|
| 118 |
|
|
.dina(data_i), // WRITE_DATA_WIDTH_A-bit input: Data input for port A write operations.
|
| 119 |
|
|
.dinb(datb_i), // WRITE_DATA_WIDTH_B-bit input: Data input for port B write operations.
|
| 120 |
|
|
.ena(csa_i), // 1-bit input: Memory enable signal for port A. Must be high on clock
|
| 121 |
|
|
// cycles when read or write operations are initiated. Pipelined
|
| 122 |
|
|
// internally.
|
| 123 |
|
|
|
| 124 |
|
|
.enb(csb_i), // 1-bit input: Memory enable signal for port B. Must be high on clock
|
| 125 |
|
|
// cycles when read or write operations are initiated. Pipelined
|
| 126 |
|
|
// internally.
|
| 127 |
|
|
|
| 128 |
|
|
.injectdbiterra(1'b0), // 1-bit input: Controls double bit error injection on input data when
|
| 129 |
|
|
// ECC enabled (Error injection capability is not available in
|
| 130 |
|
|
// "decode_only" mode).
|
| 131 |
|
|
|
| 132 |
|
|
.injectdbiterrb(1'b0), // 1-bit input: Controls double bit error injection on input data when
|
| 133 |
|
|
// ECC enabled (Error injection capability is not available in
|
| 134 |
|
|
// "decode_only" mode).
|
| 135 |
|
|
|
| 136 |
|
|
.injectsbiterra(1'b0), // 1-bit input: Controls single bit error injection on input data when
|
| 137 |
|
|
// ECC enabled (Error injection capability is not available in
|
| 138 |
|
|
// "decode_only" mode).
|
| 139 |
|
|
|
| 140 |
|
|
.injectsbiterrb(1'b0), // 1-bit input: Controls single bit error injection on input data when
|
| 141 |
|
|
// ECC enabled (Error injection capability is not available in
|
| 142 |
|
|
// "decode_only" mode).
|
| 143 |
|
|
|
| 144 |
|
|
.regcea(csa_i), // 1-bit input: Clock Enable for the last register stage on the output
|
| 145 |
|
|
// data path.
|
| 146 |
|
|
|
| 147 |
|
|
.regceb(csb_i), // 1-bit input: Clock Enable for the last register stage on the output
|
| 148 |
|
|
// data path.
|
| 149 |
|
|
|
| 150 |
|
|
.rsta(1'b0), // 1-bit input: Reset signal for the final port A output register stage.
|
| 151 |
|
|
// Synchronously resets output port douta to the value specified by
|
| 152 |
|
|
// parameter READ_RESET_VALUE_A.
|
| 153 |
|
|
|
| 154 |
|
|
.rstb(1'b0), // 1-bit input: Reset signal for the final port B output register stage.
|
| 155 |
|
|
// Synchronously resets output port doutb to the value specified by
|
| 156 |
|
|
// parameter READ_RESET_VALUE_B.
|
| 157 |
|
|
|
| 158 |
|
|
.sleep(1'b0), // 1-bit input: sleep signal to enable the dynamic power saving feature.
|
| 159 |
|
|
.wea({8{wea_i}} & sela_i), // WRITE_DATA_WIDTH_A/BYTE_WRITE_WIDTH_A-bit input: Write enable vector
|
| 160 |
|
|
// for port A input data port dina. 1 bit wide when word-wide writes are
|
| 161 |
|
|
// used. In byte-wide write configurations, each bit controls the
|
| 162 |
|
|
// writing one byte of dina to address addra. For example, to
|
| 163 |
|
|
// synchronously write only bits [15-8] of dina when WRITE_DATA_WIDTH_A
|
| 164 |
|
|
// is 32, wea would be 4'b0010.
|
| 165 |
|
|
|
| 166 |
|
|
.web({8{web_i}} & selb_i) // WRITE_DATA_WIDTH_B/BYTE_WRITE_WIDTH_B-bit input: Write enable vector
|
| 167 |
|
|
// for port B input data port dinb. 1 bit wide when word-wide writes are
|
| 168 |
|
|
// used. In byte-wide write configurations, each bit controls the
|
| 169 |
|
|
// writing one byte of dinb to address addrb. For example, to
|
| 170 |
|
|
// synchronously write only bits [15-8] of dinb when WRITE_DATA_WIDTH_B
|
| 171 |
|
|
// is 32, web would be 4'b0010.
|
| 172 |
|
|
|
| 173 |
|
|
);
|
| 174 |
|
|
|
| 175 |
|
|
`elsif VENDOR_ALTERA
|
| 176 |
|
|
always_comb
|
| 177 |
|
|
begin
|
| 178 |
|
|
$display("ToDo: Add ALTERA RAM support.");
|
| 179 |
|
|
$finish();
|
| 180 |
|
|
end
|
| 181 |
|
|
`else
|
| 182 |
|
|
always_comb
|
| 183 |
|
|
begin
|
| 184 |
|
|
$display("No RAM vendor selected.");
|
| 185 |
|
|
$finish();
|
| 186 |
|
|
end
|
| 187 |
|
|
`endif
|
| 188 |
|
|
|
| 189 |
|
|
endmodule
|