//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//// ////
|
//// ////
|
//// ps2_top.v ////
|
//// ps2_top.v ////
|
//// ////
|
//// ////
|
//// This file is part of the "ps2" project ////
|
//// This file is part of the "ps2" project ////
|
//// http://www.opencores.org/cores/ps2/ ////
|
//// http://www.opencores.org/cores/ps2/ ////
|
//// ////
|
//// ////
|
//// Author(s): ////
|
//// Author(s): ////
|
//// - mihad@opencores.org ////
|
//// - mihad@opencores.org ////
|
//// - Miha Dolenc ////
|
//// - Miha Dolenc ////
|
//// ////
|
//// ////
|
//// All additional information is avaliable in the README.txt ////
|
//// All additional information is avaliable in the README.txt ////
|
//// file. ////
|
//// file. ////
|
//// ////
|
//// ////
|
//// ////
|
//// ////
|
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//// ////
|
//// ////
|
//// Copyright (C) 2000 Miha Dolenc, mihad@opencores.org ////
|
//// Copyright (C) 2000 Miha Dolenc, mihad@opencores.org ////
|
//// ////
|
//// ////
|
//// This source file may be used and distributed without ////
|
//// This source file may be used and distributed without ////
|
//// restriction provided that this copyright statement is not ////
|
//// restriction provided that this copyright statement is not ////
|
//// removed from the file and that any derivative work contains ////
|
//// removed from the file and that any derivative work contains ////
|
//// the original copyright notice and the associated disclaimer. ////
|
//// the original copyright notice and the associated disclaimer. ////
|
//// ////
|
//// ////
|
//// This source file is free software; you can redistribute it ////
|
//// This source file is free software; you can redistribute it ////
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
//// Public License as published by the Free Software Foundation; ////
|
//// Public License as published by the Free Software Foundation; ////
|
//// either version 2.1 of the License, or (at your option) any ////
|
//// either version 2.1 of the License, or (at your option) any ////
|
//// later version. ////
|
//// later version. ////
|
//// ////
|
//// ////
|
//// This source is distributed in the hope that it will be ////
|
//// This source is distributed in the hope that it will be ////
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
//// details. ////
|
//// details. ////
|
//// ////
|
//// ////
|
//// You should have received a copy of the GNU Lesser General ////
|
//// You should have received a copy of the GNU Lesser General ////
|
//// Public License along with this source; if not, download it ////
|
//// Public License along with this source; if not, download it ////
|
//// from http://www.opencores.org/lgpl.shtml ////
|
//// from http://www.opencores.org/lgpl.shtml ////
|
//// ////
|
//// ////
|
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//
|
//
|
// CVS Revision History
|
// CVS Revision History
|
//
|
//
|
// $Log: not supported by cvs2svn $
|
// $Log: not supported by cvs2svn $
|
|
// Revision 1.1.1.1 2002/02/18 16:16:56 mihad
|
|
// Initial project import - working
|
|
//
|
//
|
//
|
|
|
`include "ps2_defines.v"
|
`include "ps2_defines.v"
|
// synopsys translate_off
|
// synopsys translate_off
|
`include "timescale.v"
|
`include "timescale.v"
|
// synopsys translate_on
|
// synopsys translate_on
|
|
|
module ps2_top
|
module ps2_top
|
(
|
(
|
wb_clk_i,
|
wb_clk_i,
|
wb_rst_i,
|
wb_rst_i,
|
wb_cyc_i,
|
wb_cyc_i,
|
wb_stb_i,
|
wb_stb_i,
|
wb_we_i,
|
wb_we_i,
|
wb_sel_i,
|
wb_sel_i,
|
wb_adr_i,
|
wb_adr_i,
|
wb_dat_i,
|
wb_dat_i,
|
wb_dat_o,
|
wb_dat_o,
|
wb_ack_o,
|
wb_ack_o,
|
|
|
wb_int_o,
|
wb_int_o,
|
|
|
ps2_kbd_clk_pad_i,
|
ps2_kbd_clk_pad_i,
|
ps2_kbd_data_pad_i,
|
ps2_kbd_data_pad_i,
|
ps2_kbd_clk_pad_o,
|
ps2_kbd_clk_pad_o,
|
ps2_kbd_data_pad_o,
|
ps2_kbd_data_pad_o,
|
ps2_kbd_clk_pad_oe_o,
|
ps2_kbd_clk_pad_oe_o,
|
ps2_kbd_data_pad_oe_o
|
ps2_kbd_data_pad_oe_o
|
|
`ifdef PS2_AUX
|
|
,
|
|
wb_intb_o,
|
|
|
|
ps2_aux_clk_pad_i,
|
|
ps2_aux_data_pad_i,
|
|
ps2_aux_clk_pad_o,
|
|
ps2_aux_data_pad_o,
|
|
ps2_aux_clk_pad_oe_o,
|
|
ps2_aux_data_pad_oe_o
|
|
`endif
|
) ;
|
) ;
|
|
|
input wb_clk_i,
|
input wb_clk_i,
|
wb_rst_i,
|
wb_rst_i,
|
wb_cyc_i,
|
wb_cyc_i,
|
wb_stb_i,
|
wb_stb_i,
|
wb_we_i ;
|
wb_we_i ;
|
|
|
input [3:0] wb_sel_i ;
|
input [3:0] wb_sel_i ;
|
|
|
input [31:0]wb_adr_i,
|
input [31:0]wb_adr_i,
|
wb_dat_i ;
|
wb_dat_i ;
|
|
|
output [31:0] wb_dat_o ;
|
output [31:0] wb_dat_o ;
|
|
|
output wb_ack_o ;
|
output wb_ack_o ;
|
|
|
output wb_int_o ;
|
output wb_int_o ;
|
|
|
input ps2_kbd_clk_pad_i,
|
input ps2_kbd_clk_pad_i,
|
ps2_kbd_data_pad_i ;
|
ps2_kbd_data_pad_i ;
|
|
|
output ps2_kbd_clk_pad_o,
|
output ps2_kbd_clk_pad_o,
|
ps2_kbd_data_pad_o,
|
ps2_kbd_data_pad_o,
|
ps2_kbd_clk_pad_oe_o,
|
ps2_kbd_clk_pad_oe_o,
|
ps2_kbd_data_pad_oe_o ;
|
ps2_kbd_data_pad_oe_o ;
|
|
|
wire rx_extended,
|
`ifdef PS2_AUX
|
rx_released,
|
output wb_intb_o ;
|
rx_shift_key_on,
|
input ps2_aux_clk_pad_i,
|
rx_data_ready,
|
ps2_aux_data_pad_i ;
|
|
|
|
output ps2_aux_clk_pad_o,
|
|
ps2_aux_data_pad_o,
|
|
ps2_aux_clk_pad_oe_o,
|
|
ps2_aux_data_pad_oe_o ;
|
|
|
|
assign ps2_aux_clk_pad_o = 1'b0 ;
|
|
assign ps2_aux_data_pad_o = 1'b0 ;
|
|
`endif
|
|
|
|
wire rx_released,
|
|
rx_kbd_data_ready,
|
rx_translated_data_ready,
|
rx_translated_data_ready,
|
rx_read_wb,
|
rx_kbd_read_wb,
|
rx_read_tt,
|
rx_kbd_read_tt,
|
tx_write,
|
tx_kbd_write,
|
tx_write_ack,
|
tx_kbd_write_ack,
|
tx_error_no_keyboard_ack,
|
tx_error_no_keyboard_ack,
|
ps2_ctrl_kbd_data_en_,
|
ps2_ctrl_kbd_data_en_,
|
ps2_ctrl_kbd_clk_en_,
|
ps2_ctrl_kbd_clk_en_,
|
ps2_ctrl_kbd_clk,
|
ps2_ctrl_kbd_clk,
|
inhibit_kbd_if ;
|
inhibit_kbd_if ;
|
|
|
wire [7:0] rx_scan_code,
|
wire [7:0] rx_scan_code,
|
rx_translated_scan_code,
|
rx_translated_scan_code,
|
rx_ascii,
|
tx_kbd_data ;
|
tx_data ;
|
|
|
|
assign ps2_kbd_clk_pad_o = 1'b0 ;
|
assign ps2_kbd_clk_pad_o = 1'b0 ;
|
assign ps2_kbd_data_pad_o = 1'b0 ;
|
assign ps2_kbd_data_pad_o = 1'b0 ;
|
|
|
ps2_io_ctrl i_ps2_io_ctrl
|
ps2_io_ctrl i_ps2_io_ctrl_keyboard
|
(
|
(
|
.clk_i (wb_clk_i),
|
.clk_i (wb_clk_i),
|
.rst_i (wb_rst_i),
|
.rst_i (wb_rst_i),
|
.ps2_ctrl_kbd_clk_en_i_ (ps2_ctrl_kbd_clk_en_),
|
.ps2_ctrl_clk_en_i_ (ps2_ctrl_kbd_clk_en_),
|
.ps2_ctrl_kbd_data_en_i_ (ps2_ctrl_kbd_data_en_),
|
.ps2_ctrl_data_en_i_ (ps2_ctrl_kbd_data_en_),
|
.ps2_kbd_clk_pad_i (ps2_kbd_clk_pad_i),
|
.ps2_clk_pad_i (ps2_kbd_clk_pad_i),
|
.ps2_kbd_clk_pad_oe_o (ps2_kbd_clk_pad_oe_o),
|
.ps2_clk_pad_oe_o (ps2_kbd_clk_pad_oe_o),
|
.ps2_kbd_data_pad_oe_o (ps2_kbd_data_pad_oe_o),
|
.ps2_data_pad_oe_o (ps2_kbd_data_pad_oe_o),
|
.inhibit_kbd_if_i (inhibit_kbd_if),
|
.inhibit_if_i (inhibit_kbd_if),
|
.ps2_ctrl_kbd_clk_o (ps2_ctrl_kbd_clk)
|
.ps2_ctrl_clk_o (ps2_ctrl_kbd_clk)
|
);
|
);
|
|
|
ps2_keyboard #(`PS2_TIMER_60USEC_VALUE_PP, `PS2_TIMER_60USEC_BITS_PP, `PS2_TIMER_5USEC_VALUE_PP, `PS2_TIMER_5USEC_BITS_PP, 0)
|
`ifdef PS2_AUX
|
|
wire rx_aux_data_ready,
|
|
rx_aux_read,
|
|
tx_aux_write,
|
|
tx_aux_write_ack,
|
|
tx_error_no_aux_ack,
|
|
ps2_ctrl_aux_data_en_,
|
|
ps2_ctrl_aux_clk_en_,
|
|
ps2_ctrl_aux_clk,
|
|
inhibit_aux_if ;
|
|
|
|
wire [7:0] rx_aux_data,
|
|
tx_aux_data ;
|
|
|
|
ps2_io_ctrl i_ps2_io_ctrl_auxiliary
|
|
(
|
|
.clk_i (wb_clk_i),
|
|
.rst_i (wb_rst_i),
|
|
.ps2_ctrl_clk_en_i_ (ps2_ctrl_aux_clk_en_),
|
|
.ps2_ctrl_data_en_i_ (ps2_ctrl_aux_data_en_),
|
|
.ps2_clk_pad_i (ps2_aux_clk_pad_i),
|
|
.ps2_clk_pad_oe_o (ps2_aux_clk_pad_oe_o),
|
|
.ps2_data_pad_oe_o (ps2_aux_data_pad_oe_o),
|
|
.inhibit_if_i (inhibit_aux_if),
|
|
.ps2_ctrl_clk_o (ps2_ctrl_aux_clk)
|
|
);
|
|
|
|
ps2_mouse #(`PS2_TIMER_60USEC_VALUE_PP, `PS2_TIMER_60USEC_BITS_PP, `PS2_TIMER_5USEC_VALUE_PP, `PS2_TIMER_5USEC_BITS_PP)
|
|
i_ps2_mouse
|
|
(
|
|
.clk (wb_clk_i),
|
|
.reset (wb_rst_i),
|
|
.ps2_clk_en_o_ (ps2_ctrl_aux_clk_en_),
|
|
.ps2_data_en_o_ (ps2_ctrl_aux_data_en_),
|
|
.ps2_clk_i (ps2_ctrl_aux_clk),
|
|
.ps2_data_i (ps2_aux_data_pad_i),
|
|
.rx_scan_code (rx_aux_data),
|
|
.rx_data_ready (rx_aux_data_ready),
|
|
.rx_read (rx_aux_read),
|
|
.tx_data (tx_aux_data),
|
|
.tx_write (tx_aux_write),
|
|
.tx_write_ack_o (tx_aux_write_ack),
|
|
.tx_error_no_ack (tx_error_no_aux_ack)
|
|
);
|
|
|
|
`endif
|
|
|
|
ps2_keyboard #(`PS2_TIMER_60USEC_VALUE_PP, `PS2_TIMER_60USEC_BITS_PP, `PS2_TIMER_5USEC_VALUE_PP, `PS2_TIMER_5USEC_BITS_PP)
|
i_ps2_keyboard
|
i_ps2_keyboard
|
(
|
(
|
.clk (wb_clk_i),
|
.clk (wb_clk_i),
|
.reset (wb_rst_i),
|
.reset (wb_rst_i),
|
.ps2_clk_en_o_ (ps2_ctrl_kbd_clk_en_),
|
.ps2_clk_en_o_ (ps2_ctrl_kbd_clk_en_),
|
.ps2_data_en_o_ (ps2_ctrl_kbd_data_en_),
|
.ps2_data_en_o_ (ps2_ctrl_kbd_data_en_),
|
.ps2_clk_i (ps2_ctrl_kbd_clk),
|
.ps2_clk_i (ps2_ctrl_kbd_clk),
|
.ps2_data_i (ps2_kbd_data_pad_i),
|
.ps2_data_i (ps2_kbd_data_pad_i),
|
.rx_extended (rx_extended),
|
|
.rx_released (rx_released),
|
.rx_released (rx_released),
|
.rx_shift_key_on (rx_shift_key_on),
|
|
.rx_scan_code (rx_scan_code),
|
.rx_scan_code (rx_scan_code),
|
.rx_ascii (rx_ascii),
|
.rx_data_ready (rx_kbd_data_ready),
|
.rx_data_ready (rx_data_ready),
|
.rx_read (rx_kbd_read_tt),
|
.rx_read (rx_read_tt),
|
.tx_data (tx_kbd_data),
|
.tx_data (tx_data),
|
.tx_write (tx_kbd_write),
|
.tx_write (tx_write),
|
.tx_write_ack_o (tx_kbd_write_ack),
|
.tx_write_ack_o (tx_write_ack),
|
|
.tx_error_no_keyboard_ack (tx_error_no_keyboard_ack),
|
.tx_error_no_keyboard_ack (tx_error_no_keyboard_ack),
|
.translate (translate)
|
.translate (translate)
|
);
|
);
|
|
|
ps2_wb_if i_ps2_wb_if
|
ps2_wb_if i_ps2_wb_if
|
(
|
(
|
.wb_clk_i (wb_clk_i),
|
.wb_clk_i (wb_clk_i),
|
.wb_rst_i (wb_rst_i),
|
.wb_rst_i (wb_rst_i),
|
.wb_cyc_i (wb_cyc_i),
|
.wb_cyc_i (wb_cyc_i),
|
.wb_stb_i (wb_stb_i),
|
.wb_stb_i (wb_stb_i),
|
.wb_we_i (wb_we_i),
|
.wb_we_i (wb_we_i),
|
.wb_sel_i (wb_sel_i),
|
.wb_sel_i (wb_sel_i),
|
.wb_adr_i (wb_adr_i),
|
.wb_adr_i (wb_adr_i),
|
.wb_dat_i (wb_dat_i),
|
.wb_dat_i (wb_dat_i),
|
.wb_dat_o (wb_dat_o),
|
.wb_dat_o (wb_dat_o),
|
.wb_ack_o (wb_ack_o),
|
.wb_ack_o (wb_ack_o),
|
|
|
.wb_int_o (wb_int_o),
|
.wb_int_o (wb_int_o),
|
|
|
.rx_scancode_i (rx_translated_scan_code),
|
.rx_scancode_i (rx_translated_scan_code),
|
.rx_data_ready_i (rx_translated_data_ready),
|
.rx_kbd_data_ready_i (rx_translated_data_ready),
|
.rx_read_o (rx_read_wb),
|
.rx_kbd_read_o (rx_kbd_read_wb),
|
.tx_data_o (tx_data),
|
.tx_kbd_data_o (tx_kbd_data),
|
.tx_write_o (tx_write),
|
.tx_kbd_write_o (tx_kbd_write),
|
.tx_write_ack_i (tx_write_ack),
|
.tx_kbd_write_ack_i (tx_kbd_write_ack),
|
.translate_o (translate),
|
.translate_o (translate),
|
.ps2_clk_i (ps2_kbd_clk_pad_i),
|
.ps2_kbd_clk_i (ps2_kbd_clk_pad_i),
|
.inhibit_kbd_if_o (inhibit_kbd_if)
|
.inhibit_kbd_if_o (inhibit_kbd_if)
|
|
`ifdef PS2_AUX
|
|
,
|
|
.wb_intb_o (wb_intb_o),
|
|
|
|
.rx_aux_data_i (rx_aux_data),
|
|
.rx_aux_data_ready_i (rx_aux_data_ready),
|
|
.rx_aux_read_o (rx_aux_read),
|
|
.tx_aux_data_o (tx_aux_data),
|
|
.tx_aux_write_o (tx_aux_write),
|
|
.tx_aux_write_ack_i (tx_aux_write_ack),
|
|
.ps2_aux_clk_i (ps2_aux_clk_pad_i),
|
|
.inhibit_aux_if_o (inhibit_aux_if)
|
|
`endif
|
) ;
|
) ;
|
|
|
ps2_translation_table i_ps2_translation_table
|
ps2_translation_table i_ps2_translation_table
|
(
|
(
|
.reset_i (wb_rst_i),
|
.reset_i (wb_rst_i),
|
.clock_i (wb_clk_i),
|
.clock_i (wb_clk_i),
|
.translate_i (translate),
|
.translate_i (translate),
|
.code_i (rx_scan_code),
|
.code_i (rx_scan_code),
|
.code_o (rx_translated_scan_code),
|
.code_o (rx_translated_scan_code),
|
.address_i (8'h00),
|
.address_i (8'h00),
|
.data_i (8'h00),
|
.data_i (8'h00),
|
.we_i (1'b0),
|
.we_i (1'b0),
|
.re_i (1'b0),
|
.re_i (1'b0),
|
.data_o (),
|
.data_o (),
|
.rx_data_ready_i (rx_data_ready),
|
.rx_data_ready_i (rx_kbd_data_ready),
|
.rx_translated_data_ready_o (rx_translated_data_ready),
|
.rx_translated_data_ready_o (rx_translated_data_ready),
|
.rx_read_i (rx_read_wb),
|
.rx_read_i (rx_kbd_read_wb),
|
.rx_read_o (rx_read_tt),
|
.rx_read_o (rx_kbd_read_tt),
|
.rx_released_i (rx_released),
|
.rx_released_i (rx_released)
|
.rx_extended_i (rx_extended)
|
|
) ;
|
) ;
|
|
|
endmodule // ps2_top
|
endmodule // ps2_top
|
|
|