TPM hardware tile module (ska_low_mccs.tile.hw_tile)

Hardware functions for the TPM 1.2 hardware.

This is derived from pyaavs.Tile object and depends heavily on the pyfabil low level software and specific hardware module plugins.

class Tile12(ip, port=10000, lmc_ip='0.0.0.0', lmc_port=4660, sampling_rate=800000000.0, logger=None)[source]

Tile hardware interface library.

Streamlined and edited version of the AAVS Tile object

__init__(ip, port=10000, lmc_ip='0.0.0.0', lmc_port=4660, sampling_rate=800000000.0, logger=None)[source]

HwTile initialization.

Parameters
  • logger (logging.Logger) – the logger to be used by this Command. If not provided, then a default module logger will be used.

  • ip (str) – IP address of the hardware

  • port (int) – UCP Port address of the hardware port

  • lmc_ip (str) – IP address of the MCCS DAQ recevier

  • lmc_port (int) – UCP Port address of the MCCS DAQ receiver

  • sampling_rate (float) – ADC sampling rate

beamformer_is_running()[source]

Check if station beamformer is running :return: beamformer running status :rtype: bool

static calculate_delay(current_delay, current_tc, ref_low, ref_hi)[source]

Calculate delay for PPS pulse.

Parameters
  • current_delay (int) – Current delay

  • current_tc (int) – Current phase register terminal count

  • ref_low (int) – Low reference

  • ref_hi (int) – High reference

Returns

Modified phase register terminal count

Return type

int

check_arp_table()[source]

Check that ARP table has been populated in for all used cores 40G interfaces use cores 0 (fpga0) and 1(fpga1) and ARP ID 0 for beamformer, 1 for LMC 10G interfaces use cores 0,1 (fpga0) and 4,5 (fpga1) for beamforming, and 2, 6 for LMC with only one ARP.

Returns

if ARP table is populated

Return type

bool

check_fpga_synchronization()[source]

Checks various synchronization parameters.

Output in the log

Returns

OK status

Return type

bool

check_jesd_error_counter(show_result=True)[source]

check JESD204 lanes errors.

Parameters

show_result (bool) – prints error counts on logger

Returns

error count vector

Return type

list(int)

check_jesd_lanes()[source]

check if JESD204 lanes are error free.

Returns

true if all OK

Return type

bool

check_pending_data_requests()[source]

Checks whether there are any pending data requests :return: true if pending requests are present :rtype: bool

check_synchronization()[source]

Checks FPGA synchronisation, returns when these are synchronised.

compute_calibration_coefficients()[source]

Compute the calibration coefficients and load them in the hardware.

configure_10g_core(core_id, src_mac=None, src_ip=None, dst_mac=None, dst_ip=None, src_port=None, dst_port=None)[source]

Configure a 10G core TODO Legacy method. Checrki if it is to be deleted.

Parameters
  • core_id – 10G core ID

  • src_mac – Source MAC address

  • src_ip – Source IP address

  • dst_mac – Destination MAC address

  • dst_ip – Destination IP

  • src_port – Source port

  • dst_port – Destination port

configure_40g_core(core_id, arp_table_entry=0, src_mac=None, src_ip=None, dst_ip=None, src_port=None, dst_port=None)[source]

Configure a 40G core.

Parameters
  • core_id – 40G core ID

  • arp_table_entry – ARP table entry ID

  • src_mac – Source MAC address

  • src_ip – Source IP address

  • dst_ip – Destination IP

  • src_port – Source port

  • dst_port – Destination port

configure_integrated_beam_data(integration_time=0.5, first_channel=0, last_channel=191)[source]

Configure and start continuous integrated beam data.

Parameters
  • integration_time (float, optional) – integration time in seconds, defaults to 0.5

  • first_channel (int, optional) – first channel

  • last_channel (int, optional) – last channel

configure_integrated_channel_data(integration_time=0.5, first_channel=0, last_channel=511)[source]

Configure and start continuous integrated channel data.

Parameters
  • integration_time (float, optional) – integration time in seconds, defaults to 0.5

  • first_channel (int, optional) – first channel

  • last_channel (int, optional) – last channel

connect(initialise=False, load_plugin=True, enable_ada=False)[source]

Connect to the hardware and loads initial configuration.

Parameters
  • initialise (bool) – Initialises the TPM object

  • load_plugin (bool) – loads software plugins

  • enable_ada (bool) – Enable ADC amplifier (usually not present)

current_station_beamformer_frame()[source]

