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

Subversion Repositories ata

[/] [ata/] [trunk/] [rtl/] [verilog/] [ocidec-1/] [atahost_top.v] - Blame information for rev 33

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 22 rherveille
/////////////////////////////////////////////////////////////////////
2
////                                                             ////
3
////  OCIDEC-1 ATA/ATAPI-5 Controller                            ////
4 23 rherveille
////  Top Level                                                 ////
5 22 rherveille
////                                                             ////
6
////  Author: Richard Herveille                                  ////
7
////          richard@asics.ws                                   ////
8
////          www.asics.ws                                       ////
9
////                                                             ////
10
/////////////////////////////////////////////////////////////////////
11
////                                                             ////
12
//// Copyright (C) 2001, 2002 Richard Herveille                  ////
13
////                          richard@asics.ws                   ////
14
////                                                             ////
15
//// This source file may be used and distributed without        ////
16
//// restriction provided that this copyright statement is not   ////
17
//// removed from the file and that any derivative work contains ////
18
//// the original copyright notice and the associated disclaimer.////
19
////                                                             ////
20
////     THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY     ////
21
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED   ////
22
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS   ////
23
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR      ////
24
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,         ////
25
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES    ////
26
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE   ////
27
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR        ////
28
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF  ////
29
//// LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT  ////
30
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT  ////
31
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE         ////
32
//// POSSIBILITY OF SUCH DAMAGE.                                 ////
33
////                                                             ////
34
/////////////////////////////////////////////////////////////////////
35
 
36
//  CVS Log
37 15 rherveille
//
38 23 rherveille
//  $Id: atahost_top.v,v 1.7 2002-02-18 14:25:43 rherveille Exp $
39 22 rherveille
//
40 23 rherveille
//  $Date: 2002-02-18 14:25:43 $
41
//  $Revision: 1.7 $
42 22 rherveille
//  $Author: rherveille $
43
//  $Locker:  $
44
//  $State: Exp $
45
//
46
// Change History:
47
//               rev.: 1.0    June 29th, 2001. Initial Verilog release
48
//               rev.: 1.1    July  3rd, 2001. Changed 'ADR_I[5:2]' into 'ADR_I' on output multiplexor sensitivity list.
49
//               rev.: 1.2    July  9th, 2001. Fixed register control; registers latched data on all edge cycles instead when selected.
50
//               rev.: 1.3    July 11th, 2001. Fixed case sensitivity error (nRESET instead of nReset) in "controller" module declaration.
51
//               rev.: 1.4    July 26th, 2001. Fixed non-blocking assignments.
52
//               rev.: 1.5  August 15th, 2001. Changed port-names to conform to new OpenCores naming-convention.
53
//               rev.: 1.6 October 15th, 2001. Removed ata_defines file. Changed define statement to parameter
54
//
55
//               $Log: not supported by cvs2svn $
56 23 rherveille
//               Revision 1.6  2002/02/16 10:42:17  rherveille
57
//               Added disclaimer
58
//               Added CVS information
59
//               Changed core for new internal counter libraries (synthesis fixes).
60 22 rherveille
//
61
//
62
//
63 23 rherveille
//
64 15 rherveille
 
65 22 rherveille
/////////////////////////////////////////////////////////////
66
//
67 15 rherveille
// DeviceType: OCIDEC-1: OpenCores IDE Controller type1
68
// Features: PIO Compatible Timing
69
// DeviceID: 0x01
70
// RevNo : 0x00
71 22 rherveille
//
72 15 rherveille
 
73
//
74
// Host signals:
75
// Reset
76
// DIOR-                read strobe. The falling edge enables data from device onto DD. The rising edge latches data at the host.
77
// DIOW-                write strobe. The rising edge latches data from DD into the device.
78
// DA(2:0)              3bit binary coded adress
79
// CS0-         select command block registers
80
// CS1-         select control block registers
81
 
