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

Subversion Repositories ps2

[/] [ps2/] [tags/] [rel_14/] [rtl/] [verilog/] [ps2_top.v] - Blame information for rev 15

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

Line No. Rev Author Line
1 2 mihad
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  ps2_top.v                                                   ////
4
////                                                              ////
5
////  This file is part of the "ps2" project                      ////
6
////  http://www.opencores.org/cores/ps2/                         ////
7
////                                                              ////
8
////  Author(s):                                                  ////
9
////      - mihad@opencores.org                                   ////
10
////      - Miha Dolenc                                           ////
11
////                                                              ////
12
////  All additional information is avaliable in the README.txt   ////
13
////  file.                                                       ////
14
////                                                              ////
15
////                                                              ////
16
//////////////////////////////////////////////////////////////////////
17
////                                                              ////
18
//// Copyright (C) 2000 Miha Dolenc, mihad@opencores.org          ////
19
////                                                              ////
20
//// This source file may be used and distributed without         ////
21
//// restriction provided that this copyright statement is not    ////
22
//// removed from the file and that any derivative work contains  ////
23
//// the original copyright notice and the associated disclaimer. ////
24
////                                                              ////
25
//// This source file is free software; you can redistribute it   ////
26
//// and/or modify it under the terms of the GNU Lesser General   ////
27
//// Public License as published by the Free Software Foundation; ////
28
//// either version 2.1 of the License, or (at your option) any   ////
29
//// later version.                                               ////
30
////                                                              ////
31
//// This source is distributed in the hope that it will be       ////
32
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
33
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
34
//// PURPOSE.  See the GNU Lesser General Public License for more ////
35
//// details.                                                     ////
36
////                                                              ////
37
//// You should have received a copy of the GNU Lesser General    ////
38
//// Public License along with this source; if not, download it   ////
39
//// from http://www.opencores.org/lgpl.shtml                     ////
40
////                                                              ////
41
//////////////////////////////////////////////////////////////////////
42
//
43
// CVS Revision History
44
//
45
// $Log: not supported by cvs2svn $
46 15 simons
// Revision 1.2  2002/04/09 13:21:15  mihad
47
// Added mouse interface and everything for its handling, cleaned up some unused code
48
//
49 13 mihad
// Revision 1.1.1.1  2002/02/18 16:16:56  mihad
50
// Initial project import - working
51 2 mihad
//
52 13 mihad
//
53 2 mihad
 
54
`include "ps2_defines.v"
55
// synopsys translate_off
56
`include "timescale.v"
57
// synopsys translate_on
58
 
59
module ps2_top
60
(
61
    wb_clk_i,
62
    wb_rst_i,
63
    wb_cyc_i,
64
    wb_stb_i,
65
    wb_we_i,
66
    wb_sel_i,
67
    wb_adr_i,
68
    wb_dat_i,
69
    wb_dat_o,
70
    wb_ack_o,
71
 
72 13 mihad
    wb_int_o,
73
 
74 2 mihad
    ps2_kbd_clk_pad_i,
75
    ps2_kbd_data_pad_i,
76
    ps2_kbd_clk_pad_o,
77
    ps2_kbd_data_pad_o,
78
    ps2_kbd_clk_pad_oe_o,
79
    ps2_kbd_data_pad_oe_o
80 13 mihad
    `ifdef PS2_AUX
81
    ,
82
    wb_intb_o,
83
 
84
    ps2_aux_clk_pad_i,
85
    ps2_aux_data_pad_i,
86
    ps2_aux_clk_pad_o,
87
    ps2_aux_data_pad_o,
88
    ps2_aux_clk_pad_oe_o,
89
    ps2_aux_data_pad_oe_o
90
    `endif
91 2 mihad
) ;
92
 
93
input wb_clk_i,
94
      wb_rst_i,
95
      wb_cyc_i,
96
      wb_stb_i,
97
      wb_we_i ;
98
 
99
input [3:0] wb_sel_i ;
100
 
101 15 simons
input [2:0] wb_adr_i,
102 2 mihad
            wb_dat_i ;
103
 
104
output [31:0] wb_dat_o ;
105
 
106
output wb_ack_o ;
107
 
108
output wb_int_o ;
109
 
110
input ps2_kbd_clk_pad_i,
111
      ps2_kbd_data_pad_i ;
112
 
113
output ps2_kbd_clk_pad_o,
114
       ps2_kbd_data_pad_o,
115
       ps2_kbd_clk_pad_oe_o,
116
       ps2_kbd_data_pad_oe_o ;
117
 
