Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add enable_match_fail_combination method to nidigital API #2076

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ All notable changes to this project will be documented in this file.
* #### Removed
* ### `nidigital` (NI-Digital Pattern Driver)
* #### Added
* Methods Added:
* `enable_match_fail_combination`
* #### Changed
* #### Removed
* ### `nidmm` (NI-DMM)
Expand Down
3 changes: 3 additions & 0 deletions build/templates/tox-system_tests.ini.mako
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ deps =
% if uses_other_wheel:
${wheel_env_no_py}: build

% endif
% if module_name == 'nidigital':
${module_name}-system_tests: nisync
% endif
${module_name}-system_tests: pytest
${module_name}-system_tests: coverage
Expand Down
13 changes: 13 additions & 0 deletions docs/nidigital/class.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1326,6 +1326,19 @@ disable_sites
Example: :py:meth:`my_session.disable_sites`


enable_match_fail_combination
-----------------------------

.. py:currentmodule:: nidigital.Session

.. py:method:: enable_match_fail_combination()

Configures digital pattern instruments and the PXIe-6674T timing and synchronization instrument to combine pattern comparison results and control subsequent pattern execution across digital pattern instruments based on those results. You must initialize the PXIe-6674T using NI-Sync and call this method from a multi-instrument session.





enable_sites
------------

Expand Down
9 changes: 9 additions & 0 deletions generated/nidigital/nidigital/_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def __init__(self, ctypes_library):
self.niDigital_CreateTimeSet_cfunc = None
self.niDigital_DeleteAllTimeSets_cfunc = None
self.niDigital_DisableSites_cfunc = None
self.niDigital_EnableMatchFailCombination_cfunc = None
self.niDigital_EnableSites_cfunc = None
self.niDigital_FetchCaptureWaveformU32_cfunc = None
self.niDigital_FetchHistoryRAMCycleInformation_cfunc = None
Expand Down Expand Up @@ -346,6 +347,14 @@ def niDigital_DisableSites(self, vi, site_list): # noqa: N802
self.niDigital_DisableSites_cfunc.restype = ViStatus # noqa: F405
return self.niDigital_DisableSites_cfunc(vi, site_list)

def niDigital_EnableMatchFailCombination(self, session_count, sessions, sync_session): # noqa: N802
with self._func_lock:
if self.niDigital_EnableMatchFailCombination_cfunc is None:
self.niDigital_EnableMatchFailCombination_cfunc = self._get_library_function('niDigital_EnableMatchFailCombination')
self.niDigital_EnableMatchFailCombination_cfunc.argtypes = [ViUInt32, ctypes.POINTER(ViSession), ViSession] # noqa: F405
self.niDigital_EnableMatchFailCombination_cfunc.restype = ViStatus # noqa: F405
return self.niDigital_EnableMatchFailCombination_cfunc(session_count, sessions, sync_session)

def niDigital_EnableSites(self, vi, site_list): # noqa: N802
with self._func_lock:
if self.niDigital_EnableSites_cfunc is None:
Expand Down
8 changes: 8 additions & 0 deletions generated/nidigital/nidigital/_library_interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,14 @@ def disable_sites(self, site_list): # noqa: N802
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
return

def enable_match_fail_combination(self, sessions, sync_session): # noqa: N802
session_count_ctype = _visatype.ViUInt32(0 if sessions is None else len(sessions)) # case S160
sessions_ctype = _get_ctypes_pointer_for_buffer(value=sessions, library_type=_visatype.ViSession) # case B550
sync_session_ctype = _visatype.ViSession(sync_session) # case S110
error_code = self._library.niDigital_EnableMatchFailCombination(session_count_ctype, sessions_ctype, sync_session_ctype)
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
return

def enable_sites(self, site_list): # noqa: N802
vi_ctype = _visatype.ViSession(self._vi) # case S110
site_list_ctype = ctypes.create_string_buffer(site_list.encode(self._encoding)) # case C010
Expand Down
8 changes: 8 additions & 0 deletions generated/nidigital/nidigital/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -3429,6 +3429,14 @@ def delete_all_time_sets(self):
'''
self._interpreter.delete_all_time_sets()

@ivi_synchronized
def enable_match_fail_combination(self, sync_session):
'''enable_match_fail_combination

