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

Subversion Repositories s1_core

[/] [s1_core/] [trunk/] [hdl/] [rtl/] [s1_top/] [rst_ctrl.v] - Blame information for rev 114

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 fafa1971
/*
2 114 albert.wat
 * S1 Reset Controller
3 4 fafa1971
 *
4 114 albert.wat
 * (C) Copyleft 2007 Fabrizio Fazzino
5 4 fafa1971
 *
6
 * LICENSE:
7
 * This is a Free Hardware Design; you can redistribute it and/or
8
 * modify it under the terms of the GNU General Public License
9
 * version 2 as published by the Free Software Foundation.
10
 * The above named program is distributed in the hope that it will
11
 * be useful, but WITHOUT ANY WARRANTY; without even the implied
12
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
 * See the GNU General Public License for more details.
14
 *
15
 * DESCRIPTION:
16
 * This block implements the Reset Controller used by the S1 Core
17
 * to wake up the SPARC Core of the OpenSPARC T1; its behavior was
18
 * reverse-engineered from the OpenSPARC waveforms.
19
 */
20
 
21
`include "s1_defs.h"
22
 
23
module rst_ctrl (
24
    sys_clock_i, sys_reset_i,
25
    cluster_cken_o, gclk_o, cmp_grst_o, cmp_arst_o,
26
    ctu_tst_pre_grst_o, adbginit_o, gdbginit_o,
27
    sys_reset_final_o
28
  );
29
 
30
  /*
31
   * Inputs
32
   */
33
 
34
  // System inputs
35
  input sys_clock_i;                            // System Clock
36
  input sys_reset_i;                            // System Reset
37
 
38
  /*
39
   * Registered Outputs
40
   */
41
 
42
  output gclk_o;
43
 
44
  /*
45
   * Registered Outputs
46
   */
47
 
48
  // SPARC Core inputs
49
  output cluster_cken_o;
50
  reg cluster_cken_o;
51
  output cmp_grst_o;
52
  reg cmp_grst_o;
53
  output cmp_arst_o;
54
  reg cmp_arst_o;
55
  output ctu_tst_pre_grst_o;
56
  reg ctu_tst_pre_grst_o;
57
  output adbginit_o;
58
  reg adbginit_o;
59
  output gdbginit_o;
60
  reg gdbginit_o;
61
  output sys_reset_final_o;
62
  reg sys_reset_final_o;
63
 
64
  /*
65
   * Registers
66
   */
67
 
68
  // Counter used as a timer to strobe the reset signals
69
  reg[`TIMER_BITS-1:0] cycle_counter;
70
 
71
  /*
72
   * Procedural blocks
73
   */
74
 
75
  // This process handles the timer counter
76
  always @(posedge sys_clock_i)
77
  begin
78
    if(sys_reset_i==1'b1)
79
    begin
80
      cycle_counter = 0;
81
    end
82
    else
83
    begin
84
      if(cycle_counter[`TIMER_BITS-1]==1'b0)
85
      begin
86
        cycle_counter = cycle_counter+1;
87
      end
88
    end
89
  end
90
 
91
  // This other process assigns the proper values to the outputs
92
  // (that are used as system inputs by the SPARC Core)
93
  always @(posedge sys_clock_i)
94
  begin
95
    if(sys_reset_i==1)
96
    begin
97
      cluster_cken_o <= 0;
98
      cmp_grst_o <= 0;
99
      cmp_arst_o <= 0;
100
      ctu_tst_pre_grst_o <= 0;
101
      adbginit_o <= 0;
102
      gdbginit_o <= 0;
103
      sys_reset_final_o <= 1;
104
    end
105
    else
106
    begin
107
      if(cycle_counter<`RESET_CYCLES_1)
108
      begin
109
        cluster_cken_o <= 0;
110
        cmp_grst_o <= 0;
111
        cmp_arst_o <= 0;
112
        ctu_tst_pre_grst_o <= 0;
113
        adbginit_o <= 0;
114
        gdbginit_o <= 0;
115
        sys_reset_final_o <= 1;
116
      end
117
      else
118
      if(cycle_counter<`RESET_CYCLES_2)
119
      begin
120
        cluster_cken_o <= 0;
121
        cmp_grst_o <= 0;
122
        cmp_arst_o <= 1;  // <--
123
        ctu_tst_pre_grst_o <= 0;
124
        adbginit_o <= 1;  // <--
125
        gdbginit_o <= 0;
126
        sys_reset_final_o <= 1;
127
      end
128
      else
129
      if(cycle_counter<`RESET_CYCLES_3)
130
      begin
131
        cluster_cken_o <= 1;  // <--
132
        cmp_grst_o <= 0;
133
        cmp_arst_o <= 1;
134
        ctu_tst_pre_grst_o <= 1;  // <--
135
        adbginit_o <= 1;
136
        gdbginit_o <= 0;
137
        sys_reset_final_o <= 1;
138
      end
139
      else
140
      if(cycle_counter<`RESET_CYCLES_4)
141
      begin
142
        cluster_cken_o <= 1;
143
        cmp_grst_o <= 1;  // <--
144
        cmp_arst_o <= 1;
145
        ctu_tst_pre_grst_o <= 1;
146
        adbginit_o <= 1;
147
        gdbginit_o <= 1;  // <--
148
        sys_reset_final_o <= 1;
149
      end
150
      else
151
      begin
152
        cluster_cken_o <= 1;
153
        cmp_grst_o <= 1;
154
        cmp_arst_o <= 1;
155
        ctu_tst_pre_grst_o <= 1;
156
        adbginit_o <= 1;
157
        gdbginit_o <= 1;
158
        sys_reset_final_o <= 0;  // <--
159
      end
160
    end
161
  end
162
 
163
  assign gclk_o = (cycle_counter>`GCLK_CYCLES) & sys_clock_i;
164
 
165
endmodule

powered by: WebSVN 2.1.0

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