Merge marina project in subdirectory marina/
[fleet.git] / src / edu / berkeley / fleet / fpga / ddr2 / 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 users 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    )
77   (
78    input          clk0,
79    input          rst0,
80    input [2:0]    app_af_cmd,
81    input [30:0]   app_af_addr,
82    input          app_af_wren,
83    input          ctrl_af_rden,
84    output [2:0]   af_cmd,
85    output [30:0]  af_addr,
86    output         af_empty,
87    output         app_af_afull
88    );
89
90   wire [35:0]     fifo_data_out;
91    reg            rst_r;
92
93
94   always @(posedge clk0)
95      rst_r <= rst0;
96
97
98   //***************************************************************************
99
100   assign af_cmd      = fifo_data_out[33:31];
101   assign af_addr     = fifo_data_out[30:0];
102
103   //***************************************************************************
104
105   FIFO36 #
106     (
107      .ALMOST_EMPTY_OFFSET     (13'h0007),
108      .ALMOST_FULL_OFFSET      (13'h000F),
109      .DATA_WIDTH              (36),
110      .DO_REG                  (1),
111      .EN_SYN                  ("TRUE"),
112      .FIRST_WORD_FALL_THROUGH ("FALSE")
113      )
114     u_af
115       (
116        .ALMOSTEMPTY (),
117        .ALMOSTFULL  (app_af_afull),
118        .DO          (fifo_data_out[31:0]),
119        .DOP         (fifo_data_out[35:32]),
120        .EMPTY       (af_empty),
121        .FULL        (),
122        .RDCOUNT     (),
123        .RDERR       (),
124        .WRCOUNT     (),
125        .WRERR       (),
126        .DI          ({app_af_cmd[0],app_af_addr}),
127        .DIP         ({2'b00,app_af_cmd[2:1]}),
128        .RDCLK       (clk0),
129        .RDEN        (ctrl_af_rden),
130        .RST         (rst_r),
131        .WRCLK       (clk0),
132        .WREN        (app_af_wren)
133        );
134
135 endmodule