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

<pIndex> is not implemented according to standard #182

Open
xkvkraoSICKAG opened this issue Feb 27, 2024 · 1 comment
Open

<pIndex> is not implemented according to standard #182

xkvkraoSICKAG opened this issue Feb 27, 2024 · 1 comment
Labels
C-bug Category: Bug

Comments

@xkvkraoSICKAG
Copy link

The <pIndex> offset field is used incorrectly to compute the register address.

For example:

      <Address>0xa48c</Address>
      <pIndex Offset="144">Index</pIndex>

In the above example the address should be 0xa48c + 144 * Index according to the standard.
The current code computes 0xa48c + 144 + Index which is incorrect.

Note that if no Offset is given the register’s length should be taken as the offset. This must be handled in the else-branch of the current code. If it was not for this fact the fix would be easy and I could make a PR myself. However it seems the length of the register is not available in the RegPIndex context so it requires some larger refactoring to fix.

@bschwind
Copy link
Contributor

bschwind commented Jul 4, 2024

Adding in some context from the standard (page 27):

The <pIndex Offset=”12”> element points to a node implementing an IInteger interface delivering an index. The element has an attribute Offset. The product of index and Offset is added to the address. Alternatively the offset can be taken from a node <pIndex pOffset=”OffsetValue”>. If neither Offset nor pOffest attribute is given the register’s length is taken as offset.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Bug
Projects
None yet
Development

No branches or pull requests

2 participants