From d43e6ee23956eb4f59eadda73509d93ca44fa339 Mon Sep 17 00:00:00 2001 From: Istvan Csomortani Date: Thu, 18 Jul 2019 14:02:35 +0100 Subject: [PATCH] axi_laser_driver: TIA's are controlled individually in manual mode Update the sequencer, so the TIA channel selection can be controlled separately for each TIA, when the sequencer runs in manual mode. --- library/axi_laser_driver/axi_laser_driver.v | 16 ++++++------- .../axi_laser_driver_regmap.v | 23 +++++++++++++------ .../common/ad_fmclidar1_ebz_bd.tcl | 2 +- .../ad_fmclidar1_ebz/common/util_tia_chsel.v | 4 ++-- .../ad_fmclidar1_ebz/zc706/system_constr.xdc | 20 ++++++++-------- projects/ad_fmclidar1_ebz/zc706/system_top.v | 12 ++-------- 6 files changed, 39 insertions(+), 38 deletions(-) diff --git a/library/axi_laser_driver/axi_laser_driver.v b/library/axi_laser_driver/axi_laser_driver.v index e0753cfae..5f5e512ed 100644 --- a/library/axi_laser_driver/axi_laser_driver.v +++ b/library/axi_laser_driver/axi_laser_driver.v @@ -72,7 +72,7 @@ module axi_laser_driver #( output driver_pulse, input driver_otw_n, output driver_dp_reset, - output reg [ 1:0] tia_chsel, + output reg [ 7:0] tia_chsel, // interrupt @@ -116,7 +116,7 @@ module axi_laser_driver #( wire [ 1:0] auto_seq1_s; wire [ 1:0] auto_seq2_s; wire [ 1:0] auto_seq3_s; - wire [ 1:0] manual_select_s; + wire [ 7:0] manual_select_s; // local parameters @@ -247,16 +247,16 @@ module axi_laser_driver #( always @(posedge clk) begin if (sequence_en_s == 1'b0) begin - tia_chsel <= 2'b0; + tia_chsel <= 8'h00; end else begin if (pulse_counter_s == sequence_offset_s) begin if (auto_sequence_s) begin case (sequence_counter) - 2'b00 : tia_chsel <= auto_seq0_s; - 2'b01 : tia_chsel <= auto_seq1_s; - 2'b10 : tia_chsel <= auto_seq2_s; - 2'b11 : tia_chsel <= auto_seq3_s; - default : tia_chsel <= 2'b00; + 2'b00 : tia_chsel <= {auto_seq0_s, auto_seq0_s, auto_seq0_s, auto_seq0_s}; + 2'b01 : tia_chsel <= {auto_seq1_s, auto_seq1_s, auto_seq1_s, auto_seq1_s}; + 2'b10 : tia_chsel <= {auto_seq2_s, auto_seq2_s, auto_seq2_s, auto_seq2_s}; + 2'b11 : tia_chsel <= {auto_seq3_s, auto_seq3_s, auto_seq3_s, auto_seq3_s}; + default : tia_chsel <= 8'h00; endcase end else begin tia_chsel <= manual_select_s; diff --git a/library/axi_laser_driver/axi_laser_driver_regmap.v b/library/axi_laser_driver/axi_laser_driver_regmap.v index 4636087c0..541eae9a1 100644 --- a/library/axi_laser_driver/axi_laser_driver_regmap.v +++ b/library/axi_laser_driver/axi_laser_driver_regmap.v @@ -61,7 +61,7 @@ module axi_laser_driver_regmap #( output [ 1:0] auto_seq2, output [ 1:0] auto_seq3, - output [ 1:0] manual_select, + output [ 7:0] manual_select, // processor interface @@ -91,7 +91,7 @@ module axi_laser_driver_regmap #( reg [ 1:0] up_auto_seq1 = 2'b01; reg [ 1:0] up_auto_seq2 = 2'b10; reg [ 1:0] up_auto_seq3 = 2'b11; - reg [ 1:0] up_manual_select = 2'b00; + reg [ 7:0] up_manual_select = 8'h00; // internal signals @@ -122,7 +122,7 @@ module axi_laser_driver_regmap #( up_auto_seq1 <= 2'b01; up_auto_seq2 <= 2'b10; up_auto_seq3 <= 2'b11; - up_manual_select <= 2'b00; + up_manual_select <= 8'h00; end else begin up_wack <= up_wreq_int_s; if ((up_wreq_int_s == 1'b1) && (up_waddr[3:0] == 4'h0)) begin @@ -145,7 +145,10 @@ module axi_laser_driver_regmap #( up_auto_seq3 <= up_wdata[13:12]; end if ((up_wreq_int_s == 1'b1) && (up_waddr[3:0] == 4'hE)) begin - up_sequence_offset <= up_wdata[1:0]; + up_manual_select <= {up_wdata[13:12], + up_wdata[9:8], + up_wdata[5:4], + up_wdata[1:0]}; end end end @@ -166,8 +169,14 @@ module axi_laser_driver_regmap #( 5'h0A: up_rdata <= {29'h0, up_irq_pending_s}; 5'h0B: up_rdata <= {30'h0, up_auto_sequence, up_sequence_en}; 5'h0C: up_rdata <= up_sequence_offset; - 5'h0D: up_rdata <= {16'h0, up_auto_seq3, 2'b0, up_auto_seq2, 2'b0, up_auto_seq1, 2'b0, up_auto_seq0}; - 5'h0E: up_rdata <= {30'h0, up_manual_select}; + 5'h0D: up_rdata <= {18'h0, up_auto_seq3, + 2'h0, up_auto_seq2, + 2'h0, up_auto_seq1, + 2'h0, up_auto_seq0}; + 5'h0E: up_rdata <= {18'h0, up_manual_select[7:6], + 2'h0, up_manual_select[5:4], + 2'h0, up_manual_select[3:2], + 2'h0, up_manual_select[1:0]}; default: up_rdata <= 0; endcase @@ -240,7 +249,7 @@ module axi_laser_driver_regmap #( .out_bits ({auto_sequence, sequence_en})); sync_bits #( - .NUM_OF_BITS (10), + .NUM_OF_BITS (16), .ASYNC_CLK (1)) i_sequencer_sync ( .in_bits ({up_auto_seq3, diff --git a/projects/ad_fmclidar1_ebz/common/ad_fmclidar1_ebz_bd.tcl b/projects/ad_fmclidar1_ebz/common/ad_fmclidar1_ebz_bd.tcl index 8ca722378..4b30fa080 100644 --- a/projects/ad_fmclidar1_ebz/common/ad_fmclidar1_ebz_bd.tcl +++ b/projects/ad_fmclidar1_ebz/common/ad_fmclidar1_ebz_bd.tcl @@ -21,7 +21,7 @@ create_bd_port -dir I spi_afe_adc_sdi_i create_bd_port -dir O laser_driver create_bd_port -dir O laser_driver_en_n create_bd_port -dir I laser_driver_otw_n -create_bd_port -dir O -from 1 -to 0 tia_chsel +create_bd_port -dir O -from 7 -to 0 tia_chsel # adc peripherals - controlled by PS7/SPI0 diff --git a/projects/ad_fmclidar1_ebz/common/util_tia_chsel.v b/projects/ad_fmclidar1_ebz/common/util_tia_chsel.v index 200ecf05a..5925659b9 100644 --- a/projects/ad_fmclidar1_ebz/common/util_tia_chsel.v +++ b/projects/ad_fmclidar1_ebz/common/util_tia_chsel.v @@ -44,7 +44,7 @@ module util_tia_chsel #( input adc_tia_chsel_en, output [DATA_WIDTH-1:0] adc_data_tia_chsel, - input [ 1:0] tia_chsel); + input [ 7:0] tia_chsel); (* keep = "TRUE" *)reg [DATA_WIDTH-1:0] adc_data_tia_chsel_int; @@ -53,7 +53,7 @@ module util_tia_chsel #( for (i=0; i