82
`include "timescale.v"
83
 
84 17 rherveille
module atahost_top (wb_clk_i, arst_i, wb_rst_i, wb_cyc_i, wb_stb_i, wb_ack_o, wb_err_o,
85 15 rherveille
                wb_adr_i, wb_dat_i, wb_dat_o, wb_sel_i, wb_we_i, wb_inta_o,
86 18 rherveille
                resetn_pad_o, dd_pad_i, dd_pad_o, dd_padoe_o, da_pad_o, cs0n_pad_o,
87 17 rherveille
                cs1n_pad_o, diorn_pad_o, diown_pad_o, iordy_pad_i, intrq_pad_i);
88 15 rherveille
        //
89
        // Parameter declarations
90
        //
91 19 rherveille
        parameter ARST_LVL = 1'b0;                    // asynchronous reset level
92
 
93 15 rherveille
        parameter TWIDTH = 8;                         // counter width
94
        // PIO mode 0 settings (@100MHz clock)
95
        parameter PIO_mode0_T1   =  6;                // 70ns
96
        parameter PIO_mode0_T2   = 28;                // 290ns
97
        parameter PIO_mode0_T4   =  2;                // 30ns
98
        parameter PIO_mode0_Teoc = 23;                // 240ns ==> T0 - T1 - T2 = 600 - 70 - 290 = 240
99
 
100
        //
101
        // inputs & outputs
102
        //
103
 
104
        // WISHBONE SYSCON signals
105
        input wb_clk_i;                               // master clock in
106 17 rherveille
        input arst_i;                                 // asynchronous reset
107
        input wb_rst_i;                               // synchronous reset
108 15 rherveille
 
109
        // WISHBONE SLAVE signals
110
        input        wb_cyc_i;                        // valid bus cycle input
111
        input        wb_stb_i;                        // strobe/core select input
112
        output       wb_ack_o;                        // strobe acknowledge output
113
        output       wb_err_o;                        // error output
114
        input  [6:2] wb_adr_i;                        // A6 = '1' ATA devices selected
115
                                                      //          A5 = '1' CS1- asserted, '0' CS0- asserted
116
                                                      //          A4..A2 ATA address lines
117
                                                      // A6 = '0' ATA controller selected
118
        input  [31:0] wb_dat_i;                       // Databus in
119
        output [31:0] wb_dat_o;                       // Databus out
120
        input  [ 3:0] wb_sel_i;                       // Byte select signals
121
        input         wb_we_i;                        // Write enable input
122
        output        wb_inta_o;                      // interrupt request signal
123
 
124
        // ATA signals
125 17 rherveille
        output        resetn_pad_o;
126
        input  [15:0] dd_pad_i;
127
        output [15:0] dd_pad_o;
128 18 rherveille
        output        dd_padoe_o;
129 17 rherveille
        output [ 2:0] da_pad_o;
130
        output        cs0n_pad_o;
131
        output        cs1n_pad_o;
132 15 rherveille
 
133 17 rherveille
        output        diorn_pad_o;
134
        output        diown_pad_o;
135
        input         iordy_pad_i;
136
        input         intrq_pad_i;
137 15 rherveille
 
138
        //
139
        // constant declarations
140
        //
141
        parameter [3:0] DeviceId = 4'h1;
142
        parameter [3:0] RevisionNo = 4'h0;
143
 
144
        //
145
        // Variable declarations
146
        //
147
 
148
        // registers
149
        wire        IDEctrl_IDEen, IDEctrl_rst;
150 23 rherveille
        wire [ 7:0] PIO_cmdport_T1, PIO_cmdport_T2, PIO_cmdport_T4, PIO_cmdport_Teoc;
151 15 rherveille
        wire        PIO_cmdport_IORDYen;
152
 
153
        wire        PIOack;
154
        wire [15:0] PIOq;
155
 
156
        wire irq; // ATA bus IRQ signal
157
 
158 23 rherveille
 
159 15 rherveille
        /////////////////
160
        // Module body //
161
        /////////////////
162
 
163 17 rherveille
        // generate asynchronous reset level
164
        // arst_signal is either a wire or a NOT-gate
165 19 rherveille
        wire arst_signal = arst_i ^ ARST_LVL;
166 17 rherveille
 
167 23 rherveille
        //
168
        // hookup wishbone slave
169
        //
170
        atahost_wb_slave #(DeviceId, RevisionNo, PIO_mode0_T1,
171
                        PIO_mode0_T2, PIO_mode0_T4, PIO_mode0_Teoc, 0, 0, 0)
172
        u0 (
173
                // WISHBONE SYSCON signals
174
                .clk_i(wb_clk_i),
175
                .arst_i(arst_signal),
176
                .rst_i(wb_rst_i),
177 15 rherveille
 
178 23 rherveille
                // WISHBONE SLAVE signals
179
                .cyc_i(wb_cyc_i),
180
                .stb_i(wb_stb_i),
181
                .ack_o(wb_ack_o),
182
                .rty_o(),
183
                .err_o(wb_err_o),
184
                .adr_i(wb_adr_i),
185
                .dat_i(wb_dat_i),
186
                .dat_o(wb_dat_o),
187
                .sel_i(wb_sel_i),
188
                .we_i(wb_we_i),
189
                .inta_o(wb_inta_o),
190 15 rherveille
 
191 23 rherveille
                // PIO control inputs
192
                .PIOsel(PIOsel),
193
                        //      PIOtip is only asserted during a PIO transfer (No shit! ;)
194
                        //      Since it is impossible to read the status register and access the PIO registers at the same time
195
                        //      this bit is useless (besides using-up resources)
196
                .PIOtip(1'b0),
197
                .PIOack(PIOack),
198
                .PIOq(PIOq),
199
                .PIOpp_full(1'b0), // OCIDEC-1 does not support PIO-write pingpong, negate signal
200
                .irq(irq),
201 15 rherveille
 
202 23 rherveille
                // DMA control inputs (negate all of them, OCIDEC-1 does not support DMA)
203
                .DMAsel(),
204
                .DMAtip(1'b0),
205
                .DMAack(1'b0),
206
                .DMARxEmpty(1'b0),
207
                .DMATxFull(1'b0),
208
                .DMA_dmarq(1'b0),
209
                .DMAq(32'h0),
210 15 rherveille
 
211 23 rherveille
                // outputs
212
                // control register outputs
213
                .IDEctrl_rst(IDEctrl_rst),
214
                .IDEctrl_IDEen(IDEctrl_IDEen),
215
                .IDEctrl_FATR0(),
216
                .IDEctrl_FATR1(),
217
                .IDEctrl_ppen(),
218 15 rherveille
 
219 23 rherveille
                .DMActrl_DMAen(),
220
                .DMActrl_dir(),
221
                .DMActrl_BeLeC0(),
222
                .DMActrl_BeLeC1(),
223 15 rherveille
 
224 23 rherveille
                // CMD port timing registers
225
                .PIO_cmdport_T1(PIO_cmdport_T1),
226
                .PIO_cmdport_T2(PIO_cmdport_T2),
227
                .PIO_cmdport_T4(PIO_cmdport_T4),
228
                .PIO_cmdport_Teoc(PIO_cmdport_Teoc),
229
                .PIO_cmdport_IORDYen(PIO_cmdport_IORDYen),
230 15 rherveille
 
231 23 rherveille
                // data-port0 timing registers
232
                .PIO_dport0_T1(),
233
                .PIO_dport0_T2(),
234
                .PIO_dport0_T4(),
235
                .PIO_dport0_Teoc(),
236
                .PIO_dport0_IORDYen(),
237 15 rherveille
 
238 23 rherveille
                // data-port1 timing registers
239
                .PIO_dport1_T1(),
240
                .PIO_dport1_T2(),
241
                .PIO_dport1_T4(),
242
                .PIO_dport1_Teoc(),
243
                .PIO_dport1_IORDYen(),
244 15 rherveille
 
245 23 rherveille
                // DMA device0 timing registers
246
                .DMA_dev0_Tm(),
247
                .DMA_dev0_Td(),
248
                .DMA_dev0_Teoc(),
249 15 rherveille
 
250 23 rherveille
                // DMA device1 timing registers
251
                .DMA_dev1_Tm(),
252
                .DMA_dev1_Td(),
253
                .DMA_dev1_Teoc()
254
        );
255 15 rherveille
 
256
 
257
        //
258
        // hookup controller section
259
        //
260
        atahost_controller #(TWIDTH, PIO_mode0_T1, PIO_mode0_T2, PIO_mode0_T4, PIO_mode0_Teoc)
261
                u1 (
262
                        .clk(wb_clk_i),
263 17 rherveille
                        .nReset(arst_signal),
264 15 rherveille
                        .rst(wb_rst_i),
265
                        .irq(irq),
266
                        .IDEctrl_rst(IDEctrl_rst),
267
                        .IDEctrl_IDEen(IDEctrl_IDEen),
268
                        .PIO_cmdport_T1(PIO_cmdport_T1),
269
                        .PIO_cmdport_T2(PIO_cmdport_T2),
270
                        .PIO_cmdport_T4(PIO_cmdport_T4),
271
                        .PIO_cmdport_Teoc(PIO_cmdport_Teoc),
272
                        .PIO_cmdport_IORDYen(PIO_cmdport_IORDYen),
273
                        .PIOreq(PIOsel),
274
                        .PIOack(PIOack),
275
                        .PIOa(wb_adr_i[5:2]),
276
                        .PIOd(wb_dat_i[15:0]),
277
                        .PIOq(PIOq),
278
                        .PIOwe(wb_we_i),
279 17 rherveille
                        .RESETn(resetn_pad_o),
280
                        .DDi(dd_pad_i),
281
                        .DDo(dd_pad_o),
282 18 rherveille
                        .DDoe(dd_padoe_o),
283 17 rherveille
                        .DA(da_pad_o),
284
                        .CS0n(cs0n_pad_o),
285
                        .CS1n(cs1n_pad_o),
286
                        .DIORn(diorn_pad_o),
287
                        .DIOWn(diown_pad_o),
288
                        .IORDY(iordy_pad_i),
289
                        .INTRQ(intrq_pad_i)
290 15 rherveille
                );
291
 
292
endmodule

powered by: WebSVN 2.1.0

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