ska_low_cbf_tango_cnic Package
ARGS FPGA Tango wrapper.
- class ska_low_cbf_tango_cnic.cnic_device.CnicDevice(*args, **kwargs)
Low CBF CNIC Tango Device.
- CallMethod(request)
Call an ICL method.
- Parameters:
request –
JSON string, containing at least a method to call. To call a top level (
FpgaPersonality
) method with no arguments:{"method": "reset"}
To call a peripheral method with arguments:
{"peripheral": "adder", "method": "sum", "arguments": {"x": 1, "y": 2}}
- Return type:
- Returns:
method return value, converted to string
- ConfigurePulsarMode(config_str)
Configure the Virtual Digitiser pulsar mode.
- Parameters:
config_str – Pulsar parameters as JSON, e.g.
{ "enable": true, "sample_count": [ 32, 256, 32] }
where
sample_count
entries (all >= 16) are, in order:number of samples before start
number of samples during ON period
number of samples during OFF period
see https://jira.skatelescope.org/browse/PERENTIE-2106
sample_count
is optional, if omitted the old values remain active
- ConfigureSourcesFromYAML(sources)
Configure VD Data Generator sources (for debugging use!).
- Parameters:
sources – YAML
- ConfigureVirtualDigitiser(config)
Configure the Virtual Digitiser.
- Parameters:
config – JSON structure along the lines of:
{ "sps_packet_version": 3, "stream_configs": [ # a list of dicts - one per SPEAD stream { "scan": 123_1, "subarray": 1, "station": 345, "substation": 1, "frequency": 66, "beam": 16, "sources": { "x": [ {"tone": True, "fine_frequency": 16, "scale": 8000}, ], "y": [ {"tone": True, "fine_frequency": 16, "scale": 8000}, ] }, # ... ] }
JSON dictionary keys are the method arguments defined in
cnic_fpga.CnicFpga.configure_vd()
Input also accepts the old format (a subset), which is only the above
stream_configs
value (as a list, not a dictionary).
- SelectPersonality(request)
Select a new personality to download & program FPGA.
- Parameters:
request –
Personality name & version (JSON). e.g.
{ "personality": "cnic", "version": "0.1.5", "source": "gitlab", "platform": 3, "memory": "2Gs:2Gs" }
All keys are optional, see
_select_personality
for defaults.
- StartRegisterLog(filename)
Start register transaction logging.
- Parameters:
filename – yes, a filename
- Raises:
RuntimeError – if no FPGA core active
- StartSourceDelays(fqdn)
Subscribe to delay polynomials & begin applying delays for our VD data streams.
CNIC will start emitting VD data packets after delay updates are received.
The delay source device is assumed to have attributes like ‘source_s{subarray:02d}_b{beam:02d}_{source}’ (each subarray beam has 4 sources)
- StartTmSourceDelays(subarray_bm_uris)
Command allows use of TM delay polynomials.
Actions are: 1. Subscribe to TM delay polynomials that describe relative delays of the signals received at each stations from sky sources. (The delays are a function of the real-time direction of each sky source - directions of sources are specified as parameters to the delay-polynomial device, outside of CNIC.) As a simplification, in this mode of operation, there is only one direction (one polynomial source) for all 4 sources that can be generated for a beam. 2. Apply delays to the data streams produced by the CNIC, so that simulated sky data is output as SKA SPEAD packet streams.
CNIC will begin sending data packets when delay updates begin to be received.
The ‘ConfigureVirtualDigitiser’ command should have been issued before this one. It parameters set the subarrays, stations, and substations for which the CNIC is to generate data. The arguments to StartTmSource delays must include an entry for every subarray and beam in ConfigureVirtualDigitiser parameters.
- Parameters:
subarray_bm_uris –
JSON dictionary containing a Tango URI for each station beam delay source. e.g. if subarray 3 has station beams 7 & 12 and subarray 6 has station beam 4, we expect the JSON version of:
{ 3: {7: ["uri_1", "attr_1"], 12: ["uri_2", "attr_2"]}, 6: {4: ["uri_3", "attr_3"]}, }
- StopSourceDelays()
Unsubscribe from the source delay generator & cease applying delays.
- __add_attr_from_icl_field(name, field)
Create a Tango attribute from an IclFpgaField object.
- _check_core()
Throw exception if FPGA core is missing otherwise just proceed.
- _create_core(personality_class, memory)
Create our _core FpgaPersonality object.
- Parameters:
personality_class (
type
[FpgaPersonality
]) – Derived type of FpgaPersonality to use.memory (
str
) – memory configuration string (see mem_parse).
- _create_fpga_attrs()
Create Tango attributes from ICL attributes.
- _delete_fpga_attrs()
Delete all FPGA ICL attributes.
- _drop_xrt_driver()
Release XRT driver object(s), as they may hold an Alveo card lock.
Normally called before switching FPGA personality.
- _field_from_name(name)
Find the
IclFpgaField
object for a given attribute name.e.g.
“top_level” -> self._core.top_level
“peripheral_name__field_name” -> self._core.peripheral_name.field_name
- Return type:
- Returns:
The referenced
IclFpgaField
object
- _read_fpga_attr(attr)
Update an FPGA attribute with its current value.
- _select_personality(personality='cnic', version='', source='nexus', platform=3, memory='4095Ms:1Gi:4095Ms:1Gi', **kwargs)
Download the specified personality.
- _write_fpga_attr(attr)
Write a value to the FPGA.
- activePersonality()
Read the currently active personality (firmware).
- Return type:
- Returns:
‘None’ if none loaded
- delete_device()
Delete resources allocated in init_device.
This method allows for any memory or other resources allocated in the init_device method to be released. This method is called by the device destructor and by the device Init command.
- init_device()
Initialise.
- is_ConfigureSourcesFromYAML_allowed()
Experiment.
- ska_low_cbf_tango_cnic.cnic_device._split_icl_attr_name(name)
Decode a dynamic FPGA attribute name into peripheral & field names.
e.g.
“top_level” -> None, “top_level”
“peripheral_name__field_name” -> “peripheral_name”, “field_name”
- ska_low_cbf_tango_cnic.cnic_device.main(args=None, **kwargs)
Launch device server.