forked from Elphel/x393
-
Notifications
You must be signed in to change notification settings - Fork 0
/
x393.v
3617 lines (3370 loc) · 207 KB
/
x393.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
/*!
* <b>Module:</b> x393
* @file x393.v
* @date 2015-01-13
* @author Andrey Filippov
*
* @copyright Copyright (c) 2015 Elphel, Inc.
*
* @brief Elphel NC393 camera FPGA top module
*
* <b>License:</b>
*
* x393.v is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* x393.v is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/> .
*
* Additional permission under GNU GPL version 3 section 7:
* If you modify this Program, or any covered work, by linking or combining it
* with independent modules provided by the FPGA vendor only (this permission
* does not extend to any 3-rd party modules, "soft cores" or macros) under
* different license terms solely for the purpose of generating binary "bitstream"
* files and/or simulating the code, the copyright holders of this Program give
* you the right to distribute the covered work without those independent modules
* as long as the source code for them is available from the FPGA vendor free of
* charge, and there is no dependence on any encrypted modules for simulating of
* the combined code. This permission applies to you if the distributed code
* contains all the components and scripts required to completely simulate it
* with at least one of the Free Software programs.
*/
//`define DEBUG_SAXI1 1
`timescale 1ns/1ps
`include "system_defines.vh"
module x393 #(
`include "includes/x393_parameters.vh" // SuppressThisWarning VEditor - some not used
)(
// Sensors interface: I/O pads, pin names match circuit diagram (each sensor)
`ifdef HISPI
input [3:0] sns1_dp,
input [3:0] sns1_dn,
inout [7:4] sns1_dp74, // other non-diff signals
inout [7:4] sns1_dn74, // other non-diff signals
input sns1_clkp,
input sns1_clkn,
inout sns1_scl,
inout sns1_sda,
inout sns1_ctl,
inout sns1_pg,
input [3:0] sns2_dp,
input [3:0] sns2_dn,
inout [7:4] sns2_dp74, // other non-diff signals
inout [7:4] sns2_dn74, // other non-diff signals
input sns2_clkp,
input sns2_clkn,
inout sns2_scl,
inout sns2_sda,
inout sns2_ctl,
inout sns2_pg,
input [3:0] sns3_dp,
input [3:0] sns3_dn,
inout [7:4] sns3_dp74, // other non-diff signals
inout [7:4] sns3_dn74, // other non-diff signals
input sns3_clkp,
input sns3_clkn,
inout sns3_scl,
inout sns3_sda,
inout sns3_ctl,
inout sns3_pg,
input [3:0] sns4_dp,
input [3:0] sns4_dn,
inout [7:4] sns4_dp74, // other non-diff signals
inout [7:4] sns4_dn74, // other non-diff signals
input sns4_clkp,
input sns4_clkn,
inout sns4_scl,
inout sns4_sda,
inout sns4_ctl,
inout sns4_pg,
`else
inout [7:0] sns1_dp,
inout [7:0] sns1_dn,
inout sns1_clkp,
inout sns1_clkn,
inout sns1_scl,
inout sns1_sda,
inout sns1_ctl,
inout sns1_pg,
inout [7:0] sns2_dp,
inout [7:0] sns2_dn,
inout sns2_clkp,
inout sns2_clkn,
inout sns2_scl,
inout sns2_sda,
inout sns2_ctl,
inout sns2_pg,
inout [7:0] sns3_dp,
inout [7:0] sns3_dn,
inout sns3_clkp,
inout sns3_clkn,
inout sns3_scl,
inout sns3_sda,
inout sns3_ctl,
inout sns3_pg,
inout [7:0] sns4_dp,
inout [7:0] sns4_dn,
inout sns4_clkp,
inout sns4_clkn,
inout sns4_scl,
inout sns4_sda,
inout sns4_ctl,
inout sns4_pg,
`endif
// GPIO pins (1.5V): assigned in 10389: [1:0] - i2c, [5:2] - gpio, [GPIO_N-1:6] - sync i/o
inout [GPIO_N-1:0] gpio_pins,
// DDR3 interface
output SDRST, // DDR3 reset (active low)
output SDCLK, // DDR3 clock differential output, positive
output SDNCLK,// DDR3 clock differential output, negative
output [ADDRESS_NUMBER-1:0] SDA, // output address ports (14:0) for 4Gb device
output [2:0] SDBA, // output bank address ports
output SDWE, // output WE port
output SDRAS, // output RAS port
output SDCAS, // output CAS port
output SDCKE, // output Clock Enable port
output SDODT, // output ODT port
inout [15:0] SDD, // DQ I/O pads
output SDDML, // LDM I/O pad (actually only output)
inout DQSL, // LDQS I/O pad
inout NDQSL, // ~LDQS I/O pad
output SDDMU, // UDM I/O pad (actually only output)
inout DQSU, // UDQS I/O pad
inout NDQSU,
// Clock inputs
input memclk, // M5
input ffclk0p, // Y12
input ffclk0n, // Y11
input ffclk1p, // W14
input ffclk1n, // W13
// SATA data interface
input RXN,
input RXP,
output TXN,
output TXP,
// sata clocking iface
input EXTCLK_P,
input EXTCLK_N
);
`include "fpga_version.vh"
// Source for reset and clock
`ifndef IGNORE_ATTR
(* KEEP = "TRUE" *)
`endif
wire [3:0] fclk; // PL Clocks [3:0], output
`ifndef IGNORE_ATTR
(* KEEP = "TRUE" *)
`endif
wire [3:0] frst; // PL Clocks [3:0], output
// AXI write interface signals
wire axi_aclk; // clock - should be buffered
wire axi_grst; // reset, active high, global (try to get rid of) - trying, removed BUFG
// AXI Write Address
wire [31:0] maxi0_awaddr; // AWADDR[31:0], input
wire maxi0_awvalid; // AWVALID, input
wire maxi0_awready; // AWREADY, output
wire [11:0] maxi0_awid; // AWID[11:0], input
wire [ 3:0] maxi0_awlen; // AWLEN[3:0], input
wire [ 1:0] maxi0_awsize; // AWSIZE[1:0], input
wire [ 1:0] maxi0_awburst; // AWBURST[1:0], input
// AXI PS Master GP0: Write Data
wire [31:0] maxi0_wdata; // WDATA[31:0], input
wire maxi0_wvalid; // WVALID, input
wire maxi0_wready; // WREADY, output
wire [11:0] maxi0_wid; // WID[11:0], input
wire maxi0_wlast; // WLAST, input
wire [ 3:0] maxi0_wstb; // WSTRB[3:0], input
// AXI PS Master GP0: Write response
wire maxi0_bvalid; // BVALID, output
wire maxi0_bready; // BREADY, input
wire [11:0] maxi0_bid; // BID[11:0], output
wire [ 1:0] maxi0_bresp; // BRESP[1:0], output
// BRAM (and other write modules) interface from AXI write
wire [AXI_WR_ADDR_BITS-1:0] axiwr_pre_awaddr; // same as awaddr_out, early address to decode and return dev_ready
wire axiwr_start_burst; // start of write burst, valid pre_awaddr, save externally to control ext. dev_ready multiplexer
wire axiwr_dev_ready; // extrernal combinatorial ready signal, multiplexed from different sources according to pre_awaddr@start_burst
wire axiwr_wclk;
wire [AXI_WR_ADDR_BITS-1:0] axiwr_waddr;
wire axiwr_wen; // external memory write enable, (internally combined with registered dev_ready
// SuppressWarnings VEditor unused (yet?)
wire [3:0] axiwr_bram_wstb;
wire [31:0] axiwr_wdata;
// AXI Read Address
wire [31:0] maxi0_araddr; // ARADDR[31:0], input
wire maxi0_arvalid; // ARVALID, input
wire maxi0_arready; // ARREADY, output
wire [11:0] maxi0_arid; // ARID[11:0], input
wire [ 3:0] maxi0_arlen; // ARLEN[3:0], input
wire [ 1:0] maxi0_arsize; // ARSIZE[1:0], input
wire [ 1:0] maxi0_arburst; // ARBURST[1:0], input
// AXI Read Data
wire [31:0] maxi0_rdata; // RDATA[31:0], output
wire maxi0_rvalid; // RVALID, output
wire maxi0_rready; // RREADY, input
wire [11:0] maxi0_rid; // RID[11:0], output
wire maxi0_rlast; // RLAST, output
wire [ 1:0] maxi0_rresp;
// External memory synchronization
wire [AXI_RD_ADDR_BITS-1:0] axird_pre_araddr; // same as awaddr_out, early address to decode and return dev_ready
wire axird_start_burst; // start of read burst, valid pre_araddr, save externally to control ext. dev_ready multiplexer
wire axird_dev_ready; // extrernal combinatorial ready signal, multiplexed from different sources according to pre_araddr@start_burst
// External memory interface
// SuppressWarnings VEditor unused (yet?) - use mclk
wire axird_bram_rclk; // == axi_aclk .rclk(aclk), // clock for read port
// while only status provides read data, the next signals are not used (relies on axird_pre_araddr, axird_start_burst)
wire [AXI_RD_ADDR_BITS-1:0] axird_raddr; // .raddr(read_in_progress?read_address[9:0]:10'h3ff), // read address
wire axird_ren; // .ren(bram_reg_re_w) , // read port enable
wire axird_regen; // .regen(bram_reg_re_w), // output register enable
wire [31:0] axird_rdata; // .data_out(rdata[31:0]), // data out
// wire [31:0] port0_rdata; //
wire [31:0] status_rdata; //
wire status_selected;
wire [31:0] readback_rdata; //
wire readback_selected;
wire [31:0] mcntrl_axird_rdata; // read data from the memory controller
wire mcntrl_axird_selected; // memory controller has valid data output on mcntrl_axird_rdata
reg status_selected_ren; // status_selected (set at axird_start_burst) delayed when ren is active
reg readback_selected_ren;
reg mcntrl_axird_selected_ren; // mcntrl_axird_selected (set at axird_start_burst) delayed when ren is active
reg status_selected_regen; // status_selected (set at axird_start_burst) delayed when ren is active, then when regen (normally 2 cycles)
reg readback_selected_regen;
reg mcntrl_axird_selected_regen; // mcntrl_axird_selected (set at axird_start_burst) delayed when ren is active, then when regen (normally 2 cycles)
// global clocks
wire mclk; // global clock, memory controller, command/status network (currently 200MHz)
wire mcntrl_locked; // to generate syn resets
wire ref_clk; // global clock for idelay_ctrl calibration
wire hclk; // global clock, axi_hp (150MHz) derived from aclk_in = 50MHz
// sensor pixel rate clock likely to originate from the external clock
//TODO: Create missing clocks
wire pclk; // global clock, sensor pixel rate (96 MHz)
`ifdef USE_PCLK2X
wire pclk2x; // global clock, sensor double pixel rate (192 MHz)
`endif
// compressor pixel rate can be adjusted independently
wire xclk; // global clock, compressor pixel rate (100 MHz)?
`ifdef USE_XCLK2X
wire xclk2x; // global clock, compressor double pixel rate (200 MHz)
`endif
wire camsync_clk; // global clock used for external synchronization. 96MHz in x353.
// Make it independent of pixel, compressor and mclk so it can be frozen
wire logger_clk; // global clock for the event logger. Use 100 MHz, shared with camsync_clk
assign logger_clk = camsync_clk;
wire mrst; // @ posedge mclk
wire prst; // @ posedge pclk
wire xrst; // @ posedge xclk
wire crst; // @ posedge camsync_clk
wire lrst; // @ posedge logger_clk;
wire arst; // @ posedge axi_aclk;
wire hrst; // @ posedge hclk;
wire locked_sync_clk;
wire locked_xclk;
wire locked_pclk;
wire locked_hclk;
wire idelay_ctrl_reset; // to reset idelay_cntrl
wire time_ref; // RTC reference: integer number of microseconds, less than mclk/2. Not a global clock
wire [11:0] tmp_debug;
// reg select_port0; // May be used later!
wire axiwr_dev_busy;
wire axird_dev_busy;
//TODO: The following is the interface to the frame-based command sequencer (not yet implemnted)
wire [AXI_WR_ADDR_BITS-1:0] cseq_waddr; // command sequencer write address (output to command multiplexer)
wire cseq_wr_en; // command sequencer write enable (output to command multiplexer) - keep until cseq_ackn received
wire [31:0] cseq_wdata; // command sequencer write data (output to command multiplexer)
wire cseq_ackn; // ackn to command sequencer, command sequencer should de-assert cseq_wr_en
// Signals for the frame sequnecer/mux
wire [4 * AXI_WR_ADDR_BITS-1:0] frseq_waddr;
wire [3:0] frseq_valid;
wire [127:0] frseq_wdata;
wire [3:0] frseq_ackn;
wire [3:0] frseq_is;
wire [3:0] frseq_im;
wire [3:0] frseq_irq = frseq_is & frseq_im; // frame interrupts
// parallel address/data - where higher bandwidth (single-cycle) is needed
wire [AXI_WR_ADDR_BITS-1:0] par_waddr;
wire [31:0] par_data;
wire [7:0] cmd_root_ad; // multiplexed byte-wide serialized address/data to slave devices (AL-AH-D0-D1-D2-D3), may contain less cycles
wire cmd_root_stb; // strobe marking the first of 1-6 a/d bytes and also data valid for par_waddr and par_data
wire [7:0] status_root_ad; // Root status byte-wide address/data
wire status_root_rq; // Root status request
wire status_root_start; // Root status packet transfer start (currently with 0 latency from status_root_rq)
wire [7:0] status_mcontr_ad; // Memory controller status byte-wide address/data
wire status_mcontr_rq; // Memory controller status request
wire status_mcontr_start; // Memory controller status packet transfer start (currently with 0 latency from status_root_rq)
// Not yet connected
wire [7:0] status_membridge_ad; // membridge (afi to ddr3) status byte-wide address/data
wire status_membridge_rq; // membridge (afi to ddr3) status request
wire status_membridge_start; //membridge (afi to ddr3) status packet transfer start (currently with 0 latency from status_root_rq)
// wire [7:0] status_other_ad = 0; // Other status byte-wide address/data
// wire status_other_rq = 0; // Other status request
// wire status_other_start; //
wire [7:0] status_test01_ad; // Test module status byte-wide address/data
wire status_test01_rq; // Test module status request
wire status_test01_start; // Test module status packet transfer start (currently with 0 latency from status_root_rq)
wire [7:0] status_sensor_ad; // Other status byte-wide address/data
wire status_sensor_rq; // Other status request
wire status_sensor_start; //
wire [7:0] status_compressor_ad; // Other status byte-wide address/data
wire status_compressor_rq; // Other status request
wire status_compressor_start; //
// TODO: Add sequencer status (16+2) bits of current frame number. Ose 'h31 as the address, 'h702 (701..703 were empty) to program
wire [7:0] status_sequencer_ad; // Other status byte-wide address/data
wire status_sequencer_rq; // Other status request
wire status_sequencer_start; // S uppressThisWarning VEditor ****** Other status packet transfer start (currently with 0 latency from status_root_rq)
wire [7:0] status_logger_ad; // Other status byte-wide address/data
wire status_logger_rq; // Other status request
wire status_logger_start; // S uppressThisWarning VEditor ****** Other status packet transfer start (currently with 0 latency from status_root_rq)
wire [7:0] status_timing_ad; // Other status byte-wide address/data
wire status_timing_rq; // Other status request
wire status_timing_start; // S uppressThisWarning VEditor ****** Other status packet transfer start (currently with 0 latency from status_root_rq)
wire [7:0] status_gpio_ad; // Other status byte-wide address/data
wire status_gpio_rq; // Other status request
wire status_gpio_start; // S uppressThisWarning VEditor ****** Other status packet transfer start (currently with 0 latency from status_root_rq)
wire [7:0] status_saxi1wr_ad; // saxi1 - logger data Other status byte-wide address/data
wire status_saxi1wr_rq; // Other status request
wire status_saxi1wr_start; // S uppressThisWarning VEditor ****** Other status packet transfer start (currently with 0 latency from status_root_rq)
wire [7:0] status_clocks_ad; // saxi1 - logger data Other status byte-wide address/data
wire status_clocks_rq; // Other status request
wire status_clocks_start; // S uppressThisWarning VEditor ****** Other status packet transfer start (currently with 0 latency from status_root_rq)
`ifdef DEBUG_SENS_MEM_PAGES
wire [7:0] dbg_rpage;
wire [7:0] dbg_wpage;
`endif
`ifdef DEBUG_RING
wire [7:0] status_debug_ad; // saxi1 - logger data Other status byte-wide address/data
wire status_debug_rq; // Other status request
wire status_debug_start; // S uppressThisWarning VEditor ****** Other status packet transfer start (currently with 0 latency from status_root_rq)
localparam DEBUG_RING_LENGTH = 3; // increase here, insert new after master
wire [DEBUG_RING_LENGTH:0] debug_ring; // TODO: adjust number of bits
wire debug_sl; // debug shift/load: 0 - idle, (1,0) - shift, (1,1) - load
`endif
`ifdef DEBUG_SAXI1
wire [7:0] status_debug_saxi_ad; // saxi1 - logger data Other status byte-wide address/data
wire status_debug_saxi_rq; // Other status request
wire status_debug_saxi_start; // S uppressThisWarning VEditor ****** Other status packet transfer start (currently with 0 latency from status_root_rq)
`endif
// Insert register layer if needed
reg [7:0] cmd_mcontr_ad;
reg cmd_mcontr_stb;
reg [7:0] cmd_test01_ad;
reg cmd_test01_stb;
reg [7:0] cmd_membridge_ad;
reg cmd_membridge_stb;
reg [7:0] cmd_sensor_ad;
reg cmd_sensor_stb;
reg [7:0] cmd_compressor_ad;
reg cmd_compressor_stb;
reg [7:0] cmd_sequencer_ad;
reg cmd_sequencer_stb;
reg [7:0] cmd_logger_ad;
reg cmd_logger_stb;
reg [7:0] cmd_timing_ad;
reg cmd_timing_stb;
reg [7:0] cmd_gpio_ad;
reg cmd_gpio_stb;
reg [7:0] cmd_saxi1wr_ad;
reg cmd_saxi1wr_stb;
reg [7:0] cmd_clocks_ad;
reg cmd_clocks_stb;
`ifdef DEBUG_RING
reg [7:0] cmd_debug_ad;
reg cmd_debug_stb;
`endif
`ifdef DEBUG_SAXI1
reg [7:0] cmd_debug_saxi1_ad;
reg cmd_debug_saxi1_stb;
`endif
// membridge
wire frame_start_chn1; // input
wire next_page_chn1; // input
wire cmd_wrmem_chn1;
wire page_ready_chn1; // output
wire frame_done_chn1; // output
wire[FRAME_HEIGHT_BITS-1:0] line_unfinished_chn1; // output[15:0]
wire suspend_chn1; // input
wire xfer_reset_page1_rd;
wire buf_wpage_nxt_chn1;
wire buf_wr_chn1;
wire [63:0] buf_wdata_chn1;
wire xfer_reset_page1_wr;
wire rpage_nxt_chn1;
wire buf_rd_chn1;
wire [63:0] buf_rdata_chn1;
//mcntrl393_test01
wire frame_start_chn2; // input
wire next_page_chn2; // input
wire page_ready_chn2; // output
wire frame_done_chn2; // output
wire[FRAME_HEIGHT_BITS-1:0] line_unfinished_chn2; // output[15:0]
// wire [LAST_FRAME_BITS-1:0] frame_number_chn2; // output[15:0]
wire suspend_chn2; // input
wire frame_start_chn3; // input
wire next_page_chn3; // input
wire page_ready_chn3; // output
wire frame_done_chn3; // output
wire[FRAME_HEIGHT_BITS-1:0] line_unfinished_chn3; // output[15:0]
// wire [LAST_FRAME_BITS-1:0] frame_number_chn3; // output[15:0]
wire suspend_chn3; // input
wire frame_start_chn4; // input
wire next_page_chn4; // input
wire page_ready_chn4; // output
wire frame_done_chn4; // output
wire[FRAME_HEIGHT_BITS-1:0] line_unfinished_chn4; // output[15:0]
// wire [LAST_FRAME_BITS-1:0] frame_number_chn4; // output[15:0]
wire suspend_chn4; // input
reg axi_rst_pre=1'b1;
wire comb_rst; //=~frst[0] | frst[1];
wire [63:0] gpio_in;
// signals for sensor393 (in/outs as seen for the sensor393)
wire [3:0] sens_rpage_set; // (), // input
wire [3:0] sens_frame_run; // @mclk from mcntrl393 - enable data to memory buffer
wire [3:0] sens_rpage_next; // (), // input
wire [3:0] sens_buf_rd; // (), // input
wire [255:0] sens_buf_dout; // (), // output[63:0]
wire [3:0] sens_page_written; // single mclk pulse: buffer page (full or partial) is written to the memory buffer
// TODO: Add counter(s) to count sens_xfer_skipped pulses
wire [3:0] sens_xfer_skipped; // single mclk pulse on every skipped (not written) block to record error statistics // SuppressThisWarning VEditor - unused
wire [3:0] sens_first_wr_in_frame; // single mclk pulse on first write block in each frame
wire trigger_mode; // (), // input
wire [3:0] trig_in; // input[3:0]
wire [3:0] sof_out_pclk; // (), // output[3:0] // SuppressThisWarning VEditor - (yet) unused
wire [3:0] eof_out_pclk; // (), // output[3:0] // SuppressThisWarning VEditor - (yet) unused
wire [3:0] sof_out_mclk; // Use for sequencer and to start memory write
// if sof_out_mclk is applied to both sequencer and memory controller (as it is now) reprogramming of the sensor->memory
// parameters will be applied to the next frame TODO: Verify that sequencer will always be later than memory controller
// handling this pulse (should be so). Make sure parameters are applied in ASAP in single-trigger mode
wire [3:0] sof_late_mclk; // (), // output[3:0]
wire [4 * NUM_FRAME_BITS - 1:0] frame_num; // (), // input[15:0]
wire [4 * NUM_FRAME_BITS - 1:0] frame_num_compressed; // (), // input[15:0]
// signals for compressor393 (in/outs as seen for the sensor393)
// per-channel memory buffers interface
wire [3:0] cmprs_xfer_reset_page_rd; // input
wire [3:0] cmprs_buf_wpage_nxt; // input
wire [3:0] cmprs_buf_we; // input
wire [255:0] cmprs_buf_din; // input[63:0]
wire [3:0] cmprs_page_ready; // input
wire [3:0] cmprs_next_page; // output
// per-channel master (sensor)/slave (compressor) synchronization (compressor wait until sensor provided data)
wire [3:0] cmprs_frame_start_dst; // output - trigger receive (tiledc) memory channel (it will take care of single/repetitive
// these output either follows vsync_late (reclocks it) or generated in non-bonded mode
// (compress from memory)
wire [3:0] cmprs_frame_start_conf; // memory controller confirmed cmprs_frame_start_dst - normally delayed by 1 clock,
// or more if there were outstanding memory transactions.
wire [4*FRAME_HEIGHT_BITS-1:0] cmprs_line_unfinished_src; // input[15:0] number of the current (unfinished ) line, in the source (sensor)
// channel (RELATIVE TO FRAME, NOT WINDOW?)
wire [4*LAST_FRAME_BITS-1:0] cmprs_frame_number_src;// input[15:0] current frame number (for multi-frame ranges) in the source (sensor) channel
wire [3:0] cmprs_frame_done_src; // input single-cycle pulse when the full frame (window) was transferred to/from DDR3 memory
// frame_done_src is later than line_unfinished_src/ frame_number_src changes
// Used withe a single-frame buffers
wire [4*FRAME_HEIGHT_BITS-1:0] cmprs_line_unfinished_dst; // input[15:0] number of the current (unfinished ) line in this (compressor) channel
wire [4*LAST_FRAME_BITS-1:0] cmprs_frame_number_dst; // input[15:0] current frame number (for multi-frame ranges) in this (compressor channel
wire [3:0] cmprs_frames_in_sync; // cmprs_frame_number_dst is valid (in bonded mode)
wire [3:0] cmprs_frame_done_dst; // input single-cycle pulse when the full frame (window) was transferred to/from DDR3 memory
// use as 'eot_real' in 353
wire [3:0] cmprs_suspend; // output suspend reading data for this channel - waiting for the source data
// wire [3:0] cmprs_master_follow; // compressor memory is in dependent mode, frame number should be copied from sesnor, not reset to 0
wire [4*LAST_FRAME_BITS-1:0] cmprs_frame_number_finished; // frame numbers compressed
// Timestamp messages (@mclk) - combine to a single ts_data?
wire [3:0] ts_pre_stb; // input[ 3:0] 4 compressor channels
wire [31:0] ts_data; // input[31:0] 4 compressor channels
// Timestamp messages (@mclk) - combine to a single ts_data?
wire ts_pre_logger_stb; // input logger timestamp sync (@logger_clk)
wire [7:0] ts_logegr_data; // input[7:0] loger timestamp data (@logger_clk)
// Compressor signals for interrupts generation
wire [3:0] eof_written_mclk; // output // SuppressThisWarning VEditor - (yet) unused
wire [3:0] stuffer_done_mclk; // output// SuppressThisWarning VEditor - (yet) unused
wire [3:0] cmprs_irq; // compressor done, data confirmed written to memory)
wire [3:0] mult_saxi_irq; // interrupts from mult_saxi channels
wire membridge_irq; // interrupt from membridge done
// Compressor frame synchronization
// GPIO internal signals (for camera GPIOs, not Zynq PS GPIO)
wire [GPIO_N-1:0] gpio_rd; // data read from the external GPIO pins
wire [GPIO_N-1:0] gpio_camsync; // data out from the camsync module
wire [GPIO_N-1:0] gpio_camsync_en; // output enable from the camsync module
wire [GPIO_N-1:0] gpio_db; // data out from the port B (unused, Motors in x353)
wire [GPIO_N-1:0] gpio_db_en; // output enable from the port B (unused, Motors in x353)
wire [GPIO_N-1:0] gpio_logger; // data out from the event_logger module
wire [GPIO_N-1:0] gpio_logger_en; // output enable from the event_logger module
// Internal signal for toming393 (camsync) modules
wire logger_snap;
// event_logger intermediate signals
wire [15:0] logger_out; // output[15:0]
wire logger_stb; // output
// event_logger intermediate signals (after mult_saxi_wr_inbuf - converted to 32 bit wide)
wire logger_saxi_en;
wire logger_has_burst;
wire logger_read_burst;
wire [31:0] logger_data32;
wire logger_pre_valid_chn;
wire idelay_ctrl_rdy;// just to keep idelay_ctrl instances
// Top level signals for SATA
// MAXIGP1 - interface with SATA controller register memory
wire [31:0] maxi1_araddr;
wire maxi1_arvalid;
wire maxi1_arready;
wire [11:0] maxi1_arid;
wire [3:0] maxi1_arlen;
wire [1:0] maxi1_arsize;
wire [1:0] maxi1_arburst;
wire [31:0] maxi1_rdata;
wire maxi1_rvalid;
wire maxi1_rready;
wire [11:0] maxi1_rid;
wire maxi1_rlast;
wire [1:0] maxi1_rresp;
wire [31:0] maxi1_awaddr;
wire maxi1_awvalid;
wire maxi1_awready;
wire [11:0] maxi1_awid;
wire [3:0] maxi1_awlen;
wire [1:0] maxi1_awsize;
wire [1:0] maxi1_awburst;
wire [31:0] maxi1_wdata;
wire maxi1_wvalid;
wire maxi1_wready;
wire [11:0] maxi1_wid;
wire maxi1_wlast;
wire [3:0] maxi1_wstb;
wire maxi1_bvalid;
wire maxi1_bready;
wire [11:0] maxi1_bid;
wire [1:0] maxi1_bresp;
// SAXIGP3 - SATA comntroller DMA interface with system memory
wire [31:0] afi3_awaddr; // output[31:0]
wire afi3_awvalid; // output
wire afi3_awready; // input
wire [ 5:0] afi3_awid; // output[5:0]
wire [ 1:0] afi3_awlock; // output[1:0]
wire [ 3:0] afi3_awcache; // output[3:0]
wire [ 2:0] afi3_awprot; // output[2:0]
wire [ 3:0] afi3_awlen; // output[3:0]
wire [ 1:0] afi3_awsize; // output[2:0]
wire [ 1:0] afi3_awburst; // output[1:0]
wire [ 3:0] afi3_awqos; // output[3:0]
wire [63:0] afi3_wdata; // output[63:0]
wire afi3_wvalid; // output
wire afi3_wready; // input
wire [ 5:0] afi3_wid; // output[5:0]
wire afi3_wlast; // output
wire [ 7:0] afi3_wstrb; // output[7:0]
wire afi3_bvalid; // input
wire afi3_bready; // output
wire [ 5:0] afi3_bid; // input[5:0]
wire [ 1:0] afi3_bresp; // input[1:0]
wire [ 7:0] afi3_wcount; // input[7:0]
wire [ 5:0] afi3_wacount; // input[5:0]
wire afi3_wrissuecap1en;// output
wire [31:0] afi3_araddr; // output[31:0]
wire afi3_arvalid; // output
wire afi3_arready; // input
wire [ 5:0] afi3_arid; // output[5:0]
wire [ 1:0] afi3_arlock; // output[1:0]
wire [ 3:0] afi3_arcache; // output[3:0]
wire [ 2:0] afi3_arprot; // output[2:0]
wire [ 3:0] afi3_arlen; // output[3:0]
wire [ 1:0] afi3_arsize; // output[2:0]
wire [ 1:0] afi3_arburst; // output[1:0]
wire [ 3:0] afi3_arqos; // output[3:0]
wire [63:0] afi3_rdata; // input[63:0]
wire afi3_rvalid; // input
wire afi3_rready; // output
wire [ 5:0] afi3_rid; // input[5:0]
wire afi3_rlast; // input
wire [ 1:0] afi3_rresp; // input[2:0]
wire [ 7:0] afi3_rcount; // input[7:0]
wire [ 2:0] afi3_racount; // input[2:0]
wire afi3_rdissuecap1en;// output
wire sata_irq; // ps7 IRQ
wire sata_clk ; // Just output from SATA subsystem SuppressThisWarning VEditor Not used
assign gpio_db = 0; // unused, Motors in x353
assign gpio_db_en = 0; // unused, Motors in x353
assign gpio_in= {48'h0,frst,tmp_debug}; // these are PS GPIO pins
assign axird_dev_ready = ~axird_dev_busy; //may combine (AND) multiple sources if needed
assign axird_dev_busy = 1'b0; // always for now
// Use this later
assign axird_rdata= ({32{status_selected_regen}} & status_rdata[31:0]) |
({32{readback_selected_regen}} & readback_rdata[31:0]) |
({32{mcntrl_axird_selected_regen}} & mcntrl_axird_rdata[31:0]);
//Debug with this (to show 'x)
// assign axird_rdata= status_selected_regen?status_rdata[31:0] : (mcntrl_axird_selected_regen? mcntrl_axird_rdata[31:0]:'bx);
// temporary for Vivado debugging
// assign axird_rdata= status_rdata[31:0] | mcntrl_axird_rdata[31:0];
assign axiwr_dev_ready = ~axiwr_dev_busy; //may combine (AND) multiple sources if needed
// Clock and reset from PS
assign comb_rst=~frst[0] | frst[1];
// insert register layers if needed
always @ (posedge mclk) begin
cmd_mcontr_ad <= cmd_root_ad;
cmd_mcontr_stb <= cmd_root_stb;
cmd_test01_ad <= cmd_root_ad;
cmd_test01_stb <= cmd_root_stb;
cmd_membridge_ad <= cmd_root_ad;
cmd_membridge_stb <= cmd_root_stb;
cmd_sensor_ad <= cmd_root_ad;
cmd_sensor_stb <= cmd_root_stb;
cmd_compressor_ad <= cmd_root_ad;
cmd_compressor_stb <= cmd_root_stb;
cmd_sequencer_ad <= cmd_root_ad;
cmd_sequencer_stb <= cmd_root_stb;
cmd_logger_ad <= cmd_root_ad;
cmd_logger_stb <= cmd_root_stb;
cmd_timing_ad <= cmd_root_ad;
cmd_timing_stb <= cmd_root_stb;
cmd_gpio_ad <= cmd_root_ad;
cmd_gpio_stb <= cmd_root_stb;
cmd_saxi1wr_ad <= cmd_root_ad;
cmd_saxi1wr_stb <= cmd_root_stb;
cmd_clocks_ad <= cmd_root_ad;
cmd_clocks_stb <= cmd_root_stb;
`ifdef DEBUG_RING
cmd_debug_ad <= cmd_root_ad;
cmd_debug_stb <= cmd_root_stb;
`endif
`ifdef DEBUG_SAXI1
cmd_debug_saxi1_ad <= cmd_root_ad;
cmd_debug_saxi1_stb <= cmd_root_stb;
`endif
end
// For now - connect status_test01 to status_other, if needed - increase number of multiplexer inputs)
// assign status_other_ad = status_test01_ad;
// assign status_other_rq = status_test01_rq;
// assign status_test01_start = status_other_start;
// delay status_selected and mcntrl_axird_selected to match data for multiplexing
// always @(posedge axi_grst or posedge axird_bram_rclk) begin // axird_bram_rclk==axi_aclk
always @(posedge axird_bram_rclk) begin // axird_bram_rclk==axi_aclk
if (arst) status_selected_ren <= 1'b0;
else if (axird_ren) status_selected_ren <= status_selected;
if (arst) status_selected_regen <= 1'b0;
else if (axird_regen) status_selected_regen <= status_selected_ren;
if (arst) readback_selected_ren <= 1'b0;
else if (axird_ren) readback_selected_ren <= readback_selected;
if (arst) readback_selected_regen <= 1'b0;
else if (axird_regen) readback_selected_regen <= readback_selected_ren;
if (arst) mcntrl_axird_selected_ren <= 1'b0;
else if (axird_ren) mcntrl_axird_selected_ren <= mcntrl_axird_selected;
if (arst) mcntrl_axird_selected_regen <= 1'b0;
else if (axird_regen) mcntrl_axird_selected_regen <= mcntrl_axird_selected_ren;
end
always @(posedge comb_rst or posedge axi_aclk) begin
if (comb_rst) axi_rst_pre <= 1'b1;
else axi_rst_pre <= 1'b0;
end
`ifdef DEBUG_FIFO
wire waddr_under, wdata_under, wresp_under;
wire waddr_over, wdata_over, wresp_over;
reg waddr_under_r, wdata_under_r, wresp_under_r;
reg waddr_over_r, wdata_over_r, wresp_over_r;
wire fifo_rst= frst[2];
wire [3:0] waddr_wcount;
wire [3:0] waddr_rcount;
wire [3:0] waddr_num_in_fifo;
wire [3:0] wdata_wcount;
wire [3:0] wdata_rcount;
wire [3:0] wdata_num_in_fifo;
wire [3:0] wresp_wcount;
wire [3:0] wresp_rcount;
wire [3:0] wresp_num_in_fifo;
wire [3:0] wleft;
wire [3:0] wlength; // output[3:0]
wire [3:0] wlen_in_dbg; // output[3:0] reg
always @(posedge fifo_rst or posedge axi_aclk) begin
if (fifo_rst) {waddr_under_r, wdata_under_r, wresp_under_r,waddr_over_r, wdata_over_r, wresp_over_r} <= 0;
else {waddr_under_r, wdata_under_r, wresp_under_r, waddr_over_r, wdata_over_r, wresp_over_r} <=
{waddr_under_r, wdata_under_r, wresp_under_r, waddr_over_r, wdata_over_r, wresp_over_r} |
{waddr_under, wdata_under, wresp_under, waddr_over, wdata_over, wresp_over};
end
`endif
// Checking if global axi_grst is not needed anymore:
//BUFG bufg_axi_rst_i (.O(axi_grst),.I(axi_rst_pre)); // will go only to memory controller (to minimize changes), later - remove from there too
assign axi_grst = axi_rst_pre;
// channel test module
mcntrl393_test01 #(
.MCNTRL_TEST01_ADDR (MCNTRL_TEST01_ADDR),
.MCNTRL_TEST01_MASK (MCNTRL_TEST01_MASK),
.FRAME_HEIGHT_BITS (FRAME_HEIGHT_BITS),
.MCNTRL_TEST01_CHN1_MODE (MCNTRL_TEST01_CHN1_MODE),
.MCNTRL_TEST01_CHN1_STATUS_CNTRL (MCNTRL_TEST01_CHN1_STATUS_CNTRL),
.MCNTRL_TEST01_CHN2_MODE (MCNTRL_TEST01_CHN2_MODE),
.MCNTRL_TEST01_CHN2_STATUS_CNTRL (MCNTRL_TEST01_CHN2_STATUS_CNTRL),
.MCNTRL_TEST01_CHN3_MODE (MCNTRL_TEST01_CHN3_MODE),
.MCNTRL_TEST01_CHN3_STATUS_CNTRL (MCNTRL_TEST01_CHN3_STATUS_CNTRL),
.MCNTRL_TEST01_CHN4_MODE (MCNTRL_TEST01_CHN4_MODE),
.MCNTRL_TEST01_CHN4_STATUS_CNTRL (MCNTRL_TEST01_CHN4_STATUS_CNTRL),
.MCNTRL_TEST01_STATUS_REG_CHN1_ADDR (MCNTRL_TEST01_STATUS_REG_CHN1_ADDR),
.MCNTRL_TEST01_STATUS_REG_CHN2_ADDR (MCNTRL_TEST01_STATUS_REG_CHN2_ADDR),
.MCNTRL_TEST01_STATUS_REG_CHN3_ADDR (MCNTRL_TEST01_STATUS_REG_CHN3_ADDR),
.MCNTRL_TEST01_STATUS_REG_CHN4_ADDR (MCNTRL_TEST01_STATUS_REG_CHN4_ADDR)
) mcntrl393_test01_i (
.mrst (mrst), // input
.mclk (mclk), // input
.cmd_ad (cmd_test01_ad), // input[7:0]
.cmd_stb (cmd_test01_stb), // input
.status_ad (status_test01_ad), // output[7:0]
.status_rq (status_test01_rq), // output
.status_start (status_test01_start), // input
.frame_start_chn1 (), //frame_start_chn1), // output
.next_page_chn1 (), //next_page_chn1), // output
.page_ready_chn1 (1'b0), // page_ready_chn1), // input
.frame_done_chn1 (1'b0), //frame_done_chn1), // input
.line_unfinished_chn1 (16'b0), //line_unfinished_chn1), // input[15:0]
.suspend_chn1 (), //suspend_chn1), // output
.frame_start_chn2 (frame_start_chn2), // output
.next_page_chn2 (next_page_chn2), // output
.page_ready_chn2 (page_ready_chn2), // input
.frame_done_chn2 (frame_done_chn2), // input
.line_unfinished_chn2 (line_unfinished_chn2), // input[15:0]
.suspend_chn2 (suspend_chn2), // output
.frame_start_chn3 (frame_start_chn3), // output
.next_page_chn3 (next_page_chn3), // output
.page_ready_chn3 (page_ready_chn3), // input
.frame_done_chn3 (frame_done_chn3), // input
.line_unfinished_chn3 (line_unfinished_chn3), // input[15:0]
.suspend_chn3 (suspend_chn3), // output
.frame_start_chn4 (frame_start_chn4), // output
.next_page_chn4 (next_page_chn4), // output
.page_ready_chn4 (page_ready_chn4), // input
.frame_done_chn4 (frame_done_chn4), // input
.line_unfinished_chn4 (line_unfinished_chn4), // input[15:0]
.suspend_chn4 (suspend_chn4) // output
);
// Interface to channels to read/write memory (including 4 page BRAM buffers)
// TODO:increase depth, number of NUM_CYCLES - twice?
cmd_mux #(
.AXI_WR_ADDR_BITS (AXI_WR_ADDR_BITS),
.CONTROL_ADDR (CONTROL_ADDR),
.CONTROL_ADDR_MASK (CONTROL_ADDR_MASK),
// TODO: Put correct numcycles!
.NUM_CYCLES_LOW_BIT(NUM_CYCLES_LOW_BIT),
.NUM_CYCLES_00 (NUM_CYCLES_00),
.NUM_CYCLES_01 (NUM_CYCLES_01),
.NUM_CYCLES_02 (NUM_CYCLES_02),
.NUM_CYCLES_03 (NUM_CYCLES_03),
.NUM_CYCLES_04 (NUM_CYCLES_04),
.NUM_CYCLES_05 (NUM_CYCLES_05),
.NUM_CYCLES_06 (NUM_CYCLES_06),
.NUM_CYCLES_07 (NUM_CYCLES_07),
.NUM_CYCLES_08 (NUM_CYCLES_08),
.NUM_CYCLES_09 (NUM_CYCLES_09),
.NUM_CYCLES_10 (NUM_CYCLES_10),
.NUM_CYCLES_11 (NUM_CYCLES_11),
.NUM_CYCLES_12 (NUM_CYCLES_12),
.NUM_CYCLES_13 (NUM_CYCLES_13),
.NUM_CYCLES_14 (NUM_CYCLES_14),
.NUM_CYCLES_15 (NUM_CYCLES_15),
.NUM_CYCLES_16 (NUM_CYCLES_16),
.NUM_CYCLES_17 (NUM_CYCLES_17),
.NUM_CYCLES_18 (NUM_CYCLES_18),
.NUM_CYCLES_19 (NUM_CYCLES_19),
.NUM_CYCLES_20 (NUM_CYCLES_20),
.NUM_CYCLES_21 (NUM_CYCLES_21),
.NUM_CYCLES_22 (NUM_CYCLES_22),
.NUM_CYCLES_23 (NUM_CYCLES_23),
.NUM_CYCLES_24 (NUM_CYCLES_24),
.NUM_CYCLES_25 (NUM_CYCLES_25),
.NUM_CYCLES_26 (NUM_CYCLES_26),
.NUM_CYCLES_27 (NUM_CYCLES_27),
.NUM_CYCLES_28 (NUM_CYCLES_28),
.NUM_CYCLES_29 (NUM_CYCLES_29),
.NUM_CYCLES_30 (NUM_CYCLES_30),
.NUM_CYCLES_31 (NUM_CYCLES_31)
) cmd_mux_i ( // SuppressThisWarning ISExst: Output port <par_data>,<par_waddr>, <cseq_ackn> of the instance <cmd_mux_i> is unconnected or connected to loadless signal.
.axi_clk (axiwr_wclk), // input
.mclk (mclk), // input
.mrst (mrst), // input
.arst (arst), // input
.pre_waddr (axiwr_pre_awaddr[AXI_WR_ADDR_BITS-1:0]), // input[12:0] // SuppressThisWarning VivadoSynthesis: [Synth 8-3295] tying undriven pin #cmd_mux_i:pre_waddr[9:0] to constant 0
.start_wburst (axiwr_start_burst), // input
.waddr (axiwr_waddr[AXI_WR_ADDR_BITS-1:0]), // input[12:0]
.wr_en (axiwr_wen), // input
.wdata (axiwr_wdata[31:0]), // input[31:0]
.busy (axiwr_dev_busy), // output // assign axiwr_dev_ready = ~axiwr_dev_busy; //may combine (AND) multiple sources if needed
//TODO: The following is the interface to the command sequencer
.cseq_waddr (cseq_waddr), // input[12:0] // SuppressThisWarning VivadoSynthesis: [Synth 8-3295] tying undriven pin #cmd_mux_i:cseq_waddr[13:0] to constant 0 (command sequencer not yet implemented)
.cseq_wr_en (cseq_wr_en), // input // SuppressThisWarning VivadoSynthesis: [Synth 8-3295] tying undriven pin #cmd_mux_i:cseq_wr_en to constant 0 (command sequencer not yet implemented)
.cseq_wdata (cseq_wdata), // input[31:0] // SuppressThisWarning VivadoSynthesis: [Synth 8-3295] tying undriven pin #cmd_mux_i:cseq_wdata[31:0] to constant 0 (command sequencer not yet implemented)
.cseq_ackn (cseq_ackn), // output // SuppressThisWarning ISExst: Assignment to cseq_ackn ignored, since the identifier is never used (command sequencer not yet implemented)
// parallel address/data - where higher bandwidth (single-cycle) is needed
.par_waddr (par_waddr), // output[12:0] // SuppressThisWarning ISExst: Assignment to par_waddr ignored, since the identifier is never used (not yet used)
.par_data (par_data), // output[31:0] // SuppressThisWarning ISExst: Assignment to par_data ignored, since the identifier is never used (not yet used)
// registers may be inserted before byte_ad and ad_stb
.byte_ad (cmd_root_ad), // output[7:0]
.ad_stb (cmd_root_stb) // output
);
generate
genvar i;
for (i = 0; i < 4; i = i+1) begin: frame_sequencer_block
cmd_frame_sequencer #(
.CMDFRAMESEQ_ADDR (CMDFRAMESEQ_ADDR_BASE + i * CMDFRAMESEQ_ADDR_INC),
.CMDFRAMESEQ_MASK (CMDFRAMESEQ_MASK),
.AXI_WR_ADDR_BITS (AXI_WR_ADDR_BITS),
.CMDFRAMESEQ_DEPTH (CMDFRAMESEQ_DEPTH),
.CMDFRAMESEQ_ABS (CMDFRAMESEQ_ABS),
.CMDFRAMESEQ_REL (CMDFRAMESEQ_REL),
.CMDFRAMESEQ_CTRL (CMDFRAMESEQ_CTRL),
.CMDFRAMESEQ_RST_BIT (CMDFRAMESEQ_RST_BIT),
.CMDFRAMESEQ_RUN_BIT (CMDFRAMESEQ_RUN_BIT),
.CMDFRAMESEQ_IRQ_BIT (CMDFRAMESEQ_IRQ_BIT)
) cmd_frame_sequencer_i (
.mrst (mrst), // input
.mclk (mclk), // input
.cmd_ad (cmd_sequencer_ad), // input[7:0]
.cmd_stb (cmd_sequencer_stb), // input
.frame_sync (sof_out_mclk[i]), // input
.frame_no (frame_num[i * NUM_FRAME_BITS +: NUM_FRAME_BITS]), // output[3:0]
.waddr (frseq_waddr[i * AXI_WR_ADDR_BITS +: AXI_WR_ADDR_BITS]), // output[13:0]
.valid (frseq_valid[i]), // output
.wdata (frseq_wdata[i * 32 +: 32]), // output[31:0]
.ackn (frseq_ackn[i]), // input
.is (frseq_is[i]), // output
.im (frseq_im[i]) // output
);
end
endgenerate
frame_num_sync #(
.NUM_FRAME_BITS(NUM_FRAME_BITS),
.LAST_FRAME_BITS(LAST_FRAME_BITS),
.FRAME_BITS_KEEP(NUM_FRAME_BITS)
) frame_num_sync_i (
.mrst (mrst), // input
.mclk (mclk), // input
.absolute_frames (frame_num), // input[15:0]
.first_wr_in_frame (sens_first_wr_in_frame), // input[3:0]
// .first_rd_in_frame (), // input[3:0]
.memory_frames_sensor (cmprs_frame_number_src), // input[63:0]
.memory_frames_compressor (cmprs_frame_number_finished), // input[63:0]
.compressed_frames (frame_num_compressed) // output[15:0]
);
cmd_seq_mux #(
.CMDSEQMUX_ADDR (CMDSEQMUX_ADDR),
.CMDSEQMUX_MASK (CMDSEQMUX_MASK),
.CMDSEQMUX_STATUS (CMDSEQMUX_STATUS),
.AXI_WR_ADDR_BITS (AXI_WR_ADDR_BITS)
) cmd_seq_mux_i (
.mrst (mrst), // input
.mclk (mclk), // input
.cmd_ad (cmd_sequencer_ad), // input[7:0]
.cmd_stb (cmd_sequencer_stb), // input
.status_ad (status_sequencer_ad), // output[7:0]