Tile Hardware module (ska_low_mccs.tile.tile_hardware)

This module implements tile hardware management for MCCS.

class TileHardwareFactory(simulation_mode, test_mode, logger, tpm_ip='0.0.0.0', tpm_cpld_port=0, tpm_version='tpm_v1_6')[source]

A hardware factory for tile hardware.

At present, this returns a BaseTpmSimulator object when in simulation mode, and a TpmDriver object if the hardware is sought whilst not in simulation mode

__init__(simulation_mode, test_mode, logger, tpm_ip='0.0.0.0', tpm_cpld_port=0, tpm_version='tpm_v1_6')[source]

Create a new factory instance.

Parameters
  • simulation_mode (SimulationMode) – the initial simulation mode of this hardware factory

  • test_mode (TestMode) – the initial test mode of this hardware factory

  • logger (logging.Logger) – the logger to be used by this hardware manager.

  • tpm_ip (str) – the IP address of the tile

  • tpm_cpld_port (int) – the port at which the tile is accessed for control

  • tpm_version (str) – TPM version: “tpm_v1_2” or “tpm_v1_6”

class TileHardwareHealthEvaluator[source]

A very rudimentary stub HardwareHealthEvaluator for tile hardware.

At present this returns * FAILED if the connection to the TPM has been lost * OK otherwise.

class TileHardwareManager(simulation_mode, test_mode, logger, tpm_ip, tpm_cpld_port=10000, tpm_version='tpm_v1_6', _factory=None)[source]

This class manages tile hardware.

__init__(simulation_mode, test_mode, logger, tpm_ip, tpm_cpld_port=10000, tpm_version='tpm_v1_6', _factory=None)[source]

Initialise a new TileHardwareManager instance.

Parameters
  • simulation_mode (SimulationMode) – the initial simulation mode for this tile hardware manager

  • test_mode (TestMode) – the initial test mode for this tile hardware manager

  • logger (logging.Logger) – a logger for this hardware manager to use

  • tpm_ip (str) – IP address of TPM board

  • tpm_cpld_port (int) – port address of TPM board control port

  • tpm_version (str) – TPM version: “tpm_v1_2” or “tpm_v1_6”

  • _factory (TileHardwareFactory) – allows for substitution of a hardware factory. This is useful for testing, but generally should not be used in operations.

property adc_rms

Return the RMS power of the TPM’s analogue-to-digital converter.

Returns

the RMS power of the TPM’s ADC

Return type

tuple(float)

property arp_table

Check that ARP table has been populated in for all used cores.

Returns

list of core id and arp table populated

Return type

dict(list)

property board_temperature

The temperature of the main board of the hardware.

Returns

the temperature of the main board of the hardware

Return type

float

calculate_delay(current_delay, current_tc, ref_lo, ref_hi)[source]

Calculate the delay.

Parameters
  • current_delay (float) – the current delay

  • current_tc (int) – current phase register terminal count

  • ref_lo (float) – low reference

  • ref_hi (float) – high reference

check_pending_data_requests()[source]

Check the TPM for pending data requests.

Returns

whether the TPM has pending data requests

Return type

bool

compute_calibration_coefficients()[source]

Compute the calibration coefficients from previously specified gain curves, tapering weights and beam angles, load them in the hardware.

It must be followed by switch_calibration_bank() to make these active

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

Configure the 40G code.

Parameters
  • core_id (int) – id of the core

  • arp_table_entry (int) – ARP table entry ID

  • src_mac (int) – MAC address of the source

  • src_ip (str) – IP address of the source

  • src_port (int) – port of the source

  • dst_ip (str) – IP address of the destination

  • dst_port (int) – port of the destination

configure_integrated_beam_data(integration_time=None, first_channel=None, last_channel=None)[source]

Configure and start the transmission of integrated channel data with the provided integration time, first channel and last channel. Data are sent continuously until the StopIntegratedData command is run.

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=None, first_channel=None, last_channel=None)[source]

Configure and start the transmission of integrated channel data with the provided integration time, first channel and last channel. Data are sent continuously until the StopIntegratedData command is run.

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_test_generator(frequency0, amplitude0, frequency1, amplitude1, amplitude_noise, pulse_code, amplitude_pulse, load_time=0)[source]

Test generator configuration.

Parameters
  • frequency0 (float) – Tone frequency in Hz of DDC 0

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

  • frequency1 (float) – Tone frequency in Hz of DDC 1

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

  • amplitude_noise (float) – Amplitude of pseudorandom noise normalized to 26.03 ADC units, resolution 0.102 ADU

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

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

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

cpld_flash_write(bitfile)[source]

Write a program to the CPLD flash.

Parameters

bitfile (str) – the bitfile to be flashed

property current

The current of the hardware.