Query time of packets at station beamformer input :return: current frame, in units of 256 ADC frames (276,48 us) :rtype: int

current_tile_beamformer_frame()[source]

Query time of packets at tile beamformer input :return: current frame, in units of 256 ADC frames (276,48 us) :rtype: int

define_spead_header(station_id, subarray_id, nof_antennas, ref_epoch=- 1, start_time=0)[source]

Define SPEAD header for last tile.

All parameters are specified by the LMC.

Parameters
  • station_id – Station ID

  • subarray_id – Subarray ID

  • nof_antennas (int) – Number of antenns in the station

  • ref_epoch (int) – Unix time of epoch. -1 uses value defined in set_epoch

  • start_time – start time (TODO describe better)

Returns

True if parameters OK, False for error

Return type

bool

download_firmware(device, bitfile)[source]

Download bitfile to FPGA.

Parameters
  • device – FPGA to download bitfile

  • bitfile – Bitfile to download

Raises

LibraryError – if the TPM is not connected

erase_fpga()[source]

Erase FPGA configuration memory.

get_10g_core_configuration(core_id)[source]

Get the configuration for a 10g core TODO CHeck whether to be deleted.

Parameters

core_id (int) – Core ID (0-7)

Returns

core configuration

Return type

dict

get_40g_core_configuration(core_id, arp_table_entry=0)[source]

Get the configuration for a 40g core.

Parameters
  • core_id (int) – Core ID

  • arp_table_entry (int) – ARP table entry to use

Returns

core configuration

Return type

dict

get_adc_rms()[source]

Get ADC power :return: ADC RMS power :rtype: list(float)

get_current()[source]

Read board current :return: board supply current :rtype: float

get_firmware_list()[source]

Get information for loaded firmware :return: Firmware information dictionary for each loaded firmware :rtype: list(dict)

get_fpga0_temperature()[source]

Get FPGA0 temperature :return: FPGA0 temperature :rtype: float

get_fpga1_temperature()[source]

Get FPGA1 temperature :return: FPGA0 temperature :rtype: float

get_fpga_time(device=pyfabil.base.definitions.Device.FPGA_1)[source]

Return time from FPGA.

Parameters

device (int) – FPGA to get time from

Returns

Internal time for FPGA

Return type

int

Raises

LibraryError – Invalid value for device

get_fpga_timestamp(device=pyfabil.base.definitions.Device.FPGA_1)[source]

Get timestamp from FPGA.

Parameters

device (int) – FPGA to read timestamp from

Returns

PPS time

Return type

int

Raises

LibraryError – Invalid value for device

get_ip()[source]

Get tile IP :return: tile IP address :rtype: str

get_phase_terminal_count()[source]

Get PPS phase terminal count :return: PPS phase terminal count :rtype: int

get_pps_delay()[source]

Get delay between PPS and 10 MHz clock :return: delay between PPS and 10 MHz clock in 200 MHz cycles :rtype: int

get_station_id()[source]

Get station ID :return: station ID programmed in HW :rtype: int

get_temperature()[source]

Read board temperature :return: board temperature :rtype: float

get_tile_id()[source]

Get tile ID.

Returns

programmed tile id

Return type

int

get_voltage()[source]

Read board voltage :return: board supply voltage :rtype: float

initialise(enable_ada=False, enable_test=False)[source]

Connect and initialise.

Parameters
  • enable_ada (bool) – enable adc amplifier, Not present in most TPM versions

  • enable_test (bool) – setup internal test signal generator instead of ADC

initialise_beamformer(start_channel, nof_channels, is_first, is_last)[source]

Initialise tile and station beamformers for a simple single beam configuration.

Parameters
  • start_channel (int) – Initial channel, must be even

  • nof_channels (int) – Number of beamformed spectral channels

  • is_first (bool) – True for first tile in beamforming chain

  • is_last (bool) – True for last tile in beamforming chain

is_programmed()[source]

Check whether the TPM is connected and programmed.

Returns

If the TPM is programmed

Return type

bool

load_antenna_tapering(beam, tapering_coefficients)[source]

tapering_coefficients is a vector of 16 values, one per antenna. Default (at initialization) is 1.0. TODO modify plugin to allow for different beams.

Parameters
  • beam (int) – Beam index in range 0:47

  • tapering_coefficients (list(int)) – Coefficients for each antenna

load_beam_angle(angle_coefficients)[source]

Angle_coefficients is an array of one element per beam, specifying a rotation angle, in radians, for the specified beam.

The rotation is the same for all antennas. Default is 0 (no rotation). A positive pi/4 value transfers the X polarization to the Y polarization. The rotation is applied after regular calibration.

