Skip to content

Instantly share code, notes, and snippets.

@berndca
Created October 24, 2016 11:51
Show Gist options
  • Save berndca/8a9a95eb6a20a9b07e2c9a44045ec810 to your computer and use it in GitHub Desktop.
Save berndca/8a9a95eb6a20a9b07e2c9a44045ec810 to your computer and use it in GitHub Desktop.
IPXACT catalog Example
<?xml version="1.0" encoding="UTF-8"?>
<ipxact:catalog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ipxact="http://www.accellera.org/XMLSchema/IPXACT/1685-2014"
xsi:schemaLocation="http://www.accellera.org/XMLSchema/IPXACT/1685-2014/
http://www.accellera.org/XMLSchema/IPXACT/1685-2014/index.xsd">
<ipxact:vendor>VLSI-EDA</ipxact:vendor>
<ipxact:library>PoC</ipxact:library>
<ipxact:name>PoC</ipxact:name>
<ipxact:version>0.1</ipxact:version>
<ipxact:description> IP Core Library - Published and maintained by the Chair for VLSI Design,
Diagnostics and Architecture, Faculty of Computer Science, Technische Universität Dresden,
Germany http://vlsi-eda.inf.tu-dresden.de/ </ipxact:description>
<ipxact:catalogs>
<ipxact:ipxactFile>
<ipxact:vlnv vendor="VLSI-EDA" library="PoC" name="uart" version="0.1"/>
<ipxact:name>https://github.com/VLSI-EDA/PoC</ipxact:name>
<ipxact:description>Simple UART</ipxact:description>
</ipxact:ipxactFile>
<ipxact:ipxactFile>
<ipxact:vlnv vendor="VLSI-EDA" library="PoC" name="stat_Minimum" version="0.1"/>
<ipxact:name>https://github.com/VLSI-EDA/PoC</ipxact:name>
<ipxact:description>calculate minimums of an input stream</ipxact:description>
</ipxact:ipxactFile>
</ipxact:catalogs>
</ipxact:catalog>
@Paebbels
Copy link

Hello Bernd,

thanks for your short example. I have discussed the IPXACT file support with @mzabeltud.
We concluded, that we could implement an export feature into our Python based infrastructure, that generates such a catalog file. We could run the export in every Travis-CI run and upload the "build results" back to GitHub.

I created a GitHub repository for all IP-XACT schema definition versions:
https://github.com/UnofficialRepos/IPXACT-Schema?ts=2

Maybe I'll create a DOM for IP-XACT, so one could easily read and write at least a subset of such files. I still need to figure out if IP-XACT is a valid XML format with its multiple root elements ...

@berndca
Copy link
Author

berndca commented Oct 24, 2016

The whole point of the XML format is that all files can be validated with standard validation software. On Linux I'm using xmllint which is part of libxml2. http://xmlsoft.org/xmllint.html Before I release any IPXACT files I run validation to make sure it passes.

xmllint --schema <path to index.xsd> --noout *.xml

AFAIK IPXACT does not have multiple root elements. Can you elaborate? Where did you see that?

@Paebbels
Copy link

You can use for example catalog, designConfiguration, component as a root element in files with the same extension. I evaluated that. It's a loophole in XML schema definitions. It's possible to prevent such a usage, but most XSD editors/generators don't XSD files in such a way.

The same is true for XHTML, where you can define a valid XHTML document with this content:

<head xmlns="http://www.w3.org/1999/xhtml">
  <title>foo</title>
</head>

but human persons would consider this a valid document :). The loophole is generated by defining multiple root level XML element definitions in an XSD. This can be prevented by using element references and incomplete types. (I hope that's the right wording in the XSD, XSI context.)

@berndca
Copy link
Author

berndca commented Oct 24, 2016

I'm not sure I understand what you are saying. Are you implying that multiple root elements can occur in the same file or do you mean that files ending in .xml could have any (single) root element defined by IPXACT and you would not know what type of document you are dealing with before having parsed it?

@Paebbels
Copy link

Paebbels commented Oct 24, 2016

Hello Bernd,

I uploaded my first simple implementation of a IP-XACT DOM for Python.
https://github.com/Paebbels/pyIPXACT?ts=2

According to the standard, it's a bit more complex to describe PoC. A name tag in an ipxactFile tag references another IP-XACT file, which contains a catalog description. This catalog can then contain one or more component descriptions.

Kind regards
Patrick

@berndca
Copy link
Author

berndca commented Oct 25, 2016

I agree, ultimately we want the URI in ipxactFile.name to point to the IPXACT component file. Please note that we need to complete path in this field, i.e. either a relative path from the catalog or a complete URL.

Thanks, Bernd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment