qick.rfboard

Classes

AbsAdcBalunChain()

AbsAdcDcChain()

AbsAdcRfChain()

AbsDacBalunChain()

AbsDacDcChain()

AbsDacRfChain()

AdcBalunCard216(card_num, soc, gpio)

AdcBalunChain216(soc, card, global_ch, ...)

AdcDcCard216(card_num, soc, gpio)

AdcDcChain111(ch, switches, gain_spi)

Class to describe the ADC-DC channel chain.

AdcDcChain216(soc, card, global_ch, ...)

AdcRfCard216(card_num, soc, gpio)

AdcRfChain111(ch, switches, attn_spi)

AdcRfChain216(soc, card, global_ch, ...)

AttenuatorPE43705(spi_ip[, ch, nch, le, ...])

This class provides SPI access to the PE43705 step attenuator.

AxisDdsMrSwitch(*args, **kwargs)

AxisSignalGenV3(*args, **kwargs)

AxisSignalGenV3Ctrl(*args, **kwargs)

AxisSignalGenV6Ctrl(*args, **kwargs)

AxisSwitchV1(*args, **kwargs)

BiasAD5781(spi_ip, ch_en[, cs_t])

Bias DAC chip AD5781.

BiasDAC11001(spi_ip, ch_en[, cs_t])

Bias DAC chip DAC11001.

BoardSelection(gpio_ip)

This class is used to enable one daughter card on the RF Board for the ZCU216, V1.

Chain216(soc, card, global_ch, card_num, card_ch)

DacBalunCard216(card_num, soc, gpio)

DacBalunChain216(soc, card, global_ch, ...)

DacChain111(ch, switches, attn_spi)

DacDcCard216(card_num, soc, gpio)

DacDcChain216(soc, card, global_ch, ...)

DacRfCard216(card_num, soc, gpio)

DacRfChain216(soc, card, global_ch, ...)

DaughterCard216(card_num, soc, gpio)

FilterADMV8818(spi_ip, ch[, cs_t])

ADMV8818 filter chip.

FilterChain(soc, card, global_ch, card_num, ...)

GainLMH6401(spi_ip, ch_en[, cs_t])

Variable gain amp LMH6401.

GpioMCP23S08(spi_ip, ch_en, dev_addr[, ...])

GPIO chip MCP23S08.

LoSynthADF4372(spi_ip[, nch, le, en_l, cs_t])

LO Synthesis chip ADF4372

LoSynthLMX2594(spi_ip, ch)

RFQickSoc(*args, **kwargs)

Overrides the __init__ method of QickSoc in order to add the drivers for the preproduction (V1) version of the RF board.

RFQickSoc111V1(*args, **kwargs)

RFQickSoc111V2(*args, **kwargs)

RFQickSoc216V1(*args, **kwargs)

RFQickSocV2

alias of RFQickSoc111V2

SwitchControl(spi_ip)

spi(*args, **kwargs)

class qick.rfboard.AxisSignalGenV3(*args: Any, **kwargs: Any)[source]

Bases: SocIP

bindto = ['user.org:user:axis_signal_gen_v3:1.0', 'QICK:QICK:axis_signal_gen_v3:1.0']
N = 12
NDDS = 16
MAX_LENGTH = 65536
__init__(description, **kwargs)[source]
config(axi_dma, dds_mr_switch, axis_switch, channel, name, **kwargs)[source]
load(buff_in, addr=0)[source]
wr_enable(addr=0)[source]
wr_disable()[source]
property cfg
configure_connections(soc)

Use the HWH metadata to figure out what connects to this IP block.

Parameters:

soc (QickSoc) – The overlay object, used to look up metadata and dereference driver names.

class qick.rfboard.AxisSignalGenV3Ctrl(*args: Any, **kwargs: Any)[source]

Bases: SocIP

bindto = ['user.org:user:axis_signal_gen_v3_ctrl:1.0', 'QICK:QICK:axis_signal_gen_v3_ctrl:1.0']
N = 10
NDDS = 16
B = 16
MAX_v = 65535
fs = 4096
__init__(description, **kwargs)[source]
add(freq=0, phase=0, addr=0, gain=30000, nsamp=1600, outsel='dds', mode='periodic', stdysel='zero')[source]
set_fs(fs)[source]
property cfg
configure_connections(soc)

Use the HWH metadata to figure out what connects to this IP block.

Parameters:

soc (QickSoc) – The overlay object, used to look up metadata and dereference driver names.

class qick.rfboard.AxisSignalGenV6Ctrl(*args: Any, **kwargs: Any)[source]

Bases: SocIP

bindto = ['user.org:user:axis_signal_gen_v6_ctrl:1.0', 'QICK:QICK:axis_signal_gen_v6_ctrl:1.0']
__init__(description, **kwargs)[source]
configure(fs, gen)[source]
add(freq=0, phase=0, addr=0, gain=0.99, nsamp=1600, outsel='dds', mode='periodic', stdysel='zero', phrst='no')[source]
property cfg
configure_connections(soc)

Use the HWH metadata to figure out what connects to this IP block.

Parameters:

soc (QickSoc) – The overlay object, used to look up metadata and dereference driver names.

class qick.rfboard.AxisDdsMrSwitch(*args: Any, **kwargs: Any)[source]

Bases: SocIP

bindto = ['user.org:user:axis_dds_mr_switch:1.0', 'QICK:QICK:axis_dds_mr_switch:1.0']
__init__(description, **kwargs)[source]

Constructor method

config(reg_)[source]
real()[source]
imag()[source]
property cfg
configure_connections(soc)

Use the HWH metadata to figure out what connects to this IP block.

Parameters:

soc (QickSoc) – The overlay object, used to look up metadata and dereference driver names.

class qick.rfboard.AxisSwitchV1(*args: Any, **kwargs: Any)[source]

Bases: SocIP

bindto = ['user.org:user:axis_switch_v1:1.0', 'QICK:QICK:axis_switch_v1:1.0']
__init__(description)[source]

Constructor method

sel(mst=0)[source]
property cfg
configure_connections(soc)

Use the HWH metadata to figure out what connects to this IP block.

Parameters:

soc (QickSoc) – The overlay object, used to look up metadata and dereference driver names.

class qick.rfboard.spi(*args: Any, **kwargs: Any)[source]

Bases: SocIP

bindto = ['xilinx.com:ip:axi_quad_spi:3.2']
SPI_REGLIST = ['DGIER', 'IPISR', 'IPIER', 'SRR', 'SPICR', 'SPISR', 'SPI_DTR', 'SPI_DRR', 'SPI_SSR', 'SPI_TXFIFO_OR', 'SPI_RXFIFO_OR']
__init__(description, **kwargs)[source]
rst()[source]
config(lsb='lsb', msttran='enable', ssmode='ssr', rxfifo='rst', txfifo='rst', cpha='', cpol='high', mst='master', en='enable', loopback='no')[source]
en_level(nch=4, chlist=[0], en_l='high')[source]

chlist: list of bits to enable en_l: enable level “high”: ignore nch, enabled bits are set high “low”: nch is total length, enabled bits are set low

send_m(data, ch_en, cs_t='pulse')[source]

The data must be formatted in bytes, regardless of the data width of the SPI IP. For data width 16 or 32, the bytes will be packed in little-endian order.

receive()[source]

The returned data will be formatted in bytes, regardless of the data width of the SPI IP. For data width 16 or 32, the bytes will be unpacked in little-endian order.

send_receive_m(data, ch_en, cs_t='pulse')[source]

data: list of bytes to send ch_en: destination address

property cfg
configure_connections(soc)

Use the HWH metadata to figure out what connects to this IP block.

Parameters:

soc (QickSoc) – The overlay object, used to look up metadata and dereference driver names.

class qick.rfboard.BiasAD5781(spi_ip, ch_en, cs_t='')[source]

Bases: object

Bias DAC chip AD5781.

cmd_wr = 0
cmd_rd = 1
VREFN = -10
VREFP = 10
B = 18
REGS = {'CLEAR_REG': 3, 'CTRL_REG': 2, 'DAC_REG': 1, 'SOFT_REG': 4}
__init__(spi_ip, ch_en, cs_t='')[source]
read_reg(reg)[source]
write_reg(reg, val)[source]
set_volt(volt)[source]

Set the voltage, return the actual (rounded) value that was set.

get_volt()[source]

Read and return the voltage setpoint.

class qick.rfboard.BiasDAC11001(spi_ip, ch_en, cs_t='')[source]

Bases: object

Bias DAC chip DAC11001.

cmd_wr = 0
cmd_rd = 1
VREFN = -10
VREFP = 10
B = 20
REGS = {'CONFIG1_REG': 2, 'CONFIG2_REG': 6, 'DAC_CLEAR_DATA_REG': 3, 'DAC_DATA_REG': 1, 'STATUS_REG': 5, 'TRIGGER_REG': 4}
__init__(spi_ip, ch_en, cs_t='')[source]
read_reg(reg)[source]
write_reg(reg, val)[source]
set_volt(volt)[source]
get_volt()[source]

Read and return the voltage setpoint.

class qick.rfboard.AttenuatorPE43705(spi_ip, ch=0, nch=3, le=[0], en_l='high', cs_t='pulse')[source]

Bases: object

This class provides SPI access to the PE43705 step attenuator. Range is 0-31.75 dB. Parts are used in serial mode. This device’s SPI interface is write-only, no readback. See schematics for Address/LE correspondance.

nSteps = 128
dbStep = 0.25
dbMinAtt = 0
dbMaxAtt = 31.75
__init__(spi_ip, ch=0, nch=3, le=[0], en_l='high', cs_t='pulse')[source]
set_att(db)[source]
class qick.rfboard.FilterADMV8818(spi_ip, ch, cs_t='')[source]

Bases: object

ADMV8818 filter chip.

cmd_wr = 0
cmd_rd = 1
REGS = {'ADI_SPI_CONFIG_A': 0, 'ADI_SPI_CONFIG_B': 1, 'CHIPTYPE': 3, 'PRODUCT_ID_H': 5, 'PRODUCT_ID_L': 4, 'WR0_FILTER': 33, 'WR0_SW': 32}
BANDS = {'HPF': {'HPF1': {'max': 3.55, 'min': 1.75, 'switch': 1}, 'HPF2': {'max': 7.25, 'min': 3.4, 'switch': 2}, 'HPF3': {'max': 12.6, 'min': 6.6, 'switch': 3}, 'HPF4': {'max': 19.9, 'min': 12.5, 'switch': 4}, 'bypass': {'max': 18.0, 'min': 2.0, 'switch': 0}}, 'LPF': {'LPF1': {'max': 3.85, 'min': 2.05, 'switch': 1}, 'LPF2': {'max': 7.25, 'min': 3.35, 'switch': 2}, 'LPF3': {'max': 13.0, 'min': 7.0, 'switch': 3}, 'LPF4': {'max': 18.85, 'min': 12.55, 'switch': 4}, 'bypass': {'max': 18.0, 'min': 2.0, 'switch': 0}}}
B = 4
__init__(spi_ip, ch, cs_t='')[source]
write_reg(reg, value)[source]
read_reg(reg)[source]
freq2step(f, section, n=10)[source]
set_filter_raw(hpf, lpf)[source]

lpf, hpf: -1 for bypass, 0 through 63 to enable filter

set_filter(fc=0, bw=2.0, ftype='lowpass')[source]
class qick.rfboard.SwitchControl(spi_ip)[source]

Bases: object

__init__(spi_ip)[source]
add_MCP(gpio, outputs)[source]
class qick.rfboard.GpioMCP23S08(spi_ip, ch_en, dev_addr, iodir=0, cs_t='')[source]

Bases: object

GPIO chip MCP23S08.

cmd_wr = 64
cmd_rd = 65
REGS = {'DEFVAL_REG': 3, 'GPINTEN_REG': 2, 'GPIO_REG': 9, 'GPPU_REG': 6, 'INTCAP_REG': 8, 'INTCON_REG': 4, 'INTF_REG': 7, 'IOCON_REG': 5, 'IODIR_REG': 0, 'IPOL_REG': 1, 'OLAT_REG': 10}
__init__(spi_ip, ch_en, dev_addr, iodir=0, cs_t='')[source]
read_reg(reg)[source]
write_reg(reg, val)[source]
set_bits(bits, val)[source]
class qick.rfboard.LoSynthADF4372(spi_ip, nch=2, le=[0], en_l='low', cs_t='')[source]

Bases: object

LO Synthesis chip ADF4372

f_REF_in = 122.88
MOD1 = 33554432
cmd_wr = 0
cmd_rd = 128
REGS = {'ADC_CLK_REG': 53, 'ADC_OFFSET_REG': 58, 'ADC_REG': 50, 'AUXOUT_REG': 114, 'BIAS_SEL_X2_REG': 112, 'BIAS_SEL_X4_REG': 113, 'BLEED0_REG': 38, 'BLEED1_REG': 39, 'CAL_PRE_REG': 18, 'CHIP_REG': 3, 'CLK1_DIV_HIGH_REG': 64, 'CLK1_DIV_LOW_REG': 63, 'CLK2_DIV_REG': 65, 'CONFIG0_REG': 0, 'CONFIG1_REG': 1, 'CONFIG2_REG': 30, 'CONFIG3_REG': 35, 'CONFIG4_REG': 42, 'CP_TMODE_REG': 62, 'FRAC1_HIGH_REG': 22, 'FRAC1_LOW_REG': 20, 'FRAC1_MID_REG': 21, 'FRAC2_HIGH_REG': 24, 'FRAC2_LOW_REG': 23, 'ICP_OFFSET_REG': 54, 'INT_HIGH_REG': 17, 'INT_LOW_REG': 16, 'LD_PD_ADC_REG': 115, 'LOCK_DETECT_REG': 124, 'LOCK_REG': 40, 'MOD2_HIGH_REG': 26, 'MOD2_LOW_REG': 25, 'MUXOUT_REG': 32, 'PHASE_HIGH_REG': 29, 'PHASE_LOW_REG': 27, 'PHASE_MID_REG': 28, 'PROD_ID0_REG': 4, 'PROD_ID1_REG': 5, 'PROD_REV_REG': 6, 'RCNT_REG': 31, 'REF_REG': 34, 'RFDIV_REG': 36, 'RFOUT_REG': 37, 'SD_REG': 43, 'SD_RESET_REG': 61, 'SI_BAND_REG': 55, 'SI_VCO_REG': 56, 'SI_VTUNE_REG': 57, 'SYNTH_TIMEOUT_REG': 51, 'TIMEOUT_REG': 49, 'TRM_RESD0_REG': 71, 'TRM_RESD1_REG': 82, 'VCO_BAND_REG': 48, 'VCO_BIAS0_REG': 44, 'VCO_BIAS1_REG': 45, 'VCO_BIAS2_REG': 46, 'VCO_BIAS3_REG': 47, 'VCO_DATA_HIGH_REG': 111, 'VCO_DATA_LOW_REG': 110, 'VCO_TIMEOUT_REG': 52}
__init__(spi_ip, nch=2, le=[0], en_l='low', cs_t='')[source]
reg_rd(reg='CONFIG0_REG')[source]
reg_wr(reg='CONFIG0_REG', val=0)[source]
set_freq(fin=6000)[source]
class qick.rfboard.LoSynthLMX2594(spi_ip, ch)[source]

Bases: object

__init__(spi_ip, ch)[source]
property freq
reset()[source]
reg_wr(regval)[source]
reg_rd(addr)[source]
is_locked()[source]
set_freq(f, pwr=50, reset=True, verbose=False)[source]
calibrate(timeout=1.0, n_attempts=5, verbose=False)[source]
set_param(name, val)[source]
get_param(name)[source]
program()[source]
class qick.rfboard.GainLMH6401(spi_ip, ch_en, cs_t='')[source]

Bases: object

Variable gain amp LMH6401.

B = 6
Gmin = -6
Gmax = 26
cmd_wr = 0
cmd_rd = 128
REGS = {'GAIN_REG': 2, 'PRODID_REG': 1, 'REVID_REG': 0, 'TFREQ_REG': 5, 'TGAIN_REG': 4}
__init__(spi_ip, ch_en, cs_t='')[source]
read_reg(reg)[source]
write_reg(reg, val)[source]
set_gain(db)[source]
get_gain()[source]
class qick.rfboard.AbsDacRfChain[source]

Bases: ABC

abstract enable_rf(att1, att2)[source]
class qick.rfboard.AbsAdcRfChain[source]

Bases: ABC

abstract enable_rf(att)[source]
class qick.rfboard.AbsDacDcChain[source]

Bases: ABC

abstract enable_dc()[source]
class qick.rfboard.AbsAdcDcChain[source]

Bases: ABC

abstract enable_dc(gain)[source]
abstract get_gain()[source]
class qick.rfboard.AbsDacBalunChain[source]

Bases: ABC

class qick.rfboard.AbsAdcBalunChain[source]

Bases: ABC

class qick.rfboard.AdcRfChain111(ch, switches, attn_spi)[source]

Bases: AbsAdcRfChain

__init__(ch, switches, attn_spi)[source]
enable_rf(att)[source]
disable()[source]
class qick.rfboard.AdcDcChain111(ch, switches, gain_spi)[source]

Bases: AbsAdcDcChain

Class to describe the ADC-DC channel chain.

__init__(ch, switches, gain_spi)[source]
get_gain()[source]
enable_dc(gain)[source]
disable()[source]
class qick.rfboard.DacChain111(ch, switches, attn_spi)[source]

Bases: AbsDacRfChain, AbsDacDcChain

__init__(ch, switches, attn_spi)[source]
rfsw_sel(sel='RF')[source]
enable_rf(att1, att2)[source]
enable_dc()[source]
disable()[source]
class qick.rfboard.Chain216(soc, card, global_ch, card_num, card_ch)[source]

Bases: ABC

__init__(soc, card, global_ch, card_num, card_ch)[source]
class qick.rfboard.FilterChain(soc, card, global_ch, card_num, card_ch)[source]

Bases: Chain216

init_filter()[source]
set_filter(fc=0, bw=None, ftype='lowpass')[source]
set_filter_raw(hpf=-1, lpf=-1)[source]
read_filter(reg='')[source]
__init__(soc, card, global_ch, card_num, card_ch)
class qick.rfboard.DacRfChain216(soc, card, global_ch, card_num, card_ch)[source]

Bases: AbsDacRfChain, FilterChain

__init__(soc, card, global_ch, card_num, card_ch)[source]
enable_rf(att1, att2)[source]
disable()[source]

Because this daughter card doesn’t have a per-channel power switch, we don’t power it down.

