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 19

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 19 simons
// Revision 1.3  2003/05/28 16:27:09  simons
47
// Change the address width.
48
//
49 15 simons
// Revision 1.2  2002/04/09 13:21:15  mihad
50
// Added mouse interface and everything for its handling, cleaned up some unused code
51
//
52 13 mihad
// Revision 1.1.1.1  2002/02/18 16:16:56  mihad
53
// Initial project import - working
54 2 mihad
//
55 13 mihad
//
56 2 mihad
 
57
`include "ps2_defines.v"
58
// synopsys translate_off
59
`include "timescale.v"
60
// synopsys translate_on
61
 
62
module ps2_top
63
(
64
    wb_clk_i,
65
    wb_rst_i,
66
    wb_cyc_i,
67
    wb_stb_i,
68
    wb_we_i,
69
    wb_sel_i,
70
    wb_adr_i,
71
    wb_dat_i,
72
    wb_dat_o,
73
    wb_ack_o,
74
 
75 13 mihad
    wb_int_o,
76
 
77 2 mihad
    ps2_kbd_clk_pad_i,
78
    ps2_kbd_data_pad_i,
79
    ps2_kbd_clk_pad_o,
80
    ps2_kbd_data_pad_o,
81
    ps2_kbd_clk_pad_oe_o,
82
    ps2_kbd_data_pad_oe_o
83 13 mihad
    `ifdef PS2_AUX
84
    ,
85
    wb_intb_o,
86
 
87
    ps2_aux_clk_pad_i,
88
    ps2_aux_data_pad_i,
89
    ps2_aux_clk_pad_o,
90
    ps2_aux_data_pad_o,
91
    ps2_aux_clk_pad_oe_o,
92
    ps2_aux_data_pad_oe_o
93
    `endif
94 2 mihad
) ;
95
 
96
input wb_clk_i,
97
      wb_rst_i,
98
      wb_cyc_i,
99
      wb_stb_i,
100
      wb_we_i ;
101
 
102
input [3:0] wb_sel_i ;
103
 
104 15 simons
input [2:0] wb_adr_i,
105 19 simons
input [31:0] wb_dat_i ;
106 2 mihad
 
107
output [31:0] wb_dat_o ;
108
 
109
output wb_ack_o ;
110
 
111
output wb_int_o ;
112
 
113
input ps2_kbd_clk_pad_i,
114
      ps2_kbd_data_pad_i ;
115
 
116
output ps2_kbd_clk_pad_o,
117
       ps2_kbd_data_pad_o,
118
       ps2_kbd_clk_pad_oe_o,
119
       ps2_kbd_data_pad_oe_o ;
120
 
121 13 mihad
`ifdef PS2_AUX
122
output wb_intb_o ;
123
input ps2_aux_clk_pad_i,
124
      ps2_aux_data_pad_i ;
125
 
126
output ps2_aux_clk_pad_o,
127
       ps2_aux_data_pad_o,
128
       ps2_aux_clk_pad_oe_o,
129
       ps2_aux_data_pad_oe_o ;
130
 
131
assign ps2_aux_clk_pad_o  = 1'b0 ;
132
assign ps2_aux_data_pad_o = 1'b0 ;
133
`endif
134
 
135
wire rx_released,
136
     rx_kbd_data_ready,
137 2 mihad
     rx_translated_data_ready,
138 13 mihad
     rx_kbd_read_wb,
139
     rx_kbd_read_tt,
140
     tx_kbd_write,
141
     tx_kbd_write_ack,
142 2 mihad
     tx_error_no_keyboard_ack,
143
     ps2_ctrl_kbd_data_en_,
144
     ps2_ctrl_kbd_clk_en_,
145
     ps2_ctrl_kbd_clk,
146
     inhibit_kbd_if ;
147
 
148 13 mihad
wire [7:0] rx_scan_code,
149 2 mihad
           rx_translated_scan_code,
150 13 mihad
           tx_kbd_data ;
151 2 mihad
 
