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 |
|
|
// Reservation status bit
|
40 |
|
|
module mpmc10_resv_bit(clk, state, wch, we, cr, adr, resv_ch, resv_adr, rb);
|
41 |
|
|
input clk;
|
42 |
11 |
robfinch |
input mpmc10_state_t state;
|
43 |
5 |
robfinch |
input we;
|
44 |
|
|
input cr;
|
45 |
|
|
input [3:0] wch;
|
46 |
|
|
input [31:0] adr;
|
47 |
|
|
input [3:0] resv_ch [0:mpmc10_pkg::NAR-1];
|
48 |
|
|
input [31:0] resv_adr [0:mpmc10_pkg::NAR-1];
|
49 |
|
|
output reg rb;
|
50 |
|
|
|
51 |
|
|
integer n5;
|
52 |
|
|
always_ff @(posedge clk)
|
53 |
11 |
robfinch |
if (state==IDLE) begin
|
54 |
5 |
robfinch |
if (we) begin
|
55 |
|
|
if (cr) begin
|
56 |
11 |
robfinch |
rb <= 1'b0;
|
57 |
5 |
robfinch |
for (n5 = 0; n5 < mpmc10_pkg::NAR; n5 = n5 + 1)
|
58 |
|
|
if ((resv_ch[n5]==wch) && (resv_adr[n5][31:5]==adr[31:5]))
|
59 |
11 |
robfinch |
rb <= 1'b1;
|
60 |
5 |
robfinch |
end
|
61 |
|
|
end
|
62 |
|
|
end
|
63 |
|
|
|
64 |
|
|
endmodule
|