init_filter()
read_filter(reg='')
set_filter(fc=0, bw=None, ftype='lowpass')
set_filter_raw(hpf=-1, lpf=-1)
class qick.rfboard.AdcRfChain216(soc, card, global_ch, card_num, card_ch)[source]

Bases: AbsAdcRfChain, FilterChain

__init__(soc, card, global_ch, card_num, card_ch)[source]
enable_rf(att)[source]
disable()[source]
init_filter()
read_filter(reg='')
set_filter(fc=0, bw=None, ftype='lowpass')
set_filter_raw(hpf=-1, lpf=-1)
class qick.rfboard.DacDcChain216(soc, card, global_ch, card_num, card_ch)[source]

Bases: AbsDacDcChain, Chain216

__init__(soc, card, global_ch, card_num, card_ch)[source]
enable_dc()[source]
disable()[source]
class qick.rfboard.AdcDcChain216(soc, card, global_ch, card_num, card_ch)[source]

Bases: AbsAdcDcChain, Chain216

__init__(soc, card, global_ch, card_num, card_ch)[source]
enable_dc(gain)[source]
disable()[source]
get_gain()[source]
class qick.rfboard.DacBalunChain216(soc, card, global_ch, card_num, card_ch)[source]

Bases: AbsDacBalunChain, Chain216

__init__(soc, card, global_ch, card_num, card_ch)[source]
class qick.rfboard.AdcBalunChain216(soc, card, global_ch, card_num, card_ch)[source]

Bases: AbsAdcBalunChain, Chain216

__init__(soc, card, global_ch, card_num, card_ch)[source]
class qick.rfboard.DaughterCard216(card_num, soc, gpio)[source]

Bases: ABC

NCH = None
CARDNUM_OFFSET = None
CHAIN_CLASS = None
GPIO_OUTPUTS = [None, None, None, None]
NAME = ''
__init__(card_num, soc, gpio)[source]
disable_all()[source]
class qick.rfboard.DacRfCard216(card_num, soc, gpio)[source]

Bases: DaughterCard216

NCH = 4
CARDNUM_OFFSET = 0
CHAIN_CLASS

alias of DacRfChain216

GPIO_OUTPUTS = [('RFOUT5V0_EN0', 0), ('RFOUT5V0_EN1', 0), None, None]
NAME = 'RF Out'
disable_all()[source]
__init__(card_num, soc, gpio)
class qick.rfboard.DacDcCard216(card_num, soc, gpio)[source]

Bases: DaughterCard216

NCH = 4
CARDNUM_OFFSET = 0
CHAIN_CLASS

alias of DacDcChain216

GPIO_OUTPUTS = [('PD0', 0), ('PD1', 0), ('PD2', 0), ('PD3', 0)]
NAME = 'DC Out'
__init__(card_num, soc, gpio)
disable_all()
class qick.rfboard.DacBalunCard216(card_num, soc, gpio)[source]

Bases: DaughterCard216

NCH = 4
CARDNUM_OFFSET = 0
CHAIN_CLASS

alias of DacBalunChain216

GPIO_OUTPUTS = [None, None, None, None]
NAME = 'Balun Out'
__init__(card_num, soc, gpio)
disable_all()
class qick.rfboard.AdcRfCard216(card_num, soc, gpio)[source]

Bases: DaughterCard216

NCH = 2
CARDNUM_OFFSET = 4
CHAIN_CLASS

alias of AdcRfChain216

GPIO_OUTPUTS = [('RFIN5V0CH0_EN', 0), ('RFIN5V0CH1_EN', 0), None, None]
NAME = 'RF In'
__init__(card_num, soc, gpio)
disable_all()
class qick.rfboard.AdcDcCard216(card_num, soc, gpio)[source]

Bases: DaughterCard216

NCH = 2
CARDNUM_OFFSET = 4
CHAIN_CLASS

alias of AdcDcChain216

GPIO_OUTPUTS = [('PD0', 1), ('PD1', 1), None, None]
NAME = 'DC In'
__init__(card_num, soc, gpio)
disable_all()
class qick.rfboard.AdcBalunCard216(card_num, soc, gpio)[source]

Bases: DaughterCard216

NCH = 2
CARDNUM_OFFSET = 4
CHAIN_CLASS

alias of AdcBalunChain216

GPIO_OUTPUTS = [None, None, None, None]
NAME = 'Balun In'
__init__(card_num, soc, gpio)
disable_all()
class qick.rfboard.BoardSelection(gpio_ip)[source]

Bases: object

This class is used to enable one daughter card on the RF Board for the ZCU216, V1.

__init__(gpio_ip)[source]
enable(board_id=0)[source]
disable()[source]
enable_context(board_id)[source]

Use with “with” to temporarily enable a card inside a code block.

class qick.rfboard.RFQickSoc(*args: Any, **kwargs: Any)[source]

Bases: QickSoc

Overrides the __init__ method of QickSoc in order to add the drivers for the preproduction (V1) version of the RF board. Otherwise supports all the QickSoc functionality.

HAS_LO = True
__init__(bitfile, clk_output=None, no_tproc=False, **kwargs)[source]

A bitfile must always be provided, since the default bitstream will not work with the RF board.

The ZCU111 RF board takes its LO reference from the ZCU111 clock output. So if clk_output is None, the clocks will be re-initialized every time. This ensures that the LO output to the RF board is enabled.

rfb_set_gen_rf(gen_ch, att1, att2)[source]

Enable and configure an RF-board output channel for RF output.

Parameters:
  • gen_ch (int) – DAC channel (index in ‘gens’ list)

  • att1 (float) – Attenuation for first stage (0 through 31.75 dB in 0.25-dB increments)

  • att2 (float) – Attenuation for second stage (0 through 31.75 dB in 0.25-dB increments)

Returns:

  • float – actual (rounded) att1 value that was set

  • float – actual (rounded) att2 value that was set

rfb_set_gen_dc(gen_ch)[source]

Enable and configure an RF-board output channel for DC output.

Parameters:

gen_ch (int) – DAC channel (index in ‘gens’ list)

rfb_set_dac_rf(dac_port, att1, att2)[source]

Enable and configure a QICK box or RF board DAC port for RF output.

Parameters:
  • dac_port (int) – QICK box or RF board DAC port number (0-15 for ZCU216, 0-7 for ZCU111)

  • att1 (float) – Attenuation for first stage (0 through 31.75 dB in 0.25-dB increments)

  • att2 (float) – Attenuation for second stage (0 through 31.75 dB in 0.25-dB increments)

Returns:

  • float – actual (rounded) att1 value that was set

  • float – actual (rounded) att2 value that was set

rfb_set_dac_dc(dac_port)[source]

Enable and configure a QICK box or RF board DAC port for DC output.

Parameters:

dac_port (int) – QICK box or RF board DAC port number (0-15 for ZCU216, 0-7 for ZCU111)

rfb_set_ro_rf(ro_ch, att)[source]

Enable and configure an RF-board RF input channel. Will fail if this is not an RF input.

Parameters:
  • ro_ch (int) – ADC channel (index in ‘avg_bufs’ list)

  • att (float) – Attenuation (0 through 31.75 dB in 0.25-dB increments)

Returns:

actual (rounded) value that was set

Return type:

float

rfb_set_ro_dc(ro_ch, gain)[source]

Enable and configure an RF-board DC input channel. Will fail if this is not a DC input.

Parameters:
  • ro_ch (int) – ADC channel (index in ‘readouts’ list)

  • gain (float) – Gain (-6 through 26 dB in 1-dB increments)

Returns:

actual (rounded) value that was set

Return type:

float

rfb_set_adc_rf(adc_port, att)[source]

Enable and configure an RF-board RF input channel. Will fail if this is not an RF input.

Parameters:
  • adc_port (int) – QICK box or RF board ADC port number (0-7 for ZCU216, 0-3 for ZCU111)

  • att (float) – Attenuation (0 through 31.75 dB in 0.25-dB increments)

Returns:

actual (rounded) value that was set

Return type:

float

rfb_set_adc_dc(adc_port, gain)[source]

Enable and configure an RF-board DC input channel. Will fail if this is not a DC input.

Parameters:
  • adc_port (int) – QICK box or RF board ADC port number (0-7 for ZCU216, 4-7 for ZCU111)

  • gain (float) – Gain (-6 through 26 dB in 1-dB increments)

Returns:

actual (rounded) value that was set

Return type:

float

rfb_set_bias(bias_ch, v)[source]

Set a voltage on an RF-board bias output.

Parameters:
  • bias_ch (int) – Channel number (0-7)

  • v (float) – Voltage (-10 to 10 V)

Returns:

actual (rounded) value that was set

Return type:

float

rfb_get_bias(bias_ch)[source]

Read the voltage setpoint on an RF-board bias output.

Parameters:

bias_ch (int) – Channel number (0-7)

Returns:

setpoint, in volts

Return type:

float

adcfreq(f, gen_ch=0, ro_ch=0)

Takes a frequency and trims it to the closest DDS frequency valid for both channels.

Parameters:
  • f (float) – frequency (MHz)

  • gen_ch (int) – generator channel

  • ro_ch (int) – readout channel

Returns:

Re-formatted frequency

Return type:

float

arm_ddr4(ch, nt, force_overwrite=False)

Prepare the DDR4 buffer to take data. This must be called before starting a program that triggers the buffer. Once the buffer is armed, the first trigger it receives will cause the buffer to record the specified amount of data. Later triggers will have no effect.

Parameters:
  • ch (int) – The readout channel to record (index in ‘readouts’ list).

  • nt (int) – Number of data transfers to record; the number of IQ samples/transfer (128 or 256) is printed in the QickSoc config. Note that the amount of useful data is less (see get_ddr4)

  • force_overwrite (bool) – Allow a DDR4 acqusition that exceeds the DDR4 memory capacity. The memory will be used as a circular buffer: later transfers will wrap around to the beginning of the memory and overwrite older data.

arm_mr(ch)

Prepare the Multi-Rate buffer to take data. This must be called before starting a program that triggers the buffer. Once the buffer is armed, the first trigger it receives will cause the buffer to record until the buffer is filled. Later triggers will have no effect.

Parameters:

ch (int) – The readout channel to record (index in ‘readouts’ list).

calc_fstep(dicts)

Finds the least common multiple of the frequency steps of one or more channels (typically two, a generator and a readout) For proper frequency matching, you should only use frequencies that are evenly divisible by this value. The order of the parameters does not matter.

Parameters:

dicts (list of dict) – config dict for the channels

Returns:

frequency step common to all channels

Return type:

float

calc_fstep_int(dict1, other_dicts)

Finds the multiplier that needs to be applied to a channel’s frequency step size to allow this channel to be frequency-matched with another channel.

Parameters:
  • dict1 (dict) – config dict for this channel

  • other_dicts (list of dict) – config dict for the other channel(s)

Returns:

frequency step multiplier for the first channel

Return type:

int

calc_mixer_freq(gen_ch, mixer_freq, nqz, ro_ch)

Set the NCO frequency that will be mixed with the generator output.

The RFdc driver does its own math to convert a frequency to a register value. (see XRFdc_SetMixerSettings in xrfdc_mixer.c, and “NCO Frequency Conversion” in PG269) This is what it does: 1. Add/subtract fs to get the frequency in the range of [-fs/2, fs/2]. 2. If the original frequency was not in [-fs/2, fs/2] and the DAC is configured for 2nd Nyquist zone, multiply by -1. 3. Convert to a 48-bit register value, rounding using C integer casting (i.e. round towards 0).

Step 2 is not desirable for us, so we must undo it.

The rounding gives unexpected results sometimes: it’s hard to tell if a freq will get rounded up or down. This is important if the demanded frequency was rounded to a valid frequency for frequency matching. The safest way to get consistent behavior is to always round to a valid NCO frequency. We are trusting that the floating-point math is exact and a number we rounded here is still a round number in the RFdc driver.

calc_muxgen_regs(gen_ch, freqs, gains, phases, ro_ch, absolute_freqs, mixer_freq)

Calculate the register values to program into a multiplexed generator. mixer_freq will have been rounded appropriately in declare_gen, and will be 0 if there’s no mixer

calc_ro_freq(rocfg, ro_pars, ro_regs, absolute_freqs, mixer_freq, flip_freq=False)

Calculate the readout frequency and registers.

calc_ro_regs(rocfg, phase, sel, ch=None)

Calculate the settings to configure a readout.

Returns:

settings for QickSoc.config_readout()

Return type:

dict

ch_fstep(dict1)

Finds the frequency step size of a single channel (generator or readout).

Parameters:

dict1 (dict) – config dict for one channel

Returns:

frequency step for this channel

Return type:

float

check_pfb_collisions(rocfg, cfg1, cfgs)

Check whether the specified PFB config collides or interefers with any others. If this PFB block can’t put two readouts on the same channel, this method will raise an error on collisions. Possible crosstalk will be identified in warnings.

Parameters:
  • rocfg (dict) – firmware config dictionary for the PFB or the readout chain

  • cfg1 (dict) – PFB config to check

  • cfgs (list of dict) – PFB configs to check cfg1 against

cleanup_round()

This runs after a program has finished running. This is called by acquire/acquire_decimated/run_rounds; user code should not call it.

By default this does nothing, but a subclass of QickSoc may override this.

clear_ddr4(length=None)

Clear the DDR4 buffer, filling it with 0’s. This is not necessary (the buffer will overwrite old data), but may be useful for debugging. Clearing the full buffer (4 GB) typically takes 4-5 seconds.

Parameters:

length (int) – Number of samples to clear (starting at the beginning of the buffer). If None, clear the entire buffer.

clear_tproc_counter(addr)

Initialize the tProc shot counter. For tProc v1, the data memory at the specified address is zeroed. For tProc v2, the tProc is reset, which zeroes all registers (the address is ignored).

Typical tProc v2 programs will also initialize the counter registers at the beginning of the program, but zeroing the counter now is important to distinguish “program waiting for external start” from “program complete.”

Parameters:

addr (int) – Counter address

clocks_locked()

Checks whether the DAC and ADC PLLs are locked. This can only be run after the bitstream has been downloaded. A failure usually means the FPGA is not getting a good reference clock from the on-board clock chips.

Returns:

clock status

Return type:

bool

config_avg(ch, address=0, length=1, edge_counting=False, high_threshold=1000, low_threshold=0)

Configure accumulated buffer; must then enable using enable_buf()

Parameters:
  • ch (int) – Readout channel to configure

  • address (int) – Starting address of buffer

  • length (int) – length of buffer (how many samples to integrate)

config_buf(ch, address=0, length=1)

Configure decimated buffer; must then enable using enable_buf()

Parameters:
  • ch (int) – Readout channel to configure

  • address (int) – Starting address of buffer

  • length (int) – length of buffer (how many samples to take)

config_clocks(force_init_clks, clk_output, external_clk)

Configure PLLs if requested, or if any ADC/DAC is not locked. The ADC/DAC PLL lock status is read through the RFDC IP, so this assumes that the bitstream has already been downloaded. The reference clock frequency must already have been read from the firmware config.

config_mux_gen(ch, tones)

Set up a list of tones all at once, using raw (integer) units. If the supplied list of tones is shorter than the number supported, the extra tones will have their gains set to 0.

Parameters:
  • ch (int) – generator channel (index in ‘gens’ list)

  • tones (list of dict) – Tones to configure. This is generated by QickConfig.calc_muxgen_regs().

config_mux_readout(pfbpath, cfgs, sel=None)

Set up a list of readout frequencies all at once, using raw (integer) units.

Parameters:
  • pfbpath (str) – Firmware path of the PFB readout being configured.

  • cfgs (list of dict) – Readout chains to configure. This is generated by QickConfig.calc_pfbro_regs().

  • sel (str) – Output selection (if supported), default to ‘product’

configure_readout(ch, ro_regs)

Configure readout channel output style and frequency. This method is only for use with PYNQ-configured readouts.

Parameters:
  • ch (int) – readout channel number (index in ‘readouts’ list)

  • ro_regs (dict) – readout registers, from QickConfig.calc_ro_regs()

cycles2us(cycles, gen_ch=None, ro_ch=None)

Converts clock cycles to microseconds. Uses tProc clock frequency by default. If gen_ch or ro_ch is specified, uses that generator/readout channel’s fabric clock.

Parameters:
  • cycles (int) – Number of clock cycles

  • gen_ch (int) – generator channel (index in ‘gens’ list)

  • ro_ch (int) – readout channel (index in ‘readouts’ list)

Returns:

Number of microseconds

Return type:

float

deg2int(deg, thisch)

Converts phase in degrees to integer value suitable for writing to a register. This method works for both generators and readouts.

Parameters:
  • deg (float) – phase (degrees)

  • thisch (dict) – config dict for the channel you’re configuring

Returns:

Re-formatted phase

Return type:

int

deg2reg(deg, gen_ch=0, ro_ch=None)

Converts degrees into phase register values; numbers greater than 360 will effectively be wrapped.

Parameters:
  • deg (float) – Number of degrees

  • gen_ch (int) – generator channel (index in ‘gens’ list)

  • ro_ch (int) – readout channel (index in ‘readouts’ list)

Returns:

Re-formatted number of degrees

Return type:

int

description()

Generate a printable description of the QICK configuration.

Returns:

description

Return type:

str

dump_cfg(gen_file_path=None)

Generate a JSON description of the QICK configuration. You can save this string to a file and load it to recreate the QickConfig.

Parameters:

gen_file_path (str or path-like, optional) – If provided, write the generated JSON configuration to this file path.

Returns:

configuration in JSON format

Return type:

str

Raises:

OSError – If gen_file_path is provided and the JSON configuration cannot be written to the specified file.

enable_buf(ch, enable_avg=True, enable_buf=True)

Enable capture of accumulated and/or decimated data for a buffer

Parameters:
  • ch (int) – Readout channel to configure

  • enable_avg (bool) – Enable accumulated data capture

  • enable_buf (bool) – Enable decimated data capture

freeze_adc_cals(blocknames)

Freeze the calibrations (stop the background calibration) of a list of RFSoC ADCs.

See the Xilinx documentation:

https://docs.amd.com/r/en-US/pg269-rf-data-converter/Background-Calibration-Process

Parameters:

blocknames (list of str) – List of RF-ADC IDs (2-digit strings). An ADC’s ID is the concatenation of the tile and block numbers displayed in the firmware configuration: in other words, for “ADC tile 2, blk 1” the blockname is “21”.

freq2int(f, thisch, otherch=None)

Converts frequency in MHz to integer value suitable for writing to a register. This method works for both generators and readouts. If a gen will be connected to an RO, the two channels must have exactly the same frequency, and you must supply the config for the other channel.

