2017-01-31 14:20:13 +00:00
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
2017-05-17 08:44:52 +00:00
|
|
|
// Copyright 2014 - 2017 (c) Analog Devices, Inc. All rights reserved.
|
2017-01-31 14:20:13 +00:00
|
|
|
//
|
2017-05-31 15:15:24 +00:00
|
|
|
// In this HDL repository, there are many different and unique modules, consisting
|
|
|
|
// of various HDL (Verilog or VHDL) components. The individual modules are
|
|
|
|
// developed independently, and may be accompanied by separate and unique license
|
|
|
|
// terms.
|
|
|
|
//
|
|
|
|
// The user should read each of these license terms, and understand the
|
2018-03-14 14:45:47 +00:00
|
|
|
// freedoms and responsibilities that he or she has by using this source/core.
|
2017-05-31 15:15:24 +00:00
|
|
|
//
|
|
|
|
// This core is distributed in the hope that it will be useful, but WITHOUT ANY
|
2017-05-29 06:55:41 +00:00
|
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
|
|
// A PARTICULAR PURPOSE.
|
2017-01-31 14:20:13 +00:00
|
|
|
//
|
2017-05-29 06:55:41 +00:00
|
|
|
// Redistribution and use of source or resulting binaries, with or without modification
|
|
|
|
// of this file, are permitted under one of the following two license terms:
|
2017-01-31 14:20:13 +00:00
|
|
|
//
|
2017-05-17 08:44:52 +00:00
|
|
|
// 1. The GNU General Public License version 2 as published by the
|
2017-05-31 15:15:24 +00:00
|
|
|
// Free Software Foundation, which can be found in the top level directory
|
|
|
|
// of this repository (LICENSE_GPL2), and also online at:
|
|
|
|
// <https://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
|
2017-05-17 08:44:52 +00:00
|
|
|
//
|
|
|
|
// OR
|
|
|
|
//
|
2017-05-31 15:15:24 +00:00
|
|
|
// 2. An ADI specific BSD license, which can be found in the top level directory
|
|
|
|
// of this repository (LICENSE_ADIBSD), and also on-line at:
|
2017-05-29 06:55:41 +00:00
|
|
|
// https://github.com/analogdevicesinc/hdl/blob/master/LICENSE_ADIBSD
|
|
|
|
// This will allow to generate bit files and not release the source code,
|
|
|
|
// as long as it attaches to an ADI device.
|
2017-01-31 14:20:13 +00:00
|
|
|
//
|
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
|
|
|
|
|
|
|
`timescale 1ns/100ps
|
|
|
|
|
2019-02-05 07:14:24 +00:00
|
|
|
module axi_adc_trigger #(
|
|
|
|
|
|
|
|
// parameters
|
|
|
|
|
|
|
|
parameter SIGN_BITS = 2) (
|
|
|
|
|
|
|
|
// interface
|
2017-01-31 14:20:13 +00:00
|
|
|
|
|
|
|
input clk,
|
|
|
|
|
axi_adc_trigger: Add cascade support.
- Add embedded trigger as an option. The use of the embedded trigger as an
option in the data stream is done for further processing, keeping the data
synchronized with the trigger.
When instrument (module) trigger is desired (logic_analyzer - adc_trigger),
a small propagation time is required, hence the need to remove the
util_extract(trigger extract) module from the data path.
- Add more options for the IO triggering. This will open the door for multiple
M2k synchronization(triggering).
trigger_o mux:
1 - trigger flag (from regmap)
2 - external pin trigger (Ti)
3 - external pin trigger (To)
4 - internal adc trigger
5 - logic analyzer trigger
The signal passed to trigger_o must not be delayed, but the new value has to be
kept for a short period, 1ms (100000 clock cycles), to reduce switch noises in
the system.
The axi_adc_trigger handles 3 output triggers:
- trigger_o - external trigger (1 clock cycle delay)
- trigger_out - signals on dmac/fifo_wr_sync the start of a new transfer.
A variable fifo depth is present in the data path, which delays the data
arriving at the DMA with 3 clock cycles. By coincidence, the external trigger
is synchronized and detected on 3 clock cycles. To get a maximum optimization
the trigger_out will be delayed with 3 clock cycles for internal triggers and
directly forwarded in the case of an external trigger.
- trigger_out_la (cascade trigger for logic_analyzer - m2k example)
Because the trigger_out_la must have a small delay, to get a realible
instrument triggering mechanism, a 1 delay clock cycle must be added on the
trigger paths, to avoid creating a closed combinatorial loop.
Increase pcore version. The major version 3 is used to describe the instrument
trigger updates.
2019-03-08 14:21:38 +00:00
|
|
|
input trigger_in,
|
|
|
|
|
2017-01-31 14:20:13 +00:00
|
|
|
input [ 1:0] trigger_i,
|
axi_adc_trigger: Add cascade support.
- Add embedded trigger as an option. The use of the embedded trigger as an
option in the data stream is done for further processing, keeping the data
synchronized with the trigger.
When instrument (module) trigger is desired (logic_analyzer - adc_trigger),
a small propagation time is required, hence the need to remove the
util_extract(trigger extract) module from the data path.
- Add more options for the IO triggering. This will open the door for multiple
M2k synchronization(triggering).
trigger_o mux:
1 - trigger flag (from regmap)
2 - external pin trigger (Ti)
3 - external pin trigger (To)
4 - internal adc trigger
5 - logic analyzer trigger
The signal passed to trigger_o must not be delayed, but the new value has to be
kept for a short period, 1ms (100000 clock cycles), to reduce switch noises in
the system.
The axi_adc_trigger handles 3 output triggers:
- trigger_o - external trigger (1 clock cycle delay)
- trigger_out - signals on dmac/fifo_wr_sync the start of a new transfer.
A variable fifo depth is present in the data path, which delays the data
arriving at the DMA with 3 clock cycles. By coincidence, the external trigger
is synchronized and detected on 3 clock cycles. To get a maximum optimization
the trigger_out will be delayed with 3 clock cycles for internal triggers and
directly forwarded in the case of an external trigger.
- trigger_out_la (cascade trigger for logic_analyzer - m2k example)
Because the trigger_out_la must have a small delay, to get a realible
instrument triggering mechanism, a 1 delay clock cycle must be added on the
trigger paths, to avoid creating a closed combinatorial loop.
Increase pcore version. The major version 3 is used to describe the instrument
trigger updates.
2019-03-08 14:21:38 +00:00
|
|
|
output reg [ 1:0] trigger_o,
|
2017-01-31 14:20:13 +00:00
|
|
|
output [ 1:0] trigger_t,
|
|
|
|
|
|
|
|
input [15:0] data_a,
|
|
|
|
input [15:0] data_b,
|
|
|
|
input data_valid_a,
|
|
|
|
input data_valid_b,
|
|
|
|
|
|
|
|
output [15:0] data_a_trig,
|
|
|
|
output [15:0] data_b_trig,
|
|
|
|
output data_valid_a_trig,
|
|
|
|
output data_valid_b_trig,
|
axi_adc_trigger: Add cascade support.
- Add embedded trigger as an option. The use of the embedded trigger as an
option in the data stream is done for further processing, keeping the data
synchronized with the trigger.
When instrument (module) trigger is desired (logic_analyzer - adc_trigger),
a small propagation time is required, hence the need to remove the
util_extract(trigger extract) module from the data path.
- Add more options for the IO triggering. This will open the door for multiple
M2k synchronization(triggering).
trigger_o mux:
1 - trigger flag (from regmap)
2 - external pin trigger (Ti)
3 - external pin trigger (To)
4 - internal adc trigger
5 - logic analyzer trigger
The signal passed to trigger_o must not be delayed, but the new value has to be
kept for a short period, 1ms (100000 clock cycles), to reduce switch noises in
the system.
The axi_adc_trigger handles 3 output triggers:
- trigger_o - external trigger (1 clock cycle delay)
- trigger_out - signals on dmac/fifo_wr_sync the start of a new transfer.
A variable fifo depth is present in the data path, which delays the data
arriving at the DMA with 3 clock cycles. By coincidence, the external trigger
is synchronized and detected on 3 clock cycles. To get a maximum optimization
the trigger_out will be delayed with 3 clock cycles for internal triggers and
directly forwarded in the case of an external trigger.
- trigger_out_la (cascade trigger for logic_analyzer - m2k example)
Because the trigger_out_la must have a small delay, to get a realible
instrument triggering mechanism, a 1 delay clock cycle must be added on the
trigger paths, to avoid creating a closed combinatorial loop.
Increase pcore version. The major version 3 is used to describe the instrument
trigger updates.
2019-03-08 14:21:38 +00:00
|
|
|
output reg trigger_out,
|
|
|
|
output reg trigger_out_la,
|
2017-01-31 14:20:13 +00:00
|
|
|
|
2017-06-06 12:35:59 +00:00
|
|
|
output [31:0] fifo_depth,
|
2017-01-31 14:20:13 +00:00
|
|
|
|
|
|
|
// axi interface
|
|
|
|
|
|
|
|
input s_axi_aclk,
|
|
|
|
input s_axi_aresetn,
|
|
|
|
input s_axi_awvalid,
|
2017-04-10 17:30:57 +00:00
|
|
|
input [ 6:0] s_axi_awaddr,
|
2017-01-31 14:20:13 +00:00
|
|
|
input [ 2:0] s_axi_awprot,
|
|
|
|
output s_axi_awready,
|
|
|
|
input s_axi_wvalid,
|
|
|
|
input [31:0] s_axi_wdata,
|
|
|
|
input [ 3:0] s_axi_wstrb,
|
|
|
|
output s_axi_wready,
|
|
|
|
output s_axi_bvalid,
|
|
|
|
output [ 1:0] s_axi_bresp,
|
|
|
|
input s_axi_bready,
|
|
|
|
input s_axi_arvalid,
|
2017-04-10 17:30:57 +00:00
|
|
|
input [ 6:0] s_axi_araddr,
|
2017-01-31 14:20:13 +00:00
|
|
|
input [ 2:0] s_axi_arprot,
|
|
|
|
output s_axi_arready,
|
|
|
|
output s_axi_rvalid,
|
|
|
|
output [31:0] s_axi_rdata,
|
|
|
|
output [ 1:0] s_axi_rresp,
|
|
|
|
input s_axi_rready);
|
|
|
|
|
2019-02-05 07:24:49 +00:00
|
|
|
|
|
|
|
localparam DW = 15 - SIGN_BITS;
|
|
|
|
|
2017-01-31 14:20:13 +00:00
|
|
|
// internal signals
|
|
|
|
|
2019-02-05 07:24:49 +00:00
|
|
|
wire up_clk;
|
|
|
|
wire up_rstn;
|
|
|
|
wire [ 4:0] up_waddr;
|
|
|
|
wire [31:0] up_wdata;
|
|
|
|
wire up_wack;
|
|
|
|
wire up_wreq;
|
|
|
|
wire up_rack;
|
|
|
|
wire [31:0] up_rdata;
|
|
|
|
wire up_rreq;
|
|
|
|
wire [ 4:0] up_raddr;
|
|
|
|
|
axi_adc_trigger: Add cascade support.
- Add embedded trigger as an option. The use of the embedded trigger as an
option in the data stream is done for further processing, keeping the data
synchronized with the trigger.
When instrument (module) trigger is desired (logic_analyzer - adc_trigger),
a small propagation time is required, hence the need to remove the
util_extract(trigger extract) module from the data path.
- Add more options for the IO triggering. This will open the door for multiple
M2k synchronization(triggering).
trigger_o mux:
1 - trigger flag (from regmap)
2 - external pin trigger (Ti)
3 - external pin trigger (To)
4 - internal adc trigger
5 - logic analyzer trigger
The signal passed to trigger_o must not be delayed, but the new value has to be
kept for a short period, 1ms (100000 clock cycles), to reduce switch noises in
the system.
The axi_adc_trigger handles 3 output triggers:
- trigger_o - external trigger (1 clock cycle delay)
- trigger_out - signals on dmac/fifo_wr_sync the start of a new transfer.
A variable fifo depth is present in the data path, which delays the data
arriving at the DMA with 3 clock cycles. By coincidence, the external trigger
is synchronized and detected on 3 clock cycles. To get a maximum optimization
the trigger_out will be delayed with 3 clock cycles for internal triggers and
directly forwarded in the case of an external trigger.
- trigger_out_la (cascade trigger for logic_analyzer - m2k example)
Because the trigger_out_la must have a small delay, to get a realible
instrument triggering mechanism, a 1 delay clock cycle must be added on the
trigger paths, to avoid creating a closed combinatorial loop.
Increase pcore version. The major version 3 is used to describe the instrument
trigger updates.
2019-03-08 14:21:38 +00:00
|
|
|
wire [ 7:0] io_selection;
|
2019-02-05 07:24:49 +00:00
|
|
|
|
|
|
|
wire [ 1:0] low_level;
|
|
|
|
wire [ 1:0] high_level;
|
|
|
|
wire [ 1:0] any_edge;
|
|
|
|
wire [ 1:0] rise_edge;
|
|
|
|
wire [ 1:0] fall_edge;
|
|
|
|
|
|
|
|
wire [15:0] limit_a;
|
|
|
|
wire [ 1:0] function_a;
|
|
|
|
wire [31:0] hysteresis_a;
|
|
|
|
wire [ 3:0] trigger_l_mix_a;
|
|
|
|
|
|
|
|
wire [15:0] limit_b;
|
|
|
|
wire [ 1:0] function_b;
|
|
|
|
wire [31:0] hysteresis_b;
|
|
|
|
wire [ 3:0] trigger_l_mix_b;
|
|
|
|
|
axi_adc_trigger: Add cascade support.
- Add embedded trigger as an option. The use of the embedded trigger as an
option in the data stream is done for further processing, keeping the data
synchronized with the trigger.
When instrument (module) trigger is desired (logic_analyzer - adc_trigger),
a small propagation time is required, hence the need to remove the
util_extract(trigger extract) module from the data path.
- Add more options for the IO triggering. This will open the door for multiple
M2k synchronization(triggering).
trigger_o mux:
1 - trigger flag (from regmap)
2 - external pin trigger (Ti)
3 - external pin trigger (To)
4 - internal adc trigger
5 - logic analyzer trigger
The signal passed to trigger_o must not be delayed, but the new value has to be
kept for a short period, 1ms (100000 clock cycles), to reduce switch noises in
the system.
The axi_adc_trigger handles 3 output triggers:
- trigger_o - external trigger (1 clock cycle delay)
- trigger_out - signals on dmac/fifo_wr_sync the start of a new transfer.
A variable fifo depth is present in the data path, which delays the data
arriving at the DMA with 3 clock cycles. By coincidence, the external trigger
is synchronized and detected on 3 clock cycles. To get a maximum optimization
the trigger_out will be delayed with 3 clock cycles for internal triggers and
directly forwarded in the case of an external trigger.
- trigger_out_la (cascade trigger for logic_analyzer - m2k example)
Because the trigger_out_la must have a small delay, to get a realible
instrument triggering mechanism, a 1 delay clock cycle must be added on the
trigger paths, to avoid creating a closed combinatorial loop.
Increase pcore version. The major version 3 is used to describe the instrument
trigger updates.
2019-03-08 14:21:38 +00:00
|
|
|
wire [16:0] trigger_out_control;
|
2019-02-05 07:24:49 +00:00
|
|
|
wire [31:0] trigger_delay;
|
|
|
|
|
|
|
|
wire signed [DW:0] data_a_cmp;
|
|
|
|
wire signed [DW:0] data_b_cmp;
|
|
|
|
wire signed [DW:0] limit_a_cmp;
|
|
|
|
wire signed [DW:0] limit_b_cmp;
|
|
|
|
|
|
|
|
wire comp_low_a_s; // signal is over the limit
|
|
|
|
wire comp_low_b_s; // signal is over the limit
|
|
|
|
wire passthrough_high_a_s; // trigger when rising through the limit
|
|
|
|
wire passthrough_low_a_s; // trigger when fallingh thorugh the limit
|
|
|
|
wire passthrough_high_b_s; // trigger when rising through the limit
|
|
|
|
wire passthrough_low_b_s; // trigger when fallingh thorugh the limit
|
|
|
|
wire trigger_a_fall_edge;
|
|
|
|
wire trigger_a_rise_edge;
|
|
|
|
wire trigger_b_fall_edge;
|
|
|
|
wire trigger_b_rise_edge;
|
|
|
|
wire trigger_a_any_edge;
|
|
|
|
wire trigger_b_any_edge;
|
|
|
|
wire trigger_out_delayed;
|
axi_adc_trigger: Add cascade support.
- Add embedded trigger as an option. The use of the embedded trigger as an
option in the data stream is done for further processing, keeping the data
synchronized with the trigger.
When instrument (module) trigger is desired (logic_analyzer - adc_trigger),
a small propagation time is required, hence the need to remove the
util_extract(trigger extract) module from the data path.
- Add more options for the IO triggering. This will open the door for multiple
M2k synchronization(triggering).
trigger_o mux:
1 - trigger flag (from regmap)
2 - external pin trigger (Ti)
3 - external pin trigger (To)
4 - internal adc trigger
5 - logic analyzer trigger
The signal passed to trigger_o must not be delayed, but the new value has to be
kept for a short period, 1ms (100000 clock cycles), to reduce switch noises in
the system.
The axi_adc_trigger handles 3 output triggers:
- trigger_o - external trigger (1 clock cycle delay)
- trigger_out - signals on dmac/fifo_wr_sync the start of a new transfer.
A variable fifo depth is present in the data path, which delays the data
arriving at the DMA with 3 clock cycles. By coincidence, the external trigger
is synchronized and detected on 3 clock cycles. To get a maximum optimization
the trigger_out will be delayed with 3 clock cycles for internal triggers and
directly forwarded in the case of an external trigger.
- trigger_out_la (cascade trigger for logic_analyzer - m2k example)
Because the trigger_out_la must have a small delay, to get a realible
instrument triggering mechanism, a 1 delay clock cycle must be added on the
trigger paths, to avoid creating a closed combinatorial loop.
Increase pcore version. The major version 3 is used to describe the instrument
trigger updates.
2019-03-08 14:21:38 +00:00
|
|
|
wire [ 1:0] trigger_up_o_s;
|
2019-02-05 07:24:49 +00:00
|
|
|
wire streaming;
|
axi_adc_trigger: Add cascade support.
- Add embedded trigger as an option. The use of the embedded trigger as an
option in the data stream is done for further processing, keeping the data
synchronized with the trigger.
When instrument (module) trigger is desired (logic_analyzer - adc_trigger),
a small propagation time is required, hence the need to remove the
util_extract(trigger extract) module from the data path.
- Add more options for the IO triggering. This will open the door for multiple
M2k synchronization(triggering).
trigger_o mux:
1 - trigger flag (from regmap)
2 - external pin trigger (Ti)
3 - external pin trigger (To)
4 - internal adc trigger
5 - logic analyzer trigger
The signal passed to trigger_o must not be delayed, but the new value has to be
kept for a short period, 1ms (100000 clock cycles), to reduce switch noises in
the system.
The axi_adc_trigger handles 3 output triggers:
- trigger_o - external trigger (1 clock cycle delay)
- trigger_out - signals on dmac/fifo_wr_sync the start of a new transfer.
A variable fifo depth is present in the data path, which delays the data
arriving at the DMA with 3 clock cycles. By coincidence, the external trigger
is synchronized and detected on 3 clock cycles. To get a maximum optimization
the trigger_out will be delayed with 3 clock cycles for internal triggers and
directly forwarded in the case of an external trigger.
- trigger_out_la (cascade trigger for logic_analyzer - m2k example)
Because the trigger_out_la must have a small delay, to get a realible
instrument triggering mechanism, a 1 delay clock cycle must be added on the
trigger paths, to avoid creating a closed combinatorial loop.
Increase pcore version. The major version 3 is used to describe the instrument
trigger updates.
2019-03-08 14:21:38 +00:00
|
|
|
wire trigger_out_s;
|
|
|
|
wire embedded_trigger;
|
|
|
|
wire external_trigger;
|
2019-02-05 07:24:49 +00:00
|
|
|
|
|
|
|
reg trigger_a_d1; // synchronization flip flop
|
|
|
|
reg trigger_a_d2; // synchronization flip flop
|
|
|
|
reg trigger_a_d3;
|
|
|
|
reg trigger_b_d1; // synchronization flip flop
|
|
|
|
reg trigger_b_d2; // synchronization flip flop
|
|
|
|
reg trigger_b_d3;
|
|
|
|
reg comp_high_a; // signal is over the limit
|
|
|
|
reg old_comp_high_a; // t + 1 version of comp_high_a
|
|
|
|
reg first_a_h_trigger; // valid hysteresis range on passthrough high trigger limit
|
|
|
|
reg first_a_l_trigger; // valid hysteresis range on passthrough low trigger limit
|
|
|
|
reg signed [DW:0] hyst_a_high_limit;
|
|
|
|
reg signed [DW:0] hyst_a_low_limit;
|
|
|
|
reg comp_high_b; // signal is over the limit
|
|
|
|
reg old_comp_high_b; // t + 1 version of comp_high_b
|
|
|
|
reg first_b_h_trigger; // valid hysteresis range on passthrough high trigger limit
|
|
|
|
reg first_b_l_trigger; // valid hysteresis range on passthrough low trigger limit
|
|
|
|
reg signed [DW:0] hyst_b_high_limit;
|
|
|
|
reg signed [DW:0] hyst_b_low_limit;
|
|
|
|
|
|
|
|
reg trigger_pin_a;
|
|
|
|
reg trigger_pin_b;
|
axi_adc_trigger: Add cascade support.
- Add embedded trigger as an option. The use of the embedded trigger as an
option in the data stream is done for further processing, keeping the data
synchronized with the trigger.
When instrument (module) trigger is desired (logic_analyzer - adc_trigger),
a small propagation time is required, hence the need to remove the
util_extract(trigger extract) module from the data path.
- Add more options for the IO triggering. This will open the door for multiple
M2k synchronization(triggering).
trigger_o mux:
1 - trigger flag (from regmap)
2 - external pin trigger (Ti)
3 - external pin trigger (To)
4 - internal adc trigger
5 - logic analyzer trigger
The signal passed to trigger_o must not be delayed, but the new value has to be
kept for a short period, 1ms (100000 clock cycles), to reduce switch noises in
the system.
The axi_adc_trigger handles 3 output triggers:
- trigger_o - external trigger (1 clock cycle delay)
- trigger_out - signals on dmac/fifo_wr_sync the start of a new transfer.
A variable fifo depth is present in the data path, which delays the data
arriving at the DMA with 3 clock cycles. By coincidence, the external trigger
is synchronized and detected on 3 clock cycles. To get a maximum optimization
the trigger_out will be delayed with 3 clock cycles for internal triggers and
directly forwarded in the case of an external trigger.
- trigger_out_la (cascade trigger for logic_analyzer - m2k example)
Because the trigger_out_la must have a small delay, to get a realible
instrument triggering mechanism, a 1 delay clock cycle must be added on the
trigger paths, to avoid creating a closed combinatorial loop.
Increase pcore version. The major version 3 is used to describe the instrument
trigger updates.
2019-03-08 14:21:38 +00:00
|
|
|
reg [ 1:0] trigger_o_m;
|
|
|
|
reg [ 1:0] trigger_o_m_1;
|
|
|
|
|
|
|
|
reg trig_o_hold_0;
|
|
|
|
reg trig_o_hold_1;
|
|
|
|
reg [16:0] trig_o_hold_cnt_0;
|
|
|
|
reg [16:0] trig_o_hold_cnt_1;
|
2019-02-05 07:24:49 +00:00
|
|
|
|
|
|
|
reg trigger_adc_a;
|
|
|
|
reg trigger_adc_b;
|
|
|
|
|
|
|
|
reg trigger_a;
|
|
|
|
reg trigger_b;
|
|
|
|
|
|
|
|
reg trigger_out_mixed;
|
|
|
|
reg up_triggered;
|
|
|
|
reg up_triggered_d1;
|
|
|
|
reg up_triggered_d2;
|
|
|
|
|
|
|
|
reg up_triggered_set;
|
|
|
|
reg up_triggered_reset;
|
|
|
|
reg up_triggered_reset_d1;
|
|
|
|
reg up_triggered_reset_d2;
|
|
|
|
|
|
|
|
reg [31:0] trigger_delay_counter;
|
|
|
|
reg triggered;
|
axi_adc_trigger: Add cascade support.
- Add embedded trigger as an option. The use of the embedded trigger as an
option in the data stream is done for further processing, keeping the data
synchronized with the trigger.
When instrument (module) trigger is desired (logic_analyzer - adc_trigger),
a small propagation time is required, hence the need to remove the
util_extract(trigger extract) module from the data path.
- Add more options for the IO triggering. This will open the door for multiple
M2k synchronization(triggering).
trigger_o mux:
1 - trigger flag (from regmap)
2 - external pin trigger (Ti)
3 - external pin trigger (To)
4 - internal adc trigger
5 - logic analyzer trigger
The signal passed to trigger_o must not be delayed, but the new value has to be
kept for a short period, 1ms (100000 clock cycles), to reduce switch noises in
the system.
The axi_adc_trigger handles 3 output triggers:
- trigger_o - external trigger (1 clock cycle delay)
- trigger_out - signals on dmac/fifo_wr_sync the start of a new transfer.
A variable fifo depth is present in the data path, which delays the data
arriving at the DMA with 3 clock cycles. By coincidence, the external trigger
is synchronized and detected on 3 clock cycles. To get a maximum optimization
the trigger_out will be delayed with 3 clock cycles for internal triggers and
directly forwarded in the case of an external trigger.
- trigger_out_la (cascade trigger for logic_analyzer - m2k example)
Because the trigger_out_la must have a small delay, to get a realible
instrument triggering mechanism, a 1 delay clock cycle must be added on the
trigger paths, to avoid creating a closed combinatorial loop.
Increase pcore version. The major version 3 is used to describe the instrument
trigger updates.
2019-03-08 14:21:38 +00:00
|
|
|
reg trigger_out_m1;
|
2019-02-05 07:24:49 +00:00
|
|
|
|
|
|
|
reg streaming_on;
|
2017-07-03 13:54:40 +00:00
|
|
|
|
2017-01-31 14:20:13 +00:00
|
|
|
// signal name changes
|
|
|
|
|
|
|
|
assign up_clk = s_axi_aclk;
|
|
|
|
assign up_rstn = s_axi_aresetn;
|
|
|
|
|
axi_adc_trigger: Add cascade support.
- Add embedded trigger as an option. The use of the embedded trigger as an
option in the data stream is done for further processing, keeping the data
synchronized with the trigger.
When instrument (module) trigger is desired (logic_analyzer - adc_trigger),
a small propagation time is required, hence the need to remove the
util_extract(trigger extract) module from the data path.
- Add more options for the IO triggering. This will open the door for multiple
M2k synchronization(triggering).
trigger_o mux:
1 - trigger flag (from regmap)
2 - external pin trigger (Ti)
3 - external pin trigger (To)
4 - internal adc trigger
5 - logic analyzer trigger
The signal passed to trigger_o must not be delayed, but the new value has to be
kept for a short period, 1ms (100000 clock cycles), to reduce switch noises in
the system.
The axi_adc_trigger handles 3 output triggers:
- trigger_o - external trigger (1 clock cycle delay)
- trigger_out - signals on dmac/fifo_wr_sync the start of a new transfer.
A variable fifo depth is present in the data path, which delays the data
arriving at the DMA with 3 clock cycles. By coincidence, the external trigger
is synchronized and detected on 3 clock cycles. To get a maximum optimization
the trigger_out will be delayed with 3 clock cycles for internal triggers and
directly forwarded in the case of an external trigger.
- trigger_out_la (cascade trigger for logic_analyzer - m2k example)
Because the trigger_out_la must have a small delay, to get a realible
instrument triggering mechanism, a 1 delay clock cycle must be added on the
trigger paths, to avoid creating a closed combinatorial loop.
Increase pcore version. The major version 3 is used to describe the instrument
trigger updates.
2019-03-08 14:21:38 +00:00
|
|
|
assign trigger_t = io_selection[1:0];
|
2017-01-31 14:20:13 +00:00
|
|
|
|
|
|
|
assign trigger_a_fall_edge = (trigger_a_d2 == 1'b0 && trigger_a_d3 == 1'b1) ? 1'b1: 1'b0;
|
|
|
|
assign trigger_a_rise_edge = (trigger_a_d2 == 1'b1 && trigger_a_d3 == 1'b0) ? 1'b1: 1'b0;
|
|
|
|
assign trigger_a_any_edge = trigger_a_rise_edge | trigger_a_fall_edge;
|
|
|
|
assign trigger_b_fall_edge = (trigger_b_d2 == 1'b0 && trigger_b_d3 == 1'b1) ? 1'b1: 1'b0;
|
|
|
|
assign trigger_b_rise_edge = (trigger_b_d2 == 1'b1 && trigger_b_d3 == 1'b0) ? 1'b1: 1'b0;
|
|
|
|
assign trigger_b_any_edge = trigger_b_rise_edge | trigger_b_fall_edge;
|
|
|
|
|
2019-02-05 07:24:49 +00:00
|
|
|
assign data_a_cmp = data_a[DW:0];
|
|
|
|
assign data_b_cmp = data_b[DW:0];
|
|
|
|
assign limit_a_cmp = limit_a[DW:0];
|
|
|
|
assign limit_b_cmp = limit_b[DW:0];
|
2017-01-31 14:20:13 +00:00
|
|
|
|
axi_adc_trigger: Add cascade support.
- Add embedded trigger as an option. The use of the embedded trigger as an
option in the data stream is done for further processing, keeping the data
synchronized with the trigger.
When instrument (module) trigger is desired (logic_analyzer - adc_trigger),
a small propagation time is required, hence the need to remove the
util_extract(trigger extract) module from the data path.
- Add more options for the IO triggering. This will open the door for multiple
M2k synchronization(triggering).
trigger_o mux:
1 - trigger flag (from regmap)
2 - external pin trigger (Ti)
3 - external pin trigger (To)
4 - internal adc trigger
5 - logic analyzer trigger
The signal passed to trigger_o must not be delayed, but the new value has to be
kept for a short period, 1ms (100000 clock cycles), to reduce switch noises in
the system.
The axi_adc_trigger handles 3 output triggers:
- trigger_o - external trigger (1 clock cycle delay)
- trigger_out - signals on dmac/fifo_wr_sync the start of a new transfer.
A variable fifo depth is present in the data path, which delays the data
arriving at the DMA with 3 clock cycles. By coincidence, the external trigger
is synchronized and detected on 3 clock cycles. To get a maximum optimization
the trigger_out will be delayed with 3 clock cycles for internal triggers and
directly forwarded in the case of an external trigger.
- trigger_out_la (cascade trigger for logic_analyzer - m2k example)
Because the trigger_out_la must have a small delay, to get a realible
instrument triggering mechanism, a 1 delay clock cycle must be added on the
trigger paths, to avoid creating a closed combinatorial loop.
Increase pcore version. The major version 3 is used to describe the instrument
trigger updates.
2019-03-08 14:21:38 +00:00
|
|
|
always @(*) begin
|
|
|
|
case(io_selection[4:2])
|
|
|
|
3'h0: trigger_o_m[0] = trigger_up_o_s[0];
|
|
|
|
3'h1: trigger_o_m[0] = trigger_i[0];
|
|
|
|
3'h2: trigger_o_m[0] = trigger_i[1];
|
|
|
|
3'h3: trigger_o_m[0] = trigger_out_mixed;
|
|
|
|
3'h4: trigger_o_m[0] = trigger_in;
|
|
|
|
default: trigger_o_m[0] = trigger_up_o_s[0];
|
|
|
|
endcase
|
|
|
|
case(io_selection[7:5])
|
|
|
|
3'h0: trigger_o_m[1] = trigger_up_o_s[1];
|
|
|
|
3'h1: trigger_o_m[1] = trigger_i[1];
|
|
|
|
3'h2: trigger_o_m[1] = trigger_i[0];
|
|
|
|
3'h3: trigger_o_m[1] = trigger_out_mixed;
|
|
|
|
3'h4: trigger_o_m[1] = trigger_in;
|
|
|
|
default: trigger_o_m[1] = trigger_up_o_s[1];
|
|
|
|
endcase
|
|
|
|
end
|
|
|
|
|
|
|
|
// External trigger output hold 100000 clock cycles(1ms) on polarity change.
|
|
|
|
// All trigger signals that are to be outputted on the external trigger after a
|
|
|
|
// trigger out is acknowledged by the hold counter will be disregarded for 1ms.
|
|
|
|
// This was done to avoid noise created by high frequency switches on long
|
|
|
|
// wires.
|
|
|
|
always @(posedge clk) begin
|
|
|
|
// trigger_o[0] hold start
|
|
|
|
if ((trigger_o_m[0] != trigger_o_m_1[0]) & (trig_o_hold_cnt_0 == 17'd0)) begin
|
|
|
|
trig_o_hold_cnt_0 <= 17'd100000;
|
|
|
|
trig_o_hold_0 <= trigger_o_m[0];
|
|
|
|
end
|
|
|
|
if (trig_o_hold_cnt_0 != 17'd0) begin
|
|
|
|
trig_o_hold_cnt_0 <= trig_o_hold_cnt_0 - 17'd1;
|
|
|
|
end
|
|
|
|
trigger_o_m_1[0] <= trigger_o_m[0];
|
|
|
|
|
|
|
|
// trigger_o[1] hold start
|
|
|
|
if ((trigger_o_m[1] != trigger_o_m_1[1]) & (trig_o_hold_cnt_1 == 17'd0)) begin
|
|
|
|
trig_o_hold_cnt_1 <= 17'd100000;
|
|
|
|
trig_o_hold_1 <= trigger_o_m[1];
|
|
|
|
end
|
|
|
|
if (trig_o_hold_cnt_1 != 17'd0) begin
|
|
|
|
trig_o_hold_cnt_1 <= trig_o_hold_cnt_1 - 17'd1;
|
|
|
|
end
|
|
|
|
trigger_o_m_1[1] <= trigger_o_m[1];
|
|
|
|
|
|
|
|
// hold
|
|
|
|
trigger_o[0] <= (trig_o_hold_cnt_0 == 'd0) ? trigger_o_m[0] : trig_o_hold_0;
|
|
|
|
trigger_o[1] <= (trig_o_hold_cnt_1 == 'd0) ? trigger_o_m[1] : trig_o_hold_1;
|
|
|
|
end
|
|
|
|
|
|
|
|
// - keep data in sync with the trigger. The trigger bypasses the variable fifo.
|
|
|
|
// The data goes through and it is delayed with 4 clock cycles)
|
|
|
|
always @(posedge clk) begin
|
|
|
|
trigger_out_m1 <= trigger_out_s;
|
|
|
|
trigger_out <= trigger_out_m1;
|
|
|
|
|
|
|
|
// triggers logic analyzer
|
|
|
|
trigger_out_la <= trigger_out_mixed;
|
|
|
|
end
|
|
|
|
|
|
|
|
// the embedded trigger does not require any extra delay, since the util_extract
|
|
|
|
// present in this case, delays the trigger with 2 clock cycles
|
|
|
|
assign data_a_trig = (embedded_trigger == 1'h0) ? {data_a[14],data_a[14:0]} : {trigger_out_s,data_a[14:0]};
|
|
|
|
assign data_b_trig = (embedded_trigger == 1'h0) ? {data_b[14],data_b[14:0]} : {trigger_out_s,data_b[14:0]};
|
|
|
|
|
|
|
|
assign embedded_trigger = trigger_out_control[16];
|
|
|
|
assign trigger_out_s = (trigger_delay == 32'h0) ? (trigger_out_mixed | streaming_on) :
|
|
|
|
(trigger_out_delayed | streaming_on);
|
|
|
|
assign data_valid_a_trig = data_valid_a;
|
|
|
|
assign data_valid_b_trig = data_valid_b;
|
2017-01-31 14:20:13 +00:00
|
|
|
|
2017-06-08 09:00:27 +00:00
|
|
|
assign trigger_out_delayed = (trigger_delay_counter == 32'h0) ? 1 : 0;
|
|
|
|
|
2017-01-31 14:20:13 +00:00
|
|
|
always @(posedge clk) begin
|
2017-06-06 12:35:59 +00:00
|
|
|
if (trigger_delay == 0) begin
|
|
|
|
trigger_delay_counter <= 32'h0;
|
|
|
|
end else begin
|
axi_adc_trigger: Add cascade support.
- Add embedded trigger as an option. The use of the embedded trigger as an
option in the data stream is done for further processing, keeping the data
synchronized with the trigger.
When instrument (module) trigger is desired (logic_analyzer - adc_trigger),
a small propagation time is required, hence the need to remove the
util_extract(trigger extract) module from the data path.
- Add more options for the IO triggering. This will open the door for multiple
M2k synchronization(triggering).
trigger_o mux:
1 - trigger flag (from regmap)
2 - external pin trigger (Ti)
3 - external pin trigger (To)
4 - internal adc trigger
5 - logic analyzer trigger
The signal passed to trigger_o must not be delayed, but the new value has to be
kept for a short period, 1ms (100000 clock cycles), to reduce switch noises in
the system.
The axi_adc_trigger handles 3 output triggers:
- trigger_o - external trigger (1 clock cycle delay)
- trigger_out - signals on dmac/fifo_wr_sync the start of a new transfer.
A variable fifo depth is present in the data path, which delays the data
arriving at the DMA with 3 clock cycles. By coincidence, the external trigger
is synchronized and detected on 3 clock cycles. To get a maximum optimization
the trigger_out will be delayed with 3 clock cycles for internal triggers and
directly forwarded in the case of an external trigger.
- trigger_out_la (cascade trigger for logic_analyzer - m2k example)
Because the trigger_out_la must have a small delay, to get a realible
instrument triggering mechanism, a 1 delay clock cycle must be added on the
trigger paths, to avoid creating a closed combinatorial loop.
Increase pcore version. The major version 3 is used to describe the instrument
trigger updates.
2019-03-08 14:21:38 +00:00
|
|
|
if (data_valid_a == 1'b1) begin
|
2017-06-08 09:00:27 +00:00
|
|
|
triggered <= trigger_out_mixed | triggered;
|
2017-06-06 12:35:59 +00:00
|
|
|
if (trigger_delay_counter == 0) begin
|
|
|
|
trigger_delay_counter <= trigger_delay;
|
|
|
|
triggered <= 1'b0;
|
|
|
|
end else begin
|
2017-06-08 09:00:27 +00:00
|
|
|
if(triggered == 1'b1 || trigger_out_mixed == 1'b1) begin
|
2017-06-06 12:35:59 +00:00
|
|
|
trigger_delay_counter <= trigger_delay_counter - 1;
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-07-03 13:54:40 +00:00
|
|
|
always @(posedge clk) begin
|
|
|
|
if (trigger_delay == 0) begin
|
axi_adc_trigger: Add cascade support.
- Add embedded trigger as an option. The use of the embedded trigger as an
option in the data stream is done for further processing, keeping the data
synchronized with the trigger.
When instrument (module) trigger is desired (logic_analyzer - adc_trigger),
a small propagation time is required, hence the need to remove the
util_extract(trigger extract) module from the data path.
- Add more options for the IO triggering. This will open the door for multiple
M2k synchronization(triggering).
trigger_o mux:
1 - trigger flag (from regmap)
2 - external pin trigger (Ti)
3 - external pin trigger (To)
4 - internal adc trigger
5 - logic analyzer trigger
The signal passed to trigger_o must not be delayed, but the new value has to be
kept for a short period, 1ms (100000 clock cycles), to reduce switch noises in
the system.
The axi_adc_trigger handles 3 output triggers:
- trigger_o - external trigger (1 clock cycle delay)
- trigger_out - signals on dmac/fifo_wr_sync the start of a new transfer.
A variable fifo depth is present in the data path, which delays the data
arriving at the DMA with 3 clock cycles. By coincidence, the external trigger
is synchronized and detected on 3 clock cycles. To get a maximum optimization
the trigger_out will be delayed with 3 clock cycles for internal triggers and
directly forwarded in the case of an external trigger.
- trigger_out_la (cascade trigger for logic_analyzer - m2k example)
Because the trigger_out_la must have a small delay, to get a realible
instrument triggering mechanism, a 1 delay clock cycle must be added on the
trigger paths, to avoid creating a closed combinatorial loop.
Increase pcore version. The major version 3 is used to describe the instrument
trigger updates.
2019-03-08 14:21:38 +00:00
|
|
|
if (streaming == 1'b1 && data_valid_a == 1'b1 && trigger_out_mixed == 1'b1) begin
|
2017-07-03 13:54:40 +00:00
|
|
|
streaming_on <= 1'b1;
|
|
|
|
end else if (streaming == 1'b0) begin
|
|
|
|
streaming_on <= 1'b0;
|
|
|
|
end
|
|
|
|
end else begin
|
axi_adc_trigger: Add cascade support.
- Add embedded trigger as an option. The use of the embedded trigger as an
option in the data stream is done for further processing, keeping the data
synchronized with the trigger.
When instrument (module) trigger is desired (logic_analyzer - adc_trigger),
a small propagation time is required, hence the need to remove the
util_extract(trigger extract) module from the data path.
- Add more options for the IO triggering. This will open the door for multiple
M2k synchronization(triggering).
trigger_o mux:
1 - trigger flag (from regmap)
2 - external pin trigger (Ti)
3 - external pin trigger (To)
4 - internal adc trigger
5 - logic analyzer trigger
The signal passed to trigger_o must not be delayed, but the new value has to be
kept for a short period, 1ms (100000 clock cycles), to reduce switch noises in
the system.
The axi_adc_trigger handles 3 output triggers:
- trigger_o - external trigger (1 clock cycle delay)
- trigger_out - signals on dmac/fifo_wr_sync the start of a new transfer.
A variable fifo depth is present in the data path, which delays the data
arriving at the DMA with 3 clock cycles. By coincidence, the external trigger
is synchronized and detected on 3 clock cycles. To get a maximum optimization
the trigger_out will be delayed with 3 clock cycles for internal triggers and
directly forwarded in the case of an external trigger.
- trigger_out_la (cascade trigger for logic_analyzer - m2k example)
Because the trigger_out_la must have a small delay, to get a realible
instrument triggering mechanism, a 1 delay clock cycle must be added on the
trigger paths, to avoid creating a closed combinatorial loop.
Increase pcore version. The major version 3 is used to describe the instrument
trigger updates.
2019-03-08 14:21:38 +00:00
|
|
|
if (streaming == 1'b1 && data_valid_a == 1'b1 && trigger_out_delayed == 1'b1) begin
|
2017-07-03 13:54:40 +00:00
|
|
|
streaming_on <= 1'b1;
|
|
|
|
end else if (streaming == 1'b0) begin
|
|
|
|
streaming_on <= 1'b0;
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-07-03 10:00:51 +00:00
|
|
|
always @(posedge clk) begin
|
axi_adc_trigger: Add cascade support.
- Add embedded trigger as an option. The use of the embedded trigger as an
option in the data stream is done for further processing, keeping the data
synchronized with the trigger.
When instrument (module) trigger is desired (logic_analyzer - adc_trigger),
a small propagation time is required, hence the need to remove the
util_extract(trigger extract) module from the data path.
- Add more options for the IO triggering. This will open the door for multiple
M2k synchronization(triggering).
trigger_o mux:
1 - trigger flag (from regmap)
2 - external pin trigger (Ti)
3 - external pin trigger (To)
4 - internal adc trigger
5 - logic analyzer trigger
The signal passed to trigger_o must not be delayed, but the new value has to be
kept for a short period, 1ms (100000 clock cycles), to reduce switch noises in
the system.
The axi_adc_trigger handles 3 output triggers:
- trigger_o - external trigger (1 clock cycle delay)
- trigger_out - signals on dmac/fifo_wr_sync the start of a new transfer.
A variable fifo depth is present in the data path, which delays the data
arriving at the DMA with 3 clock cycles. By coincidence, the external trigger
is synchronized and detected on 3 clock cycles. To get a maximum optimization
the trigger_out will be delayed with 3 clock cycles for internal triggers and
directly forwarded in the case of an external trigger.
- trigger_out_la (cascade trigger for logic_analyzer - m2k example)
Because the trigger_out_la must have a small delay, to get a realible
instrument triggering mechanism, a 1 delay clock cycle must be added on the
trigger paths, to avoid creating a closed combinatorial loop.
Increase pcore version. The major version 3 is used to describe the instrument
trigger updates.
2019-03-08 14:21:38 +00:00
|
|
|
if (data_valid_a == 1'b1 && trigger_out_mixed == 1'b1) begin
|
2017-07-03 10:00:51 +00:00
|
|
|
up_triggered_set <= 1'b1;
|
|
|
|
end else if (up_triggered_reset == 1'b1) begin
|
|
|
|
up_triggered_set <= 1'b0;
|
|
|
|
end
|
|
|
|
up_triggered_reset_d1 <= up_triggered;
|
|
|
|
up_triggered_reset_d2 <= up_triggered_reset_d1;
|
|
|
|
up_triggered_reset <= up_triggered_reset_d2;
|
|
|
|
end
|
|
|
|
|
|
|
|
always @(posedge up_clk) begin
|
|
|
|
up_triggered_d1 <= up_triggered_set;
|
|
|
|
up_triggered_d2 <= up_triggered_d1;
|
|
|
|
up_triggered <= up_triggered_d2;
|
|
|
|
end
|
|
|
|
|
2017-01-31 14:20:13 +00:00
|
|
|
always @(*) begin
|
|
|
|
case(trigger_l_mix_a)
|
|
|
|
4'h0: trigger_a = 1'b1;
|
|
|
|
4'h1: trigger_a = trigger_pin_a;
|
|
|
|
4'h2: trigger_a = trigger_adc_a;
|
|
|
|
4'h4: trigger_a = trigger_pin_a | trigger_adc_a ;
|
|
|
|
4'h5: trigger_a = trigger_pin_a & trigger_adc_a ;
|
|
|
|
4'h6: trigger_a = trigger_pin_a ^ trigger_adc_a ;
|
|
|
|
4'h7: trigger_a = !(trigger_pin_a | trigger_adc_a) ;
|
|
|
|
4'h8: trigger_a = !(trigger_pin_a & trigger_adc_a) ;
|
|
|
|
4'h9: trigger_a = !(trigger_pin_a ^ trigger_adc_a) ;
|
|
|
|
default: trigger_a = 1'b1;
|
|
|
|
endcase
|
|
|
|
end
|
|
|
|
|
|
|
|
always @(*) begin
|
|
|
|
case(trigger_l_mix_b)
|
|
|
|
4'h0: trigger_b = 1'b1;
|
|
|
|
4'h1: trigger_b = trigger_pin_b;
|
|
|
|
4'h2: trigger_b = trigger_adc_b;
|
|
|
|
4'h4: trigger_b = trigger_pin_b | trigger_adc_b ;
|
|
|
|
4'h5: trigger_b = trigger_pin_b & trigger_adc_b ;
|
|
|
|
4'h6: trigger_b = trigger_pin_b ^ trigger_adc_b ;
|
|
|
|
4'h7: trigger_b = !(trigger_pin_b | trigger_adc_b) ;
|
|
|
|
4'h8: trigger_b = !(trigger_pin_b & trigger_adc_b) ;
|
|
|
|
4'h9: trigger_b = !(trigger_pin_b ^ trigger_adc_b) ;
|
|
|
|
default: trigger_b = 1'b1;
|
|
|
|
endcase
|
|
|
|
end
|
|
|
|
|
|
|
|
always @(*) begin
|
|
|
|
case(function_a)
|
2019-02-05 07:14:24 +00:00
|
|
|
2'h0: trigger_adc_a = comp_low_a_s;
|
2017-01-31 14:20:13 +00:00
|
|
|
2'h1: trigger_adc_a = comp_high_a;
|
2019-02-05 07:14:24 +00:00
|
|
|
2'h2: trigger_adc_a = passthrough_high_a_s;
|
|
|
|
2'h3: trigger_adc_a = passthrough_low_a_s;
|
|
|
|
default: trigger_adc_a = comp_low_a_s;
|
2017-01-31 14:20:13 +00:00
|
|
|
endcase
|
|
|
|
end
|
|
|
|
|
|
|
|
always @(*) begin
|
|
|
|
case(function_b)
|
2019-02-05 07:14:24 +00:00
|
|
|
2'h0: trigger_adc_b = comp_low_b_s;
|
2017-01-31 14:20:13 +00:00
|
|
|
2'h1: trigger_adc_b = comp_high_b;
|
2019-02-05 07:14:24 +00:00
|
|
|
2'h2: trigger_adc_b = passthrough_high_b_s;
|
|
|
|
2'h3: trigger_adc_b = passthrough_low_b_s;
|
|
|
|
default: trigger_adc_b = comp_low_b_s;
|
2017-01-31 14:20:13 +00:00
|
|
|
endcase
|
|
|
|
end
|
|
|
|
|
|
|
|
always @(posedge clk) begin
|
|
|
|
trigger_a_d1 <= trigger_i[0];
|
|
|
|
trigger_a_d2 <= trigger_a_d1;
|
|
|
|
trigger_a_d3 <= trigger_a_d2;
|
|
|
|
trigger_b_d1 <= trigger_i[1];
|
|
|
|
trigger_b_d2 <= trigger_b_d1;
|
|
|
|
trigger_b_d3 <= trigger_b_d2;
|
|
|
|
end
|
|
|
|
|
|
|
|
always @(*) begin
|
|
|
|
trigger_pin_a = ((!trigger_a_d3 & low_level[0]) |
|
|
|
|
(trigger_a_d3 & high_level[0]) |
|
|
|
|
(trigger_a_fall_edge & fall_edge[0]) |
|
|
|
|
(trigger_a_rise_edge & rise_edge[0]) |
|
|
|
|
(trigger_a_any_edge & any_edge[0]));
|
|
|
|
end
|
|
|
|
|
|
|
|
always @(*) begin
|
|
|
|
trigger_pin_b = ((!trigger_b_d3 & low_level[1]) |
|
|
|
|
(trigger_b_d3 & high_level[1]) |
|
|
|
|
(trigger_b_fall_edge & fall_edge[1]) |
|
|
|
|
(trigger_b_rise_edge & rise_edge[1]) |
|
|
|
|
(trigger_b_any_edge & any_edge[1]));
|
|
|
|
end
|
|
|
|
|
|
|
|
always @(*) begin
|
axi_adc_trigger: Add cascade support.
- Add embedded trigger as an option. The use of the embedded trigger as an
option in the data stream is done for further processing, keeping the data
synchronized with the trigger.
When instrument (module) trigger is desired (logic_analyzer - adc_trigger),
a small propagation time is required, hence the need to remove the
util_extract(trigger extract) module from the data path.
- Add more options for the IO triggering. This will open the door for multiple
M2k synchronization(triggering).
trigger_o mux:
1 - trigger flag (from regmap)
2 - external pin trigger (Ti)
3 - external pin trigger (To)
4 - internal adc trigger
5 - logic analyzer trigger
The signal passed to trigger_o must not be delayed, but the new value has to be
kept for a short period, 1ms (100000 clock cycles), to reduce switch noises in
the system.
The axi_adc_trigger handles 3 output triggers:
- trigger_o - external trigger (1 clock cycle delay)
- trigger_out - signals on dmac/fifo_wr_sync the start of a new transfer.
A variable fifo depth is present in the data path, which delays the data
arriving at the DMA with 3 clock cycles. By coincidence, the external trigger
is synchronized and detected on 3 clock cycles. To get a maximum optimization
the trigger_out will be delayed with 3 clock cycles for internal triggers and
directly forwarded in the case of an external trigger.
- trigger_out_la (cascade trigger for logic_analyzer - m2k example)
Because the trigger_out_la must have a small delay, to get a realible
instrument triggering mechanism, a 1 delay clock cycle must be added on the
trigger paths, to avoid creating a closed combinatorial loop.
Increase pcore version. The major version 3 is used to describe the instrument
trigger updates.
2019-03-08 14:21:38 +00:00
|
|
|
case(trigger_out_control[3:0])
|
|
|
|
4'h0: trigger_out_mixed = trigger_a;
|
|
|
|
4'h1: trigger_out_mixed = trigger_b;
|
|
|
|
4'h2: trigger_out_mixed = trigger_a | trigger_b;
|
|
|
|
4'h3: trigger_out_mixed = trigger_a & trigger_b;
|
|
|
|
4'h4: trigger_out_mixed = trigger_a ^ trigger_b;
|
|
|
|
4'h5: trigger_out_mixed = trigger_in;
|
|
|
|
4'h6: trigger_out_mixed = trigger_a | trigger_in;
|
|
|
|
4'h7: trigger_out_mixed = trigger_b | trigger_in;
|
|
|
|
4'h8: trigger_out_mixed = trigger_a | trigger_b | trigger_in;
|
2017-01-31 14:20:13 +00:00
|
|
|
default: trigger_out_mixed = trigger_a;
|
|
|
|
endcase
|
|
|
|
end
|
|
|
|
|
|
|
|
always @(posedge clk) begin
|
|
|
|
if (data_valid_a == 1'b1) begin
|
2019-02-05 07:24:49 +00:00
|
|
|
hyst_a_high_limit <= limit_a_cmp + hysteresis_a[DW:0];
|
|
|
|
hyst_a_low_limit <= limit_a_cmp - hysteresis_a[DW:0];
|
2019-02-05 07:14:24 +00:00
|
|
|
|
|
|
|
if (data_a_cmp >= limit_a_cmp) begin
|
2017-01-31 14:20:13 +00:00
|
|
|
comp_high_a <= 1'b1;
|
2019-02-05 07:14:24 +00:00
|
|
|
first_a_h_trigger <= passthrough_high_a_s ? 0 : first_a_h_trigger;
|
|
|
|
if (data_a_cmp > hyst_a_high_limit) begin
|
|
|
|
first_a_l_trigger <= 1'b1;
|
|
|
|
end
|
2017-01-31 14:20:13 +00:00
|
|
|
end else begin
|
|
|
|
comp_high_a <= 1'b0;
|
2019-02-05 07:14:24 +00:00
|
|
|
first_a_l_trigger <= (passthrough_low_a_s) ? 0 : first_a_l_trigger;
|
|
|
|
if (data_a_cmp < hyst_a_low_limit) begin
|
|
|
|
first_a_h_trigger <= 1'b1;
|
|
|
|
end
|
2017-01-31 14:20:13 +00:00
|
|
|
end
|
2019-02-05 07:14:24 +00:00
|
|
|
old_comp_high_a <= comp_high_a;
|
2017-01-31 14:20:13 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-02-05 07:14:24 +00:00
|
|
|
assign passthrough_high_a_s = !old_comp_high_a & comp_high_a & first_a_h_trigger;
|
|
|
|
assign passthrough_low_a_s = old_comp_high_a & !comp_high_a & first_a_l_trigger;
|
|
|
|
assign comp_low_a_s = !comp_high_a;
|
|
|
|
|
2017-01-31 14:20:13 +00:00
|
|
|
always @(posedge clk) begin
|
|
|
|
if (data_valid_b == 1'b1) begin
|
2019-02-05 07:24:49 +00:00
|
|
|
hyst_b_high_limit <= limit_b_cmp + hysteresis_b[DW:0];
|
|
|
|
hyst_b_low_limit <= limit_b_cmp - hysteresis_b[DW:0];
|
2019-02-05 07:14:24 +00:00
|
|
|
|
|
|
|
if (data_b_cmp >= limit_b_cmp) begin
|
2017-01-31 14:20:13 +00:00
|
|
|
comp_high_b <= 1'b1;
|
2019-02-05 07:14:24 +00:00
|
|
|
first_b_h_trigger <= (passthrough_high_b_s == 1) ? 0 : first_b_h_trigger;
|
|
|
|
if (data_b_cmp > hyst_b_high_limit) begin
|
|
|
|
first_b_l_trigger <= 1'b1;
|
|
|
|
end
|
2017-01-31 14:20:13 +00:00
|
|
|
end else begin
|
|
|
|
comp_high_b <= 1'b0;
|
2019-02-05 07:14:24 +00:00
|
|
|
first_b_l_trigger <= (passthrough_low_b_s == 1) ? 0 : first_b_l_trigger;
|
|
|
|
if (data_b_cmp < hyst_b_low_limit) begin
|
|
|
|
first_b_h_trigger <= 1'b1;
|
|
|
|
end
|
2017-01-31 14:20:13 +00:00
|
|
|
end
|
2019-02-05 07:14:24 +00:00
|
|
|
old_comp_high_b <= comp_high_b;
|
2017-01-31 14:20:13 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-02-05 07:14:24 +00:00
|
|
|
assign passthrough_high_b_s = !old_comp_high_b & comp_high_b & first_b_h_trigger;
|
|
|
|
assign passthrough_low_b_s = old_comp_high_b & !comp_high_b & first_b_l_trigger;
|
|
|
|
assign comp_low_b_s = !comp_high_b;
|
|
|
|
|
2017-01-31 14:20:13 +00:00
|
|
|
axi_adc_trigger_reg adc_trigger_registers (
|
|
|
|
|
|
|
|
.clk(clk),
|
|
|
|
|
|
|
|
.io_selection(io_selection),
|
axi_adc_trigger: Add cascade support.
- Add embedded trigger as an option. The use of the embedded trigger as an
option in the data stream is done for further processing, keeping the data
synchronized with the trigger.
When instrument (module) trigger is desired (logic_analyzer - adc_trigger),
a small propagation time is required, hence the need to remove the
util_extract(trigger extract) module from the data path.
- Add more options for the IO triggering. This will open the door for multiple
M2k synchronization(triggering).
trigger_o mux:
1 - trigger flag (from regmap)
2 - external pin trigger (Ti)
3 - external pin trigger (To)
4 - internal adc trigger
5 - logic analyzer trigger
The signal passed to trigger_o must not be delayed, but the new value has to be
kept for a short period, 1ms (100000 clock cycles), to reduce switch noises in
the system.
The axi_adc_trigger handles 3 output triggers:
- trigger_o - external trigger (1 clock cycle delay)
- trigger_out - signals on dmac/fifo_wr_sync the start of a new transfer.
A variable fifo depth is present in the data path, which delays the data
arriving at the DMA with 3 clock cycles. By coincidence, the external trigger
is synchronized and detected on 3 clock cycles. To get a maximum optimization
the trigger_out will be delayed with 3 clock cycles for internal triggers and
directly forwarded in the case of an external trigger.
- trigger_out_la (cascade trigger for logic_analyzer - m2k example)
Because the trigger_out_la must have a small delay, to get a realible
instrument triggering mechanism, a 1 delay clock cycle must be added on the
trigger paths, to avoid creating a closed combinatorial loop.
Increase pcore version. The major version 3 is used to describe the instrument
trigger updates.
2019-03-08 14:21:38 +00:00
|
|
|
.trigger_o(trigger_up_o_s),
|
2017-07-03 10:00:51 +00:00
|
|
|
.triggered(up_triggered),
|
2017-01-31 14:20:13 +00:00
|
|
|
|
|
|
|
.low_level(low_level),
|
|
|
|
.high_level(high_level),
|
|
|
|
.any_edge(any_edge),
|
|
|
|
.rise_edge(rise_edge),
|
|
|
|
.fall_edge(fall_edge),
|
|
|
|
|
|
|
|
.limit_a(limit_a),
|
|
|
|
.function_a(function_a),
|
|
|
|
.hysteresis_a(hysteresis_a),
|
|
|
|
.trigger_l_mix_a(trigger_l_mix_a),
|
|
|
|
|
|
|
|
.limit_b(limit_b),
|
|
|
|
.function_b(function_b),
|
|
|
|
.hysteresis_b(hysteresis_b),
|
|
|
|
.trigger_l_mix_b(trigger_l_mix_b),
|
|
|
|
|
axi_adc_trigger: Add cascade support.
- Add embedded trigger as an option. The use of the embedded trigger as an
option in the data stream is done for further processing, keeping the data
synchronized with the trigger.
When instrument (module) trigger is desired (logic_analyzer - adc_trigger),
a small propagation time is required, hence the need to remove the
util_extract(trigger extract) module from the data path.
- Add more options for the IO triggering. This will open the door for multiple
M2k synchronization(triggering).
trigger_o mux:
1 - trigger flag (from regmap)
2 - external pin trigger (Ti)
3 - external pin trigger (To)
4 - internal adc trigger
5 - logic analyzer trigger
The signal passed to trigger_o must not be delayed, but the new value has to be
kept for a short period, 1ms (100000 clock cycles), to reduce switch noises in
the system.
The axi_adc_trigger handles 3 output triggers:
- trigger_o - external trigger (1 clock cycle delay)
- trigger_out - signals on dmac/fifo_wr_sync the start of a new transfer.
A variable fifo depth is present in the data path, which delays the data
arriving at the DMA with 3 clock cycles. By coincidence, the external trigger
is synchronized and detected on 3 clock cycles. To get a maximum optimization
the trigger_out will be delayed with 3 clock cycles for internal triggers and
directly forwarded in the case of an external trigger.
- trigger_out_la (cascade trigger for logic_analyzer - m2k example)
Because the trigger_out_la must have a small delay, to get a realible
instrument triggering mechanism, a 1 delay clock cycle must be added on the
trigger paths, to avoid creating a closed combinatorial loop.
Increase pcore version. The major version 3 is used to describe the instrument
trigger updates.
2019-03-08 14:21:38 +00:00
|
|
|
.trigger_out_control(trigger_out_control),
|
2017-06-06 12:35:59 +00:00
|
|
|
.trigger_delay(trigger_delay),
|
axi_adc_trigger: Add cascade support.
- Add embedded trigger as an option. The use of the embedded trigger as an
option in the data stream is done for further processing, keeping the data
synchronized with the trigger.
When instrument (module) trigger is desired (logic_analyzer - adc_trigger),
a small propagation time is required, hence the need to remove the
util_extract(trigger extract) module from the data path.
- Add more options for the IO triggering. This will open the door for multiple
M2k synchronization(triggering).
trigger_o mux:
1 - trigger flag (from regmap)
2 - external pin trigger (Ti)
3 - external pin trigger (To)
4 - internal adc trigger
5 - logic analyzer trigger
The signal passed to trigger_o must not be delayed, but the new value has to be
kept for a short period, 1ms (100000 clock cycles), to reduce switch noises in
the system.
The axi_adc_trigger handles 3 output triggers:
- trigger_o - external trigger (1 clock cycle delay)
- trigger_out - signals on dmac/fifo_wr_sync the start of a new transfer.
A variable fifo depth is present in the data path, which delays the data
arriving at the DMA with 3 clock cycles. By coincidence, the external trigger
is synchronized and detected on 3 clock cycles. To get a maximum optimization
the trigger_out will be delayed with 3 clock cycles for internal triggers and
directly forwarded in the case of an external trigger.
- trigger_out_la (cascade trigger for logic_analyzer - m2k example)
Because the trigger_out_la must have a small delay, to get a realible
instrument triggering mechanism, a 1 delay clock cycle must be added on the
trigger paths, to avoid creating a closed combinatorial loop.
Increase pcore version. The major version 3 is used to describe the instrument
trigger updates.
2019-03-08 14:21:38 +00:00
|
|
|
|
2017-06-06 12:35:59 +00:00
|
|
|
.fifo_depth(fifo_depth),
|
2017-01-31 14:20:13 +00:00
|
|
|
|
2017-07-03 13:54:40 +00:00
|
|
|
.streaming(streaming),
|
|
|
|
|
2017-01-31 14:20:13 +00:00
|
|
|
// bus interface
|
|
|
|
|
|
|
|
.up_rstn(up_rstn),
|
|
|
|
.up_clk(up_clk),
|
|
|
|
.up_wreq(up_wreq),
|
|
|
|
.up_waddr(up_waddr),
|
|
|
|
.up_wdata(up_wdata),
|
|
|
|
.up_wack(up_wack),
|
|
|
|
.up_rreq(up_rreq),
|
|
|
|
.up_raddr(up_raddr),
|
|
|
|
.up_rdata(up_rdata),
|
|
|
|
.up_rack(up_rack));
|
|
|
|
|
2017-04-10 17:30:57 +00:00
|
|
|
up_axi #(
|
2019-07-15 15:16:07 +00:00
|
|
|
.AXI_ADDRESS_WIDTH(7)
|
2017-04-10 17:30:57 +00:00
|
|
|
) i_up_axi (
|
2017-01-31 14:20:13 +00:00
|
|
|
.up_rstn (up_rstn),
|
|
|
|
.up_clk (up_clk),
|
|
|
|
.up_axi_awvalid (s_axi_awvalid),
|
|
|
|
.up_axi_awaddr (s_axi_awaddr),
|
|
|
|
.up_axi_awready (s_axi_awready),
|
|
|
|
.up_axi_wvalid (s_axi_wvalid),
|
|
|
|
.up_axi_wdata (s_axi_wdata),
|
|
|
|
.up_axi_wstrb (s_axi_wstrb),
|
|
|
|
.up_axi_wready (s_axi_wready),
|
|
|
|
.up_axi_bvalid (s_axi_bvalid),
|
|
|
|
.up_axi_bresp (s_axi_bresp),
|
|
|
|
.up_axi_bready (s_axi_bready),
|
|
|
|
.up_axi_arvalid (s_axi_arvalid),
|
|
|
|
.up_axi_araddr (s_axi_araddr),
|
|
|
|
.up_axi_arready (s_axi_arready),
|
|
|
|
.up_axi_rvalid (s_axi_rvalid),
|
|
|
|
.up_axi_rresp (s_axi_rresp),
|
|
|
|
.up_axi_rdata (s_axi_rdata),
|
|
|
|
.up_axi_rready (s_axi_rready),
|
|
|
|
.up_wreq (up_wreq),
|
|
|
|
.up_waddr (up_waddr),
|
|
|
|
.up_wdata (up_wdata),
|
|
|
|
.up_wack (up_wack),
|
|
|
|
.up_rreq (up_rreq),
|
|
|
|
.up_raddr (up_raddr),
|
|
|
|
.up_rdata (up_rdata),
|
|
|
|
.up_rack (up_rack));
|
|
|
|
|
|
|
|
endmodule
|
|
|
|
|
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|