Parameters

angle_coefficients (list(float)) – Rotation angle, per beam, in radians

load_calibration_coefficients(antenna, calibration_coefficients)[source]

Loads calibration coefficients. calibration_coefficients is a bi-dimensional complex array of the form calibration_coefficients[channel, polarization], with each element representing a normalized coefficient, with (1.0, 0.0) the normal, expected response for an ideal antenna. Channel is the index specifying the channels at the beamformer output, i.e. considering only those channels actually processed and beam assignments. The polarization index ranges from 0 to 3. 0: X polarization direct element 1: X->Y polarization cross element 2: Y->X polarization cross element 3: Y polarization direct element The calibration coefficients may include any rotation matrix (e.g. the parallitic angle), but do not include the geometric delay.

Parameters
  • antenna (int) – Antenna number (0-15)

  • calibration_coefficients (list(float)) – Calibration coefficient array

load_pointing_delay(load_time=0)[source]

Delay is updated inside the delay engine at the time specified If time = 0 load immediately :param load_time: time (in ADC frames/256) for delay update :type load_time: int

post_synchronisation()[source]

Post tile configuration synchronization.

program_cpld(bitfile)[source]

Program CPLD with specified bitfile. Use with VERY GREAT care, this might leave the FPGA in an unreachable state. TODO Wiser to leave the method out altogether and use a dedicated utility instead?

Parameters

bitfile – Bitfile to flash to CPLD

Returns

write status

program_fpgas(bitfile)[source]

Program both FPGAs with specified firmware.

Parameters

bitfile (str) – Bitfile to load

read_cpld(bitfile='cpld_dump.bit')[source]

Read bitfile in CPLD FLASH.

Parameters

bitfile (str) – Bitfile where to dump CPLD firmware

reset_jesd_error_counter()[source]

Reset errors in JESD lanes.

send_beam_data(timestamp=None, seconds=0.2)[source]

Transmit a snapshot containing beamformed data.

Parameters
  • timestamp (int, optional) – when to start(?)

  • seconds (float, optional) – when to synchronise

send_channelised_data(number_of_samples=1024, first_channel=0, last_channel=511, timestamp=None, seconds=0.2)[source]

send channelised data from the TPM.

Parameters
  • number_of_samples (int, optional) – number of spectra to send

  • first_channel (int, optional) – first channel to send

  • last_channel (int, optional) – last channel to send

  • timestamp (int, optional) – when to start(?)

  • seconds (float, optional) – when to synchronise

send_channelised_data_continuous(channel_id, number_of_samples=128, wait_seconds=0, timestamp=None, seconds=0.2)[source]

Transmit data from a channel continuously.

Parameters
  • channel_id (int) – index of channel to send

  • number_of_samples (int, optional) – number of spectra to send

  • wait_seconds (float) – wait time before sending data

  • timestamp (int, optional) – when to start(?)

  • seconds (float, optional) – when to synchronise

send_channelised_data_narrowband(frequency, round_bits, number_of_samples=128, wait_seconds=0, timestamp=None, seconds=0.2)[source]

Send channelised data from a single channel.

Parameters
  • frequency (int) – sky frequency to transmit

  • round_bits (int) – which bits to round

  • number_of_samples (int, optional) – number of spectra to send

  • wait_seconds (int, optional) – wait time before sending data

  • timestamp (int, optional) – when to start

  • seconds (float, optional) – when to synchronise

send_raw_data(sync=False, timestamp=None, seconds=0.2)[source]

send raw data from the TPM.

Parameters
  • timestamp (int, optional) – When to start. Default now.

  • seconds (float, optional) – delay with respect to timestamp, in seconds

  • sync (bool, optional) – Get synchronised

set_beamformer_epoch(epoch)[source]

Set the Unix epoch in seconds since Unix reference time.

Parameters

epoch – Unix epoch for the reference time

Returns

Success status

Return type

bool

set_beamformer_regions(region_array)[source]

Set frequency regions.

Regions are defined in a 2-d array, for a maximum of 48 regions. Each element in the array defines a region, with the form [start_ch, nof_ch, beam_index]

  • start_ch: region starting channel (currently must be a

    multiple of 2, LS bit discarded)

  • nof_ch: size of the region: must be multiple of 8 chans

  • beam_index: beam used for this region, range [0:8)

Total number of channels must be <= 384 The routine computes the arrays beam_index, region_off, region_sel, and the total number of channels nof_chans, and programs it in the HW :param region_array: list of region array descriptors :type region_array: list(list(int))