Parameters:
  • f (float) – frequency (MHz)

  • thisch (dict) – config dict for the channel you’re configuring

  • otherch (dict) – config dict for a channel you will set to the same frequency

Returns:

Re-formatted frequency

Return type:

int

freq2reg(f, gen_ch=0, ro_ch=None)

Converts frequency in MHz to tProc generator register value.

Parameters:
  • f (float) – frequency (MHz)

  • gen_ch (int) – generator channel

  • ro_ch (int) – readout channel (use None if you don’t want to frequency-match to a readout)

Returns:

Re-formatted frequency

Return type:

int

freq2reg_adc(f, ro_ch=0, gen_ch=None)

Converts frequency in MHz to readout register value.

Parameters:
  • f (float) – frequency (MHz)

  • ro_ch (int) – readout channel

  • gen_ch (int) – generator channel (use None if you don’t want to frequency-match to a generator)

Returns:

Re-formatted frequency

Return type:

int

get_accumulated(ch, address=0, length=None)

Acquires data from the readout accumulated buffer

Parameters:
  • ch (int) – ADC channel

  • address (int) – Address of data

  • length (int) – Buffer transfer length

Returns:

  • di[:length] (list) - list of accumulated I data

  • dq[:length] (list) - list of accumulated Q data

get_adc_attenuator(blockname)

Read the RFSoC ADC’s built-in step attenuator.

Only available for RFSoC Gen 3 (ZCU216, RFSoC4x2, RFSoC2x4). See https://docs.amd.com/r/en-US/pg269-rf-data-converter/Digital-Step-Attenuator-Gen-3/DFE.

Parameters:

blockname (str) – RF-ADC ID (2-digit string). This is the concatenation of the tile and block numbers displayed in the firmware configuration: in other words, for “ADC tile 2, blk 1” the blockname is “21”.

Returns:

Attenuation value (dB)

Return type:

float

get_cfg()

Return the QICK configuration dictionary. This contains everything you need to recreate the QickConfig.

Returns:

configuration dictionary

Return type:

dict

get_ddr4(nt, start=None)

Get data from the DDR4 buffer. The first samples (typically 401 or 801) of the buffer are always stale data from the previous acquisition.

Parameters:
  • nt (int) – Number of data transfers (each transfer is 128 or 256 decimated samples) to retrieve. If start=None, the amount of data will be reduced (see below).

  • start (int) – Number of samples to skip at the beginning of the buffer. If a value is specified, the end address of the transfer window will also be incremented. If None, the junk at the start of the buffer will be skipped but the end address will not be incremented. This reduces the amount of data, giving you exactly the block of valid data from a DDR4 trigger with the same value of nt.

get_decimated(ch, address=0, length=None)

Acquires data from the readout decimated buffer

Parameters:
  • ch (int) – ADC channel

  • address (int) – Address of data

  • length (int) – Buffer transfer length

Returns:

List of I and Q decimated arrays

Return type:

list of numpy.ndarray

get_maxv(gen_ch)

Convenience method for looking up a generator’s maximum allowed envelope value. The absolute value of the idata/qdata should not exceed this. Typically you will want to normalize your envelope’s maximum range to this value.

Parameters:

gen_ch (int) – generator channel (index in ‘gens’ list)

Returns:

max allowed value

Return type:

int

get_mr(start=None)

Get data from the multi-rate buffer. The first 8 samples are always stale data from the previous acquisition. The transfer window always extends to the end of the buffer.

Parameters:

start (int) – Number of samples to skip at the beginning of the buffer. If None, the junk at the start of the buffer is skipped.

get_sample_rates()

Produce dictionaries of the current sample rates of the DAC and ADC tiles. A dictionary of this form can be used to configure the sample rates at SoC initialization.

Returns:

A pair of dictionaries mapping DAC/ADC tiles to sample rates (in Msps).

Return type:

dict[str, dict[int, float]]

get_tproc_counter(addr)

Read the tProc shot counter. For tProc V1, this accesses the data memory at the given address. For tProc V2, this accesses one of the two special AXI-readable registers.

Parameters:

addr (int) – Counter address

Returns:

Counter value

Return type:

int

int2deg(r, thisch)

Converts register value to degrees. This method works for both generators and readouts.

Parameters:
  • r (int) – register value

  • thisch (dict) – config dict for the channel you’re configuring

Returns:

Re-formatted phase (degrees)

Return type:

float

int2freq(r, thisch)

Converts register value to MHz. This method works for both generators and readouts.

Parameters:
  • r (int) – register value

  • thisch (dict) – config dict for the channel you’re configuring

Returns:

Re-formatted frequency (MHz)

Return type:

float

load_bin_program(binprog, load_mem=True)

Write the program to the tProc program memory.

Parameters:
  • binprog (numpy.ndarray or dict) – compiled program (format depends on tProc version)

  • load_mem (bool) – write waveform and data memory now (can do this later with reload_mem())

load_envelope(ch, data, addr)

Load envelope data into a signal generator.

Parameters:
  • ch (int) – Generator channel to configure

  • data (numpy.ndarray of int16) – Array of (I, Q) values for pulse envelope

  • addr (int) – Starting address

load_mem(data, mem_sel='dmem', addr=0)

Write a block of the selected tProc memory. For tProc v1 only the data memory (“dmem”) is valid. For tProc v2 the program, data, and waveform memory are all accessible.

Parameters:
  • data (numpy.ndarray of int) – Data to be loaded 32-bit array of shape (n, 8) for pmem and wmem, (n) for dmem

  • mem_sel (str) – “pmem”, “dmem”, “wmem”

  • addr (int) – Starting write address

load_weights(ch, data, addr=0)

Load weights array to a weighted buffer.

Parameters:
  • ch (int) – Readout channel to configure

  • data (numpy.ndarray of int16) – array of 16-bit (I, Q) values for weights

  • address (int) – starting address

map_signal_paths(no_tproc)

Make lists of signal generator, readout, and buffer blocks in the firmware. Also map the switches connecting the generators and buffers to DMA. Fill the config dictionary with parameters of the DAC and ADC channels.

pl_reset(reinit=True)

Reset all firmware IP blocks. This pulses the pl_resetn0 line from the PS (also known as the “fabric reset” or the “PS-PL reset”). Every firmware block’s reset logic is triggered by this pulse. The main visible effect of this reset is to reset the start times of all the phase-coherent DDS oscillators.

Some firmware blocks have startup code in their __initialize__() to configure the block after the firmware is loaded. That configuration gets wiped out by a PL reset, so this method also re-configures those blocks.

More info on the PL reset: The reset sequence is defined in psu_ps_pl_reset_config_data() in psu_init.c. You can find this in the BSP or the firmware project files. The reset sequence and the memory addresses invovled appear to be the same for all RFSoCs.

https://support.xilinx.com/s/article/68962 https://support.xilinx.com/s/question/0D52E00006lLhBnSAK/zynq-ultrascale-howto-reset-the-pl https://docs.amd.com/r/en-US/ug1137-zynq-ultrascale-mpsoc-swdev/GPIO-Reset-to-PL https://docs.amd.com/r/en-US/pg201-zynq-ultrascale-plus-processing-system/Fabric-Reset-Enable

Parameters:

reinit (bool) – Reinitialize firmware blocks. False is OK if you haven’t run map_signal_paths() yet (which triggers block initialization).

poll_data(totaltime=0.1, timeout=None)

Get as much data as possible from the streamer data queue. Stop when any of the following conditions are met: * all the data has been transferred (based on the total_count) * we got data, and it has been totaltime seconds since poll_data was called * timeout is defined, and the timeout expired without getting new data in the queue If there are errors in the error queue, raise the first one.

Parameters:
  • totaltime (float) – How long to acquire data (negative value = ignore total time and total count, just read until timeout)

  • timeout (float) – How long to wait for the next data packet (None = wait forever)

Returns:

list of (data, stats) pairs, oldest first

Return type:

list

prepare_round()

This runs before a program starts running. This is called by acquire/acquire_decimated/run_rounds; user code should not call it.

By default this does nothing, but a subclass of QickSoc may override this.

read_mem(length, mem_sel='dmem', addr=0)

Read a block of the selected tProc memory. For tProc v1 only the data memory (“dmem”) is valid. For tProc v2 the program, data, and waveform memory are all accessible.

Parameters:
  • length (int) – Number of words to read

  • mem_sel (str) – “pmem”, “dmem”, “wmem”

  • addr (int) – Starting read address

Returns:

32-bit array of shape (n, 8) for pmem and wmem, (n) for dmem

Return type:

numpy.ndarray

reg2deg(r, gen_ch=0, ro_ch=None)

Converts phase register values into degrees.

Parameters:
  • reg (int) – Re-formatted number of degrees

  • gen_ch (int) – generator channel (index in ‘gens’ list)

  • ro_ch (int) – readout channel (index in ‘readouts’ list)

Returns:

Number of degrees

Return type:

float

reg2freq(r, gen_ch=0)

Converts frequency from format readable by generator to MHz.

Parameters:
  • r (int) – frequency in generator format

  • gen_ch (int) – generator channel

Returns:

Re-formatted frequency in MHz

Return type:

float

reg2freq_adc(r, ro_ch=0)

Converts frequency from format readable by readout to MHz.

Parameters:
  • r (int) – frequency in readout format

  • ro_ch (int) – readout channel

Returns:

Re-formatted frequency in MHz

Return type:

float

reload_mem()

Reload the waveform and data memory, overwriting any changes made by running the program.

reset_gens()

Reset the tProc and run a minimal tProc program that drives all signal generators with 0’s. Useful for stopping any periodic or stdysel=”last” outputs that may have been driven by a previous program.

round_sample_rate(tiletype, tile, fs_target)

Return the closest achievable sample rate to the requested value. This does not account for dependencies due to clock groups, or the restriction that you’re not allowed to raise the sample rate.

Parameters:
  • tiletype (str) – ‘dac’ or ‘adc’

  • tile (int) – Tile number (0-3)

  • fs_target (float) – Requested sample rate, in Msps

Returns:

Closest valid sample rate, in Msps

Return type:

float

roundfreq(f, dicts)

Round a frequency to the LCM of the frequency steps of one or more channels (typically two, a generator and a readout).

Parameters:
Returns:

rounded frequency (MHz)

Return type:

float or numpy.ndarray

set_adc_attenuator(blockname, attenuation)

Set the RFSoC ADC’s built-in step attenuator. The requested value will be rounded to the nearest valid value (0-27 dB inclusive, 1 dB steps).

Only available for RFSoC Gen 3 (ZCU216, RFSoC4x2, RFSoC2x4). See https://docs.amd.com/r/en-US/pg269-rf-data-converter/Digital-Step-Attenuator-Gen-3/DFE.

Parameters:
  • blockname (str) – RF-ADC ID (2-digit string). This is the concatenation of the tile and block numbers displayed in the firmware configuration: in other words, for “ADC tile 2, blk 1” the blockname is “21”.

  • attenuation (float) – Attenuation value (dB)

Returns:

The rounded attenuation value that was actually set (dB)

Return type:

float

set_all_clks(clk_output, external_clk)

Resets all the board clocks

set_iq(ch, f, i, q, ro_ch=None, phase_reset=True)

Set frequency, I, and Q for a constant-IQ output.

Parameters:
  • ch (int) – DAC channel (index in ‘gens’ list)

  • f (float) – frequency (in MHz)

  • i (float) – I value (in range -1 to 1)

  • q (float) – Q value (in range -1 to 1)

  • ro_ch (int) – readout channel (index in ‘readouts’ list) for frequency matching use None if you don’t want freq to be rounded to a valid readout frequency

  • phase_reset (bool) – if this changes the frequency, also reset the phase (so if we go to freq=0, we end up on the real axis)

set_mixer_freq(ch, f, ro_ch=None, phase_reset=True, fullscale=False)

Set mixer frequency for a signal generator. If the generator does not have a mixer, you will get an error.

Parameters:
set_nyquist(ch, nqz, force=False)

Sets DAC channel ch to operate in Nyquist zone nqz mode.

Parameters:
  • ch (int) – DAC channel (index in ‘gens’ list)

  • nqz (int) – Nyquist zone

start_readout(total_shots, counter_addr=1, ch_list=None, reads_per_shot=1, stride=None)

Start a streaming readout of the accumulated buffers.

Parameters:
  • total_shots (int) – Final value expected for the shot counter

  • counter_addr (int) – Data memory address for the shot counter

  • ch_list (list of int) – List of readout channels

  • reads_per_shot (list of int) – Number of data points to expect per counter increment

  • stride (int) – Default number of measurements to transfer at a time.

start_src(src)

Sets the start source of tProc

Parameters:

src (str) – start source “internal” or “external”

start_tproc()

Start the tProc.

If the tProc is configured for external start, this does nothing (the tProc will start on the first start signal it sees after external start is enabled).

stop_tproc(lazy=False)

Stop the tProc. This is somewhat slow (tens of ms) for tProc v1.

Parameters:

lazy (bool) – Only stop the tProc if it’s easy (i.e. do nothing for v1)

property streamer
property tproc
tt_arm(blk)

Start data capture on the specified time-tagger block.

Parameters:

blk (int) – The time tagger block to arm (index in time_taggers list).

tt_config(blk, threshold, wr_smp=32, filt=False, slope=False, invert=False, interp=0, deadtime=5)

Configure the specified time-tagger block.

Parameters:
  • blk (int) – The time tagger block to flush (index in time_taggers list).

  • threshold (int) – Tag threshold (-2^15 through 2^15-1).

  • wr_smp (int) – Number of 8-sample chunks to capture per tag in the SMP memory (1 through 32). If this time tagger has no SMP memory, this is ignored.

  • filt (bool) – Trigger on signal after a 2-sample smoothing filter.

  • slope (bool) – Trigger on slope (difference between consecutive samples), not level.

  • invert (bool) – Trigger on inverted signal.

  • interp (int) – Number of bits for interpolation (0 through 7).

  • deadtime (int) – Minimum time (in fabric ticks, 8 samples) between one tag and the next (5 through 255). This should be larger than the expected pulse width, otherwise you will get double-triggering on the same pulse.

tt_disarm(blk)

Stop data capture on the specified time-tagger block.

Parameters:

blk (int) – The time tagger block to arm (index in time_taggers list).

tt_readmem(blk, mem)

Read one of the specified time-tagger block’s memories. Reading a time-tagger memory clears it.

Parameters:
  • blk (int) – The time tagger block to read (index in time_taggers list).

  • mem (str) – “ARM”, “SMP”, “TAG0”/”TAG1”/”TAG2”/”TAG3”

tt_reset(blk)

Reset and flush the memories of the specified time-tagger block.

Parameters:

blk (int) – The time tagger block to reset (index in time_taggers list).

unfreeze_adc_cals(blocknames)

Unfreeze the calibrations (resume the background calibration) of a list of RFSoC ADCs.

See the Xilinx documentation:

https://docs.amd.com/r/en-US/pg269-rf-data-converter/Background-Calibration-Process

Parameters:

blocknames (list of str) – List of RF-ADC IDs (2-digit strings). An ADC’s ID is the concatenation of the tile and block numbers displayed in the firmware configuration: in other words, for “ADC tile 2, blk 1” the blockname is “21”.

us2cycles(us, gen_ch=None, ro_ch=None, as_float=False)

Converts microseconds to integer number of clock cycles. Uses tProc clock frequency by default. If gen_ch or ro_ch is specified, uses that generator/readout channel’s fabric clock.

Parameters:
  • us (float) – Number of microseconds

  • gen_ch (int) – generator channel (index in ‘gens’ list)

  • ro_ch (int) – readout channel (index in ‘readouts’ list)

  • as_float (bool) – leave as float, instead of rounding to int

Returns:

Number of clock cycles

Return type:

int

valid_sample_rates(tiletype, tile)

Return an array of valid sample rates. This does not account for dependencies due to clock groups, or the restriction that you’re not allowed to raise the sample rate.

Parameters:
  • tiletype (str) – ‘dac’ or ‘adc’

  • tile (int) – Tile number (0-3)

Returns:

Array of sample rates, in Msps

Return type:

numpy.ndarray

class qick.rfboard.RFQickSoc111V1(*args: Any, **kwargs: Any)[source]

Bases: RFQickSoc

rfb_config(no_tproc)[source]

Configure the SPI interfaces to the RF board.

rfb_set_lo(f)[source]

Set both of the RF-board local oscillators to the same frequency.

Tile 0 DACs and all RF ADCs are connected to LO[0], tile 1 DACs are connected to LO[1].

Parameters:

f (float) – Frequency (4000-8000 MHz)

HAS_LO = True
__init__(bitfile, clk_output=None, no_tproc=False, **kwargs)

A bitfile must always be provided, since the default bitstream will not work with the RF board.

The ZCU111 RF board takes its LO reference from the ZCU111 clock output. So if clk_output is None, the clocks will be re-initialized every time. This ensures that the LO output to the RF board is enabled.

adcfreq(f, gen_ch=0, ro_ch=0)

Takes a frequency and trims it to the closest DDS frequency valid for both channels.

Parameters:
  • f (float) – frequency (MHz)

  • gen_ch (int) – generator channel

  • ro_ch (int) – readout channel

Returns:

Re-formatted frequency

Return type:

float

arm_ddr4(ch, nt, force_overwrite=False)

Prepare the DDR4 buffer to take data. This must be called before starting a program that triggers the buffer. Once the buffer is armed, the first trigger it receives will cause the buffer to record the specified amount of data. Later triggers will have no effect.

Parameters:
  • ch (int) – The readout channel to record (index in ‘readouts’ list).

  • nt (int) – Number of data transfers to record; the number of IQ samples/transfer (128 or 256) is printed in the QickSoc config. Note that the amount of useful data is less (see get_ddr4)

  • force_overwrite (bool) – Allow a DDR4 acqusition that exceeds the DDR4 memory capacity. The memory will be used as a circular buffer: later transfers will wrap around to the beginning of the memory and overwrite older data.

arm_mr(ch)

Prepare the Multi-Rate buffer to take data. This must be called before starting a program that triggers the buffer. Once the buffer is armed, the first trigger it receives will cause the buffer to record until the buffer is filled. Later triggers will have no effect.

Parameters:

ch (int) – The readout channel to record (index in ‘readouts’ list).

calc_fstep(dicts)

Finds the least common multiple of the frequency steps of one or more channels (typically two, a generator and a readout) For proper frequency matching, you should only use frequencies that are evenly divisible by this value. The order of the parameters does not matter.

Parameters:

dicts (list of dict) – config dict for the channels

