[6] | 1 | /* |
---|
| 2 | * Reset Controller |
---|
| 3 | * |
---|
| 4 | * (C) Copyleft 2007 Simply RISC LLP |
---|
| 5 | * AUTHOR: Fabrizio Fazzino <fabrizio.fazzino@srisc.com> |
---|
| 6 | * |
---|
| 7 | * LICENSE: |
---|
| 8 | * This is a Free Hardware Design; you can redistribute it and/or |
---|
| 9 | * modify it under the terms of the GNU General Public License |
---|
| 10 | * version 2 as published by the Free Software Foundation. |
---|
| 11 | * The above named program is distributed in the hope that it will |
---|
| 12 | * be useful, but WITHOUT ANY WARRANTY; without even the implied |
---|
| 13 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
---|
| 14 | * See the GNU General Public License for more details. |
---|
| 15 | * |
---|
| 16 | * DESCRIPTION: |
---|
| 17 | * This block implements the Reset Controller used by the S1 Core |
---|
| 18 | * to wake up the SPARC Core of the OpenSPARC T1; its behavior was |
---|
| 19 | * reverse-engineered from the OpenSPARC waveforms. |
---|
| 20 | */ |
---|
| 21 | |
---|
| 22 | module rst_ctrl ( |
---|
| 23 | sys_clock_i, sys_reset_i, |
---|
| 24 | cluster_cken_o, gclk_o, cmp_grst_o, cmp_arst_o, |
---|
| 25 | ctu_tst_pre_grst_o, adbginit_o, gdbginit_o, |
---|
| 26 | sys_reset_final_o |
---|
| 27 | ); |
---|
| 28 | |
---|
| 29 | /* |
---|
| 30 | * Inputs |
---|
| 31 | */ |
---|
| 32 | |
---|
| 33 | // System inputs |
---|
| 34 | input sys_clock_i; // System Clock |
---|
| 35 | input sys_reset_i; // System Reset |
---|
| 36 | |
---|
| 37 | /* |
---|
| 38 | * Registered Outputs |
---|
| 39 | */ |
---|
| 40 | |
---|
| 41 | output gclk_o; |
---|
| 42 | |
---|
| 43 | /* |
---|
| 44 | * Registered Outputs |
---|
| 45 | */ |
---|
| 46 | |
---|
| 47 | // SPARC Core inputs |
---|
| 48 | output cluster_cken_o; |
---|
| 49 | output cmp_grst_o; |
---|
| 50 | output cmp_arst_o; |
---|
| 51 | output ctu_tst_pre_grst_o; |
---|
| 52 | output adbginit_o; |
---|
| 53 | output gdbginit_o; |
---|
| 54 | output sys_reset_final_o; |
---|
| 55 | |
---|
| 56 | /* |
---|
| 57 | * Registers |
---|
| 58 | */ |
---|
| 59 | |
---|
| 60 | // Counter used as a timer to strobe the reset signals |
---|
| 61 | reg [12:0] cycle_counter; |
---|
| 62 | |
---|
| 63 | /* |
---|
| 64 | * Procedural blocks |
---|
| 65 | */ |
---|
| 66 | |
---|
| 67 | // This process handles the timer counter |
---|
| 68 | |
---|
| 69 | reg rst_sync; |
---|
| 70 | reg sys_reset; |
---|
| 71 | |
---|
| 72 | always @(posedge sys_clock_i) |
---|
| 73 | begin |
---|
| 74 | rst_sync<=sys_reset_i; |
---|
| 75 | sys_reset<=rst_sync; |
---|
| 76 | if(sys_reset==1'b1) |
---|
| 77 | cycle_counter<=0; |
---|
| 78 | else |
---|
| 79 | if(cycle_counter[12]==1'b0) |
---|
| 80 | cycle_counter<=cycle_counter+1; |
---|
| 81 | end |
---|
| 82 | |
---|
| 83 | assign cmp_arst_o =!sys_reset; |
---|
| 84 | assign adbginit_o =!sys_reset; |
---|
| 85 | assign cluster_cken_o =cycle_counter<'d20 ? 0:1; |
---|
| 86 | assign ctu_tst_pre_grst_o=cycle_counter<'d60 ? 0:1; |
---|
| 87 | assign gdbginit_o =cycle_counter<'d120 ? 0:1; |
---|
| 88 | assign cmp_grst_o =cycle_counter<'d120 ? 0:1; |
---|
| 89 | assign sys_reset_final_o =cycle_counter<'d126 ? 1:0; |
---|
| 90 | assign gclk_o = sys_clock_i; |
---|
| 91 | |
---|
| 92 | endmodule |
---|