set_c2c_burst()[source]

Setting C2C burst when supported by FPGAs and CPLD.

set_channeliser_truncation(trunc, signal=None)[source]

Set channeliser truncation scale for the whole tile.

Parameters
  • trunc (int) – Truncted bits, channeliser output scaled down

  • signal (int) – Input signal, 0 to 31. If None, apply to all

set_csp_rounding(rounding)[source]

Set output rounding for CSP.

Parameters

rounding – Number of bits rounded in final 8 bit requantization to CSP

Returns

success status

Return type

bool

set_first_last_tile(is_first, is_last)[source]

Defines if a tile is first, last, both or intermediate.

One, and only one tile must be first, and last, in a chain. A tile can be both (one tile chain), or none.

Parameters
  • is_first (bool) – True for first tile in beamforming chain

  • is_last (bool) – True for last tile in beamforming chain

Returns

success status

Return type

bool

set_fpga_time(device, device_time)[source]

Set Unix time in FPGA.

Parameters
  • device (int) – FPGA to get time from

  • device_time (int) – Internal time for FPGA

Raises

LibraryError – Invalid value for device

set_lmc_download(mode, payload_length=1024, dst_ip=None, src_port=61648, dst_port=4660, lmc_mac=None)[source]

Configure link and size of control data.

Parameters
  • mode – 1g or 10g

  • payload_length – SPEAD payload length in bytes

  • dst_ip – Destination IP

  • src_port – Source port for integrated data streams

  • dst_port – Destination port for integrated data streams

  • lmc_mac – LMC Mac address is required for 10G lane configuration

set_lmc_integrated_download(mode, channel_payload_length, beam_payload_length, dst_ip=None, src_port=61648, dst_port=4660, lmc_mac=None)[source]

Configure link and size of control data.

Parameters
  • mode – ‘1g’ or ‘10g’

  • channel_payload_length – SPEAD payload length for integrated channel data

  • beam_payload_length – SPEAD payload length for integrated beam data

  • dst_ip – Destination IP

  • src_port – Source port for integrated data streams

  • dst_port – Destination port for integrated data streams

  • lmc_mac – LMC Mac address is required for 10G lane configuration

set_phase_terminal_count(value)[source]

Set phase terminal count.

Parameters

value – PPS phase terminal count

set_pointing_delay(delay_array, beam_index)[source]

The method specifies the delay in seconds and the delay rate in seconds/seconds. The delay_array specifies the delay and delay rate for each antenna. beam_index specifies which beam is described (range 0:7). Delay is updated inside the delay engine at the time specified by method load_delay.

Parameters
  • delay_array (list(list(float))) – delay and delay rate for each antenna

  • beam_index (int) – specifies which beam is described (range 0:7)

set_station_id(station_id, tile_id)[source]

Set station ID.

Parameters
  • station_id – Station ID

  • tile_id – Tile ID within station

set_test_generator_noise(amplitude=0.0, load_time=0)[source]

test generator Gaussian white noise setting.

Parameters
  • amplitude (float) – Tone peak amplitude, normalized to 26.03 ADC units, resolution 0.102 ADU

  • load_time (int) – Time to start the tone.

set_test_generator_pulse(freq_code, amplitude=0.0)[source]

test generator Gaussian white noise setting.

Parameters
  • freq_code (int) – Code for pulse frequency. Range 0 to 7: 16,12,8,6,4,3,2 times frame frequency

  • amplitude (float) – Tone peak amplitude, normalized to 127.5 ADC units, resolution 0.5 ADU

set_test_generator_tone(generator, frequency=100000000.0, amplitude=0.0, phase=0.0, load_time=0)[source]

test generator tone setting.

Parameters
  • generator (int) – generator select. 0 or 1

  • frequency (float) – Tone frequency in Hz

  • amplitude (float) – Tone peak amplitude, normalized to 31.875 ADC units, resolution 0.125 ADU

  • phase (float) – Initial tone phase, in turns

  • load_time (int) – Time to start the tone.

set_time_delays(delays)[source]

Set coarse zenith delay for input ADC streams Delay specified in nanoseconds, nominal is 0.

Parameters

delays (list(float)) – Delay in samples, positive delay adds delay to the signal stream

Returns

Parameters in range

Return type

bool

start_acquisition(start_time=None, delay=2)[source]

Start data acquisition.

Parameters
  • start_time – Time for starting (frames)

  • delay – delay after start_time (frames)

start_beamformer(start_time=0, duration=- 1)[source]