Returns:

frequency step common to all channels

Return type:

float

calc_fstep_int(dict1, other_dicts)

Finds the multiplier that needs to be applied to a channel’s frequency step size to allow this channel to be frequency-matched with another channel.

Parameters:
  • dict1 (dict) – config dict for this channel

  • other_dicts (list of dict) – config dict for the other channel(s)

Returns:

frequency step multiplier for the first channel

Return type:

int

calc_mixer_freq(gen_ch, mixer_freq, nqz, ro_ch)

Set the NCO frequency that will be mixed with the generator output.

The RFdc driver does its own math to convert a frequency to a register value. (see XRFdc_SetMixerSettings in xrfdc_mixer.c, and “NCO Frequency Conversion” in PG269) This is what it does: 1. Add/subtract fs to get the frequency in the range of [-fs/2, fs/2]. 2. If the original frequency was not in [-fs/2, fs/2] and the DAC is configured for 2nd Nyquist zone, multiply by -1. 3. Convert to a 48-bit register value, rounding using C integer casting (i.e. round towards 0).

Step 2 is not desirable for us, so we must undo it.

The rounding gives unexpected results sometimes: it’s hard to tell if a freq will get rounded up or down. This is important if the demanded frequency was rounded to a valid frequency for frequency matching. The safest way to get consistent behavior is to always round to a valid NCO frequency. We are trusting that the floating-point math is exact and a number we rounded here is still a round number in the RFdc driver.

calc_muxgen_regs(gen_ch, freqs, gains, phases, ro_ch, absolute_freqs, mixer_freq)

Calculate the register values to program into a multiplexed generator. mixer_freq will have been rounded appropriately in declare_gen, and will be 0 if there’s no mixer

calc_ro_freq(rocfg, ro_pars, ro_regs, absolute_freqs, mixer_freq, flip_freq=False)

Calculate the readout frequency and registers.

calc_ro_regs(rocfg, phase, sel, ch=None)

Calculate the settings to configure a readout.

Returns:

settings for QickSoc.config_readout()

Return type:

dict

ch_fstep(dict1)

Finds the frequency step size of a single channel (generator or readout).

Parameters:

dict1 (dict) – config dict for one channel

Returns:

frequency step for this channel

Return type:

float

check_pfb_collisions(rocfg, cfg1, cfgs)

Check whether the specified PFB config collides or interefers with any others. If this PFB block can’t put two readouts on the same channel, this method will raise an error on collisions. Possible crosstalk will be identified in warnings.

Parameters:
  • rocfg (dict) – firmware config dictionary for the PFB or the readout chain

  • cfg1 (dict) – PFB config to check

  • cfgs (list of dict) – PFB configs to check cfg1 against

cleanup_round()

This runs after a program has finished running. This is called by acquire/acquire_decimated/run_rounds; user code should not call it.

By default this does nothing, but a subclass of QickSoc may override this.

clear_ddr4(length=None)

Clear the DDR4 buffer, filling it with 0’s. This is not necessary (the buffer will overwrite old data), but may be useful for debugging. Clearing the full buffer (4 GB) typically takes 4-5 seconds.

Parameters:

length (int) – Number of samples to clear (starting at the beginning of the buffer). If None, clear the entire buffer.

clear_tproc_counter(addr)

Initialize the tProc shot counter. For tProc v1, the data memory at the specified address is zeroed. For tProc v2, the tProc is reset, which zeroes all registers (the address is ignored).

Typical tProc v2 programs will also initialize the counter registers at the beginning of the program, but zeroing the counter now is important to distinguish “program waiting for external start” from “program complete.”

Parameters:

addr (int) – Counter address

clocks_locked()

Checks whether the DAC and ADC PLLs are locked. This can only be run after the bitstream has been downloaded. A failure usually means the FPGA is not getting a good reference clock from the on-board clock chips.

Returns:

clock status

Return type:

bool

config_avg(ch, address=0, length=1, edge_counting=False, high_threshold=1000, low_threshold=0)

Configure accumulated buffer; must then enable using enable_buf()

Parameters:
  • ch (int) – Readout channel to configure

  • address (int) – Starting address of buffer

  • length (int) – length of buffer (how many samples to integrate)

config_buf(ch, address=0, length=1)

Configure decimated buffer; must then enable using enable_buf()

Parameters:
  • ch (int) – Readout channel to configure

  • address (int) – Starting address of buffer

  • length (int) – length of buffer (how many samples to take)

config_clocks(force_init_clks, clk_output, external_clk)

Configure PLLs if requested, or if any ADC/DAC is not locked. The ADC/DAC PLL lock status is read through the RFDC IP, so this assumes that the bitstream has already been downloaded. The reference clock frequency must already have been read from the firmware config.

config_mux_gen(ch, tones)

Set up a list of tones all at once, using raw (integer) units. If the supplied list of tones is shorter than the number supported, the extra tones will have their gains set to 0.

Parameters:
  • ch (int) – generator channel (index in ‘gens’ list)

  • tones (list of dict) – Tones to configure. This is generated by QickConfig.calc_muxgen_regs().

config_mux_readout(pfbpath, cfgs, sel=None)

Set up a list of readout frequencies all at once, using raw (integer) units.

Parameters:
  • pfbpath (str) – Firmware path of the PFB readout being configured.

  • cfgs (list of dict) – Readout chains to configure. This is generated by QickConfig.calc_pfbro_regs().

  • sel (str) – Output selection (if supported), default to ‘product’

configure_readout(ch, ro_regs)

Configure readout channel output style and frequency. This method is only for use with PYNQ-configured readouts.

Parameters:
  • ch (int) – readout channel number (index in ‘readouts’ list)

  • ro_regs (dict) – readout registers, from QickConfig.calc_ro_regs()

cycles2us(cycles, gen_ch=None, ro_ch=None)

Converts clock cycles to microseconds. Uses tProc clock frequency by default. If gen_ch or ro_ch is specified, uses that generator/readout channel’s fabric clock.

Parameters:
  • cycles (int) – Number of clock cycles

  • gen_ch (int) – generator channel (index in ‘gens’ list)

  • ro_ch (int) – readout channel (index in ‘readouts’ list)

Returns:

Number of microseconds

Return type:

float

deg2int(deg, thisch)

Converts phase in degrees to integer value suitable for writing to a register. This method works for both generators and readouts.

Parameters:
  • deg (float) – phase (degrees)

  • thisch (dict) – config dict for the channel you’re configuring

Returns:

Re-formatted phase

Return type:

int

deg2reg(deg, gen_ch=0, ro_ch=None)

Converts degrees into phase register values; numbers greater than 360 will effectively be wrapped.

Parameters:
  • deg (float) – Number of degrees

  • gen_ch (int) – generator channel (index in ‘gens’ list)

  • ro_ch (int) – readout channel (index in ‘readouts’ list)

Returns:

Re-formatted number of degrees

Return type:

int

description()

Generate a printable description of the QICK configuration.

Returns:

description

Return type:

str

dump_cfg(gen_file_path=None)

Generate a JSON description of the QICK configuration. You can save this string to a file and load it to recreate the QickConfig.

Parameters:

gen_file_path (str or path-like, optional) – If provided, write the generated JSON configuration to this file path.

Returns:

configuration in JSON format

Return type:

str

Raises:

OSError – If gen_file_path is provided and the JSON configuration cannot be written to the specified file.

enable_buf(ch, enable_avg=True, enable_buf=True)

Enable capture of accumulated and/or decimated data for a buffer

Parameters:
  • ch (int) – Readout channel to configure

  • enable_avg (bool) – Enable accumulated data capture

  • enable_buf (bool) – Enable decimated data capture

freeze_adc_cals(blocknames)

Freeze the calibrations (stop the background calibration) of a list of RFSoC ADCs.

See the Xilinx documentation:

https://docs.amd.com/r/en-US/pg269-rf-data-converter/Background-Calibration-Process

Parameters:

blocknames (list of str) – List of RF-ADC IDs (2-digit strings). An ADC’s ID is the concatenation of the tile and block numbers displayed in the firmware configuration: in other words, for “ADC tile 2, blk 1” the blockname is “21”.

freq2int(f, thisch, otherch=None)

Converts frequency in MHz to integer value suitable for writing to a register. This method works for both generators and readouts. If a gen will be connected to an RO, the two channels must have exactly the same frequency, and you must supply the config for the other channel.

Parameters:
  • f (float) – frequency (MHz)

  • thisch (dict) – config dict for the channel you’re configuring

  • otherch (dict) – config dict for a channel you will set to the same frequency

Returns:

Re-formatted frequency

Return type:

int

freq2reg(f, gen_ch=0, ro_ch=None)

Converts frequency in MHz to tProc generator register value.

Parameters:
  • f (float) – frequency (MHz)

  • gen_ch (int) – generator channel

  • ro_ch (int) – readout channel (use None if you don’t want to frequency-match to a readout)

Returns:

Re-formatted frequency

Return type:

int

freq2reg_adc(f, ro_ch=0, gen_ch=None)

Converts frequency in MHz to readout register value.

Parameters:
  • f (float) – frequency (MHz)

  • ro_ch (int) – readout channel

  • gen_ch (int) – generator channel (use None if you don’t want to frequency-match to a generator)

Returns:

Re-formatted frequency

Return type:

int

get_accumulated(ch, address=0, length=None)

Acquires data from the readout accumulated buffer

Parameters:
  • ch (int) – ADC channel

  • address (int) – Address of data

  • length (int) – Buffer transfer length

Returns:

  • di[:length] (list) - list of accumulated I data

  • dq[:length] (list) - list of accumulated Q data

get_adc_attenuator(blockname)

Read the RFSoC ADC’s built-in step attenuator.

Only available for RFSoC Gen 3 (ZCU216, RFSoC4x2, RFSoC2x4). See https://docs.amd.com/r/en-US/pg269-rf-data-converter/Digital-Step-Attenuator-Gen-3/DFE.

Parameters:

blockname (str) – RF-ADC ID (2-digit string). This is the concatenation of the tile and block numbers displayed in the firmware configuration: in other words, for “ADC tile 2, blk 1” the blockname is “21”.

Returns:

Attenuation value (dB)

Return type:

float

get_cfg()

Return the QICK configuration dictionary. This contains everything you need to recreate the QickConfig.

Returns:

configuration dictionary

Return type:

dict

get_ddr4(nt, start=None)

Get data from the DDR4 buffer. The first samples (typically 401 or 801) of the buffer are always stale data from the previous acquisition.

Parameters:
  • nt (int) – Number of data transfers (each transfer is 128 or 256 decimated samples) to retrieve. If start=None, the amount of data will be reduced (see below).

  • start (int) – Number of samples to skip at the beginning of the buffer. If a value is specified, the end address of the transfer window will also be incremented. If None, the junk at the start of the buffer will be skipped but the end address will not be incremented. This reduces the amount of data, giving you exactly the block of valid data from a DDR4 trigger with the same value of nt.

get_decimated(ch, address=0, length=None)

Acquires data from the readout decimated buffer

Parameters:
  • ch (int) – ADC channel

  • address (int) – Address of data

  • length (int) – Buffer transfer length

Returns:

List of I and Q decimated arrays

Return type:

list of numpy.ndarray

get_maxv(gen_ch)

Convenience method for looking up a generator’s maximum allowed envelope value. The absolute value of the idata/qdata should not exceed this. Typically you will want to normalize your envelope’s maximum range to this value.

Parameters:

gen_ch (int) – generator channel (index in ‘gens’ list)

Returns:

max allowed value

Return type:

int

get_mr(start=None)

Get data from the multi-rate buffer. The first 8 samples are always stale data from the previous acquisition. The transfer window always extends to the end of the buffer.

Parameters:

start (int) – Number of samples to skip at the beginning of the buffer. If None, the junk at the start of the buffer is skipped.

get_sample_rates()

Produce dictionaries of the current sample rates of the DAC and ADC tiles. A dictionary of this form can be used to configure the sample rates at SoC initialization.

Returns:

A pair of dictionaries mapping DAC/ADC tiles to sample rates (in Msps).

Return type:

dict[str, dict[int, float]]

get_tproc_counter(addr)

Read the tProc shot counter. For tProc V1, this accesses the data memory at the given address. For tProc V2, this accesses one of the two special AXI-readable registers.

Parameters:

addr (int) – Counter address

Returns:

Counter value

Return type:

int

int2deg(r, thisch)

Converts register value to degrees. This method works for both generators and readouts.

Parameters:
  • r (int) – register value

  • thisch (dict) – config dict for the channel you’re configuring

Returns:

Re-formatted phase (degrees)

Return type:

float

int2freq(r, thisch)

Converts register value to MHz. This method works for both generators and readouts.

Parameters:
  • r (int) – register value

  • thisch (dict) – config dict for the channel you’re configuring

Returns:

Re-formatted frequency (MHz)

Return type:

float

load_bin_program(binprog, load_mem=True)

Write the program to the tProc program memory.

Parameters:
  • binprog (numpy.ndarray or dict) – compiled program (format depends on tProc version)

  • load_mem (bool) – write waveform and data memory now (can do this later with reload_mem())

load_envelope(ch, data, addr)

Load envelope data into a signal generator.

Parameters:
  • ch (int) – Generator channel to configure

  • data (numpy.ndarray of int16) – Array of (I, Q) values for pulse envelope

  • addr (int) – Starting address

load_mem(data, mem_sel='dmem', addr=0)

Write a block of the selected tProc memory. For tProc v1 only the data memory (“dmem”) is valid. For tProc v2 the program, data, and waveform memory are all accessible.

Parameters:
  • data (numpy.ndarray of int) – Data to be loaded 32-bit array of shape (n, 8) for pmem and wmem, (n) for dmem

  • mem_sel (str) – “pmem”, “dmem”, “wmem”

  • addr (int) – Starting write address

load_weights(ch, data, addr=0)

Load weights array to a weighted buffer.

Parameters:
  • ch (int) – Readout channel to configure

  • data (numpy.ndarray of int16) – array of 16-bit (I, Q) values for weights

  • address (int) – starting address

map_signal_paths(no_tproc)

Make lists of signal generator, readout, and buffer blocks in the firmware. Also map the switches connecting the generators and buffers to DMA. Fill the config dictionary with parameters of the DAC and ADC channels.

pl_reset(reinit=True)

Reset all firmware IP blocks. This pulses the pl_resetn0 line from the PS (also known as the “fabric reset” or the “PS-PL reset”). Every firmware block’s reset logic is triggered by this pulse. The main visible effect of this reset is to reset the start times of all the phase-coherent DDS oscillators.

Some firmware blocks have startup code in their __initialize__() to configure the block after the firmware is loaded. That configuration gets wiped out by a PL reset, so this method also re-configures those blocks.

More info on the PL reset: The reset sequence is defined in psu_ps_pl_reset_config_data() in psu_init.c. You can find this in the BSP or the firmware project files. The reset sequence and the memory addresses invovled appear to be the same for all RFSoCs.

https://support.xilinx.com/s/article/68962 https://support.xilinx.com/s/question/0D52E00006lLhBnSAK/zynq-ultrascale-howto-reset-the-pl https://docs.amd.com/r/en-US/ug1137-zynq-ultrascale-mpsoc-swdev/GPIO-Reset-to-PL https://docs.amd.com/r/en-US/pg201-zynq-ultrascale-plus-processing-system/Fabric-Reset-Enable

Parameters:

reinit (bool) – Reinitialize firmware blocks. False is OK if you haven’t run map_signal_paths() yet (which triggers block initialization).

poll_data(totaltime=0.1, timeout=None)

Get as much data as possible from the streamer data queue. Stop when any of the following conditions are met: * all the data has been transferred (based on the total_count) * we got data, and it has been totaltime seconds since poll_data was called * timeout is defined, and the timeout expired without getting new data in the queue If there are errors in the error queue, raise the first one.

Parameters:
  • totaltime (float) – How long to acquire data (negative value = ignore total time and total count, just read until timeout)

  • timeout (float) – How long to wait for the next data packet (None = wait forever)

Returns:

list of (data, stats) pairs, oldest first

Return type:

list

prepare_round()

This runs before a program starts running. This is called by acquire/acquire_decimated/run_rounds; user code should not call it.

By default this does nothing, but a subclass of QickSoc may override this.

read_mem(length, mem_sel='dmem', addr=0)

Read a block of the selected tProc memory. For tProc v1 only the data memory (“dmem”) is valid. For tProc v2 the program, data, and waveform memory are all accessible.

Parameters:
  • length (int) – Number of words to read

  • mem_sel (str) – “pmem”, “dmem”, “wmem”

  • addr (int) – Starting read address

Returns:

32-bit array of shape (n, 8) for pmem and wmem, (n) for dmem

Return type:

numpy.ndarray

reg2deg(r, gen_ch=0, ro_ch=None)

Converts phase register values into degrees.

Parameters:
  • reg (int) – Re-formatted number of degrees

  • gen_ch (int) – generator channel (index in ‘gens’ list)

  • ro_ch (int) – readout channel (index in ‘readouts’ list)

Returns:

Number of degrees

Return type:

float

reg2freq(r, gen_ch=0)

Converts frequency from format readable by generator to MHz.

Parameters:
  • r (int) – frequency in generator format

  • gen_ch (int) – generator channel

Returns:

Re-formatted frequency in MHz

Return type:

float

reg2freq_adc(r, ro_ch=0)

Converts frequency from format readable by readout to MHz.

Parameters:
  • r (int) – frequency in readout format

  • ro_ch (int) – readout channel

Returns:

Re-formatted frequency in MHz

Return type:

float

reload_mem()

Reload the waveform and data memory, overwriting any changes made by running the program.

reset_gens()

Reset the tProc and run a minimal tProc program that drives all signal generators with 0’s. Useful for stopping any periodic or stdysel=”last” outputs that may have been driven by a previous program.

rfb_get_bias(bias_ch)

Read the voltage setpoint on an RF-board bias output.

Parameters:

bias_ch (int) – Channel number (0-7)

Returns:

setpoint, in volts

Return type:

float

rfb_set_adc_dc(adc_port, gain)

Enable and configure an RF-board DC input channel. Will fail if this is not a DC input.

Parameters:
  • adc_port (int) – QICK box or RF board ADC port number (0-7 for ZCU216, 4-7 for ZCU111)

  • gain (float) – Gain (-6 through 26 dB in 1-dB increments)

Returns:

actual (rounded) value that was set

Return type:

float

rfb_set_adc_rf(adc_port, att)

Enable and configure an RF-board RF input channel. Will fail if this is not an RF input.