152
assign ps2_kbd_clk_pad_o  = 1'b0 ;
153
assign ps2_kbd_data_pad_o = 1'b0 ;
154
 
155 13 mihad
ps2_io_ctrl i_ps2_io_ctrl_keyboard
156 2 mihad
(
157 13 mihad
    .clk_i               (wb_clk_i),
158
    .rst_i               (wb_rst_i),
159
    .ps2_ctrl_clk_en_i_  (ps2_ctrl_kbd_clk_en_),
160
    .ps2_ctrl_data_en_i_ (ps2_ctrl_kbd_data_en_),
161
    .ps2_clk_pad_i       (ps2_kbd_clk_pad_i),
162
    .ps2_clk_pad_oe_o    (ps2_kbd_clk_pad_oe_o),
163
    .ps2_data_pad_oe_o   (ps2_kbd_data_pad_oe_o),
164
    .inhibit_if_i        (inhibit_kbd_if),
165
    .ps2_ctrl_clk_o      (ps2_ctrl_kbd_clk)
166 2 mihad
);
167
 
168 13 mihad
`ifdef PS2_AUX
169
wire rx_aux_data_ready,
170
     rx_aux_read,
171
     tx_aux_write,
172
     tx_aux_write_ack,
173
     tx_error_no_aux_ack,
174
     ps2_ctrl_aux_data_en_,
175
     ps2_ctrl_aux_clk_en_,
176
     ps2_ctrl_aux_clk,
177
     inhibit_aux_if ;
178
 
179
wire [7:0] rx_aux_data,
180
           tx_aux_data ;
181
 
182
ps2_io_ctrl i_ps2_io_ctrl_auxiliary
183
(
184
    .clk_i               (wb_clk_i),
185
    .rst_i               (wb_rst_i),
186
    .ps2_ctrl_clk_en_i_  (ps2_ctrl_aux_clk_en_),
187
    .ps2_ctrl_data_en_i_ (ps2_ctrl_aux_data_en_),
188
    .ps2_clk_pad_i       (ps2_aux_clk_pad_i),
189
    .ps2_clk_pad_oe_o    (ps2_aux_clk_pad_oe_o),
190
    .ps2_data_pad_oe_o   (ps2_aux_data_pad_oe_o),
191
    .inhibit_if_i        (inhibit_aux_if),
192
    .ps2_ctrl_clk_o      (ps2_ctrl_aux_clk)
193
);
194
 
195
ps2_mouse #(`PS2_TIMER_60USEC_VALUE_PP, `PS2_TIMER_60USEC_BITS_PP, `PS2_TIMER_5USEC_VALUE_PP, `PS2_TIMER_5USEC_BITS_PP)
196
i_ps2_mouse
197
(
198
    .clk                         (wb_clk_i),
199
    .reset                       (wb_rst_i),
200
    .ps2_clk_en_o_               (ps2_ctrl_aux_clk_en_),
201
    .ps2_data_en_o_              (ps2_ctrl_aux_data_en_),
202
    .ps2_clk_i                   (ps2_ctrl_aux_clk),
203
    .ps2_data_i                  (ps2_aux_data_pad_i),
204
    .rx_scan_code                (rx_aux_data),
205
    .rx_data_ready               (rx_aux_data_ready),
206
    .rx_read                     (rx_aux_read),
207
    .tx_data                     (tx_aux_data),
208
    .tx_write                    (tx_aux_write),
209
    .tx_write_ack_o              (tx_aux_write_ack),
210
    .tx_error_no_ack             (tx_error_no_aux_ack)
211
);
212
 
213
`endif
214
 
