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

Subversion Repositories ao68000

[/] [ao68000/] [trunk/] [tests/] [soc_for_linux_on_terasic_de2_70/] [verilog/] [soc_for_linux.v] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 alfik
/*
2
 * Copyright 2010, Aleksander Osman, alfik@poczta.fm. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without modification, are
5
 * permitted provided that the following conditions are met:
6
 *
7
 *  1. Redistributions of source code must retain the above copyright notice, this list of
8
 *     conditions and the following disclaimer.
9
 *
10
 *  2. Redistributions in binary form must reproduce the above copyright notice, this list
11
 *     of conditions and the following disclaimer in the documentation and/or other materials
12
 *     provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
15
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
16
 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
17
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20
 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
21
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
22
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23
 */
24
 
25
module soc_for_linux(
26
        input clk_i,
27
        input rst_i,
28
 
29
        //ssram interface
30
        output [18:0] ssram_address,
31
        output ssram_oe_n,
32
        output ssram_writeen_n,
33
        output ssram_byteen0_n,
34
        output ssram_byteen1_n,
35
        output ssram_byteen2_n,
36
        output ssram_byteen3_n,
37
 
38
        inout [31:0] ssram_data,
39
 
40
        output ssram_clk,
41
        //output ssram_mode,
42
        //output ssram_zz,
43
        output ssram_globalw_n,
44
        output ssram_advance_n,
45
        output ssram_adsp_n,
46
        output ssram_adsc_n,
47
        output ssram_ce1_n,
48
        output ssram_ce2,
49
        output ssram_ce3_n,
50
 
51
        //sd interface
52
        output sd_clk_o,
53
        inout sd_cmd_io,
54
        inout sd_dat_io,
55
 
56
        //serial interface
57
        input uart_rxd,
58
        input uart_rts,
59
        output uart_txd,
60
        output uart_cts,
61
 
62
        //debug
63
        output [5:0] sd_debug,
64
        output [7:0] pc_debug
65
);
66
 
67
assign pc_debug = 8'd0;
68
 
69
/*
70
MASTER ao68000          connected with SLAVES: ssram, serial_txd
71
MASTER sd                       connected with SLAVES: ssram
72
MASTER early_boot       connected with SLAVES: sd
73
 
74
Address space:
75
SLAVE sd:                       0x30000000 - 0x30000003 /not used - point to point connection/
76
SLAVE ssram:            0x00000000 - 0x00100000
77
SLAVE serial_txt:       0x38000000 - 0x38000000
78
*/
79
 
80
 
81
/***********************************************************************************************************************
82
 * MASTER ao68000
83
 **********************************************************************************************************************/
84
 
85
//------------------------------------- global wires
86
//output
87
wire ao68000_cyc_o;
88
wire [31:2] ao68000_adr_o;
89
wire [31:0] ao68000_dat_o;
90
wire [3:0] ao68000_sel_o;
91
wire ao68000_stb_o;
92
wire ao68000_we_o;
93
 