Parameters:
  • adc_port (int) – QICK box or RF board ADC port number (0-7 for ZCU216, 0-3 for ZCU111)

  • att (float) – Attenuation (0 through 31.75 dB in 0.25-dB increments)

Returns:

actual (rounded) value that was set

Return type:

float

rfb_set_bias(bias_ch, v)

Set a voltage on an RF-board bias output.

Parameters:
  • bias_ch (int) – Channel number (0-7)

  • v (float) – Voltage (-10 to 10 V)

Returns:

actual (rounded) value that was set

Return type:

float

rfb_set_dac_dc(dac_port)

Enable and configure a QICK box or RF board DAC port for DC output.

Parameters:

dac_port (int) – QICK box or RF board DAC port number (0-15 for ZCU216, 0-7 for ZCU111)

rfb_set_dac_rf(dac_port, att1, att2)

Enable and configure a QICK box or RF board DAC port for RF output.

Parameters:
  • dac_port (int) – QICK box or RF board DAC port number (0-15 for ZCU216, 0-7 for ZCU111)

  • att1 (float) – Attenuation for first stage (0 through 31.75 dB in 0.25-dB increments)

  • att2 (float) – Attenuation for second stage (0 through 31.75 dB in 0.25-dB increments)

Returns:

  • float – actual (rounded) att1 value that was set

  • float – actual (rounded) att2 value that was set

rfb_set_gen_dc(gen_ch)

Enable and configure an RF-board output channel for DC output.

Parameters:

gen_ch (int) – DAC channel (index in ‘gens’ list)

rfb_set_gen_rf(gen_ch, att1, att2)

Enable and configure an RF-board output channel for RF output.

Parameters:
  • gen_ch (int) – DAC channel (index in ‘gens’ list)

  • att1 (float) – Attenuation for first stage (0 through 31.75 dB in 0.25-dB increments)

  • att2 (float) – Attenuation for second stage (0 through 31.75 dB in 0.25-dB increments)

Returns:

  • float – actual (rounded) att1 value that was set

  • float – actual (rounded) att2 value that was set

rfb_set_ro_dc(ro_ch, gain)

Enable and configure an RF-board DC input channel. Will fail if this is not a DC input.

Parameters:
  • ro_ch (int) – ADC channel (index in ‘readouts’ list)

  • gain (float) – Gain (-6 through 26 dB in 1-dB increments)

Returns:

actual (rounded) value that was set

Return type:

float

rfb_set_ro_rf(ro_ch, att)

Enable and configure an RF-board RF input channel. Will fail if this is not an RF input.

Parameters:
  • ro_ch (int) – ADC channel (index in ‘avg_bufs’ list)

  • att (float) – Attenuation (0 through 31.75 dB in 0.25-dB increments)

Returns:

actual (rounded) value that was set

Return type:

float

round_sample_rate(tiletype, tile, fs_target)

Return the closest achievable sample rate to the requested value. This does not account for dependencies due to clock groups, or the restriction that you’re not allowed to raise the sample rate.

Parameters:
  • tiletype (str) – ‘dac’ or ‘adc’

  • tile (int) – Tile number (0-3)

  • fs_target (float) – Requested sample rate, in Msps

Returns:

Closest valid sample rate, in Msps

Return type:

float

roundfreq(f, dicts)

Round a frequency to the LCM of the frequency steps of one or more channels (typically two, a generator and a readout).

Parameters:
Returns:

rounded frequency (MHz)

Return type:

float or numpy.ndarray

set_adc_attenuator(blockname, attenuation)

Set the RFSoC ADC’s built-in step attenuator. The requested value will be rounded to the nearest valid value (0-27 dB inclusive, 1 dB steps).

Only available for RFSoC Gen 3 (ZCU216, RFSoC4x2, RFSoC2x4). See https://docs.amd.com/r/en-US/pg269-rf-data-converter/Digital-Step-Attenuator-Gen-3/DFE.

Parameters:
  • blockname (str) – RF-ADC ID (2-digit string). This is the concatenation of the tile and block numbers displayed in the firmware configuration: in other words, for “ADC tile 2, blk 1” the blockname is “21”.

  • attenuation (float) – Attenuation value (dB)

Returns:

The rounded attenuation value that was actually set (dB)

Return type:

float

set_all_clks(clk_output, external_clk)

Resets all the board clocks

set_iq(ch, f, i, q, ro_ch=None, phase_reset=True)

Set frequency, I, and Q for a constant-IQ output.

Parameters:
  • ch (int) – DAC channel (index in ‘gens’ list)

  • f (float) – frequency (in MHz)

  • i (float) – I value (in range -1 to 1)

  • q (float) – Q value (in range -1 to 1)

  • ro_ch (int) – readout channel (index in ‘readouts’ list) for frequency matching use None if you don’t want freq to be rounded to a valid readout frequency

  • phase_reset (bool) – if this changes the frequency, also reset the phase (so if we go to freq=0, we end up on the real axis)

set_mixer_freq(ch, f, ro_ch=None, phase_reset=True, fullscale=False)

Set mixer frequency for a signal generator. If the generator does not have a mixer, you will get an error.

Parameters:
set_nyquist(ch, nqz, force=False)

Sets DAC channel ch to operate in Nyquist zone nqz mode.

Parameters:
  • ch (int) – DAC channel (index in ‘gens’ list)

  • nqz (int) – Nyquist zone

start_readout(total_shots, counter_addr=1, ch_list=None, reads_per_shot=1, stride=None)

Start a streaming readout of the accumulated buffers.

Parameters:
  • total_shots (int) – Final value expected for the shot counter

  • counter_addr (int) – Data memory address for the shot counter

  • ch_list (list of int) – List of readout channels

  • reads_per_shot (list of int) – Number of data points to expect per counter increment

  • stride (int) – Default number of measurements to transfer at a time.

start_src(src)

Sets the start source of tProc

Parameters:

src (str) – start source “internal” or “external”

start_tproc()

Start the tProc.

If the tProc is configured for external start, this does nothing (the tProc will start on the first start signal it sees after external start is enabled).

stop_tproc(lazy=False)

Stop the tProc. This is somewhat slow (tens of ms) for tProc v1.

Parameters:

lazy (bool) – Only stop the tProc if it’s easy (i.e. do nothing for v1)

property streamer
property tproc
tt_arm(blk)

Start data capture on the specified time-tagger block.

Parameters:

blk (int) – The time tagger block to arm (index in time_taggers list).

tt_config(blk, threshold, wr_smp=32, filt=False, slope=False, invert=False, interp=0, deadtime=5)

Configure the specified time-tagger block.

Parameters:
  • blk (int) – The time tagger block to flush (index in time_taggers list).

  • threshold (int) – Tag threshold (-2^15 through 2^15-1).

  • wr_smp (int) – Number of 8-sample chunks to capture per tag in the SMP memory (1 through 32). If this time tagger has no SMP memory, this is ignored.

  • filt (bool) – Trigger on signal after a 2-sample smoothing filter.

  • slope (bool) – Trigger on slope (difference between consecutive samples), not level.

  • invert (bool) – Trigger on inverted signal.

  • interp (int) – Number of bits for interpolation (0 through 7).

  • deadtime (int) – Minimum time (in fabric ticks, 8 samples) between one tag and the next (5 through 255). This should be larger than the expected pulse width, otherwise you will get double-triggering on the same pulse.

tt_disarm(blk)

Stop data capture on the specified time-tagger block.

Parameters:

blk (int) – The time tagger block to arm (index in time_taggers list).

tt_readmem(blk, mem)

Read one of the specified time-tagger block’s memories. Reading a time-tagger memory clears it.

Parameters:
  • blk (int) – The time tagger block to read (index in time_taggers list).

  • mem (str) – “ARM”, “SMP”, “TAG0”/”TAG1”/”TAG2”/”TAG3”

tt_reset(blk)

Reset and flush the memories of the specified time-tagger block.

Parameters:

blk (int) – The time tagger block to reset (index in time_taggers list).

unfreeze_adc_cals(blocknames)

Unfreeze the calibrations (resume the background calibration) of a list of RFSoC ADCs.

See the Xilinx documentation:

https://docs.amd.com/r/en-US/pg269-rf-data-converter/Background-Calibration-Process

Parameters:

blocknames (list of str) – List of RF-ADC IDs (2-digit strings). An ADC’s ID is the concatenation of the tile and block numbers displayed in the firmware configuration: in other words, for “ADC tile 2, blk 1” the blockname is “21”.

us2cycles(us, gen_ch=None, ro_ch=None, as_float=False)

Converts microseconds to integer number of clock cycles. Uses tProc clock frequency by default. If gen_ch or ro_ch is specified, uses that generator/readout channel’s fabric clock.

Parameters:
  • us (float) – Number of microseconds

  • gen_ch (int) – generator channel (index in ‘gens’ list)

  • ro_ch (int) – readout channel (index in ‘readouts’ list)

  • as_float (bool) – leave as float, instead of rounding to int

Returns:

Number of clock cycles

Return type:

int

valid_sample_rates(tiletype, tile)

Return an array of valid sample rates. This does not account for dependencies due to clock groups, or the restriction that you’re not allowed to raise the sample rate.

Parameters:
  • tiletype (str) – ‘dac’ or ‘adc’

  • tile (int) – Tile number (0-3)

Returns:

Array of sample rates, in Msps

Return type:

numpy.ndarray

class qick.rfboard.RFQickSoc111V2(*args: Any, **kwargs: Any)[source]

Bases: RFQickSoc111V1

rfb_set_lo(f, ch=None, verbose=False)[source]

Set RF-board local oscillators.

LO[0]: all RF ADCs LO[1]: RF DACs 0-3 LO[2]: RF DACs 4-7

Parameters:
  • f (float) – Frequency (4000-8000 MHz)

  • ch (int) – LO to configure (None=all)

  • verbose (bool) – Print freq and lock info.

rfb_get_lo(gen_ch=None, ro_ch=None)[source]

Get local oscillator frequency for a DAC or ADC channel.

Parameters:
  • gen_ch (int) – DAC channel (index in ‘gens’ list)

  • ro_ch (int) – ADC channel (index in ‘readouts’ list)

HAS_LO = True
__init__(bitfile, clk_output=None, no_tproc=False, **kwargs)

A bitfile must always be provided, since the default bitstream will not work with the RF board.

The ZCU111 RF board takes its LO reference from the ZCU111 clock output. So if clk_output is None, the clocks will be re-initialized every time. This ensures that the LO output to the RF board is enabled.

adcfreq(f, gen_ch=0, ro_ch=0)

Takes a frequency and trims it to the closest DDS frequency valid for both channels.

Parameters:
  • f (float) – frequency (MHz)

  • gen_ch (int) – generator channel

  • ro_ch (int) – readout channel

Returns:

Re-formatted frequency

Return type:

float

arm_ddr4(ch, nt, force_overwrite=False)

Prepare the DDR4 buffer to take data. This must be called before starting a program that triggers the buffer. Once the buffer is armed, the first trigger it receives will cause the buffer to record the specified amount of data. Later triggers will have no effect.

Parameters:
  • ch (int) – The readout channel to record (index in ‘readouts’ list).

  • nt (int) – Number of data transfers to record; the number of IQ samples/transfer (128 or 256) is printed in the QickSoc config. Note that the amount of useful data is less (see get_ddr4)

  • force_overwrite (bool) – Allow a DDR4 acqusition that exceeds the DDR4 memory capacity. The memory will be used as a circular buffer: later transfers will wrap around to the beginning of the memory and overwrite older data.

arm_mr(ch)

Prepare the Multi-Rate buffer to take data. This must be called before starting a program that triggers the buffer. Once the buffer is armed, the first trigger it receives will cause the buffer to record until the buffer is filled. Later triggers will have no effect.

Parameters:

ch (int) – The readout channel to record (index in ‘readouts’ list).

calc_fstep(dicts)

Finds the least common multiple of the frequency steps of one or more channels (typically two, a generator and a readout) For proper frequency matching, you should only use frequencies that are evenly divisible by this value. The order of the parameters does not matter.

Parameters:

dicts (list of dict) – config dict for the channels

Returns:

frequency step common to all channels

Return type:

float

calc_fstep_int(dict1, other_dicts)

Finds the multiplier that needs to be applied to a channel’s frequency step size to allow this channel to be frequency-matched with another channel.

Parameters:
  • dict1 (dict) – config dict for this channel

  • other_dicts (list of dict) – config dict for the other channel(s)

Returns:

frequency step multiplier for the first channel

Return type:

int

calc_mixer_freq(gen_ch, mixer_freq, nqz, ro_ch)

Set the NCO frequency that will be mixed with the generator output.

The RFdc driver does its own math to convert a frequency to a register value. (see XRFdc_SetMixerSettings in xrfdc_mixer.c, and “NCO Frequency Conversion” in PG269) This is what it does: 1. Add/subtract fs to get the frequency in the range of [-fs/2, fs/2]. 2. If the original frequency was not in [-fs/2, fs/2] and the DAC is configured for 2nd Nyquist zone, multiply by -1. 3. Convert to a 48-bit register value, rounding using C integer casting (i.e. round towards 0).

Step 2 is not desirable for us, so we must undo it.

The rounding gives unexpected results sometimes: it’s hard to tell if a freq will get rounded up or down. This is important if the demanded frequency was rounded to a valid frequency for frequency matching. The safest way to get consistent behavior is to always round to a valid NCO frequency. We are trusting that the floating-point math is exact and a number we rounded here is still a round number in the RFdc driver.

calc_muxgen_regs(gen_ch, freqs, gains, phases, ro_ch, absolute_freqs, mixer_freq)

Calculate the register values to program into a multiplexed generator. mixer_freq will have been rounded appropriately in declare_gen, and will be 0 if there’s no mixer

calc_ro_freq(rocfg, ro_pars, ro_regs, absolute_freqs, mixer_freq, flip_freq=False)

Calculate the readout frequency and registers.

calc_ro_regs(rocfg, phase, sel, ch=None)

Calculate the settings to configure a readout.

Returns:

settings for QickSoc.config_readout()

Return type:

dict

ch_fstep(dict1)

Finds the frequency step size of a single channel (generator or readout).

Parameters:

dict1 (dict) – config dict for one channel

Returns:

frequency step for this channel

Return type:

float

check_pfb_collisions(rocfg, cfg1, cfgs)

Check whether the specified PFB config collides or interefers with any others. If this PFB block can’t put two readouts on the same channel, this method will raise an error on collisions. Possible crosstalk will be identified in warnings.

Parameters:
  • rocfg (dict) – firmware config dictionary for the PFB or the readout chain

  • cfg1 (dict) – PFB config to check

  • cfgs (list of dict) – PFB configs to check cfg1 against

cleanup_round()

This runs after a program has finished running. This is called by acquire/acquire_decimated/run_rounds; user code should not call it.

By default this does nothing, but a subclass of QickSoc may override this.

clear_ddr4(length=None)

Clear the DDR4 buffer, filling it with 0’s. This is not necessary (the buffer will overwrite old data), but may be useful for debugging. Clearing the full buffer (4 GB) typically takes 4-5 seconds.

Parameters:

length (int) – Number of samples to clear (starting at the beginning of the buffer). If None, clear the entire buffer.

clear_tproc_counter(addr)

Initialize the tProc shot counter. For tProc v1, the data memory at the specified address is zeroed. For tProc v2, the tProc is reset, which zeroes all registers (the address is ignored).

Typical tProc v2 programs will also initialize the counter registers at the beginning of the program, but zeroing the counter now is important to distinguish “program waiting for external start” from “program complete.”

Parameters:

addr (int) – Counter address

clocks_locked()

Checks whether the DAC and ADC PLLs are locked. This can only be run after the bitstream has been downloaded. A failure usually means the FPGA is not getting a good reference clock from the on-board clock chips.

Returns:

clock status

Return type:

bool

config_avg(ch, address=0, length=1, edge_counting=False, high_threshold=1000, low_threshold=0)

Configure accumulated buffer; must then enable using enable_buf()

Parameters:
  • ch (int) – Readout channel to configure

  • address (int) – Starting address of buffer

  • length (int) – length of buffer (how many samples to integrate)

config_buf(ch, address=0, length=1)

Configure decimated buffer; must then enable using enable_buf()

Parameters:
  • ch (int) – Readout channel to configure

  • address (int) – Starting address of buffer

  • length (int) – length of buffer (how many samples to take)

config_clocks(force_init_clks, clk_output, external_clk)

Configure PLLs if requested, or if any ADC/DAC is not locked. The ADC/DAC PLL lock status is read through the RFDC IP, so this assumes that the bitstream has already been downloaded. The reference clock frequency must already have been read from the firmware config.

config_mux_gen(ch, tones)

Set up a list of tones all at once, using raw (integer) units. If the supplied list of tones is shorter than the number supported, the extra tones will have their gains set to 0.

Parameters:
  • ch (int) – generator channel (index in ‘gens’ list)

  • tones (list of dict) – Tones to configure. This is generated by QickConfig.calc_muxgen_regs().

config_mux_readout(pfbpath, cfgs, sel=None)

Set up a list of readout frequencies all at once, using raw (integer) units.

Parameters:
  • pfbpath (str) – Firmware path of the PFB readout being configured.

  • cfgs (list of dict) – Readout chains to configure. This is generated by QickConfig.calc_pfbro_regs().

  • sel (str) – Output selection (if supported), default to ‘product’

configure_readout(ch, ro_regs)

Configure readout channel output style and frequency. This method is only for use with PYNQ-configured readouts.

Parameters:
  • ch (int) – readout channel number (index in ‘readouts’ list)

  • ro_regs (dict) – readout registers, from QickConfig.calc_ro_regs()

cycles2us(cycles, gen_ch=None, ro_ch=None)

Converts clock cycles to microseconds. Uses tProc clock frequency by default. If gen_ch or ro_ch is specified, uses that generator/readout channel’s fabric clock.

Parameters:
  • cycles (int) – Number of clock cycles

  • gen_ch (int) – generator channel (index in ‘gens’ list)

  • ro_ch (int) – readout channel (index in ‘readouts’ list)

Returns:

Number of microseconds

Return type:

float

deg2int(deg, thisch)

Converts phase in degrees to integer value suitable for writing to a register. This method works for both generators and readouts.

Parameters:
  • deg (float) – phase (degrees)

  • thisch (dict) – config dict for the channel you’re configuring

Returns:

Re-formatted phase

Return type:

int

deg2reg(deg, gen_ch=0, ro_ch=None)

Converts degrees into phase register values; numbers greater than 360 will effectively be wrapped.

