| 1 |
2 |
csantifort |
//////////////////////////////////////////////////////////////////
|
| 2 |
|
|
// //
|
| 3 |
|
|
// Wrapper for Xilinx Spartan-6 RAM Block //
|
| 4 |
|
|
// //
|
| 5 |
|
|
// This file is part of the Amber project //
|
| 6 |
|
|
// http://www.opencores.org/project,amber //
|
| 7 |
|
|
// //
|
| 8 |
|
|
// Description //
|
| 9 |
|
|
// 256 words x 21 bits with a single write enable //
|
| 10 |
|
|
// //
|
| 11 |
|
|
// Author(s): //
|
| 12 |
|
|
// - Conor Santifort, csantifort.amber@gmail.com //
|
| 13 |
|
|
// //
|
| 14 |
|
|
//////////////////////////////////////////////////////////////////
|
| 15 |
|
|
// //
|
| 16 |
|
|
// Copyright (C) 2010 Authors and OPENCORES.ORG //
|
| 17 |
|
|
// //
|
| 18 |
|
|
// This source file may be used and distributed without //
|
| 19 |
|
|
// restriction provided that this copyright statement is not //
|
| 20 |
|
|
// removed from the file and that any derivative work contains //
|
| 21 |
|
|
// the original copyright notice and the associated disclaimer. //
|
| 22 |
|
|
// //
|
| 23 |
|
|
// This source file is free software; you can redistribute it //
|
| 24 |
|
|
// and/or modify it under the terms of the GNU Lesser General //
|
| 25 |
|
|
// Public License as published by the Free Software Foundation; //
|
| 26 |
|
|
// either version 2.1 of the License, or (at your option) any //
|
| 27 |
|
|
// later version. //
|
| 28 |
|
|
// //
|
| 29 |
|
|
// This source is distributed in the hope that it will be //
|
| 30 |
|
|
// useful, but WITHOUT ANY WARRANTY; without even the implied //
|
| 31 |
|
|
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR //
|
| 32 |
|
|
// PURPOSE. See the GNU Lesser General Public License for more //
|
| 33 |
|
|
// details. //
|
| 34 |
|
|
// //
|
| 35 |
|
|
// You should have received a copy of the GNU Lesser General //
|
| 36 |
|
|
// Public License along with this source; if not, download it //
|
| 37 |
|
|
// from http://www.opencores.org/lgpl.shtml //
|
| 38 |
|
|
// //
|
| 39 |
|
|
//////////////////////////////////////////////////////////////////
|
| 40 |
|
|
|
| 41 |
|
|
|
| 42 |
|
|
module xs6_sram_256x21_line_en
|
| 43 |
|
|
#(
|
| 44 |
12 |
csantifort |
parameter DATA_WIDTH = 21,
|
| 45 |
|
|
parameter INITIALIZE_TO_ZERO = 0,
|
| 46 |
|
|
parameter ADDRESS_WIDTH = 8
|
| 47 |
2 |
csantifort |
)
|
| 48 |
|
|
|
| 49 |
|
|
(
|
| 50 |
|
|
input i_clk,
|
| 51 |
|
|
input [DATA_WIDTH-1:0] i_write_data,
|
| 52 |
|
|
input i_write_enable,
|
| 53 |
|
|
input [ADDRESS_WIDTH-1:0] i_address,
|
| 54 |
|
|
output [DATA_WIDTH-1:0] o_read_data
|
| 55 |
|
|
);
|
| 56 |
|
|
|
| 57 |
|
|
|
| 58 |
|
|
wire [15:0] read_data_lo, read_data_hi;
|
| 59 |
|
|
|
| 60 |
|
|
assign o_read_data = { read_data_hi[12:8], read_data_hi[4:0],
|
| 61 |
|
|
read_data_lo[12:8], read_data_lo[5:0] };
|
| 62 |
|
|
|
| 63 |
|
|
RAMB8BWER #(
|
| 64 |
|
|
.DATA_WIDTH_A ( 36 ),
|
| 65 |
|
|
.DATA_WIDTH_B ( 36 ),
|
| 66 |
|
|
.RAM_MODE ( "SDP" ),
|
| 67 |
|
|
.SIM_COLLISION_CHECK ( "GENERATE_X_ONLY" ),
|
| 68 |
|
|
.WRITE_MODE_A ( "READ_FIRST" ),
|
| 69 |
|
|
.WRITE_MODE_B ( "READ_FIRST" )
|
| 70 |
|
|
)
|
| 71 |
|
|
u_ramb8bwer (
|
| 72 |
|
|
.CLKAWRCLK ( i_clk ),
|
| 73 |
|
|
.CLKBRDCLK ( i_clk ),
|
| 74 |
|
|
.ADDRAWRADDR ( {i_address, 5'd0} ),
|
| 75 |
|
|
.ADDRBRDADDR ( {i_address, 5'd0} ),
|
| 76 |
|
|
.ENAWREN ( i_write_enable ),
|
| 77 |
|
|
.ENBRDEN ( ~i_write_enable ),
|
| 78 |
|
|
.WEAWEL ( {2{i_write_enable}} ),
|
| 79 |
|
|
.WEBWEU ( {2{i_write_enable}} ),
|
| 80 |
|
|
.DIADI ( {3'd0, i_write_data[10: 6], 2'd0, i_write_data[ 5: 0] } ),
|
| 81 |
|
|
.DOADO ( read_data_lo ),
|
| 82 |
|
|
.DIBDI ( {3'd0, i_write_data[20:16], 3'd0, i_write_data[15:11] } ),
|
| 83 |
|
|
.DOBDO ( read_data_hi ),
|
| 84 |
|
|
|
| 85 |
|
|
// These guys are not used, so they are just tied off
|
| 86 |
|
|
// ----------------------------------------------------
|
| 87 |
|
|
.DIPBDIP ( 2'd0 ),
|
| 88 |
|
|
.DIPADIP ( 2'd0 ),
|
| 89 |
|
|
.DOPADOP ( ),
|
| 90 |
|
|
.DOPBDOP ( ),
|
| 91 |
|
|
|
| 92 |
|
|
.REGCEA ( 1'd0 ),
|
| 93 |
|
|
.REGCEBREGCE ( 1'd0 ),
|
| 94 |
|
|
.RSTA ( 1'd0 ),
|
| 95 |
|
|
.RSTBRST ( 1'd0 )
|
| 96 |
|
|
);
|
| 97 |
|
|
|
| 98 |
|
|
|
| 99 |
|
|
//synopsys translate_off
|
| 100 |
|
|
initial
|
| 101 |
|
|
begin
|
| 102 |
|
|
if ( DATA_WIDTH != 21 ) $display("%M Warning: Incorrect parameter DATA_WIDTH");
|
| 103 |
|
|
if ( ADDRESS_WIDTH != 8 ) $display("%M Warning: Incorrect parameter ADDRESS_WIDTH");
|
| 104 |
|
|
end
|
| 105 |
|
|
//synopsys translate_on
|
| 106 |
|
|
|
| 107 |
|
|
endmodule
|
| 108 |
|
|
|
| 109 |
|
|
|