forked from open-ephys/rhythm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.v
executable file
·2924 lines (2588 loc) · 104 KB
/
main.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
//////////////////////////////////////////////////////////////////////////////////
// Company: Intan Technologies, LLC
// Copyright (c) 2013-2014 Intan Technologies LLC
//
// Design Name: RHD2000 Rhythm Interface - MODIFIED for Open EPhys aq. board Nov 2014
// see here for details on how this fork differs from the Intan code: https://open-ephys.atlassian.net/wiki/display/OEW/Rhythm+firmware+fork
//
//
// Module Name: main, command_selector
// Project Name: Opal Kelly FPGA/USB RHD2000 Interface
// Target Devices:
// Tool versions:
// Description: Uses Opal Kelly XEM6010 USB/FPGA board to interface multiple
// Intan Technologies RHD2000-series chips to a computer via a
// USB 2.0 connection.
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any
// damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any
// applications that use Intan Technologies integrated circuits, and
// to alter it and redistribute it freely.
//
// See http://www.intantech.com for documentation and product information.
//
// Dependencies:
//
// Revision: 1.4 (26 February 2014) (BOARD_VERSION = 1)
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
//------------------------------------------------------------------------
// Note on starting Xilinx projects for Opal Kelly XEM6010-LX45 board based on
// the Opal Kelly RAMTester sample:
//
// Start a new project for device xc6slx45-2fgg484, preferred language: Verilog
//
// Include the following files from the XEM6010 RAMTester sample directory
// (C:\Program Files\Opal Kelly\FrontPanelUSB\Samples\RAMTester\XEM6010-Verilog) and
// FrontPanel directory (C:\Program Files\Opal Kelly\FrontPanelUSB\FrontPanelHDL\XEM6010-LX45)
// using Project --> Add Source...:
// iodrp_mcb_controller.v
// iodrp_controller.v
// mcb_soft_calibration.v
// mcb_soft_calibration_top.v
// mcb_raw_wrapper.v
// okLibrary.v
// memc3_wrapper.v
// memc3_infrastructure.v (the one in the root directory of the XEM6010 RAMTester sample)
// fifo_w64_512_r16_2048.v
// fifo_w16_2048_r64_512.v
// ddr2_test.v
// ramtest.v
// xem6010.ucf
//
// Copy the associated *.ngc files to the main Xilinx project directory. Make sure the
// fifo_w16_2048_r64_512.ngc and fifo_w64_512_r16_2048.ngc are in the main directory, not
// the Core subdirectory.
//------------------------------------------------------------------------
`timescale 1ns/1ps
module main #(
// All of these parameters for the 'main' module relate to the SDRAM interface
parameter C3_P0_MASK_SIZE = 4,
parameter C3_P0_DATA_PORT_SIZE = 32,
parameter C3_P1_MASK_SIZE = 4,
parameter C3_P1_DATA_PORT_SIZE = 32,
parameter DEBUG_EN = 0,
parameter C3_MEMCLK_PERIOD = 3200,
parameter C3_CALIB_SOFT_IP = "TRUE",
parameter C3_SIMULATION = "FALSE",
parameter C3_HW_TESTING = "FALSE",
parameter C3_RST_ACT_LOW = 0,
parameter C3_INPUT_CLK_TYPE = "DIFFERENTIAL",
parameter C3_MEM_ADDR_ORDER = "ROW_BANK_COLUMN",
parameter C3_NUM_DQ_PINS = 16,
parameter C3_MEM_ADDR_WIDTH = 13,
parameter C3_MEM_BANKADDR_WIDTH = 3
)
(
input wire [7:0] hi_in,
output wire [1:0] hi_out,
inout wire [15:0] hi_inout,
inout wire hi_aa,
output wire i2c_sda,
output wire i2c_scl,
output wire hi_muxsel,
output wire [7:0] led,
input wire clk1_in, // CY22393 CLKA, f = 100MHz
inout wire [C3_NUM_DQ_PINS-1:0] mcb3_dram_dq,
output wire [C3_MEM_ADDR_WIDTH-1:0] mcb3_dram_a,
output wire [C3_MEM_BANKADDR_WIDTH-1:0] mcb3_dram_ba,
output wire mcb3_dram_ras_n,
output wire mcb3_dram_cas_n,
output wire mcb3_dram_we_n,
output wire mcb3_dram_odt,
output wire mcb3_dram_cke,
output wire mcb3_dram_dm,
inout wire mcb3_dram_udqs,
inout wire mcb3_dram_udqs_n,
inout wire mcb3_rzq,
inout wire mcb3_zio,
output wire mcb3_dram_udm,
inout wire mcb3_dram_dqs,
inout wire mcb3_dram_dqs_n,
output wire mcb3_dram_ck,
output wire mcb3_dram_ck_n,
output wire mcb3_dram_cs_n,
input wire MISO_A1_p,
input wire MISO_A1_n,
input wire MISO_A2_p,
input wire MISO_A2_n,
output wire CS_b_A_p,
output wire CS_b_A_n,
output wire SCLK_A_p,
output wire SCLK_A_n,
output wire MOSI_A_p,
output wire MOSI_A_n,
input wire MISO_B1_p,
input wire MISO_B1_n,
input wire MISO_B2_p,
input wire MISO_B2_n,
output wire CS_b_B_p,
output wire CS_b_B_n,
output wire SCLK_B_p,
output wire SCLK_B_n,
output wire MOSI_B_p,
output wire MOSI_B_n,
input wire MISO_C1_p,
input wire MISO_C1_n,
input wire MISO_C2_p,
input wire MISO_C2_n,
output wire CS_b_C_p,
output wire CS_b_C_n,
output wire SCLK_C_p,
output wire SCLK_C_n,
output wire MOSI_C_p,
output wire MOSI_C_n,
input wire MISO_D1_p,
input wire MISO_D1_n,
input wire MISO_D2_p,
input wire MISO_D2_n,
output wire CS_b_D_p,
output wire CS_b_D_n,
output wire SCLK_D_p,
output wire SCLK_D_n,
output wire MOSI_D_p,
output wire MOSI_D_n,
output reg CS_b,
output reg SCLK,
output reg MOSI_A,
output reg MOSI_B,
output reg MOSI_C,
output reg MOSI_D,
output reg sample_clk,
input wire [15:0] TTL_in,
output wire [15:0] TTL_out,
output wire DAC_SYNC,
output wire DAC_SCLK,
output wire DAC_DIN_1,
output wire DAC_DIN_2,
output wire DAC_DIN_3,
output wire DAC_DIN_4,
output wire DAC_DIN_5,
output wire DAC_DIN_6,
output wire DAC_DIN_7,
output wire DAC_DIN_8,
output wire ADC_CS,
output wire ADC_SCLK,
input wire ADC_DOUT_1,
input wire ADC_DOUT_2,
input wire ADC_DOUT_3,
input wire ADC_DOUT_4,
input wire ADC_DOUT_5,
input wire ADC_DOUT_6,
input wire ADC_DOUT_7,
input wire ADC_DOUT_8,
input wire [3:0] board_mode,
output wire LED_OUT
);
assign i2c_sda = 1'bz;
assign i2c_scl = 1'bz;
assign hi_muxsel = 1'b0;
// LVDS output pins
// Non-LVDS pin assignment example:
// assign MOSI_A_p = MOSI_A;
// assign MOSI_A_n = 1'b0;
// assign CS_b_A_p = CS_b;
// assign CS_b_A_n = 1'b0;
// assign SCLK_A_p = SCLK;
// assign SCLK_A_n = 1'b0;
OBUFDS lvds_driver_out_1 (.O(MOSI_A_p), .OB(MOSI_A_n), .I(MOSI_A));
OBUFDS lvds_driver_out_2 (.O(MOSI_B_p), .OB(MOSI_B_n), .I(MOSI_B));
OBUFDS lvds_driver_out_3 (.O(MOSI_C_p), .OB(MOSI_C_n), .I(MOSI_C));
OBUFDS lvds_driver_out_4 (.O(MOSI_D_p), .OB(MOSI_D_n), .I(MOSI_D));
OBUFDS lvds_driver_out_5 (.O(CS_b_A_p), .OB(CS_b_A_n), .I(CS_b));
OBUFDS lvds_driver_out_6 (.O(CS_b_B_p), .OB(CS_b_B_n), .I(CS_b));
OBUFDS lvds_driver_out_7 (.O(CS_b_C_p), .OB(CS_b_C_n), .I(CS_b));
OBUFDS lvds_driver_out_8 (.O(CS_b_D_p), .OB(CS_b_D_n), .I(CS_b));
OBUFDS lvds_driver_out_9 (.O(SCLK_A_p), .OB(SCLK_A_n), .I(SCLK));
OBUFDS lvds_driver_out_10 (.O(SCLK_B_p), .OB(SCLK_B_n), .I(SCLK));
OBUFDS lvds_driver_out_11 (.O(SCLK_C_p), .OB(SCLK_C_n), .I(SCLK));
OBUFDS lvds_driver_out_12 (.O(SCLK_D_p), .OB(SCLK_D_n), .I(SCLK));
// LVDS input pins
wire MISO_A1, MISO_A2;
wire MISO_B1, MISO_B2;
wire MISO_C1, MISO_C2;
wire MISO_D1, MISO_D2;
// assign MISO_A1 = MISO_A1_p;
IBUFDS lvds_receiver_in_0 (.O(MISO_A1), .I(MISO_A1_p), .IB(MISO_A1_n));
IBUFDS lvds_receiver_in_1 (.O(MISO_A2), .I(MISO_A2_p), .IB(MISO_A2_n));
IBUFDS lvds_receiver_in_2 (.O(MISO_B1), .I(MISO_B1_p), .IB(MISO_B1_n));
IBUFDS lvds_receiver_in_3 (.O(MISO_B2), .I(MISO_B2_p), .IB(MISO_B2_n));
IBUFDS lvds_receiver_in_4 (.O(MISO_C1), .I(MISO_C1_p), .IB(MISO_C1_n));
IBUFDS lvds_receiver_in_5 (.O(MISO_C2), .I(MISO_C2_p), .IB(MISO_C2_n));
IBUFDS lvds_receiver_in_6 (.O(MISO_D1), .I(MISO_D1_p), .IB(MISO_D1_n));
IBUFDS lvds_receiver_in_7 (.O(MISO_D2), .I(MISO_D2_p), .IB(MISO_D2_n));
// Board ID number and verison
localparam BOARD_ID = 16'd500;
localparam BOARD_VERSION = 16'd1;
// Wires and registers
wire clk1; // buffered 100 MHz clock
wire dataclk; // programmable frequency clock (f = 2800 * per-channel amplifier sampling rate)
wire dataclk_locked, DCM_prog_done;
reg [15:0] FIFO_data_in;
reg FIFO_write_to;
wire [15:0] FIFO_data_out;
wire FIFO_read_from;
wire [31:0] num_words_in_FIFO;
wire [9:0] RAM_addr_wr;
reg [9:0] RAM_addr_rd;
wire [3:0] RAM_bank_sel_wr;
reg [3:0] RAM_bank_sel_rd;
wire [15:0] RAM_data_in;
wire [15:0] RAM_data_out_1_pre, RAM_data_out_2_pre, RAM_data_out_3_pre;
reg [15:0] RAM_data_out_1, RAM_data_out_2, RAM_data_out_3;
wire RAM_we_1, RAM_we_2, RAM_we_3;
reg [5:0] channel, channel_MISO; // varies from 0-34 (amplfier channels 0-31, plus 3 auxiliary commands)
reg [15:0] MOSI_cmd_A, MOSI_cmd_B, MOSI_cmd_C, MOSI_cmd_D;
reg [73:0] in4x_A1, in4x_A2;
reg [73:0] in4x_B1, in4x_B2;
reg [73:0] in4x_C1, in4x_C2;
reg [73:0] in4x_D1, in4x_D2;
wire [15:0] in_A1, in_A2;
wire [15:0] in_B1, in_B2;
wire [15:0] in_C1, in_C2;
wire [15:0] in_D1, in_D2;
wire [15:0] in_DDR_A1, in_DDR_A2;
wire [15:0] in_DDR_B1, in_DDR_B2;
wire [15:0] in_DDR_C1, in_DDR_C2;
wire [15:0] in_DDR_D1, in_DDR_D2;
wire [3:0] delay_A, delay_B, delay_C, delay_D;
reg [15:0] result_A1, result_A2;
reg [15:0] result_B1, result_B2;
reg [15:0] result_C1, result_C2;
reg [15:0] result_D1, result_D2;
reg [15:0] result_DDR_A1, result_DDR_A2;
reg [15:0] result_DDR_B1, result_DDR_B2;
reg [15:0] result_DDR_C1, result_DDR_C2;
reg [15:0] result_DDR_D1, result_DDR_D2;
reg [31:0] timestamp;
reg [31:0] max_timestep;
wire [31:0] max_timestep_in;
wire [31:0] data_stream_timestamp;
wire [63:0] header_magic_number;
wire [15:0] data_stream_filler;
reg [15:0] data_stream_1, data_stream_2, data_stream_3, data_stream_4;
reg [15:0] data_stream_5, data_stream_6, data_stream_7, data_stream_8;
reg [3:0] data_stream_1_sel, data_stream_2_sel, data_stream_3_sel, data_stream_4_sel;
reg [3:0] data_stream_5_sel, data_stream_6_sel, data_stream_7_sel, data_stream_8_sel;
wire [3:0] data_stream_1_sel_in, data_stream_2_sel_in, data_stream_3_sel_in, data_stream_4_sel_in;
wire [3:0] data_stream_5_sel_in, data_stream_6_sel_in, data_stream_7_sel_in, data_stream_8_sel_in;
reg data_stream_1_en, data_stream_2_en, data_stream_3_en, data_stream_4_en;
reg data_stream_5_en, data_stream_6_en, data_stream_7_en, data_stream_8_en;
wire data_stream_1_en_in, data_stream_2_en_in, data_stream_3_en_in, data_stream_4_en_in;
wire data_stream_5_en_in, data_stream_6_en_in, data_stream_7_en_in, data_stream_8_en_in;
reg [15:0] data_stream_TTL_in, data_stream_TTL_out;
wire [15:0] data_stream_ADC_1, data_stream_ADC_2, data_stream_ADC_3, data_stream_ADC_4;
wire [15:0] data_stream_ADC_5, data_stream_ADC_6, data_stream_ADC_7, data_stream_ADC_8;
wire TTL_out_mode;
reg [15:0] TTL_out_user;
wire reset, SPI_start, SPI_run_continuous;
reg SPI_running;
wire [8:0] dataclk_M, dataclk_D;
wire DCM_prog_trigger;
wire DSP_settle;
wire [15:0] MOSI_cmd_selected_A, MOSI_cmd_selected_B, MOSI_cmd_selected_C, MOSI_cmd_selected_D;
reg [15:0] aux_cmd_A, aux_cmd_B, aux_cmd_C, aux_cmd_D;
reg [9:0] aux_cmd_index_1, aux_cmd_index_2, aux_cmd_index_3;
wire [9:0] max_aux_cmd_index_1_in, max_aux_cmd_index_2_in, max_aux_cmd_index_3_in;
reg [9:0] max_aux_cmd_index_1, max_aux_cmd_index_2, max_aux_cmd_index_3;
reg [9:0] loop_aux_cmd_index_1, loop_aux_cmd_index_2, loop_aux_cmd_index_3;
wire [3:0] aux_cmd_bank_1_A_in, aux_cmd_bank_1_B_in, aux_cmd_bank_1_C_in, aux_cmd_bank_1_D_in;
wire [3:0] aux_cmd_bank_2_A_in, aux_cmd_bank_2_B_in, aux_cmd_bank_2_C_in, aux_cmd_bank_2_D_in;
wire [3:0] aux_cmd_bank_3_A_in, aux_cmd_bank_3_B_in, aux_cmd_bank_3_C_in, aux_cmd_bank_3_D_in;
reg [3:0] aux_cmd_bank_1_A, aux_cmd_bank_1_B, aux_cmd_bank_1_C, aux_cmd_bank_1_D;
reg [3:0] aux_cmd_bank_2_A, aux_cmd_bank_2_B, aux_cmd_bank_2_C, aux_cmd_bank_2_D;
reg [3:0] aux_cmd_bank_3_A, aux_cmd_bank_3_B, aux_cmd_bank_3_C, aux_cmd_bank_3_D;
wire [4:0] DAC_channel_sel_1, DAC_channel_sel_2, DAC_channel_sel_3, DAC_channel_sel_4;
wire [4:0] DAC_channel_sel_5, DAC_channel_sel_6, DAC_channel_sel_7, DAC_channel_sel_8;
wire [3:0] DAC_stream_sel_1, DAC_stream_sel_2, DAC_stream_sel_3, DAC_stream_sel_4;
wire [3:0] DAC_stream_sel_5, DAC_stream_sel_6, DAC_stream_sel_7, DAC_stream_sel_8;
wire DAC_en_1, DAC_en_2, DAC_en_3, DAC_en_4;
wire DAC_en_5, DAC_en_6, DAC_en_7, DAC_en_8;
reg [15:0] DAC_pre_register_1, DAC_pre_register_2, DAC_pre_register_3, DAC_pre_register_4;
reg [15:0] DAC_pre_register_5, DAC_pre_register_6, DAC_pre_register_7, DAC_pre_register_8;
reg [15:0] DAC_register_1, DAC_register_2, DAC_register_3, DAC_register_4;
reg [15:0] DAC_register_5, DAC_register_6, DAC_register_7, DAC_register_8;
reg [15:0] DAC_manual;
wire [6:0] DAC_noise_suppress;
wire [2:0] DAC_gain;
reg [15:0] DAC_thresh_1, DAC_thresh_2, DAC_thresh_3, DAC_thresh_4;
reg [15:0] DAC_thresh_5, DAC_thresh_6, DAC_thresh_7, DAC_thresh_8;
reg DAC_thresh_pol_1, DAC_thresh_pol_2, DAC_thresh_pol_3, DAC_thresh_pol_4;
reg DAC_thresh_pol_5, DAC_thresh_pol_6, DAC_thresh_pol_7, DAC_thresh_pol_8;
wire [7:0] DAC_thresh_out;
reg HPF_en;
reg [15:0] HPF_coefficient;
reg external_fast_settle_enable;
reg [3:0] external_fast_settle_channel;
reg external_fast_settle, external_fast_settle_prev;
reg external_digout_enable_A, external_digout_enable_B, external_digout_enable_C, external_digout_enable_D;
reg [3:0] external_digout_channel_A, external_digout_channel_B, external_digout_channel_C, external_digout_channel_D;
reg external_digout_A, external_digout_B, external_digout_C, external_digout_D;
wire [7:0] led_in;
// Opal Kelly USB Host Interface
wire ti_clk; // 48 MHz clock from Opal Kelly USB interface
wire [30:0] ok1;
wire [16:0] ok2;
wire [15:0] ep00wirein, ep01wirein, ep02wirein, ep03wirein, ep04wirein, ep05wirein, ep06wirein, ep07wirein;
wire [15:0] ep08wirein, ep09wirein, ep0awirein, ep0bwirein, ep0cwirein, ep0dwirein, ep0ewirein, ep0fwirein;
wire [15:0] ep10wirein, ep11wirein, ep12wirein, ep13wirein, ep14wirein, ep15wirein, ep16wirein, ep17wirein;
wire [15:0] ep18wirein, ep19wirein, ep1awirein, ep1bwirein, ep1cwirein, ep1dwirein, ep1ewirein, ep1fwirein;
wire [15:0] ep20wireout, ep21wireout, ep22wireout, ep23wireout, ep24wireout, ep25wireout, ep26wireout, ep27wireout;
wire [15:0] ep28wireout, ep29wireout, ep2awireout, ep2bwireout, ep2cwireout, ep2dwireout, ep2ewireout, ep2fwireout;
wire [15:0] ep30wireout, ep31wireout, ep32wireout, ep33wireout, ep34wireout, ep35wireout, ep36wireout, ep37wireout;
wire [15:0] ep38wireout, ep39wireout, ep3awireout, ep3bwireout, ep3cwireout, ep3dwireout, ep3ewireout, ep3fwireout;
wire [15:0] ep40trigin, ep41trigin, ep42trigin, ep43trigin, ep44trigin, ep45trigin, ep46trigin;
// USB WireIn inputs
assign reset = ep00wirein[0];
assign SPI_run_continuous = ep00wirein[1];
assign DSP_settle = ep00wirein[2];
assign TTL_out_mode = ep00wirein[3];
assign DAC_noise_suppress = ep00wirein[12:6];
assign DAC_gain = ep00wirein[15:13];
assign max_timestep_in[15:0] = ep01wirein;
assign max_timestep_in[31:16] = ep02wirein;
always @(posedge dataclk) begin
max_timestep <= max_timestep_in;
end
assign dataclk_M = { 1'b0, ep03wirein[15:8] };
assign dataclk_D = { 1'b0, ep03wirein[7:0] };
assign delay_A = ep04wirein[3:0];
assign delay_B = ep04wirein[7:4];
assign delay_C = ep04wirein[11:8];
assign delay_D = ep04wirein[15:12];
assign RAM_addr_wr = ep05wirein[9:0];
assign RAM_bank_sel_wr = ep06wirein[3:0];
assign RAM_data_in = ep07wirein;
assign aux_cmd_bank_1_A_in = ep08wirein[3:0];
assign aux_cmd_bank_1_B_in = ep08wirein[7:4];
assign aux_cmd_bank_1_C_in = ep08wirein[11:8];
assign aux_cmd_bank_1_D_in = ep08wirein[15:12];
assign aux_cmd_bank_2_A_in = ep09wirein[3:0];
assign aux_cmd_bank_2_B_in = ep09wirein[7:4];
assign aux_cmd_bank_2_C_in = ep09wirein[11:8];
assign aux_cmd_bank_2_D_in = ep09wirein[15:12];
assign aux_cmd_bank_3_A_in = ep0awirein[3:0];
assign aux_cmd_bank_3_B_in = ep0awirein[7:4];
assign aux_cmd_bank_3_C_in = ep0awirein[11:8];
assign aux_cmd_bank_3_D_in = ep0awirein[15:12];
assign max_aux_cmd_index_1_in = ep0bwirein[9:0];
assign max_aux_cmd_index_2_in = ep0cwirein[9:0];
assign max_aux_cmd_index_3_in = ep0dwirein[9:0];
always @(posedge dataclk) begin
loop_aux_cmd_index_1 <= ep0ewirein[9:0];
loop_aux_cmd_index_2 <= ep0fwirein[9:0];
loop_aux_cmd_index_3 <= ep10wirein[9:0];
end
assign led_in = ep11wirein[7:0];
assign data_stream_1_sel_in = ep12wirein[3:0];
assign data_stream_2_sel_in = ep12wirein[7:4];
assign data_stream_3_sel_in = ep12wirein[11:8];
assign data_stream_4_sel_in = ep12wirein[15:12];
assign data_stream_5_sel_in = ep13wirein[3:0];
assign data_stream_6_sel_in = ep13wirein[7:4];
assign data_stream_7_sel_in = ep13wirein[11:8];
assign data_stream_8_sel_in = ep13wirein[15:12];
assign data_stream_1_en_in = ep14wirein[0];
assign data_stream_2_en_in = ep14wirein[1];
assign data_stream_3_en_in = ep14wirein[2];
assign data_stream_4_en_in = ep14wirein[3];
assign data_stream_5_en_in = ep14wirein[4];
assign data_stream_6_en_in = ep14wirein[5];
assign data_stream_7_en_in = ep14wirein[6];
assign data_stream_8_en_in = ep14wirein[7];
always @(posedge dataclk) begin
TTL_out_user <= ep15wirein;
end
assign TTL_out = TTL_out_mode ? {TTL_out_user[15:8], DAC_thresh_out} : TTL_out_user;
assign DAC_channel_sel_1 = ep16wirein[4:0];
assign DAC_stream_sel_1 = ep16wirein[8:5];
assign DAC_en_1 = ep16wirein[9];
assign DAC_channel_sel_2 = ep17wirein[4:0];
assign DAC_stream_sel_2 = ep17wirein[8:5];
assign DAC_en_2 = ep17wirein[9];
assign DAC_channel_sel_3 = ep18wirein[4:0];
assign DAC_stream_sel_3 = ep18wirein[8:5];
assign DAC_en_3 = ep18wirein[9];
assign DAC_channel_sel_4 = ep19wirein[4:0];
assign DAC_stream_sel_4 = ep19wirein[8:5];
assign DAC_en_4 = ep19wirein[9];
assign DAC_channel_sel_5 = ep1awirein[4:0];
assign DAC_stream_sel_5 = ep1awirein[8:5];
assign DAC_en_5 = ep1awirein[9];
assign DAC_channel_sel_6 = ep1bwirein[4:0];
assign DAC_stream_sel_6 = ep1bwirein[8:5];
assign DAC_en_6 = ep1bwirein[9];
assign DAC_channel_sel_7 = ep1cwirein[4:0];
assign DAC_stream_sel_7 = ep1cwirein[8:5];
assign DAC_en_7 = ep1cwirein[9];
assign DAC_channel_sel_8 = ep1dwirein[4:0];
assign DAC_stream_sel_8 = ep1dwirein[8:5];
assign DAC_en_8 = ep1dwirein[9];
always @(posedge dataclk) begin
DAC_manual <= ep1ewirein;
end
// USB TriggerIn inputs
assign DCM_prog_trigger = ep40trigin[0];
assign SPI_start = ep41trigin[0];
assign RAM_we_1 = ep42trigin[0];
assign RAM_we_2 = ep42trigin[1];
assign RAM_we_3 = ep42trigin[2];
always @(posedge ep43trigin[0]) begin
DAC_thresh_1 <= ep1fwirein;
end
always @(posedge ep43trigin[1]) begin
DAC_thresh_2 <= ep1fwirein;
end
always @(posedge ep43trigin[2]) begin
DAC_thresh_3 <= ep1fwirein;
end
always @(posedge ep43trigin[3]) begin
DAC_thresh_4 <= ep1fwirein;
end
always @(posedge ep43trigin[4]) begin
DAC_thresh_5 <= ep1fwirein;
end
always @(posedge ep43trigin[5]) begin
DAC_thresh_6 <= ep1fwirein;
end
always @(posedge ep43trigin[6]) begin
DAC_thresh_7 <= ep1fwirein;
end
always @(posedge ep43trigin[7]) begin
DAC_thresh_8 <= ep1fwirein;
end
always @(posedge ep43trigin[8]) begin
DAC_thresh_pol_1 <= ep1fwirein[0];
end
always @(posedge ep43trigin[9]) begin
DAC_thresh_pol_2 <= ep1fwirein[0];
end
always @(posedge ep43trigin[10]) begin
DAC_thresh_pol_3 <= ep1fwirein[0];
end
always @(posedge ep43trigin[11]) begin
DAC_thresh_pol_4 <= ep1fwirein[0];
end
always @(posedge ep43trigin[12]) begin
DAC_thresh_pol_5 <= ep1fwirein[0];
end
always @(posedge ep43trigin[13]) begin
DAC_thresh_pol_6 <= ep1fwirein[0];
end
always @(posedge ep43trigin[14]) begin
DAC_thresh_pol_7 <= ep1fwirein[0];
end
always @(posedge ep43trigin[15]) begin
DAC_thresh_pol_8 <= ep1fwirein[0];
end
always @(posedge ep44trigin[0]) begin
HPF_en <= ep1fwirein[0];
end
always @(posedge ep44trigin[1]) begin
HPF_coefficient <= ep1fwirein;
end
always @(posedge ep45trigin[0]) begin
external_fast_settle_enable <= ep1fwirein[0];
end
always @(posedge ep45trigin[1]) begin
external_fast_settle_channel <= ep1fwirein[3:0];
end
always @(posedge ep46trigin[0]) begin
external_digout_enable_A <= ep1fwirein[0];
end
always @(posedge ep46trigin[1]) begin
external_digout_enable_B <= ep1fwirein[0];
end
always @(posedge ep46trigin[2]) begin
external_digout_enable_C <= ep1fwirein[0];
end
always @(posedge ep46trigin[3]) begin
external_digout_enable_D <= ep1fwirein[0];
end
always @(posedge ep46trigin[4]) begin
external_digout_channel_A <= ep1fwirein[3:0];
end
always @(posedge ep46trigin[5]) begin
external_digout_channel_B <= ep1fwirein[3:0];
end
always @(posedge ep46trigin[6]) begin
external_digout_channel_C <= ep1fwirein[3:0];
end
always @(posedge ep46trigin[7]) begin
external_digout_channel_D <= ep1fwirein[3:0];
end
// USB WireOut outputs
assign ep20wireout = num_words_in_FIFO[15:0];
assign ep21wireout = num_words_in_FIFO[31:16];
assign ep22wireout = { 15'b0, SPI_running };
assign ep23wireout = TTL_in;
assign ep24wireout = { 14'b0, DCM_prog_done, dataclk_locked };
assign ep25wireout = { 12'b0, board_mode };
// Unused; future expansion
assign ep26wireout = 16'h0000;
assign ep27wireout = 16'h0000;
assign ep28wireout = 16'h0000;
assign ep29wireout = 16'h0000;
assign ep2awireout = 16'h0000;
assign ep2bwireout = 16'h0000;
assign ep2cwireout = 16'h0000;
assign ep2dwireout = 16'h0000;
assign ep2ewireout = 16'h0000;
assign ep2fwireout = 16'h0000;
assign ep30wireout = 16'h0000;
assign ep31wireout = 16'h0000;
assign ep32wireout = 16'h0000;
assign ep33wireout = 16'h0000;
assign ep34wireout = 16'h0000;
assign ep35wireout = 16'h0000;
assign ep36wireout = 16'h0000;
assign ep37wireout = 16'h0000;
assign ep38wireout = 16'h0000;
assign ep39wireout = 16'h0000;
assign ep3awireout = 16'h0000;
assign ep3bwireout = 16'h0000;
assign ep3cwireout = 16'h0000;
assign ep3dwireout = 16'h0000;
assign ep3ewireout = BOARD_ID;
assign ep3fwireout = BOARD_VERSION;
// OPen Ephys board status LEDs
//assign LED_OUT = 1'b0; // use to set to 0
// led controller for
// format is 24 bit red,blue,green, least? significant bit first color cor current led
LED_controller WS2812controller(
.dat_out(LED_OUT), // output to led string
.reset(reset),
.clk(clk1), // 100MHz clock
/* .led1(24'b000000000000000000000000),
.led2(24'b000000000000000000000000),
.led3(24'b000000000000000000000000),
.led4(24'b000000000000000000000000),
.led5(24'b000000000000000000000000),
.led6(24'b000000000000000000000000),
.led7(24'b000000000000000000000000),
.led8(24'b101010101010101010101010)
);
*/
.led1({data_stream_7_en_in ? {8'b00010010,8'b01000000,8'b10000000} : {8'b10000010,8'b10000010,8'b10000010}}), // 4 SPI cable status LEDs
.led2({data_stream_5_en_in ? {8'b00010010,8'b01000000,8'b10000000} : {8'b10000010,8'b10000010,8'b10000010}}),
.led3({data_stream_3_en_in ? {8'b00010010,8'b01000000,8'b10000000} : {8'b10000010,8'b10000010,8'b10000010}}),
.led4({data_stream_1_en_in ? {8'b00010010,8'b01000000,8'b10000000} : {8'b10000010,8'b10000010,8'b10000010}}),
.led5({{8'b00010010,8'b01000010},TTL_in}), // TTL in
.led6({{8'b00010010,8'b01000010},TTL_out}), // TTL out
.led7({8'b10000010,8'b10000010,8'b10000010}), // Ain
//.led8({DAC_register_1,DAC_register_2,8'b00000000}) //Aout
.led8({SPI_running ? {DAC_register_1,DAC_register_2,8'b00000000} : {8'b10000010,8'b10000010,8'b10000010}})
);
// 8-LED Display on Opal Kelly board
assign led = ~{ led_in };
// Variable frequency data clock generator
variable_freq_clk_generator #(
.M_DEFAULT (42), // default sample frequency = 30 kS/s/channel
.D_DEFAULT (25)
)
variable_freq_clk_generator_inst
(
.clk1 (clk1),
.ti_clk (ti_clk),
.reset (reset),
.M (dataclk_M),
.D (dataclk_D),
.DCM_prog_trigger (DCM_prog_trigger),
.clkout (dataclk),
.DCM_prog_done (DCM_prog_done),
.locked (dataclk_locked)
);
// SDRAM FIFO that regulates data flow from Xilinx FPGA to USB interface
SDRAM_FIFO #(
.C3_P0_MASK_SIZE (C3_P0_MASK_SIZE),
.C3_P0_DATA_PORT_SIZE (C3_P0_DATA_PORT_SIZE),
.C3_P1_MASK_SIZE (C3_P1_MASK_SIZE),
.C3_P1_DATA_PORT_SIZE (C3_P1_DATA_PORT_SIZE),
.DEBUG_EN (DEBUG_EN),
.C3_MEMCLK_PERIOD (C3_MEMCLK_PERIOD),
.C3_CALIB_SOFT_IP (C3_CALIB_SOFT_IP),
.C3_SIMULATION (C3_SIMULATION),
.C3_HW_TESTING (C3_HW_TESTING),
.C3_RST_ACT_LOW (C3_RST_ACT_LOW),
.C3_INPUT_CLK_TYPE (C3_INPUT_CLK_TYPE),
.C3_MEM_ADDR_ORDER (C3_MEM_ADDR_ORDER),
.C3_NUM_DQ_PINS (C3_NUM_DQ_PINS),
.C3_MEM_ADDR_WIDTH (C3_MEM_ADDR_WIDTH),
.C3_MEM_BANKADDR_WIDTH (C3_MEM_BANKADDR_WIDTH)
)
SDRAM_FIFO_inst
(
.ti_clk (ti_clk),
.data_in_clk (dataclk),
.clk1_in (clk1_in),
.clk1_out (clk1),
.reset (reset),
.FIFO_write_to (FIFO_write_to),
.FIFO_data_in (FIFO_data_in),
.FIFO_read_from (FIFO_read_from),
.FIFO_data_out (FIFO_data_out),
.num_words_in_FIFO (num_words_in_FIFO),
.mcb3_dram_dq (mcb3_dram_dq),
.mcb3_dram_a (mcb3_dram_a),
.mcb3_dram_ba (mcb3_dram_ba),
.mcb3_dram_ras_n (mcb3_dram_ras_n),
.mcb3_dram_cas_n (mcb3_dram_cas_n),
.mcb3_dram_we_n (mcb3_dram_we_n),
.mcb3_dram_odt (mcb3_dram_odt),
.mcb3_dram_cke (mcb3_dram_cke),
.mcb3_dram_dm (mcb3_dram_dm),
.mcb3_dram_udqs (mcb3_dram_udqs),
.mcb3_dram_udqs_n (mcb3_dram_udqs_n),
.mcb3_rzq (mcb3_rzq),
.mcb3_zio (mcb3_zio),
.mcb3_dram_udm (mcb3_dram_udm),
.mcb3_dram_dqs (mcb3_dram_dqs),
.mcb3_dram_dqs_n (mcb3_dram_dqs_n),
.mcb3_dram_ck (mcb3_dram_ck),
.mcb3_dram_ck_n (mcb3_dram_ck_n),
.mcb3_dram_cs_n (mcb3_dram_cs_n)
);
// MOSI auxiliary command sequence RAM banks
RAM_bank RAM_bank_1(
.clk_A(ti_clk),
.clk_B(dataclk),
.RAM_bank_sel_A(RAM_bank_sel_wr),
.RAM_bank_sel_B(RAM_bank_sel_rd),
.RAM_addr_A(RAM_addr_wr),
.RAM_addr_B(RAM_addr_rd),
.RAM_data_in(RAM_data_in),
.RAM_data_out_A(),
.RAM_data_out_B(RAM_data_out_1_pre),
.RAM_we(RAM_we_1),
.reset(reset)
);
wire external_fast_settle_rising_edge, external_fast_settle_falling_edge;
assign external_fast_settle_rising_edge = external_fast_settle_prev == 1'b0 && external_fast_settle == 1'b1;
assign external_fast_settle_falling_edge = external_fast_settle_prev == 1'b1 && external_fast_settle == 1'b0;
// If the user has enabled external fast settling of amplifiers, inject commands to set fast settle
// (bit D[5] in RAM Register 0) on a rising edge and reset fast settle on a falling edge of the control
// signal. We only inject commands in the auxcmd1 slot, since this is typically used only for setting
// impedance test waveforms.
always @(*) begin
if (external_fast_settle_enable == 1'b0)
RAM_data_out_1 <= RAM_data_out_1_pre; // If external fast settle is disabled, pass command from RAM
else if (external_fast_settle_rising_edge)
RAM_data_out_1 <= 16'h80fe; // Send WRITE(0, 254) command to set fast settle when rising edge detected.
else if (external_fast_settle_falling_edge)
RAM_data_out_1 <= 16'h80de; // Send WRITE(0, 222) command to reset fast settle when falling edge detected.
else if (RAM_data_out_1_pre[15:8] == 8'h80)
// If the user tries to write to Register 0, override it with the external fast settle value.
RAM_data_out_1 <= { RAM_data_out_1_pre[15:6], external_fast_settle, RAM_data_out_1_pre[4:0] };
else RAM_data_out_1 <= RAM_data_out_1_pre; // Otherwise pass command from RAM.
end
RAM_bank RAM_bank_2(
.clk_A(ti_clk),
.clk_B(dataclk),
.RAM_bank_sel_A(RAM_bank_sel_wr),
.RAM_bank_sel_B(RAM_bank_sel_rd),
.RAM_addr_A(RAM_addr_wr),
.RAM_addr_B(RAM_addr_rd),
.RAM_data_in(RAM_data_in),
.RAM_data_out_A(),
.RAM_data_out_B(RAM_data_out_2_pre),
.RAM_we(RAM_we_2),
.reset(reset)
);
always @(*) begin
if (external_fast_settle_enable == 1'b1 && RAM_data_out_2_pre[15:8] == 8'h80)
// If the user tries to write to Register 0 when external fast settle is enabled, override it
// with the external fast settle value.
RAM_data_out_2 <= { RAM_data_out_2_pre[15:6], external_fast_settle, RAM_data_out_2_pre[4:0] };
else RAM_data_out_2 <= RAM_data_out_2_pre;
end
RAM_bank RAM_bank_3(
.clk_A(ti_clk),
.clk_B(dataclk),
.RAM_bank_sel_A(RAM_bank_sel_wr),
.RAM_bank_sel_B(RAM_bank_sel_rd),
.RAM_addr_A(RAM_addr_wr),
.RAM_addr_B(RAM_addr_rd),
.RAM_data_in(RAM_data_in),
.RAM_data_out_A(),
.RAM_data_out_B(RAM_data_out_3_pre),
.RAM_we(RAM_we_3),
.reset(reset)
);
always @(*) begin
if (external_fast_settle_enable == 1'b1 && RAM_data_out_3_pre[15:8] == 8'h80)
// If the user tries to write to Register 0 when external fast settle is enabled, override it
// with the external fast settle value.
RAM_data_out_3 <= { RAM_data_out_3_pre[15:6], external_fast_settle, RAM_data_out_3_pre[4:0] };
else RAM_data_out_3 <= RAM_data_out_3_pre;
end
command_selector command_selector_A (
.channel(channel), .DSP_settle(DSP_settle), .aux_cmd(aux_cmd_A), .digout_override(external_digout_A), .MOSI_cmd(MOSI_cmd_selected_A));
command_selector command_selector_B (
.channel(channel), .DSP_settle(DSP_settle), .aux_cmd(aux_cmd_B), .digout_override(external_digout_B), .MOSI_cmd(MOSI_cmd_selected_B));
command_selector command_selector_C (
.channel(channel), .DSP_settle(DSP_settle), .aux_cmd(aux_cmd_C), .digout_override(external_digout_C), .MOSI_cmd(MOSI_cmd_selected_C));
command_selector command_selector_D (
.channel(channel), .DSP_settle(DSP_settle), .aux_cmd(aux_cmd_D), .digout_override(external_digout_D), .MOSI_cmd(MOSI_cmd_selected_D));
assign header_magic_number = 64'hC691199927021942; // Fixed 64-bit "magic number" that begins each data frame
// to aid in synchronization.
assign data_stream_filler = 16'd0;
integer main_state;
localparam
ms_wait = 99,
ms_clk1_a = 100,
ms_clk1_b = 101,
ms_clk1_c = 102,
ms_clk1_d = 103,
ms_clk2_a = 104,
ms_clk2_b = 105,
ms_clk2_c = 106,
ms_clk2_d = 107,
ms_clk3_a = 108,
ms_clk3_b = 109,
ms_clk3_c = 110,
ms_clk3_d = 111,
ms_clk4_a = 112,
ms_clk4_b = 113,
ms_clk4_c = 114,
ms_clk4_d = 115,
ms_clk5_a = 116,
ms_clk5_b = 117,
ms_clk5_c = 118,
ms_clk5_d = 119,
ms_clk6_a = 120,
ms_clk6_b = 121,
ms_clk6_c = 122,
ms_clk6_d = 123,
ms_clk7_a = 124,
ms_clk7_b = 125,
ms_clk7_c = 126,
ms_clk7_d = 127,
ms_clk8_a = 128,
ms_clk8_b = 129,
ms_clk8_c = 130,
ms_clk8_d = 131,
ms_clk9_a = 132,
ms_clk9_b = 133,
ms_clk9_c = 134,
ms_clk9_d = 135,
ms_clk10_a = 136,
ms_clk10_b = 137,
ms_clk10_c = 138,
ms_clk10_d = 139,
ms_clk11_a = 140,
ms_clk11_b = 141,
ms_clk11_c = 142,
ms_clk11_d = 143,
ms_clk12_a = 144,
ms_clk12_b = 145,
ms_clk12_c = 146,
ms_clk12_d = 147,
ms_clk13_a = 148,
ms_clk13_b = 149,
ms_clk13_c = 150,
ms_clk13_d = 151,
ms_clk14_a = 152,
ms_clk14_b = 153,
ms_clk14_c = 154,
ms_clk14_d = 155,
ms_clk15_a = 156,
ms_clk15_b = 157,
ms_clk15_c = 158,
ms_clk15_d = 159,
ms_clk16_a = 160,
ms_clk16_b = 161,
ms_clk16_c = 162,
ms_clk16_d = 163,
ms_clk17_a = 164,
ms_clk17_b = 165,
ms_cs_a = 166,
ms_cs_b = 167,
ms_cs_c = 168,
ms_cs_d = 169,
ms_cs_e = 170,
ms_cs_f = 171,
ms_cs_g = 172,
ms_cs_h = 173,
ms_cs_i = 174,
ms_cs_j = 175,
ms_cs_k = 176,
ms_cs_l = 177,
ms_cs_m = 178,
ms_cs_n = 179;
always @(posedge dataclk) begin
if (reset) begin
main_state <= ms_wait;
timestamp <= 0;
sample_clk <= 0;
channel <= 0;
CS_b <= 1'b1;
SCLK <= 1'b0;
MOSI_A <= 1'b0;
MOSI_B <= 1'b0;
MOSI_C <= 1'b0;
MOSI_D <= 1'b0;
FIFO_data_in <= 16'b0;
FIFO_write_to <= 1'b0;
end else begin
CS_b <= 1'b0;
SCLK <= 1'b0;
FIFO_data_in <= 16'b0;
FIFO_write_to <= 1'b0;
case (main_state)
ms_wait: begin
timestamp <= 0;
sample_clk <= 0;
channel <= 0;
channel_MISO <= 33; // channel of MISO output, accounting for 2-cycle pipeline in RHD2000 SPI interface (Bug fix: changed 2 to 33, 1/26/13)
CS_b <= 1'b1;
SCLK <= 1'b0;
MOSI_A <= 1'b0;
MOSI_B <= 1'b0;
MOSI_C <= 1'b0;
MOSI_D <= 1'b0;
FIFO_data_in <= 16'b0;
FIFO_write_to <= 1'b0;
aux_cmd_index_1 <= 0;
aux_cmd_index_2 <= 0;
aux_cmd_index_3 <= 0;
max_aux_cmd_index_1 <= max_aux_cmd_index_1_in;
max_aux_cmd_index_2 <= max_aux_cmd_index_2_in;
max_aux_cmd_index_3 <= max_aux_cmd_index_3_in;
aux_cmd_bank_1_A <= aux_cmd_bank_1_A_in;
aux_cmd_bank_1_B <= aux_cmd_bank_1_B_in;
aux_cmd_bank_1_C <= aux_cmd_bank_1_C_in;