Skip to content

Commit a94be0c

Browse files
strainmikemgumble
authored andcommitted
Ignoring FXP types with incomplete metadata (#26)
LabVIEW Communications 2.0 shipped with an issue where it doesn't output all of the XML required for FXP types. The Python API will now skip a register or FIFO that doesn't contain all of the needed metadata.
1 parent 954f058 commit a94be0c

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

nifpga/bitfile.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,12 @@ class _FXP(_BaseType):
381381
def __init__(self, name, type_xml):
382382
super(_FXP, self).__init__(name)
383383
self._datatype = DataType.Fxp
384-
self._signed = True if type_xml.find("Signed").text.lower() == 'true' else False
384+
signed_tag = type_xml.find("Signed")
385+
if signed_tag is None:
386+
raise UnsupportedTypeError("Unsupported FXP type encountered. This bitfile "
387+
"was likely compiled with LabVIEW Communications 2.0. "
388+
"Recompile with LabVIEW Communications 2.1 or later.")
389+
self._signed = True if signed_tag.text.lower() == 'true' else False
385390
overflow_enabled_xml = type_xml.find("IncludeOverflowStatus")
386391
if overflow_enabled_xml is not None:
387392
self._overflow_enabled = True if overflow_enabled_xml.text.lower() == 'true' else False

nifpga/tests/allregistertypes.lvbitx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1872,6 +1872,31 @@
18721872
<AccessMayTimeout>false</AccessMayTimeout>
18731873
<RegisterNode>false</RegisterNode>
18741874
<SubControlList/>
1875+
</Register>
1876+
<Register>
1877+
<Name>Comms 2.0 FXP</Name>
1878+
<Hidden>false</Hidden>
1879+
<Indicator>true</Indicator>
1880+
<Datatype>
1881+
<FXP>
1882+
<Name>Comms 2.0 FXP</Name>
1883+
</FXP>
1884+
</Datatype>
1885+
<FlattenedType>13008000000000010058405F0311003F00000020000000010000000100000000000000000000003F000000207FFFFFFFFFFFFFFF00000001FFFFFFE200000000000000011A4F7574707574204658502036332D62697420556E7369676E65640000010000000000000000000000000000</FlattenedType>
1886+
<Grouping/>
1887+
<Offset>98556</Offset>
1888+
<SizeInBits>63</SizeInBits>
1889+
<Class>18</Class>
1890+
<Internal>false</Internal>
1891+
<TypedefPath/>
1892+
<TypedefRelativePath/>
1893+
<ID>63</ID>
1894+
<Bidirectional>true</Bidirectional>
1895+
<Synchronous>false</Synchronous>
1896+
<MechanicalAction>Switch When Pressed</MechanicalAction>
1897+
<AccessMayTimeout>false</AccessMayTimeout>
1898+
<RegisterNode>false</RegisterNode>
1899+
<SubControlList/>
18751900
</Register>
18761901
<Register>
18771902
<Name>Output FXP 63-bit Signed</Name>

0 commit comments

Comments
 (0)