xPDK BB

This section in a xPDK extends from xPDK_Header, so we will only describe the fields that are added with respect to the normal header.

This BB information contains the typical shared data between software: This information is needed in schematic design and circuit simulation as well as in layout.

This scope is therefore fairly broad and future extensions are likely to capture more information. The current common fields provide for a rich design kit already compared to other formats, while adressing different software.
Vendor extensions are supported in this section, so software specific details are possible therefore to tune behavior.

XSD

The schema file can be downloaded or viewed: xPDK_BB. It needs the xPDK_Base also, which is referenced via the http-link in the file.

xPDK_Layout

Define basic technology info.

The technology file contains the xsection information which is needed in the port to make sure the references are correct. To get this information, you can include a full technology file or just query the data using xsltproc and keep the (xs:include expanded) meta data file short.
full file
 <!-- Full tech file -->
 <xi:include href="xPDK_Layout.xml" />

Technology file → summary

You can run the following to summarize a technology file for the (embedded or xs:include'd) xsection list.
xsltproc --xinclude xPDK_xsection_list.xsl xPDK_Layout.xml
This should give the following output:
full file
<xsection name="WGbase"/>
<xsection name="WG"/>
<xsection name="Doc"/>
<xsection name="DocGds"/>

The XSLT file can be downloaded: xPDK_xsection_list.xsl.
XSD(xPDK_Layout):
Include the technology file and/or define them locally.
Include a full technology file to avoid copy/paste errors and other data inconsistencies. See xPDK_Layout.xml for how to do this.

xsection

You can copy the output of the summary generation into the XML file and/or define additional xsection. As only the name is needed, the list is short.
full file
 <!-- Local tech file, eg. from summary -->
 <xsection name="Waveguide" />
 <xsection name="Metal1" />
 <xsection name="Metal2" />
XSD(xsection):
Define local xsection's which can be added to a technology file or be just the a sub-set of the technology file to reduce file size and make the files stand-alone.

Sometimes it is handy to add xsection's for port's that are not defined in the basic technology file. Such a list can include parts of the technology file instead of the full include.
Note - adding xsection's here that include GDS layer mapportgs is ok for the XML, but you risk that the software that only uses the technology file does not use all data.

xPDK_CompactModel_List

See building block type for the more details on what this section defines. The preferred route is to include such files rather then embedding them.
full file
 <!-- Include compact model file -->
 <xi:include href="xPDK_CompactModel_List.xml" />
XSD(xPDK_CompactModel_List):
Include the defined compact models for easy checks and/or define them locally.
Using the <xi:include ... /> is the preferred route as it allows to share the definition between design kits.

bb

XSD(bb):
Define a series of building blocks, sometimes called cell or pcell also (EDA terminology).
This section is used by both layout and schematic / circuit oriented software to allow designers to create their circuits. In general it does not make sense to have design kits without BBs in there. However it is not a required to have them - there are gds layer / process only design kits also.
full file
<bb name="myBB_0">
 <!-- put real definitions in here - see other sections. -->
</bb>

<bb name="myBB_1">
 <!-- put real definitions in here - see other sections. -->
</bb>

Extensive example

This example is part of the full file below. It is mostly listed here so you do not need to download it. It shows many fields and properties that can be defined and these are described in the child pages.
This file includes the technology file and adds the Met, Met1 and Met2 xsection's in the meta data to show both options work.

Use:
xmllint --format --xinclude --schema xPDK_BB.xsd xPDK_BB.xml
to validate.
full file

 <globals>
  <global name="glbA" type="int"> 4 </global>
  <global name="glbB" type="double"> exp(glbA*3) </global>
  <!-- triggers "duplicate key-sequence" glbB
  <global name="glbB" type="double" >exp(glbA*3)</global>
  -->
 </globals>

 <extend>
   <!-- Series of supplier extensions for supplier side for trace-ability.
  -->
  <foundryDatabase app="SQL" version="2.0.0">See ISO forms - software release documents</foundryDatabase>
  <foundryDatabase app="GUI" version="1.0.42">See ISO forms - software release documents</foundryDatabase>
  <foundryReporter waveguide_module="2.0.1">Loss, neff, groupindex</foundryReporter>
  <foundryReporter active_module="1.2.9">groupindex</foundryReporter>
  <labRuns>march-june 2021, december 2021-april 2022.</labRuns>
 </extend>

 <!-- Include the technology file to ensure correct references.
   -->
  <xi:include href="xPDK_Layout.xml" parse="xml" />
  <!-- Include the compact model list to ensure correct references.
   -->
  <xi:include href="xPDK_CompactModel_List.xml" parse="xml" />


 <!-- Some xsection's for port's that are not defined in the basic technology
    - file. Such a list can include parts of the technology file instead of
    - the full include.
    - Note - adding xsection's here that include GDS layer mapportgs is ok for
    - the XML, but you risk that the software that only uses the technology
    - file does not use all data.
    -->
 <xsection name="Met" />
 <xsection name="Met1" /><xsection name="Met2" />


 <!-- very simple BB -->
 <bb name="myBB">
  <library>Basic components/demo</library>
  <version>1.0</version>
  <!-- implicit layout ports, here just for testing the portref. -->
  <port label="bil" /> <port label="bcl" /> <port label="bol" />
  <port label="bic" /> <port label="bcc" /> <port label="boc" />
  <port label="bir" /> <port label="bcr" /> <port label="bor" />
  <port label="org" />


  <port label="in0">
    <domain>Optical</domain>
    <position> <!-- units for x,y,z: um; for angle,pitch,roll: degree -->
      <x>0</x><y>0</y>
      <angle>10</angle>
    </position>
    <width unit="um" min="2" max="100000">5</width>
    <radius unit="um" min="5" max="100000">50</radius>
  </port>
  <boundary>
    <rectangle portref="org" width="10" length="20" x="0" y="0" />
  </boundary>
 </bb>

 <bb name="myDate">
  <lastChangedDate>2022-04-29</lastChangedDate>
 </bb>

 <bb name="mySOA">
   <BBtype>soa</BBtype>
 </bb>

 <bb name="myParam">
  <parameters>
   <parameter name="MinL" min="1"> 5.0 </parameter>
   <parameter name="MaxL" max="100"> 5.0 </parameter>
   <parameter name="RangeL" min="1" max="100"> 5.0 </parameter>
   <parameter name="IntSet" type="int" allowedValues="1 2 5 6 10">5</parameter>
   <parameter name="StringSet" type="string" allowedValues="a1 b2 c5 6 10">c5</parameter>
  </parameters>
 </bb>

 <bb name="myDoc">
   <doc>This is the short one.

    Can still span lines though.</doc>
   <tex>And here I go for some Tex docu like $\rightarrow$ or even \input{sub.tex}.

    Can be manu lines too.</tex>
 </bb>



 <!-- simple BB with multiple port & parameters -->
 <bb name="myBB1">
  <version>2.0</version>
  <doc>I am a really nice BB with 2 parameters</doc>
  <drcManhattan >true</drcManhattan>
  <!-- implicit layout ports, here just for testing the portref. -->
  <port label="orgx" />

  <parameters>
   <parameter name="L"> 5.0 </parameter>
   <parameter name="IntSet" type="int" allowedValues="1 2 5 6 10">5</parameter>
   <parameter name="StringSet" type="string" allowedValues="a1 b2 c5 6 10">c5</parameter>
  </parameters>

  <port label="in0">
    <domain>Optical</domain>
    <position> <!-- units for x,y,z: um; for angle,pitch,roll: degree -->
     <x doc="We are symmetric">0</x><y>0</y>
      <angle>10</angle>
    </position>
  </port>
  <port label="out0">
    <domain>Optical</domain>
    <position> <!-- units for x,y,z: um; for angle,pitch,roll: degree -->
      <x>L</x><y>0</y>
      <angle>0</angle>
    </position>
    <drcAngles>0 45 90 135 180</drcAngles>
  </port>
  <parameters>
   <parameter name="Width" type="int" min="10" max="500"
          doc="The width is key for this BB">
    42
   </parameter>
   <parameter name="Length" min="0.5">
     3*Width+7.0
   </parameter>
  </parameters>
 </bb>

 <bb name="myIcon1" devicetype="amplifier">
  <icon> <!-- this data is not actually a PNG ! -->
   <file format="png">4oVIUNDopNMHqhuzLaDOFXnzCT+cRkQM/NroSIdxnALeS1kYcYMKeRGrdRnc
yXtMtUAk6Xmnoje2X6EnYll/Zn0+GEfFl/6birD2W6ZVc3HhoRQ5Fnl8DObg
WhiGthy1dwNPhKULEzVoDEsffEilx1FfnRWaNSQr0sMfVPIUXH5Gpfb0+zvn
69+xutJmQa9cCrUgsNpYPQFZQLNj7B/gxzYywQHlNQPjO2OakXW7zruTfrgU
TYJlSTSmdJXwdBNN0Vbbn0giRM7RHDgJy/XA6Yvm2BIJci4K41fu+DEhtq+e
L8zzN6cDA6SzeOBcSDd4LWf6nvdmKdX9tIBw5zPlDO+kFSg/ldUPiSJG5udy
PnoaiBfw6faCyV3lTMD13w+HR0EUZCYWF+pu5swDlYstQidbSO59isRQsi7j
+VZb+D/l8SI0JpB2HCpw97gePmXuVKIKuXKmfpOqSWC9nSRlc1qm+++m270p
b2sdpETAstnriFLgcn98jrvKzbCQPRyLJteBzqBOyIaTe50zcDjwENSoVTzI
gwquDVYndjqZIR/ZrcCG7R3ic0LqFzuznQB0BIFN3sbBaVwquCS5Fd9vr0hp
96HXjpSz3NQouc5fMYPYcwK2QU1m+w5L/e5DFqLzbTpbWKO2MvGz5tlPuqoR
1hi7iZHduuKAwyba1acptLGw9zp6ZmtSFaqWKHHcQFV2Uu+vFnM24lunQHW/
VfpLIx5joVsncxfVDYbDcqlffKM3RmszKIt/NRVRbNwKTRteO3EhE4SrRKNi
FX19GlCWXz9vjqFDBvq4cRf+4XLG6IHk6lLxo6QY4zzRNo1p</file>
  </icon>
 </bb>

 <bb name="myIcon2" devicetype="amplifier">
  <icon>
   <!-- use fixed files -->
   <filename format="png">icon.png</filename>
   <filename format="svg">icon.svg</filename>
   <!-- call some drawing code, specific per software -->
   <function software="Software1">call_something_to_draw();</function>
   <function software="Software2">draw_me();</function>
  </icon>
 </bb>

 <!-- more content in BB -->
 <bb name="myBB2" devicetype="source">
  <library>Advanced components/Using parameters</library>
  <version>1.0.0</version>
  <icon>
   <!-- call some drawing code, specific per software -->
   <function software="Software1">call_something_to_draw();</function>
   <function software="Software2">draw_me();</function>
  </icon>
  <port label="out0">
    <domain>Optical</domain>
    <position>
      <x>0</x><y>0</y>
      <angle>10</angle>
    </position>
    <drcMinimumX>200</drcMinimumX>
    <drcMaximumY>400</drcMaximumY>
  </port>
  <port label="out1" refport="out0">
    <domain>Optical</domain>
    <position>
      <x>0</x><y>0</y>
      <angle>10</angle>
    </position>
    <drcMinimumX>200</drcMinimumX>
    <drcMaximumY>400</drcMaximumY>
  </port>
  <port label="rf0" >
    <domain>RF</domain>
    <position>
      <x>100</x><y>200+myLength/2</y>
      <angle>10+sqrt(myPos)</angle>
    </position>
  </port>
  <parameters>
   <parameter name="myWidth" type="int" min="10" max="500"
          doc="The width is key for this BB">42
   </parameter>
   <parameter name="myLength" min="0.5"> 3*myWidth+7.0 </parameter>
   <parameter name="Length"   min="0.5"> 3*myWidth+7.0 </parameter>
   <parameter name="myPos" type="point" unit="um"
          doc="A location is a 2 value expression">
     [ 3*myWidth+7.0 , sqrt(myLength) ]
   </parameter>
  </parameters>
   <locals>
   <attribute key="justStarted">InitialStage</attribute>
   <attribute key="pleaseDoSomeGUIplacement" />
  </locals>
  <!-- PDAFlow views. The code in PDAFlow allocates the views & sets parameters.
       Here just arbitrary names and values.
  -->
  <view name="pdaLayoutView">
   <parameters>
     <parameter name="myWidth" type="int"> 42 </parameter>
   </parameters>
  </view>
  <view name="pdaModelView">
   <parameters>
    <parameter name="myNeff" type="double"> 1.0/myWidth </parameter>
   </parameters>
  </view>
  <view name="pdaModelReference">
   <parameters>
    <parameter name="ref" type="string"> WaveguideModel </parameter>
   </parameters>
  </view>
  <!-- Some specialized views -->
  <SpecView name="loss">5 dB/cm</SpecView>
  <SpecView name="maturity">very high</SpecView>
  <CompactModel name="base" level="NonLinear"><file>SomeFile.yaml</file></CompactModel>
  <CompactModel name="advanced" level="NonLinear" >
   <parameters>
    <parameter name="W" type="int" min="10" max="500"
          doc="The width is key for this BB">
     42
    </parameter>
    <parameter name="L" min="0.5">
     3*myWidth+7.0
    </parameter>
   </parameters>
  </CompactModel>


  <CompactModel name="moreAdvanced" level="NonLinear" >
   <version>2.0</version> <!-- refer to something in the model, not the data here -->
   <license>xPDK forever!</license>
   <parameters>
    <parameter name="Width" type="int" min="10" max="500"
          doc="The width is key for this BB">
    42
    </parameter>
   <parameter name="Length" min="0.5"> 3*Width+7.0 </parameter>
   </parameters>
   <doc>Like to add some info here as well... any ideas for comments?</doc>
  </CompactModel>

  <boundary>
   <point x="0" y="-myWidth/2"/>
   <point x="myLength" y="-myWidth/2"/>
   <point x="myLength" y="myWidth/2"/>
   <point x="0" y="myWidth/2"/>
  </boundary>
 </bb>

 <bb name="myStraight" >
  <parameters>
   <parameter name="Width" type="int" min="10" max="500"
          doc="The width is key for this BB"> 42 </parameter>
   <parameter name="Length" min="0.5"> 3*Width+7.0 </parameter>
  </parameters>

     <xsection>WG</xsection>
     <xsection>Met</xsection>
  <port label="in0" org="true">
    <domain>Optical</domain>
  </port>
 </bb>

 <!-- simple BB with multiple port & parameters -->
 <bb name="myBB3">
  <version>2.0</version>
  <doc>I am a really nice BB with 2 parameters</doc>
  <drcManhattan >true</drcManhattan>
  <port label="in0">
    <domain>Optical</domain>
    <position>
      <x>0</x><y>0</y>
      <angle>10</angle>
    </position>
     <xsection>WG</xsection>
  </port>
  <port label="out0">
    <domain>Optical</domain>
    <position>
      <x>Length</x> <y>0</y>
      <angle>0</angle>
    </position>
    <drcAngles>0 45 90 135 180</drcAngles>
  </port>

   <port label="out1">
    <domain>Optical</domain>
    <position>
      <x>Length</x> <y>0</y>
      <angle>0</angle>
    </position>
    <drcAngles>0 45 90 135 180</drcAngles>
  </port>

  <parameters>
   <parameter name="Width" type="int" min="10" max="500"
          doc="The width is key for this BB"> 42 </parameter>
   <parameter name="Length" min="0.5"> 3*Width+7.0 </parameter>
   <!-- gives Duplicate key-sequence ['Length'] - ->
   <parameter name="Length" min="0.5">3*W+7.0</parameter>-->
  </parameters>
  <locals>
   <local name="xlW" type="int" min="10" max="500"
          doc="The width is key for this BB">42
   </local>
   <local name="xlL" min="0.5">3*Width+7.0</local>
   <!-- gives Duplicate key-sequence ['xlL'] - ->
   <local name="xlL" min="0.5">3*Width+7.0</local> -->
  </locals>
  <boundary >
    <rectangle portref="in0" width="10" length="20" />
  </boundary>
  <boundary purpose="metal">
    <rectangle portref="in0" width="4" length="2" />
  </boundary>
  <boundary purpose="metal">
    <rectangle portref="out0" align="boc" width="4" length="2" />
  </boundary>
  <boundary purpose="metal">
    <circle portref="out0" align="bcc" radius="42.24" y="10" />
     <xsection>Doc</xsection>
  </boundary>
  <boundary purpose="metal">
    <od_spt> ml::Straight(cin->[0] : );
    </od_spt>
  </boundary>
  <boundary purpose="waveguide">
    <circle portref="out0" align="bcc" radius="42.24" y="10" />
     <xsection>WG</xsection>
  </boundary>
 </bb>


  <!-- simple BB with multiple port & defaults xsection -->
 <bb name="myBB_manyport">
  <xsection>Met</xsection>
  <xsection>WG</xsection>
  <port label="in0" />
  <port label="out0" />
  <port label="rf0" />
  <port label="rf1" />
 </bb>