Configures digital pattern instruments and the PXIe-6674T timing and synchronization instrument to combine pattern comparison results and control subsequent pattern execution across digital pattern instruments based on those results. You must initialize the PXIe-6674T using NI-Sync and call this method from a multi-instrument session.
'''
self._interpreter.enable_match_fail_combination([self._interpreter.get_session_handle()], sync_session.session_handle)

@ivi_synchronized
def load_specifications_levels_and_timing(self, specifications_file_paths=None, levels_file_paths=None, timing_file_paths=None):
'''load_specifications_levels_and_timing
Expand Down
9 changes: 9 additions & 0 deletions generated/nidigital/nidigital/unit_tests/_mock_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ def __init__(self):
self._defaults['DeleteAllTimeSets']['return'] = 0
self._defaults['DisableSites'] = {}
self._defaults['DisableSites']['return'] = 0
self._defaults['EnableMatchFailCombination'] = {}
self._defaults['EnableMatchFailCombination']['return'] = 0
self._defaults['EnableSites'] = {}
self._defaults['EnableSites']['return'] = 0
self._defaults['FetchCaptureWaveformU32'] = {}
Expand Down Expand Up @@ -407,6 +409,11 @@ def niDigital_DisableSites(self, vi, site_list): # noqa: N802
return self._defaults['DisableSites']['return']
return self._defaults['DisableSites']['return']

def niDigital_EnableMatchFailCombination(self, session_count, sessions, sync_session): # noqa: N802
if self._defaults['EnableMatchFailCombination']['return'] != 0:
return self._defaults['EnableMatchFailCombination']['return']
return self._defaults['EnableMatchFailCombination']['return']

def niDigital_EnableSites(self, vi, site_list): # noqa: N802
if self._defaults['EnableSites']['return'] != 0:
return self._defaults['EnableSites']['return']
Expand Down Expand Up @@ -1179,6 +1186,8 @@ def set_side_effects_and_return_values(self, mock_library):
mock_library.niDigital_DeleteAllTimeSets.return_value = 0
mock_library.niDigital_DisableSites.side_effect = MockFunctionCallError("niDigital_DisableSites")
mock_library.niDigital_DisableSites.return_value = 0
mock_library.niDigital_EnableMatchFailCombination.side_effect = MockFunctionCallError("niDigital_EnableMatchFailCombination")
mock_library.niDigital_EnableMatchFailCombination.return_value = 0
mock_library.niDigital_EnableSites.side_effect = MockFunctionCallError("niDigital_EnableSites")
mock_library.niDigital_EnableSites.return_value = 0
mock_library.niDigital_FetchCaptureWaveformU32.side_effect = MockFunctionCallError("niDigital_FetchCaptureWaveformU32")
Expand Down
1 change: 1 addition & 0 deletions generated/nidigital/tox-system_tests.ini
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ commands =
deps =
nidigital-wheel_dep: build

nidigital-system_tests: nisync
nidigital-system_tests: pytest
nidigital-system_tests: coverage
nidigital-system_tests: numpy
Expand Down
81 changes: 81 additions & 0 deletions src/nidigital/metadata/functions_addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,3 +535,84 @@
],
},
}

