1 |
3 |
kuzmi4 |
//------------------------------------------------------------------------------
|
2 |
|
|
// Title : RAM memory for RX and TX client FIFOs
|
3 |
|
|
// Version : 1.0
|
4 |
|
|
// Project : Tri-Mode Ethernet MAC
|
5 |
|
|
//------------------------------------------------------------------------------
|
6 |
|
|
// File : tri_mode_ethernet_mac_0_bram_tdp.v
|
7 |
|
|
// Author : Xilinx Inc.
|
8 |
|
|
// -----------------------------------------------------------------------------
|
9 |
|
|
// (c) Copyright 2013 Xilinx, Inc. All rights reserved.
|
10 |
|
|
//
|
11 |
|
|
// This file contains confidential and proprietary information
|
12 |
|
|
// of Xilinx, Inc. and is protected under U.S. and
|
13 |
|
|
// international copyright and other intellectual property
|
14 |
|
|
// laws.
|
15 |
|
|
//
|
16 |
|
|
// DISCLAIMER
|
17 |
|
|
// This disclaimer is not a license and does not grant any
|
18 |
|
|
// rights to the materials distributed herewith. Except as
|
19 |
|
|
// otherwise provided in a valid license issued to you by
|
20 |
|
|
// Xilinx, and to the maximum extent permitted by applicable
|
21 |
|
|
// law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
|
22 |
|
|
// WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
|
23 |
|
|
// AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
|
24 |
|
|
// BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
|
25 |
|
|
// INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
|
26 |
|
|
// (2) Xilinx shall not be liable (whether in contract or tort,
|
27 |
|
|
// including negligence, or under any other theory of
|
28 |
|
|
// liability) for any loss or damage of any kind or nature
|
29 |
|
|
// related to, arising under or in connection with these
|
30 |
|
|
// materials, including for any direct, or any indirect,
|
31 |
|
|
// special, incidental, or consequential loss or damage
|
32 |
|
|
// (including loss of data, profits, goodwill, or any type of
|
33 |
|
|
// loss or damage suffered as a result of any action brought
|
34 |
|
|
// by a third party) even if such damage or loss was
|
35 |
|
|
// reasonably foreseeable or Xilinx had been advised of the
|
36 |
|
|
// possibility of the same.
|
37 |
|
|
//
|
38 |
|
|
// CRITICAL APPLICATIONS
|
39 |
|
|
// Xilinx products are not designed or intended to be fail-
|
40 |
|
|
// safe, or for use in any application requiring fail-safe
|
41 |
|
|
// performance, such as life-support or safety devices or
|
42 |
|
|
// systems, Class III medical devices, nuclear facilities,
|
43 |
|
|
// applications related to the deployment of airbags, or any
|
44 |
|
|
// other applications that could lead to death, personal
|
45 |
|
|
// injury, or severe property or environmental damage
|
46 |
|
|
// (individually and collectively, "Critical
|
47 |
|
|
// Applications"). Customer assumes the sole risk and
|
48 |
|
|
// liability of any use of Xilinx products in Critical
|
49 |
|
|
// Applications, subject only to applicable laws and
|
50 |
|
|
// regulations governing limitations on product liability.
|
51 |
|
|
//
|
52 |
|
|
// THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
|
53 |
|
|
// PART OF THIS FILE AT ALL TIMES.
|
54 |
|
|
// -----------------------------------------------------------------------------
|
55 |
|
|
// Description: This is a parameterized inferred block RAM
|
56 |
|
|
//
|
57 |
|
|
//------------------------------------------------------------------------------
|
58 |
|
|
|
59 |
|
|
`timescale 1ps / 1ps
|
60 |
|
|
|
61 |
|
|
//------------------------------------------------------------------------------
|
62 |
|
|
// The module declaration for the block RAM
|
63 |
|
|
//------------------------------------------------------------------------------
|
64 |
|
|
|
65 |
|
|
|
66 |
|
|
module tri_mode_ethernet_mac_0_bram_tdp #(
|
67 |
|
|
parameter DATA_WIDTH = 8,
|
68 |
|
|
parameter ADDR_WIDTH = 12
|
69 |
|
|
) (
|
70 |
|
|
// Port A
|
71 |
|
|
input wire a_clk,
|
72 |
|
|
input wire a_rst,
|
73 |
|
|
input wire a_wr,
|
74 |
|
|
input wire [ADDR_WIDTH-1:0] a_addr,
|
75 |
|
|
input wire [DATA_WIDTH-1:0] a_din,
|
76 |
|
|
|
77 |
|
|
// Port B
|
78 |
|
|
input wire b_clk,
|
79 |
|
|
input wire b_en,
|
80 |
|
|
input wire b_rst,
|
81 |
|
|
input wire [ADDR_WIDTH-1:0] b_addr,
|
82 |
|
|
output reg [DATA_WIDTH-1:0] b_dout
|
83 |
|
|
);
|
84 |
|
|
|
85 |
|
|
// Shared memory
|
86 |
|
|
localparam RAM_DEPTH = 2 ** ADDR_WIDTH;
|
87 |
|
|
reg [DATA_WIDTH-1:0] mem [RAM_DEPTH-1:0];
|
88 |
|
|
|
89 |
|
|
// To write use port A
|
90 |
|
|
always @(posedge a_clk)
|
91 |
|
|
begin
|
92 |
|
|
if(!a_rst && a_wr) begin
|
93 |
|
|
mem[a_addr] <= a_din;
|
94 |
|
|
end
|
95 |
|
|
end
|
96 |
|
|
|
97 |
|
|
// To read use Port B
|
98 |
|
|
always @(posedge b_clk)
|
99 |
|
|
begin
|
100 |
|
|
if(b_rst)
|
101 |
|
|
b_dout <= {DATA_WIDTH{1'b0}};
|
102 |
|
|
else if(b_en)
|
103 |
|
|
b_dout <= mem[b_addr];
|
104 |
|
|
end
|
105 |
|
|
|
106 |
|
|
endmodule
|
107 |
|
|
|