////////////////////////////////////////////////////////////////////// //// //// //// Generic Single-Port Synchronous RAM //// //// //// //// This file is part of memory library available from //// //// http://www.opencores.org/cvsweb.shtml/generic_memories/ //// //// //// //// Description //// //// This block is a wrapper with common single-port //// //// synchronous memory interface for different //// //// types of ASIC and FPGA RAMs. Beside universal memory //// //// interface it also provides a behavioral model of generic //// //// single-port synchronous RAM. //// //// It also contains a synthesizeable model for FPGAs. //// //// It should be used in all OPENCORES designs that want to be //// //// portable accross different target technologies and //// //// independent of target memory. //// //// //// //// Supported ASIC RAMs are: //// //// - Artisan Single-Port Sync RAM //// //// - Avant! Two-Port Sync RAM (*) //// //// - Virage Single-Port Sync RAM //// //// - Virtual Silicon Single-Port Sync RAM //// //// //// //// Supported FPGA RAMs are: //// //// - Generic FPGA (VENDOR_FPGA) //// //// Tested RAMs: Altera, Xilinx //// //// Synthesis tools: LeonardoSpectrum, Synplicity //// //// - Xilinx (VENDOR_XILINX) //// //// - Altera (VENDOR_ALTERA) //// //// //// //// To Do: //// //// - fix avant! two-port ram //// //// - add additional RAMs //// //// //// //// Author(s): //// //// - Richard Herveille, richard@asics.ws //// //// - Damjan Lampret, lampret@opencores.org //// //// //// ////////////////////////////////////////////////////////////////////// //// //// //// Copyright (C) 2000 Authors and OPENCORES.ORG //// //// //// //// This source file may be used and distributed without //// //// restriction provided that this copyright statement is not //// //// removed from the file and that any derivative work contains //// //// the original copyright notice and the associated disclaimer. //// //// //// //// This source file is free software; you can redistribute it //// //// and/or modify it under the terms of the GNU Lesser General //// //// Public License as published by the Free Software Foundation; //// //// either version 2.1 of the License, or (at your option) any //// //// later version. //// //// //// //// This source is distributed in the hope that it will be //// //// useful, but WITHOUT ANY WARRANTY; without even the implied //// //// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR //// //// PURPOSE. See the GNU Lesser General Public License for more //// //// details. //// //// //// //// You should have received a copy of the GNU Lesser General //// //// Public License along with this source; if not, download it //// //// from http://www.opencores.org/lgpl.shtml //// //// //// ////////////////////////////////////////////////////////////////////// // // CVS Revision History // // $Log: generic_spram.v,v $ // Revision 1.3 2003/03/18 21:45:48 rherveille // Added WISHBONE revB.3 Registered Feedback Cycles support // // // `include "timescale.v" //`define VENDOR_XILINX //`define VENDOR_ALTERA `define VENDOR_FPGA module generic_spram( // Generic synchronous single-port RAM interface clk, rst, ce, we, oe, addr, di, do ); // // Default address and data buses width // parameter aw = 6; //number of address-bits parameter dw = 8; //number of data-bits // // Generic synchronous single-port RAM interface // input clk; // Clock, rising edge input rst; // Reset, active high input ce; // Chip enable input, active high input we; // Write enable input, active high input oe; // Output enable input, active high input [aw-1:0] addr; // address bus inputs input [dw-1:0] di; // input data bus output [dw-1:0] do; // output data bus // // Module body // `ifdef VENDOR_FPGA // // Instantiation synthesizeable FPGA memory // // This code has been tested using LeonardoSpectrum and Synplicity. // The code correctly instantiates Altera EABs and Xilinx BlockRAMs. // // NOTE: // 'synthesis syn_ramstyle="block_ram"' is a Synplify attribute. // It instructs Synplify to map to BlockRAMs instead of the default SelectRAMs reg [dw-1:0] mem [(1<