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

Subversion Repositories numbert_sort_device

[/] [numbert_sort_device/] [trunk/] [main/] [high_end.sv] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 leshabiruk
 
2
 
3
 
4
module Cell_life ( clk, cell_rst,       in_mm, in_m0, in_mp,
5
                                                                                in_0m,        in_0p,
6
                                                                                in_pm, in_p0, in_pp, init,
7
                                                                                                                                        state );
8
 
9
input clk;
10
input cell_rst;
11
 
12
input in_mm;
13
input in_m0;
14
input in_mp;
15
input in_0m;
16
input in_0p;
17
input in_pm;
18
input in_p0;
19
input in_pp;
20
input init;
21
 
22
output reg state;
23
 
24
 
25
always@(posedge clk )
26
begin
27
        if ( cell_rst )
28
        begin
29
                state<= init;
30
        end
31
        else
32
        begin
33
                state <= (state |       (  in_mm+ in_m0+ in_mp+
34
                                                                                in_0m+        in_0p+
35
                                                                                in_pm+ in_p0+ in_pp ))==3;
36
        end
37
end
38
endmodule
39
 
40
 
41
 
42
 
43
module VGA_HighEnd ( clk, rst,
44
                                                                iX_video, iY_video,
45
                                                                oR_video, oG_video, oB_video,
46
                                                                tumblers, endFrame, dbg_val     );
47
 
48
parameter RES_X_H= 1240;
49
parameter RES_Y_H= 1024;
50
parameter XY_STEP_H= 7;
51
parameter RES_X_L= 640;
52
parameter RES_Y_L= 480;
53
parameter XY_STEP_L= 8;
54
 
55
input clk;
56
input rst;
57
 
58
input signed [11:0] iX_video;
59
input signed [11:0] iY_video;
60
output reg [7:0] oR_video;
61
output reg [7:0] oG_video;
62
output reg [7:0] oB_video;
63
input   [9:0]                   tumblers;
64
input endFrame;
65
output wire [63:0] dbg_val= count;
66
 
67
wire [31:0] V_out2;
68
 
69
wire high_res= 1;
70
 
71
reg [31:0] count;
72
reg [31:0] count_py;
73
 
74
 
75
parameter R_SZ= 27;
76
parameter R_SZp= R_SZ +1;
77
 
78
wire  cell_out[R_SZ:0][R_SZ:0];
79
 
80
wire  cell_in_mm[R_SZ:0][R_SZ:0];
81
wire  cell_in_m0[R_SZ:0][R_SZ:0];
82
wire  cell_in_mp[R_SZ:0][R_SZ:0];
83
 
84
wire  cell_in_0m[R_SZ:0][R_SZ:0];
85
wire  cell_in_0p[R_SZ:0][R_SZ:0];
86
 
87
wire  cell_in_pm[R_SZ:0][R_SZ:0];
88
wire  cell_in_p0[R_SZ:0][R_SZ:0];
89
wire  cell_in_pp[R_SZ:0][R_SZ:0];
90
 
91
wire  ribbon_init[R_SZ:0][R_SZ:0];
92
//wire [R_SZ:0] token_in;
93
//wire [R_SZ:0] token_out;
94
wire cell_rst= (iY_video==1);
95
wire cell_clk= (iX_video==1 && iY_video %R_SZp==1);
96
 
97
Cell_life ribbon[R_SZ:0][R_SZ:0] ( cell_clk, cell_rst, cell_in_mm, cell_in_m0, cell_in_mp,
98
                                                                                                                                                cell_in_0m,                     cell_in_0p,
99
                                                                                                                                cell_in_pm, cell_in_p0, cell_in_pp, ribbon_init, cell_out );
100
 
101
generate
102
  genvar i,j;
103
  for (i=0; i<=R_SZ; i=i+1)
104
  begin : block_name01
105
          for (j=0; j<=R_SZ; j=j+1)
106
          begin : block_name02
107
                        if ( i==R_SZp/2 && j>=8 && j<24 )
108
                                assign ribbon_init[i][j]= 1;
109
                        else if ( i==R_SZp/2 && j>=3 && j<24 )
110
                                assign ribbon_init[i][j]= tumblers[j-3];
111
                        else
112
                                assign ribbon_init[i][j]= 0;
113
          end
114
  end
115
 
116
  for (i=0; i<=R_SZ; i=i+1)
117
  begin : block_name1