Returns

the current of the hardware

Return type

float

property current_tile_beamformer_frame

Return the current beamformer frame of the tile.

Returns

the tile’s current beamformer frame

Return type

int

download_firmware(bitfile)[source]

Download firmware to the board.

Parameters

bitfile (str) – the bitfile to be downloaded

property firmware_available

Return specifications of the firmware loaded on the hardware and available for use.

Returns

specifications of the firmware stored on the hardware

Return type

dict

property firmware_name

Return the name of the firmware running on the hardware.

Returns

the name of the firmware

Return type

str

property firmware_version

Returns the version of the firmware running on the hardware.

Returns

the version of the firmware

Return type

str

property fpga1_temperature

The temperature of FPGA 1.

Returns

the temperature of FPGA 1

Return type

float

property fpga2_temperature

The temperature of FPGA 2.

Returns

the temperature of FPGA 2

Return type

float

property fpgas_time

The FPGAs time.

Returns

the FPGAs time

Return type

list(int)

get_40g_configuration(core_id=- 1, arp_table_entry=0)[source]

Return a 40G configuration.

Parameters
  • core_id (int, optional) – id of the core for which a configuration is to be return. Defaults to -1, in which case all cores configurations are returned, defaults to -1

  • arp_table_entry (int) – ARP table entry to use

Returns

core configuration or list of core configurations

Return type

list(dict) or dict

property hardware_version

Returns the version of the hardware running on the hardware.

Returns

the version of the hardware (e.g. 120 for 1.2)

Return type

int

initialise()[source]

Initialise the TPM.

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

Initialise the beamformer.

Parameters
  • start_channel (int) – the start channel

  • nof_channels (int) – number of channels

  • is_first (bool) – whether this is the first (?)

  • is_last (bool) – whether this is the last (?)

property is_beamformer_running

Check if beamformer is running.

Returns

whether the beamformer is running

Return type

bool

property is_programmed

Return whether the TPM is programmed or not.

Returns

whether the TPM is programmed of not

Return type

bool

load_antenna_tapering(beam, tapering_coefficients)[source]

Loat the antenna tapering coefficients.

Parameters
  • beam (int) – beam index

  • tapering_coefficients (list(float)) – list of tapering coefficients for each antenna

load_beam_angle(angle_coefficients)[source]

Load the beam angle.

Parameters

angle_coefficients (list(float)) – list containing angle coefficients for each beam

load_calibration_coefficients(antenna, calibration_coefficients)[source]

Load calibration coefficients. These may include any rotation matrix (e.g. the parallactic angle), but do not include the geometric delay.

Parameters
  • antenna (int) – the antenna to which the coefficients apply

  • calibration_coefficients (list(int)) – a bidirectional complex array of coefficients, flattened into a list

load_calibration_curve(antenna, beam, calibration_coefficients)[source]

Load calibration curve. This is the frequency dependent response for a single antenna and beam, as a function of frequency. It will be combined together with tapering coefficients and beam angles by ComputeCalibrationCoefficients, which will also make them active like SwitchCalibrationBank. The calibration coefficients do not include the geometric delay.

Parameters
  • antenna (int) – the antenna to which the coefficients apply

  • beam (int) – the beam to which the coefficients apply

  • calibration_coefficients (list(int)) – a bidirectional complex array of coefficients, flattened into a list

load_pointing_delay(load_time)[source]

Load the pointing delay at a specified time.

Parameters

load_time (int) – time at which to load the pointing delay

property phase_terminal_count

Get phase terminal count.

Returns

phase terminal count

Return type

int

post_synchronisation()[source]

Perform post tile configuration synchronization.

property pps_delay

Returns the PPS delay of the TPM.

Returns

PPS delay

Return type

float

read_address(address, nvalues)[source]

Returns a list of values from a given address.

Parameters
  • address (int) – address of start of read

  • nvalues (int) – number of values to read

Returns

values at the address

Return type

list(int)

read_register(register_name, nb_read, offset, device)[source]

Read the values in a register.

Parameters
  • register_name (str) – name of the register

  • nb_read (int) – number of values to read

  • offset (int) – offset from which to start reading

  • device (int) – The device number: 1 = FPGA 1, 2 = FPGA 2

Returns

values from the register

Return type

list

property register_list

Return a list of registers available on each device.

Returns

list of registers

Return type

list(str)

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

Transmit a snapshot containing beamformed data.

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

  • seconds (float, optional) – when to synchronise, defaults to 0.2

send_channelised_data(number_of_samples=None, first_channel=None, last_channel=None, timestamp=None, seconds=None)[source]

Transmit a snapshot containing channelized data totalling number_of_samples spectra.

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

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

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

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

  • seconds (float, optional) – when to synchronise, defaults to 0.2

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