functions_additional_enable_match_fail_combination = {
'EnableMatchFailCombination': {
'codegen_method': 'yes',
'method_templates': [
{
'documentation_filename': 'default_method',
'library_interpreter_filename': 'enable_match_fail_combination',
'method_python_name_suffix': '',
'session_filename': 'none',
}
],
'documentation': {
'description': 'Configures digital pattern instruments and the PXIe-6674T timing and synchronization instrument to combine pattern comparison results and control subsequent pattern execution across digital pattern instruments based on those results. You must initialize the PXIe-6674T using NI-Sync and use the niTClk Synchronize function to synchronize instruments before calling the niDigital_EnableMatchFailCombination function.\n'
},
'included_in_proto': False,
'parameters': [
{
'direction': 'in',
'documentation': {
'description': 'Number of sessions.\n'
},
'name': 'sessionCount',
'type': 'ViUInt32'
},
{
'direction': 'in',
'documentation': {
'description': 'The specified array of sessions synchronized using NI-TClk.\n'
},
'name': 'sessions',
'size': {
'mechanism': 'passed-in',
'value': 'sessionCount'
},
'type': 'ViSession[]'
},
{
'direction': 'in',
'documentation': {
'description': 'The specified NI-Sync session.\n'
},
'name': 'syncSession',
'type': 'ViSession'
}
],
'returns': 'ViStatus'
},
'FancyEnableMatchFailCombination': {
'python_name': 'enable_match_fail_combination',
'codegen_method': 'python-only',
'method_templates': [
{
'documentation_filename': 'default_method',
'library_interpreter_filename': 'none',
'method_python_name_suffix': '',
'session_filename': 'fancy_enable_match_fail_combination',
}
],
'documentation': {
'description': 'Configures digital pattern instruments and the PXIe-6674T timing and synchronization instrument to combine pattern comparison results and control subsequent pattern execution across digital pattern instruments based on those results. You must initialize the PXIe-6674T using NI-Sync and call this method from a multi-instrument session.\n'
},
'included_in_proto': True,
'parameters': [
{
'direction': 'in',
'name': 'vi',
'type': 'ViSession'
},
{
'direction': 'in',
'documentation': {
'description': 'The specified NI-Sync session.\n'
},
'name': 'syncSession',
'type': 'ViSession'
}
],
'returns': 'ViStatus'
},
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<PinLevelsFile xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" schemaVersion="1.0" xmlns="http://www.ni.com/Semiconductor/PinLevels">
<PinLevelsSheet>
<DigitalPinLevelSets>
<DigitalPinLevelSet pin="PinGroup1">
<Vil>0</Vil>
<Vih>3.3</Vih>
<Vol>0.8</Vol>
<Voh>2</Voh>
<Vterm>0</Vterm>
<TerminationMode>HighZ</TerminationMode>
</DigitalPinLevelSet>
</DigitalPinLevelSets>
</PinLevelsSheet>
</PinLevelsFile>
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<PinMap xmlns="http://www.ni.com/TestStand/SemiconductorModule/PinMap.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" schemaVersion="1.2">
<Instruments>
<NIDigitalPatternInstrument name="PXI1Slot2" numberOfChannels="32" />
<NIDigitalPatternInstrument name="PXI1Slot5" numberOfChannels="32" />
</Instruments>
<Pins>
<DUTPin name="DUTPin1" />
<DUTPin name="DUTPin2" />
<DUTPin name="DUTPin3" />
<DUTPin name="DUTPin4" />
</Pins>
<PinGroups>
<PinGroup name="PinGroup1">
<PinReference pin="DUTPin1" />
<PinReference pin="DUTPin2" />
<PinReference pin="DUTPin3" />
<PinReference pin="DUTPin4" />
</PinGroup>
</PinGroups>
<Sites>
<Site siteNumber="0" />
<Site siteNumber="1" />
</Sites>
<Connections>
<Connection pin="DUTPin1" siteNumber="0" instrument="PXI1Slot2" channel="0" />
<Connection pin="DUTPin2" siteNumber="0" instrument="PXI1Slot2" channel="1" />
<Connection pin="DUTPin3" siteNumber="0" instrument="PXI1Slot2" channel="2" />
<Connection pin="DUTPin4" siteNumber="0" instrument="PXI1Slot2" channel="3" />
<Connection pin="DUTPin1" siteNumber="1" instrument="PXI1Slot5" channel="0" />
<Connection pin="DUTPin2" siteNumber="1" instrument="PXI1Slot5" channel="1" />
<Connection pin="DUTPin3" siteNumber="1" instrument="PXI1Slot5" channel="2" />
<Connection pin="DUTPin4" siteNumber="1" instrument="PXI1Slot5" channel="3" />
</Connections>
</PinMap>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Specifications xmlns:f="http://www.ni.com/schemas/Semiconductor/Formula.xsd" schemaVersion="1.0" xmlns="http://www.ni.com/schemas/Semiconductor/Specifications.xsd">
<Section name="timing">
<f:Formula symbol="period">
<f:Definition>1 µs</f:Definition>
</f:Formula>
</Section>
<Description />
</Specifications>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<TimingFile xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" schemaVersion="1.0" xmlns="http://www.ni.com/Semiconductor/Timing">
<TimingSheet>
<TimeSets>
<TimeSet name="tset0">
<Period>timing.period</Period>
<PinEdges>
<PinEdge pin="PinGroup1">
<DriveNonReturn>
<On>0 ns</On>
<Data>timing.period / 2</Data>
<Off>timing.period</Off>
</DriveNonReturn>
<CompareStrobe>
<Strobe>(3 * timing.period) / 4</Strobe>
</CompareStrobe>
<DataSource>Pattern</DataSource>
</PinEdge>
</PinEdges>
</TimeSet>
</TimeSets>
</TimingSheet>
</TimingFile>
16 changes: 16 additions & 0 deletions src/nidigital/system_tests/test_system_nidigital.py
Original file line number Diff line number Diff line change
Expand Up @@ -1330,6 +1330,22 @@ class TestLibrary(SystemTests):
def session_creation_kwargs(self):
return {}

def test_enable_match_fail_combination(self, multi_instrument_session):
import nisync

test_name = self.test_enable_match_fail_combination.__name__
multi_instrument_session.load_pin_map(self.get_test_file_path(test_name, 'pin_map.pinmap'))
multi_instrument_session.load_pattern(self.get_test_file_path(test_name, 'pattern.digipat'))
multi_instrument_session.load_specifications_levels_and_timing(
specifications_file_paths=self.get_test_file_path(test_name, 'specifications.specs'),
levels_file_paths=self.get_test_file_path(test_name, 'pin_levels.digilevels'),
timing_file_paths=self.get_test_file_path(test_name, 'timing.digitiming'))
multi_instrument_session.apply_levels_and_timing(levels_sheet='pin_levels', timing_sheet='timing')
with nisync.Session('6674T') as sync_session:
multi_instrument_session.enable_match_fail_combination(sync_session)
multi_instrument_session.burst_pattern(start_label='new_pattern')
multi_instrument_session.read_sequencer_flag(nidigital.SequencerFlag.FLAG0)


class TestGrpc(SystemTests):
@pytest.fixture(scope='class')
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## This file is empty. We won't support gRPC, for now.
## Even though gRPC Device supports the function, the nisync Python API lacks gRPC support, so there's no point.
## If a user tries to call enable_match_fail_combination with a session runing on a gRPC Device Server, they will get an error
## because the method does not exist in _grpc_stub_interpreter.py.
## Most likely it will be an AttributeError, though it hasn't been tested.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

def enable_match_fail_combination(self, sessions, sync_session): # noqa: N802
session_count_ctype = _visatype.ViUInt32(0 if sessions is None else len(sessions)) # case S160
sessions_ctype = _get_ctypes_pointer_for_buffer(value=sessions, library_type=_visatype.ViSession) # case B550
sync_session_ctype = _visatype.ViSession(sync_session) # case S110
error_code = self._library.niDigital_EnableMatchFailCombination(session_count_ctype, sessions_ctype, sync_session_ctype)
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
return
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<%page args="f, config, method_template"/>\
<%
import build.helper as helper
%>\
def ${f['python_name']}(self, sync_session):
'''${f['python_name']}

${helper.get_function_docstring(f, False, config, indent=8)}
'''
self._interpreter.enable_match_fail_combination([self._interpreter.get_session_handle()], sync_session.session_handle)