215
ps2_keyboard #(`PS2_TIMER_60USEC_VALUE_PP, `PS2_TIMER_60USEC_BITS_PP, `PS2_TIMER_5USEC_VALUE_PP, `PS2_TIMER_5USEC_BITS_PP)
216 2 mihad
i_ps2_keyboard
217
(
218
    .clk                         (wb_clk_i),
219
    .reset                       (wb_rst_i),
220
    .ps2_clk_en_o_               (ps2_ctrl_kbd_clk_en_),
221
    .ps2_data_en_o_              (ps2_ctrl_kbd_data_en_),
222
    .ps2_clk_i                   (ps2_ctrl_kbd_clk),
223
    .ps2_data_i                  (ps2_kbd_data_pad_i),
224
    .rx_released                 (rx_released),
225
    .rx_scan_code                (rx_scan_code),
226 13 mihad
    .rx_data_ready               (rx_kbd_data_ready),
227
    .rx_read                     (rx_kbd_read_tt),
228
    .tx_data                     (tx_kbd_data),
229
    .tx_write                    (tx_kbd_write),
230
    .tx_write_ack_o              (tx_kbd_write_ack),
231 2 mihad
    .tx_error_no_keyboard_ack    (tx_error_no_keyboard_ack),
232
    .translate                   (translate)
233
);
234
 
235
ps2_wb_if i_ps2_wb_if
236
(
237
    .wb_clk_i                      (wb_clk_i),
238
    .wb_rst_i                      (wb_rst_i),
239
    .wb_cyc_i                      (wb_cyc_i),
240
    .wb_stb_i                      (wb_stb_i),
241
    .wb_we_i                       (wb_we_i),
242
    .wb_sel_i                      (wb_sel_i),
243
    .wb_adr_i                      (wb_adr_i),
244
    .wb_dat_i                      (wb_dat_i),
245
    .wb_dat_o                      (wb_dat_o),
246
    .wb_ack_o                      (wb_ack_o),
247 13 mihad
 
248 2 mihad
    .wb_int_o                      (wb_int_o),
249 13 mihad
 
250 2 mihad
    .rx_scancode_i                 (rx_translated_scan_code),
251 13 mihad
    .rx_kbd_data_ready_i           (rx_translated_data_ready),
252
    .rx_kbd_read_o                 (rx_kbd_read_wb),
253
    .tx_kbd_data_o                 (tx_kbd_data),
254
    .tx_kbd_write_o                (tx_kbd_write),
255
    .tx_kbd_write_ack_i            (tx_kbd_write_ack),
256 2 mihad
    .translate_o                   (translate),
257 13 mihad
    .ps2_kbd_clk_i                 (ps2_kbd_clk_pad_i),
258 2 mihad
    .inhibit_kbd_if_o              (inhibit_kbd_if)
259 13 mihad
    `ifdef PS2_AUX
260
    ,
261
    .wb_intb_o                     (wb_intb_o),
262
 
263
    .rx_aux_data_i                 (rx_aux_data),
264
    .rx_aux_data_ready_i           (rx_aux_data_ready),
265
    .rx_aux_read_o                 (rx_aux_read),
266
    .tx_aux_data_o                 (tx_aux_data),
267
    .tx_aux_write_o                (tx_aux_write),
268
    .tx_aux_write_ack_i            (tx_aux_write_ack),
269
    .ps2_aux_clk_i                 (ps2_aux_clk_pad_i),
270
    .inhibit_aux_if_o              (inhibit_aux_if)
271
    `endif
272 2 mihad
) ;
273
 
274
ps2_translation_table i_ps2_translation_table
275
(
276
    .reset_i                    (wb_rst_i),
277
    .clock_i                    (wb_clk_i),
278
    .translate_i                (translate),
279
    .code_i                     (rx_scan_code),
280
    .code_o                     (rx_translated_scan_code),
281
    .address_i                  (8'h00),
282
    .data_i                     (8'h00),
283
    .we_i                       (1'b0),
284
    .re_i                       (1'b0),
285
    .data_o                     (),
286 13 mihad
    .rx_data_ready_i            (rx_kbd_data_ready),
287 2 mihad
    .rx_translated_data_ready_o (rx_translated_data_ready),
288 13 mihad
    .rx_read_i                  (rx_kbd_read_wb),
289
    .rx_read_o                  (rx_kbd_read_tt),
290
    .rx_released_i              (rx_released)
291 2 mihad
) ;
292
 
293
endmodule // ps2_top

powered by: WebSVN 2.1.0

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