SystemRDL / PeakRDL-ipxact

Import and export IP-XACT XML register models
http://peakrdl-ipxact.readthedocs.io
GNU General Public License v3.0
31 stars 10 forks source link

IPXACT importer is arraying registers when it is not required. #20

Closed willy134 closed 10 months ago

willy134 commented 1 year ago

I have some IPXACT files that are from 3rd party ip with the register/dim value set to 1. Looking at the ipxact documentation this is the default. PeakRDL interprets this as an arrayed register with dimension of 1, which is kind of correct, but when I dump the html documentation the register is shown with the array square brackets[].

It would be nice if the ipxact importer checked the size of the dimension before turning the register into an arrayed register. I did a quick hack of changing: if 'dim' in d: to if 'dim' in d and d['dim'][0] > 1:

That did remove the extra array indicators. However, I am pretty sure that is not the appropriate way to actually fix this.

amykyta3 commented 11 months ago

Looking at the ipxact documentation this is the default

Can you point me to where you see that? I checked the spec and it shows the <ipxact:dim> tag as optional, and that if it is present it implies the node is an array. There is no mention of a default value of 1 that I could find.

willy134 commented 11 months ago

From the Accellera IP-XACT User Guide (March 2018), the bottom paragraph of page 28

Copied here:

A register element describes the software interface to a register. It has a name to identify the element. It can have a description to provide a human-readable description. A register can have a dim element describing the dimension of the register. If dim is not described, then its value defaults to 1. Furthermore, a register has an addressOffset that describes the location of the register expressed in addressUnitBits as offset to the starting address of the containing addressBlock or the containing registerFile. The size of a register describes the number of bits in the register. A register size cannot exceed the width of a containing addressBlock.

Looking at the actual IEEE standard, it isn't as clear. All I see is that if the node has the array element, dim is mandatory (section C.4.3.2). It is ambiguous as what should happen if the dim is set to 1.