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

Subversion Repositories ps2

[/] [ps2/] [tags/] [rel_14/] [rtl/] [verilog/] [ps2_io_ctrl.v] - Blame information for rev 2

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

Line No. Rev Author Line
1 2 mihad
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  ps2_io_ctrl.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
//
47
 
48
// synopsys translate_off
49
`include "timescale.v"
50
// synopsys translate_on
51
 
52
module ps2_io_ctrl
53
(
54
    clk_i,
55
    rst_i,
56
    ps2_ctrl_kbd_clk_en_i_,
57
    ps2_ctrl_kbd_data_en_i_,
58
    ps2_kbd_clk_pad_i,
59
    ps2_kbd_clk_pad_oe_o,
60
    ps2_kbd_data_pad_oe_o,
61
    inhibit_kbd_if_i,
62
    ps2_ctrl_kbd_clk_o
63
);
64
 
65
input clk_i,
66
      rst_i,
67
      ps2_ctrl_kbd_clk_en_i_,
68
      ps2_ctrl_kbd_data_en_i_,
69
      ps2_kbd_clk_pad_i,
70
      inhibit_kbd_if_i ;
71
 
72
output ps2_kbd_clk_pad_oe_o,
73
       ps2_kbd_data_pad_oe_o,
74
       ps2_ctrl_kbd_clk_o ;
75
 
76
reg    ps2_kbd_clk_pad_oe_o,
77
       ps2_kbd_data_pad_oe_o ;
78
 
79
always@(posedge clk_i or posedge rst_i)
80
begin
81
    if ( rst_i )
82
    begin
83
        ps2_kbd_clk_pad_oe_o  <= #1 1'b0 ;
84
        ps2_kbd_data_pad_oe_o <= #1 1'b0 ;
85
    end
86
    else
87
    begin
88
        ps2_kbd_clk_pad_oe_o  <= #1 !ps2_ctrl_kbd_clk_en_i_ || inhibit_kbd_if_i ;
89
        ps2_kbd_data_pad_oe_o <= #1 !ps2_ctrl_kbd_data_en_i_ ;
90
    end
91
end
92
 
93
reg inhibit_kbd_if_previous ;
94
always@(posedge clk_i or posedge rst_i)
95
begin
96
    if ( rst_i )
97
        inhibit_kbd_if_previous <= #1 1'b1 ;
98
    else
99
        inhibit_kbd_if_previous <= #1 inhibit_kbd_if_i ;
100
end
101
 
102
assign ps2_ctrl_kbd_clk_o = ps2_kbd_clk_pad_i || ps2_kbd_clk_pad_oe_o && inhibit_kbd_if_previous ;
103
endmodule // ps2_io_ctrl

powered by: WebSVN 2.1.0

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