OpenCores
URL https://opencores.org/ocsvn/thor/thor/trunk

Subversion Repositories thor

[/] [thor/] [trunk/] [FT64v5/] [rtl/] [common/] [FT64_mpu.v] - Blame information for rev 49

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 48 robfinch
`timescale 1ns / 1ps
2
// ============================================================================
3
//        __
4
//   \\__/ o\    (C) 2017-2018  Robert Finch, Waterloo
5
//    \  __ /    All rights reserved.
6
//     \/_//     robfinch<remove>@finitron.ca
7
//       ||
8
//
9
//      FT64_MPU.v
10
//              
11
//
12
// This source file is free software: you can redistribute it and/or modify 
13
// it under the terms of the GNU Lesser General Public License as published 
14
// by the Free Software Foundation, either version 3 of the License, or     
15
// (at your option) any later version.                                      
16
//                                                                          
17
// This source file is distributed in the hope that it will be useful,      
18
// but WITHOUT ANY WARRANTY; without even the implied warranty of           
19
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            
20
// GNU General Public License for more details.                             
21
//                                                                          
22
// You should have received a copy of the GNU General Public License        
23
// along with this program.  If not, see <http://www.gnu.org/licenses/>.    
24
//                                                                          
25
//
26
// ============================================================================
27
//
28
module FT64_mpu(hartid_i,rst_i, clk4x_i, clk_i, tm_clk_i,
29
        pit_clk2, pit_gate2, pit_out2,
30
        irq_o,
31
    i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,i12,i13,i14,i15,i16,i17,i18,i19,
32
    i20,i21,i22,i23,i24,i25,i26,i27,i28,i29,
33
        cti_o,bte_o,cyc_o,stb_o,ack_i,err_i,we_o,sel_o,adr_o,dat_o,dat_i,
34
        sr_o, cr_o, rb_i);
35
input [63:0] hartid_i;
36
input rst_i;
37
input clk4x_i;
38
input clk_i;
39
input tm_clk_i;
40
input pit_clk2;
41
input pit_gate2;
42
output pit_out2;
43
output [2:0] irq_o;
44
input i1;
45
input i2;
46
input i3;
47
input i4;
48
input i5;
49
input i6;
50
input i7;
51
input i8;
52
input i9;
53
input i10;
54
input i11;
55
input i12;
56
input i13;
57
input i14;
58
input i15;
59
input i16;
60
input i17;
61
input i18;
62
input i19;
63
input i20;
64
input i21;
65
input i22;
66
input i23;
67
input i24;
68
input i25;
69
input i26;
70
input i27;
71
input i28;
72
input i29;
73
output [2:0] cti_o;
74
output [1:0] bte_o;
75
output cyc_o;
76
output stb_o;
77
input ack_i;
78
input err_i;
79
output we_o;
80
output [7:0] sel_o;
81
output [31:0] adr_o;
82
output [63:0] dat_o;
83
input [63:0] dat_i;
84
output sr_o;
85
output cr_o;
86
input rb_i;
87
 
88
wire cyc,stb,we;
89
wire [31:0] adr;
90
reg [63:0] dati;
91 49 robfinch
wire [3:0] irq;
92 48 robfinch
wire [6:0] cause;
93
wire mmu_ack;
94
wire [31:0] mmu_dato;
95
wire pic_ack;
96
wire [31:0] pic_dato;
97
wire pit_ack;
98
wire [31:0] pit_dato;
99
wire pit_out0, pit_out1;
100
wire crd_ack;
101
wire [63:0] crd_dato;
102
wire ack;
103
wire [2:0] ol;
104
wire [31:0] pcr;
105
wire [63:0] pcr2;
106
wire icl;           // instruction cache load
107
wire exv,rdv,wrv;
108
wire pulse60;
109
wire sptr_o;
110
 
111
wire cs_pit = adr[31:8]==24'hFFDC11;
112
wire cs_crd = adr[31:11]==21'd0;        // $00000000 in virtual address space
113
 
114
FT64_pit upit1
115
(
116
        .rst_i(rst_i),
117
        .clk_i(clk_i),
118
        .cs_i(cs_pit),
119
        .cyc_i(cyc),
120
        .stb_i(stb),
121
        .ack_o(pit_ack),
122
        .sel_i(sel_o[7:4]|sel_o[3:0]),
123
        .we_i(we_o),
124
        .adr_i(adr[5:0]),
125
        .dat_i(dat_o[31:0]),
126
        .dat_o(pit_dato),
127
        .clk0(1'b0),
128
        .gate0(1'b0),
129
        .out0(pit_out0),
130
        .clk1(1'b0),
131
        .gate1(1'b0),
132
        .out1(pit_out1),
133
        .clk2(1'b0),
134
        .gate2(1'b0),
135
        .out2(pit_out2)
136
);
137
 
138
FT64_pic upic1
139
(
140
        .rst_i(rst_i),          // reset
141
        .clk_i(clk_i),          // system clock
142
        .cyc_i(cyc),
143
        .stb_i(stb),
144
        .ack_o(pic_ack),    // controller is ready
145
        .wr_i(we_o),            // write
146
        .adr_i(adr),            // address
147
        .dat_i(dat_o[31:0]),
148
        .dat_o(pic_dato),
149
        .vol_o(),                       // volatile register selected
150
        .i1(i1),
151
        .i2(i2),
152
        .i3(i3),
153
        .i4(i4),
154
        .i5(i5),
155
        .i6(i6),
156
        .i7(i7),
157
        .i8(i8),
158
        .i9(i9),
159
        .i10(i10),
160
        .i11(i11),
161
        .i12(i12),
162
        .i13(i13),
163
        .i14(i14),
164
        .i15(i15),
165
        .i16(i16),
166
        .i17(i17),
167
        .i18(i18),
168
        .i19(i19),
169
        .i20(i20),
170
        .i21(i21),
171
        .i22(i22),
172
        .i23(i23),
173
        .i24(i24),
174
        .i25(i25),
175
        .i26(i26),
176
        .i27(i27),
177
        .i28(i28),
178
        .i29(pit_out2), // garbage collector stop interrupt
179
        .i30(pit_out1), // garbage collector interrupt
180
        .i31(pit_out0), // time slice interrupt
181
        .irqo(irq),
182
        .nmii(1'b0),
183
        .nmio(),
184
        .causeo(cause)
185
);
186
 
187
assign irq_o = irq;
188
 
189
FT64_mmu ummu1
190
(
191
    .rst_i(rst_i),
192
    .clk_i(clk_i),
193
    .ol_i(ol),
194
    .pcr_i(pcr),
195
    .pcr2_i(pcr2),
196
    .mapen_i(pcr[31]),
197
    .s_ex_i(icl),
198
    .s_cyc_i(cyc),
199
    .s_stb_i(stb),
200
    .s_ack_o(mmu_ack),
201
    .s_wr_i(we_o),
202
    .s_adr_i(adr),
203
    .s_dat_i(dat_o[31:0]),
204
    .s_dat_o(mmu_dato),
205
    .cyc_o(cyc_o),
206
    .stb_o(stb_o),
207
    .pea_o(adr_o),
208
    .exv_o(exv),
209
    .rdv_o(rdv),
210
    .wrv_o(wrv)
211
);
212
 
213
CardMemory ucrd1
214
(
215
        .clk_i(clk_i),
216 49 robfinch
        .cs_i(cs_crd & cyc_o & stb_o),
217 48 robfinch
        .ack_o(crd_ack),
218
        .wr_i(we_o),
219
        .adr_i(adr),
220
        .dat_i(dat_o),
221
        .dat_o(crd_dato),
222
        .stp(1'b0),
223
        .mapno(pcr[5:0])
224
);
225
 
226
 
227
always @*
228
casez({mmu_ack,pic_ack,pit_ack,crd_ack})
229
4'b1???:    dati <= {2{mmu_dato}};
230
4'b01??:        dati <= {2{pic_dato}};
231
4'b001?:        dati <= {2{pit_dato}};
232
4'b0001:        dati <= crd_dato;
233
default:    dati <= dat_i;
234
endcase
235
 
236
assign ack = ack_i|mmu_ack|pic_ack|crd_ack;
237
 
238
FT64 ucpu1
239
(
240
    .hartid(hartid_i),
241
    .rst(rst_i),
242
    .clk_i(clk_i),
243
    .clk4x(clk4x_i),
244
    .tm_clk_i(tm_clk_i),
245
    .irq_i(irq),
246
    .vec_i(cause),
247
    .cti_o(cti_o),
248
    .bte_o(bte_o),
249
    .cyc_o(cyc),
250
    .stb_o(stb),
251
    .ack_i(ack),
252
    .err_i(err_i),
253
    .we_o(we_o),
254
    .sel_o(sel_o),
255
    .adr_o(adr),
256
    .dat_o(dat_o),
257
    .dat_i(dati),
258
    .ol_o(ol),
259
    .pcr_o(pcr),
260
    .pcr2_o(pcr2),
261
    .icl_o(icl),
262
    .exv_i(exv),
263
    .rdv_i(rdv),
264
    .wrv_i(wrv),
265
    .sr_o(sr_o),
266
    .cr_o(cr_o),
267
    .rbi_i(rb_i)
268
);
269
 
270
endmodule

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.