-
Notifications
You must be signed in to change notification settings - Fork 0
/
LDPCg5p16codecv8f.v
4671 lines (4509 loc) · 313 KB
/
LDPCg5p16codecv8f.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 LDPCg5p16codec(
RESET_N,CLK,
start_encode,
data_in_tx,
data_in,
start_ldpc,start_Ldata,
maxiter,
encode_fin,
parity_r,
hb_count,
addr_count,
hardbit,
enga_en,dec_fin,dec_fail,hb_vlid,
ch_counta,ch_countb);
input RESET_N,CLK;
input start_encode,start_ldpc,start_Ldata;
input [4:0] maxiter;
input [15:0] data_in_tx;
input [47:0] data_in;
output [3:0] hb_count;
output [3:0] addr_count;
output [15:0] hardbit,parity_r;
output encode_fin,enga_en,dec_fin,dec_fail,hb_vlid;
output [12:0] ch_counta,ch_countb;
wire encode_fin;
wire [15:0] parity_r;
wire [3:0] hb_count;
wire [3:0] addr_count;
wire [15:0] hardbit;
wire enga_en,dec_fin,dec_fail,hb_vlid;
wire [12:0] ch_counta,ch_countb;
LDPC_enc LDPC_enc(
.RESET_N(RESET_N),.CLK(CLK),
.start_encode(start_encode),
.data_in(data_in_tx),
.encode_fin(encode_fin),
.parity_r(parity_r) );
wire [47:0] chdata=data_in;
LDPCDECg5p16v8 LDPCDECg5p16v8(
.CLK(CLK),.RESET_N(RESET_N),.start_ldpc(start_ldpc),.start_Ldata(start_Ldata),
.maxiter(maxiter),
.chdata(chdata),
.hb_count(hb_count),
.hardbit(hardbit),
.enga_en(enga_en),.dec_fin(dec_fin),.dec_fail(dec_fail),.hb_vlid(hb_vlid),
.ch_counta(ch_counta),.ch_countb(ch_countb),.addr_count(addr_count));
endmodule
module LDPC_enc(
RESET_N,CLK,
start_encode,
data_in,
encode_fin,
parity_r
);
input RESET_N,CLK;
input start_encode;
input [15:0] data_in;
output encode_fin;
output [15:0] parity_r;
parameter cir_lt1 =256'b0100100110110111001110101100001010010101100000111111111011010001111101111001001100110101110110100000001011000000111110100000001111010010100011010001010101111110101111101011000001110011000001001000010100011110100111011000001001001100101000101000110010000110;
parameter cir_lt2 =256'b0001001010000010111111001000011100010000011011000010011101010010110001011111010011100010111011011010111001011010101111100110110101101110001011000111011111101010111111011101100000100010100001001101011000011010101110110000010110010001010100101000111011101000;
parameter cir_lt3 =256'b0110000001101101111111110001100001101000110111110011110110000100100011100000000101000111101011000001110001001110111111011111010011111010101110110011100101001011101111100101000010110101111011001100000111101001001001000001110100001000011001111110000000101110;
parameter cir_lt4 =256'b1011101101011000001110010101110111101101001100001110010000000111101111000110011010010000100110111011000011010100101110011001101001000110000110100101101111011111111111010011100011100100011011001001001011101101000000101001101011010101100101111110001001000000;
parameter cir_lt5 =256'b0011001001101101011101001111100110111011001000000101010110010010011111011110110000001111111101010101001111011001101011010010010001001000100111011110110100101011110101011100010111010000110001101011000111110100000111011010010010111111000000110000110000010000;
parameter cir_lt6 =256'b0010010111101101001010110001101111001000011100111001100001011100110000101100011101001111000101011111001001011010100101001000111010011111111000110111100100000000100100000001101101101110101001101101110101001111100011101100000110100100101110101100110000011010;
parameter cir_lt7 =256'b1001111110101000110100100110111100100000101110000110111101101111000101100110010000001100110011000100100001101010110111100101110100001111100110011000001100101011110010011001001011100101100010001100111010000100001000011000101110001001111001101111101111001000;
parameter cir_lt8 =256'b0000100000101000100011011000110101010011111010111010001010100001101010010100111101001100001011001110100111101001111001111111011111011000111001110001011100000000100011000100110001011011111010001010001000111111101100101110111010010010010111110011101111000010;
parameter cir_lt9 =256'b0111110011111011011001111111010100001110101110110111100111011000100000011001001100010010010111110111110110101010111101001001111000000111101100011101111000011000100010100111101000001111100100011101110111110001101101010111101010100100010111110100111000101010;
parameter cir_lt10 =256'b1011001101110111010011011110101110101000101101100101101000111000110001101101001011011101111110011011000111100110001010001111001110111110010011110110000001101101011101110010001011100001110010101010011110000000101100001101100010101010110110001011110011111000;
parameter cir_lt11 =256'b0010001100000000000010111111001110100110001001101011101101001111100100001011011110110000101000101011101100000110101111101100011010001001011100111111100000010100110000001011110110001111000111011000010010101101101000111111111111111001101110101011001001111000;
parameter cir_lt12 =256'b0110110010001100001000011110110100000000001010111001100010101111110101111111011001111111000001000111011101001010011000101010101100110000100011010100011001100001001111011110010101100001010001101111111011011100101001100101110111110111001111010100000010101010;
parameter cir_lt13 =256'b0001100101010011011001001111010001110101001101010000010011000101100010101100010111100101010101110111000011001001101101100101101110010001110010010011010101010100100111001101001100000001000111100101111110010001010110110000100001010110011010010000110001110100;
parameter cir_lt14 =256'b0001000000111000100111110011001000111110100101100111001010001111011010111010000100101011010001100110010000000011100010110100100011100110100100010100101010111011101000110010010001000110101010010110100100011100110010100110101000101011111101111010110100110100;
parameter cir_lt15 =256'b1101100101011001111100011100011010110100111110111011010011111111110001011101001101010101101010101101100011101101100110011100110001101010000100011101011111110101001101011001100111010100111010001010001110011110111110001001110010001101010010101100100001001010;
parameter cir_lt16 =256'b0101000000110010000010100000000011111111010110001100001010110101001001001011011110011011101110111100110000100111101001001101111100011101010010011010100000011010000010100110111010010011010111111001010100010011011010011111111011110000110101000110100100001010;
parameter cir_lt17 =256'b1010001110111110001001110010100101111000100101111010111100101110111000001001011100010001100110111111100100100011100010111010111000111010010001000011010000001011010001111010001010100100010000100110101110001000111010010011010110001011111100100101000101100100;
parameter cir_lt18 =256'b1011111010000100000100101000000101000010010001011101101101001011001000100011010000001110100111011010011111110010111010010011011110010000000100000111010011001101000110001101111100010011010101001011100011110100101010110111010000000011010011100110111111011110;
parameter cir_lt19 =256'b1010100100000001111110010010100011110110011010010001100010110100110001110101100111110110111010100111000010010000000111111100111010011011111101111010000101111100101101000100001000101101100011010000011101100110010110110111011110110100011011110010000100011100;
parameter cir_lt20 =256'b0011010000111011110011001000000011001100101110110110110011010001000001011111101011101001111011000010111001000001011111010101011100110001101000111110000110111010111010110011111110011010100110111101010000011010000110010011011000111100110100110001111110100110;
parameter cir_lt21 =256'b0000011011000100000011100001101111010111000110111010100000011110100001010001010000011111101110010000000010010010111101010111111101011110000000111010110101110001110001101011111000101100111101001011110100000101010001001101101111011100101101000101000100000000;
parameter cir_lt22 =256'b0011110000010111001101110010101101111011110001111010010110101001110101010011010010101001110000100010011101011101100111010011111011110011011001011110000010101011111110110110101111000010001011110011110000100001101100011001111100110101011000000010111100010000;
parameter cir_lt23 =256'b1111101100001010000100100101111010111010000010101011001010111000111011000001111010111001001100011100110110010001010001000000001111010001001100010101011011111010011101100010110010111000010001000101001000000111010010001001011011001001110110001001001111101110;
parameter cir_lt24 =256'b0100000111011001001010110110111000010110110101101011111100001111101111000011111000001111010010101110101001011110001011000100001001111100010101110001101100100000010010111111100101010110100111111101001100100011101111011101001000100000000011001110110111111110;
parameter cir_lt25 =256'b0001101001100010000101000010010111110111110000010011111111101100101111110000011000000001100011101001001100110010111111101000110011101001000010100001110110111111001000010110000000100010001001111011101100010010000000110010111001111111011001100001001000111010;
parameter cir_lt26 =256'b1100100111010001000000011011111100100010011000111001001110100011000101101110110100000011111100001101110101110101111010000001010111100101010001101110111101001010011001011010010001111011101111111110001100111101110110100101001000010100110000101110100011000010;
parameter cir_lt27 =256'b1001100100110101000111010010010000001010111111000000010010011010110101010001111010101101100000100001011100001100011001111110011001011001010011110110010011111000000011000001111000101000010010110000100100101111010010100010110101111000000101010001011011110100;
parameter cir_lt28 =256'b1100101010000110000010001011111011011111010111101010100011010101011111001111010110101111111111000101100101001011011100010111111101010101000000111001011000001101010010001101101001110001110100110101000100000000100100110101000100010011101100011110110000001100;
parameter cir_lt29 =256'b1010011001111101110101001111000110001111111001000001101010000111111000100100000011000110110110111010111111101000110000010101101010011010010100010011111110001101101000110001001011101111100011111001100001100010100011001100100010100011101010111010010000010110;
parameter cir_lt30 =256'b1001111011000111000000110000111011011100100000101000000110000111000110000111000000001001100100010100111101110110111001100111110110010100110011111000101111010011010101000111100101011011000000001010011100101001000011111011100001110100010111100111001001000010;
parameter cir_lt31 =256'b0000111101100110010001001111000100010111000010101110001101001001101100111001000110001100001100110011011001110011101110100000100001000101101001100010011101011000100011010011000110011111011110001111010101110001011100011001010100010111010000101010000100010010;
parameter cir_lt32 =256'b1011011111011100100100110000111001000100011011000111100001001001010010011010000101000011011110011101011011101101100111010010111101001011001110001001001100000110011110100101101000101011111101111100101000111010111100101110010111000000101101110111011101000110;
parameter cir_lt33 =256'b0011010011001111101101011100110001010110111011111101001001100001000011110010111111001011000011111101111111011011000001111001111101111010100100011000010001111111000110000101101011000001110110011011000100100001100010111111101100000110110010110010000001011010;
parameter cir_lt34 =256'b0101001100010100111100011100100011101001111001100111001101010001001011001001010110101000001001101001100011101110101000111110011100110001101010101000000111100110110011000101111100101101111101100111001011011110000100101010100011001010111110010011100000001110;
parameter cir_lt35 =256'b0110000100111010001000001010011111001100001101000010111101011011000111000001110110010001010110100110001110001001111111101001010000101001000101110010110010010000000010011101101001001100000010110001110101110001000000100110010110011000011010100101001000010000;
parameter cir_lt36 =256'b1000011011100001011001001010001101110011001111011000111001101011001111111010011111110010011100110010010010111100010110101110110001100010001011000010100100001001110111011101111110100000001001001101111010001110100110110011011001010100010110000100101001000100;
parameter cir_lt37 =256'b0010011011110101111111011000101011010010100100001001001110011001111011011111110000000011011110110001001000100001111011111101100100111110010111111011000110010110010001011100000110001100010100010000010100111010010011010011110110011100111011011101111100101010;
parameter cir_lt38 =256'b0001101101100011000101101001111000001001100011000100010000000100001001000000111110110010000100100010100110101011001001110100100111100101000100001011100101111011100000010110001000101110110011111001010011000001000001001011111010101010111000011001010010100100;
parameter cir_lt39 =256'b1100111100011001001111101001011001001110100000110000110110111001001101110011001001010100100000011000110011100110110010100100000101100001000110000010011110001011101010101001111101110001010010111100100110110101011000010101001111111011101101111010110011010010;
parameter cir_lt40 =256'b0111001010001111110101011000001010010101100111111101101000100100111111101100000111100101111010001011011101101100000000101101000110111010010101110010111101100110011011100011110011010011110101010101100001001110001010001101000011001101101110111110011101011100;
parameter cir_lt41 =256'b0101000110100010011011010010111100100011110100011101101000010110001101110010001001000000010101000001110101010111111011100101100010001111100011010001100100110100111101001110010011100001010011100101110011100001001110101010010101000010010010010111110110111110;
parameter cir_lt42 =256'b1011101100010011100100101000010011110010010011110010001000111110000101010000110001000001111001111010110001111100000010011110101001100000100100101101100111100101110011001100100110010000000110100011101011001101001001110010011011100000011000101101111111001100;
parameter cir_lt43 =256'b0010000000011010000011000111101101111101100110110000100001101010011110110111011100001101110001100000100100100010110010010011100010101111100011111010011001110000110101100100000100010110000000010011110001001110010010000010010011010011110011000111001011111100;
parameter cir_lt44 =256'b0100101010101011111100111101000010101100000001011111000001000010010110010101100100001100011101011011100000001001001011101000101001000000100100000110011010100001111011100110110001100111010101010101101001100010010101011010011101110001111001111101000010001110;
parameter cir_lt45 =256'b1100000011010111101010011110111100000001100101110011100010101010011001110111100000011010001100010100001000111101001101010001100010010100111100000101001100111011011011000010011010010001111000011001001101010110100100101011101100100001011010101100100011101100;
parameter cir_lt46 =256'b0110011010111010111000101111010111111000010001000011010110010100010011101001011101110110011010000001101000100000001001101111100000011000111100010001011111100111000001010000001101011001010011000011110000001011101111110110000010100111110011100010101100011100;
parameter cir_lt47 =256'b0011010000011111111110100010110000110011011110001011101101110110100111111101100011111011111010100010010011101011010011001100100000111100011000001100111011111011111101011111110111100000010101111001001100000011011111110100110000011100011111011010011010010110;
parameter cir_lt48 =256'b0001001001110010101100010011011011001010101010111011011001001000101101100011011110010111101100110111110011110110010111110010100010110000011000011000101000100111100111001101100000101000111110100011110001011110010100101001011110011010110110010100010101100110;
parameter cir_lt49 =256'b0010110000010111000000000010110111011001100100111100000001111011110001110111111011101011110011010010010111000100010100100111011100101100101001001011100011011000001111100001001110111010111101101110010001011110010011000010100001110100011111000011100111101100;
parameter cir_lt50 =256'b1010011011100011100010011011100010101000001011011011100000000100010000011110011000001011111011010111100011111111010000101001111011011111111101001000001111000001011101111101110111111001110100011001010010000100000101110011010001111100110000100110001100011000;
parameter cir_lt51 =256'b1010010010111001000001111001101001110101101001000000011001001110010100011101111100000101101010001010001101111010101111000111100001101011001010010100001110111010100110111110010110110011000100100111000001100000101011110111110001010110000001110000011000111000;
parameter cir_lt52 =256'b1010111001001101100011100000111100000100000110100111111000110001110101110100011111100101100010001111111001000001101011001001000110011000011110010111100010100011110100100010101111110000001101010000000010111010111101000110000001011110101110010101110011001100;
parameter cir_lt53 =256'b0010110111111101011111101000101000011110100110100001101000111010101010101101001101111011011110100110100110010011000000110001100101101001110110001011101010111110000001010101100100100110001100110010110001010110110100100001011111010001111011001011100101011100;
parameter cir_lt54 =256'b0111101111000010100101001010111100001010100101010100101011011000100011001111110001001110100010101001000111011000110111110001011111001011010100010000011100011000000000111010110101000010111000111110010100011000110011010011001100100010101111001011101101000100;
parameter cir_lt55 =256'b1011000000000010010101000010011010000010010011110011001001001100011110011100000000011101101110000110010110101111110101000000000010011101000000011001010011110001001011111010010000011110110010110101000100101100101101111101100011010100110000100010011111011100;
parameter cir_lt56 =256'b0110011000111101101111100000001110010110010000000110001010101110010111111110111100101000010010001001110111100100000010000000111000111111100010000010100101010111001010010101000001111010000110111001100001100010101010001111110000100111100100100010010111000100;
parameter cir_lt57 =256'b0101100010011011001010011000100110110100101110011100000011110010101010111111000011000011010010000001110101100010001111100100110111100100110111110111111000110111101111001001101110101011110001100000101011110101010010010001110011111110101010100001101001100110;
parameter cir_lt58 =256'b0011111010011011000100101011100001000000000100010011101101010000010011100001010011000111011110011100000110000010100011101000111011000011111010110111101001110111101111010111101111101010101010101110101010111100101101111101010111111000000111110001000100000010;
parameter cir_lt59 =256'b1100111011010111111110011010011100000110100101101110111110001100111010111111000011101111111000101011111100000111111111001010000011101011001010101101101011011111011100100110110011100110001000000110100110100010000110101011110000000010111110000111111001101100;
parameter cir_lt60 =256'b0010100011010111110000101001011011110010001111100001010000101110000011100001010011101011110100110110001111100111010011000110001111001100000111101101111010011111011100111000110010100111010011001000100111101011111001000111010100000100010011010111010100001000;
parameter cir_lt61 =256'b1001100001011101110001111010100001001000111110111110011110000100010001111101111010111011111100011001000001111010001110100011101101100001110111011011110110011110001100000110011101001011110111000110001011010111010011101001010111100001000010100100110010110000;
parameter cir_lt62 =256'b0110001110101100111100100101100001010011100011110011001100100011010001100100011001111101101011111000001110100011110101011101111001000010110011110101001100110011011100110000001010011110100110001001111110100111110010001100010111110101101110000110001111110100;
parameter cir_lt63 =256'b1111011110000001100011111100110100110100001111101001111110100110010110110111011101011000000110001100000101100010001110101111101101001110011100101011000110111000111101111100011101010111101101000111010101110010011101010110100111100000000100000000001100001110;
parameter cir_lt64 =256'b1000110001110000101110100011110100101111010010100100101100000001010110101110111110011110010001101101001010111011110101010001111001101101011000000101111100010101101101001010001010000010111100001000100000000010111100110011100111110100101000100010110001001010;
parameter cir_lt65 =256'b1000101100001010100001001100000011001010101010110100000100101010011110010001000011000011100001010110110101110001100001100011110010110110111101101001110111010100010001110011000010010100101001111101101101111111001001100011101010010100100110000110000010111010;
parameter cir_lt66 =256'b1111011011110101101100111101111010000100011110011110000101110010000100111111000111001010110001101011110001011111001110001001100110111101100111111010111100000110111110100001001111001101010000000000000000110111100010111000000110001010000111010101111100000100;
parameter cir_lt67 =256'b1101111100011001001110001101010111110011000101010001010001110010011111011100000100011101000100000111011101000011010001010111110001011110111111000111010100101110001101101000010100000000011100010100011000010011110001100001001011000001010110100111000100101010;
parameter cir_lt68 =256'b0010001011100110000011111100101110111101110001111011010000101010000101110010000000010100010100111010011001101101111110111101100101010101100101010100011111111100100010111010011001011001100101101001110101011011011010111010100111011111110111110100111010010100;
parameter cir_lt69 =256'b0000101100111100100011101000001110111011011001101001010011000100011100010101101000110000000010001101011100000001011110011110010000011000010111111000011010110011011001110111101101011111011100001101001000111010010100001100010001110001111110111001110101100010;
parameter cir_lt70 =256'b1000001000000101111100100100110010100000010101011101010100011110011110100111101100111101010110110000000101110001100100101010100100111110111001010110000100000110001101110010001111101101111101101011111110101000000110111100011101111100001000011001001111101010;
parameter cir_lt71 =256'b1000100110000001010001110001110110010101101000101111111010111011111101000110100110001101101010011110101101001010010100111000111100001110000100111101011100011000100010001111000110010100100000010111111100001100100100100010011000011111001110001111111001100100;
parameter cir_lt72 =256'b1000000010111000001110111101001010001110100100011011111101100001111111110100100010000000111110100011110100111010101110001100001000101000101010010011000010101101110110001010100100100110000001110001001010011110110110010010010100010010111000101111000011101100;
parameter cir_lt73 =256'b1100001110001010111000000111111000111010001010111100000010100100001011101010011111010111000111110010010011001001001100000101111001000111111110100001110101100001100101101110111000111001000110011111000110111010110000100111101110011001011011110100101110011100;
parameter cir_lt74 =256'b1100110010001111111101001001000000010110101100001000000000011001000010111010010101110001001011010110001010101001110010001011010111101010000100011110110111000100011010110100011101111001000011100010001110011110100110001110111001011110110111001100101001011000;
parameter cir_lt75 =256'b0111000000010101010110000000111101001011101001100000110011110110010011000010010101101001001110011001011110110100001011010011110001111110101111100111010111111111111100010001111100011111000100101110110110001111011011010111000111100110000001011101110011000110;
parameter cir_lt76 =256'b1111111100010000010011001110000101100111001111010100110001001011011010010010011111001111000010111101000111010100110101011101011111010011010101011000010101011010000011001011011001011111000001010011111110101011001101111110010000100001101101100101110100000010;
parameter cir_lt77 =256'b0110001010011000010000000010110011101100011010011010100011110100110010100101110110101011001010111110001000101001101100101011111110011011110001111100000110000111001010000010101101101000000100101111101001001000011011110011011011101100001011111111010110100100;
parameter cir_lt78 =256'b1111010101100001011001000010100111100111011000110100011010110100010101110011011001001011100111010001000111010110100010011100010000001111111011101111101011000100000001101100010010110000000001111011101001101010110011000100101111001110111111101011100000111100;
parameter cir_lt79 =256'b1110110001100110001010100111110001100101100100000111101110000001000001010011010010010101111111111010010100000001011010001011110000001000100110111110000000011001111101001101001000000000010000100101010110101111100101000000011010111110000110011101101100110100;
parameter cir_lt80 =256'b1111101110011111000011100111100101101110100110101001010111000001100110000101111101110101010010010101011011111110010100111100011110011100101100101101101101011010110110100011110111011000010101110001010110001101001101110111101110011100110010001001011010101100;
parameter cir_lt81 =256'b1101100001010000011000110000000100000111101101010001010010110001010000000100110010100010011101111101101011011001101100101011001110010011101110110111000111111001111001011111011110101010000100010010100111111111001100100101011100000000011100011100010101001010;
parameter cir_lt82 =256'b1101101111100111001100100100001010100010001011110000010001110100101111110011100001011001000010110101111101000010100011001010000010100111001101110010111010001001111110001001111100010110111001100111101011011101111000110110110000001010110100101111010010011100;
parameter cir_lt83 =256'b0111011011111101010100000011010001100111100011011011010001001010110110000011001011000010000010011110110101010011000100110000101000010100010001110011110101000101000011000001100101111110101001001001100111011110011000101111101011001000100001100001111010100010;
parameter cir_lt84 =256'b1111010101001010000000010111011111000010000101111010010010001111001001110100011000111001011101010110100011001000001011010001100100100000110010110110001000110101000100010111000111000010010100111100101011111100101100111100000111000010001001010010111101110100;
parameter cir_lt85 =256'b0011000001100001100001000110110011100000001101110001001100100110110110001011001111001000001001110010001100111001001110111011011011011110100110001101110001100010110010101101100011010010011001010001000110001010110001100100101111001001110000010010010010011110;
parameter cir_lt86 =256'b1111110100000111001101101000000011001110011111100101001001110110000010101010111000110110011101010101111001110111110110101011011000011000101110011000010110110001100000111110110111000111100110010110100101011001010001100010101110100111011111000000101110110100;
parameter cir_lt87 =256'b0101010100001000001000011110010010110000110010101000101101000000101110111000010001111010111100111111101111010100001000010001000101000000010101100100000001010101000110101110000100111010001010000011100011010000010000000100011001110101110010111100100010111010;
parameter cir_lt88 =256'b0001100001101110100100110000100010011110100000111100101000010000011010011001100110000100101000011000011010011010110000000001000110000110011101110001100110000110010100111101010000101111110101000100000000000011110000000010011000011011011101101110011110010000;
parameter cir_lt89 =256'b0000001010101111001001001001100011100010011000110001011000000101101111111011110011111111100111101000110000100001100110110111001001100011100001100111100001010101101111000101000001101101100000000111101010111111101100011101010111100001100010100010101001111000;
parameter cir_lt90 =256'b1000010001000100011101001111000001110010000110011000101100100111110101110001101010001100001011110000000100100011110010001001110111101000011100101001011110000011101111101001101101101110010110010011111111001100011010101111000010011001001100111001110100010010;
parameter cir_lt91 =256'b1100101001111000100100001001000010101001100011100111100011001111000100111111110000100001100110001101000111101010000011001101000111011100110001101110001100111110101000110110101100110011110010011110101000001100101100011001110101010010011000111110000010101010;
parameter cir_lt92 =256'b1100110010010011110000001111100000111001111101001110010111101101011110110101101001010010001010010101110011101000010111110011111001010111001100100000110011101000101000011010000000110000000100001010111101111111011010101011100000101010110110100101011111000000;
parameter cir_lt93 =256'b0110111000110010000010000110011011111101011011010101010011011010110100011001001010111111110111101000100111000100011110100001001100001101010100011111110100011011001111001011000111011000110000010110010001110100010001011000010110111011011110000000101000101000;
parameter cir_lt94 =256'b0100110010100101011101101011011100110010101100010000111101110110110011101011011111111000011010101100010111011011111011111000010100111000011001111100110001101110111111100110100101010101000000110101111011110010001100100100000011011001101100010101000101000110;
parameter cir_lt95 =256'b0001100111100010111100100011101000111100111100010000000010000011010111001001010111111011111000000101100110110010011111100011010001000111010001110000011000011001000101100010000100110110111001101011001110110101010001100011111101101101111111101001101010000000;
parameter cir_lt96 =256'b1011101101110101100011001110101111110011001011010101101100101111010000111011000010111100010101000001010110101101111010111010001001110010011100010011011101101100110101001111100110111011001001001000100100110011001100011111101000001111001101111100000111101110;
parameter cir_lt97 =256'b1100111101010000101011010110100010100000100110101010100011111001011100100101000101111011110110001011010110011001101110000010110110111000100101011111010101110010001100011000101011101001001110110010000100011000010101100000100100100100110010000000101000000010;
parameter cir_lt98 =256'b1000010001011110111011110110111001101110010011111000001000010100101011101101010111001110100000101000110100010111100000001110111001111101111000110011000010100100100100110110001001100101101111111011100111011100010000011010001001100011000100000101000101000100;
parameter cir_lt99 =256'b0101101000101000010111000010000100001101010011011100111000110000110010101000010001001011010011010100010001101010100110001011101011111101000100100011111100011111000111100111000100110001000010110000010011111111010101000101100001010111001011010100101111100000;
parameter cir_lt100=256'b1001000100100110000111100010011111000011100110001110010011011101000101100000000011111110000101110111110011100100101000000111100100111000011001001111101011001001101111001001100110111101100011111001110000111011010000111111001100010000111101010001000010100110;
parameter cir_lt101=256'b1001101111100110001100110011101000000011111000010000101010000101111100110110100000011110100000110000001111110010010010101010111110011101101010011110101011011000110011110011100101101010001100011001010000101111111101101000001010010000100011011001101100100010;
parameter cir_lt102=256'b1101011100111010000101000010111011101101011100001001111110111110001001100010001001110110000111101010010110111111011110111000101110011111010000010011010111110010111010110001001100000110110101001000010101000011110111010000110011010100101001110011000100010010;
parameter cir_lt103=256'b0011000001010000011111000100101100010101010101110100111111001000011011110111100010010110100110101011011001011101110011100001010000011011001010111100100011010011101010001101111100010001101011101011111100100101001100111001101100001100110111000011001000111110;
parameter cir_lt104=256'b1111110010001100010110110101111111111011110001101101101011110011101110100011001011111110000001110001000000010000111111110011000000011001110000110001011111111001100011001111010101111101010010111010111001001001000110000001010101001000111101101001100000001110;
parameter cir_lt105=256'b1110011110111011010001111101010001001011101011011001000111101101111011100000101010011001010000110101010010010010010110111001110011001111111111110000001101111011111110000111001111110001000010101000011100100101010111000111011000111011001100011011111011111100;
parameter cir_lt106=256'b0010000111010010011111010110001100101010110011000111010110100100110100100100001100100001001000010000001110001010100011010001100010000111110010101101000111000110010010100110000101011111100110001001000100101001110000100111011000010011000100011101111001001100;
parameter cir_lt107=256'b1110001110000111011101001110111000010000100110001111100101011100011000001000001111010001110010110101110001111111100000010101110001001100100100110111111011011001110100011011001001111010010010101001010001100110001101111100110000000110101000000111110101100110;
parameter cir_lt108=256'b1010010111101110010011100101100101110001111110010001110100010101010111001100101001101001101010010000101101100111010101111101100000000100101001101010110001100100011000111010000011010100110110001000001001101010101010011100110000101110100000000001110111010110;
parameter cir_lt109=256'b0011101011011101110001111110011111111010001010100110001011010001001101100100100011001111111001001111101001101001101011010100110001010011010111011110001001011110000110111000000001111010100001000111011111100111001001010101011110110010110000110100101001111100;
parameter cir_lt110=256'b1101000110001010100100111101110111111001000111110010100010000111011010100001111100100011110011010001101100101010001100011011011100011010000110101010011100101010001011110001101010101111100111111110111111000111010000100001110011000010000010010110001011011010;
parameter cir_lt111=256'b1000111001111010011100000111100101100010010110111011110011010111100100011001000101100110101000001101111100011100111110001001101011111101110001111111101111100010001110001001010111101001110100010001110011101100010100111101011011101000101010101111000011010110;
parameter cir_lt112=256'b1110010100101101001001000100001101100001011011101111011010000001110011011100011010001010100010010011111001011111011001000110000110110100100000001011111010010110000011000000111100111100110010101000010011001100001101001001110110011000011000001101100001110000;
parameter cir_lt113=256'b1011010101000011011110011111001110000011111100000111011001000101110111011001100110000101001011101011010110010100101011100010000100100010011111011100111011111100010010010000010000001011010101101010010100110011100010111000010110000010011000001100001011000110;
parameter cir_lt114=256'b1111000001110001001001010101010000100111000111100110000010111000011110001000011100111101011111010101001000111011111101001111111011110000010010001111100101110100100101011011000100001110000110111100011001001111010100011110001011011011000110000110111001011110;
parameter cir_lt115=256'b0000101001001100001001111011101001011000010110001011000101111111101011000000001011011000010010011000010011101011110101000001110101010100100001010011010100011000100100110011001100001100001101011100101101010110100000111011100000001010101100010010111011011000;
parameter cir_lt116=256'b1100111101111110011110110001110111111100101101101010011110000010000010010001110001100000000110100110001101000100100011101100001010000110101100000000001010010000010011111000011000001001011110001010100000101010010110011101111101010011110010011000001001000000;
parameter cir_lt117=256'b0110100111110100000010100001100111111000001100101110010110110110111111111000101110010000000110000001101010000011110101101001001110001110011110011100100100101010101010100111111011110011010101001101010111000011100011110011111001000100001111000100110010011010;
parameter cir_lt118=256'b0000000011111011100010010010101100001000101000000100100111000111001011111101100001011101010010001011000000110110000101101001010101111000000010010000011111001101010010000101001111100111100011110010101111101010111100010110100111001010101000010111001001101010;
parameter cir_lt119=256'b0010111011011010101110100001111101100111011111011110010110010001111110000001000000101011111011001111100000001000011011000010001111100001000101111010000111000001011010011100111010000011011111010100000000011001001100100011010100010001110001101011011101001100;
parameter cir_lt120=256'b1100011111010101001110010010110110010111111011110100100111100000001010000100001111100110101111000101001010111101101011000010010100010111011001110110111100100110100010111110001110010111101001101011111000110000010011000110001010011111010110111000100110111100;
parameter cir_lt121=256'b1011101110001110111000100101100111011110000010001100011010010101001100011101011100010100110001110000001100011111110110000010100110000001100001101000110111000101010111000100111010001110111110011101000110011000110011010001001000100111011111001111000110010000;
parameter cir_lt122=256'b1001110011001111010110001000110011101110010110101110101010001001100100101000110011101011011101010000010111110001111111000110101011111010011000111100011011110010000100011110001001100001110010001010100001110000001011011001011000001000111001100011000010000000;
parameter cir_lt123=256'b1111000100010010001101110001110011100101101000011111100000101100010111010110000001100110011111010111100110110010100001010010000011101000011101100110010110101001010100110111000100100001100101100000111110110000110110110101001111001101100100010011010101110110;
parameter cir_lt124=256'b0101011001010011100011011100100111010101111100111101010000110000111111100011101110011001110011110111111101011100101000010110001110010011100100110010111010011110000111101101110111001110101001110111011001011000001110111101011111100010000010111111010001100110;
parameter cir_lt125=256'b1111101011011000100011011010101000010100011010101100000000011111101111111000110110101011111100111110000101001010101111001100100110000000111101000101100111110011111000100110011000010010000111011101001110110110000000010101100111111111010011111101010010110100;
parameter cir_lt126=256'b0011110011111101011001001110100000011001010101100111110001011000100100110000001111010101111100010100011111010010101000011101010111111011111010101001011000101101100100111110110000110101001001110110001101011101010111000010100110010001010011111010101111110010;
parameter cir_lt127=256'b0110010000001100010100111101000100110000001110111001100011110010101001101100011111111000001000100110100011110000101011110011010110001010000101011010001110110001001100010010101110001001111100110110101101110010100000101001000101101100111011001000100000100000;
parameter cir_lt128=256'b0010001000101001101110101001001100111101000001110010010010110101100010100100100110000110001000001100111001101000101100100010100111110001000010110110110001101111010000001010000110101110110010011101101110011001110111111110000100000010111011001111011101100110;
parameter cir_lt129=256'b1000100011100110011011010001010001001101111111000011011100101110111100101001111111111010100101010011111011000000010100001100101101001001011101110110110000111110100000101100110010011010101111011010001000100010000101011000110101001000110000001110000100111100;
parameter cir_lt130=256'b1011110111001010100101000000111111000100010110100000101000100010001011011101100101100000110011111001101101011111101001001101100000101100101100011111000000001001001001110011001010001110100111100101000110011101010101011011110111100101000111110000100111000010;
parameter cir_lt131=256'b1100101101000001001011111110101011011110010011010111001000010000111001000001101100110110101001101001001111010111101011001011110010100001100001110100110010110110101111010111101010000110000110001011011100000001110111110000111001100000100001000100001000111110;
parameter cir_lt132=256'b0111111001101101110101101111000101010111111010110100111100011100001110110101110110101100111111000011011001001000010110001010111111000100010000011101000010000001000110001000010010010010001110110100010010111110100111110011111011001101010110111010101011000000;
parameter cir_lt133=256'b0100000111000010100111100001010100000110111100010111010110110100001001110100001111101001011010111100010100100010110101011000100001001101111111000100010100101001111100001111110100100100101010011011000001001101100110000110010011110001010100111001111111000010;
parameter cir_lt134=256'b0010001000010011010011101011010001100100100111001001000011000100001100100010000011001111001001110110011101010000111011101100011100101011101011011111110100000000010001110100010001011101010011001010100101100101001000000111010010111100110100000111011000101000;
parameter cir_lt135=256'b1100000001011001001010111110110011110101001011111110010101001010001001101001010001101011101010101000000111011111011001101011111101001110101101100110011000110011110011001011011010010011100101001101010011110010101010111010110000110010100111111011001100110010;
parameter cir_lt136=256'b0010001110001000111110110100110110010111010000100000000000111010001100111111011101001101111001100010001110101101010111011111000000101000111001111101111000011010011110110000111111101010011100011100110111011010000100111011110001111111000111000101101011011000;
parameter cir_lt137=256'b1110001100110010010010100011001011110000010101110011011000000011111110100010101110100000000011010110010010101010011001100001010110011101011110001011001000100111010000110100100000010100100111100011011110010011110111011111010011110110011000000011001100010100;
parameter cir_lt138=256'b0111110111101001001111100000000101100011110010100011010101100100010100000011110100000000011001001110101111011111000101000001110110110101001101101110100101000011100111100011011111011101100111101011011101111000000010011010111110000111111111100101000010000110;
parameter cir_lt139=256'b0000011010011010101110111100000111010010110001000001011111100001111001110111111000001101110100110000110111000100110011111010000011110101001100111100101001010011110101001100000111100000100110010110011111011100000011001111100010100000101111001011001001111110;
parameter cir_lt140=256'b0001100001000001110011111111001001000001010110010001010010000110010011010110100010101101101110101000001010110001101111011010100011011101011111011001000100110111000010011011111000101001100110011110011100110111110110001010001111010001001000101101000111101100;
parameter cir_lt141=256'b0010110010110111001000110011001100100111001111000011011001000111001001000000000001101001001100101010100011000000111010101110001010010001001111000110100110011011100111101110101001100100100111100110110010001100101000111011100110001000101101100110101011111100;
parameter cir_lt142=256'b0111000011001001010000100111100101100110011011101001010011011011101101001001000001100001110000101100001001011011101101100100110000100100111000111000001000010111100011111011111101111111011111001110010011110110001010010100000010011001000011000000011111010100;
parameter cir_lt143=256'b1010110111111101001100101110111000100100000100000010011000010010100000111100101101101101000000010001000111110110101110110010000001110010001010001000101101010111001101100110010100011000110110101110101010110110000100101011000111010011001111111000011100101100;
parameter cir_lt144=256'b0111000110000011010100111010010001100101010000101000010010001110000100110101101101100101111100010111101101101101111001111000111011000111111101110110000011011011001001110011000000000011001110000110001011001100100110000100100011000010100001011110101000000100;
reg [9:0] counter;
reg [1:0] state;
reg [255:0] parity1,parity2,parity3,parity4;
reg [255:0] cir_lt_r1,cir_lt_r2,cir_lt_r3,cir_lt_r4;
reg encode_fin;
reg [15:0] parity_r;
wire [255:0] cir_lt_r10=(data_in[15])?cir_lt_r1:256'd0,
cir_lt_r20=(data_in[15])?cir_lt_r2:256'd0,
cir_lt_r30=(data_in[15])?cir_lt_r3:256'd0,
cir_lt_r40=(data_in[15])?cir_lt_r4:256'd0,
cir_lt_r11=(data_in[14])?{cir_lt_r1[0] ,cir_lt_r1[255:1]}:256'd0,
cir_lt_r21=(data_in[14])?{cir_lt_r2[0] ,cir_lt_r2[255:1]}:256'd0,
cir_lt_r31=(data_in[14])?{cir_lt_r3[0] ,cir_lt_r3[255:1]}:256'd0,
cir_lt_r41=(data_in[14])?{cir_lt_r4[0] ,cir_lt_r4[255:1]}:256'd0,
cir_lt_r12=(data_in[13])?{cir_lt_r1[1:0],cir_lt_r1[255:2]}:256'd0,
cir_lt_r22=(data_in[13])?{cir_lt_r2[1:0],cir_lt_r2[255:2]}:256'd0,
cir_lt_r32=(data_in[13])?{cir_lt_r3[1:0],cir_lt_r3[255:2]}:256'd0,
cir_lt_r42=(data_in[13])?{cir_lt_r4[1:0],cir_lt_r4[255:2]}:256'd0,
cir_lt_r13=(data_in[12])?{cir_lt_r1[2:0],cir_lt_r1[255:3]}:256'd0,
cir_lt_r23=(data_in[12])?{cir_lt_r2[2:0],cir_lt_r2[255:3]}:256'd0,
cir_lt_r33=(data_in[12])?{cir_lt_r3[2:0],cir_lt_r3[255:3]}:256'd0,
cir_lt_r43=(data_in[12])?{cir_lt_r4[2:0],cir_lt_r4[255:3]}:256'd0,
cir_lt_r14=(data_in[11])?{cir_lt_r1[3:0],cir_lt_r1[255:4]}:256'd0,
cir_lt_r24=(data_in[11])?{cir_lt_r2[3:0],cir_lt_r2[255:4]}:256'd0,
cir_lt_r34=(data_in[11])?{cir_lt_r3[3:0],cir_lt_r3[255:4]}:256'd0,
cir_lt_r44=(data_in[11])?{cir_lt_r4[3:0],cir_lt_r4[255:4]}:256'd0,
cir_lt_r15=(data_in[10])?{cir_lt_r1[4:0],cir_lt_r1[255:5]}:256'd0,
cir_lt_r25=(data_in[10])?{cir_lt_r2[4:0],cir_lt_r2[255:5]}:256'd0,
cir_lt_r35=(data_in[10])?{cir_lt_r3[4:0],cir_lt_r3[255:5]}:256'd0,
cir_lt_r45=(data_in[10])?{cir_lt_r4[4:0],cir_lt_r4[255:5]}:256'd0,
cir_lt_r16=(data_in[9])?{cir_lt_r1[5:0],cir_lt_r1[255:6]}:256'd0,
cir_lt_r26=(data_in[9])?{cir_lt_r2[5:0],cir_lt_r2[255:6]}:256'd0,
cir_lt_r36=(data_in[9])?{cir_lt_r3[5:0],cir_lt_r3[255:6]}:256'd0,
cir_lt_r46=(data_in[9])?{cir_lt_r4[5:0],cir_lt_r4[255:6]}:256'd0,
cir_lt_r17=(data_in[8])?{cir_lt_r1[6:0],cir_lt_r1[255:7]}:256'd0,
cir_lt_r27=(data_in[8])?{cir_lt_r2[6:0],cir_lt_r2[255:7]}:256'd0,
cir_lt_r37=(data_in[8])?{cir_lt_r3[6:0],cir_lt_r3[255:7]}:256'd0,
cir_lt_r47=(data_in[8])?{cir_lt_r4[6:0],cir_lt_r4[255:7]}:256'd0,
cir_lt_r18 =(data_in[7])?{cir_lt_r1[7:0],cir_lt_r1[255:8]}:256'd0,
cir_lt_r28 =(data_in[7])?{cir_lt_r2[7:0],cir_lt_r2[255:8]}:256'd0,
cir_lt_r38 =(data_in[7])?{cir_lt_r3[7:0],cir_lt_r3[255:8]}:256'd0,
cir_lt_r48 =(data_in[7])?{cir_lt_r4[7:0],cir_lt_r4[255:8]}:256'd0,
cir_lt_r19 =(data_in[6])?{cir_lt_r1[8:0],cir_lt_r1[255:9]}:256'd0,
cir_lt_r29 =(data_in[6])?{cir_lt_r2[8:0],cir_lt_r2[255:9]}:256'd0,
cir_lt_r39 =(data_in[6])?{cir_lt_r3[8:0],cir_lt_r3[255:9]}:256'd0,
cir_lt_r49 =(data_in[6])?{cir_lt_r4[8:0],cir_lt_r4[255:9]}:256'd0,
cir_lt_r110=(data_in[5])?{cir_lt_r1[9:0],cir_lt_r1[255:10]}:256'd0,
cir_lt_r210=(data_in[5])?{cir_lt_r2[9:0],cir_lt_r2[255:10]}:256'd0,
cir_lt_r310=(data_in[5])?{cir_lt_r3[9:0],cir_lt_r3[255:10]}:256'd0,
cir_lt_r410=(data_in[5])?{cir_lt_r4[9:0],cir_lt_r4[255:10]}:256'd0,
cir_lt_r111=(data_in[4])?{cir_lt_r1[10:0],cir_lt_r1[255:11]}:256'd0,
cir_lt_r211=(data_in[4])?{cir_lt_r2[10:0],cir_lt_r2[255:11]}:256'd0,
cir_lt_r311=(data_in[4])?{cir_lt_r3[10:0],cir_lt_r3[255:11]}:256'd0,
cir_lt_r411=(data_in[4])?{cir_lt_r4[10:0],cir_lt_r4[255:11]}:256'd0,
cir_lt_r112=(data_in[3])?{cir_lt_r1[11:0],cir_lt_r1[255:12]}:256'd0,
cir_lt_r212=(data_in[3])?{cir_lt_r2[11:0],cir_lt_r2[255:12]}:256'd0,
cir_lt_r312=(data_in[3])?{cir_lt_r3[11:0],cir_lt_r3[255:12]}:256'd0,
cir_lt_r412=(data_in[3])?{cir_lt_r4[11:0],cir_lt_r4[255:12]}:256'd0,
cir_lt_r113=(data_in[2])?{cir_lt_r1[12:0],cir_lt_r1[255:13]}:256'd0,
cir_lt_r213=(data_in[2])?{cir_lt_r2[12:0],cir_lt_r2[255:13]}:256'd0,
cir_lt_r313=(data_in[2])?{cir_lt_r3[12:0],cir_lt_r3[255:13]}:256'd0,
cir_lt_r413=(data_in[2])?{cir_lt_r4[12:0],cir_lt_r4[255:13]}:256'd0,
cir_lt_r114=(data_in[1])?{cir_lt_r1[13:0],cir_lt_r1[255:14]}:256'd0,
cir_lt_r214=(data_in[1])?{cir_lt_r2[13:0],cir_lt_r2[255:14]}:256'd0,
cir_lt_r314=(data_in[1])?{cir_lt_r3[13:0],cir_lt_r3[255:14]}:256'd0,
cir_lt_r414=(data_in[1])?{cir_lt_r4[13:0],cir_lt_r4[255:14]}:256'd0,
cir_lt_r115=(data_in[0])?{cir_lt_r1[14:0],cir_lt_r1[255:15]}:256'd0,
cir_lt_r215=(data_in[0])?{cir_lt_r2[14:0],cir_lt_r2[255:15]}:256'd0,
cir_lt_r315=(data_in[0])?{cir_lt_r3[14:0],cir_lt_r3[255:15]}:256'd0,
cir_lt_r415=(data_in[0])?{cir_lt_r4[14:0],cir_lt_r4[255:15]}:256'd0;
parameter idle=2'b00,encode=2'b01,dataout=2'b10;
always @(*)
begin
case(counter)
10'd0 :parity_r=parity1[255:240];
10'd1 :parity_r=parity1[239:224];
10'd2 :parity_r=parity1[223:208];
10'd3 :parity_r=parity1[207:192];
10'd4 :parity_r=parity1[191:176];
10'd5 :parity_r=parity1[175:160];
10'd6 :parity_r=parity1[159:144];
10'd7 :parity_r=parity1[143:128];
10'd8 :parity_r=parity1[127:112];
10'd9 :parity_r=parity1[111: 96];
10'd10 :parity_r=parity1[ 95: 80];
10'd11 :parity_r=parity1[ 79: 64];
10'd12 :parity_r=parity1[ 63: 48];
10'd13 :parity_r=parity1[ 47: 32];
10'd14 :parity_r=parity1[ 31: 16];
10'd15 :parity_r=parity1[ 15: 0];
10'd16 :parity_r=parity2[255:240];
10'd17 :parity_r=parity2[239:224];
10'd18 :parity_r=parity2[223:208];
10'd19 :parity_r=parity2[207:192];
10'd20 :parity_r=parity2[191:176];
10'd21 :parity_r=parity2[175:160];
10'd22 :parity_r=parity2[159:144];
10'd23 :parity_r=parity2[143:128];
10'd24 :parity_r=parity2[127:112];
10'd25 :parity_r=parity2[111: 96];
10'd26 :parity_r=parity2[ 95: 80];
10'd27 :parity_r=parity2[ 79: 64];
10'd28 :parity_r=parity2[ 63: 48];
10'd29 :parity_r=parity2[ 47: 32];
10'd30 :parity_r=parity2[ 31: 16];
10'd31 :parity_r=parity2[ 15: 0];
10'd32 :parity_r=parity3[255:240];
10'd33 :parity_r=parity3[239:224];
10'd34 :parity_r=parity3[223:208];
10'd35 :parity_r=parity3[207:192];
10'd36 :parity_r=parity3[191:176];
10'd37 :parity_r=parity3[175:160];
10'd38 :parity_r=parity3[159:144];
10'd39 :parity_r=parity3[143:128];
10'd40 :parity_r=parity3[127:112];
10'd41 :parity_r=parity3[111: 96];
10'd42 :parity_r=parity3[ 95: 80];
10'd43 :parity_r=parity3[ 79: 64];
10'd44 :parity_r=parity3[ 63: 48];
10'd45 :parity_r=parity3[ 47: 32];
10'd46 :parity_r=parity3[ 31: 16];
10'd47 :parity_r=parity3[ 15: 0];
10'd48 :parity_r=parity4[255:240];
10'd49 :parity_r=parity4[239:224];
10'd50 :parity_r=parity4[223:208];
10'd51 :parity_r=parity4[207:192];
10'd52 :parity_r=parity4[191:176];
10'd53 :parity_r=parity4[175:160];
10'd54 :parity_r=parity4[159:144];
10'd55 :parity_r=parity4[143:128];
10'd56 :parity_r=parity4[127:112];
10'd57 :parity_r=parity4[111: 96];
10'd58 :parity_r=parity4[ 95: 80];
10'd59 :parity_r=parity4[ 79: 64];
10'd60 :parity_r=parity4[ 63: 48];
10'd61 :parity_r=parity4[ 47: 32];
10'd62 :parity_r=parity4[ 31: 16];
10'd63 :parity_r=parity4[ 15: 0];
default:parity_r=0;
endcase
end
always @(negedge RESET_N or posedge CLK)
begin
if (~RESET_N)
begin
parity1 <=256'd0;
parity2 <=256'd0;
parity3 <=256'd0;
parity4 <=256'd0;
cir_lt_r1 <=256'd0;
cir_lt_r2 <=256'd0;
cir_lt_r3 <=256'd0;
cir_lt_r4 <=256'd0;
state <=idle;
counter <=10'b0;
encode_fin<=1;
end
else
begin
case(state)
idle:
begin
parity1 <=256'd0;
parity2 <=256'd0;
parity3 <=256'd0;
parity4 <=256'd0;
cir_lt_r1<=cir_lt1;
cir_lt_r2<=cir_lt2;
cir_lt_r3<=cir_lt3;
cir_lt_r4<=cir_lt4;
state <=(start_encode) ? encode : idle;
counter <=0;
encode_fin<= ~(start_encode);
end
encode:
begin
parity1 <=parity1^cir_lt_r10^cir_lt_r11^cir_lt_r12^cir_lt_r13^cir_lt_r14^cir_lt_r15^cir_lt_r16^cir_lt_r17^cir_lt_r18^cir_lt_r19^cir_lt_r110^cir_lt_r111^cir_lt_r112^cir_lt_r113^cir_lt_r114^cir_lt_r115;
parity2 <=parity2^cir_lt_r20^cir_lt_r21^cir_lt_r22^cir_lt_r23^cir_lt_r24^cir_lt_r25^cir_lt_r26^cir_lt_r27^cir_lt_r28^cir_lt_r29^cir_lt_r210^cir_lt_r211^cir_lt_r212^cir_lt_r213^cir_lt_r214^cir_lt_r215;
parity3 <=parity3^cir_lt_r30^cir_lt_r31^cir_lt_r32^cir_lt_r33^cir_lt_r34^cir_lt_r35^cir_lt_r36^cir_lt_r37^cir_lt_r38^cir_lt_r39^cir_lt_r310^cir_lt_r311^cir_lt_r312^cir_lt_r313^cir_lt_r314^cir_lt_r315;
parity4 <=parity4^cir_lt_r40^cir_lt_r41^cir_lt_r42^cir_lt_r43^cir_lt_r44^cir_lt_r45^cir_lt_r46^cir_lt_r47^cir_lt_r48^cir_lt_r49^cir_lt_r410^cir_lt_r411^cir_lt_r412^cir_lt_r413^cir_lt_r414^cir_lt_r415;
cir_lt_r1<={cir_lt_r1[15:0],cir_lt_r1[255:16]};
cir_lt_r2<={cir_lt_r2[15:0],cir_lt_r2[255:16]};
cir_lt_r3<={cir_lt_r3[15:0],cir_lt_r3[255:16]};
cir_lt_r4<={cir_lt_r4[15:0],cir_lt_r4[255:16]};
state <=(counter==10'd575) ? dataout : encode;
counter <=(counter==10'd575) ? 0 : counter+1;
encode_fin <=(counter==10'd575) ;
if(counter<=10'd1023)
begin
if(counter==10'd575)
begin
if(counter==10'd575)
begin
cir_lt_r1<=cir_lt1;
cir_lt_r2<=cir_lt2;
cir_lt_r3<=cir_lt3;
cir_lt_r4<=cir_lt4;
end
if(counter==10'd15)
begin
cir_lt_r1<=cir_lt5;
cir_lt_r2<=cir_lt6;
cir_lt_r3<=cir_lt7;
cir_lt_r4<=cir_lt8;
end
if(counter==10'd31)
begin
cir_lt_r1<=cir_lt9 ;
cir_lt_r2<=cir_lt10;
cir_lt_r3<=cir_lt11;
cir_lt_r4<=cir_lt12;
end
if(counter==10'd47)
begin
cir_lt_r1<=cir_lt13;
cir_lt_r2<=cir_lt14;
cir_lt_r3<=cir_lt15;
cir_lt_r4<=cir_lt16;
end
if(counter==10'd63)
begin
cir_lt_r1<=cir_lt17;
cir_lt_r2<=cir_lt18;
cir_lt_r3<=cir_lt19;
cir_lt_r4<=cir_lt20;
end
if(counter==10'd79)
begin
cir_lt_r1<=cir_lt21;
cir_lt_r2<=cir_lt22;
cir_lt_r3<=cir_lt23;
cir_lt_r4<=cir_lt24;
end
if(counter==10'd95)
begin
cir_lt_r1<=cir_lt25;
cir_lt_r2<=cir_lt26;
cir_lt_r3<=cir_lt27;
cir_lt_r4<=cir_lt28;
end
if(counter==10'd111)
begin
cir_lt_r1<=cir_lt29;
cir_lt_r2<=cir_lt30;
cir_lt_r3<=cir_lt31;
cir_lt_r4<=cir_lt32;
end
if(counter==10'd127 )
begin
cir_lt_r1<=cir_lt33;
cir_lt_r2<=cir_lt34;
cir_lt_r3<=cir_lt35;
cir_lt_r4<=cir_lt36;
end
if(counter==10'd143 )
begin
cir_lt_r1<=cir_lt37;
cir_lt_r2<=cir_lt38;
cir_lt_r3<=cir_lt39;
cir_lt_r4<=cir_lt40;
end
if(counter==10'd159 )
begin
cir_lt_r1<=cir_lt41;
cir_lt_r2<=cir_lt42;
cir_lt_r3<=cir_lt43;
cir_lt_r4<=cir_lt44;
end
if(counter==10'd175 )
begin
cir_lt_r1<=cir_lt45;
cir_lt_r2<=cir_lt46;
cir_lt_r3<=cir_lt47;
cir_lt_r4<=cir_lt48;
end
if(counter==10'd191 )
begin
cir_lt_r1<=cir_lt49;
cir_lt_r2<=cir_lt50;
cir_lt_r3<=cir_lt51;
cir_lt_r4<=cir_lt52;
end
if(counter==10'd207 )
begin
cir_lt_r1<=cir_lt53;
cir_lt_r2<=cir_lt54;
cir_lt_r3<=cir_lt55;
cir_lt_r4<=cir_lt56;
end
if(counter==10'd223 )
begin
cir_lt_r1<=cir_lt57;
cir_lt_r2<=cir_lt58;
cir_lt_r3<=cir_lt59;
cir_lt_r4<=cir_lt60;
end
if(counter==10'd239 )
begin
cir_lt_r1<=cir_lt61;
cir_lt_r2<=cir_lt62;
cir_lt_r3<=cir_lt63;
cir_lt_r4<=cir_lt64;
end
if(counter==10'd255 )
begin
cir_lt_r1<=cir_lt65;
cir_lt_r2<=cir_lt66;
cir_lt_r3<=cir_lt67;
cir_lt_r4<=cir_lt68;
end
if(counter==10'd271 )
begin
cir_lt_r1<=cir_lt69;
cir_lt_r2<=cir_lt70;
cir_lt_r3<=cir_lt71;
cir_lt_r4<=cir_lt72;
end
if(counter==10'd287 )
begin
cir_lt_r1<=cir_lt73;
cir_lt_r2<=cir_lt74;
cir_lt_r3<=cir_lt75;
cir_lt_r4<=cir_lt76;
end
if(counter==10'd303 )
begin
cir_lt_r1<=cir_lt77;
cir_lt_r2<=cir_lt78;
cir_lt_r3<=cir_lt79;
cir_lt_r4<=cir_lt80;
end
if(counter==10'd319 )
begin
cir_lt_r1<=cir_lt81;
cir_lt_r2<=cir_lt82;
cir_lt_r3<=cir_lt83;
cir_lt_r4<=cir_lt84;
end
if(counter==10'd335 )
begin
cir_lt_r1<=cir_lt85;
cir_lt_r2<=cir_lt86;
cir_lt_r3<=cir_lt87;
cir_lt_r4<=cir_lt88;
end
if(counter==10'd351 )
begin
cir_lt_r1<=cir_lt89;
cir_lt_r2<=cir_lt90;
cir_lt_r3<=cir_lt91;
cir_lt_r4<=cir_lt92;
end
if(counter==10'd367 )
begin
cir_lt_r1<=cir_lt93;
cir_lt_r2<=cir_lt94;
cir_lt_r3<=cir_lt95;
cir_lt_r4<=cir_lt96;
end
if(counter==10'd383 )
begin
cir_lt_r1<=cir_lt97 ;
cir_lt_r2<=cir_lt98 ;
cir_lt_r3<=cir_lt99 ;
cir_lt_r4<=cir_lt100;
end
if(counter==10'd399 )
begin
cir_lt_r1<=cir_lt101;
cir_lt_r2<=cir_lt102;
cir_lt_r3<=cir_lt103;
cir_lt_r4<=cir_lt104;
end
if(counter==10'd415 )
begin
cir_lt_r1<=cir_lt105;
cir_lt_r2<=cir_lt106;
cir_lt_r3<=cir_lt107;
cir_lt_r4<=cir_lt108;
end
if(counter==10'd431 )
begin
cir_lt_r1<=cir_lt109;
cir_lt_r2<=cir_lt110;
cir_lt_r3<=cir_lt111;
cir_lt_r4<=cir_lt112;
end
if(counter==10'd447 )
begin
cir_lt_r1<=cir_lt113;
cir_lt_r2<=cir_lt114;
cir_lt_r3<=cir_lt115;
cir_lt_r4<=cir_lt116;
end
if(counter==10'd463 )
begin
cir_lt_r1<=cir_lt117;
cir_lt_r2<=cir_lt118;
cir_lt_r3<=cir_lt119;
cir_lt_r4<=cir_lt120;
end
if(counter==10'd479 )
begin
cir_lt_r1<=cir_lt121;
cir_lt_r2<=cir_lt122;
cir_lt_r3<=cir_lt123;
cir_lt_r4<=cir_lt124;
end
if(counter==10'd495 )
begin
cir_lt_r1<=cir_lt125;
cir_lt_r2<=cir_lt126;
cir_lt_r3<=cir_lt127;
cir_lt_r4<=cir_lt128;
end
if(counter==10'd511 )
begin
cir_lt_r1<=cir_lt129;
cir_lt_r2<=cir_lt130;
cir_lt_r3<=cir_lt131;
cir_lt_r4<=cir_lt132;
end
if(counter==10'd527 )
begin
cir_lt_r1<=cir_lt133;
cir_lt_r2<=cir_lt134;
cir_lt_r3<=cir_lt135;
cir_lt_r4<=cir_lt136;
end
if(counter==10'd543 )
begin
cir_lt_r1<=cir_lt137;
cir_lt_r2<=cir_lt138;
cir_lt_r3<=cir_lt139;
cir_lt_r4<=cir_lt140;
end
if(counter==10'd559 )
begin
cir_lt_r1<=cir_lt141;
cir_lt_r2<=cir_lt142;
cir_lt_r3<=cir_lt143;
cir_lt_r4<=cir_lt144;
end
end
end
dataout:
begin
state <=(counter==10'd64) ? idle : dataout;
counter <=(counter==10'd64) ? 0 : counter+1;
encode_fin<=1;
end
default:
begin
state <=idle;
counter <=0;
encode_fin<=1;
end
endcase
end
end
endmodule
module LDPCDECg5p16v8(
CLK,RESET_N,start_ldpc,start_Ldata,maxiter,
chdata,
hb_count,
hardbit,
enga_en,dec_fin,dec_fail,hb_vlid,
ch_counta,ch_countb,addr_count);
input CLK,RESET_N,start_ldpc,start_Ldata;
input [4:0] maxiter;
input [47:0] chdata;
output [3:0] hb_count;
output [3:0] addr_count;
output [15:0] hardbit;
output enga_en,dec_fin,dec_fail,hb_vlid;
output [12:0] ch_counta,ch_countb;
parameter max_iter=8;
wire data_wrsa,data_wrsb,
deca_en,decb_en,hb_en,hb_vlid,
load_data_en,
memwra_en,memwrb_en,
start_ldpc,dec_fin,vncn_en;
wire enga_en=data_wrsa;
wire [3:0] hb_count;
wire [3:0] addr_count,addr_ch_count;
wire [12:0] ch_counta,ch_countb;
wire [1:0] layer_i,section,section_r,section_ch,section_hb;
wire [4:0] iter_count;
wire [3:0] vncn_count;
wire [1:0] min1,min2,min3,min4,min5,min6,min7,min8,
min9,min10,min11,min12,min13,min14,min15,min16,
min17,min18,min19,min20,min21,min22,min23,min24,
min25,min26,min27,min28,min29,min30,min31,min32,
min33,min34,min35,min36,min37,min38,min39,min40,
min41,min42,min43,min44,min45,min46,min47,min48,
min49,min50,min51,min52,min53,min54,min55,min56,
min57,min58,min59,min60,min61,min62,min63,min64,
min65,min66,min67,min68,min69,min70,min71,min72,
min73,min74,min75,min76,min77,min78,min79,min80;
wire [31:0] hbout1,hbout2,hbout3,hbout4,hbout5;
wire [15:0] hbout_o;
wire [15:0] sgn1,sgn2,sgn3,sgn4,sgn5;
wire [15:0] sgn_i=sgn1^sgn2^sgn3^sgn4^sgn5;
reg parity_reg,dec_fail,tmn;
wire [7:0] rotat_en1,rotat_en2,rotat_en3,
rotat_en4,rotat_en5;
reg [7:0] rotat_en1_r,rotat_en2_r,rotat_en3_r,
rotat_en4_r,rotat_en5_r;
always @(negedge RESET_N or posedge CLK)
begin
if (~RESET_N)
begin
parity_reg<=0;
dec_fail <=0;
tmn <=0;
rotat_en1_r <=0;
rotat_en2_r <=0;
rotat_en3_r <=0;
rotat_en4_r <=0;
rotat_en5_r <=0;
end
else
begin
tmn<= (iter_count==3'd0 & ~( vncn_count==4'd11 & addr_count==4'd15 & layer_i==2'd3))?
1'b0 :
(vncn_count==4'd11 & addr_count==4'd15 & layer_i==2'd3)?
~(parity_reg):tmn;
if(vncn_count>4'd4)
parity_reg<=parity_reg | sgn_i[0]
| sgn_i[1] | sgn_i[2]
| sgn_i[3] | sgn_i[4]
| sgn_i[5] | sgn_i[6]
| sgn_i[7] | sgn_i[8]
| sgn_i[9] | sgn_i[10]
| sgn_i[11] | sgn_i[12]
| sgn_i[13] | sgn_i[14]
| sgn_i[15] ;
if(addr_count==4'd0 && layer_i==2'd0 )
parity_reg<=0;// reset parity_reg
if(addr_count==4'd15 && layer_i==2'd3 && iter_count==3'd7)
dec_fail <=parity_reg;
rotat_en1_r <=rotat_en1;
rotat_en2_r <=rotat_en2;
rotat_en3_r <=rotat_en3;
rotat_en4_r <=rotat_en4;
rotat_en5_r <=rotat_en5;
end
end
wire [2:0] memgroup_hb;
wire [15:0] hardbit=hbout_o;
wire [31:0] hbout_w= (memgroup_hb==3'd0)? hbout1:
(memgroup_hb==3'd1)? hbout2:
(memgroup_hb==3'd2)? hbout3:
(memgroup_hb==3'd3)? hbout4: hbout5;
wire hboutmux;
wire [15:0] hbout=(hboutmux)? hbout_w[31:16] : hbout_w[15:0];
wire [47:0] chdata, chdata_o;
wire [2:0] memid;
wire [2:0] memgroup;
wire [4:0] minaddrtop1,minaddrtop2,minaddrtop3,minaddrtop4,
minaddrtop5,minaddrtop6,minaddrtop7,minaddrtop8,
minaddrtop9,minaddrtop10,minaddrtop11,minaddrtop12,
minaddrtop13,minaddrtop14,minaddrtop15,minaddrtop16;
wire [1:0] secmintop1,secmintop2,secmintop3,secmintop4,
secmintop5,secmintop6,secmintop7,secmintop8,
secmintop9,secmintop10,secmintop11,secmintop12,
secmintop13,secmintop14,secmintop15,secmintop16,
mintop1,mintop2,mintop3,mintop4,
mintop5,mintop6,mintop7,mintop8,
mintop9,mintop10,mintop11,mintop12,
mintop13,mintop14,mintop15,mintop16;
wire [79:0] mtv1,mtv2,
mtv9,mtv10,
mtv17,mtv18,
mtv25,mtv26,
mtv33,mtv34,
mtv1_w,mtv2_w,
mtv9_w,mtv10_w,
mtv17_w,mtv18_w,
mtv25_w,mtv26_w,
mtv33_w,mtv34_w;
wire [79:0] sumdata1,sumdata2,
sumdata9,sumdata10,
sumdata17,sumdata18,
sumdata25,sumdata26,
sumdata33,sumdata34,
sumdata1_w,sumdata2_w,
sumdata9_w,sumdata10_w,
sumdata17_w,sumdata18_w,
sumdata25_w,sumdata26_w,
sumdata33_w,sumdata34_w;
wire [16:1]
min_loc1 ={(minaddrtop16[0]),(minaddrtop15[0]),
(minaddrtop14[0]),(minaddrtop13[0]),
(minaddrtop12[0]),(minaddrtop11[0]),
(minaddrtop10[0]),(minaddrtop9 [0]),
(minaddrtop8 [0]),(minaddrtop7 [0]),
(minaddrtop6 [0]),(minaddrtop5 [0]),
(minaddrtop4 [0]),(minaddrtop3 [0]),
(minaddrtop2 [0]),(minaddrtop1 [0])},
min_loc2 ={(minaddrtop16[1]),(minaddrtop15[1]),
(minaddrtop14[1]),(minaddrtop13[1]),
(minaddrtop12[1]),(minaddrtop11[1]),
(minaddrtop10[1]),(minaddrtop9 [1]),
(minaddrtop8 [1]),(minaddrtop7 [1]),
(minaddrtop6 [1]),(minaddrtop5 [1]),
(minaddrtop4 [1]),(minaddrtop3 [1]),
(minaddrtop2 [1]),(minaddrtop1 [1])},
min_loc3 ={(minaddrtop16[2]),(minaddrtop15[2]),
(minaddrtop14[2]),(minaddrtop13[2]),
(minaddrtop12[2]),(minaddrtop11[2]),
(minaddrtop10[2]),(minaddrtop9 [2]),
(minaddrtop8 [2]),(minaddrtop7 [2]),
(minaddrtop6 [2]),(minaddrtop5 [2]),
(minaddrtop4 [2]),(minaddrtop3 [2]),
(minaddrtop2 [2]),(minaddrtop1 [2])},
min_loc4 ={(minaddrtop16[3]),(minaddrtop15[3]),
(minaddrtop14[3]),(minaddrtop13[3]),
(minaddrtop12[3]),(minaddrtop11[3]),
(minaddrtop10[3]),(minaddrtop9 [3]),
(minaddrtop8 [3]),(minaddrtop7 [3]),
(minaddrtop6 [3]),(minaddrtop5 [3]),
(minaddrtop4 [3]),(minaddrtop3 [3]),
(minaddrtop2 [3]),(minaddrtop1 [3])},
min_loc5 ={(minaddrtop16[4]),(minaddrtop15[4]),
(minaddrtop14[4]),(minaddrtop13[4]),
(minaddrtop12[4]),(minaddrtop11[4]),
(minaddrtop10[4]),(minaddrtop9 [4]),
(minaddrtop8 [4]),(minaddrtop7 [4]),
(minaddrtop6 [4]),(minaddrtop5 [4]),
(minaddrtop4 [4]),(minaddrtop3 [4]),
(minaddrtop2 [4]),(minaddrtop1 [4])};
wire [47:0] ctm1,ctm2,ctm3,ctm4,ctm5,
ctm6,ctm7,ctm8,ctm9,ctm10,
ctm1_w,ctm2_w,ctm3_w,ctm4_w,
ctm5_w,ctm6_w,ctm7_w,ctm8_w,
ctm9_w,ctm10_w;
wire grouploaddata_en1=(memgroup==3'd0) & load_data_en,
grouploaddata_en2=(memgroup==3'd1) & load_data_en,
grouploaddata_en3=(memgroup==3'd2) & load_data_en,
grouploaddata_en4=(memgroup==3'd3) & load_data_en,
grouploaddata_en5=(memgroup==3'd4) & load_data_en;
invrotatreg invrotatreg(
.RESET_N(RESET_N),
.CLK(CLK),
.start_ldpc(start_ldpc),
.hb_en(hb_en),
.data_wrsa(data_wrsa),
.data_wrsb(data_wrsb),
.hbout(hbout),
.hbout_o(hbout_o) );
controller controller(
.RESET_N(RESET_N),
.CLK(CLK),
.tmn(tmn),
.start_ldpc(start_ldpc),
.maxiter(maxiter),
.start_Ldata(start_Ldata),
.data_wrsa(data_wrsa),
.data_wrsb(data_wrsb),
.deca_en(deca_en),
.decb_en(decb_en),
.hb_vlid(hb_vlid),
.hb_en(hb_en),
.load_data_en(load_data_en),
.dec_fin(dec_fin),
.vncn_en(vncn_en),
.memwra_en(memwra_en),
.memwrb_en(memwrb_en),
.layer_i(layer_i),
.section(section),
.section_r(section_r),
.iter_count(iter_count),
.vncn_count(vncn_count),
.ch_counta(ch_counta),
.ch_countb(ch_countb),
.addr_count(addr_count),
.addr_ch_count(addr_ch_count),
.hb_count(hb_count),
.hboutmux(hboutmux),
.memgroup_hb(memgroup_hb),
.section_hb(section_hb) );
rotatreg rotatreg(
.RESET_N(RESET_N),
.CLK(CLK),
.start_Ldata(start_Ldata),
.load_data_en(load_data_en),
.data_wrsa(data_wrsa),
.data_wrsb(data_wrsb),
.chdata(chdata),
.chdata_o(chdata_o),
.memid(memid),
.memgroup(memgroup),
.section_ch(section_ch) );
wire [3:0] circulant1 =4'd0 ; //0 0 0
wire [3:0] circulant2 =4'd15; //63 15 3
wire [3:0] circulant3 =4'd15; //191 15 11
wire [3:0] circulant4 =4'd11; //155 11 9
wire [3:0] circulant5 =4'd7 ; //23 7 1
wire [3:0] circulant6 =4'd1 ; //97 1 6
wire [3:0] circulant7 =4'd5 ; //197 5 12
wire [3:0] circulant8 =4'd10; //58 10 3
wire [3:0] circulant9 =4'd0 ; //0 0 0
wire [3:0] circulant10 =4'd5 ; //213 5 13
wire [3:0] circulant11 =4'd0 ; //112 0 7
wire [3:0] circulant12 =4'd13; //141 13 8
wire [3:0] circulant13 =4'd5 ; //101 5 6
wire [3:0] circulant14 =4'd5 ; //53 5 3
wire [3:0] circulant15 =4'd1 ; //209 1 13
wire [3:0] circulant16 =4'd2 ; //146 2 9
wire [3:0] circulant17 =4'd0 ; //0 0 0
wire [3:0] circulant18 =4'd7 ; //231 7 14
wire [3:0] circulant19 =4'd6 ; //198 6 12
wire [3:0] circulant20 =4'd6 ; //214 6 13
wire [3:0] circulant21 =4'd6 ; //54 6 3
wire [3:0] circulant22 =4'd13; //253 13 15
wire [3:0] circulant23 =4'd10; //106 10 6
wire [3:0] circulant24 =4'd4 ; //244 4 15
wire [3:0] circulant25 =4'd15; //95 15 5
wire [3:0] circulant26 =4'd8 ; //120 8 7
wire [3:0] circulant27 =4'd2 ; //82 2 5
wire [3:0] circulant28 =4'd8 ; //24 8 1
wire [3:0] circulant29 =4'd3 ; //3 3 0
wire [3:0] circulant30 =4'd2 ; //146 2 9
wire [3:0] circulant31 =4'd9 ; //153 9 9
wire [3:0] circulant32 =4'd2 ; //194 2 12
wire [3:0] circulant33 =4'd10; //250 10 15
wire [3:0] circulant34 =4'd11; //171 11 10
wire [3:0] circulant35 =4'd11; //27 11 1
wire [3:0] circulant36 =4'd7 ; //247 7 15
wire [3:0] circulant37 =4'd5 ; //101 5 6
wire [3:0] circulant38 =4'd14; //222 14 13
wire [3:0] circulant39 =4'd1 ; //145 1 9
wire [3:0] circulant40 =4'd1 ; //33 1 2
wire [3:0] circulant41 =4'd9 ; //233 9 14
wire [3:0] circulant42 =4'd10; //10 10 0
wire [3:0] circulant43 =4'd13; //205 13 12
wire [3:0] circulant44 =4'd13; //189 13 11
wire [3:0] circulant45 =4'd12; //28 12 1
wire [3:0] circulant46 =4'd12; //124 12 7
wire [3:0] circulant47 =4'd2 ; //66 2 4
wire [3:0] circulant48 =4'd13; //221 13 13
wire [3:0] circulant49 =4'd5 ; //229 5 14
wire [3:0] circulant50 =4'd12; //12 12 0
wire [3:0] circulant51 =4'd2 ; //210 2 13
wire [3:0] circulant52 =4'd9 ; //73 9 4
wire [3:0] circulant53 =4'd0 ; //0 0 0
wire [3:0] circulant54 =4'd13; //141 13 8
wire [3:0] circulant55 =4'd10; //58 10 3
wire [3:0] circulant56 =4'd15; //15 15 0
wire [3:0] circulant57 =4'd11; //75 11 4
wire [3:0] circulant58 =4'd6 ; //230 6 14
wire [3:0] circulant59 =4'd7 ; //231 7 14
wire [3:0] circulant60 =4'd15; //127 15 7
wire [3:0] circulant61 =4'd1 ; //49 1 3
wire [3:0] circulant62 =4'd4 ; //196 4 12
wire [3:0] circulant63 =4'd14; //78 14 4
wire [3:0] circulant64 =4'd12; //44 12 2
wire [3:0] circulant65 =4'd9 ; //25 9 1
wire [3:0] circulant66 =4'd3 ; //35 3 2
wire [3:0] circulant67 =4'd9 ; //57 9 3
wire [3:0] circulant68 =4'd13; //237 13 14
wire [3:0] circulant69 =4'd5 ; //69 5 4
wire [3:0] circulant70 =4'd7 ; //23 7 1
wire [3:0] circulant71 =4'd6 ; //166 6 10
wire [3:0] circulant72 =4'd1 ; //97 1 6
wire [3:0] circulant73 =4'd12; //12 12 0
wire [3:0] circulant74 =4'd8 ; //216 8 13
wire [3:0] circulant75 =4'd8 ; //216 8 13
wire [3:0] circulant76 =4'd8 ; //200 8 12
wire [3:0] circulant77 =4'd13; //109 13 6
wire [3:0] circulant78 =4'd11; //43 11 2
wire [3:0] circulant79 =4'd13; //189 13 11
wire [3:0] circulant80 =4'd0 ; //208 0 13
wire [3:0] circulant81 =4'd2 ; //130 2 8