increase number of Memory ships to 3 in the large configuration
[fleet.git] / src / edu / berkeley / fleet / fpga / greg / ddr2_usr_addr_fifo.v
1 //*****************************************************************************
2 // DISCLAIMER OF LIABILITY
3 // 
4 // This text/file contains proprietary, confidential
5 // information of Xilinx, Inc., is distributed under license
6 // from Xilinx, Inc., and may be used, copied and/or
7 // disclosed only pursuant to the terms of a valid license
8 // agreement with Xilinx, Inc. Xilinx hereby grants you a 
9 // license to use this text/file solely for design, simulation, 
10 // implementation and creation of design files limited 
11 // to Xilinx devices or technologies. Use with non-Xilinx 
12 // devices or technologies is expressly prohibited and 
13 // immediately terminates your license unless covered by
14 // a separate agreement.
15 //
16 // Xilinx is providing this design, code, or information 
17 // "as-is" solely for use in developing programs and 
18 // solutions for Xilinx devices, with no obligation on the 
19 // part of Xilinx to provide support. By providing this design, 
20 // code, or information as one possible implementation of 
21 // this feature, application or standard, Xilinx is making no 
22 // representation that this implementation is free from any 
23 // claims of infringement. You are responsible for 
24 // obtaining any rights you may require for your implementation. 
25 // Xilinx expressly disclaims any warranty whatsoever with 
26 // respect to the adequacy of the implementation, including 
27 // but not limited to any warranties or representations that this
28 // implementation is free from claims of infringement, implied 
29 // warranties of merchantability or fitness for a particular 
30 // purpose.
31 //
32 // Xilinx products are not intended for use in life support
33 // appliances, devices, or systems. Use in such applications is
34 // expressly prohibited.
35 //
36 // Any modifications that are made to the Source Code are 
37 // done at the user\92s sole risk and will be unsupported.
38 //
39 // Copyright (c) 2006-2007 Xilinx, Inc. All rights reserved.
40 //
41 // This copyright and support notice must be retained as part 
42 // of this text at all times. 
43 //*****************************************************************************
44 //   ____  ____
45 //  /   /\/   /
46 // /___/  \  /    Vendor: Xilinx
47 // \   \   \/     Version: 2.3
48 //  \   \         Application: MIG
49 //  /   /         Filename: ddr2_usr_addr_fifo.v
50 // /___/   /\     Date Last Modified: $Date: 2008/05/08 15:20:47 $
51 // \   \  /  \    Date Created: Mon Aug 28 2006
52 //  \___\/\___\
53 //
54 //Device: Virtex-5
55 //Design Name: DDR2
56 //Purpose:
57 //   This module instantiates the block RAM based FIFO to store the user
58 //   address and the command information. Also calculates potential bank/row
59 //   conflicts by comparing the new address with last address issued.
60 //Reference:
61 //Revision History:
62 //*****************************************************************************
63
64 `timescale 1ns/1ps
65
66 module ddr2_usr_addr_fifo #
67   (
68    // Following parameters are for 72-bit RDIMM design (for ML561 Reference 
69    // board design). Actual values may be different. Actual parameters values 
70    // are passed from design top module ddr2_sdram module. Please refer to
71    // the ddr2_sdram module for actual values.
72    parameter BANK_WIDTH    = 2,
73    parameter COL_WIDTH     = 10,
74    parameter CS_BITS       = 0,
75    parameter ROW_WIDTH     = 14,
76    parameter EN_SYN        = "FALSE"
77    )
78   (
79    input          clk0,                 //ddr2 phy clock
80    input          rst0,
81    //start new port by xtan & gdgib
82    input          af_clk,               //user side clock
83    input          af_rst,               //user side reset
84    //end new port by xtan & gdgib
85    input [2:0]    app_af_cmd,
86    input [30:0]   app_af_addr,
87    input          app_af_wren,
88    input          ctrl_af_rden,
89    output [2:0]   af_cmd,
90    output [30:0]  af_addr,
91    output         af_empty,
92    output         app_af_afull
93    );
94
95   wire [35:0]     fifo_data_out;
96    reg            rst_r;
97
98
99   always @(posedge clk0)
100      rst_r <= rst0;
101
102
103   //***************************************************************************
104
105   assign af_cmd      = fifo_data_out[33:31];
106   assign af_addr     = fifo_data_out[30:0];
107
108   //***************************************************************************
109
110   FIFO36 #
111     (
112      .ALMOST_EMPTY_OFFSET     (13'h0007),
113      .ALMOST_FULL_OFFSET      (13'h000F),
114      .DATA_WIDTH              (36),
115      .DO_REG                  (1),
116      .EN_SYN                  (EN_SYN),
117      .FIRST_WORD_FALL_THROUGH ("FALSE")
118      )
119     u_af
120       (
121        .ALMOSTEMPTY (),
122        .ALMOSTFULL  (app_af_afull),
123        .DO          (fifo_data_out[31:0]),
124        .DOP         (fifo_data_out[35:32]),
125        .EMPTY       (af_empty),
126        .FULL        (),
127        .RDCOUNT     (),
128        .RDERR       (),
129        .WRCOUNT     (),
130        .WRERR       (),
131        .DI          ({app_af_cmd[0],app_af_addr}),
132        .DIP         ({2'b00,app_af_cmd[2:1]}),
133        .RDCLK       (clk0),
134        .RDEN        (ctrl_af_rden),
135        .RST         (rst_r | af_rst),
136        .WRCLK       (af_clk),                   //changed by xtan: clk0 -> af_clk
137        .WREN        (app_af_wren)
138        );
139
140 endmodule