Transmit data from a channel continuously. It can be stopped with stop_data_transmission.

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

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

  • wait_seconds (float) – wait time before sending data

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

  • seconds (float, optional) – when to synchronise, defaults to 0.2

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

Continuously send channelised data from a single channel.

This is a special mode used for UAV campaigns.

Parameters
  • frequency (int) – sky frequency to transmit

  • round_bits (int) – which bits to round

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

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

  • timestamp (int, optional) – when to start, defaults to None

  • seconds (float, optional) – when to synchronise, defaults to 0.2

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

Transmit a snapshot containing raw antenna data.

Parameters
  • sync (bool, optional) – whether synchronised, defaults to False

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

  • seconds (float, optional) – when to synchronise, defaults to 0.2

set_beamformer_regions(regions)[source]

Set the frequency regions to be beamformed into a single beam.

Parameters

regions (list(int)) – a list encoding up to 16 regions, with each region containing a start channel, the size of the region (which must be a multiple of 8), and a beam index (between 0 and 7)

set_channeliser_truncation(array)[source]

Set the channeliser coefficients to modify the bandpass.

Parameters

array (list(int)) – an N * M array, where N is the number of input channels, and M is the number of frequency channels. This is encoded as a list comprising N, then M, then the flattened array

set_csp_rounding(rounding)[source]

Set output rounding for CSP.

Parameters

rounding (float) – the output rounding

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

Specify whether control data will be transmitted over 1G or 40G networks.

Parameters
  • mode (str) – “1g” or “10g”

  • payload_length (int, optional) – SPEAD payload length for integrated channel data, defaults to 1024

  • dst_ip (str, optional) – destination IP, defaults to None

  • src_port (int, optional) – sourced port, defaults to 0xF0D0

  • dst_port (int, optional) – destination port, defaults to 4660

  • lmc_mac (str, optional) – LMC MAC address, defaults to None

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

Configure link and size of control data.

Parameters
  • mode (str) – ‘1g’ or ‘10g’

  • channel_payload_length (int) – SPEAD payload length for integrated channel data

  • beam_payload_length (int) – SPEAD payload length for integrated beam data

  • dst_ip (str, optional) – Destination IP, defaults to None

  • src_port (int, optional) – source port, defaults to 0xF0D0

  • dst_port (int, optional) – destination port, defaults to 4660

  • lmc_mac (str, optional) – MAC address of destination, defaults to None

set_pointing_delay(delay_array, beam_index)[source]

Specifies the delay in seconds and the delay rate in seconds/second. The delay_array specifies the delay and delay rate for each antenna. beam_index specifies which beam is desired (range 0-7)

Parameters
  • delay_array (list(float)) – delay in seconds, and delay rate in seconds/second

  • beam_index (int) – the beam to which the pointing delay should be applied

set_time_delays(delays)[source]

Set coarse zenith delay for input ADC streams.

Parameters

delays (int) – the delay in samples, specified in nanoseconds. A positive delay adds delay to the signal stream

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

Start data acquisitiong.

Parameters
  • start_time (int, optional) – the time at which to start data acquisition, defaults to None

  • delay (int, optional) – delay start, defaults to 2

start_beamformer(start_time=None, duration=None)[source]

Start the beamformer at the specified time.

Parameters
  • start_time (int, optional) – time at which to start the beamformer, defaults to 0

  • duration (int, optional) – duration for which to run the beamformer, defaults to -1 (run forever)

property station_id

Station ID :return: assigned station Id value :rtype: int

stop_beamformer()[source]

Stop the beamformer.

stop_data_transmission()[source]

Stop data transmission for send_channelised_data_continuous.

stop_integrated_data()[source]

Stop integrated data.

switch_calibration_bank(switch_time=None)[source]

Switch the calibration bank (i.e. apply the calibration coefficients previously loaded by load_calibration_coefficients()).

Parameters

switch_time (int, optional) – an optional time at which to perform the switch

sync_fpgas()[source]

Synchronise the FPGAs.

property test_generator_active

Check if the test generator is active.

Returns

whether the test generator is active

Return type

bool

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

property tile_id

Tile ID :return: assigned tile Id value :rtype: int

tweak_transceivers()[source]

Tweak the transceivers.

property voltage

The voltage of the hardware.

Returns

the voltage of the hardware

Return type

float

write_address(address, values)[source]

Write a list of values to a given address.

Parameters
  • address (int) – address of start of read

  • values (list(int)) – values to write

write_register(register_name, values, offset, device)[source]

Read the values in a register.

Parameters
  • register_name (str) – name of the register

  • values (list) – values to write

  • offset (int) – offset from which to start reading

  • device (int) – The device number: 1 = FPGA 1, 2 = FPGA 2