-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathAcceleratoTop.v
4889 lines (4889 loc) · 289 KB
/
AcceleratoTop.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
module Bitmap(
input clock,
input reset,
input [15:0] io_mat1_0_0,
input [15:0] io_mat1_0_1,
input [15:0] io_mat1_1_0,
input [15:0] io_mat1_1_1,
output [15:0] io_bitmap1_0_0,
output [15:0] io_bitmap1_0_1,
output [15:0] io_bitmap1_1_0,
output [15:0] io_bitmap1_1_1
);
`ifdef RANDOMIZE_REG_INIT
reg [31:0] _RAND_0;
reg [31:0] _RAND_1;
reg [31:0] _RAND_2;
reg [31:0] _RAND_3;
reg [31:0] _RAND_4;
reg [31:0] _RAND_5;
`endif // RANDOMIZE_REG_INIT
reg [15:0] matReg1_0_0; // @[Bitmap.scala 14:26]
reg [15:0] matReg1_0_1; // @[Bitmap.scala 14:26]
reg [15:0] matReg1_1_0; // @[Bitmap.scala 14:26]
reg [15:0] matReg1_1_1; // @[Bitmap.scala 14:26]
reg i; // @[Bitmap.scala 19:20]
reg j; // @[Bitmap.scala 20:20]
wire _GEN_42 = ~i; // @[Bitmap.scala 23:{41,41}]
wire [15:0] _GEN_1 = ~i & j ? io_mat1_0_1 : io_mat1_0_0; // @[Bitmap.scala 23:{41,41}]
wire _GEN_43 = ~j; // @[Bitmap.scala 23:{41,41}]
wire [15:0] _GEN_2 = i & ~j ? io_mat1_1_0 : _GEN_1; // @[Bitmap.scala 23:{41,41}]
wire [15:0] _GEN_3 = i & j ? io_mat1_1_1 : _GEN_2; // @[Bitmap.scala 23:{41,41}]
wire _j_T_1 = j + 1'h1; // @[Bitmap.scala 33:17]
assign io_bitmap1_0_0 = matReg1_0_0; // @[Bitmap.scala 16:16]
assign io_bitmap1_0_1 = matReg1_0_1; // @[Bitmap.scala 16:16]
assign io_bitmap1_1_0 = matReg1_1_0; // @[Bitmap.scala 16:16]
assign io_bitmap1_1_1 = matReg1_1_1; // @[Bitmap.scala 16:16]
always @(posedge clock) begin
if (reset) begin // @[Bitmap.scala 14:26]
matReg1_0_0 <= 16'h0; // @[Bitmap.scala 14:26]
end else if (_GEN_3 != 16'h0) begin // @[Bitmap.scala 23:49]
if (_GEN_42 & _GEN_43) begin // @[Bitmap.scala 24:31]
matReg1_0_0 <= 16'h1; // @[Bitmap.scala 24:31]
end
end else if (_GEN_42 & _GEN_43) begin // @[Bitmap.scala 26:31]
matReg1_0_0 <= 16'h0; // @[Bitmap.scala 26:31]
end
if (reset) begin // @[Bitmap.scala 14:26]
matReg1_0_1 <= 16'h0; // @[Bitmap.scala 14:26]
end else if (_GEN_3 != 16'h0) begin // @[Bitmap.scala 23:49]
if (_GEN_42 & j) begin // @[Bitmap.scala 24:31]
matReg1_0_1 <= 16'h1; // @[Bitmap.scala 24:31]
end
end else if (_GEN_42 & j) begin // @[Bitmap.scala 26:31]
matReg1_0_1 <= 16'h0; // @[Bitmap.scala 26:31]
end
if (reset) begin // @[Bitmap.scala 14:26]
matReg1_1_0 <= 16'h0; // @[Bitmap.scala 14:26]
end else if (_GEN_3 != 16'h0) begin // @[Bitmap.scala 23:49]
if (i & _GEN_43) begin // @[Bitmap.scala 24:31]
matReg1_1_0 <= 16'h1; // @[Bitmap.scala 24:31]
end
end else if (i & _GEN_43) begin // @[Bitmap.scala 26:31]
matReg1_1_0 <= 16'h0; // @[Bitmap.scala 26:31]
end
if (reset) begin // @[Bitmap.scala 14:26]
matReg1_1_1 <= 16'h0; // @[Bitmap.scala 14:26]
end else if (_GEN_3 != 16'h0) begin // @[Bitmap.scala 23:49]
if (i & j) begin // @[Bitmap.scala 24:31]
matReg1_1_1 <= 16'h1; // @[Bitmap.scala 24:31]
end
end else if (i & j) begin // @[Bitmap.scala 26:31]
matReg1_1_1 <= 16'h0; // @[Bitmap.scala 26:31]
end
if (reset) begin // @[Bitmap.scala 19:20]
i <= 1'h0; // @[Bitmap.scala 19:20]
end else if (j) begin // @[Bitmap.scala 35:36]
i <= i + 1'h1; // @[Bitmap.scala 36:7]
end
if (reset) begin // @[Bitmap.scala 20:20]
j <= 1'h0; // @[Bitmap.scala 20:20]
end else begin
j <= _j_T_1;
end
end
// Register and memory initialization
`ifdef RANDOMIZE_GARBAGE_ASSIGN
`define RANDOMIZE
`endif
`ifdef RANDOMIZE_INVALID_ASSIGN
`define RANDOMIZE
`endif
`ifdef RANDOMIZE_REG_INIT
`define RANDOMIZE
`endif
`ifdef RANDOMIZE_MEM_INIT
`define RANDOMIZE
`endif
`ifndef RANDOM
`define RANDOM $random
`endif
`ifdef RANDOMIZE_MEM_INIT
integer initvar;
`endif
`ifndef SYNTHESIS
`ifdef FIRRTL_BEFORE_INITIAL
`FIRRTL_BEFORE_INITIAL
`endif
initial begin
`ifdef RANDOMIZE
`ifdef INIT_RANDOM
`INIT_RANDOM
`endif
`ifndef VERILATOR
`ifdef RANDOMIZE_DELAY
#`RANDOMIZE_DELAY begin end
`else
#0.002 begin end
`endif
`endif
`ifdef RANDOMIZE_REG_INIT
_RAND_0 = {1{`RANDOM}};
matReg1_0_0 = _RAND_0[15:0];
_RAND_1 = {1{`RANDOM}};
matReg1_0_1 = _RAND_1[15:0];
_RAND_2 = {1{`RANDOM}};
matReg1_1_0 = _RAND_2[15:0];
_RAND_3 = {1{`RANDOM}};
matReg1_1_1 = _RAND_3[15:0];
_RAND_4 = {1{`RANDOM}};
i = _RAND_4[0:0];
_RAND_5 = {1{`RANDOM}};
j = _RAND_5[0:0];
`endif // RANDOMIZE_REG_INIT
`endif // RANDOMIZE
end // initial
`ifdef FIRRTL_AFTER_INITIAL
`FIRRTL_AFTER_INITIAL
`endif
`endif // SYNTHESIS
endmodule
module Regor(
input clock,
input reset,
input [15:0] io_mat1_0_0,
input [15:0] io_mat1_0_1,
input [15:0] io_mat1_1_0,
input [15:0] io_mat1_1_1,
input [15:0] io_mat2_0_0,
input [15:0] io_mat2_0_1,
input [15:0] io_mat2_1_0,
input [15:0] io_mat2_1_1,
output [15:0] io_compressedBitmap_0_0,
output [15:0] io_compressedBitmap_0_1,
output [15:0] io_compressedBitmap_1_0,
output [15:0] io_compressedBitmap_1_1
);
`ifdef RANDOMIZE_REG_INIT
reg [31:0] _RAND_0;
reg [31:0] _RAND_1;
reg [31:0] _RAND_2;
reg [31:0] _RAND_3;
reg [31:0] _RAND_4;
reg [31:0] _RAND_5;
reg [31:0] _RAND_6;
reg [31:0] _RAND_7;
`endif // RANDOMIZE_REG_INIT
wire bitmap_clock; // @[MatrixPRE-Processor.scala 17:24]
wire bitmap_reset; // @[MatrixPRE-Processor.scala 17:24]
wire [15:0] bitmap_io_mat1_0_0; // @[MatrixPRE-Processor.scala 17:24]
wire [15:0] bitmap_io_mat1_0_1; // @[MatrixPRE-Processor.scala 17:24]
wire [15:0] bitmap_io_mat1_1_0; // @[MatrixPRE-Processor.scala 17:24]
wire [15:0] bitmap_io_mat1_1_1; // @[MatrixPRE-Processor.scala 17:24]
wire [15:0] bitmap_io_bitmap1_0_0; // @[MatrixPRE-Processor.scala 17:24]
wire [15:0] bitmap_io_bitmap1_0_1; // @[MatrixPRE-Processor.scala 17:24]
wire [15:0] bitmap_io_bitmap1_1_0; // @[MatrixPRE-Processor.scala 17:24]
wire [15:0] bitmap_io_bitmap1_1_1; // @[MatrixPRE-Processor.scala 17:24]
reg [15:0] matReg1_0_0; // @[MatrixPRE-Processor.scala 14:26]
reg [15:0] matReg1_0_1; // @[MatrixPRE-Processor.scala 14:26]
reg [15:0] matReg1_1_0; // @[MatrixPRE-Processor.scala 14:26]
reg [15:0] matReg1_1_1; // @[MatrixPRE-Processor.scala 14:26]
reg reg_0; // @[MatrixPRE-Processor.scala 21:22]
reg reg_1; // @[MatrixPRE-Processor.scala 21:22]
reg i; // @[MatrixPRE-Processor.scala 28:20]
reg j; // @[MatrixPRE-Processor.scala 29:20]
wire _GEN_1 = j ? reg_1 : reg_0; // @[MatrixPRE-Processor.scala 35:{23,23}]
wire [15:0] _GEN_2 = bitmap_io_bitmap1_0_0; // @[MatrixPRE-Processor.scala 35:{60,60}]
wire _GEN_28 = ~i; // @[MatrixPRE-Processor.scala 35:{60,60}]
wire [15:0] _GEN_3 = ~i & j ? bitmap_io_bitmap1_0_1 : _GEN_2; // @[MatrixPRE-Processor.scala 35:{60,60}]
wire _GEN_29 = ~j; // @[MatrixPRE-Processor.scala 35:{60,60}]
wire [15:0] _GEN_4 = i & ~j ? bitmap_io_bitmap1_1_0 : _GEN_3; // @[MatrixPRE-Processor.scala 35:{60,60}]
wire [15:0] _GEN_5 = i & j ? bitmap_io_bitmap1_1_1 : _GEN_4; // @[MatrixPRE-Processor.scala 35:{60,60}]
wire [15:0] _GEN_15 = _GEN_28 & j ? io_mat1_0_1 : io_mat1_0_0; // @[MatrixPRE-Processor.scala 38:{27,27}]
wire [15:0] _GEN_16 = i & _GEN_29 ? io_mat1_1_0 : _GEN_15; // @[MatrixPRE-Processor.scala 38:{27,27}]
wire _i_T_1 = i + 1'h1; // @[MatrixPRE-Processor.scala 40:16]
Bitmap bitmap ( // @[MatrixPRE-Processor.scala 17:24]
.clock(bitmap_clock),
.reset(bitmap_reset),
.io_mat1_0_0(bitmap_io_mat1_0_0),
.io_mat1_0_1(bitmap_io_mat1_0_1),
.io_mat1_1_0(bitmap_io_mat1_1_0),
.io_mat1_1_1(bitmap_io_mat1_1_1),
.io_bitmap1_0_0(bitmap_io_bitmap1_0_0),
.io_bitmap1_0_1(bitmap_io_bitmap1_0_1),
.io_bitmap1_1_0(bitmap_io_bitmap1_1_0),
.io_bitmap1_1_1(bitmap_io_bitmap1_1_1)
);
assign io_compressedBitmap_0_0 = matReg1_0_0; // @[MatrixPRE-Processor.scala 15:25]
assign io_compressedBitmap_0_1 = matReg1_0_1; // @[MatrixPRE-Processor.scala 15:25]
assign io_compressedBitmap_1_0 = matReg1_1_0; // @[MatrixPRE-Processor.scala 15:25]
assign io_compressedBitmap_1_1 = matReg1_1_1; // @[MatrixPRE-Processor.scala 15:25]
assign bitmap_clock = clock;
assign bitmap_reset = reset;
assign bitmap_io_mat1_0_0 = io_mat1_0_0; // @[MatrixPRE-Processor.scala 18:20]
assign bitmap_io_mat1_0_1 = io_mat1_0_1; // @[MatrixPRE-Processor.scala 18:20]
assign bitmap_io_mat1_1_0 = io_mat1_1_0; // @[MatrixPRE-Processor.scala 18:20]
assign bitmap_io_mat1_1_1 = io_mat1_1_1; // @[MatrixPRE-Processor.scala 18:20]
always @(posedge clock) begin
if (reset) begin // @[MatrixPRE-Processor.scala 14:26]
matReg1_0_0 <= 16'h0; // @[MatrixPRE-Processor.scala 14:26]
end else if (~_GEN_1 & _GEN_5 == 16'h1) begin // @[MatrixPRE-Processor.scala 35:69]
if (_GEN_28 & _GEN_29) begin // @[MatrixPRE-Processor.scala 36:27]
matReg1_0_0 <= 16'h0; // @[MatrixPRE-Processor.scala 36:27]
end
end else if (_GEN_28 & _GEN_29) begin // @[MatrixPRE-Processor.scala 38:27]
if (i & j) begin // @[MatrixPRE-Processor.scala 38:27]
matReg1_0_0 <= io_mat1_1_1; // @[MatrixPRE-Processor.scala 38:27]
end else begin
matReg1_0_0 <= _GEN_16;
end
end
if (reset) begin // @[MatrixPRE-Processor.scala 14:26]
matReg1_0_1 <= 16'h0; // @[MatrixPRE-Processor.scala 14:26]
end else if (~_GEN_1 & _GEN_5 == 16'h1) begin // @[MatrixPRE-Processor.scala 35:69]
if (_GEN_28 & j) begin // @[MatrixPRE-Processor.scala 36:27]
matReg1_0_1 <= 16'h0; // @[MatrixPRE-Processor.scala 36:27]
end
end else if (_GEN_28 & j) begin // @[MatrixPRE-Processor.scala 38:27]
if (i & j) begin // @[MatrixPRE-Processor.scala 38:27]
matReg1_0_1 <= io_mat1_1_1; // @[MatrixPRE-Processor.scala 38:27]
end else begin
matReg1_0_1 <= _GEN_16;
end
end
if (reset) begin // @[MatrixPRE-Processor.scala 14:26]
matReg1_1_0 <= 16'h0; // @[MatrixPRE-Processor.scala 14:26]
end else if (~_GEN_1 & _GEN_5 == 16'h1) begin // @[MatrixPRE-Processor.scala 35:69]
if (i & _GEN_29) begin // @[MatrixPRE-Processor.scala 36:27]
matReg1_1_0 <= 16'h0; // @[MatrixPRE-Processor.scala 36:27]
end
end else if (i & _GEN_29) begin // @[MatrixPRE-Processor.scala 38:27]
if (i & j) begin // @[MatrixPRE-Processor.scala 38:27]
matReg1_1_0 <= io_mat1_1_1; // @[MatrixPRE-Processor.scala 38:27]
end else begin
matReg1_1_0 <= _GEN_16;
end
end
if (reset) begin // @[MatrixPRE-Processor.scala 14:26]
matReg1_1_1 <= 16'h0; // @[MatrixPRE-Processor.scala 14:26]
end else if (~_GEN_1 & _GEN_5 == 16'h1) begin // @[MatrixPRE-Processor.scala 35:69]
if (i & j) begin // @[MatrixPRE-Processor.scala 36:27]
matReg1_1_1 <= 16'h0; // @[MatrixPRE-Processor.scala 36:27]
end
end else if (i & j) begin // @[MatrixPRE-Processor.scala 38:27]
if (i & j) begin // @[MatrixPRE-Processor.scala 38:27]
matReg1_1_1 <= io_mat1_1_1; // @[MatrixPRE-Processor.scala 38:27]
end else begin
matReg1_1_1 <= _GEN_16;
end
end
if (reset) begin // @[MatrixPRE-Processor.scala 21:22]
reg_0 <= 1'h0; // @[MatrixPRE-Processor.scala 21:22]
end else begin
reg_0 <= io_mat2_0_0 != 16'h0 | io_mat2_0_1 != 16'h0; // @[MatrixPRE-Processor.scala 23:16]
end
if (reset) begin // @[MatrixPRE-Processor.scala 21:22]
reg_1 <= 1'h0; // @[MatrixPRE-Processor.scala 21:22]
end else begin
reg_1 <= io_mat2_1_0 != 16'h0 | io_mat2_1_1 != 16'h0; // @[MatrixPRE-Processor.scala 23:16]
end
if (reset) begin // @[MatrixPRE-Processor.scala 28:20]
i <= 1'h0; // @[MatrixPRE-Processor.scala 28:20]
end else begin
i <= _i_T_1;
end
if (reset) begin // @[MatrixPRE-Processor.scala 29:20]
j <= 1'h0; // @[MatrixPRE-Processor.scala 29:20]
end else if (i) begin // @[MatrixPRE-Processor.scala 42:28]
j <= j + 1'h1; // @[MatrixPRE-Processor.scala 43:11]
end
end
// Register and memory initialization
`ifdef RANDOMIZE_GARBAGE_ASSIGN
`define RANDOMIZE
`endif
`ifdef RANDOMIZE_INVALID_ASSIGN
`define RANDOMIZE
`endif
`ifdef RANDOMIZE_REG_INIT
`define RANDOMIZE
`endif
`ifdef RANDOMIZE_MEM_INIT
`define RANDOMIZE
`endif
`ifndef RANDOM
`define RANDOM $random
`endif
`ifdef RANDOMIZE_MEM_INIT
integer initvar;
`endif
`ifndef SYNTHESIS
`ifdef FIRRTL_BEFORE_INITIAL
`FIRRTL_BEFORE_INITIAL
`endif
initial begin
`ifdef RANDOMIZE
`ifdef INIT_RANDOM
`INIT_RANDOM
`endif
`ifndef VERILATOR
`ifdef RANDOMIZE_DELAY
#`RANDOMIZE_DELAY begin end
`else
#0.002 begin end
`endif
`endif
`ifdef RANDOMIZE_REG_INIT
_RAND_0 = {1{`RANDOM}};
matReg1_0_0 = _RAND_0[15:0];
_RAND_1 = {1{`RANDOM}};
matReg1_0_1 = _RAND_1[15:0];
_RAND_2 = {1{`RANDOM}};
matReg1_1_0 = _RAND_2[15:0];
_RAND_3 = {1{`RANDOM}};
matReg1_1_1 = _RAND_3[15:0];
_RAND_4 = {1{`RANDOM}};
reg_0 = _RAND_4[0:0];
_RAND_5 = {1{`RANDOM}};
reg_1 = _RAND_5[0:0];
_RAND_6 = {1{`RANDOM}};
i = _RAND_6[0:0];
_RAND_7 = {1{`RANDOM}};
j = _RAND_7[0:0];
`endif // RANDOMIZE_REG_INIT
`endif // RANDOMIZE
end // initial
`ifdef FIRRTL_AFTER_INITIAL
`FIRRTL_AFTER_INITIAL
`endif
`endif // SYNTHESIS
endmodule
module Muxes(
input clock,
input reset,
input [15:0] io_mat1_0_0,
input [15:0] io_mat1_0_1,
input [15:0] io_mat1_1_0,
input [15:0] io_mat1_1_1,
input [15:0] io_mat2_0,
input [15:0] io_mat2_1,
input [15:0] io_counterMatrix1_0_0,
input [15:0] io_counterMatrix1_0_1,
input [15:0] io_counterMatrix1_1_0,
input [15:0] io_counterMatrix1_1_1,
input [15:0] io_counterMatrix2_0,
input [15:0] io_counterMatrix2_1,
output [3:0] io_i_mux_bus_0,
output [3:0] io_i_mux_bus_1,
output [3:0] io_i_mux_bus_2,
output [3:0] io_i_mux_bus_3,
output [15:0] io_Source_0,
output [15:0] io_Source_1,
output [15:0] io_Source_2,
output [15:0] io_Source_3,
output io_End
);
`ifdef RANDOMIZE_REG_INIT
reg [31:0] _RAND_0;
reg [31:0] _RAND_1;
reg [31:0] _RAND_2;
reg [31:0] _RAND_3;
reg [31:0] _RAND_4;
reg [31:0] _RAND_5;
reg [31:0] _RAND_6;
reg [31:0] _RAND_7;
reg [31:0] _RAND_8;
reg [31:0] _RAND_9;
reg [31:0] _RAND_10;
reg [31:0] _RAND_11;
reg [31:0] _RAND_12;
reg [31:0] _RAND_13;
reg [31:0] _RAND_14;
reg [31:0] _RAND_15;
reg [31:0] _RAND_16;
reg [31:0] _RAND_17;
reg [31:0] _RAND_18;
reg [31:0] _RAND_19;
reg [31:0] _RAND_20;
reg [31:0] _RAND_21;
reg [31:0] _RAND_22;
`endif // RANDOMIZE_REG_INIT
reg [15:0] prevStationary_matrix_0_0; // @[Muxes.scala 19:40]
reg [15:0] prevStationary_matrix_0_1; // @[Muxes.scala 19:40]
reg [15:0] prevStationary_matrix_1_0; // @[Muxes.scala 19:40]
reg [15:0] prevStationary_matrix_1_1; // @[Muxes.scala 19:40]
reg [15:0] prevStreaming_matrix_0; // @[Muxes.scala 20:39]
reg [15:0] prevStreaming_matrix_1; // @[Muxes.scala 20:39]
reg matricesAreEqual; // @[Muxes.scala 21:31]
wire _GEN_0 = io_mat1_0_0 != prevStationary_matrix_0_0 ? 1'h0 : 1'h1; // @[Muxes.scala 22:22 26:61 27:28]
wire _GEN_1 = io_mat1_0_1 != prevStationary_matrix_0_1 ? 1'h0 : _GEN_0; // @[Muxes.scala 26:61 27:28]
reg jValid; // @[Muxes.scala 36:25]
reg [31:0] i; // @[Muxes.scala 37:20]
reg [31:0] j; // @[Muxes.scala 38:20]
reg [31:0] counter; // @[Muxes.scala 39:26]
reg [3:0] mux_0; // @[Muxes.scala 40:22]
reg [3:0] mux_1; // @[Muxes.scala 40:22]
reg [3:0] mux_2; // @[Muxes.scala 40:22]
reg [3:0] mux_3; // @[Muxes.scala 40:22]
reg [3:0] src_0; // @[Muxes.scala 41:22]
reg [3:0] src_1; // @[Muxes.scala 41:22]
reg [3:0] src_2; // @[Muxes.scala 41:22]
reg [3:0] src_3; // @[Muxes.scala 41:22]
reg [3:0] dest_0; // @[Muxes.scala 42:23]
reg [3:0] dest_1; // @[Muxes.scala 42:23]
reg [3:0] dest_2; // @[Muxes.scala 42:23]
reg [3:0] dest_3; // @[Muxes.scala 42:23]
wire _GEN_132 = ~j[0]; // @[Muxes.scala 50:{26,26}]
wire [15:0] _GEN_7 = ~j[0] & i[0] ? io_mat1_0_1 : io_mat1_0_0; // @[Muxes.scala 50:{26,26}]
wire _GEN_133 = ~i[0]; // @[Muxes.scala 50:{26,26}]
wire [15:0] _GEN_8 = j[0] & ~i[0] ? io_mat1_1_0 : _GEN_7; // @[Muxes.scala 50:{26,26}]
wire [15:0] _GEN_9 = j[0] & i[0] ? io_mat1_1_1 : _GEN_8; // @[Muxes.scala 50:{26,26}]
wire [15:0] _GEN_11 = i[0] ? io_mat2_1 : io_mat2_0; // @[Muxes.scala 50:{50,50}]
wire [15:0] _GEN_13 = _GEN_132 & i[0] ? io_counterMatrix1_0_1 : io_counterMatrix1_0_0; // @[Muxes.scala 52:{38,38}]
wire [15:0] _GEN_14 = j[0] & _GEN_133 ? io_counterMatrix1_1_0 : _GEN_13; // @[Muxes.scala 52:{38,38}]
wire [15:0] _GEN_15 = j[0] & i[0] ? io_counterMatrix1_1_1 : _GEN_14; // @[Muxes.scala 52:{38,38}]
wire [15:0] _GEN_17 = i[0] ? io_counterMatrix2_1 : io_counterMatrix2_0; // @[Muxes.scala 52:{38,38}]
wire [15:0] _mux_T_2 = _GEN_17 - 16'h1; // @[Muxes.scala 53:51]
wire [15:0] _mux_T_6 = _GEN_15 - 16'h1; // @[Muxes.scala 53:85]
wire [15:0] _mux_T_8 = _mux_T_2 - _mux_T_6; // @[Muxes.scala 53:58]
wire [3:0] _GEN_24 = 2'h0 == counter[1:0] ? _mux_T_8[3:0] : mux_0; // @[Muxes.scala 40:22 53:{24,24}]
wire [3:0] _GEN_25 = 2'h1 == counter[1:0] ? _mux_T_8[3:0] : mux_1; // @[Muxes.scala 40:22 53:{24,24}]
wire [3:0] _GEN_26 = 2'h2 == counter[1:0] ? _mux_T_8[3:0] : mux_2; // @[Muxes.scala 40:22 53:{24,24}]
wire [3:0] _GEN_27 = 2'h3 == counter[1:0] ? _mux_T_8[3:0] : mux_3; // @[Muxes.scala 40:22 53:{24,24}]
wire [3:0] _GEN_28 = 2'h0 == counter[1:0] ? _GEN_11[3:0] : src_0; // @[Muxes.scala 41:22 54:{24,24}]
wire [3:0] _GEN_29 = 2'h1 == counter[1:0] ? _GEN_11[3:0] : src_1; // @[Muxes.scala 41:22 54:{24,24}]
wire [3:0] _GEN_30 = 2'h2 == counter[1:0] ? _GEN_11[3:0] : src_2; // @[Muxes.scala 41:22 54:{24,24}]
wire [3:0] _GEN_31 = 2'h3 == counter[1:0] ? _GEN_11[3:0] : src_3; // @[Muxes.scala 41:22 54:{24,24}]
wire [3:0] _GEN_34 = 2'h0 == counter[1:0] ? _GEN_9[3:0] : dest_0; // @[Muxes.scala 42:23 55:{25,25}]
wire [3:0] _GEN_35 = 2'h1 == counter[1:0] ? _GEN_9[3:0] : dest_1; // @[Muxes.scala 42:23 55:{25,25}]
wire [3:0] _GEN_36 = 2'h2 == counter[1:0] ? _GEN_9[3:0] : dest_2; // @[Muxes.scala 42:23 55:{25,25}]
wire [3:0] _GEN_37 = 2'h3 == counter[1:0] ? _GEN_9[3:0] : dest_3; // @[Muxes.scala 42:23 55:{25,25}]
wire [15:0] _mux_T_17 = _mux_T_6 - _mux_T_2; // @[Muxes.scala 57:61]
wire [3:0] _GEN_48 = 2'h0 == counter[1:0] ? _mux_T_17[3:0] : mux_0; // @[Muxes.scala 40:22 57:{24,24}]
wire [3:0] _GEN_49 = 2'h1 == counter[1:0] ? _mux_T_17[3:0] : mux_1; // @[Muxes.scala 40:22 57:{24,24}]
wire [3:0] _GEN_50 = 2'h2 == counter[1:0] ? _mux_T_17[3:0] : mux_2; // @[Muxes.scala 40:22 57:{24,24}]
wire [3:0] _GEN_51 = 2'h3 == counter[1:0] ? _mux_T_17[3:0] : mux_3; // @[Muxes.scala 40:22 57:{24,24}]
wire [3:0] _GEN_66 = _GEN_15 < _GEN_17 ? _GEN_24 : _GEN_48; // @[Muxes.scala 52:61]
wire [3:0] _GEN_67 = _GEN_15 < _GEN_17 ? _GEN_25 : _GEN_49; // @[Muxes.scala 52:61]
wire [3:0] _GEN_68 = _GEN_15 < _GEN_17 ? _GEN_26 : _GEN_50; // @[Muxes.scala 52:61]
wire [3:0] _GEN_69 = _GEN_15 < _GEN_17 ? _GEN_27 : _GEN_51; // @[Muxes.scala 52:61]
wire [3:0] _GEN_70 = _GEN_15 < _GEN_17 ? _GEN_28 : _GEN_28; // @[Muxes.scala 52:61]
wire [3:0] _GEN_71 = _GEN_15 < _GEN_17 ? _GEN_29 : _GEN_29; // @[Muxes.scala 52:61]
wire [3:0] _GEN_72 = _GEN_15 < _GEN_17 ? _GEN_30 : _GEN_30; // @[Muxes.scala 52:61]
wire [3:0] _GEN_73 = _GEN_15 < _GEN_17 ? _GEN_31 : _GEN_31; // @[Muxes.scala 52:61]
wire [3:0] _GEN_74 = _GEN_15 < _GEN_17 ? _GEN_34 : _GEN_34; // @[Muxes.scala 52:61]
wire [3:0] _GEN_75 = _GEN_15 < _GEN_17 ? _GEN_35 : _GEN_35; // @[Muxes.scala 52:61]
wire [3:0] _GEN_76 = _GEN_15 < _GEN_17 ? _GEN_36 : _GEN_36; // @[Muxes.scala 52:61]
wire [3:0] _GEN_77 = _GEN_15 < _GEN_17 ? _GEN_37 : _GEN_37; // @[Muxes.scala 52:61]
wire _T_22 = ~jValid; // @[Muxes.scala 62:15]
wire _T_23 = j == 32'h1; // @[Muxes.scala 64:22]
wire _T_24 = i == 32'h1; // @[Muxes.scala 64:56]
wire _T_25 = j == 32'h1 & i == 32'h1; // @[Muxes.scala 64:50]
wire [31:0] _counter_T_1 = counter + 32'h1; // @[Muxes.scala 65:30]
wire [31:0] _GEN_78 = ~(j == 32'h1 & i == 32'h1) ? _counter_T_1 : counter; // @[Muxes.scala 64:85 65:19 39:26]
wire [31:0] _GEN_79 = ~jValid ? _GEN_78 : counter; // @[Muxes.scala 62:24 39:26]
wire [3:0] _GEN_80 = _GEN_9 != 16'h0 & _GEN_11 != 16'h0 ? _GEN_66 : mux_0; // @[Muxes.scala 40:22 50:60]
wire [3:0] _GEN_81 = _GEN_9 != 16'h0 & _GEN_11 != 16'h0 ? _GEN_67 : mux_1; // @[Muxes.scala 40:22 50:60]
wire [3:0] _GEN_82 = _GEN_9 != 16'h0 & _GEN_11 != 16'h0 ? _GEN_68 : mux_2; // @[Muxes.scala 40:22 50:60]
wire [3:0] _GEN_83 = _GEN_9 != 16'h0 & _GEN_11 != 16'h0 ? _GEN_69 : mux_3; // @[Muxes.scala 40:22 50:60]
wire [3:0] _GEN_84 = _GEN_9 != 16'h0 & _GEN_11 != 16'h0 ? _GEN_70 : src_0; // @[Muxes.scala 41:22 50:60]
wire [3:0] _GEN_85 = _GEN_9 != 16'h0 & _GEN_11 != 16'h0 ? _GEN_71 : src_1; // @[Muxes.scala 41:22 50:60]
wire [3:0] _GEN_86 = _GEN_9 != 16'h0 & _GEN_11 != 16'h0 ? _GEN_72 : src_2; // @[Muxes.scala 41:22 50:60]
wire [3:0] _GEN_87 = _GEN_9 != 16'h0 & _GEN_11 != 16'h0 ? _GEN_73 : src_3; // @[Muxes.scala 41:22 50:60]
wire [3:0] _GEN_88 = _GEN_9 != 16'h0 & _GEN_11 != 16'h0 ? _GEN_74 : dest_0; // @[Muxes.scala 42:23 50:60]
wire [3:0] _GEN_89 = _GEN_9 != 16'h0 & _GEN_11 != 16'h0 ? _GEN_75 : dest_1; // @[Muxes.scala 42:23 50:60]
wire [3:0] _GEN_90 = _GEN_9 != 16'h0 & _GEN_11 != 16'h0 ? _GEN_76 : dest_2; // @[Muxes.scala 42:23 50:60]
wire [3:0] _GEN_91 = _GEN_9 != 16'h0 & _GEN_11 != 16'h0 ? _GEN_77 : dest_3; // @[Muxes.scala 42:23 50:60]
wire [31:0] _GEN_92 = _GEN_9 != 16'h0 & _GEN_11 != 16'h0 ? _GEN_79 : counter; // @[Muxes.scala 39:26 50:60]
wire [31:0] _j_T_1 = j + 32'h1; // @[Muxes.scala 75:16]
wire [31:0] _i_T_1 = i + 32'h1; // @[Muxes.scala 81:18]
wire [31:0] _GEN_93 = i < 32'h1 ? _i_T_1 : i; // @[Muxes.scala 80:42 81:13 37:20]
wire _GEN_94 = _T_25 | jValid; // @[Muxes.scala 76:83 77:16 36:25]
assign io_i_mux_bus_0 = mux_0; // @[Muxes.scala 43:18]
assign io_i_mux_bus_1 = mux_1; // @[Muxes.scala 43:18]
assign io_i_mux_bus_2 = mux_2; // @[Muxes.scala 43:18]
assign io_i_mux_bus_3 = mux_3; // @[Muxes.scala 43:18]
assign io_Source_0 = {{12'd0}, src_0}; // @[Muxes.scala 44:15]
assign io_Source_1 = {{12'd0}, src_1}; // @[Muxes.scala 44:15]
assign io_Source_2 = {{12'd0}, src_2}; // @[Muxes.scala 44:15]
assign io_Source_3 = {{12'd0}, src_3}; // @[Muxes.scala 44:15]
assign io_End = ~(_T_24 & _T_23); // @[Muxes.scala 99:15]
always @(posedge clock) begin
prevStationary_matrix_0_0 <= io_mat1_0_0; // @[Muxes.scala 19:40]
prevStationary_matrix_0_1 <= io_mat1_0_1; // @[Muxes.scala 19:40]
prevStationary_matrix_1_0 <= io_mat1_1_0; // @[Muxes.scala 19:40]
prevStationary_matrix_1_1 <= io_mat1_1_1; // @[Muxes.scala 19:40]
prevStreaming_matrix_0 <= io_mat2_0; // @[Muxes.scala 20:39]
prevStreaming_matrix_1 <= io_mat2_1; // @[Muxes.scala 20:39]
if (io_mat2_1 != prevStreaming_matrix_1) begin // @[Muxes.scala 30:51]
matricesAreEqual <= 1'h0; // @[Muxes.scala 31:26]
end else if (io_mat1_1_1 != prevStationary_matrix_1_1) begin // @[Muxes.scala 26:61]
matricesAreEqual <= 1'h0; // @[Muxes.scala 27:28]
end else if (io_mat1_1_0 != prevStationary_matrix_1_0) begin // @[Muxes.scala 26:61]
matricesAreEqual <= 1'h0; // @[Muxes.scala 27:28]
end else if (io_mat2_0 != prevStreaming_matrix_0) begin // @[Muxes.scala 30:51]
matricesAreEqual <= 1'h0; // @[Muxes.scala 31:26]
end else begin
matricesAreEqual <= _GEN_1;
end
if (reset) begin // @[Muxes.scala 36:25]
jValid <= 1'h0; // @[Muxes.scala 36:25]
end else if (_T_22) begin // @[Muxes.scala 72:29]
if (!(j < 32'h1)) begin // @[Muxes.scala 74:40]
jValid <= _GEN_94;
end
end else if (jValid & ~matricesAreEqual) begin // @[Muxes.scala 85:64]
jValid <= 1'h0; // @[Muxes.scala 89:14]
end
if (reset) begin // @[Muxes.scala 37:20]
i <= 32'h0; // @[Muxes.scala 37:20]
end else if (_T_22) begin // @[Muxes.scala 72:29]
if (!(j < 32'h1)) begin // @[Muxes.scala 74:40]
if (!(_T_25)) begin // @[Muxes.scala 76:83]
i <= _GEN_93;
end
end
end else if (jValid & ~matricesAreEqual) begin // @[Muxes.scala 85:64]
i <= 32'h0; // @[Muxes.scala 87:9]
end
if (reset) begin // @[Muxes.scala 38:20]
j <= 32'h0; // @[Muxes.scala 38:20]
end else if (_T_22) begin // @[Muxes.scala 72:29]
if (j < 32'h1) begin // @[Muxes.scala 74:40]
j <= _j_T_1; // @[Muxes.scala 75:11]
end else if (!(_T_25)) begin // @[Muxes.scala 76:83]
j <= 32'h0; // @[Muxes.scala 79:11]
end
end else if (jValid & ~matricesAreEqual) begin // @[Muxes.scala 85:64]
j <= 32'h0; // @[Muxes.scala 88:9]
end
if (reset) begin // @[Muxes.scala 39:26]
counter <= 32'h0; // @[Muxes.scala 39:26]
end else if (_T_22) begin // @[Muxes.scala 72:29]
counter <= _GEN_92;
end else if (jValid & ~matricesAreEqual) begin // @[Muxes.scala 85:64]
counter <= 32'h0; // @[Muxes.scala 90:15]
end else begin
counter <= _GEN_92;
end
if (reset) begin // @[Muxes.scala 40:22]
mux_0 <= 4'h0; // @[Muxes.scala 40:22]
end else if (_T_22) begin // @[Muxes.scala 72:29]
mux_0 <= _GEN_80;
end else if (jValid & ~matricesAreEqual) begin // @[Muxes.scala 85:64]
mux_0 <= 4'h0; // @[Muxes.scala 95:16]
end else begin
mux_0 <= _GEN_80;
end
if (reset) begin // @[Muxes.scala 40:22]
mux_1 <= 4'h0; // @[Muxes.scala 40:22]
end else if (_T_22) begin // @[Muxes.scala 72:29]
mux_1 <= _GEN_81;
end else if (jValid & ~matricesAreEqual) begin // @[Muxes.scala 85:64]
mux_1 <= 4'h0; // @[Muxes.scala 95:16]
end else begin
mux_1 <= _GEN_81;
end
if (reset) begin // @[Muxes.scala 40:22]
mux_2 <= 4'h0; // @[Muxes.scala 40:22]
end else if (_T_22) begin // @[Muxes.scala 72:29]
mux_2 <= _GEN_82;
end else if (jValid & ~matricesAreEqual) begin // @[Muxes.scala 85:64]
mux_2 <= 4'h0; // @[Muxes.scala 95:16]
end else begin
mux_2 <= _GEN_82;
end
if (reset) begin // @[Muxes.scala 40:22]
mux_3 <= 4'h0; // @[Muxes.scala 40:22]
end else if (_T_22) begin // @[Muxes.scala 72:29]
mux_3 <= _GEN_83;
end else if (jValid & ~matricesAreEqual) begin // @[Muxes.scala 85:64]
mux_3 <= 4'h0; // @[Muxes.scala 95:16]
end else begin
mux_3 <= _GEN_83;
end
if (reset) begin // @[Muxes.scala 41:22]
src_0 <= 4'h0; // @[Muxes.scala 41:22]
end else if (_T_22) begin // @[Muxes.scala 72:29]
src_0 <= _GEN_84;
end else if (jValid & ~matricesAreEqual) begin // @[Muxes.scala 85:64]
src_0 <= 4'h0; // @[Muxes.scala 93:16]
end else begin
src_0 <= _GEN_84;
end
if (reset) begin // @[Muxes.scala 41:22]
src_1 <= 4'h0; // @[Muxes.scala 41:22]
end else if (_T_22) begin // @[Muxes.scala 72:29]
src_1 <= _GEN_85;
end else if (jValid & ~matricesAreEqual) begin // @[Muxes.scala 85:64]
src_1 <= 4'h0; // @[Muxes.scala 93:16]
end else begin
src_1 <= _GEN_85;
end
if (reset) begin // @[Muxes.scala 41:22]
src_2 <= 4'h0; // @[Muxes.scala 41:22]
end else if (_T_22) begin // @[Muxes.scala 72:29]
src_2 <= _GEN_86;
end else if (jValid & ~matricesAreEqual) begin // @[Muxes.scala 85:64]
src_2 <= 4'h0; // @[Muxes.scala 93:16]
end else begin
src_2 <= _GEN_86;
end
if (reset) begin // @[Muxes.scala 41:22]
src_3 <= 4'h0; // @[Muxes.scala 41:22]
end else if (_T_22) begin // @[Muxes.scala 72:29]
src_3 <= _GEN_87;
end else if (jValid & ~matricesAreEqual) begin // @[Muxes.scala 85:64]
src_3 <= 4'h0; // @[Muxes.scala 93:16]
end else begin
src_3 <= _GEN_87;
end
if (reset) begin // @[Muxes.scala 42:23]
dest_0 <= 4'h0; // @[Muxes.scala 42:23]
end else if (_T_22) begin // @[Muxes.scala 72:29]
dest_0 <= _GEN_88;
end else if (jValid & ~matricesAreEqual) begin // @[Muxes.scala 85:64]
dest_0 <= 4'h0; // @[Muxes.scala 94:17]
end else begin
dest_0 <= _GEN_88;
end
if (reset) begin // @[Muxes.scala 42:23]
dest_1 <= 4'h0; // @[Muxes.scala 42:23]
end else if (_T_22) begin // @[Muxes.scala 72:29]
dest_1 <= _GEN_89;
end else if (jValid & ~matricesAreEqual) begin // @[Muxes.scala 85:64]
dest_1 <= 4'h0; // @[Muxes.scala 94:17]
end else begin
dest_1 <= _GEN_89;
end
if (reset) begin // @[Muxes.scala 42:23]
dest_2 <= 4'h0; // @[Muxes.scala 42:23]
end else if (_T_22) begin // @[Muxes.scala 72:29]
dest_2 <= _GEN_90;
end else if (jValid & ~matricesAreEqual) begin // @[Muxes.scala 85:64]
dest_2 <= 4'h0; // @[Muxes.scala 94:17]
end else begin
dest_2 <= _GEN_90;
end
if (reset) begin // @[Muxes.scala 42:23]
dest_3 <= 4'h0; // @[Muxes.scala 42:23]
end else if (_T_22) begin // @[Muxes.scala 72:29]
dest_3 <= _GEN_91;
end else if (jValid & ~matricesAreEqual) begin // @[Muxes.scala 85:64]
dest_3 <= 4'h0; // @[Muxes.scala 94:17]
end else begin
dest_3 <= _GEN_91;
end
end
// Register and memory initialization
`ifdef RANDOMIZE_GARBAGE_ASSIGN
`define RANDOMIZE
`endif
`ifdef RANDOMIZE_INVALID_ASSIGN
`define RANDOMIZE
`endif
`ifdef RANDOMIZE_REG_INIT
`define RANDOMIZE
`endif
`ifdef RANDOMIZE_MEM_INIT
`define RANDOMIZE
`endif
`ifndef RANDOM
`define RANDOM $random
`endif
`ifdef RANDOMIZE_MEM_INIT
integer initvar;
`endif
`ifndef SYNTHESIS
`ifdef FIRRTL_BEFORE_INITIAL
`FIRRTL_BEFORE_INITIAL
`endif
initial begin
`ifdef RANDOMIZE
`ifdef INIT_RANDOM
`INIT_RANDOM
`endif
`ifndef VERILATOR
`ifdef RANDOMIZE_DELAY
#`RANDOMIZE_DELAY begin end
`else
#0.002 begin end
`endif
`endif
`ifdef RANDOMIZE_REG_INIT
_RAND_0 = {1{`RANDOM}};
prevStationary_matrix_0_0 = _RAND_0[15:0];
_RAND_1 = {1{`RANDOM}};
prevStationary_matrix_0_1 = _RAND_1[15:0];
_RAND_2 = {1{`RANDOM}};
prevStationary_matrix_1_0 = _RAND_2[15:0];
_RAND_3 = {1{`RANDOM}};
prevStationary_matrix_1_1 = _RAND_3[15:0];
_RAND_4 = {1{`RANDOM}};
prevStreaming_matrix_0 = _RAND_4[15:0];
_RAND_5 = {1{`RANDOM}};
prevStreaming_matrix_1 = _RAND_5[15:0];
_RAND_6 = {1{`RANDOM}};
matricesAreEqual = _RAND_6[0:0];
_RAND_7 = {1{`RANDOM}};
jValid = _RAND_7[0:0];
_RAND_8 = {1{`RANDOM}};
i = _RAND_8[31:0];
_RAND_9 = {1{`RANDOM}};
j = _RAND_9[31:0];
_RAND_10 = {1{`RANDOM}};
counter = _RAND_10[31:0];
_RAND_11 = {1{`RANDOM}};
mux_0 = _RAND_11[3:0];
_RAND_12 = {1{`RANDOM}};
mux_1 = _RAND_12[3:0];
_RAND_13 = {1{`RANDOM}};
mux_2 = _RAND_13[3:0];
_RAND_14 = {1{`RANDOM}};
mux_3 = _RAND_14[3:0];
_RAND_15 = {1{`RANDOM}};
src_0 = _RAND_15[3:0];
_RAND_16 = {1{`RANDOM}};
src_1 = _RAND_16[3:0];
_RAND_17 = {1{`RANDOM}};
src_2 = _RAND_17[3:0];
_RAND_18 = {1{`RANDOM}};
src_3 = _RAND_18[3:0];
_RAND_19 = {1{`RANDOM}};
dest_0 = _RAND_19[3:0];
_RAND_20 = {1{`RANDOM}};
dest_1 = _RAND_20[3:0];
_RAND_21 = {1{`RANDOM}};
dest_2 = _RAND_21[3:0];
_RAND_22 = {1{`RANDOM}};
dest_3 = _RAND_22[3:0];
`endif // RANDOMIZE_REG_INIT
`endif // RANDOMIZE
end // initial
`ifdef FIRRTL_AFTER_INITIAL
`FIRRTL_AFTER_INITIAL
`endif
`endif // SYNTHESIS
endmodule
module SourceDestination(
input clock,
input reset,
input [15:0] io_Stationary_matrix_0_0,
input [15:0] io_Stationary_matrix_0_1,
input [15:0] io_Stationary_matrix_1_0,
input [15:0] io_Stationary_matrix_1_1,
input [15:0] io_Streaming_matrix_0,
input [15:0] io_Streaming_matrix_1,
output io_counterMatrix1_valid,
output [15:0] io_counterMatrix1_bits_0_0,
output [15:0] io_counterMatrix1_bits_0_1,
output [15:0] io_counterMatrix1_bits_1_0,
output [15:0] io_counterMatrix1_bits_1_1,
output io_counterMatrix2_valid,
output [15:0] io_counterMatrix2_bits_0,
output [15:0] io_counterMatrix2_bits_1
);
`ifdef RANDOMIZE_REG_INIT
reg [31:0] _RAND_0;
reg [31:0] _RAND_1;
reg [31:0] _RAND_2;
reg [31:0] _RAND_3;
reg [31:0] _RAND_4;
reg [31:0] _RAND_5;
reg [31:0] _RAND_6;
reg [31:0] _RAND_7;
reg [31:0] _RAND_8;
reg [31:0] _RAND_9;
reg [31:0] _RAND_10;
reg [31:0] _RAND_11;
reg [31:0] _RAND_12;
reg [31:0] _RAND_13;
reg [31:0] _RAND_14;
reg [31:0] _RAND_15;
reg [31:0] _RAND_16;
reg [31:0] _RAND_17;
`endif // RANDOMIZE_REG_INIT
reg [15:0] prevStationary_matrix_0_0; // @[SourceDestination.scala 15:40]
reg [15:0] prevStationary_matrix_0_1; // @[SourceDestination.scala 15:40]
reg [15:0] prevStationary_matrix_1_0; // @[SourceDestination.scala 15:40]
reg [15:0] prevStationary_matrix_1_1; // @[SourceDestination.scala 15:40]
reg matricesAreEqual; // @[SourceDestination.scala 16:31]
reg [15:0] counterRegs1_0_0; // @[SourceDestination.scala 29:31]
reg [15:0] counterRegs1_0_1; // @[SourceDestination.scala 29:31]
reg [15:0] counterRegs1_1_0; // @[SourceDestination.scala 29:31]
reg [15:0] counterRegs1_1_1; // @[SourceDestination.scala 29:31]
reg [15:0] counterRegs2_0; // @[SourceDestination.scala 30:31]
reg [15:0] counterRegs2_1; // @[SourceDestination.scala 30:31]
reg [31:0] i; // @[SourceDestination.scala 32:20]
reg [31:0] j; // @[SourceDestination.scala 33:20]
reg jValid; // @[SourceDestination.scala 36:21]
reg kvalid; // @[SourceDestination.scala 38:21]
reg [31:0] k; // @[SourceDestination.scala 39:20]
reg [31:0] counter1; // @[SourceDestination.scala 41:27]
reg [31:0] counter2; // @[SourceDestination.scala 42:27]
wire _GEN_77 = ~i[0]; // @[SourceDestination.scala 45:{38,38}]
wire [15:0] _GEN_5 = ~i[0] & j[0] ? io_Stationary_matrix_0_1 : io_Stationary_matrix_0_0; // @[SourceDestination.scala 45:{38,38}]
wire _GEN_78 = ~j[0]; // @[SourceDestination.scala 45:{38,38}]
wire [15:0] _GEN_6 = i[0] & ~j[0] ? io_Stationary_matrix_1_0 : _GEN_5; // @[SourceDestination.scala 45:{38,38}]
wire [15:0] _GEN_7 = i[0] & j[0] ? io_Stationary_matrix_1_1 : _GEN_6; // @[SourceDestination.scala 45:{38,38}]
wire [15:0] _GEN_8 = _GEN_77 & _GEN_78 ? counter1[15:0] : counterRegs1_0_0; // @[SourceDestination.scala 47:{28,28} 29:31]
wire [15:0] _GEN_9 = _GEN_77 & j[0] ? counter1[15:0] : counterRegs1_0_1; // @[SourceDestination.scala 47:{28,28} 29:31]
wire [15:0] _GEN_10 = i[0] & _GEN_78 ? counter1[15:0] : counterRegs1_1_0; // @[SourceDestination.scala 47:{28,28} 29:31]
wire [15:0] _GEN_11 = i[0] & j[0] ? counter1[15:0] : counterRegs1_1_1; // @[SourceDestination.scala 47:{28,28} 29:31]
wire _T_10 = j == 32'h1; // @[SourceDestination.scala 48:20]
wire _T_11 = i == 32'h1; // @[SourceDestination.scala 48:54]
wire _T_12 = j == 32'h1 & i == 32'h1; // @[SourceDestination.scala 48:48]
wire _T_13 = ~(j == 32'h1 & i == 32'h1); // @[SourceDestination.scala 48:15]
wire [31:0] _counter1_T_1 = counter1 + 32'h1; // @[SourceDestination.scala 49:32]
wire [31:0] _GEN_12 = ~(j == 32'h1 & i == 32'h1) ? _counter1_T_1 : counter1; // @[SourceDestination.scala 48:83 49:20 41:27]
wire [15:0] _GEN_13 = _GEN_77 & _GEN_78 ? 16'h1 : counterRegs1_0_0; // @[SourceDestination.scala 52:{28,28} 29:31]
wire [15:0] _GEN_14 = _GEN_77 & j[0] ? 16'h1 : counterRegs1_0_1; // @[SourceDestination.scala 52:{28,28} 29:31]
wire [15:0] _GEN_15 = i[0] & _GEN_78 ? 16'h1 : counterRegs1_1_0; // @[SourceDestination.scala 52:{28,28} 29:31]
wire [15:0] _GEN_16 = i[0] & j[0] ? 16'h1 : counterRegs1_1_1; // @[SourceDestination.scala 52:{28,28} 29:31]
wire [15:0] _GEN_17 = counter1 < 32'h5 ? _GEN_8 : _GEN_13; // @[SourceDestination.scala 46:48]
wire [15:0] _GEN_18 = counter1 < 32'h5 ? _GEN_9 : _GEN_14; // @[SourceDestination.scala 46:48]
wire [15:0] _GEN_19 = counter1 < 32'h5 ? _GEN_10 : _GEN_15; // @[SourceDestination.scala 46:48]
wire [15:0] _GEN_20 = counter1 < 32'h5 ? _GEN_11 : _GEN_16; // @[SourceDestination.scala 46:48]
wire [31:0] _GEN_21 = counter1 < 32'h5 ? _GEN_12 : 32'h2; // @[SourceDestination.scala 46:48 53:18]
wire [15:0] _GEN_22 = _GEN_77 & _GEN_78 ? 16'h0 : counterRegs1_0_0; // @[SourceDestination.scala 56:{26,26} 29:31]
wire [15:0] _GEN_23 = _GEN_77 & j[0] ? 16'h0 : counterRegs1_0_1; // @[SourceDestination.scala 56:{26,26} 29:31]
wire [15:0] _GEN_24 = i[0] & _GEN_78 ? 16'h0 : counterRegs1_1_0; // @[SourceDestination.scala 56:{26,26} 29:31]
wire [15:0] _GEN_25 = i[0] & j[0] ? 16'h0 : counterRegs1_1_1; // @[SourceDestination.scala 56:{26,26} 29:31]
wire [15:0] _GEN_26 = _GEN_7 != 16'h0 ? _GEN_17 : _GEN_22; // @[SourceDestination.scala 45:47]
wire [15:0] _GEN_27 = _GEN_7 != 16'h0 ? _GEN_18 : _GEN_23; // @[SourceDestination.scala 45:47]
wire [15:0] _GEN_28 = _GEN_7 != 16'h0 ? _GEN_19 : _GEN_24; // @[SourceDestination.scala 45:47]
wire [15:0] _GEN_29 = _GEN_7 != 16'h0 ? _GEN_20 : _GEN_25; // @[SourceDestination.scala 45:47]
wire [31:0] _GEN_30 = _GEN_7 != 16'h0 ? _GEN_21 : counter1; // @[SourceDestination.scala 41:27 45:47]
wire [15:0] _GEN_32 = k[0] ? io_Streaming_matrix_1 : io_Streaming_matrix_0; // @[SourceDestination.scala 59:{34,34}]
wire [15:0] _GEN_33 = ~k[0] ? counter1[15:0] : counterRegs2_0; // @[SourceDestination.scala 61:{25,25} 30:31]
wire [15:0] _GEN_34 = k[0] ? counter1[15:0] : counterRegs2_1; // @[SourceDestination.scala 61:{25,25} 30:31]
wire [31:0] _counter2_T_1 = counter2 + 32'h1; // @[SourceDestination.scala 63:32]
wire [31:0] _GEN_35 = _T_13 ? _counter2_T_1 : counter2; // @[SourceDestination.scala 62:83 63:20 42:27]
wire [15:0] _GEN_36 = counter2 < 32'h5 ? _GEN_33 : counterRegs2_0; // @[SourceDestination.scala 30:31 60:48]
wire [15:0] _GEN_37 = counter2 < 32'h5 ? _GEN_34 : counterRegs2_1; // @[SourceDestination.scala 30:31 60:48]
wire [31:0] _GEN_38 = counter2 < 32'h5 ? _GEN_35 : counter2; // @[SourceDestination.scala 42:27 60:48]
wire [15:0] _GEN_39 = _GEN_32 != 16'h0 ? _GEN_36 : counterRegs2_0; // @[SourceDestination.scala 30:31 59:43]
wire [15:0] _GEN_40 = _GEN_32 != 16'h0 ? _GEN_37 : counterRegs2_1; // @[SourceDestination.scala 30:31 59:43]
wire [31:0] _GEN_41 = _GEN_32 != 16'h0 ? _GEN_38 : counter2; // @[SourceDestination.scala 42:27 59:43]
wire [31:0] _k_T_1 = k + 32'h1; // @[SourceDestination.scala 79:14]
wire _GEN_42 = ~kvalid ? 1'h0 : kvalid; // @[SourceDestination.scala 77:47 78:14 38:21]
wire [31:0] _GEN_43 = ~kvalid ? _k_T_1 : k; // @[SourceDestination.scala 39:20 77:47 79:9]
wire [31:0] _GEN_45 = k == 32'h1 ? k : _GEN_43; // @[SourceDestination.scala 39:20 75:39]
wire [31:0] _j_T_1 = j + 32'h1; // @[SourceDestination.scala 84:16]
wire [31:0] _i_T_1 = i + 32'h1; // @[SourceDestination.scala 90:18]
wire [31:0] _GEN_46 = i < 32'h1 ? _i_T_1 : i; // @[SourceDestination.scala 89:42 90:13 32:20]
wire _GEN_51 = j < 32'h1 ? 1'h0 : _T_12; // @[SourceDestination.scala 37:12 83:40]
assign io_counterMatrix1_valid = _T_10 & _T_11; // @[SourceDestination.scala 109:42]
assign io_counterMatrix1_bits_0_0 = counterRegs1_0_0; // @[SourceDestination.scala 117:28]
assign io_counterMatrix1_bits_0_1 = counterRegs1_0_1; // @[SourceDestination.scala 117:28]
assign io_counterMatrix1_bits_1_0 = counterRegs1_1_0; // @[SourceDestination.scala 117:28]
assign io_counterMatrix1_bits_1_1 = counterRegs1_1_1; // @[SourceDestination.scala 117:28]
assign io_counterMatrix2_valid = _T_10 & _T_11; // @[SourceDestination.scala 109:42]
assign io_counterMatrix2_bits_0 = counterRegs2_0; // @[SourceDestination.scala 118:28]
assign io_counterMatrix2_bits_1 = counterRegs2_1; // @[SourceDestination.scala 118:28]
always @(posedge clock) begin
prevStationary_matrix_0_0 <= io_Stationary_matrix_0_0; // @[SourceDestination.scala 15:40]
prevStationary_matrix_0_1 <= io_Stationary_matrix_0_1; // @[SourceDestination.scala 15:40]
prevStationary_matrix_1_0 <= io_Stationary_matrix_1_0; // @[SourceDestination.scala 15:40]
prevStationary_matrix_1_1 <= io_Stationary_matrix_1_1; // @[SourceDestination.scala 15:40]
if (io_Stationary_matrix_1_1 != prevStationary_matrix_1_1) begin // @[SourceDestination.scala 21:74]
matricesAreEqual <= 1'h0; // @[SourceDestination.scala 22:28]
end else if (io_Stationary_matrix_1_0 != prevStationary_matrix_1_0) begin // @[SourceDestination.scala 21:74]
matricesAreEqual <= 1'h0; // @[SourceDestination.scala 22:28]
end else if (io_Stationary_matrix_0_1 != prevStationary_matrix_0_1) begin // @[SourceDestination.scala 21:74]
matricesAreEqual <= 1'h0; // @[SourceDestination.scala 22:28]
end else if (io_Stationary_matrix_0_0 != prevStationary_matrix_0_0) begin // @[SourceDestination.scala 21:74]
matricesAreEqual <= 1'h0; // @[SourceDestination.scala 22:28]
end else begin
matricesAreEqual <= 1'h1; // @[SourceDestination.scala 17:22]
end
if (reset) begin // @[SourceDestination.scala 29:31]
counterRegs1_0_0 <= 16'h0; // @[SourceDestination.scala 29:31]
end else if (~jValid) begin // @[SourceDestination.scala 82:26]
counterRegs1_0_0 <= _GEN_26;
end else if (jValid & ~matricesAreEqual) begin // @[SourceDestination.scala 93:64]
counterRegs1_0_0 <= 16'h0; // @[SourceDestination.scala 101:30]
end else begin
counterRegs1_0_0 <= _GEN_26;
end
if (reset) begin // @[SourceDestination.scala 29:31]
counterRegs1_0_1 <= 16'h0; // @[SourceDestination.scala 29:31]
end else if (~jValid) begin // @[SourceDestination.scala 82:26]
counterRegs1_0_1 <= _GEN_27;
end else if (jValid & ~matricesAreEqual) begin // @[SourceDestination.scala 93:64]
counterRegs1_0_1 <= 16'h0; // @[SourceDestination.scala 101:30]
end else begin
counterRegs1_0_1 <= _GEN_27;
end
if (reset) begin // @[SourceDestination.scala 29:31]
counterRegs1_1_0 <= 16'h0; // @[SourceDestination.scala 29:31]
end else if (~jValid) begin // @[SourceDestination.scala 82:26]
counterRegs1_1_0 <= _GEN_28;
end else if (jValid & ~matricesAreEqual) begin // @[SourceDestination.scala 93:64]
counterRegs1_1_0 <= 16'h0; // @[SourceDestination.scala 101:30]
end else begin
counterRegs1_1_0 <= _GEN_28;
end
if (reset) begin // @[SourceDestination.scala 29:31]
counterRegs1_1_1 <= 16'h0; // @[SourceDestination.scala 29:31]
end else if (~jValid) begin // @[SourceDestination.scala 82:26]
counterRegs1_1_1 <= _GEN_29;
end else if (jValid & ~matricesAreEqual) begin // @[SourceDestination.scala 93:64]
counterRegs1_1_1 <= 16'h0; // @[SourceDestination.scala 101:30]
end else begin
counterRegs1_1_1 <= _GEN_29;
end
if (reset) begin // @[SourceDestination.scala 30:31]
counterRegs2_0 <= 16'h0; // @[SourceDestination.scala 30:31]
end else if (~jValid) begin // @[SourceDestination.scala 82:26]
counterRegs2_0 <= _GEN_39;
end else if (jValid & ~matricesAreEqual) begin // @[SourceDestination.scala 93:64]
counterRegs2_0 <= 16'h0; // @[SourceDestination.scala 103:25]
end else begin
counterRegs2_0 <= _GEN_39;
end
if (reset) begin // @[SourceDestination.scala 30:31]
counterRegs2_1 <= 16'h0; // @[SourceDestination.scala 30:31]
end else if (~jValid) begin // @[SourceDestination.scala 82:26]
counterRegs2_1 <= _GEN_40;
end else if (jValid & ~matricesAreEqual) begin // @[SourceDestination.scala 93:64]
counterRegs2_1 <= 16'h0; // @[SourceDestination.scala 103:25]
end else begin
counterRegs2_1 <= _GEN_40;
end
if (reset) begin // @[SourceDestination.scala 32:20]
i <= 32'h0; // @[SourceDestination.scala 32:20]
end else if (~jValid) begin // @[SourceDestination.scala 82:26]
if (!(j < 32'h1)) begin // @[SourceDestination.scala 83:40]
if (!(_T_12)) begin // @[SourceDestination.scala 85:83]
i <= _GEN_46;
end
end
end else if (jValid & ~matricesAreEqual) begin // @[SourceDestination.scala 93:64]
i <= 32'h0; // @[SourceDestination.scala 94:9]
end
if (reset) begin // @[SourceDestination.scala 33:20]
j <= 32'h0; // @[SourceDestination.scala 33:20]
end else if (~jValid) begin // @[SourceDestination.scala 82:26]
if (j < 32'h1) begin // @[SourceDestination.scala 83:40]
j <= _j_T_1; // @[SourceDestination.scala 84:11]
end else if (!(_T_12)) begin // @[SourceDestination.scala 85:83]
j <= 32'h0; // @[SourceDestination.scala 88:11]
end
end else if (jValid & ~matricesAreEqual) begin // @[SourceDestination.scala 93:64]
j <= 32'h0; // @[SourceDestination.scala 95:9]
end
jValid <= ~jValid & _GEN_51; // @[SourceDestination.scala 37:12 82:26]
kvalid <= k == 32'h1 | _GEN_42; // @[SourceDestination.scala 75:39 76:16]
if (reset) begin // @[SourceDestination.scala 39:20]
k <= 32'h0; // @[SourceDestination.scala 39:20]
end else if (~jValid) begin // @[SourceDestination.scala 82:26]
k <= _GEN_45;
end else if (jValid & ~matricesAreEqual) begin // @[SourceDestination.scala 93:64]
k <= 32'h0; // @[SourceDestination.scala 96:9]
end else begin
k <= _GEN_45;
end
if (reset) begin // @[SourceDestination.scala 41:27]
counter1 <= 32'h1; // @[SourceDestination.scala 41:27]
end else if (~jValid) begin // @[SourceDestination.scala 82:26]
counter1 <= _GEN_30;
end else if (jValid & ~matricesAreEqual) begin // @[SourceDestination.scala 93:64]
counter1 <= 32'h1; // @[SourceDestination.scala 97:16]
end else begin
counter1 <= _GEN_30;
end
if (reset) begin // @[SourceDestination.scala 42:27]
counter2 <= 32'h1; // @[SourceDestination.scala 42:27]
end else if (~jValid) begin // @[SourceDestination.scala 82:26]
counter2 <= _GEN_41;
end else if (jValid & ~matricesAreEqual) begin // @[SourceDestination.scala 93:64]
counter2 <= 32'h1; // @[SourceDestination.scala 98:16]
end else begin
counter2 <= _GEN_41;
end
end
// Register and memory initialization
`ifdef RANDOMIZE_GARBAGE_ASSIGN
`define RANDOMIZE
`endif
`ifdef RANDOMIZE_INVALID_ASSIGN