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

Subversion Repositories qrisc32

[/] [qrisc32/] [trunk/] [qrisc32_TB.sv] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 vinogradov
//////////////////////////////////////////////////////////////////////////////////////////////
2
//    Project Qrisc32 is risc cpu implementation, purpose is studying
3
//    Digital System Design course at Kyoung Hee University during my PhD earning
4
//    Copyright (C) 2010  Vinogradov Viacheslav
5
//
6
//    This library is free software; you can redistribute it and/or
7
//   modify it under the terms of the GNU Lesser General Public
8
//    License as published by the Free Software Foundation; either
9
//    version 2.1 of the License, or (at your option) any later version.
10
//
11
//    This library is distributed in the hope that it will be useful,
12
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
13
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
//    Lesser General Public License for more details.
15
//
16
//    You should have received a copy of the GNU Lesser General Public
17
//    License along with this library; if not, write to the Free Software
18
//    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
19
//
20
//
21
//////////////////////////////////////////////////////////////////////////////////////////////
22
 
23
 
24
 
25
`timescale 1ns / 1ns
26
 
27
module qrisc32_tb;
28
//Parameters declaration:
29
        import risc_pack::*;
30
 
31
        //Internal signals declarations:
32
        bit reset,clk;
33
        //I data
34
        logic[31:0]     idata;
35
        logic[31:0]     iaddr;
36
        logic           ird;
37
        logic           ireq;
38
 
39
        //D read
40
        logic[31:0]     rdata;
41
        logic[31:0]     raddr;
42
        logic           rrd;
43
        logic           rreq=0;
44
 
45
        //D write
46
        logic[31:0]     wdata;
47
        logic[31:0]     waddr;
48
        logic           wwr;
49
        logic           wreq=0;
50
        logic           Istop_active,Dstop_active;
51
        bit                     Istop_enable,Dstop_enable;
52
        bit                     verbose;
53
 
54
        //emulates Instruction ram
55
        mem             Iram(
56
                .clk(clk),
57
                .add_r(iaddr),
58
                .add_w(32'h0),
59
                .data_w(32'h0),
60
                .rd(ird),
61
                .wr(1'b0),
62
                .data_r(idata),
63
                .req(ireq),
64
                .stop_enable(Istop_enable),
65
                .stop_active(Istop_active),
66
                .verbose(verbose)
67
        );
68
        defparam Iram.size=256;
69
        defparam Iram.adr_limit=93;
70
 
71
        //emulates Data ram
72
        mem             Dram(
73
                .clk(clk),
74
                .add_r(raddr),
75
                .add_w(waddr),
76
                .data_w(wdata),
77
                .rd(rrd),
78
                .wr(wwr),
79
                .data_r(rdata),
80
                .req(),
81
                .stop_enable(Dstop_enable),
82
                .stop_active(Dstop_active),
83
                .verbose(verbose)
84
        );
85
        defparam Dram.size=10;
86
        defparam Dram.adr_limit=10;
87
 
88
        // Unit Under Test port map
89
        qrisc32 UUT(
90
                .reset(reset),
91
                .clk(clk),
92
                //avalon master port only for  reading instructions
93
                .avm_instructions_data(idata),
94
                .avm_instructions_addr(iaddr),
95
                .avm_instructions_rd(ird),
96
                .avm_instructions_wait_req(ireq),
97
 
98
                //avalon master port only for  reading data
99
                .avm_datar_data(rdata),
100
                .avm_datar_addr(raddr),
101
                .avm_datar_rd(rrd),
102
                .avm_datar_wait_req(rreq),
103
 
104
                //avalon master port only for  writing data
105
                .avm_dataw_data(wdata),
106
                .avm_dataw_addr(waddr),
107
                .avm_dataw_wr(wwr),
108
                .avm_dataw_wait_req(wreq),
109
                .verbose(verbose)
110
        );
111
 
112
        int address;
113
        bit signed[14:0] jmpr_label0,jmpr_label1;
114
        bit [25:0] ilabel,jlabel,inclabel,jmp_label1;
115
 
116
        function        void loadIram;
117
                input[31:0]     data;
118
                begin
119
                        Iram.sram[address] = data;
120
                        address=address+1;
121
                end
122
        endfunction
123
 
124
        task    load_buble_sort;
125
        /*buble algorithm
126
                R0=mem[00],R1=mem[04],R2=mem[08],R3=mem[c],R4=mem[10]
127
                R5=mem[14],R6=mem[18],R7=mem[1c],R8=mem[20],R9=mem[24]
128
                R10=R0;
129
                R11=R0;//minimum
130
                if R1
131
                        R11=R1
132
                if R2
133
                        R11=R2
134
                if R3
135
                        R11=R3
136
                if R4
137
                        R11=R4
138
                if R5
139
                        R11=R5
140
                if R6
141
                        R11=R6
142
                if R7
143
                        R11=R7
144
                if R8
145
                        R11=R8
146
                if R9
147
                        R11=R9
148
                mem[0]=R11;
149
 
150
                for (i = 36; i > 0; i-=4)//36,32,28,24,20,16,12,8,4
151
                {
152
                        if R0>R10
153
                                R10=R0
154
                        if R1>R10
155
                                R10=R1
156
                        if R2>R10
157
                                R10=R2
158
                        if R3>R10
159
                                R10=R3
160
                        if R4>R10
161
                                R10=R4
162
                        if R5>R10
163
                                R10=R5
164
                        if R6>R10
165
                                R10=R6
166
                        if R7>R10
167
                                R10=R7
168
                        if R8>R10
169
                                R10=R8
170
                        if R9>R10
171
                                R10=R9
172
 
173
                        mem[i]=R10;
174
 
175
                        //substitute maximum by minimum
176
                        if R10=R0
177
                                R0=R11
178
                        if R10=R1
179
                                R1=R11
180
                        if R10=R2
181
                                R2=R11
182
                        if R10=R3
183
                                R3=R11
184
                        if R10=R4
185
                                R4=R11
186
                        if R10=R5
187
                                R5=R11
188
                        if R10=R6
189
                                R6=R11
190
                        if R10=R7
191
                                R7=R11
192
                        if R10=R8
193
                                R8=R11
194
                        if R10=R9
195
                                R9=R11
196
 
197
                }*/
198
        //loading instructions
199
                address=0;
200
                //verbose=1;
201
                //Istop_enable=1;
202
 
203
                loadIram({LDRH,16'h0000,R12});//R12 is 36
204
                loadIram({XOR,DECR_0,7'h0,R13,R13,R13});//R13 is 0
205
                loadIram({LDRH,16'hFFFF,R14});//R14 is -4
206
                loadIram({LDRL,16'h0024,R12});//R12 is 36
207
 
208
                loadIram({LDRP,OFFSET_CODE,15'd00,R13,R0});//ldr R0,[R13+0]
209
                loadIram({LDRP,OFFSET_CODE,15'd04,R13,R1});//ldr R1,[R13+4]
210
                loadIram({LDRP,OFFSET_CODE,15'd08,R13,R2});//ldr R2,[R13+8]
211
                loadIram({LDRP,OFFSET_CODE,15'd12,R13,R3});//ldr R3,[R13+12]
212
                loadIram({LDRP,OFFSET_CODE,15'd16,R13,R4});//ldr R4,[R13+16]
213
 
214
                loadIram({LDRP,OFFSET_CODE,15'd20,R13,R5});//ldr R5,[R13+20]
215
                loadIram({LDRP,OFFSET_CODE,15'd24,R13,R6});//ldr R6,[R13+24]
216
                loadIram({LDRP,OFFSET_CODE,15'd28,R13,R7});//ldr R7,[R13+28]
217
                loadIram({LDRP,OFFSET_CODE,15'd32,R13,R8});//ldr R8,[R13+32]
218
                loadIram({LDRP,OFFSET_CODE,15'd36,R13,R9});//ldr R9,[R13+36]
219
 
220
                loadIram({LDRL,-16'd4,R14});//R14 is -4
221
 
222
                //search for minimum
223
                loadIram({CMP,INCR_0,7'h0,R0,R1,R1});
224
                loadIram({LDRC,INCR_0,7'h0,R0,R1,R16});
225
 
226
                loadIram({CMP,INCR_0,7'h0,R3,R2,R2});
227
                loadIram({LDRC,INCR_0,7'h0,R3,R2,R17});
228
 
229
                loadIram({CMP,INCR_0,7'h0,R5,R4,R4});
230
                loadIram({LDRC,INCR_0,7'h0,R5,R4,R18});
231
 
232
                loadIram({CMP,INCR_0,7'h0,R7,R6,R6});
233
                loadIram({LDRC,INCR_0,7'h0,R7,R6,R19});
234
 
235
                loadIram({CMP,INCR_0,7'h0,R9,R8,R8});
236
                loadIram({LDRC,INCR_0,7'h0,R9,R8,R20});
237
 
238
                loadIram({CMP,INCR_0,7'h0,R17,R16,R16});
239
                loadIram({LDRC,INCR_0,7'h0,R17,R16,R21});
240
 
241
                loadIram({CMP,INCR_0,7'h0,R19,R18,R18});
242
                loadIram({LDRC,INCR_0,7'h0,R19,R18,R22});
243
 
244
                loadIram({CMP,INCR_0,7'h0,R21,R20,R20});
245
                loadIram({LDRC,INCR_0,7'h0,R21,R20,R23});
246
                loadIram({NOP});
247
 
248
                loadIram({CMP,INCR_0,7'h0,R23,R22,R22});
249
                loadIram({LDRC,INCR_0,7'h0,R23,R22,R11});
250
 
251
                loadIram({NOP});
252
                //minimum write
253
                loadIram({STRP,OFFSET_CODE,15'd0,R13,R11});//str R10,[R13+0]
254
 
255
                //
256
                //search for maximum
257
                loadIram({CMP,INCR_0,7'h0,R0,R1,R1});
258
                loadIram({LDRNC,INCR_0,7'h0,R0,R1,R16});
259
 
260
                loadIram({CMP,INCR_0,7'h0,R3,R2,R2});
261
                jmpr_label0=4*address;
262
                loadIram({LDRNC,INCR_0,7'h0,R3,R2,R17});
263
 
264
                loadIram({CMP,INCR_0,7'h0,R5,R4,R4});
265
                loadIram({LDRNC,INCR_0,7'h0,R5,R4,R18});
266
 
267
                loadIram({CMP,INCR_0,7'h0,R7,R6,R6});
268
                loadIram({LDRNC,INCR_0,7'h0,R7,R6,R19});
269
 
270
                loadIram({CMP,INCR_0,7'h0,R9,R8,R8});
271
                loadIram({LDRNC,INCR_0,7'h0,R9,R8,R20});
272
 
273
                loadIram({CMP,INCR_0,7'h0,R17,R16,R16});
274
                loadIram({LDRNC,INCR_0,7'h0,R17,R16,R21});
275
 
276
                loadIram({CMP,INCR_0,7'h0,R19,R18,R18});
277
                loadIram({LDRNC,INCR_0,7'h0,R19,R18,R22});
278
 
279
                loadIram({CMP,INCR_0,7'h0,R21,R20,R20});
280
                loadIram({LDRNC,INCR_0,7'h0,R21,R20,R23});
281
                loadIram({NOP});
282
 
283
                loadIram({CMP,INCR_0,7'h0,R23,R22,R22});
284
                loadIram({LDRNC,INCR_0,7'h0,R23,R22,R10});
285
                loadIram({NOP});
286
 
287
                loadIram({STRP,OFFSET_CODE,15'd0,R12,R10});//str R10,[R12+0]
288
 
289
                loadIram({ADD,DECR_0,7'h0,R14,R12,R12});//R12 = R12 + R12( -4)
290
 
291
                loadIram({CMP,INCR_0,7'h0,R0,R10,R10});
292
                loadIram({LDRZ,INCR_0,7'h0,R0,R11,R0});
293
                loadIram({CMP,INCR_0,7'h0,R1,R10,R10});
294
                loadIram({LDRZ,INCR_0,7'h0,R1,R11,R1});
295
                loadIram({CMP,INCR_0,7'h0,R2,R10,R10});
296
                loadIram({LDRZ,INCR_0,7'h0,R2,R11,R2});
297
                loadIram({CMP,INCR_0,7'h0,R3,R10,R10});
298
                loadIram({LDRZ,INCR_0,7'h0,R3,R11,R3});
299
                loadIram({CMP,INCR_0,7'h0,R4,R10,R10});
300
                loadIram({LDRZ,INCR_0,7'h0,R4,R11,R4});
301
                loadIram({CMP,INCR_0,7'h0,R5,R10,R10});
302
                loadIram({LDRZ,INCR_0,7'h0,R5,R11,R5});
303
                loadIram({CMP,INCR_0,7'h0,R6,R10,R10});
304
                loadIram({LDRZ,INCR_0,7'h0,R6,R11,R6});
305
                loadIram({CMP,INCR_0,7'h0,R7,R10,R10});
306
                loadIram({LDRZ,INCR_0,7'h0,R7,R11,R7});
307
                loadIram({CMP,INCR_0,7'h0,R8,R10,R10});
308
                loadIram({LDRZ,INCR_0,7'h0,R8,R11,R8});
309
                loadIram({CMP,INCR_0,7'h0,R9,R10,R10});
310
                loadIram({LDRZ,INCR_0,7'h0,R9,R11,R9});
311
 
312
                loadIram({CMP,INCR_0,7'h0,R13,R12,R12});//cmp R12 with R13(0)
313
 
314
                jmpr_label1=jmpr_label0-4*address-8;
315
                loadIram({JMPNZ,OFFSET_CODE,jmpr_label1,10'h0});
316
                loadIram({LDRR,DECR_0,7'h0,R11,R11,R10});//R10 =R11
317
 
318
                loadIram({CMP,INCR_0,7'h0,R0,R1,R1});
319
                loadIram({LDRNC,INCR_0,7'h0,R0,R1,R16});
320
                loadIram({CMP,INCR_0,7'h0,R3,R2,R2});
321
 
322
 
323
        endtask;
324
 
325
 
326
        task    load_shell_sort_mdf;
327
        /*new algorithm
328
                for(inc = 20;inc>0;inc=inc/2)//20, 8 and 4 (5,2,1)
329
                {
330
                        for (i = inc; i < 40; i+=4)//0..4..8..c and etc
331
                        {
332
                                temp = a[i];
333
                                for (j = i; (j >= inc) && (a[j-inc] > temp); j =j-inc)
334
                                {
335
                                        a[j] = a[j-inc];
336
                                }
337
                        a[j] = temp;
338
                        }
339
                }*/
340
        //---------------------  reverse(709) random(714) sorted(516)
341
        //loading instructions
342
                address=0;
343
                loadIram({LDRH,16'h0000,R5});//R5 inc = 5
344
                loadIram({LDRH,16'h0000,R8});//R8 =1
345
                loadIram({LDRH,16'h0000,R9});//R9 =2
346
                loadIram({LDRH,16'h0000,R10});//R10 is 4
347
                loadIram({LDRH,16'h0000,R12});//R12 is 40
348
                loadIram({LDRH,16'hFFFF,R13});//R13 is mask 0xffff_ffff
349
                loadIram({LDRH,16'h0000,R14});//R14 is 3
350
 
351
                loadIram({LDRL,16'h0005,R5});//R5 inc = 5
352
                loadIram({LDRL,16'h0001,R8});//R8 =1
353
                loadIram({LDRL,16'h0002,R9});//R9 =2
354
                loadIram({LDRL,16'h0004,R10});//R10 is 4
355
                loadIram({LDRL,16'h0028,R12});//R12 is 40
356
                loadIram({LDRL,16'hFFFF,R13});//R13 is mask 0xffff_ffff
357
                loadIram({LDRL,16'h0003,R14});//R14 is 3
358
 
359
                //R5 - inc
360
                //R6 - -inc
361
                //R7 - j-inc
362
                //R4 - i
363
                //R3 - J
364
                //for (inc...
365
                inclabel = 4*address;
366
                jmpr_label0 = 4*address;
367
                loadIram({SHL,INCR_0,7'h0,R9,R5,R5});//R5 = R5<
368
 
369
                jmpr_label1=1000*4;//out of code
370
                loadIram({JMPZ,OFFSET_CODE,jmpr_label1,10'h0});//R5>0?
371
 
372
                loadIram({XOR,DECR_0,7'h0,R13,R5,R6});//R6 = R5 xor R13
373
                loadIram({LDRR,DECR_0,7'h0,R5,R5,R4});//i(R4)=inc (R5)
374
                loadIram({ADD,DECR_0,7'h0,R8,R6,R6});//R6 = R6 + R8( +1)
375
                loadIram({SHR,INCR_0,7'h0,R14,R5,R5});//R5 = R5>>R14( R5>>3))
376
 
377
                loadIram({CMP,INCR_0,7'h0,R12,R4,R4});//compare R4 with R12(i == 40) if 0 then reached maximum-> stop
378
                ilabel=4*address;
379
 
380
                jmpr_label1=jmpr_label0-4*address-8;
381
                loadIram({JMPZ,OFFSET_CODE,jmpr_label1,10'h0});//if =40 then goto inc
382
 
383
                //temp  - r1
384
                loadIram({LDRP,OFFSET_CODE,15'd0,R4,R1});//ldr R1,[R4]
385
 
386
                //for (j = i;..
387
                loadIram({LDRR,DECR_0,7'h0,R4,R4,R3});//j(R3)=i(R4)
388
                loadIram({ADD,DECR_0,7'h0,R4,R6,R7});//R7 = R4+R6=(i)j-inc
389
 
390
                loadIram({CMP,INCR_0,7'h0,R5,R3,R3});//cmp R3 j with R5 inc
391
                jlabel=4*address;
392
                //a[j-inc]  - r0
393
                loadIram({LDRP,OFFSET_CODE,15'd0,R7,R0});//ldrp R0,[R7]
394
 
395
                jmpr_label1=13*4;
396
                loadIram({JMPC,OFFSET_CODE,jmpr_label1,10'h0});//c=1 then R3 j < R5 inc
397
                loadIram({NOP});loadIram({NOP});loadIram({NOP});
398
 
399
                //a[j-inc] > temp?
400
                loadIram({CMP,INCR_0,7'h0,R1,R0,R0});//cmp R0 a[j-inc] with R1 temp
401
 
402
                jmpr_label1=8*4;
403
                loadIram({JMPC,OFFSET_CODE,jmpr_label1,10'h0});//c=1 then R0>R1
404
                loadIram({NOP});loadIram({NOP});loadIram({NOP});loadIram({NOP});
405
 
406
                loadIram({JMP,jlabel});//goto next cycle of J
407
                loadIram({LDRR,DECR_0,7'h0,R7,R7,R3});//j=j-inc,  R3=R7
408
                //a[j] = a[j-inc];
409
                loadIram({STRP,OFFSET_CODE,15'd0,R3,R0});//str R0,[R3+0]
410
                loadIram({ADD,DECR_0,7'h0,R3,R6,R7});//R7 = R3+R6=j-inc
411
                loadIram({CMP,INCR_0,7'h0,R5,R3,R3});//cmp R3 j with R5 inc
412
 
413
                //
414
                loadIram({JMP,ilabel});//goto next cycle of i
415
                loadIram({ADD,DECR_0,7'h0,R10,R4,R4});//R4=R4+R10...i+=4
416
                //a[j] = temp;
417
                loadIram({STRP,OFFSET_CODE,15'd0,R3,R1});//str R3,[R7+0]
418
                loadIram({CMP,INCR_0,7'h0,R12,R4,R4});//compare R4 with R12(i == 40) if 0 then reached maximum-> stop
419
                loadIram({NOP});
420
        endtask;
421
 
422
 
423
        task    shell_first;
424
 
425
        //old
426
        // for (i = 0; i < 36; i+=4) {
427
        // temp = a[i+4];
428
        // for (j = i; (j >= 0) && (a[j] > temp); j -= 4)a[j+4] = a[j];
429
        // a[j+4] = temp;
430
 
431
        //loading instructions
432
                address=0;
433
                loadIram({LDRH,16'h0000,R10});//R10 is 4
434
                loadIram({LDRH,16'hffff,R11});//R11 is -4
435
                loadIram({LDRH,16'h0000,R12});//R12 is 36
436
                jmp_label1 = 4*address+4*8;
437
                loadIram({JMP,jmp_label1});//goto entry point
438
 
439
                loadIram({XOR,INCR_0,7'h0,R4,R4,R4});//i base of data
440
                loadIram({LDRL,16'h0004,R10});//R10 is 4
441
                loadIram({LDRL,16'hFFFC,R11});//R11 is -4
442
                loadIram({LDRL,16'h0024,R12});//R12 is 36
443
                //R4  is i=0 base of data
444
                //R7  is J
445
 
446
                //end of main cycle
447
                jmpr_label0=4*address;
448
                jmpr_label1=4*address+32*8;
449
 
450
                loadIram({JMPZ,OFFSET_CODE,jmpr_label1,10'h0});//goto to out of main cycle
451
                loadIram({LDRR,DECR_0,7'h0,R5,R4,R7});//R7 = R4   ->R7 is J
452
                //a[j+4] = temp;
453
                loadIram({STRP,OFFSET_CODE,15'd4,R7,R0});//str R0,[R7+4]
454
                //main cycle here (I)-------------------------------------------------
455
                //entry point
456
                //temp=a[i],  R0 is temp
457
                loadIram({LDRP,OFFSET_CODE,15'd0,R4,R15});//ldr R0,[R4+0]
458
 
459
                //check j <0
460
                loadIram({XOR,DECR_0,7'h0,R7,R11,R2});//compare R7 with -4
461
                loadIram({LDRP,OFFSET_CODE,15'd4,R4,R0});//ldr R0,[R4+4]
462
                //
463
                jmp_label1=4*address;
464
                jmpr_label1=jmpr_label0-4*address-8;
465
                loadIram({JMPZ,OFFSET_CODE,jmpr_label1,10'h0});//Z=1 when J<0 goto end of main cycle a[j+4] = temp;
466
                //i+=4
467
                loadIram({ADD,DECR_0,7'h0,R10,R4,R4});//R4 = R4+4
468
                loadIram({LDRR,DECR_0,7'h0,R15,R15,R1});//R1=R15
469
                //check i =36?
470
                loadIram({XOR,INCR_0,7'h0,R12,R4,R2});//R2=R4^R12(i xor 36) if 0 then reached maximum-> stop
471
                //a[j] read
472
                loadIram({LDRP,OFFSET_CODE,-15'd4,R7,R15});//ldr R15,[R7-4]
473
 
474
                //compare R1(a[j]) with R0(temp)
475
                loadIram({CMP,INCR_0,7'h0,R0,R1,R2});
476
                jmpr_label1=jmpr_label0-4*address-8;
477
                loadIram({JMPC,OFFSET_CODE,jmpr_label1,10'h0});//c=1 then R1<=R0   - (a[j] > temp) is false goto end of subcycle (A[j+4]=temp)
478
                loadIram({NOP});loadIram({NOP});loadIram({NOP});
479
                //check i =36?
480
                loadIram({XOR,INCR_0,7'h0,R12,R4,R2});//R2=R4^R12(i xor 36) if 0 then reached maximum-> stop
481
 
482
                loadIram({JMP,jmp_label1});//goto subcycle
483
                //j-=4
484
                loadIram({ADD,DECR_0,7'h0,R7,R11,R7});//R7 = R7-4
485
                //i-=4
486
                loadIram({ADD,DECR_0,7'h0,R11,R4,R4});//R4 = R4-4
487
                //a[j+4] = a[j](R1);
488
                loadIram({STRP,OFFSET_CODE,15'd8,R7,R1});//str R1,[R7+4]                A[j+4]=temp
489
                loadIram({XOR,DECR_0,7'h0,R7,R11,R2});//compare R7 with -4
490
 
491
        endtask;
492
 
493
        task    load_unsorted_data(bit[1:0] kind);
494
        //loading  unsorted data in Dram
495
                for(int i=0;i<10;i++)
496
                        Dram.sram[i]=(kind==0)? 10-i:                   //reverse unsorted
497
                                                (kind==1)?      100+$random%100://randomly unsorted
498
                                                                        i+1;                    //already sorted
499
        endtask;
500
 
501
        task    start;
502
                reset=1;
503
                $display("Programm size is %d Words",address);
504
                #100;
505
                reset=0;
506
                #1us;
507
                @(posedge       Istop_active);
508
                $display("Sort finished");
509
                $display("Cycles for sorting -->%0d<--",cycles);
510
        endtask;
511
 
512
        initial
513
        begin
514
                Istop_enable=0;
515
                Dstop_enable=0;
516
                verbose=0;
517
                for(int i=0;i<3;i++)
518
                begin
519
                        $display("------------------Start round %d------------------",i);
520
                        load_unsorted_data(i);
521
                        $display("Load buble sort...");
522
                        load_buble_sort;
523
                        start;
524
 
525
                        load_unsorted_data(i);
526
                        $display("Load shell modified...");
527
                        load_shell_sort_mdf;
528
                        start;
529
 
530
                        load_unsorted_data(i);
531
                        $display("Load shell first...");
532
                        shell_first;
533
                        start;
534
 
535
                end
536
                $finish;
537
        end
538
 
539
        initial
540
        begin
541
                clk=0;
542
                forever #10 clk<=!clk;
543
        end
544
 
545
        int cycles;
546
 
547
        always@(posedge clk or posedge reset)
548
        if(reset)
549
                cycles=0;
550
        else
551
                cycles=cycles+1;
552
 
553
endmodule

powered by: WebSVN 2.1.0

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