xPDK BB - Using BB/cell definition

To ensure the models are well defined, the simulation XMLs contain a cell definition also. This allows to validate the ports and parameters. You can fully include a BB/cell definition, but this is not needed as you only need the name, ports and parameters.
Instead of manual work, you can use xsltproc and simply pick up the definitions from the full file.
xsltproc --xinclude -stringparam BB myBB1 xPDK_BB_to_Simulation.xsl xPDK_BB.xml
Download: xPDK_BB_to_Simulation.xsl

This should give something like:
<bb name="myBB1">
  <port label="orgx"/>
  <port label="in0"/>
  <port label="out0"/>
  <parameters>
    <parameter name="L"/>
    <parameter name="IntSet"/>
    <parameter name="StringSet"/>
    <parameter name="Width"/>
    <parameter name="Length"/>
  </parameters>
</bb>
Using bash you can thus use something like:

for B in `xsltproc --xinclude  xPDK_BB_list.xsl xPDK_BB.xml` ; do
  xsltproc --xinclude -stringparam BB $B xPDK_BB_to_Simulation.xsl xPDK_BB.xml | tee $TMP/$B.xml
done
which picks up all cell definitions and drops them in the $TMP directory. If you want to extract the full BB/cell definition, you can use xmllint also:

for B in `xsltproc --xinclude  xPDK_BB_list.xsl xPDK_BB.xml` ; do
  xmllint --xpath 'xPDK_BB/cell[@name="$B"]' xPDK_BB.xml | tee $TMP/$B.xml
done
which uses the xpath route to select a section of the XML file.