Parameters:
  • deg (float) – Number of degrees

  • gen_ch (int) – generator channel (index in ‘gens’ list)

  • ro_ch (int) – readout channel (index in ‘readouts’ list)

Returns:

Re-formatted number of degrees

Return type:

int

description()

Generate a printable description of the QICK configuration.

Returns:

description

Return type:

str

dump_cfg(gen_file_path=None)

Generate a JSON description of the QICK configuration. You can save this string to a file and load it to recreate the QickConfig.

Parameters:

gen_file_path (str or path-like, optional) – If provided, write the generated JSON configuration to this file path.

Returns:

configuration in JSON format

Return type:

str

Raises:

OSError – If gen_file_path is provided and the JSON configuration cannot be written to the specified file.

enable_buf(ch, enable_avg=True, enable_buf=True)

Enable capture of accumulated and/or decimated data for a buffer

Parameters:
  • ch (int) – Readout channel to configure

  • enable_avg (bool) – Enable accumulated data capture

  • enable_buf (bool) – Enable decimated data capture

freeze_adc_cals(blocknames)

Freeze the calibrations (stop the background calibration) of a list of RFSoC ADCs.

See the Xilinx documentation:

https://docs.amd.com/r/en-US/pg269-rf-data-converter/Background-Calibration-Process

Parameters:

blocknames (list of str) – List of RF-ADC IDs (2-digit strings). An ADC’s ID is the concatenation of the tile and block numbers displayed in the firmware configuration: in other words, for “ADC tile 2, blk 1” the blockname is “21”.

freq2int(f, thisch, otherch=None)

Converts frequency in MHz to integer value suitable for writing to a register. This method works for both generators and readouts. If a gen will be connected to an RO, the two channels must have exactly the same frequency, and you must supply the config for the other channel.

Parameters:
  • f (float) – frequency (MHz)

  • thisch (dict) – config dict for the channel you’re configuring

  • otherch (dict) – config dict for a channel you will set to the same frequency

Returns:

Re-formatted frequency

Return type:

int

freq2reg(f, gen_ch=0, ro_ch=None)

Converts frequency in MHz to tProc generator register value.

Parameters:
  • f (float) – frequency (MHz)

  • gen_ch (int) – generator channel

  • ro_ch (int) – readout channel (use None if you don’t want to frequency-match to a readout)

Returns:

Re-formatted frequency

Return type:

int

freq2reg_adc(f, ro_ch=0, gen_ch=None)

Converts frequency in MHz to readout register value.

Parameters:
  • f (float) – frequency (MHz)

  • ro_ch (int) – readout channel

  • gen_ch (int) – generator channel (use None if you don’t want to frequency-match to a generator)

Returns:

Re-formatted frequency

Return type:

int

get_accumulated(ch, address=0, length=None)

Acquires data from the readout accumulated buffer

Parameters:
  • ch (int) – ADC channel

  • address (int) – Address of data

  • length (int) – Buffer transfer length

Returns:

  • di[:length] (list) - list of accumulated I data

  • dq[:length] (list) - list of accumulated Q data

get_adc_attenuator(blockname)

Read the RFSoC ADC’s built-in step attenuator.

Only available for RFSoC Gen 3 (ZCU216, RFSoC4x2, RFSoC2x4). See https://docs.amd.com/r/en-US/pg269-rf-data-converter/Digital-Step-Attenuator-Gen-3/DFE.

Parameters:

blockname (str) – RF-ADC ID (2-digit string). This is the concatenation of the tile and block numbers displayed in the firmware configuration: in other words, for “ADC tile 2, blk 1” the blockname is “21”.

Returns:

Attenuation value (dB)

Return type:

float

get_cfg()

Return the QICK configuration dictionary. This contains everything you need to recreate the QickConfig.

Returns:

configuration dictionary

Return type:

dict

get_ddr4(nt, start=None)

Get data from the DDR4 buffer. The first samples (typically 401 or 801) of the buffer are always stale data from the previous acquisition.

Parameters:
  • nt (int) – Number of data transfers (each transfer is 128 or 256 decimated samples) to retrieve. If start=None, the amount of data will be reduced (see below).

  • start (int) – Number of samples to skip at the beginning of the buffer. If a value is specified, the end address of the transfer window will also be incremented. If None, the junk at the start of the buffer will be skipped but the end address will not be incremented. This reduces the amount of data, giving you exactly the block of valid data from a DDR4 trigger with the same value of nt.

get_decimated(ch, address=0, length=None)

Acquires data from the readout decimated buffer

Parameters:
  • ch (int) – ADC channel

  • address (int) – Address of data

  • length (int) – Buffer transfer length

Returns:

List of I and Q decimated arrays

Return type:

list of numpy.ndarray

get_maxv(gen_ch)

Convenience method for looking up a generator’s maximum allowed envelope value. The absolute value of the idata/qdata should not exceed this. Typically you will want to normalize your envelope’s maximum range to this value.

Parameters:

gen_ch (int) – generator channel (index in ‘gens’ list)

Returns:

max allowed value

Return type:

int

get_mr(start=None)

Get data from the multi-rate buffer. The first 8 samples are always stale data from the previous acquisition. The transfer window always extends to the end of the buffer.

Parameters:

start (int) – Number of samples to skip at the beginning of the buffer. If None, the junk at the start of the buffer is skipped.

get_sample_rates()

Produce dictionaries of the current sample rates of the DAC and ADC tiles. A dictionary of this form can be used to configure the sample rates at SoC initialization.

Returns:

A pair of dictionaries mapping DAC/ADC tiles to sample rates (in Msps).

Return type:

dict[str, dict[int, float]]

get_tproc_counter(addr)

Read the tProc shot counter. For tProc V1, this accesses the data memory at the given address. For tProc V2, this accesses one of the two special AXI-readable registers.

Parameters:

addr (int) – Counter address

Returns:

Counter value

Return type:

int

int2deg(r, thisch)

Converts register value to degrees. This method works for both generators and readouts.

Parameters:
  • r (int) – register value

  • thisch (dict) – config dict for the channel you’re configuring

Returns:

Re-formatted phase (degrees)

Return type:

float

int2freq(r, thisch)

Converts register value to MHz. This method works for both generators and readouts.

Parameters:
  • r (int) – register value

  • thisch (dict) – config dict for the channel you’re configuring

Returns:

Re-formatted frequency (MHz)

Return type:

float

load_bin_program(binprog, load_mem=True)

Write the program to the tProc program memory.

Parameters:
  • binprog (numpy.ndarray or dict) – compiled program (format depends on tProc version)

  • load_mem (bool) – write waveform and data memory now (can do this later with reload_mem())

load_envelope(ch, data, addr)

Load envelope data into a signal generator.

Parameters:
  • ch (int) – Generator channel to configure

  • data (numpy.ndarray of int16) – Array of (I, Q) values for pulse envelope

  • addr (int) – Starting address

load_mem(data, mem_sel='dmem', addr=0)

Write a block of the selected tProc memory. For tProc v1 only the data memory (“dmem”) is valid. For tProc v2 the program, data, and waveform memory are all accessible.

Parameters:
  • data (numpy.ndarray of int) – Data to be loaded 32-bit array of shape (n, 8) for pmem and wmem, (n) for dmem

  • mem_sel (str) – “pmem”, “dmem”, “wmem”

  • addr (int) – Starting write address

load_weights(ch, data, addr=0)

Load weights array to a weighted buffer.

Parameters:
  • ch (int) – Readout channel to configure

  • data (numpy.ndarray of int16) – array of 16-bit (I, Q) values for weights

  • address (int) – starting address

map_signal_paths(no_tproc)

Make lists of signal generator, readout, and buffer blocks in the firmware. Also map the switches connecting the generators and buffers to DMA. Fill the config dictionary with parameters of the DAC and ADC channels.

pl_reset(reinit=True)

Reset all firmware IP blocks. This pulses the pl_resetn0 line from the PS (also known as the “fabric reset” or the “PS-PL reset”). Every firmware block’s reset logic is triggered by this pulse. The main visible effect of this reset is to reset the start times of all the phase-coherent DDS oscillators.

Some firmware blocks have startup code in their __initialize__() to configure the block after the firmware is loaded. That configuration gets wiped out by a PL reset, so this method also re-configures those blocks.

More info on the PL reset: The reset sequence is defined in psu_ps_pl_reset_config_data() in psu_init.c. You can find this in the BSP or the firmware project files. The reset sequence and the memory addresses invovled appear to be the same for all RFSoCs.

https://support.xilinx.com/s/article/68962 https://support.xilinx.com/s/question/0D52E00006lLhBnSAK/zynq-ultrascale-howto-reset-the-pl https://docs.amd.com/r/en-US/ug1137-zynq-ultrascale-mpsoc-swdev/GPIO-Reset-to-PL https://docs.amd.com/r/en-US/pg201-zynq-ultrascale-plus-processing-system/Fabric-Reset-Enable

Parameters:

reinit (bool) – Reinitialize firmware blocks. False is OK if you haven’t run map_signal_paths() yet (which triggers block initialization).

poll_data(totaltime=0.1, timeout=None)

Get as much data as possible from the streamer data queue. Stop when any of the following conditions are met: * all the data has been transferred (based on the total_count) * we got data, and it has been totaltime seconds since poll_data was called * timeout is defined, and the timeout expired without getting new data in the queue If there are errors in the error queue, raise the first one.

Parameters:
  • totaltime (float) – How long to acquire data (negative value = ignore total time and total count, just read until timeout)

  • timeout (float) – How long to wait for the next data packet (None = wait forever)

Returns:

list of (data, stats) pairs, oldest first

Return type:

list

prepare_round()

This runs before a program starts running. This is called by acquire/acquire_decimated/run_rounds; user code should not call it.

By default this does nothing, but a subclass of QickSoc may override this.

read_mem(length, mem_sel='dmem', addr=0)

Read a block of the selected tProc memory. For tProc v1 only the data memory (“dmem”) is valid. For tProc v2 the program, data, and waveform memory are all accessible.

Parameters:
  • length (int) – Number of words to read

  • mem_sel (str) – “pmem”, “dmem”, “wmem”

  • addr (int) – Starting read address

Returns:

32-bit array of shape (n, 8) for pmem and wmem, (n) for dmem

Return type:

numpy.ndarray

reg2deg(r, gen_ch=0, ro_ch=None)

Converts phase register values into degrees.

Parameters:
  • reg (int) – Re-formatted number of degrees

  • gen_ch (int) – generator channel (index in ‘gens’ list)

  • ro_ch (int) – readout channel (index in ‘readouts’ list)

Returns:

Number of degrees

Return type:

float

reg2freq(r, gen_ch=0)

Converts frequency from format readable by generator to MHz.

Parameters:
  • r (int) – frequency in generator format

  • gen_ch (int) – generator channel

Returns:

Re-formatted frequency in MHz

Return type:

float

reg2freq_adc(r, ro_ch=0)

Converts frequency from format readable by readout to MHz.

Parameters:
  • r (int) – frequency in readout format

  • ro_ch (int) – readout channel

Returns:

Re-formatted frequency in MHz

Return type:

float

reload_mem()

Reload the waveform and data memory, overwriting any changes made by running the program.

reset_gens()

Reset the tProc and run a minimal tProc program that drives all signal generators with 0’s. Useful for stopping any periodic or stdysel=”last” outputs that may have been driven by a previous program.

rfb_config(no_tproc)

Configure the SPI interfaces to the RF board.

rfb_get_bias(bias_ch)

Read the voltage setpoint on an RF-board bias output.

Parameters:

bias_ch (int) – Channel number (0-7)

Returns:

setpoint, in volts

Return type:

float

rfb_set_adc_dc(adc_port, gain)

Enable and configure an RF-board DC input channel. Will fail if this is not a DC input.

Parameters:
  • adc_port (int) – QICK box or RF board ADC port number (0-7 for ZCU216, 4-7 for ZCU111)

  • gain (float) – Gain (-6 through 26 dB in 1-dB increments)

Returns:

actual (rounded) value that was set

Return type:

float

rfb_set_adc_rf(adc_port, att)

Enable and configure an RF-board RF input channel. Will fail if this is not an RF input.

Parameters:
  • adc_port (int) – QICK box or RF board ADC port number (0-7 for ZCU216, 0-3 for ZCU111)

  • att (float) – Attenuation (0 through 31.75 dB in 0.25-dB increments)

Returns:

actual (rounded) value that was set

Return type:

float

rfb_set_bias(bias_ch, v)

Set a voltage on an RF-board bias output.

Parameters:
  • bias_ch (int) – Channel number (0-7)

  • v (float) – Voltage (-10 to 10 V)

Returns:

actual (rounded) value that was set

Return type:

float

rfb_set_dac_dc(dac_port)

Enable and configure a QICK box or RF board DAC port for DC output.

Parameters:

dac_port (int) – QICK box or RF board DAC port number (0-15 for ZCU216, 0-7 for ZCU111)

rfb_set_dac_rf(dac_port, att1, att2)

Enable and configure a QICK box or RF board DAC port for RF output.

Parameters:
  • dac_port (int) – QICK box or RF board DAC port number (0-15 for ZCU216, 0-7 for ZCU111)

  • att1 (float) – Attenuation for first stage (0 through 31.75 dB in 0.25-dB increments)

  • att2 (float) – Attenuation for second stage (0 through 31.75 dB in 0.25-dB increments)

Returns:

  • float – actual (rounded) att1 value that was set

  • float – actual (rounded) att2 value that was set

rfb_set_gen_dc(gen_ch)

Enable and configure an RF-board output channel for DC output.

Parameters:

gen_ch (int) – DAC channel (index in ‘gens’ list)

rfb_set_gen_rf(gen_ch, att1, att2)

Enable and configure an RF-board output channel for RF output.

Parameters:
  • gen_ch (int) – DAC channel (index in ‘gens’ list)

  • att1 (float) – Attenuation for first stage (0 through 31.75 dB in 0.25-dB increments)

  • att2 (float) – Attenuation for second stage (0 through 31.75 dB in 0.25-dB increments)

Returns:

  • float – actual (rounded) att1 value that was set

  • float – actual (rounded) att2 value that was set

rfb_set_ro_dc(ro_ch, gain)

Enable and configure an RF-board DC input channel. Will fail if this is not a DC input.

Parameters:
  • ro_ch (int) – ADC channel (index in ‘readouts’ list)

  • gain (float) – Gain (-6 through 26 dB in 1-dB increments)

Returns:

actual (rounded) value that was set

Return type:

float

rfb_set_ro_rf(ro_ch, att)

Enable and configure an RF-board RF input channel. Will fail if this is not an RF input.

Parameters:
  • ro_ch (int) – ADC channel (index in ‘avg_bufs’ list)

  • att (float) – Attenuation (0 through 31.75 dB in 0.25-dB increments)

Returns:

actual (rounded) value that was set

Return type:

float

round_sample_rate(tiletype, tile, fs_target)

Return the closest achievable sample rate to the requested value. This does not account for dependencies due to clock groups, or the restriction that you’re not allowed to raise the sample rate.

Parameters:
  • tiletype (str) – ‘dac’ or ‘adc’

  • tile (int) – Tile number (0-3)

  • fs_target (float) – Requested sample rate, in Msps

Returns:

Closest valid sample rate, in Msps

Return type:

float

roundfreq(f, dicts)

Round a frequency to the LCM of the frequency steps of one or more channels (typically two, a generator and a readout).

Parameters:
Returns:

rounded frequency (MHz)

Return type:

float or numpy.ndarray

set_adc_attenuator(blockname, attenuation)

Set the RFSoC ADC’s built-in step attenuator. The requested value will be rounded to the nearest valid value (0-27 dB inclusive, 1 dB steps).

Only available for RFSoC Gen 3 (ZCU216, RFSoC4x2, RFSoC2x4). See https://docs.amd.com/r/en-US/pg269-rf-data-converter/Digital-Step-Attenuator-Gen-3/DFE.

Parameters:
  • blockname (str) – RF-ADC ID (2-digit string). This is the concatenation of the tile and block numbers displayed in the firmware configuration: in other words, for “ADC tile 2, blk 1” the blockname is “21”.

  • attenuation (float) – Attenuation value (dB)

Returns:

The rounded attenuation value that was actually set (dB)

Return type:

float

set_all_clks(clk_output, external_clk)

Resets all the board clocks

set_iq(ch, f, i, q, ro_ch=None, phase_reset=True)

Set frequency, I, and Q for a constant-IQ output.

Parameters:
  • ch (int) – DAC channel (index in ‘gens’ list)

  • f (float) – frequency (in MHz)

  • i (float) – I value (in range -1 to 1)

  • q (float) – Q value (in range -1 to 1)

  • ro_ch (int) – readout channel (index in ‘readouts’ list) for frequency matching use None if you don’t want freq to be rounded to a valid readout frequency

  • phase_reset (bool) – if this changes the frequency, also reset the phase (so if we go to freq=0, we end up on the real axis)

set_mixer_freq(ch, f, ro_ch=None, phase_reset=True, fullscale=False)

Set mixer frequency for a signal generator. If the generator does not have a mixer, you will get an error.

Parameters:
set_nyquist(ch, nqz, force=False)

Sets DAC channel ch to operate in Nyquist zone nqz mode.

Parameters:
  • ch (int) – DAC channel (index in ‘gens’ list)

  • nqz (int) – Nyquist zone

start_readout(total_shots, counter_addr=1, ch_list=None, reads_per_shot=1, stride=None)

Start a streaming readout of the accumulated buffers.

Parameters:
  • total_shots (int) – Final value expected for the shot counter

  • counter_addr (int) – Data memory address for the shot counter

  • ch_list (list of int) – List of readout channels

  • reads_per_shot (list of int) – Number of data points to expect per counter increment

  • stride (int) – Default number of measurements to transfer at a time.

start_src(src)

Sets the start source of tProc

Parameters:

src (str) – start source “internal” or “external”

start_tproc()

Start the tProc.

If the tProc is configured for external start, this does nothing (the tProc will start on the first start signal it sees after external start is enabled).

stop_tproc(lazy=False)

Stop the tProc. This is somewhat slow (tens of ms) for tProc v1.

Parameters:

lazy (bool) – Only stop the tProc if it’s easy (i.e. do nothing for v1)

property streamer
property tproc
tt_arm(blk)

Start data capture on the specified time-tagger block.

Parameters:

blk (int) – The time tagger block to arm (index in time_taggers list).

tt_config(blk, threshold, wr_smp=32, filt=False, slope=False, invert=False, interp=0, deadtime=5)

Configure the specified time-tagger block.

