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

Subversion Repositories i650

[/] [i650/] [trunk/] [rtl/] [timing.v] - Blame information for rev 20

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 eightycc
`timescale 1ns / 1ps
2
//////////////////////////////////////////////////////////////////////////////////
3
// IBM 650 Reconstruction in Verilog (i650)
4
// 
5
// This file is part of the IBM 650 Reconstruction in Verilog (i650) project
6
// http:////www.opencores.org/project,i650
7
//
8
// Description: 650 Timing.
9
// 
10
// Additional Comments: See US 2959351, Fig. 53, 54 and 55. Additional index
11
//  counters provided to address general storage and register RAMs.
12
//
13
// Copyright (c) 2015 Robert Abeles
14
//
15
// This source file is free software; you can redistribute it
16
// and/or modify it under the terms of the GNU Lesser General
17
// Public License as published by the Free Software Foundation;
18
// either version 2.1 of the License, or (at your option) any
19
// later version.
20
//
21
// This source is distributed in the hope that it will be
22
// useful, but WITHOUT ANY WARRANTY; without even the implied
23
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
24
// PURPOSE.  See the GNU Lesser General Public License for more
25
// details.
26
//
27
// You should have received a copy of the GNU Lesser General
28
// Public License along with this source; if not, download it
29
// from http://www.opencores.org/lgpl.shtml
30
//////////////////////////////////////////////////////////////////////////////////
31
module timing (
32
      input clk,
33
      input rst,
34
      output reg ap, bp, cp, dp,
35
      output reg dx, d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10,
36
      output reg d1_d5, d5_dx, d5_d10, d1_dx, d5_d9, d10_d1_d5,
37
      //output reg dxcu_d1cu, d10cl_d0cu,
38 6 eightycc
      output dxl, dxu, d0l, d0u, d1l, d1u, d2l, d10u,
39
      output reg w0, w1, w2, w3, w4, w5, w6, w7, w8, w9,
40
      output reg wl, wu, ewl,
41
      output reg s0, s1, s2, s3, s4,
42
      output reg hp,
43
 
44
      output reg[0:9] digit_idx,
45
      output reg[0:3] early_idx, ontime_idx
46 5 eightycc
   );
47
 
48 20 eightycc
   reg ctr_reset;
49 6 eightycc
   reg[0:3] digit_ctr;
50
   reg[0:3] word_ctr;
51
   reg[0:2] sector_ctr;
52
 
53
   assign dxl = dx & wl;
54
   assign dxu = dx & wu;
55
   assign d0l = d0 & wl;
56
   assign d0u = d0 & wu;
57
   assign d1l = d1 & wl;
58
   assign d1u = d1 & wu;
59
   assign d2l = d2 & wl;
60
   assign d10u = d10 & wu;
61
 
62
   //-----------------------------------------------------------------------------
63
   // 650 four-phase clock
64
   //-----------------------------------------------------------------------------
65 20 eightycc
   always @(posedge clk)
66 6 eightycc
      if (rst) begin
67 20 eightycc
         ctr_reset <= 1;
68 6 eightycc
         ap <= 1;
69
         bp <= 0;
70
         cp <= 0;
71
         dp <= 0;
72
      end else begin
73 20 eightycc
         if (dp) ctr_reset <= 0;
74 6 eightycc
         ap <= dp;
75
         bp <= ap;
76
         cp <= bp;
77
         dp <= cp;
78
      end;
79
 
80
   //-----------------------------------------------------------------------------
81
   // Counter-based timing signals
82
   //-----------------------------------------------------------------------------
83 20 eightycc
   always @(posedge dp)
84
      if (ctr_reset) begin
85 6 eightycc
         dx <= 0;
86
         d0 <= 0;
87
         d1 <= 0;
88
         d2 <= 0;
89
         d3 <= 0;
90
         d4 <= 0;
91
         d5 <= 0;
92
         d6 <= 0;
93
         d7 <= 0;
94
         d8 <= 0;
95
         d9 <= 0;
96
         d10 <= 0;
97
         d1_d5 <= 0;
98
         d5_dx <= 0;
99
         d5_d10 <= 0;
100
         d1_dx <= 0;
101
         d5_d9 <= 0;
102
         d10_d1_d5 <= 0;
103
         w0 <= 0;
104
         w1 <= 0;
105
         w2 <= 0;
106
         w3 <= 0;
107
         w4 <= 0;
108
         w5 <= 0;
109
         w6 <= 0;
110
         w7 <= 0;
111
         w8 <= 0;
112
         w9 <= 0;
113
         wu <= 0;
114
         wl <= 0;
115
         ewl <= 0;
116
         s0 <= 0;
117
         s1 <= 0;
118
         s2 <= 0;
119
         s3 <= 0;
120
         s4 <= 0;
121
         hp <= 0;
122
         digit_ctr <= 4'd0;
123
         word_ctr  <= 4'd0;
124
         sector_ctr <= 4'd0;
125
         digit_idx <= 10'd599;
126 18 eightycc
         early_idx <= 4'd0;
127 6 eightycc
         ontime_idx <= 4'd11;
128
      end else begin
129
         digit_idx <= (digit_idx + 1) % 600;
130
         early_idx <= (early_idx + 1) % 12;
131
         ontime_idx <= (ontime_idx + 1) % 12;
132
         digit_ctr <= (digit_ctr + 1) % 12;
133
         if (digit_ctr == 4'd11) begin
134
            word_ctr <= (word_ctr + 1) % 10;
135
            if (word_ctr == 9) begin
136
               sector_ctr <= (sector_ctr + 1) % 5;
137
            end;
138
         end;
139
 
140
         case (digit_ctr)
141
            4'd0: begin
142
                     d10 <= 0; dx <= 1;
143
                     d5_dx <= 0;
144
                     d1_dx <= 0;
145
                     d10_d1_d5 <= 0;
146
                     wl <= ~word_ctr[3];
147
                     wu <=  word_ctr[3];
148
                     case (word_ctr)
149
                        4'd0: begin
150
                                 w9 <= 0; w0 <= 1;
151
                                 case (sector_ctr)
152
                                    3'd0: begin
153
                                             s4 <= 0; s0 <= 1;
154
                                             hp <= 1;
155
                                          end
156
                                    3'd1: begin
157
                                             s0 <= 0; s1 <= 1;
158
                                          end
159
                                    3'd2: begin
160
                                             s1 <= 0; s2 <= 1;
161
                                          end
162
                                    3'd3: begin
163
                                             s2 <= 0; s3 <= 1;
164
                                          end
165
                                    3'd4: begin
166
                                             s3 <= 0; s4 <= 1;
167
                                          end
168
                                 endcase;
169
                              end
170
                        4'd1: begin
171
                                 w0 <= 0; w1 <= 1;
172
                              end
173
                        4'd2: begin
174
                                 w1 <= 0; w2 <= 1;
175
                              end
176
                        4'd3: begin
177
                                 w2 <= 0; w3 <= 1;
178
                              end
179
                        4'd4: begin
180
                                 w3 <= 0; w4 <= 1;
181
                              end
182
                        4'd5: begin
183
                                 w4 <= 0; w5 <= 1;
184
                              end
185
                        4'd6: begin
186
                                 w5 <= 0; w6 <= 1;
187
                              end
188
                        4'd7: begin
189
                                 w6 <= 0; w7 <= 1;
190
                              end
191
                        4'd8: begin
192
                                 w7 <= 0; w8 <= 1;
193
                              end
194
                        4'd9: begin
195
                                 w8 <= 0; w9 <= 1;
196
                              end
197
                     endcase;
198
                  end
199
            4'd1: begin
200
                     dx <= 0; d0 <= 1;
201
                     hp <= 0;
202
                  end
203
            4'd2: begin
204
                     d0 <= 0; d1 <= 1;
205
                     d1_d5 <= 1;
206
                  end
207
            4'd3: begin
208
                     d1 <= 0; d2 <= 1;
209
                     d1_dx <= 1;
210
                     d10_d1_d5 <= 1;
211
                  end
212
            4'd4: begin
213
                     d2 <= 0; d3 <= 1;
214
                  end
215
            4'd5: begin
216
                     d3 <= 0; d4 <= 1;
217
                     ewl <= wu;
218
                  end
219
            4'd6: begin
220
                     d4 <= 0; d5 <= 1;
221
                     d1_d5 <= 0;
222
                     d10_d1_d5 <= 0;
223
                     d5_dx <= 1;
224
                     d5_d10 <= 1;
225
                     d5_d9 <= 1;
226
                  end
227
            4'd7: begin
228
                     d5 <= 0; d6 <= 1;
229
                  end
230
            4'd8: begin
231
                     d6 <= 0; d7 <= 1;
232
                  end
233
            4'd9: begin
234
                     d7 <= 0; d8 <= 1;
235
                  end
236
            4'd10: begin
237
                     d8 <= 0; d9 <= 1;
238
                     d5_d9 <= 0;
239
                  end
240
            4'd11: begin
241
                     d9 <= 0; d10 <= 1;
242
                     d5_d10 <= 0;
243
                     d10_d1_d5 <= 1;
244
                  end
245
         endcase;
246
      end;
247
 
248 5 eightycc
endmodule

powered by: WebSVN 2.1.0

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