| 1 | // ========== Copyright Header Begin ========================================== |
| 2 | // |
| 3 | // OpenSPARC T2 Processor File: ncu_io_chkr.v |
| 4 | // Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved |
| 5 | // 4150 Network Circle, Santa Clara, California 95054, U.S.A. |
| 6 | // |
| 7 | // * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 8 | // |
| 9 | // This program is free software; you can redistribute it and/or modify |
| 10 | // it under the terms of the GNU General Public License as published by |
| 11 | // the Free Software Foundation; version 2 of the License. |
| 12 | // |
| 13 | // This program is distributed in the hope that it will be useful, |
| 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | // GNU General Public License for more details. |
| 17 | // |
| 18 | // You should have received a copy of the GNU General Public License |
| 19 | // along with this program; if not, write to the Free Software |
| 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 21 | // |
| 22 | // For the avoidance of doubt, and except that if any non-GPL license |
| 23 | // choice is available it will apply instead, Sun elects to use only |
| 24 | // the General Public License version 2 (GPLv2) at this time for any |
| 25 | // software where a choice of GPL license versions is made |
| 26 | // available with the language indicating that GPLv2 or any later version |
| 27 | // may be used, or where a choice of which version of the GPL is applied is |
| 28 | // otherwise unspecified. |
| 29 | // |
| 30 | // Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
| 31 | // CA 95054 USA or visit www.sun.com if you need additional information or |
| 32 | // have any questions. |
| 33 | // |
| 34 | // ========== Copyright Header End ============================================ |
| 35 | module ncu_io_chkr( |
| 36 | iol2clk, |
| 37 | ncu_io_vld, // From c2i of c2i.v |
| 38 | ncu_io_data, // From c2i of c2i.v |
| 39 | io_ncu_data, // To i2c of i2c.v |
| 40 | io_ncu_vld, // To i2c of i2c.v |
| 41 | io_ncu_stall, // To c2i of c2i.v |
| 42 | ncu_io_stall // From i2c of i2c.v |
| 43 | |
| 44 | ); |
| 45 | |
| 46 | input iol2clk; |
| 47 | |
| 48 | input ncu_io_vld; // From c2i of c2i.v |
| 49 | input [3:0] ncu_io_data; // From c2i of c2i.v |
| 50 | input io_ncu_stall; // To c2i of c2i.v |
| 51 | |
| 52 | input [3:0] io_ncu_data; // To i2c of i2c.v |
| 53 | input io_ncu_vld; // To i2c of i2c.v |
| 54 | input ncu_io_stall; // From i2c of i2c.v |
| 55 | |
| 56 | wire por_reset_l = ~`NCU.tcu_aclk; |
| 57 | |
| 58 | // 0in set_clock -default iol2clk -module ncu_io_chkr |
| 59 | // 0in default_reset `NCU.tcu_aclk -module ncu_io_chkr |
| 60 | |
| 61 | `ifdef X_GUARD |
| 62 | // 0in known_driven -var ncu_io_stall -name ncu_io_stall_x_guard -active por_reset_l |
| 63 | // 0in known_driven -var io_ncu_vld -name io_ncu_vld_x_guard -active por_reset_l |
| 64 | // 0in known_driven -var io_ncu_stall -name io_ncu_stall_x_guard -active por_reset_l |
| 65 | // 0in known_driven -var ncu_io_vld -name ncu_io_vld_x_guard -active por_reset_l |
| 66 | `endif |
| 67 | |
| 68 | //********************************* |
| 69 | // make sure vald and stall do not active to long |
| 70 | //********************************* |
| 71 | |
| 72 | reg [9:0] io_ncu_vld_cnt; |
| 73 | reg [9:0] io_ncu_stall_cnt; |
| 74 | reg [9:0] ncu_io_vld_cnt; |
| 75 | reg [9:0] ncu_io_stall_cnt; |
| 76 | |
| 77 | /* 0in range |
| 78 | -var io_ncu_vld_cnt |
| 79 | -min 0 |
| 80 | -max 32 |
| 81 | */ |
| 82 | |
| 83 | /* 0in range |
| 84 | -var io_ncu_stall_cnt |
| 85 | -min 0 |
| 86 | -max 1000 |
| 87 | */ |
| 88 | |
| 89 | /* 0in range |
| 90 | -var ncu_io_vld_cnt |
| 91 | -min 0 |
| 92 | -max 32 |
| 93 | */ |
| 94 | |
| 95 | /* 0in range |
| 96 | -var ncu_io_stall_cnt |
| 97 | -min 0 |
| 98 | -max 1000 |
| 99 | |
| 100 | */ |
| 101 | |
| 102 | reg ncu_io_stall_del; |
| 103 | reg io_ncu_stall_del; |
| 104 | |
| 105 | always @(posedge iol2clk) begin |
| 106 | if (io_ncu_vld && !ncu_io_stall_del) begin |
| 107 | io_ncu_vld_cnt = io_ncu_vld_cnt + 1; |
| 108 | end |
| 109 | else if (!io_ncu_vld) begin |
| 110 | io_ncu_vld_cnt = 0; |
| 111 | end |
| 112 | |
| 113 | if (io_ncu_stall_del) begin |
| 114 | io_ncu_stall_cnt = io_ncu_stall_cnt + 1; |
| 115 | end else begin |
| 116 | io_ncu_stall_cnt = 0; |
| 117 | end |
| 118 | |
| 119 | |
| 120 | if (ncu_io_vld && !io_ncu_stall_del) begin |
| 121 | ncu_io_vld_cnt = ncu_io_vld_cnt + 1; |
| 122 | end |
| 123 | else if (!ncu_io_vld) begin |
| 124 | ncu_io_vld_cnt = 0; |
| 125 | end |
| 126 | |
| 127 | if (ncu_io_stall_del) begin |
| 128 | ncu_io_stall_cnt = ncu_io_stall_cnt + 1; |
| 129 | end |
| 130 | else begin |
| 131 | ncu_io_stall_cnt = 0; |
| 132 | end |
| 133 | |
| 134 | ncu_io_stall_del <= ncu_io_stall; |
| 135 | io_ncu_stall_del <= io_ncu_stall; |
| 136 | end |
| 137 | |
| 138 | |
| 139 | |
| 140 | endmodule |