| 1 | // ========== Copyright Header Begin ========================================== |
| 2 | // |
| 3 | // OpenSPARC T2 Processor File: ncu_niu_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_niu_chkr( |
| 36 | iol2clk, |
| 37 | ncu_niu_vld, // From c2i of c2i.v |
| 38 | ncu_niu_data, // From c2i of c2i.v |
| 39 | niu_ncu_data, // To i2c of i2c.v |
| 40 | niu_ncu_vld, // To i2c of i2c.v |
| 41 | niu_ncu_stall, // To c2i of c2i.v |
| 42 | ncu_niu_stall // From i2c of i2c.v |
| 43 | ); |
| 44 | |
| 45 | input iol2clk; |
| 46 | |
| 47 | input ncu_niu_vld; // From c2i of c2i.v |
| 48 | input [31:0] ncu_niu_data; // From c2i of c2i.v |
| 49 | input niu_ncu_stall; // To c2i of c2i.v |
| 50 | |
| 51 | input [31:0] niu_ncu_data; // To i2c of i2c.v |
| 52 | input niu_ncu_vld; // To i2c of i2c.v |
| 53 | input ncu_niu_stall; // From i2c of i2c.v |
| 54 | |
| 55 | wire por_reset_l = !`NCU.tcu_aclk; |
| 56 | |
| 57 | // 0in set_clock -default iol2clk -module ncu_niu_chkr |
| 58 | // 0in default_reset `NCU.tcu_aclk -module ncu_niu_chkr |
| 59 | `ifdef X_GUARD |
| 60 | // 0in known_driven -var ncu_niu_stall -name ncu_niu_stall_x_guard -active por_reset_l |
| 61 | // 0in known_driven -var niu_ncu_vld -name niu_ncu_vld_x_guard -active por_reset_l |
| 62 | // 0in known_driven -var niu_ncu_stall -name niu_ncu_stall_x_guard -active por_reset_l |
| 63 | // 0in known_driven -var ncu_niu_vld -name ncu_niu_vld_x_guard -active por_reset_l |
| 64 | `endif |
| 65 | |
| 66 | |
| 67 | //********************************* |
| 68 | // make sure vald and stall do not active to long |
| 69 | //********************************* |
| 70 | |
| 71 | reg [9:0] niu_ncu_vld_cnt; |
| 72 | reg [9:0] niu_ncu_stall_cnt; |
| 73 | reg [9:0] ncu_niu_vld_cnt; |
| 74 | reg [9:0] ncu_niu_stall_cnt; |
| 75 | |
| 76 | /* 0in range |
| 77 | -var niu_ncu_vld_cnt |
| 78 | -min 0 |
| 79 | -max 4 |
| 80 | */ |
| 81 | |
| 82 | /* 0in range |
| 83 | -var niu_ncu_stall_cnt |
| 84 | -min 0 |
| 85 | -max 1000 |
| 86 | */ |
| 87 | |
| 88 | /* 0in range |
| 89 | -var ncu_niu_vld_cnt |
| 90 | -min 0 |
| 91 | -max 4 |
| 92 | */ |
| 93 | |
| 94 | /* 0in range |
| 95 | -var ncu_niu_stall_cnt |
| 96 | -min 0 |
| 97 | -max 1000 |
| 98 | |
| 99 | */ |
| 100 | |
| 101 | reg ncu_niu_stall_del; |
| 102 | reg niu_ncu_stall_del; |
| 103 | |
| 104 | always @(posedge iol2clk) begin |
| 105 | if (niu_ncu_vld && !ncu_niu_stall_del) begin |
| 106 | niu_ncu_vld_cnt = niu_ncu_vld_cnt + 1; |
| 107 | end |
| 108 | else if (!niu_ncu_vld) begin |
| 109 | niu_ncu_vld_cnt = 0; |
| 110 | end |
| 111 | |
| 112 | if (niu_ncu_stall_del) begin |
| 113 | niu_ncu_stall_cnt = niu_ncu_stall_cnt + 1; |
| 114 | end else begin |
| 115 | niu_ncu_stall_cnt = 0; |
| 116 | end |
| 117 | |
| 118 | |
| 119 | if (ncu_niu_vld && !niu_ncu_stall_del) begin |
| 120 | ncu_niu_vld_cnt = ncu_niu_vld_cnt + 1; |
| 121 | end |
| 122 | else if (!ncu_niu_vld) begin |
| 123 | ncu_niu_vld_cnt = 0; |
| 124 | end |
| 125 | |
| 126 | if (ncu_niu_stall_del) begin |
| 127 | ncu_niu_stall_cnt = ncu_niu_stall_cnt + 1; |
| 128 | end |
| 129 | else begin |
| 130 | ncu_niu_stall_cnt = 0; |
| 131 | end |
| 132 | |
| 133 | ncu_niu_stall_del = ncu_niu_stall; |
| 134 | niu_ncu_stall_del = niu_ncu_stall; |
| 135 | end |
| 136 | |
| 137 | |
| 138 | |
| 139 | endmodule |