94
ao68000 m_ao68000(
95
        //****************** WISHBONE
96
        .CLK_I(clk_i),
97
        .reset_n((early_boot_loading_finished_o == 1'b1) ? 1'b1 : 1'b0),
98
 
99
        .CYC_O(ao68000_cyc_o),
100
        .ADR_O(ao68000_adr_o),
101
        .DAT_O(ao68000_dat_o),
102
        .DAT_I( ssram_dat_o ),
103
        .SEL_O(ao68000_sel_o),
104
        .STB_O(ao68000_stb_o),
105
        .WE_O(ao68000_we_o),
106
 
107
        .ACK_I( (ao68000_adr_o[31:2] == 30'h38000000) ? serial_txd_ack_o : ssram_ack_o ),
108
        .ERR_I(1'b0),
109
        .RTY_I(timer_rty_o),
110
 
111
        // TAG_TYPE: TGC_O
112
        .SGL_O(),
113
        .BLK_O(),
114
        .RMW_O(),
115
 
116
        // TAG_TYPE: TGA_O
117
        .CTI_O(),
118
        .BTE_O(),
119
 
120
        // TAG_TYPE: TGC_O
121
        .fc_o(),
122
 
123
        //****************** OTHER
124
        /* interrupt acknowlege:
125
         * ACK_I: interrupt vector on DAT_I[7:0]
126
         * ERR_I: spurious interrupt
127
         * RTY_I: autovector
128
         */
129
        .ipl_i( {2'b00, timer_interrupt_o} ),
130
        .reset_o(),
131
        .blocked_o()
132
);
133
 
134
/***********************************************************************************************************************
135
 * SLAVE timer
136
 **********************************************************************************************************************/
137
 
138
//------------------------------------- global wires
139
//output
140
wire timer_interrupt_o;
141
wire timer_rty_o;
142
 
143
//input
144
 
145
timer m_timer(
146
        .CLK_I(clk_i),
147
        .RST_I(rst_i),
148
 
149
        .ADR_I(ao68000_adr_o),
150
        .CYC_I(ao68000_cyc_o),
151
        .STB_I(ao68000_stb_o),
152
        .WE_I(ao68000_we_o),
153
 
154
        .RTY_O(timer_rty_o),
155
        .interrupt_o(timer_interrupt_o)
156
);
157
 
158
/***********************************************************************************************************************
159
 * SLAVE ssram
160
 **********************************************************************************************************************/
161
 
162
//------------------------------------- global wires
163
//output
164
wire [31:0] ssram_dat_o;
165
wire ssram_ack_o;
166
 
167
//input
168
 
169
 
170
ssram m_ssram(
171
        .CLK_I(clk_i),
172
        .RST_I(rst_i),
173
 
174
        //slave
175
        .DAT_O(ssram_dat_o),
176
        .DAT_I((early_boot_loading_finished_o == 1'b1) ? ao68000_dat_o : sd_dat_o),
177
        .ACK_O(ssram_ack_o),
178
 
179
        .CYC_I((early_boot_loading_finished_o == 1'b1) ?
180
                ( (ao68000_adr_o[31:2] >= 30'h0 && ao68000_adr_o[31:2] < 30'h00080000) ? ao68000_cyc_o : 1'b0 ) :
181
                sd_cyc_o
182
        ),
183
        .ADR_I((early_boot_loading_finished_o == 1'b1) ? ao68000_adr_o[20:2] : sd_adr_o[20:2]),
184
        .STB_I((early_boot_loading_finished_o == 1'b1) ?
185
                ( (ao68000_adr_o[31:2] >= 30'h0 && ao68000_adr_o[31:2] < 30'h00080000) ? ao68000_stb_o : 1'b0 ) :
186
                sd_stb_o
187
        ),
188
        .WE_I((early_boot_loading_finished_o == 1'b1) ? ao68000_we_o : sd_we_o),
189
        .SEL_I((early_boot_loading_finished_o == 1'b1) ? ao68000_sel_o : sd_sel_o),
190
 
191
        //ssram interface
192
        .ssram_address(ssram_address),
193
        .ssram_oe_n(ssram_oe_n),
194
        .ssram_writeen_n(ssram_writeen_n),
195
        .ssram_byteen0_n(ssram_byteen0_n),
196
        .ssram_byteen1_n(ssram_byteen1_n),
197
        .ssram_byteen2_n(ssram_byteen2_n),
198
        .ssram_byteen3_n(ssram_byteen3_n),
199
 
200
        .ssram_data(ssram_data),
201
 
202
        .ssram_clk(ssram_clk),
203
        .ssram_mode(), //ssram_mode),
204
        .ssram_zz(), //ssram_zz),
205
        .ssram_globalw_n(ssram_globalw_n),
206
        .ssram_advance_n(ssram_advance_n),
207
        .ssram_adsp_n(ssram_adsp_n),
208
        .ssram_adsc_n(ssram_adsc_n),
209
        .ssram_ce1_n(ssram_ce1_n),
210
        .ssram_ce2(ssram_ce2),
211
        .ssram_ce3_n(ssram_ce3_n)
212
);
213
 
214
/***********************************************************************************************************************
215
 * MASTER and SLAVE sd
216
 **********************************************************************************************************************/
217
 
218
//------------------------------------- global wires: master
219
//output
220
wire sd_cyc_o;
221
wire [31:0] sd_dat_o;
222
wire sd_stb_o;
223
wire sd_we_o;
224
wire [31:2] sd_adr_o;
225
wire [3:0] sd_sel_o;
226
 
227
//input
228
 
229
//------------------------------------- global wires: slave
230
//output
231
wire [31:0] sd_slave_dat_o;
232
wire sd_ack_o;
233
 
234
sd m_sd(
235
        .CLK_I(clk_i),
236
        .RST_I(rst_i),
237
 
238
        .CYC_O(sd_cyc_o),
239
        .DAT_O(sd_dat_o),
240
        .STB_O(sd_stb_o),
241
        .WE_O(sd_we_o),
242
        .ADR_O(sd_adr_o),
243
        .SEL_O(sd_sel_o),
244
 
245
        .DAT_I(ssram_dat_o),
246
        .ACK_I( (early_boot_loading_finished_o == 1'b1) ? 1'b0 : ssram_ack_o),
247
        .ERR_I(1'b0),
248
        .RTY_I(1'b0),
249
 
250
        // TAG_TYPE: TGC_O
251
        .SGL_O(),
252
        .BLK_O(),
253
        .RMW_O(),
254
 
255
        // TAG_TYPE: TGA_O
256
        .CTI_O(),
257
        .BTE_O(),
258
 
259
        //slave
260
        .slave_DAT_O(sd_slave_dat_o),
261
        .slave_DAT_I(early_boot_dat_o),
262
        .ACK_O(sd_ack_o),
263
        .ERR_O(),
264
        .RTY_O(),
265
 
266
        .CYC_I(early_boot_cyc_o),
267
        .ADR_I(early_boot_adr_o[3:2]),
268
        .STB_I(early_boot_stb_o),
269
        .WE_I(early_boot_we_o),
270
        .SEL_I(early_boot_sel_o),
271
 
272
 
273
        //sd bus 1-bit interface
274
        .sd_clk_o(sd_clk_o),
275
        .sd_cmd_io(sd_cmd_io),
276
        .sd_dat_io(sd_dat_io),
277
 
278
        .debug_leds(sd_debug)
279
);
280
 
281
/***********************************************************************************************************************
282
 * SLAVE serial_txd
283
 **********************************************************************************************************************/
284
 
285
//------------------------------------- global wires
286
//output
287
wire serial_txd_ack_o;
288
 
289
//input
290
 
291
serial_txd m_serial_txd(
292
        .CLK_I(clk_i),
293
        .RST_I(rst_i),
294
 
295
        //slave
296
        .DAT_I( (ao68000_adr_o[31:2] == 30'h38000000) ?
297
                (
298
                        (ao68000_sel_o[3] == 1'b1) ? ao68000_dat_o[31:24] :
299
                        (ao68000_sel_o[2] == 1'b1) ? ao68000_dat_o[23:16] :
300
                        (ao68000_sel_o[1] == 1'b1) ? ao68000_dat_o[15:8] :
301
                        (ao68000_sel_o[0] == 1'b1) ? ao68000_dat_o[7:0] :
302
                        8'hFF
303
                ) :
304
                8'hFE ),
305
        .ACK_O(serial_txd_ack_o),
306
 
307
        .CYC_I( (ao68000_adr_o[31:2] == 30'h38000000) ? ao68000_cyc_o : 1'b0 ),
308
        .STB_I( (ao68000_adr_o[31:2] == 30'h38000000) ? ao68000_stb_o : 1'b0 ),
309
        .WE_I( ao68000_we_o ),
310
 
311
        //serial interface
312
        .uart_rxd(uart_rxd),
313
        .uart_rts(uart_rts),
314
        .uart_txd(uart_txd),
315
        .uart_cts(uart_cts)
316
);
317
 
318
/***********************************************************************************************************************
319
 * MASTER early_boot
320
 **********************************************************************************************************************/
321
 
322
//------------------------------------- global wires
323
//output
324
wire early_boot_cyc_o;
325
wire [31:0] early_boot_dat_o;
326
wire early_boot_stb_o;
327
wire early_boot_we_o;
328
wire [31:2] early_boot_adr_o;
329
wire [3:0] early_boot_sel_o;
330
 
331
wire early_boot_loading_finished_o;
332
 
333
//input
334
 
335
early_boot m_early_boot(
336
        .CLK_I(clk_i),
337
        .RST_I(rst_i),
338
 
339
        .CYC_O(early_boot_cyc_o),
340
        .DAT_O(early_boot_dat_o),
341
        .STB_O(early_boot_stb_o),
342
        .WE_O(early_boot_we_o),
343
        .ADR_O(early_boot_adr_o),
344
        .SEL_O(early_boot_sel_o),
345
 
346
        .DAT_I(sd_slave_dat_o),
347
        .ACK_I(sd_ack_o),
348
        .ERR_I(1'b0),
349
        .RTY_I(1'b0),
350
 
351
        //****************** OTHER
352
        .loading_finished_o(early_boot_loading_finished_o)
353
);
354
 
355
endmodule
356
 

powered by: WebSVN 2.1.0

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