Parameters:
  • blk (int) – The time tagger block to flush (index in time_taggers list).

  • threshold (int) – Tag threshold (-2^15 through 2^15-1).

  • wr_smp (int) – Number of 8-sample chunks to capture per tag in the SMP memory (1 through 32). If this time tagger has no SMP memory, this is ignored.

  • filt (bool) – Trigger on signal after a 2-sample smoothing filter.

  • slope (bool) – Trigger on slope (difference between consecutive samples), not level.

  • invert (bool) – Trigger on inverted signal.

  • interp (int) – Number of bits for interpolation (0 through 7).

  • deadtime (int) – Minimum time (in fabric ticks, 8 samples) between one tag and the next (5 through 255). This should be larger than the expected pulse width, otherwise you will get double-triggering on the same pulse.

tt_disarm(blk)

Stop data capture on the specified time-tagger block.

Parameters:

blk (int) – The time tagger block to arm (index in time_taggers list).

tt_readmem(blk, mem)

Read one of the specified time-tagger block’s memories. Reading a time-tagger memory clears it.

Parameters:
  • blk (int) – The time tagger block to read (index in time_taggers list).

  • mem (str) – “ARM”, “SMP”, “TAG0”/”TAG1”/”TAG2”/”TAG3”

tt_reset(blk)

Reset and flush the memories of the specified time-tagger block.

Parameters:

blk (int) – The time tagger block to reset (index in time_taggers list).

unfreeze_adc_cals(blocknames)

Unfreeze the calibrations (resume the background calibration) of a list of RFSoC ADCs.

See the Xilinx documentation:

https://docs.amd.com/r/en-US/pg269-rf-data-converter/Background-Calibration-Process

Parameters:

blocknames (list of str) – List of RF-ADC IDs (2-digit strings). An ADC’s ID is the concatenation of the tile and block numbers displayed in the firmware configuration: in other words, for “ADC tile 2, blk 1” the blockname is “21”.

us2cycles(us, gen_ch=None, ro_ch=None, as_float=False)

Converts microseconds to integer number of clock cycles. Uses tProc clock frequency by default. If gen_ch or ro_ch is specified, uses that generator/readout channel’s fabric clock.

Parameters:
  • us (float) – Number of microseconds

  • gen_ch (int) – generator channel (index in ‘gens’ list)

  • ro_ch (int) – readout channel (index in ‘readouts’ list)

  • as_float (bool) – leave as float, instead of rounding to int

Returns:

Number of clock cycles

Return type:

int

valid_sample_rates(tiletype, tile)

Return an array of valid sample rates. This does not account for dependencies due to clock groups, or the restriction that you’re not allowed to raise the sample rate.

Parameters:
  • tiletype (str) – ‘dac’ or ‘adc’

  • tile (int) – Tile number (0-3)

Returns:

Array of sample rates, in Msps

Return type:

numpy.ndarray

qick.rfboard.RFQickSocV2

alias of RFQickSoc111V2

class qick.rfboard.RFQickSoc216V1(*args: Any, **kwargs: Any)[source]

Bases: RFQickSoc

HAS_LO = False
__init__(bitfile, **kwargs)[source]

A bitfile must always be provided, since the default bitstream will not work with the RF board.

The ZCU111 RF board takes its LO reference from the ZCU111 clock output. So if clk_output is None, the clocks will be re-initialized every time. This ensures that the LO output to the RF board is enabled.

rfb_config(no_tproc)[source]

Configure the GPIO/SPI interfaces to the RF board.

rfb_enable_bias()[source]

Enable all eight main-board bias outputs (by turning on DAC_BIAS_SWEN).

This is normally run during board initialization, so you should not need to run it yourself.

rfb_disable_bias()[source]

Disable all eight main-board bias outputs (by turning off DAC_BIAS_SWEN).

rfb_set_gen_filter(gen_ch, fc, bw=1, ftype='bandpass')[source]

Set the programmable analog filter of the QICK box DAC port connected to a specified generator.

Parameters:
  • gen_ch (int) – generator channel (index in ‘gens’ list)

  • fc (float) – Center frequency for bandpass, cut-off frequency of lowpass and highpass.

  • bw (float) – Bandwidth.

  • ftype (str) – Filter type: bypass, lowpass, highpass or bandpass.

rfb_set_ro_filter(ro_ch, fc, bw=1, ftype='bandpass')[source]

Set the programmable analog filter of the QICK box ADC port connected to a specified readout channel.

Parameters:
  • ro_ch (int) – readout channel (index in ‘avg_bufs’ list)

  • fc (float) – Center frequency for bandpass, cut-off frequency of lowpass and highpass.

  • bw (float) – Bandwidth.

  • ftype (str) – Filter type: bypass, lowpass, highpass or bandpass.

rfb_set_dac_filter(dac_port, fc, bw=1, ftype='bandpass')[source]

Set the programmable analog filter of the specified QICK box DAC port.

Parameters:
  • dac_port (int) – QICK box DAC port number (0-15)

  • fc (float) – Center frequency for bandpass, cut-off frequency of lowpass and highpass.

  • bw (float) – Bandwidth.

  • ftype (str) – Filter type: bypass, lowpass, highpass or bandpass.

rfb_set_adc_filter(adc_port, fc, bw=1, ftype='bandpass')[source]

Set the programmable analog filter of the specified QICK box ADC port.

Parameters:
  • adc_port (int) – QICK box ADC port number (0-7)

  • fc (float) – Center frequency for bandpass, cut-off frequency of lowpass and highpass.

  • bw (float) – Bandwidth.

  • ftype (str) – Filter type: bypass, lowpass, highpass or bandpass.

rfb_set_dac_filter_raw(dac_port, hpf=-1, lpf=-1)[source]

Set the programmable analog filter of the specified QICK box DAC port. Filter cutoffs are specified in terms of filter steps.

Parameters:
  • dac_port (int) – QICK box DAC port number (0-15)

  • hpf (int) – High-pass filter setting. -1 to bypass, 0 through 63 to enable, with 3 dB cutoff from 1.75 to 19.90 GHz.

  • lpf (int) – Low-pass filter setting. -1 to bypass, 0 through 63 to enable, with 3 dB cutoff from 2.05 to 18.85 GHz.

rfb_set_adc_filter_raw(adc_port, hpf=-1, lpf=-1)[source]

Set the programmable analog filter of the specified QICK box ADC port. Filter cutoffs are specified in terms of filter steps.

Parameters:
  • adc_port (int) – QICK box ADC port number (0-7)

  • hpf (int) – High-pass filter setting. -1 to bypass, 0 through 63 to enable, with 3 dB cutoff from 1.75 to 19.90 GHz.

  • lpf (int) – Low-pass filter setting. -1 to bypass, 0 through 63 to enable, with 3 dB cutoff from 2.05 to 18.85 GHz.

rfb_set_rfadc_attenuator(adc_port, att)[source]

Set the programmable attenuator of the RFSoC RF-ADC connected to the specified QICK box ADC port.

Parameters:
  • adc_port (int) – QICK box ADC port number (0-7)

  • att (float) – Attenuation value (0 through 27 dB in 1-dB increments)

clear_interrupts(max_attempts=5, error_on_interrupt=False, error_on_persist=True)[source]

Check all ADCs for interrupts, and attempt to clear them.

https://docs.amd.com/r/en-US/pg269-rf-data-converter/XRFdc_IntrEnable https://docs.amd.com/r/en-US/pg269-rf-data-converter/Interrupt-Handling https://github.com/Xilinx/embeddedsw/blob/master/XilinxProcessorIPLib/drivers/rfdc/src/xrfdc_hw.h

Parameters:
  • max_attempts (int) – number of times to attempt to clear interrupts before giving up

  • error_on_interrupt (bool) – if True, raise an error if any ADC has an interrupt raised

  • error_on_persist (bool) – if True, raise an error if any ADC has an interrupt that persists after max_attempts clears

Returns:

True if all interrupts were successfully cleared

Return type:

bool

adcfreq(f, gen_ch=0, ro_ch=0)

Takes a frequency and trims it to the closest DDS frequency valid for both channels.

Parameters:
  • f (float) – frequency (MHz)

  • gen_ch (int) – generator channel

  • ro_ch (int) – readout channel

Returns:

Re-formatted frequency

Return type:

float

arm_ddr4(ch, nt, force_overwrite=False)

Prepare the DDR4 buffer to take data. This must be called before starting a program that triggers the buffer. Once the buffer is armed, the first trigger it receives will cause the buffer to record the specified amount of data. Later triggers will have no effect.

Parameters:
  • ch (int) – The readout channel to record (index in ‘readouts’ list).

  • nt (int) – Number of data transfers to record; the number of IQ samples/transfer (128 or 256) is printed in the QickSoc config. Note that the amount of useful data is less (see get_ddr4)

  • force_overwrite (bool) – Allow a DDR4 acqusition that exceeds the DDR4 memory capacity. The memory will be used as a circular buffer: later transfers will wrap around to the beginning of the memory and overwrite older data.

arm_mr(ch)

Prepare the Multi-Rate buffer to take data. This must be called before starting a program that triggers the buffer. Once the buffer is armed, the first trigger it receives will cause the buffer to record until the buffer is filled. Later triggers will have no effect.

Parameters:

ch (int) – The readout channel to record (index in ‘readouts’ list).

calc_fstep(dicts)

Finds the least common multiple of the frequency steps of one or more channels (typically two, a generator and a readout) For proper frequency matching, you should only use frequencies that are evenly divisible by this value. The order of the parameters does not matter.

Parameters:

dicts (list of dict) – config dict for the channels

Returns:

frequency step common to all channels

Return type:

float

calc_fstep_int(dict1, other_dicts)

Finds the multiplier that needs to be applied to a channel’s frequency step size to allow this channel to be frequency-matched with another channel.

Parameters:
  • dict1 (dict) – config dict for this channel

  • other_dicts (list of dict) – config dict for the other channel(s)

Returns:

frequency step multiplier for the first channel

Return type:

int

calc_mixer_freq(gen_ch, mixer_freq, nqz, ro_ch)

Set the NCO frequency that will be mixed with the generator output.

The RFdc driver does its own math to convert a frequency to a register value. (see XRFdc_SetMixerSettings in xrfdc_mixer.c, and “NCO Frequency Conversion” in PG269) This is what it does: 1. Add/subtract fs to get the frequency in the range of [-fs/2, fs/2]. 2. If the original frequency was not in [-fs/2, fs/2] and the DAC is configured for 2nd Nyquist zone, multiply by -1. 3. Convert to a 48-bit register value, rounding using C integer casting (i.e. round towards 0).

Step 2 is not desirable for us, so we must undo it.

The rounding gives unexpected results sometimes: it’s hard to tell if a freq will get rounded up or down. This is important if the demanded frequency was rounded to a valid frequency for frequency matching. The safest way to get consistent behavior is to always round to a valid NCO frequency. We are trusting that the floating-point math is exact and a number we rounded here is still a round number in the RFdc driver.

calc_muxgen_regs(gen_ch, freqs, gains, phases, ro_ch, absolute_freqs, mixer_freq)

Calculate the register values to program into a multiplexed generator. mixer_freq will have been rounded appropriately in declare_gen, and will be 0 if there’s no mixer

calc_ro_freq(rocfg, ro_pars, ro_regs, absolute_freqs, mixer_freq, flip_freq=False)

Calculate the readout frequency and registers.

calc_ro_regs(rocfg, phase, sel, ch=None)

Calculate the settings to configure a readout.

Returns:

settings for QickSoc.config_readout()

Return type:

dict

ch_fstep(dict1)

Finds the frequency step size of a single channel (generator or readout).

Parameters:

dict1 (dict) – config dict for one channel

Returns:

frequency step for this channel

Return type:

float

check_pfb_collisions(rocfg, cfg1, cfgs)

Check whether the specified PFB config collides or interefers with any others. If this PFB block can’t put two readouts on the same channel, this method will raise an error on collisions. Possible crosstalk will be identified in warnings.

Parameters:
  • rocfg (dict) – firmware config dictionary for the PFB or the readout chain

  • cfg1 (dict) – PFB config to check

  • cfgs (list of dict) – PFB configs to check cfg1 against

clear_ddr4(length=None)

Clear the DDR4 buffer, filling it with 0’s. This is not necessary (the buffer will overwrite old data), but may be useful for debugging. Clearing the full buffer (4 GB) typically takes 4-5 seconds.

Parameters:

length (int) – Number of samples to clear (starting at the beginning of the buffer). If None, clear the entire buffer.

clear_tproc_counter(addr)

Initialize the tProc shot counter. For tProc v1, the data memory at the specified address is zeroed. For tProc v2, the tProc is reset, which zeroes all registers (the address is ignored).

Typical tProc v2 programs will also initialize the counter registers at the beginning of the program, but zeroing the counter now is important to distinguish “program waiting for external start” from “program complete.”

Parameters:

addr (int) – Counter address

clocks_locked()

Checks whether the DAC and ADC PLLs are locked. This can only be run after the bitstream has been downloaded. A failure usually means the FPGA is not getting a good reference clock from the on-board clock chips.

Returns:

clock status

Return type:

bool

config_avg(ch, address=0, length=1, edge_counting=False, high_threshold=1000, low_threshold=0)

Configure accumulated buffer; must then enable using enable_buf()

Parameters:
  • ch (int) – Readout channel to configure

  • address (int) – Starting address of buffer

  • length (int) – length of buffer (how many samples to integrate)

config_buf(ch, address=0, length=1)

Configure decimated buffer; must then enable using enable_buf()

Parameters:
  • ch (int) – Readout channel to configure

  • address (int) – Starting address of buffer

  • length (int) – length of buffer (how many samples to take)

config_clocks(force_init_clks, clk_output, external_clk)

Configure PLLs if requested, or if any ADC/DAC is not locked. The ADC/DAC PLL lock status is read through the RFDC IP, so this assumes that the bitstream has already been downloaded. The reference clock frequency must already have been read from the firmware config.

config_mux_gen(ch, tones)

Set up a list of tones all at once, using raw (integer) units. If the supplied list of tones is shorter than the number supported, the extra tones will have their gains set to 0.

Parameters:
  • ch (int) – generator channel (index in ‘gens’ list)

  • tones (list of dict) – Tones to configure. This is generated by QickConfig.calc_muxgen_regs().

config_mux_readout(pfbpath, cfgs, sel=None)

Set up a list of readout frequencies all at once, using raw (integer) units.

Parameters:
  • pfbpath (str) – Firmware path of the PFB readout being configured.

  • cfgs (list of dict) – Readout chains to configure. This is generated by QickConfig.calc_pfbro_regs().

  • sel (str) – Output selection (if supported), default to ‘product’

configure_readout(ch, ro_regs)

Configure readout channel output style and frequency. This method is only for use with PYNQ-configured readouts.

Parameters:
  • ch (int) – readout channel number (index in ‘readouts’ list)

  • ro_regs (dict) – readout registers, from QickConfig.calc_ro_regs()

cycles2us(cycles, gen_ch=None, ro_ch=None)

Converts clock cycles to microseconds. Uses tProc clock frequency by default. If gen_ch or ro_ch is specified, uses that generator/readout channel’s fabric clock.

Parameters:
  • cycles (int) – Number of clock cycles

  • gen_ch (int) – generator channel (index in ‘gens’ list)

  • ro_ch (int) – readout channel (index in ‘readouts’ list)

Returns:

Number of microseconds

Return type:

float

deg2int(deg, thisch)

Converts phase in degrees to integer value suitable for writing to a register. This method works for both generators and readouts.

Parameters:
  • deg (float) – phase (degrees)

  • thisch (dict) – config dict for the channel you’re configuring

Returns:

Re-formatted phase

Return type:

int

deg2reg(deg, gen_ch=0, ro_ch=None)

Converts degrees into phase register values; numbers greater than 360 will effectively be wrapped.

Parameters:
  • deg (float) – Number of degrees

  • gen_ch (int) – generator channel (index in ‘gens’ list)

  • ro_ch (int) – readout channel (index in ‘readouts’ list)

Returns:

Re-formatted number of degrees

Return type:

int

description()

Generate a printable description of the QICK configuration.

Returns:

description

Return type:

str

dump_cfg(gen_file_path=None)

Generate a JSON description of the QICK configuration. You can save this string to a file and load it to recreate the QickConfig.

Parameters:

gen_file_path (str or path-like, optional) – If provided, write the generated JSON configuration to this file path.

Returns:

configuration in JSON format

Return type:

str

Raises:

OSError – If gen_file_path is provided and the JSON configuration cannot be written to the specified file.

enable_buf(ch, enable_avg=True, enable_buf=True)

Enable capture of accumulated and/or decimated data for a buffer

Parameters:
  • ch (int) – Readout channel to configure

  • enable_avg (bool) – Enable accumulated data capture

  • enable_buf (bool) – Enable decimated data capture

freeze_adc_cals(blocknames)

Freeze the calibrations (stop the background calibration) of a list of RFSoC ADCs.

See the Xilinx documentation:

https://docs.amd.com/r/en-US/pg269-rf-data-converter/Background-Calibration-Process

Parameters:

blocknames (list of str) – List of RF-ADC IDs (2-digit strings). An ADC’s ID is the concatenation of the tile and block numbers displayed in the firmware configuration: in other words, for “ADC tile 2, blk 1” the blockname is “21”.

freq2int(f, thisch, otherch=None)

Converts frequency in MHz to integer value suitable for writing to a register. This method works for both generators and readouts. If a gen will be connected to an RO, the two channels must have exactly the same frequency, and you must supply the config for the other channel.

Parameters:
  • f (float) – frequency (MHz)

  • thisch (dict) – config dict for the channel you’re configuring

  • otherch (dict) – config dict for a channel you will set to the same frequency

Returns:

Re-formatted frequency

Return type:

int

freq2reg(f, gen_ch=0, ro_ch=None)

Converts frequency in MHz to tProc generator register value.

Parameters:
  • f (float) – frequency (MHz)

  • gen_ch (int) – generator channel

  • ro_ch (int) – readout channel (use None if you don’t want to frequency-match to a readout)

Returns:

Re-formatted frequency

Return type:

int

freq2reg_adc(f, ro_ch=0, gen_ch=None)

Converts frequency in MHz to readout register value.

Parameters:
  • f (float) – frequency (MHz)

  • ro_ch (int) – readout channel

  • gen_ch (int) – generator channel (use None if you don’t want to frequency-match to a generator)

Returns:

Re-formatted frequency

Return type:

int

get_accumulated(ch, address=0, length=None)

Acquires data from the readout accumulated buffer

Parameters:
  • ch (int) – ADC channel

  • address (int) – Address of data

  • length (int) – Buffer transfer length