118 13 mihad
`ifdef PS2_AUX
119
output wb_intb_o ;
120
input ps2_aux_clk_pad_i,
121
      ps2_aux_data_pad_i ;
122
 
123
output ps2_aux_clk_pad_o,
124
       ps2_aux_data_pad_o,
125
       ps2_aux_clk_pad_oe_o,
126
       ps2_aux_data_pad_oe_o ;
127
 
128
assign ps2_aux_clk_pad_o  = 1'b0 ;
129
assign ps2_aux_data_pad_o = 1'b0 ;
130
`endif
131
 
132
wire rx_released,
133
     rx_kbd_data_ready,
134 2 mihad
     rx_translated_data_ready,
135 13 mihad
     rx_kbd_read_wb,
136
     rx_kbd_read_tt,
137
     tx_kbd_write,
138
     tx_kbd_write_ack,
139 2 mihad
     tx_error_no_keyboard_ack,
140
     ps2_ctrl_kbd_data_en_,
141
     ps2_ctrl_kbd_clk_en_,
142
     ps2_ctrl_kbd_clk,
143
     inhibit_kbd_if ;
144
 
145 13 mihad
wire [7:0] rx_scan_code,
146 2 mihad
           rx_translated_scan_code,
147 13 mihad
           tx_kbd_data ;
148 2 mihad
 
149
assign ps2_kbd_clk_pad_o  = 1'b0 ;
150
assign ps2_kbd_data_pad_o = 1'b0 ;
151
 
152 13 mihad
ps2_io_ctrl i_ps2_io_ctrl_keyboard
153 2 mihad
(
154 13 mihad
    .clk_i               (wb_clk_i),
155
    .rst_i               (wb_rst_i),
156
    .ps2_ctrl_clk_en_i_  (ps2_ctrl_kbd_clk_en_),
157
    .ps2_ctrl_data_en_i_ (ps2_ctrl_kbd_data_en_),
158
    .ps2_clk_pad_i       (ps2_kbd_clk_pad_i),
159
    .ps2_clk_pad_oe_o    (ps2_kbd_clk_pad_oe_o),
160
    .ps2_data_pad_oe_o   (ps2_kbd_data_pad_oe_o),
161
    .inhibit_if_i        (inhibit_kbd_if),
162
    .ps2_ctrl_clk_o      (ps2_ctrl_kbd_clk)
163 2 mihad
);
164
 
165 13 mihad
`ifdef PS2_AUX
166
wire rx_aux_data_ready,
167
     rx_aux_read,
168
     tx_aux_write,
169
     tx_aux_write_ack,
170
     tx_error_no_aux_ack,
171
     ps2_ctrl_aux_data_en_,
172
     ps2_ctrl_aux_clk_en_,
173
     ps2_ctrl_aux_clk,
174
     inhibit_aux_if ;
175
 
176
wire [7:0] rx_aux_data,
177
           tx_aux_data ;
178
 
179
ps2_io_ctrl i_ps2_io_ctrl_auxiliary
180
(
181
    .clk_i               (wb_clk_i),
182
    .rst_i               (wb_rst_i),
183
    .ps2_ctrl_clk_en_i_  (ps2_ctrl_aux_clk_en_),
184
    .ps2_ctrl_data_en_i_ (ps2_ctrl_aux_data_en_),
185
    .ps2_clk_pad_i       (ps2_aux_clk_pad_i),
186
    .ps2_clk_pad_oe_o    (ps2_aux_clk_pad_oe_o),
187
    .ps2_data_pad_oe_o   (ps2_aux_data_pad_oe_o),
188
    .inhibit_if_i        (inhibit_aux_if),
189
    .ps2_ctrl_clk_o      (ps2_ctrl_aux_clk)
190
);
191
 
192
ps2_mouse #(`PS2_TIMER_60USEC_VALUE_PP, `PS2_TIMER_60USEC_BITS_PP, `PS2_TIMER_5USEC_VALUE_PP, `PS2_TIMER_5USEC_BITS_PP)
193
i_ps2_mouse
194
(
195
    .clk                         (wb_clk_i),
196
    .reset                       (wb_rst_i),
197
    .ps2_clk_en_o_               (ps2_ctrl_aux_clk_en_),
198
    .ps2_data_en_o_              (ps2_ctrl_aux_data_en_),
199
    .ps2_clk_i                   (ps2_ctrl_aux_clk),
200
    .ps2_data_i                  (ps2_aux_data_pad_i),
201
    .rx_scan_code                (rx_aux_data),
202
    .rx_data_ready               (rx_aux_data_ready),
203
    .rx_read                     (rx_aux_read),
204
    .tx_data                     (tx_aux_data),
205
    .tx_write                    (tx_aux_write),
206
    .tx_write_ack_o              (tx_aux_write_ack),
207
    .tx_error_no_ack             (tx_error_no_aux_ack)
208
);
209
 
210
`endif
211
 