Start the beamformer.

Duration: if > 0 is a duration in frames * 256 (276.48 us) if == -1 run forever

Parameters
  • start_time (int) – time (in ADC frames/256) for first frame sent

  • duration (int) – duration in ADC frames/256. Multiple of 8

Returns

False for error (e.g. beamformer already running)

Rtype bool

stop_beamformer()[source]

Stop beamformer.

stop_integrated_beam_data()[source]

Stop transmission of integrated beam data.

stop_integrated_channel_data()[source]

Stop transmission of integrated beam data.

stop_integrated_data()[source]

Stop transmission of integrated data.

switch_calibration_bank(switch_time=0)[source]

Switches the loaded calibration coefficients at prescribed time If time = 0 switch immediately :param switch_time: time (in ADC frames/256) for delay update :type switch_time: int

sync_fpgas()[source]

Syncronises the two FPGAs in the tile Returns when these are synchronised.

synchronised_beamformer_coefficients(timestamp=None, seconds=0.2)[source]

Synchronise beamformer coefficients download.

Parameters
  • timestamp – Timestamp to synchronise against

  • seconds – Number of seconds to delay operation

synchronised_data_operation(seconds=0.2, timestamp=None)[source]

Synchronise data operations between FPGAs.

Parameters
  • seconds – Number of seconds to delay operation

  • timestamp – Timestamp at which tile will be synchronised

test_generator_input_select(inputs)[source]

Specify ADC inputs which are substitute to test signal. Specified using a 32 bit mask, with LSB for ADC input 0.

Parameters

inputs (int) – Bit mask of inputs using test signal

tpm_version()[source]

Determine whether this is a TPM V1.2 or TPM V1.6 :return: TPM hardware version :rtype: string

tweak_transceivers()[source]

Tweak transceivers.

wait_pps_event()[source]

Wait for a PPS edge. Added timeout feture to avoid method to stuck.

Raises

BoardError – Hardware PPS stuck

connected(f)[source]

Helper to disallow certain function calls on unconnected tiles.

Parameters

f (callable) – the method wrapped by this helper

Returns

the wrapped method

Return type

callable

Hardware functions for the TPM 1.6 hardware.

This is derived from pyaavs.Tile object and depends heavily on the pyfabil low level software and specific hardware module plugins.

class Tile16(ip='0.0.0.0', port=10000, lmc_ip='10.0.10.1', lmc_port=4660, sampling_rate=800000000.0, logger=None)[source]

Tile hardware interface library. Methods specific for TPM 1.6.

Streamlined and edited version of the AAVS Tile object

__init__(ip='0.0.0.0', port=10000, lmc_ip='10.0.10.1', lmc_port=4660, sampling_rate=800000000.0, logger=None)[source]

HwTile initialization.

Parameters
  • logger (logging.Logger) – the logger to be used by this Command. If not provided, then a default module logger will be used.

  • ip (str) – IP address of the hardware

  • port (int) – UCP Port address of the hardware port

  • lmc_ip (str) – IP address of the MCCS DAQ recevier

  • lmc_port (int) – UCP Port address of the MCCS DAQ receiver

  • sampling_rate (float) – ADC sampling rate

connect(initialise=False, load_plugin=True, enable_ada=False, enable_adc=True, dsp_core=True)[source]

Connect to the hardware and loads initial configuration.

Parameters
  • initialise (bool) – Initialises the TPM object

  • load_plugin (bool) – loads software plugins

  • enable_ada (bool) – Enable ADC amplifier (usually not present)

  • enable_adc (bool) – Enable ADC

  • dsp_core (bool) – Enable loading of DSP core plugins

f2f_aurora_test_check()[source]

Get test results for Aurora f2f link Tests printed on stdout.

f2f_aurora_test_start()[source]

Start test on Aurora f2f link.

f2f_aurora_test_stop()[source]

Stop test on Aurora f2f link.

initialise(enable_ada=False, enable_test=False, enable_adc=True)[source]

Connect and initialise.

Parameters
  • enable_ada (bool) – enable adc amplifier, Not present in most TPM versions

  • enable_test (bool) – setup internal test signal generator instead of ADC

  • enable_adc (bool) – Enable ADC

tpm_version()[source]

Determine whether this is a TPM V1.2 or TPM V1.6 :return: TPM hardware version :rtype: string

connected(f)[source]

Helper to disallow certain function calls on unconnected tiles.

Parameters

f (callable) – the method wrapped by this helper

Returns

the wrapped method

Return type

callable