Returns:

  • di[:length] (list) - list of accumulated I data

  • dq[:length] (list) - list of accumulated Q data

get_adc_attenuator(blockname)

Read the RFSoC ADC’s built-in step attenuator.

Only available for RFSoC Gen 3 (ZCU216, RFSoC4x2, RFSoC2x4). See https://docs.amd.com/r/en-US/pg269-rf-data-converter/Digital-Step-Attenuator-Gen-3/DFE.

Parameters:

blockname (str) – RF-ADC ID (2-digit string). This is the concatenation of the tile and block numbers displayed in the firmware configuration: in other words, for “ADC tile 2, blk 1” the blockname is “21”.

Returns:

Attenuation value (dB)

Return type:

float

get_cfg()

Return the QICK configuration dictionary. This contains everything you need to recreate the QickConfig.

Returns:

configuration dictionary

Return type:

dict

get_ddr4(nt, start=None)

Get data from the DDR4 buffer. The first samples (typically 401 or 801) of the buffer are always stale data from the previous acquisition.

Parameters:
  • nt (int) – Number of data transfers (each transfer is 128 or 256 decimated samples) to retrieve. If start=None, the amount of data will be reduced (see below).

  • start (int) – Number of samples to skip at the beginning of the buffer. If a value is specified, the end address of the transfer window will also be incremented. If None, the junk at the start of the buffer will be skipped but the end address will not be incremented. This reduces the amount of data, giving you exactly the block of valid data from a DDR4 trigger with the same value of nt.

get_decimated(ch, address=0, length=None)

Acquires data from the readout decimated buffer

Parameters:
  • ch (int) – ADC channel

  • address (int) – Address of data

  • length (int) – Buffer transfer length

Returns:

List of I and Q decimated arrays

Return type:

list of numpy.ndarray

get_maxv(gen_ch)

Convenience method for looking up a generator’s maximum allowed envelope value. The absolute value of the idata/qdata should not exceed this. Typically you will want to normalize your envelope’s maximum range to this value.

Parameters:

gen_ch (int) – generator channel (index in ‘gens’ list)

Returns:

max allowed value

Return type:

int

get_mr(start=None)

Get data from the multi-rate buffer. The first 8 samples are always stale data from the previous acquisition. The transfer window always extends to the end of the buffer.

Parameters:

start (int) – Number of samples to skip at the beginning of the buffer. If None, the junk at the start of the buffer is skipped.

get_sample_rates()

Produce dictionaries of the current sample rates of the DAC and ADC tiles. A dictionary of this form can be used to configure the sample rates at SoC initialization.

Returns:

A pair of dictionaries mapping DAC/ADC tiles to sample rates (in Msps).

Return type:

dict[str, dict[int, float]]

get_tproc_counter(addr)

Read the tProc shot counter. For tProc V1, this accesses the data memory at the given address. For tProc V2, this accesses one of the two special AXI-readable registers.

Parameters:

addr (int) – Counter address

Returns:

Counter value

Return type:

int

int2deg(r, thisch)

Converts register value to degrees. This method works for both generators and readouts.

Parameters:
  • r (int) – register value

  • thisch (dict) – config dict for the channel you’re configuring

Returns:

Re-formatted phase (degrees)

Return type:

float

int2freq(r, thisch)

Converts register value to MHz. This method works for both generators and readouts.

Parameters:
  • r (int) – register value

  • thisch (dict) – config dict for the channel you’re configuring

Returns:

Re-formatted frequency (MHz)

Return type:

float

load_bin_program(binprog, load_mem=True)

Write the program to the tProc program memory.

Parameters:
  • binprog (numpy.ndarray or dict) – compiled program (format depends on tProc version)

  • load_mem (bool) – write waveform and data memory now (can do this later with reload_mem())

load_envelope(ch, data, addr)

Load envelope data into a signal generator.

Parameters:
  • ch (int) – Generator channel to configure

  • data (numpy.ndarray of int16) – Array of (I, Q) values for pulse envelope

  • addr (int) – Starting address

load_mem(data, mem_sel='dmem', addr=0)

Write a block of the selected tProc memory. For tProc v1 only the data memory (“dmem”) is valid. For tProc v2 the program, data, and waveform memory are all accessible.

Parameters:
  • data (numpy.ndarray of int) – Data to be loaded 32-bit array of shape (n, 8) for pmem and wmem, (n) for dmem

  • mem_sel (str) – “pmem”, “dmem”, “wmem”

  • addr (int) – Starting write address

load_weights(ch, data, addr=0)

Load weights array to a weighted buffer.

Parameters:
  • ch (int) – Readout channel to configure

  • data (numpy.ndarray of int16) – array of 16-bit (I, Q) values for weights

  • address (int) – starting address

map_signal_paths(no_tproc)

Make lists of signal generator, readout, and buffer blocks in the firmware. Also map the switches connecting the generators and buffers to DMA. Fill the config dictionary with parameters of the DAC and ADC channels.

pl_reset(reinit=True)

Reset all firmware IP blocks. This pulses the pl_resetn0 line from the PS (also known as the “fabric reset” or the “PS-PL reset”). Every firmware block’s reset logic is triggered by this pulse. The main visible effect of this reset is to reset the start times of all the phase-coherent DDS oscillators.

Some firmware blocks have startup code in their __initialize__() to configure the block after the firmware is loaded. That configuration gets wiped out by a PL reset, so this method also re-configures those blocks.

More info on the PL reset: The reset sequence is defined in psu_ps_pl_reset_config_data() in psu_init.c. You can find this in the BSP or the firmware project files. The reset sequence and the memory addresses invovled appear to be the same for all RFSoCs.

https://support.xilinx.com/s/article/68962 https://support.xilinx.com/s/question/0D52E00006lLhBnSAK/zynq-ultrascale-howto-reset-the-pl https://docs.amd.com/r/en-US/ug1137-zynq-ultrascale-mpsoc-swdev/GPIO-Reset-to-PL https://docs.amd.com/r/en-US/pg201-zynq-ultrascale-plus-processing-system/Fabric-Reset-Enable

Parameters:

reinit (bool) – Reinitialize firmware blocks. False is OK if you haven’t run map_signal_paths() yet (which triggers block initialization).

poll_data(totaltime=0.1, timeout=None)

Get as much data as possible from the streamer data queue. Stop when any of the following conditions are met: * all the data has been transferred (based on the total_count) * we got data, and it has been totaltime seconds since poll_data was called * timeout is defined, and the timeout expired without getting new data in the queue If there are errors in the error queue, raise the first one.

Parameters:
  • totaltime (float) – How long to acquire data (negative value = ignore total time and total count, just read until timeout)

  • timeout (float) – How long to wait for the next data packet (None = wait forever)

Returns:

list of (data, stats) pairs, oldest first

Return type:

list

prepare_round()[source]

This runs before a program starts running. This is called by acquire/acquire_decimated/run_rounds; user code should not call it.

By default this does nothing, but a subclass of QickSoc may override this.

read_mem(length, mem_sel='dmem', addr=0)

Read a block of the selected tProc memory. For tProc v1 only the data memory (“dmem”) is valid. For tProc v2 the program, data, and waveform memory are all accessible.

Parameters:
  • length (int) – Number of words to read

  • mem_sel (str) – “pmem”, “dmem”, “wmem”

  • addr (int) – Starting read address

Returns:

32-bit array of shape (n, 8) for pmem and wmem, (n) for dmem

Return type:

numpy.ndarray

reg2deg(r, gen_ch=0, ro_ch=None)

Converts phase register values into degrees.

Parameters:
  • reg (int) – Re-formatted number of degrees

  • gen_ch (int) – generator channel (index in ‘gens’ list)

  • ro_ch (int) – readout channel (index in ‘readouts’ list)

Returns:

Number of degrees

Return type:

float

reg2freq(r, gen_ch=0)

Converts frequency from format readable by generator to MHz.

Parameters:
  • r (int) – frequency in generator format

  • gen_ch (int) – generator channel

Returns:

Re-formatted frequency in MHz

Return type:

float

reg2freq_adc(r, ro_ch=0)

Converts frequency from format readable by readout to MHz.

Parameters:
  • r (int) – frequency in readout format

  • ro_ch (int) – readout channel

Returns:

Re-formatted frequency in MHz

Return type:

float

reload_mem()

Reload the waveform and data memory, overwriting any changes made by running the program.

reset_gens()

Reset the tProc and run a minimal tProc program that drives all signal generators with 0’s. Useful for stopping any periodic or stdysel=”last” outputs that may have been driven by a previous program.

rfb_get_bias(bias_ch)

Read the voltage setpoint on an RF-board bias output.

Parameters:

bias_ch (int) – Channel number (0-7)

Returns:

setpoint, in volts

Return type:

float

rfb_set_adc_dc(adc_port, gain)

Enable and configure an RF-board DC input channel. Will fail if this is not a DC input.

Parameters:
  • adc_port (int) – QICK box or RF board ADC port number (0-7 for ZCU216, 4-7 for ZCU111)

  • gain (float) – Gain (-6 through 26 dB in 1-dB increments)

Returns:

actual (rounded) value that was set

Return type:

float

rfb_set_adc_rf(adc_port, att)

Enable and configure an RF-board RF input channel. Will fail if this is not an RF input.

Parameters:
  • adc_port (int) – QICK box or RF board ADC port number (0-7 for ZCU216, 0-3 for ZCU111)

  • att (float) – Attenuation (0 through 31.75 dB in 0.25-dB increments)

Returns:

actual (rounded) value that was set

Return type:

float

rfb_set_bias(bias_ch, v)

Set a voltage on an RF-board bias output.

Parameters:
  • bias_ch (int) – Channel number (0-7)

  • v (float) – Voltage (-10 to 10 V)

Returns:

actual (rounded) value that was set

Return type:

float

rfb_set_dac_dc(dac_port)

Enable and configure a QICK box or RF board DAC port for DC output.

Parameters:

dac_port (int) – QICK box or RF board DAC port number (0-15 for ZCU216, 0-7 for ZCU111)

rfb_set_dac_rf(dac_port, att1, att2)

Enable and configure a QICK box or RF board DAC port for RF output.

Parameters:
  • dac_port (int) – QICK box or RF board DAC port number (0-15 for ZCU216, 0-7 for ZCU111)

  • att1 (float) – Attenuation for first stage (0 through 31.75 dB in 0.25-dB increments)

  • att2 (float) – Attenuation for second stage (0 through 31.75 dB in 0.25-dB increments)

Returns:

  • float – actual (rounded) att1 value that was set

  • float – actual (rounded) att2 value that was set

rfb_set_gen_dc(gen_ch)

Enable and configure an RF-board output channel for DC output.

Parameters:

gen_ch (int) – DAC channel (index in ‘gens’ list)

rfb_set_gen_rf(gen_ch, att1, att2)

Enable and configure an RF-board output channel for RF output.

Parameters:
  • gen_ch (int) – DAC channel (index in ‘gens’ list)

  • att1 (float) – Attenuation for first stage (0 through 31.75 dB in 0.25-dB increments)

  • att2 (float) – Attenuation for second stage (0 through 31.75 dB in 0.25-dB increments)

Returns:

  • float – actual (rounded) att1 value that was set

  • float – actual (rounded) att2 value that was set

rfb_set_ro_dc(ro_ch, gain)

Enable and configure an RF-board DC input channel. Will fail if this is not a DC input.

Parameters:
  • ro_ch (int) – ADC channel (index in ‘readouts’ list)

  • gain (float) – Gain (-6 through 26 dB in 1-dB increments)

Returns:

actual (rounded) value that was set

Return type:

float

rfb_set_ro_rf(ro_ch, att)

Enable and configure an RF-board RF input channel. Will fail if this is not an RF input.

Parameters:
  • ro_ch (int) – ADC channel (index in ‘avg_bufs’ list)

  • att (float) – Attenuation (0 through 31.75 dB in 0.25-dB increments)

Returns:

actual (rounded) value that was set

Return type:

float

round_sample_rate(tiletype, tile, fs_target)

Return the closest achievable sample rate to the requested value. This does not account for dependencies due to clock groups, or the restriction that you’re not allowed to raise the sample rate.

Parameters:
  • tiletype (str) – ‘dac’ or ‘adc’

  • tile (int) – Tile number (0-3)

  • fs_target (float) – Requested sample rate, in Msps

Returns:

Closest valid sample rate, in Msps

Return type:

float

roundfreq(f, dicts)

Round a frequency to the LCM of the frequency steps of one or more channels (typically two, a generator and a readout).

Parameters:
Returns:

rounded frequency (MHz)

Return type:

float or numpy.ndarray

set_adc_attenuator(blockname, attenuation)

Set the RFSoC ADC’s built-in step attenuator. The requested value will be rounded to the nearest valid value (0-27 dB inclusive, 1 dB steps).

Only available for RFSoC Gen 3 (ZCU216, RFSoC4x2, RFSoC2x4). See https://docs.amd.com/r/en-US/pg269-rf-data-converter/Digital-Step-Attenuator-Gen-3/DFE.

Parameters:
  • blockname (str) – RF-ADC ID (2-digit string). This is the concatenation of the tile and block numbers displayed in the firmware configuration: in other words, for “ADC tile 2, blk 1” the blockname is “21”.

  • attenuation (float) – Attenuation value (dB)

Returns:

The rounded attenuation value that was actually set (dB)

Return type:

float

set_all_clks(clk_output, external_clk)

Resets all the board clocks

set_iq(ch, f, i, q, ro_ch=None, phase_reset=True)

Set frequency, I, and Q for a constant-IQ output.

Parameters:
  • ch (int) – DAC channel (index in ‘gens’ list)

  • f (float) – frequency (in MHz)

  • i (float) – I value (in range -1 to 1)

  • q (float) – Q value (in range -1 to 1)

  • ro_ch (int) – readout channel (index in ‘readouts’ list) for frequency matching use None if you don’t want freq to be rounded to a valid readout frequency

  • phase_reset (bool) – if this changes the frequency, also reset the phase (so if we go to freq=0, we end up on the real axis)

set_mixer_freq(ch, f, ro_ch=None, phase_reset=True, fullscale=False)

Set mixer frequency for a signal generator. If the generator does not have a mixer, you will get an error.

Parameters:
set_nyquist(ch, nqz, force=False)

Sets DAC channel ch to operate in Nyquist zone nqz mode.

Parameters:
  • ch (int) – DAC channel (index in ‘gens’ list)

  • nqz (int) – Nyquist zone

start_readout(total_shots, counter_addr=1, ch_list=None, reads_per_shot=1, stride=None)

Start a streaming readout of the accumulated buffers.

Parameters:
  • total_shots (int) – Final value expected for the shot counter

  • counter_addr (int) – Data memory address for the shot counter

  • ch_list (list of int) – List of readout channels

  • reads_per_shot (list of int) – Number of data points to expect per counter increment

  • stride (int) – Default number of measurements to transfer at a time.

start_src(src)

Sets the start source of tProc

Parameters:

src (str) – start source “internal” or “external”

start_tproc()

Start the tProc.

If the tProc is configured for external start, this does nothing (the tProc will start on the first start signal it sees after external start is enabled).

stop_tproc(lazy=False)

Stop the tProc. This is somewhat slow (tens of ms) for tProc v1.

Parameters:

lazy (bool) – Only stop the tProc if it’s easy (i.e. do nothing for v1)

property streamer
property tproc
tt_arm(blk)

Start data capture on the specified time-tagger block.

Parameters:

blk (int) – The time tagger block to arm (index in time_taggers list).

tt_config(blk, threshold, wr_smp=32, filt=False, slope=False, invert=False, interp=0, deadtime=5)

Configure the specified time-tagger block.

Parameters:
  • blk (int) – The time tagger block to flush (index in time_taggers list).

  • threshold (int) – Tag threshold (-2^15 through 2^15-1).

  • wr_smp (int) – Number of 8-sample chunks to capture per tag in the SMP memory (1 through 32). If this time tagger has no SMP memory, this is ignored.

  • filt (bool) – Trigger on signal after a 2-sample smoothing filter.

  • slope (bool) – Trigger on slope (difference between consecutive samples), not level.

  • invert (bool) – Trigger on inverted signal.

  • interp (int) – Number of bits for interpolation (0 through 7).

  • deadtime (int) – Minimum time (in fabric ticks, 8 samples) between one tag and the next (5 through 255). This should be larger than the expected pulse width, otherwise you will get double-triggering on the same pulse.

tt_disarm(blk)

Stop data capture on the specified time-tagger block.

Parameters:

blk (int) – The time tagger block to arm (index in time_taggers list).

tt_readmem(blk, mem)

Read one of the specified time-tagger block’s memories. Reading a time-tagger memory clears it.

Parameters:
  • blk (int) – The time tagger block to read (index in time_taggers list).

  • mem (str) – “ARM”, “SMP”, “TAG0”/”TAG1”/”TAG2”/”TAG3”

tt_reset(blk)

Reset and flush the memories of the specified time-tagger block.

Parameters:

blk (int) – The time tagger block to reset (index in time_taggers list).

unfreeze_adc_cals(blocknames)

Unfreeze the calibrations (resume the background calibration) of a list of RFSoC ADCs.

See the Xilinx documentation:

https://docs.amd.com/r/en-US/pg269-rf-data-converter/Background-Calibration-Process

Parameters:

blocknames (list of str) – List of RF-ADC IDs (2-digit strings). An ADC’s ID is the concatenation of the tile and block numbers displayed in the firmware configuration: in other words, for “ADC tile 2, blk 1” the blockname is “21”.

us2cycles(us, gen_ch=None, ro_ch=None, as_float=False)

Converts microseconds to integer number of clock cycles. Uses tProc clock frequency by default. If gen_ch or ro_ch is specified, uses that generator/readout channel’s fabric clock.

Parameters:
  • us (float) – Number of microseconds

  • gen_ch (int) – generator channel (index in ‘gens’ list)

  • ro_ch (int) – readout channel (index in ‘readouts’ list)

  • as_float (bool) – leave as float, instead of rounding to int

Returns:

Number of clock cycles

Return type:

int

valid_sample_rates(tiletype, tile)

Return an array of valid sample rates. This does not account for dependencies due to clock groups, or the restriction that you’re not allowed to raise the sample rate.

Parameters:
  • tiletype (str) – ‘dac’ or ‘adc’

  • tile (int) – Tile number (0-3)

Returns:

Array of sample rates, in Msps

Return type:

numpy.ndarray

cleanup_round()[source]

This runs after a program has finished running. This is called by acquire/acquire_decimated/run_rounds; user code should not call it.

By default this does nothing, but a subclass of QickSoc may override this.