axi_adc_trigger: Added trigger delay register, renamed fifo depth register
parent
491602d88b
commit
3148c85f73
|
@ -53,7 +53,7 @@ module axi_adc_trigger(
|
|||
output data_valid_a_trig,
|
||||
output data_valid_b_trig,
|
||||
|
||||
output [31:0] trigger_offset,
|
||||
output [31:0] fifo_depth,
|
||||
|
||||
// axi interface
|
||||
|
||||
|
@ -111,7 +111,7 @@ module axi_adc_trigger(
|
|||
wire [ 3:0] trigger_l_mix_b;
|
||||
|
||||
wire [ 2:0] trigger_out_mix;
|
||||
wire [31:0] delay_trigger;
|
||||
wire [31:0] trigger_delay;
|
||||
|
||||
wire [15:0] data_a_cmp;
|
||||
wire [15:0] data_b_cmp;
|
||||
|
@ -157,18 +157,20 @@ module axi_adc_trigger(
|
|||
|
||||
reg trigger_out_mixed;
|
||||
|
||||
reg [15:0] data_a_r;
|
||||
reg [15:0] data_b_r;
|
||||
reg [14:0] data_a_r;
|
||||
reg [14:0] data_b_r;
|
||||
reg data_valid_a_r;
|
||||
reg data_valid_b_r;
|
||||
|
||||
reg [31:0] trigger_delay_counter;
|
||||
reg trigger_out_delayed;
|
||||
reg triggered;
|
||||
|
||||
// signal name changes
|
||||
|
||||
assign up_clk = s_axi_aclk;
|
||||
assign up_rstn = s_axi_aresetn;
|
||||
|
||||
assign trigger_offset = delay_trigger;
|
||||
|
||||
assign trigger_t = io_selection;
|
||||
|
||||
assign trigger_a_fall_edge = (trigger_a_d2 == 1'b0 && trigger_a_d3 == 1'b1) ? 1'b1: 1'b0;
|
||||
|
@ -183,15 +185,35 @@ module axi_adc_trigger(
|
|||
assign limit_a_cmp = {!limit_a[15],limit_a[14:0]};
|
||||
assign limit_b_cmp = {!limit_b[15],limit_b[14:0]};
|
||||
|
||||
assign data_a_trig = {trigger_out_mixed, data_a_r[14:0]};
|
||||
assign data_b_trig = {trigger_out_mixed, data_b_r[14:0]};;
|
||||
assign data_a_trig = trigger_delay == 32'h0 ? {trigger_out_mixed, data_a_r} :{trigger_out_delayed, data_a_r} ;
|
||||
assign data_b_trig = trigger_delay == 32'h0 ? {trigger_out_mixed, data_b_r} :{trigger_out_delayed, data_b_r};
|
||||
assign data_valid_a_trig = data_valid_a_r;
|
||||
assign data_valid_b_trig = data_valid_b_r;
|
||||
|
||||
always @(posedge clk) begin
|
||||
data_a_r <= data_a;
|
||||
if (trigger_delay == 0) begin
|
||||
trigger_delay_counter <= 32'h0;
|
||||
end else begin
|
||||
if (data_valid_a_r == 1'b1) begin
|
||||
triggered <= trigger_out_mixed;
|
||||
trigger_out_delayed <= 1'b0;
|
||||
if (trigger_delay_counter == 0) begin
|
||||
trigger_delay_counter <= trigger_delay;
|
||||
trigger_out_delayed <= 1'b1;
|
||||
triggered <= 1'b0;
|
||||
end else begin
|
||||
if(triggered == 1'b1) begin
|
||||
trigger_delay_counter <= trigger_delay_counter - 1;
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
always @(posedge clk) begin
|
||||
data_a_r <= data_a[14:0];
|
||||
data_valid_a_r <= data_valid_a;
|
||||
data_b_r <= data_b;
|
||||
data_b_r <= data_b[14:0];
|
||||
data_valid_b_r <= data_valid_b;
|
||||
end
|
||||
|
||||
|
@ -362,7 +384,8 @@ module axi_adc_trigger(
|
|||
.trigger_l_mix_b(trigger_l_mix_b),
|
||||
|
||||
.trigger_out_mix(trigger_out_mix),
|
||||
.delay_trigger(delay_trigger),
|
||||
.trigger_delay(trigger_delay),
|
||||
.fifo_depth(fifo_depth),
|
||||
|
||||
// bus interface
|
||||
|
||||
|
|
|
@ -60,7 +60,8 @@ module axi_adc_trigger_reg (
|
|||
output [ 3:0] trigger_l_mix_b,
|
||||
|
||||
output [ 2:0] trigger_out_mix,
|
||||
output [31:0] delay_trigger,
|
||||
output [31:0] fifo_depth,
|
||||
output [31:0] trigger_delay,
|
||||
|
||||
// bus interface
|
||||
|
||||
|
@ -93,7 +94,8 @@ module axi_adc_trigger_reg (
|
|||
reg [31:0] up_hysteresis_b = 32'h0;
|
||||
reg [ 3:0] up_trigger_l_mix_b = 32'h0;
|
||||
reg [ 2:0] up_trigger_out_mix = 32'h0;
|
||||
reg [31:0] up_delay_trigger= 32'h0;
|
||||
reg [31:0] up_fifo_depth = 32'h0;
|
||||
reg [31:0] up_trigger_delay = 32'h0;
|
||||
reg up_triggered = 1'h0;
|
||||
|
||||
assign low_level = config_trigger[1:0];
|
||||
|
@ -115,7 +117,8 @@ module axi_adc_trigger_reg (
|
|||
up_limit_b <= 'd0;
|
||||
up_function_b <= 'd0;
|
||||
up_hysteresis_b <= 'd0;
|
||||
up_delay_trigger <= 'd0;
|
||||
up_fifo_depth <= 'd0;
|
||||
up_trigger_delay <= 'd0;
|
||||
up_trigger_l_mix_a <= 'd0;
|
||||
up_trigger_l_mix_b <= 'd0;
|
||||
up_trigger_out_mix <= 'd0;
|
||||
|
@ -162,13 +165,16 @@ module axi_adc_trigger_reg (
|
|||
up_trigger_out_mix <= up_wdata[2:0];
|
||||
end
|
||||
if ((up_wreq == 1'b1) && (up_waddr[4:0] == 5'he)) begin
|
||||
up_delay_trigger <= up_wdata;
|
||||
up_fifo_depth <= up_wdata;
|
||||
end
|
||||
// if (triggered == 1'b1) begin
|
||||
// up_triggered <= 1'b1;
|
||||
// end else if ((up_wreq == 1'b1) && (up_waddr[4:0] == 5'hf)) begin
|
||||
// up_triggered <= up_wdata[0];
|
||||
// end
|
||||
if ((up_wreq == 1'b1) && (up_waddr[4:0] == 5'h10)) begin
|
||||
up_trigger_delay <= up_wdata;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -196,8 +202,9 @@ module axi_adc_trigger_reg (
|
|||
5'hb: up_rdata <= up_hysteresis_b;
|
||||
5'hc: up_rdata <= {28'h0,up_trigger_l_mix_b};
|
||||
5'hd: up_rdata <= {29'h0,up_trigger_out_mix};
|
||||
5'he: up_rdata <= up_delay_trigger;
|
||||
5'he: up_rdata <= up_fifo_depth;
|
||||
5'hf: up_rdata <= {31'h0,up_triggered};
|
||||
5'h10: up_rdata <= up_trigger_delay;
|
||||
default: up_rdata <= 0;
|
||||
endcase
|
||||
end else begin
|
||||
|
@ -206,7 +213,7 @@ module axi_adc_trigger_reg (
|
|||
end
|
||||
end
|
||||
|
||||
up_xfer_cntrl #(.DATA_WIDTH(153)) i_xfer_cntrl (
|
||||
up_xfer_cntrl #(.DATA_WIDTH(185)) i_xfer_cntrl (
|
||||
.up_rstn (up_rstn),
|
||||
.up_clk (up_clk),
|
||||
.up_data_cntrl ({ up_config_trigger, // 10
|
||||
|
@ -219,7 +226,8 @@ module axi_adc_trigger_reg (
|
|||
up_hysteresis_b, // 32
|
||||
up_trigger_l_mix_b, // 4
|
||||
up_trigger_out_mix, // 3
|
||||
up_delay_trigger}), // 32
|
||||
up_fifo_depth, // 32
|
||||
up_trigger_delay}), // 32
|
||||
|
||||
.up_xfer_done (),
|
||||
.d_rst (1'b0),
|
||||
|
@ -234,7 +242,8 @@ module axi_adc_trigger_reg (
|
|||
hysteresis_b, // 32
|
||||
trigger_l_mix_b, // 4
|
||||
trigger_out_mix, // 3
|
||||
delay_trigger})); // 32
|
||||
fifo_depth, // 32
|
||||
trigger_delay})); // 32
|
||||
|
||||
endmodule
|
||||
|
||||
|
|
Loading…
Reference in New Issue