1 |
5 |
robfinch |
`timescale 1ns / 1ps
|
2 |
|
|
// ============================================================================
|
3 |
|
|
// __
|
4 |
|
|
// \\__/ o\ (C) 2015-2022 Robert Finch, Waterloo
|
5 |
|
|
// \ __ / All rights reserved.
|
6 |
|
|
// \/_// robfinch@finitron.ca
|
7 |
|
|
// ||
|
8 |
|
|
//
|
9 |
|
|
// BSD 3-Clause License
|
10 |
|
|
// Redistribution and use in source and binary forms, with or without
|
11 |
|
|
// modification, are permitted provided that the following conditions are met:
|
12 |
|
|
//
|
13 |
|
|
// 1. Redistributions of source code must retain the above copyright notice, this
|
14 |
|
|
// list of conditions and the following disclaimer.
|
15 |
|
|
//
|
16 |
|
|
// 2. Redistributions in binary form must reproduce the above copyright notice,
|
17 |
|
|
// this list of conditions and the following disclaimer in the documentation
|
18 |
|
|
// and/or other materials provided with the distribution.
|
19 |
|
|
//
|
20 |
|
|
// 3. Neither the name of the copyright holder nor the names of its
|
21 |
|
|
// contributors may be used to endorse or promote products derived from
|
22 |
|
|
// this software without specific prior written permission.
|
23 |
|
|
//
|
24 |
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
25 |
|
|
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
26 |
|
|
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
27 |
|
|
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
28 |
|
|
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
29 |
|
|
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
30 |
|
|
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
31 |
|
|
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
32 |
|
|
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
33 |
|
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
34 |
|
|
//
|
35 |
|
|
// ============================================================================
|
36 |
|
|
//
|
37 |
|
|
import mpmc10_pkg::*;
|
38 |
|
|
|
39 |
|
|
module mpmc10_fifo(rst, clk, rd_fifo, wr_fifo, req_fifoi, req_fifoo, v,
|
40 |
|
|
full, empty, almost_full, rd_rst_busy, wr_rst_busy, cnt);
|
41 |
|
|
input rst;
|
42 |
|
|
input clk;
|
43 |
|
|
input rd_fifo;
|
44 |
|
|
input wr_fifo;
|
45 |
|
|
input wb_write_request128_t req_fifoi;
|
46 |
|
|
output wb_write_request128_t req_fifoo;
|
47 |
|
|
output v;
|
48 |
|
|
output full;
|
49 |
|
|
output empty;
|
50 |
|
|
output almost_full;
|
51 |
|
|
output rd_rst_busy;
|
52 |
|
|
output wr_rst_busy;
|
53 |
|
|
output [4:0] cnt;
|
54 |
|
|
|
55 |
|
|
xpm_fifo_sync #(
|
56 |
|
|
.DOUT_RESET_VALUE("0"), // String
|
57 |
|
|
.ECC_MODE("no_ecc"), // String
|
58 |
|
|
.FIFO_MEMORY_TYPE("distributed"), // String
|
59 |
|
|
.FIFO_READ_LATENCY(1), // DECIMAL
|
60 |
|
|
.FIFO_WRITE_DEPTH(32), // DECIMAL
|
61 |
|
|
.FULL_RESET_VALUE(0), // DECIMAL
|
62 |
|
|
.PROG_EMPTY_THRESH(3), // DECIMAL
|
63 |
|
|
.PROG_FULL_THRESH(27), // DECIMAL
|
64 |
|
|
.RD_DATA_COUNT_WIDTH(5), // DECIMAL
|
65 |
|
|
.READ_DATA_WIDTH($bits(wb_write_request128_t)), // DECIMAL
|
66 |
|
|
.READ_MODE("std"), // String
|
67 |
|
|
.SIM_ASSERT_CHK(0), // DECIMAL; 0=disable simulation messages, 1=enable simulation messages
|
68 |
|
|
.USE_ADV_FEATURES("070F"), // String
|
69 |
|
|
.WAKEUP_TIME(0), // DECIMAL
|
70 |
|
|
.WRITE_DATA_WIDTH($bits(wb_write_request128_t)), // DECIMAL
|
71 |
|
|
.WR_DATA_COUNT_WIDTH(5) // DECIMAL
|
72 |
|
|
)
|
73 |
|
|
xpm_fifo_sync_inst (
|
74 |
|
|
.almost_empty(), // 1-bit output: Almost Empty : When asserted, this signal indicates that
|
75 |
|
|
// only one more read can be performed before the FIFO goes to empty.
|
76 |
|
|
|
77 |
|
|
.almost_full(almost_full), // 1-bit output: Almost Full: When asserted, this signal indicates that
|
78 |
|
|
// only one more write can be performed before the FIFO is full.
|
79 |
|
|
|
80 |
|
|
.data_valid(v), // 1-bit output: Read Data Valid: When asserted, this signal indicates
|
81 |
|
|
// that valid data is available on the output bus (dout).
|
82 |
|
|
|
83 |
|
|
.dbiterr(), // 1-bit output: Double Bit Error: Indicates that the ECC decoder detected
|
84 |
|
|
// a double-bit error and data in the FIFO core is corrupted.
|
85 |
|
|
|
86 |
|
|
.dout(req_fifoo), // READ_DATA_WIDTH-bit output: Read Data: The output data bus is driven
|
87 |
|
|
// when reading the FIFO.
|
88 |
|
|
|
89 |
|
|
.empty(empty), // 1-bit output: Empty Flag: When asserted, this signal indicates that the
|
90 |
|
|
// FIFO is empty. Read requests are ignored when the FIFO is empty,
|
91 |
|
|
// initiating a read while empty is not destructive to the FIFO.
|
92 |
|
|
|
93 |
|
|
.full(full), // 1-bit output: Full Flag: When asserted, this signal indicates that the
|
94 |
|
|
// FIFO is full. Write requests are ignored when the FIFO is full,
|
95 |
|
|
// initiating a write when the FIFO is full is not destructive to the
|
96 |
|
|
// contents of the FIFO.
|
97 |
|
|
|
98 |
|
|
.overflow(), // 1-bit output: Overflow: This signal indicates that a write request
|
99 |
|
|
// (wren) during the prior clock cycle was rejected, because the FIFO is
|
100 |
|
|
// full. Overflowing the FIFO is not destructive to the contents of the
|
101 |
|
|
// FIFO.
|
102 |
|
|
|
103 |
|
|
.prog_empty(), // 1-bit output: Programmable Empty: This signal is asserted when the
|
104 |
|
|
// number of words in the FIFO is less than or equal to the programmable
|
105 |
|
|
// empty threshold value. It is de-asserted when the number of words in
|
106 |
|
|
// the FIFO exceeds the programmable empty threshold value.
|
107 |
|
|
|
108 |
|
|
.prog_full(), // 1-bit output: Programmable Full: This signal is asserted when the
|
109 |
|
|
// number of words in the FIFO is greater than or equal to the
|
110 |
|
|
// programmable full threshold value. It is de-asserted when the number of
|
111 |
|
|
// words in the FIFO is less than the programmable full threshold value.
|
112 |
|
|
|
113 |
|
|
.rd_data_count(), // RD_DATA_COUNT_WIDTH-bit output: Read Data Count: This bus indicates the
|
114 |
|
|
// number of words read from the FIFO.
|
115 |
|
|
|
116 |
|
|
.rd_rst_busy(rd_rst_busy), // 1-bit output: Read Reset Busy: Active-High indicator that the FIFO read
|
117 |
|
|
// domain is currently in a reset state.
|
118 |
|
|
|
119 |
|
|
.sbiterr(), // 1-bit output: Single Bit Error: Indicates that the ECC decoder detected
|
120 |
|
|
// and fixed a single-bit error.
|
121 |
|
|
|
122 |
|
|
.underflow(), // 1-bit output: Underflow: Indicates that the read request (rd_en) during
|
123 |
|
|
// the previous clock cycle was rejected because the FIFO is empty. Under
|
124 |
|
|
// flowing the FIFO is not destructive to the FIFO.
|
125 |
|
|
|
126 |
|
|
.wr_ack(), // 1-bit output: Write Acknowledge: This signal indicates that a write
|
127 |
|
|
// request (wr_en) during the prior clock cycle is succeeded.
|
128 |
|
|
|
129 |
|
|
.wr_data_count(cnt), // WR_DATA_COUNT_WIDTH-bit output: Write Data Count: This bus indicates
|
130 |
|
|
// the number of words written into the FIFO.
|
131 |
|
|
|
132 |
|
|
.wr_rst_busy(wr_rst_busy), // 1-bit output: Write Reset Busy: Active-High indicator that the FIFO
|
133 |
|
|
// write domain is currently in a reset state.
|
134 |
|
|
|
135 |
|
|
.din(req_fifoi), // WRITE_DATA_WIDTH-bit input: Write Data: The input data bus used when
|
136 |
|
|
// writing the FIFO.
|
137 |
|
|
|
138 |
|
|
.injectdbiterr(1'b0), // 1-bit input: Double Bit Error Injection: Injects a double bit error if
|
139 |
|
|
// the ECC feature is used on block RAMs or UltraRAM macros.
|
140 |
|
|
|
141 |
|
|
.injectsbiterr(1'b0), // 1-bit input: Single Bit Error Injection: Injects a single bit error if
|
142 |
|
|
// the ECC feature is used on block RAMs or UltraRAM macros.
|
143 |
|
|
|
144 |
|
|
.rd_en(rd_fifo & ~rd_rst_busy), // 1-bit input: Read Enable: If the FIFO is not empty, asserting this
|
145 |
|
|
// signal causes data (on dout) to be read from the FIFO. Must be held
|
146 |
|
|
// active-low when rd_rst_busy is active high.
|
147 |
|
|
|
148 |
|
|
.rst(rst), // 1-bit input: Reset: Must be synchronous to wr_clk. The clock(s) can be
|
149 |
|
|
// unstable at the time of applying reset, but reset must be released only
|
150 |
|
|
// after the clock(s) is/are stable.
|
151 |
|
|
|
152 |
|
|
.sleep(1'b0), // 1-bit input: Dynamic power saving- If sleep is High, the memory/fifo
|
153 |
|
|
// block is in power saving mode.
|
154 |
|
|
|
155 |
|
|
.wr_clk(clk), // 1-bit input: Write clock: Used for write operation. wr_clk must be a
|
156 |
|
|
// free running clock.
|
157 |
|
|
|
158 |
|
|
.wr_en(wr_fifo & ~wr_rst_busy) // 1-bit input: Write Enable: If the FIFO is not full, asserting this
|
159 |
|
|
// signal causes data (on din) to be written to the FIFO Must be held
|
160 |
|
|
// active-low when rst or wr_rst_busy or rd_rst_busy is active high
|
161 |
|
|
|
162 |
|
|
);
|
163 |
|
|
|
164 |
|
|
endmodule
|