olofk / ipyxact

Python-based IP-XACT parser
MIT License
121 stars 47 forks source link

Read multi dimensional array #22

Closed hgdangkhoi closed 8 months ago

hgdangkhoi commented 3 years ago

The specs say that: dim (optional; type: unsignedLongintExpression (see C.3.8)) assigns an unbounded dimension to the register, so it is repeated as many times as the value of the dim elements

So I tried to have multiple dim tag, and the code compiles:

<ipxact:register>
          <ipxact:name>WDT_CR</ipxact:name>
          <ipxact:dim>2</ipxact:dim>
          <ipxact:dim>3</ipxact:dim>

However, I am having trouble accessing the second dim dimension, if I do register.dim I would get 2 only. My yaml struct is:

register:
  MEMBERS:
    name: str
    description: str
    dim: IpxactInt
    access: str
    addressOffset: IpxactInt
    size: IpxactInt
    range: IpxactInt
    volatile: IpxactBool
    isPresent: str

How would I access the multiple dim tag?

olofk commented 8 months ago

I would suggest moving to the new API introduced in version 0.3.0 which should handle more complex access patterns