212
ps2_keyboard #(`PS2_TIMER_60USEC_VALUE_PP, `PS2_TIMER_60USEC_BITS_PP, `PS2_TIMER_5USEC_VALUE_PP, `PS2_TIMER_5USEC_BITS_PP)
213 2 mihad
i_ps2_keyboard
214
(
215
    .clk                         (wb_clk_i),
216
    .reset                       (wb_rst_i),
217
    .ps2_clk_en_o_               (ps2_ctrl_kbd_clk_en_),
218
    .ps2_data_en_o_              (ps2_ctrl_kbd_data_en_),
219
    .ps2_clk_i                   (ps2_ctrl_kbd_clk),
220
    .ps2_data_i                  (ps2_kbd_data_pad_i),
221
    .rx_released                 (rx_released),
222
    .rx_scan_code                (rx_scan_code),
223 13 mihad
    .rx_data_ready               (rx_kbd_data_ready),
224
    .rx_read                     (rx_kbd_read_tt),
225
    .tx_data                     (tx_kbd_data),
226
    .tx_write                    (tx_kbd_write),
227
    .tx_write_ack_o              (tx_kbd_write_ack),
228 2 mihad
    .tx_error_no_keyboard_ack    (tx_error_no_keyboard_ack),
229
    .translate                   (translate)
230
);
231
 
232
ps2_wb_if i_ps2_wb_if
233
(
234
    .wb_clk_i                      (wb_clk_i),
235
    .wb_rst_i                      (wb_rst_i),
236
    .wb_cyc_i                      (wb_cyc_i),
237
    .wb_stb_i                      (wb_stb_i),
238
    .wb_we_i                       (wb_we_i),
239
    .wb_sel_i                      (wb_sel_i),
240
    .wb_adr_i                      (wb_adr_i),
241
    .wb_dat_i                      (wb_dat_i),
242
    .wb_dat_o                      (wb_dat_o),
243
    .wb_ack_o                      (wb_ack_o),
244 13 mihad
 
245 2 mihad
    .wb_int_o                      (wb_int_o),
246 13 mihad
 
247 2 mihad
    .rx_scancode_i                 (rx_translated_scan_code),
248 13 mihad
    .rx_kbd_data_ready_i           (rx_translated_data_ready),
249
    .rx_kbd_read_o                 (rx_kbd_read_wb),
250
    .tx_kbd_data_o                 (tx_kbd_data),
251
    .tx_kbd_write_o                (tx_kbd_write),
252
    .tx_kbd_write_ack_i            (tx_kbd_write_ack),
253 2 mihad
    .translate_o                   (translate),
254 13 mihad
    .ps2_kbd_clk_i                 (ps2_kbd_clk_pad_i),
255 2 mihad
    .inhibit_kbd_if_o              (inhibit_kbd_if)
256 13 mihad
    `ifdef PS2_AUX
257
    ,
258
    .wb_intb_o                     (wb_intb_o),
259
 
260
    .rx_aux_data_i                 (rx_aux_data),
261
    .rx_aux_data_ready_i           (rx_aux_data_ready),
262
    .rx_aux_read_o                 (rx_aux_read),
263
    .tx_aux_data_o                 (tx_aux_data),
264
    .tx_aux_write_o                (tx_aux_write),
265
    .tx_aux_write_ack_i            (tx_aux_write_ack),
266
    .ps2_aux_clk_i                 (ps2_aux_clk_pad_i),
267
    .inhibit_aux_if_o              (inhibit_aux_if)
268
    `endif
269 2 mihad
) ;
270
 
271
ps2_translation_table i_ps2_translation_table
272
(
273
    .reset_i                    (wb_rst_i),
274
    .clock_i                    (wb_clk_i),
275
    .translate_i                (translate),
276
    .code_i                     (rx_scan_code),
277
    .code_o                     (rx_translated_scan_code),
278
    .address_i                  (8'h00),
279
    .data_i                     (8'h00),
280
    .we_i                       (1'b0),
281
    .re_i                       (1'b0),
282
    .data_o                     (),
283 13 mihad
    .rx_data_ready_i            (rx_kbd_data_ready),
284 2 mihad
    .rx_translated_data_ready_o (rx_translated_data_ready),
285 13 mihad
    .rx_read_i                  (rx_kbd_read_wb),
286
    .rx_read_o                  (rx_kbd_read_tt),
287
    .rx_released_i              (rx_released)
288 2 mihad
) ;
289
 
290
endmodule // ps2_top

powered by: WebSVN 2.1.0

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