118
          for (j=0; j
119
          begin : block_name2
120
                 assign cell_in_m0[i][j+1]= cell_out[i][j];
121
                 assign cell_in_0m[j+1][i]= cell_out[j][i];
122
                 assign cell_in_p0[i][j]= cell_out[i][j+1];
123
                 assign cell_in_0p[j][i]= cell_out[j+1][i];
124
          end
125
          assign cell_in_m0[i][0]= 0;
126
          assign cell_in_mm[i][0]= 0;
127
          assign cell_in_0m[0][i]= 0;
128
          assign cell_in_p0[i][R_SZ]= 0;
129
          assign cell_in_0p[R_SZ][i]= 0;
130
  end
131
 
132
  for (i=0; i
133
  begin : block21
134
          for (j=0; j
135
          begin : block22
136
                 assign cell_in_mm[i+1][j+1]= cell_out[i][j];
137
                 assign cell_in_mp[i][j+1]= cell_out[i+1][j];
138
                 assign cell_in_pm[i+1][j]= cell_out[i][j+1];
139
                 assign cell_in_pp[i][j]= cell_out[i+1][j+1];
140
          end
141
  end
142
 
143
//  begin : block_name1
144
//  end
145
endgenerate
146
 
147
always@(posedge clk or posedge rst)
148
begin
149
        if ( rst )
150
        begin
151
                count= 0;
152
        end
153
        else
154
        begin
155
                if ( iX_video==1 && iY_video==1 )
156
                begin
157
                        count<= count +1;
158
                end
159
                else if ( iX_video==1 )
160
                begin
161
                        count_py<= count_py +1;
162
                end
163
 
164
                oR_video= {8{cell_out[ iX_video ][ iY_video % (R_SZ+1) ]}};
165
                oG_video= {8{cell_out[ iX_video ][ iY_video % (R_SZ+1) ]}};
166
                oB_video= {8{cell_out[ iX_video ][ iY_video % (R_SZ+1) ]}};
167
        end
168
end
169
endmodule
170
 
171
 
172
 
173
 
174
 
175
 
176
 
177
 
178
 
179
module Cell_110 ( clk, rst, in_m, in_p, out_0, broad );
180
 
181
input clk;
182
input rst;
183
 
184
input in_m;
185
input in_p;
186
 
187
output out_0= state;
188
 
189
input broad;
190
 
191
//input token_in;
192
//output reg token_out;
193
reg state;
194
 
195
always@(posedge clk or posedge rst)
196
begin
197
        if ( rst )
198
        begin
199
                state<= broad;
200
        end
201
        else
202
        begin
203
                case( { in_m, state, in_p })
204
                        3'd0: state <= 0;
205
                        3'd1: state <= 0;
206
                        3'd2: state <= 1;
207
                        3'd3: state <= 1;
208
                        3'd4: state <= 1;
209
                        3'd5: state <= 1;
210
                        3'd6: state <= 1;
211
                        3'd7: state <= 0;
212
                endcase
213
        end
214
end
215
endmodule
216
 
217
 
218
 
219
 
220
module VGA_HighEnd_2 ( clk, rst,
221
                                                                iX_video, iY_video,
222
                                                                oR_video, oG_video, oB_video,
223
                                                                tumblers, endFrame, dbg_val     );
224
 
225
parameter RES_X_H= 1240;
226
parameter RES_Y_H= 1024;
227
parameter XY_STEP_H= 7;
228
parameter RES_X_L= 640;
229
parameter RES_Y_L= 480;
230
parameter XY_STEP_L= 8;
231
 
232
input clk;
233
input rst;
234
 
235
input signed [11:0] iX_video;
236
input signed [11:0] iY_video;
237
output reg [7:0] oR_video;
238
output reg [7:0] oG_video;
239
output reg [7:0] oB_video;
240
input   [9:0]                   tumblers;
241
input endFrame;
242
output wire [63:0] dbg_val= count;
243
 
244
wire [31:0] V_out2;
245
 
246
wire high_res= 1;
247
 
248
reg [31:0] count;
249
reg [31:0] count_py;
250
 
251
 
252
wire signed [11:0] x;
253
wire signed [11:0] y;
254
assign x= (iX_video- (high_res ? RES_X_H/2 :RES_X_L/2 ));
255
assign y= (iY_video- (high_res ? RES_Y_H/2 :RES_Y_L/2 ));
256
 
257
parameter R_SZ= 1280;
258
 
259
wire [R_SZ:0] cell_out;
260
wire [R_SZ:0] cell_in_m;
261
wire [R_SZ:0] cell_in_p;
262
wire [R_SZ:0] ribbon_init;
263
//wire [R_SZ:0] token_in;
264
//wire [R_SZ:0] token_out;
265
wire cell_rst= (iY_video==1);
266
wire cell_clk= (iX_video==1);
267
 
268
Cell_110 ribbon[R_SZ:0] ( cell_clk, cell_rst, cell_in_m, cell_in_p, cell_out, ribbon_init );
269
 
270
assign ribbon_init[99:0] =0;
271
assign ribbon_init[125:100] =count[31:6];
272
assign ribbon_init[R_SZ:126] =0;
273
//
274
//assign ribbon_init[99:0] =0;
275
//assign ribbon_init[125:100] =count[31:6];
276
//assign ribbon_init[R_SZ:126] =0;
277
 
278
generate
279
  genvar i;
280
  for (i=0; i
281
  begin : block_name
282
         assign cell_in_m[i+1]= cell_out[i];
283
         assign cell_in_p[i]= cell_out[i+1];
284
  end
285
//  begin : block_name1
286
  assign cell_in_m[0]= 0;
287
  assign cell_in_p[R_SZ]= 0;
288
//  end
289
endgenerate
290
 
291
always@(posedge clk or posedge rst)
292
begin
293
        if ( rst )
294
        begin
295
                count= 0;
296
        end
297
        else
298
        begin
299
                if ( iX_video==1 && iY_video==1 )
300
                begin
301
                        count<= count +1;
302
                end
303
                else if ( iX_video==1 )
304
                begin
305
                        count_py<= count_py +1;
306
                end
307
 
308
                oR_video= {8{cell_out[ iX_video ]}};
309
                oG_video= {8{cell_out[ iX_video ]}};
310
                oB_video= {8{cell_out[ iX_video ]}};
311
        end
312
end
313
endmodule
314
 
315
 
316
 
317
 

powered by: WebSVN 2.1.0

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