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 ////
|
38 |
|
|
//// ------------------- ////
|
39 |
|
|
//// ////
|
40 |
|
|
//// ////
|
41 |
|
|
//// To Do: ////
|
42 |
|
|
//// - ////
|
43 |
|
|
//// ////
|
44 |
|
|
//////////////////////////////////////////////////////////////////////
|
45 |
|
|
|
46 |
|
|
`include "mesi_isc_define.v"
|
47 |
|
|
|
48 |
|
|
module mesi_isc
|
49 |
|
|
(
|
50 |
|
|
// Inputs
|
51 |
|
|
clk,
|
52 |
|
|
rst,
|
53 |
|
|
mbus_cmd3_i,
|
54 |
|
|
mbus_cmd2_i,
|
55 |
|
|
mbus_cmd1_i,
|
56 |
|
|
mbus_cmd0_i,
|
57 |
|
|
mbus_addr3_i,
|
58 |
|
|
mbus_addr2_i,
|
59 |
|
|
mbus_addr1_i,
|
60 |
|
|
mbus_addr0_i,
|
61 |
|
|
cbus_ack3_i,
|
62 |
|
|
cbus_ack2_i,
|
63 |
|
|
cbus_ack1_i,
|
64 |
|
|
cbus_ack0_i,
|
65 |
|
|
// Outputs
|
66 |
|
|
cbus_addr_o,
|
67 |
|
|
cbus_cmd3_o,
|
68 |
|
|
cbus_cmd2_o,
|
69 |
|
|
cbus_cmd1_o,
|
70 |
|
|
cbus_cmd0_o,
|
71 |
|
|
mbus_ack3_o,
|
72 |
|
|
mbus_ack2_o,
|
73 |
|
|
mbus_ack1_o,
|
74 |
|
|
mbus_ack0_o
|
75 |
|
|
);
|
76 |
|
|
|
77 |
|
|
parameter
|
78 |
|
|
CBUS_CMD_WIDTH = 3,
|
79 |
|
|
ADDR_WIDTH = 32,
|
80 |
|
|
BROAD_TYPE_WIDTH = 2,
|
81 |
|
|
BROAD_ID_WIDTH = 5,
|
82 |
|
|
BROAD_REQ_FIFO_SIZE = 4,
|
83 |
|
|
BROAD_REQ_FIFO_SIZE_LOG2 = 2,
|
84 |
|
|
MBUS_CMD_WIDTH = 3,
|
85 |
|
|
BREQ_FIFO_SIZE = 2,
|
86 |
|
|
BREQ_FIFO_SIZE_LOG2 = 1;
|
87 |
|
|
|
88 |
|
|
// Inputs
|
89 |
|
|
//================================
|
90 |
|
|
// System
|
91 |
|
|
input clk; // System clock
|
92 |
|
|
input rst; // Active high system reset
|
93 |
|
|
// Main buses
|
94 |
|
|
input [MBUS_CMD_WIDTH-1:0] mbus_cmd3_i; // Main bus3 command
|
95 |
|
|
input [MBUS_CMD_WIDTH-1:0] mbus_cmd2_i; // Main bus2 command
|
96 |
|
|
input [MBUS_CMD_WIDTH-1:0] mbus_cmd1_i; // Main bus1 command
|
97 |
|
|
input [MBUS_CMD_WIDTH-1:0] mbus_cmd0_i; // Main bus0 command
|
98 |
|
|
// Coherence buses
|
99 |
|
|
input [ADDR_WIDTH-1:0] mbus_addr3_i; // Coherence bus3 address
|
100 |
|
|
input [ADDR_WIDTH-1:0] mbus_addr2_i; // Coherence bus2 address
|
101 |
|
|
input [ADDR_WIDTH-1:0] mbus_addr1_i; // Coherence bus1 address
|
102 |
|
|
input [ADDR_WIDTH-1:0] mbus_addr0_i; // Coherence bus0 address
|
103 |
|
|
input cbus_ack3_i; // Coherence bus3 acknowledge
|
104 |
|
|
input cbus_ack2_i; // Coherence bus2 acknowledge
|
105 |
|
|
input cbus_ack1_i; // Coherence bus1 acknowledge
|
106 |
|
|
input cbus_ack0_i; // Coherence bus0 acknowledge
|
107 |
|
|
|
108 |
|
|
// Outputs
|
109 |
|
|
//================================
|
110 |
|
|
|
111 |
|
|
output [ADDR_WIDTH-1:0] cbus_addr_o; // Coherence bus address. All busses have
|
112 |
|
|
// the same address
|
113 |
|
|
output [CBUS_CMD_WIDTH-1:0] cbus_cmd3_o; // Coherence bus3 command
|
114 |
|
|
output [CBUS_CMD_WIDTH-1:0] cbus_cmd2_o; // Coherence bus2 command
|
115 |
|
|
output [CBUS_CMD_WIDTH-1:0] cbus_cmd1_o; // Coherence bus1 command
|
116 |
|
|
output [CBUS_CMD_WIDTH-1:0] cbus_cmd0_o; // Coherence bus0 command
|
117 |
|
|
|
118 |
|
|
|
119 |
|
|
output mbus_ack3_o; // Main bus3 acknowledge
|
120 |
|
|
output mbus_ack2_o; // Main bus2 acknowledge
|
121 |
|
|
output mbus_ack1_o; // Main bus1 acknowledge
|
122 |
|
|
output mbus_ack0_o; // Main bus0 acknowledge
|
123 |
|
|
|
124 |
|
|
// Regs & wires
|
125 |
|
|
//================================
|
126 |
|
|
wire broad_fifo_wr;
|
127 |
|
|
wire [ADDR_WIDTH-1:0] broad_addr;
|
128 |
|
|
wire [BROAD_ID_WIDTH-1:0] broad_id;
|
129 |
|
|
wire [BROAD_TYPE_WIDTH-1:0] broad_type;
|
130 |
|
|
wire [1:0] broad_cpu_id;
|
131 |
|
|
wire broad_fifo_status_full;
|
132 |
|
|
|
133 |
|
|
// mesi_isc_broad
|
134 |
|
|
//================================
|
135 |
|
|
mesi_isc_broad #(CBUS_CMD_WIDTH,
|
136 |
|
|
ADDR_WIDTH,
|
137 |
|
|
BROAD_TYPE_WIDTH,
|
138 |
|
|
BROAD_ID_WIDTH,
|
139 |
|
|
BROAD_REQ_FIFO_SIZE,
|
140 |
|
|
BROAD_REQ_FIFO_SIZE_LOG2)
|
141 |
|
|
mesi_isc_broad
|
142 |
|
|
(
|
143 |
|
|
// Inputs
|
144 |
|
|
.clk (clk),
|
145 |
|
|
.rst (rst),
|
146 |
|
|
.cbus_ack_array_i ({cbus_ack3_i,
|
147 |
|
|
cbus_ack2_i,
|
148 |
|
|
cbus_ack1_i,
|
149 |
|
|
cbus_ack0_i}
|
150 |
|
|
),
|
151 |
|
|
.broad_fifo_wr_i (broad_fifo_wr ),
|
152 |
|
|
.broad_addr_i (broad_addr[ADDR_WIDTH-1:0]),
|
153 |
|
|
.broad_type_i (broad_type[BROAD_TYPE_WIDTH-1:0]),
|
154 |
|
|
.broad_cpu_id_i (broad_cpu_id[1:0]),
|
155 |
|
|
.broad_id_i (broad_id[BROAD_ID_WIDTH-1:0]),
|
156 |
|
|
// Outputs
|
157 |
|
|
.cbus_addr_o (cbus_addr_o[ADDR_WIDTH-1:0]),
|
158 |
|
|
.cbus_cmd_array_o ({cbus_cmd3_o[CBUS_CMD_WIDTH-1:0],
|
159 |
|
|
cbus_cmd2_o[CBUS_CMD_WIDTH-1:0],
|
160 |
|
|
cbus_cmd1_o[CBUS_CMD_WIDTH-1:0],
|
161 |
|
|
cbus_cmd0_o[CBUS_CMD_WIDTH-1:0]}
|
162 |
|
|
),
|
163 |
|
|
.fifo_status_full_o (broad_fifo_status_full)
|
164 |
|
|
);
|
165 |
|
|
|
166 |
|
|
// mesi_isc_breq_fifos
|
167 |
|
|
//================================
|
168 |
|
|
mesi_isc_breq_fifos #(MBUS_CMD_WIDTH,
|
169 |
|
|
ADDR_WIDTH,
|
170 |
|
|
BROAD_TYPE_WIDTH,
|
171 |
|
|
BROAD_ID_WIDTH,
|
172 |
|
|
BREQ_FIFO_SIZE,
|
173 |
|
|
BREQ_FIFO_SIZE_LOG2)
|
174 |
|
|
mesi_isc_breq_fifos
|
175 |
|
|
(
|
176 |
|
|
// Inputs
|
177 |
|
|
.clk (clk),
|
178 |
|
|
.rst (rst),
|
179 |
|
|
.mbus_cmd_array_i ({mbus_cmd3_i[MBUS_CMD_WIDTH-1:0],
|
180 |
|
|
mbus_cmd2_i[MBUS_CMD_WIDTH-1:0],
|
181 |
|
|
mbus_cmd1_i[MBUS_CMD_WIDTH-1:0],
|
182 |
|
|
mbus_cmd0_i[MBUS_CMD_WIDTH-1:0]}
|
183 |
|
|
),
|
184 |
|
|
.mbus_addr_array_i ({mbus_addr3_i[ADDR_WIDTH-1:0],
|
185 |
|
|
mbus_addr2_i[ADDR_WIDTH-1:0],
|
186 |
|
|
mbus_addr1_i[ADDR_WIDTH-1:0],
|
187 |
|
|
mbus_addr0_i[ADDR_WIDTH-1:0]}
|
188 |
|
|
),
|
189 |
|
|
.broad_fifo_status_full_i (broad_fifo_status_full),
|
190 |
|
|
// Outputs
|
191 |
|
|
.mbus_ack_array_o ({mbus_ack3_o,
|
192 |
|
|
mbus_ack2_o,
|
193 |
|
|
mbus_ack1_o,
|
194 |
|
|
mbus_ack0_o}
|
195 |
|
|
),
|
196 |
|
|
.broad_fifo_wr_o (broad_fifo_wr ),
|
197 |
|
|
.broad_addr_o (broad_addr[ADDR_WIDTH-1:0]),
|
198 |
|
|
.broad_type_o (broad_type[BROAD_TYPE_WIDTH-1:0]),
|
199 |
|
|
.broad_cpu_id_o (broad_cpu_id[1:0]),
|
200 |
|
|
.broad_id_o (broad_id[BROAD_ID_WIDTH-1:0])
|
201 |
|
|
);
|
202 |
|
|
|
203 |
|
|
endmodule
|