1 |
2 |
yaira |
//////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// Copyright (C) 2009 Authors and OPENCORES.ORG ////
|
4 |
|
|
//// ////
|
5 |
|
|
//// This source file may be used and distributed without ////
|
6 |
|
|
//// restriction provided that this copyright statement is not ////
|
7 |
|
|
//// removed from the file and that any derivative work contains ////
|
8 |
|
|
//// the original copyright notice and the associated disclaimer. ////
|
9 |
|
|
//// ////
|
10 |
|
|
//// This source file is free software; you can redistribute it ////
|
11 |
|
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
12 |
|
|
//// Public License as published by the Free Software Foundation; ////
|
13 |
|
|
//// either version 2.1 of the License, or (at your option) any ////
|
14 |
|
|
//// later version. ////
|
15 |
|
|
//// ////
|
16 |
|
|
//// This source is distributed in the hope that it will be ////
|
17 |
|
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
18 |
|
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
19 |
|
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
20 |
|
|
//// details. ////
|
21 |
|
|
//// ////
|
22 |
|
|
//// You should have received a copy of the GNU Lesser General ////
|
23 |
|
|
//// Public License along with this source; if not, download it ////
|
24 |
|
|
//// from http://www.opencores.org/lgpl.shtml ////
|
25 |
|
|
//// ////
|
26 |
|
|
//////////////////////////////////////////////////////////////////////
|
27 |
|
|
|
28 |
|
|
//////////////////////////////////////////////////////////////////////
|
29 |
|
|
//// ////
|
30 |
|
|
//// MESI_ISC Project ////
|
31 |
|
|
//// ////
|
32 |
|
|
//// Author(s): ////
|
33 |
|
|
//// - Yair Amitay yair.amitay@yahoo.com ////
|
34 |
|
|
//// www.linkedin.com/in/yairamitay ////
|
35 |
|
|
//// ////
|
36 |
|
|
//// Description ////
|
37 |
|
|
//// mesi_isc_broad ////
|
38 |
|
|
//// ------------------- ////
|
39 |
|
|
//// ////
|
40 |
|
|
//// ////
|
41 |
|
|
//// To Do: ////
|
42 |
|
|
//// - ////
|
43 |
|
|
//// ////
|
44 |
|
|
//////////////////////////////////////////////////////////////////////
|
45 |
|
|
|
46 |
|
|
`include "mesi_isc_define.v"
|
47 |
|
|
|
48 |
|
|
module mesi_isc_broad
|
49 |
|
|
(
|
50 |
|
|
// Inputs
|
51 |
|
|
clk,
|
52 |
|
|
rst,
|
53 |
|
|
cbus_ack_array_i,
|
54 |
|
|
broad_fifo_wr_i,
|
55 |
|
|
broad_addr_i,
|
56 |
|
|
broad_type_i,
|
57 |
|
|
broad_cpu_id_i,
|
58 |
|
|
broad_id_i,
|
59 |
|
|
// Outputs
|
60 |
|
|
cbus_addr_o,
|
61 |
|
|
cbus_cmd_array_o,
|
62 |
|
|
fifo_status_full_o
|
63 |
|
|
);
|
64 |
|
|
parameter
|
65 |
|
|
CBUS_CMD_WIDTH = 3,
|
66 |
|
|
ADDR_WIDTH = 32,
|
67 |
|
|
BROAD_TYPE_WIDTH = 2,
|
68 |
|
|
BROAD_ID_WIDTH = 5,
|
69 |
|
|
BROAD_REQ_FIFO_SIZE = 4,
|
70 |
|
|
BROAD_REQ_FIFO_SIZE_LOG2 = 2;
|
71 |
|
|
|
72 |
|
|
// Inputs
|
73 |
|
|
//================================
|
74 |
|
|
// System
|
75 |
|
|
input clk; // System clock
|
76 |
|
|
input rst; // Active high system reset
|
77 |
|
|
// Coherence bus
|
78 |
|
|
input [3:0] cbus_ack_array_i;
|
79 |
|
|
input broad_fifo_wr_i; // Write the broadcast request
|
80 |
|
|
input [ADDR_WIDTH-1:0] broad_addr_i; // Broad addresses
|
81 |
|
|
input [BROAD_TYPE_WIDTH-1:0] broad_type_i; // Broad type
|
82 |
|
|
input [1:0] broad_cpu_id_i; // Initiators
|
83 |
|
|
// CPU id array
|
84 |
|
|
input [BROAD_ID_WIDTH-1:0] broad_id_i; // Broadcast request ID array
|
85 |
|
|
|
86 |
|
|
// Outputs
|
87 |
|
|
//================================
|
88 |
|
|
|
89 |
|
|
output [ADDR_WIDTH-1:0] cbus_addr_o; // Coherence bus address. All busses have
|
90 |
|
|
// the same address
|
91 |
|
|
output [4*CBUS_CMD_WIDTH-1:0] cbus_cmd_array_o; // See broad_addr_i
|
92 |
|
|
|
93 |
|
|
output fifo_status_full_o; // The broad fifo is full
|
94 |
|
|
|
95 |
|
|
// Regs & wires
|
96 |
|
|
//================================
|
97 |
|
|
wire broad_fifo_rd; // Read broadcast
|
98 |
|
|
wire fifo_status_empty; // Status empty
|
99 |
|
|
wire fifo_status_full; // The broad fifo is full
|
100 |
|
|
wire [ADDR_WIDTH-1:0] broad_snoop_addr; // Address of broadcast snooping
|
101 |
|
|
wire [BROAD_TYPE_WIDTH-1:0] broad_snoop_type; // Type of broadcast snooping
|
102 |
|
|
wire [1:0] broad_snoop_cpu_id; // ID of initiator of broadcast
|
103 |
|
|
// snooping
|
104 |
|
|
wire [BROAD_ID_WIDTH-1:0] broad_snoop_id; // Broadcast snooping ID
|
105 |
|
|
\
|
106 |
|
|
// assign
|
107 |
|
|
//================================
|
108 |
|
|
assign cbus_addr_o[ADDR_WIDTH-1:0] = broad_snoop_addr[ADDR_WIDTH-1:0];
|
109 |
|
|
assign fifo_status_full_o = fifo_status_full;
|
110 |
|
|
|
111 |
|
|
// Breq fifo control
|
112 |
|
|
//================================
|
113 |
|
|
mesi_isc_broad_cntl #(CBUS_CMD_WIDTH,
|
114 |
|
|
BROAD_TYPE_WIDTH,
|
115 |
|
|
BROAD_ID_WIDTH)
|
116 |
|
|
mesi_isc_broad_cntl
|
117 |
|
|
(
|
118 |
|
|
// Inputs
|
119 |
|
|
.clk (clk),
|
120 |
|
|
.rst (rst),
|
121 |
|
|
// Coherence buses
|
122 |
|
|
.cbus_ack_array_i (cbus_ack_array_i[3:0]),
|
123 |
|
|
// broad_fifo
|
124 |
|
|
.fifo_status_empty_i (fifo_status_empty),
|
125 |
|
|
.fifo_status_full_i (fifo_status_full),
|
126 |
|
|
// broad_fifo
|
127 |
|
|
.broad_snoop_type_i (broad_snoop_type[BROAD_TYPE_WIDTH-1:0]),
|
128 |
|
|
.broad_snoop_cpu_id_i (broad_snoop_cpu_id[1:0]),
|
129 |
|
|
.broad_snoop_id_i (broad_snoop_id[BROAD_ID_WIDTH-1:0]),
|
130 |
|
|
|
131 |
|
|
// Outputs
|
132 |
|
|
// Coherence buses
|
133 |
|
|
.cbus_cmd_array_o (cbus_cmd_array_o[4*CBUS_CMD_WIDTH-1:0]),
|
134 |
|
|
// fifo
|
135 |
|
|
.broad_fifo_rd_o (broad_fifo_rd)
|
136 |
|
|
);
|
137 |
|
|
|
138 |
|
|
// broad fifo
|
139 |
|
|
//================================
|
140 |
|
|
mesi_isc_basic_fifo #(ADDR_WIDTH + // DATA_WIDTH
|
141 |
|
|
BROAD_TYPE_WIDTH +
|
142 |
|
|
2 + // BROAD_CPU_ID_WIDTH
|
143 |
|
|
BROAD_ID_WIDTH,
|
144 |
|
|
BROAD_REQ_FIFO_SIZE, // FIFO_SIZE
|
145 |
|
|
BROAD_REQ_FIFO_SIZE_LOG2) // FIFO_SIZE_LOG2
|
146 |
|
|
// \ / (\ / marks the fifo ID)
|
147 |
|
|
broad_fifo
|
148 |
|
|
(
|
149 |
|
|
// Inputs
|
150 |
|
|
.clk (clk),
|
151 |
|
|
.rst (rst),
|
152 |
|
|
.wr_i (broad_fifo_wr_i),
|
153 |
|
|
.rd_i (broad_fifo_rd),
|
154 |
|
|
.data_i ({broad_addr_i[ADDR_WIDTH-1:0],
|
155 |
|
|
broad_type_i[BROAD_TYPE_WIDTH-1:0],
|
156 |
|
|
broad_cpu_id_i[1:0],
|
157 |
|
|
broad_id_i[BROAD_ID_WIDTH-1:0]
|
158 |
|
|
}),
|
159 |
|
|
// Outputs
|
160 |
|
|
.data_o ({broad_snoop_addr[ADDR_WIDTH-1:0],
|
161 |
|
|
broad_snoop_type[BROAD_TYPE_WIDTH-1:0],
|
162 |
|
|
broad_snoop_cpu_id[1:0],
|
163 |
|
|
broad_snoop_id[BROAD_ID_WIDTH-1:0]
|
164 |
|
|
}),
|
165 |
|
|
.status_empty_o (fifo_status_empty),
|
166 |
|
|
.status_full_o (fifo_status_full)
|
167 |
|
|
);
|
168 |
|
|
|
169 |
|
|
endmodule
|
170 |
|
|
|