<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:xml="http://www.w3.org/XML/1998/namespace"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:xi="http://www.w3.org/2001/XInclude"
           targetNamespace="http://pdaflow.org/ns/OptoDesigner"
           xmlns="http://pdaflow.org/ns/OptoDesigner"
           xmlns:pda="http://pdaflow.org/ns/xPDK"
           xmlns:epi="http://pdaflow.org/ns/Epiphany"
           elementFormDefault="qualified">
  <xs:annotation>
   <xs:appinfo>xPDK schema format extensions for OptoDesigner</xs:appinfo>
   <xs:documentation xml:lang="en">
   This schema defines a few OptoDesigner extensions for different items.

<br/>
The schema is located at: <tt>http://pdaflow.org/xsd/</tt> per instance of the standard.
<br/>
<ul>
  <li>License for <b>general users / automation / ...</b>:<br/>
   Use unmodified.
  </li>
  <li>License for <b>PDAFlow members</b>:<br/>
   Allow to extend / modify / update in alignment with the other PDAFlow members.
   </li>
</ul>
   </xs:documentation>
  </xs:annotation>

  <xs:import schemaLocation="xPDK_Base.xsd" namespace="http://pdaflow.org/ns/xPDK" />

  <!-- Epiphany design namespaces -->
  <xs:import schemaLocation="Epiphany.xsd" namespace="http://pdaflow.org/ns/Epiphany" />

  <xs:element name="VendorExtension"           type="VendorExtension"/>
  <xs:element name="sptHeader"                 type="sptHeader"/>
  <xs:element name="sptFooter"                 type="sptFooter"/>
  <xs:element name="Function"                  type="Function"/>
  <xs:element name="TechFooter"                type="TechFooter"/>
  <xs:element name="TechGlobals"               type="TechGlobals"/>
  <xs:element name="TechExport"                type="TechExport"/>
  <xs:element name="TechFactory"               type="TechFactory"/>
  <xs:element name="DieTemplate"               type="DieTemplate"/>
  <xs:element name="DieExtends"                type="DieExtends"/>
  <xs:element name="techIncludeMaskFile"       type="techIncludeMaskFile"/>
  <xs:element name="techDefineCoating"         type="techDefineCoating"/>
  <xs:element name="techGenerateSptFile"       type="techGenerateSptFile"/>
  <xs:element name="techIncludePathLength"     type="techIncludePathLength"/>
  <xs:element name="Example"                   type="Example"/>
  <xs:attribute name="layerIgnoreAsData"       type="layerIgnoreAsData"/>
  <xs:attribute name="layerIsDieArea"          type="layerIsDieArea"/>
  <xs:attribute name="mcsAnnotateBoundary"     type="mcsAnnotateBoundary"/>
  <xs:attribute name="gdsAnnotateBoundary"     type="gdsAnnotateBoundary"/>
  <xs:attribute name="mcsAnnotateCellName"     type="mcsAnnotateCellName"/>
  <xs:attribute name="mcsAnnotateParameter"    type="mcsAnnotateParameter"/>
  <xs:attribute name="mcsAnnotatePinInfo"      type="mcsAnnotatePinInfo"/>
  <xs:attribute name="mcsAnnotateText"         type="mcsAnnotateText"/>
  <xs:attribute name="mcsAnnotatePinSize"      type="mcsAnnotatePinSize"/>
  <xs:attribute name="mcsAnnotatePinOptical"   type="mcsAnnotatePinOptical"/>
  <xs:attribute name="mcsAnnotatePinDC"        type="mcsAnnotatePinDC"/>
  <xs:attribute name="mcsAnnotatePinRF"        type="mcsAnnotatePinRF"/>
  <xs:element name="bbAnnotateName"            type="bbAnnotateName"/>
  <xs:element name="bbAnnotateFontSize"        type="bbAnnotateFontSize"/>
  <xs:attribute name="mcsBusConfig"            type="mcsBusConfig"/>
  <xs:attribute name="busConfigElement"        type="busConfigElement"/>
  <xs:attribute name="busConfigArguments"      type="busConfigArguments"/>
  <xs:attribute name="portMapIn"               type="portMapIn"/>
  <xs:attribute name="portMapOut"              type="portMapOut"/>
  <xs:attribute name="portMapDC"               type="portMapDC"/>
  <xs:attribute name="portMapRF"               type="portMapRF"/>
  <xs:attribute name="portMapDCi"              type="portMapDCi"/>
  <xs:attribute name="portMapDCo"              type="portMapDCo"/>
  <xs:attribute name="portMapRFi"              type="portMapRFi"/>
  <xs:attribute name="portMapRFo"              type="portMapRFo"/>
  <xs:attribute name="portMapToName"           type="portMapToName"/>
  <xs:attribute name="mcsWrapper"              type="mcsWrapper"/>
  <xs:element name="bbWrapper"                 type="bbWrapper"/>
  <xs:attribute name="TechADK"                 type="TechADK"/>
  <xs:element name="GDSCellPrefix"             type="GDSCellPrefix"/>
  <xs:element name="pxFactory"                 type="pxFactory"/>
  <xs:element name="bbFlexWrapper"             type="bbFlexWrapper"/>
  <xs:attribute name="mcsMigrate"              type="mcsMigrate"/>
  <xs:attribute name="noParameterRangeTest"    type="noParameterRangeTest"/>
  <xs:attribute name="nullable"                type="nullable"/>

  <xs:simpleType name="VendorExtension">
    <xs:annotation>
      <xs:documentation xml:lang="en"><a href="basicsetup.php#extensions">Vendor</a> extension for <a href="https://www.synopsys.com/photonic-solutions.html">OptoDesigner</a>.<br/>
  </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string"/>
  </xs:simpleType>

  <xs:simpleType name="sptHeader">
   <xs:annotation>
    <xs:documentation xml:lang="en">
    This section will be put at the start of a definition via XSLT.<br/>

    <h3>Tech/02 definition</h3>
    This section is copied into the '02' file at the start of the TechnologyPDKLIB
    class instance.<br/>
    The typical use is waveguide mode models and other bigger spt sections that can
    then be used in the different sections.

    <h3>pdaSingleLayerOPS</h3>
    This section is copied into the '02' file below the (gds/mcs) layer definitions in the single-layer
    operation block. It is intended for more complex single/multi layer derived operations or DRC.
    <!--##PHPOPEN## xmlSpt02("layer_singleSpt.xml","drc0",54,26,"450px"); ##PHPCLOSE##-->

    <h3>xsection</h3>
    This section is copied into the '02' file below the mcs definition and is intended
    for more complex properties like waveguide models and so on.<br/>
    It provides also for less common mcsSet*() functions or feeding them with values that xPDK
    does not support.

     <!--##PHPOPEN## xmlCodeBlock("examples/mcslayer_spt.xml",17,2); ##PHPCLOSE##-->

    <h3>BB definition</h3>
    This section is copied into the '04' file inside the layout definition and is intended
    for fine-tuning behavior, giving control over returned attributes and so on. In typical
    cases it is not needed.
    <br/>
    Use this field in case the xPDK format does not have all the fields you need for your BB in
    OptoDesigner. For example this is possible for returning more layout attributes or supporting
    more complex design rule checking.<br/><br/>

    <!--##PHPOPEN## xmlCodeBlock("examples/bb_spt.xml",18,2);  ##PHPCLOSE##-->

    <h3>BB boundary</h3>
    This section is copied into the '04' file into the layout itself and can be used to
    mark up complex boundaries. Also the use of multiple mcs/gds layers for DRC can be
    simpler this way.<br/>
    Instead of using spt, you can also use the xsection for typical cases and reduce
    vendor dependence for this section.<br/>
    <!--##PHPOPEN##  xmlCodeBlock("examples/bb_boundary_spt.xml",17,2); ##PHPCLOSE##-->

    </xs:documentation>
   </xs:annotation>
   <xs:restriction base="VendorExtension" />
  </xs:simpleType>


  <xs:simpleType name="sptFooter">
   <xs:annotation>
    <xs:documentation xml:lang="en">
    This section will be put at the end of a definition via XSLT.

    <h3>Tech/02 definition</h3>
    This section is copied into the '02' file just before the <i>function export()</i><br/>
    The typical use is for backward compatability (for example mapping older <i>mcs</i> names)
    or some custom tech functions that need access to most of the tech-file.<br/>
    Using this element instead of the <i>TechFooter</i> is easier in case of enriching the
    design kit via the C++ or Python library.

    <h3>pdaSingleLayerOPS</h3>
    This section is copied into the '02' file below the (gds/mcs) layer definitions in the single-layer
    operation block. It is intended for more complex single/multi layer derived operations or DRC.
    <!--##PHPOPEN## xmlSpt02("layer_singleSpt.xml","drc0",54,26,"450px"); ##PHPCLOSE##-->

    <h3>xsection</h3>
    This section is copied into the '02' file below the mcs definition and is intended
    for more complex properties like waveguide models and so on.<br/>
    It provides also for less common mcsSet*() functions or feeding them with values that xPDK
    does not support.
    <!--##PHPOPEN## xmlCodeBlock("examples/mcslayer_spt.xml",17,2); ##PHPCLOSE##-->

    <h3>BB definition</h3>
    This section is copied into the '04' file inside the layout definition and is intended
    for fine-tuning behavior, giving control over returned attributes and so on. In typical
    cases it is not needed.
    <br/>
    Use this field in case the xPDK format does not have all the fields you need for your BB in
    OptoDesigner. For example this is possible for returning more layout attributes or supporting
    more complex design rule checking.<br/><br/>

    <!--##PHPOPEN## xmlCodeBlock("examples/bb_spt.xml",18,2);  ##PHPCLOSE##-->

    <h3>BB boundary</h3>
    This section is copied into the '04' file into the layout itself and can be used to
    mark up complex boundaries. Also the use of multiple mcs/gds layers for DRC can be
    simpler this way.<br/>
    Instead of using spt, you can also use the xsection for typical cases and reduce
    vendor dependence for this section.<br/>

    <!--##PHPOPEN##  xmlCodeBlock("examples/bb_boundary_spt.xml",17,2); ##PHPCLOSE##-->

    </xs:documentation>
   </xs:annotation>
   <xs:restriction base="VendorExtension"/>
  </xs:simpleType>

  <xs:simpleType name="Function">
    <xs:annotation>
      <xs:documentation xml:lang="en">
  Define an function for OptoDesigner.<br/>
<br/>
This is vendor specific and can be defined as functor <i>{functor #}</i> or expression <i>{a -&gt; f(a)}</i>
style. These are used in the lengthening and widening of curves for example.<br/>
  </xs:documentation>
    </xs:annotation>
    <xs:restriction base="VendorExtension"/>
  </xs:simpleType>


<xs:complexType name="TechFooter">
 <xs:annotation>
  <xs:documentation xml:lang="en">
  This section is copied into the '02' file just before the export() function and is
  intended for overriding functions of the base technology class.<br/>
  The following attributes are possible<ul>
   <li><i>mcs</i>: Define the default mcs - so what gets mask::CSselect()ed at the end of the
    technology class.</li>
   <li><i>mcsDC</i>: Define the default mcs for DC</li>
   <li><i>mcsRF</i>: Define the default mcs for RF</li>
  </ul>
  </xs:documentation>
 </xs:annotation>
 <xs:simpleContent>
  <xs:extension base="VendorExtension">
   <xs:attribute name="mcs" type="pda:pdaIdentifier" use="optional" >
    <xs:annotation>
     <xs:documentation xml:lang="en">
     Define the default mcs - so what gets mask::CSselect()ed at the end of the
     technology class.
     </xs:documentation>
    </xs:annotation>
   </xs:attribute>

   <xs:attribute name="mcsDC" type="pda:pdaIdentifier" use="optional" >
    <xs:annotation>
     <xs:documentation xml:lang="en">
     Define the default mcs for DC; this is used for:<br/>
     <pre><i>function getmcs_DC(){}.</i></pre>
     </xs:documentation>
    </xs:annotation>
   </xs:attribute>

   <xs:attribute name="mcsRF" type="pda:pdaIdentifier" use="optional" >
    <xs:annotation>
     <xs:documentation xml:lang="en">
     Define the default mcs for RF; this is used for:<br/>
     <pre><i>function getmcs_RF(){}.</i></pre>
     </xs:documentation>
    </xs:annotation>
   </xs:attribute>

   <!-- extensions -->
   <xs:attribute ref="epi:pdkSelect" use="optional"/>
   <xs:anyAttribute namespace="##other" processContents="strict" />
  </xs:extension>
 </xs:simpleContent>
</xs:complexType>

<xs:simpleType name="TechGlobals">
 <xs:annotation>
  <xs:documentation xml:lang="en">
  This section is copied into the '02' file below the default header with the
  typical mask/die etc includes. The purpose of this is to define pcell libraries
  and other globals that are shared by 02 and 04 files, eg. for pdkexport() use.
  </xs:documentation>
 </xs:annotation>
  <xs:restriction base="VendorExtension"/>
</xs:simpleType>

<xs:simpleType name="TechExport">
 <xs:annotation>
  <xs:documentation xml:lang="en">
  This section is copied into the '02' file as the design kit export function body, so
  you do not need the 'function export(..)'.<br/>
  If this section is not in the PDK, it will add a default export function which you may need
  to modify if you use the TechGlobals section with pcellLibraries or other things you need
  in the export.
  </xs:documentation>
 </xs:annotation>
  <xs:restriction base="VendorExtension"/>
</xs:simpleType>

<xs:simpleType name="TechFactory">
 <xs:annotation>
  <xs:documentation xml:lang="en">
  This section is copied into the '02' file below the export() function and is
  intended to register the pxBB's mapping into the pxFactory.Register() tables to support
  foundry independent designs.
  </xs:documentation>
 </xs:annotation>
  <xs:restriction base="VendorExtension"/>
</xs:simpleType>

<xs:simpleType name="DieTemplate">
 <xs:annotation>
  <xs:documentation xml:lang="en">
  This section contains the die-template definition which is put in the '04' file.
  The die-template should define form-factors, typical IO locations, dice line or
  cleave markers and so on.<br/>
  When using the examples, this section will be placed before the <a href='DieExtends.php'>DieExtends</a>
  section.
  </xs:documentation>
 </xs:annotation>
  <xs:restriction base="VendorExtension"/>
</xs:simpleType>

<xs:simpleType name="DieExtends">
 <xs:annotation>
  <xs:documentation xml:lang="en">
  This section contains the die-template instance/use, which is copied into the code-snippets
  but will also used for the examples to define a basic die.<br/>
  It is therefore good to pick defaults like die-sizes that support the examples directly.
  </xs:documentation>
 </xs:annotation>
  <xs:restriction base="VendorExtension"/>
</xs:simpleType>


<xs:complexType name="Example">
 <xs:annotation>
  <xs:documentation xml:lang="en">
  This allows to define an example for the technology. You can use xslt to select
  one of them by using the example name and create a self contained spt example
  file.<br/>
  This is handy to validate design rules or re-generate designer examples when new die-templates
  or additonal options are used.
  </xs:documentation>
 </xs:annotation>
 <xs:simpleContent>
  <xs:extension base="VendorExtension">
   <xs:attribute name="example" use="required" type="pda:pdaIdentifier" />
   <xs:anyAttribute namespace="##other" processContents="strict" />
  </xs:extension>
 </xs:simpleContent>
</xs:complexType>

<xs:simpleType name="techIncludeMaskFile">
 <xs:annotation>
  <xs:documentation xml:lang="en">
   Specify that the <i>#include @mask/file</i> will be added to the OptoDesigner 02-file/<br/>
   This library suppport operations on mask files and is needed also for loading GDS-based BB/cell
   definitions from a design kit. If BBs have a <i>boundary</i> with a <i>gds cell</i> in them, you
   do not need to set this value to true - it will automatically add it.
</xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:boolean"/>
</xs:simpleType>

<xs:complexType name="techDefineCoating">
 <xs:annotation>
  <xs:documentation xml:lang="en">
  You can use this field to define the coating options.<br/>
  For edge-coupled fibre/chips (typically with SSCs) you normally have different coating options
  provided by the foundry. In case you use InP or other active materials, you may also have special
  handling for laser facets.<br/>
  If you use this field, then the OptoDesigner tech file will setup the coating options and write
  the designer spec in a side file. You can define which sides support coating; not setting the field
  will block coating for that edge.<br/>
  For typical packaging rules (like defined by <a href='https://pixapp.eu/'>Europe's PIXAPP Pilot Line service</a>) only <i>West</i> (typical photonics edge) and <i>East</i> (either photonics or RF) are the edges to use; with <i>North</i> and <i>South</i> for use by electrical (lower speed, few GHz) connections.<br/>
  The values should be a list of names, seperated by a <tt>,</tt>, so <tt>AR, NO,HR</tt>. The names are free, but preferred naming is:
  <ul>
   <li><b>NA</b> Not Applicable - the designer does not care</li>
   <li><b>NO</b> No coating</li>
   <li><b>AR</b> Anti-reflection coating</li>
   <li><b>HR</b> High-reflection coating</li>
  </ul>
  </xs:documentation>
 </xs:annotation>
 <xs:complexContent>
  <xs:restriction base="xs:anyType">
   <xs:attribute name="West" type="xs:string" use="optional">
    <xs:annotation><xs:documentation xml:lang="en">Coating specification for West side</xs:documentation></xs:annotation>
   </xs:attribute>
   <xs:attribute name="East" type="xs:string" use="optional">
    <xs:annotation><xs:documentation xml:lang="en">Coating specification for East side</xs:documentation></xs:annotation>
   </xs:attribute>
   <xs:attribute name="North" type="xs:string" use="optional">
    <xs:annotation><xs:documentation xml:lang="en">Coating specification for North side</xs:documentation></xs:annotation>
   </xs:attribute>
   <xs:attribute name="South" type="xs:string" use="optional">
    <xs:annotation><xs:documentation xml:lang="en">Coating specification for South side</xs:documentation></xs:annotation>
   </xs:attribute>
  </xs:restriction>
 </xs:complexContent>
</xs:complexType>


<xs:simpleType name="techGenerateSptFile">
 <xs:annotation>
  <xs:documentation xml:lang="en">
   Specify that the <i>pcellMaskEngineer_Library</i> will be added to the OptoDesigner 02-file/<br/>
   This pcell library will be used in the BBs to generate a spt-based side-file for mask assembly.
  </xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:boolean"/>
</xs:simpleType>

<xs:simpleType name="techIncludePathLength">
 <xs:annotation>
  <xs:documentation xml:lang="en">
   Specify that the <i>path length library</i> will be added to the OptoDesigner 02-file/<br/>
   This pcell library will be used within the OptoCompiler fast server code. Select the GDS layer
   that is used for marking the electrical pin.
  </xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:boolean"/>
</xs:simpleType>



<xs:simpleType name="layerIgnoreAsData">
 <xs:annotation>
  <xs:documentation xml:lang="en">Layer annotation used in XSL to generate an OptoDesigner Tech/02 file.<br/>
  OptoDesigner extension, mark this layer as 'non data' for a "data inside die/design area" test.
</xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:boolean"/>
</xs:simpleType>

<xs:simpleType name="layerIsDieArea">
 <xs:annotation>
  <xs:documentation xml:lang="en">Layer annotation used in XSL to generate an OptoDesigner Tech/02 file.<br/>
  OptoDesigner extension, mark this layer as "die/design area".
</xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:boolean"/>
</xs:simpleType>

<xs:simpleType name="gdsAnnotateBoundary">
 <xs:annotation>
  <xs:documentation xml:lang="en">gds annotation used in XSL where the mcsAnnotateBoundary can not be used for autoXsection=false setting.
</xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:boolean"/>
</xs:simpleType>

<xs:simpleType name="mcsAnnotateBoundary">
 <xs:annotation>
  <xs:documentation xml:lang="en">MCS annotation used in XSL to generate an OptoDesigner BB/pcell/04 file.<br/>
  OptoDesigner extension, use this xsection/mcs for the BB/pcell name in xpdkAnnotator().
</xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:boolean"/>
</xs:simpleType>

<xs:simpleType name="mcsAnnotateCellName">
 <xs:annotation>
  <xs:documentation xml:lang="en">MCS annotation used in XSL to generate an OptoDesigner BB/pcell/04 file.<br/>
  OptoDesigner extension, use this MCS for the BB/pcell name in xpdkAnnotator().
</xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:boolean"/>
</xs:simpleType>

<xs:simpleType name="mcsAnnotateParameter">
 <xs:annotation>
  <xs:documentation xml:lang="en">MCS annotation used in XSL to generate an OptoDesigner BB/pcell/04 file.<br/>
      OptoDesigner extension, use this MCS for BB/pcell parameters in xpdkAnnotator().
</xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:boolean"/>
</xs:simpleType>

<xs:simpleType name="mcsAnnotateText">
 <xs:annotation>
  <xs:documentation xml:lang="en">MCS annotation for text in BB/pcell/04 file.<br/>
      Extension, use this MCS for plain text.
</xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:boolean"/>
</xs:simpleType>

<xs:simpleType name="mcsAnnotatePinInfo">
 <xs:annotation>
  <xs:documentation xml:lang="en">MCS annotation used in XSL to generate an OptoDesigner BB/pcell/04 file.<br/>
      OptoDesigner extension, use this MCS for BB/pcell ports in xpdkAnnotator(). This layer is used for the port name
      and properties.
</xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:boolean"/>
</xs:simpleType>

<xs:simpleType name="mcsAnnotatePinSize">
 <xs:annotation>
  <xs:documentation xml:lang="en">MCS annotation used in XSL to generate an OptoDesigner BB/pcell/04 file.<br/>
      OptoDesigner extension, use this MCS for BB/pcell ports in xpdkAnnotator(). This layer is used for a rectangle
      that indicates the width of the port.
</xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:boolean"/>
</xs:simpleType>

<xs:simpleType name="mcsAnnotatePinOptical">
 <xs:annotation>
  <xs:documentation xml:lang="en">MCS annotation used in XSL to generate an OptoDesigner BB/pcell/04 file.<br/>
     Tag optical port in this layer via rectangle.
</xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:boolean"/>
</xs:simpleType>

<xs:simpleType name="mcsAnnotatePinDC">
 <xs:annotation>
  <xs:documentation xml:lang="en">MCS annotation used in XSL to generate an OptoDesigner BB/pcell/04 file.<br/>
     Tag DC port in this layer via rectangle.
</xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:boolean"/>
</xs:simpleType>

<xs:simpleType name="mcsAnnotatePinRF">
 <xs:annotation>
  <xs:documentation xml:lang="en">MCS annotation used in XSL to generate an OptoDesigner BB/pcell/04 file.<br/>
     Tag RF port in this layer via rectangle.
</xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:boolean"/>
</xs:simpleType>



<xs:simpleType name="bbAnnotateName">
 <xs:annotation>
  <xs:documentation xml:lang="en">BB annotation used in XSL to generate an OptoDesigner BB/pcell/04 file.
  </xs:documentation>
 </xs:annotation>
 <xs:restriction base="xs:string">
  <xs:enumeration value="gdstext"/>
  <xs:enumeration value="masktext"/>
  <xs:enumeration value="none"/>
 </xs:restriction>
</xs:simpleType>

<xs:simpleType name="bbAnnotateFontSize">
  <xs:annotation>
   <xs:documentation xml:lang="en">Font size to use for <i>masktext</i> in um.
   </xs:documentation>
  </xs:annotation>
 <xs:restriction base="xs:double">
  <xs:minInclusive value="0.5"/>
 </xs:restriction>
</xs:simpleType>

<xs:simpleType name="busConfigArguments">
 <xs:annotation>
 <xs:documentation xml:lang="en">Configure the arguments of a bus-routing component.<br/>
  <b>Obsolete, the LayoutInterfaceArguments is now used for both python and spt.</b><br/>
 The OptoDesigner bus-router simplifies complex (delay based) routing. It needs a few different
 BBs to be setup per PDK, which can be generic waveguide curves also.<br/>
 For the argument/order you can look in the /*default:*/ below, which shows the curve that is used
 if you do not overrule it. <i>wwg</i> is the configured waveguide width for the bus.<br/>
 <pre>
 // create straight in some way, must support a port/port spec via L=null
 abstract layout straight(double L nullable UnitInfo "micron") TexDoc "Create a straight waveguide";
    /*default:*/ ml::Straight( cin->this@in0,cout->this@out0 : wfix(wwg), L == null?null:max(0,L));

 // create taper in some way, L=null allows sub-class to spec it
 abstract layout taperToBus(double win UnitInfo "micron",double L nullable UnitInfo "micron") TexDoc "Width taper";
    /*default:*/ ml::Straight( cin->this@in0,cout->this@out0 : wlin(win,wwg), L);

 // create taper in some way, L=null allows sub-class to spec it
 abstract layout taperFromBus(double wto UnitInfo "micron",double L nullable UnitInfo "micron") TexDoc "Width taper";
    /*default:*/ ml::Straight( cin->this@in0,cout->this@out0 : wlin(wwg,wto), L);

 // create 90deg bend in some way
 abstract layout bend90(int up RangeSpec[-2,2]) TexDoc "Manhattan bend style";
    /*default:*/ ml::BendPolar( cin->this@in0,cout->this@out0 : wfix(wwg), wwr, up*90);

 // create 180deg bend in some way
 abstract layout bend180(int up RangeSpec[-2,2]) TexDoc "Manhattan bend style";
    /*default:*/ ml::BendPolar( cin->this@in0,cout->this@out0 : wfix(wwg), wwr, up*180);

 // create some bend
 abstract layout bend(double r UnitInfo "micron",double a UnitInfo "Degree") TexDoc "General bend";
    /*default:*/ ml::BendPolar( cin->this@in0,cout->this@out0 : wfix(wwg),r,a);
 </pre>
 <br/>
 The string data is the argument for the PDK bb element based on the mapping from above. In addition to the (very
 few) arguments of the layout's above, you can use:
 <pre>
 final function getWidth()  TexDoc "Return width"<br/>
 final function getRadius() TexDoc "Return radius"<br/>
 final function getDistance() TexDoc "Return wg/wg distance"<br/>
 final function getDistanceCenterCenter() TexDoc "Center - center distance of 2 waveguides"<br/>
 final function getTaperAngle()  TexDoc "Return default angle for tapers"<br/>
 </pre>
 <br/>
 For the busConfigElement arguments:
 L,win,wbus
 <ul>
  <li><i>straight</i>L,wwg</li>
  <li><i>taperToFromBus</i>L,wext,wbus; use the argument order for the ``into'' the bus; the widths will be reversed for the out-going taper</li>
  <li><i>bend90</i>up,wwr,wwg</li>
  <li><i>bend</i>r,a,wwg</li>
 </ul>
 </xs:documentation>
 </xs:annotation>
 <xs:restriction base="xs:string" />
</xs:simpleType>

<xs:simpleType name="busConfigElement">
 <xs:annotation>
  <xs:documentation xml:lang="en">BB annotation used in XSL to generate an OptoDesigner BB/pcell/09 file.
    <br/>
    This field is superseded by the <i>epi:LayoutInterfaceBB</i>, which extends this with more values. The <i>busConfigArguments</i>
    is used for the OptoDesigner spt, also for the <i>epi:LayoutInterfaceBB</i>.
  </xs:documentation>
 </xs:annotation>
 <xs:restriction base="xs:string">
  <xs:enumeration value="straight"/>
  <xs:enumeration value="taperToFromBus"/>
  <xs:enumeration value="bend"/>
  <xs:enumeration value="bend90"/>
  <xs:enumeration value="dcpad"/>
  <xs:enumeration value="rfpad"/>
  <xs:enumeration value="wgtToBus"/>
  <xs:enumeration value="wgtFromBus"/>
  <xs:enumeration value="sinebend"/>
 </xs:restriction>
</xs:simpleType>

<xs:simpleType name="mcsBusConfig">
 <xs:annotation>
  <xs:documentation xml:lang="en">MCS annotation used in XSL to generate an OptoDesigner bus config 09 file.<br/>
  This boolean can be set to true to set up a curve-based bus-config for this xsection in case no BBs are set up
  for bus-routing for this xsection.<br/>
  Using this value is not needed if there is at least a single BB configured for being a busConfig-element for this
  xsection; in that case the other non-specified layout's are automatically configured using basic OptoDesigner
  curves.
  </xs:documentation>
 </xs:annotation>
 <xs:restriction base="xs:boolean"/>
</xs:simpleType>

<xs:simpleType name="portMapIn">
 <xs:annotation>
  <xs:documentation xml:lang="en">Use this at xPDK_BB or BB level to mark output ports to be mapped to <i>in*</i> ports.<br/>
   Use the port <i>label</i> or <i>label_rev</i> to pick the direction; do not add numbers.
  </xs:documentation>
 </xs:annotation>
 <xs:restriction base="xs:string"/>
</xs:simpleType>

<xs:simpleType name="portMapOut">
 <xs:annotation>
  <xs:documentation xml:lang="en">Use this at xPDK_BB or BB level to mark output ports to be mapped to <i>out*</i> ports.<br/>
   Use the port <i>label</i> or <i>label_rev</i> to pick the direction; do not add numbers.
  </xs:documentation>
 </xs:annotation>
 <xs:restriction base="xs:string"/>
</xs:simpleType>

<xs:simpleType name="portMapDC">
 <xs:annotation>
  <xs:documentation xml:lang="en">Use this at xPDK_BB or BB level to mark output ports to be mapped to <i>dc*</i> ports.<br/>
   Use the port <i>label</i> or <i>label_rev</i> to pick the direction; do not add numbers.
  </xs:documentation>
 </xs:annotation>
 <xs:restriction base="xs:string"/>
</xs:simpleType>

<xs:simpleType name="portMapRF">
 <xs:annotation>
  <xs:documentation xml:lang="en">Use this at xPDK_BB or BB level to mark output ports to be mapped to <i>dc*</i> ports.<br/>
   Use the port <i>label</i> or <i>label_rev</i> to pick the direction; do not add numbers.
  </xs:documentation>
 </xs:annotation>
 <xs:restriction base="xs:string"/>
</xs:simpleType>

<xs:simpleType name="portMapDCi">
 <xs:annotation>
  <xs:documentation xml:lang="en">Use this at xPDK_BB or BB level to mark output ports to be mapped to <i>dci*</i> ports.<br/>
   Use the port <i>label</i> or <i>label_rev</i> to pick the direction; do not add numbers.
  </xs:documentation>
 </xs:annotation>
 <xs:restriction base="xs:string"/>
</xs:simpleType>

<xs:simpleType name="portMapDCo">
 <xs:annotation>
  <xs:documentation xml:lang="en">Use this at xPDK_BB or BB level to mark output ports to be mapped to <i>dco*</i> ports.<br/>
   Use the port <i>label</i> or <i>label_rev</i> to pick the direction; do not add numbers.
  </xs:documentation>
 </xs:annotation>
 <xs:restriction base="xs:string"/>
</xs:simpleType>

<xs:simpleType name="portMapRFi">
 <xs:annotation>
  <xs:documentation xml:lang="en">Use this at xPDK_BB or BB level to mark output ports to be mapped to <i>rfi*</i> ports.<br/>
   Use the port <i>label</i> or <i>label_rev</i> to pick the direction; do not add numbers.
  </xs:documentation>
 </xs:annotation>
 <xs:restriction base="xs:string"/>
</xs:simpleType>

<xs:simpleType name="portMapRFo">
 <xs:annotation>
  <xs:documentation xml:lang="en">Use this at xPDK_BB or BB level to mark output ports to be mapped to <i>rfo*</i> ports.<br/>
   Use the port <i>label</i> or <i>label_rev</i> to pick the direction; do not add numbers.
  </xs:documentation>
 </xs:annotation>
 <xs:restriction base="xs:string"/>
</xs:simpleType>

<xs:simpleType name="portMapToName">
 <xs:annotation>
  <xs:documentation xml:lang="en">Use this at port level to map to a standard name. You can add a <i>+[0,0,180]</i>
   or something like that - it is a <i>ml::setPort(this: label -&gt; this@portMapToName );</i>
  </xs:documentation>
 </xs:annotation>
 <xs:restriction base="xs:string"/>
</xs:simpleType>

<xs:simpleType name="mcsWrapper">
 <xs:annotation>
  <xs:documentation xml:lang="en">Use this at port level to map to a standard name. You can add a <i>+[0,0,180]</i>
   or something like that - it is a <i>ml::setPort(this: label -&gt; this@portMapToName );</i>
  </xs:documentation>
 </xs:annotation>
 <xs:restriction base="xs:string">
   <xs:pattern value="[A-Za-z]([A-Za-z0-9_\.])*"/>
 </xs:restriction>
</xs:simpleType>


<xs:simpleType name="mcsMigrate">
 <xs:annotation>
  <xs:documentation xml:lang="en">Specify an earlier name for this xsection; it is intended for backward compatability
   and thus to slowly be dropped from the design kit.
  </xs:documentation>
 </xs:annotation>
 <xs:restriction base="xs:string"/>
</xs:simpleType>


<xs:complexType name="bbWrapper">
 <xs:annotation>
  <xs:documentation xml:lang="en">
  Define that this BB replaces another one.<br/>
  Due to PDK changes, older BBs may need migration to new ones. Using this field allows to define at the definition of the new
  BB the mapping from the old one. You can change parameters and ports.<br/>
  Remove the old BB from the PDK, a new definition will be added which gives the <i>replace by..</i> type of message on its use.
  This allows designers to quickly migrate their design.<br/>
  You can use the optional (plain) text content for additional information.
  </xs:documentation>
 </xs:annotation>
 <xs:simpleContent>
  <xs:extension base="xs:string">
   <xs:attribute name="layoutargs" use="optional" type="xs:string">
     <xs:annotation>
      <xs:documentation xml:lang="en">
      The arguments of the old BB definition, so used in the layout header.
      </xs:documentation>
     </xs:annotation>
   </xs:attribute>
   <xs:attribute name="instargs" use="optional" type="xs:string">
     <xs:annotation>
      <xs:documentation xml:lang="en">
      Arguments used in the call to the new BB
      </xs:documentation>
     </xs:annotation>
   </xs:attribute>
   <xs:attribute name="setLayoutPort" use="optional" type="xs:string">
     <xs:annotation>
      <xs:documentation xml:lang="en">
      If not in0/out0, set as string <i>"dc0","dc1"</i> or something like that.
      </xs:documentation>
     </xs:annotation>
   </xs:attribute>
   <xs:attribute name="ports" use="optional" type="xs:string">
     <xs:annotation>
      <xs:documentation xml:lang="en">
       The ports used for connecting the new and old element. <i>this</i> is the old element.
      </xs:documentation>
     </xs:annotation>
   </xs:attribute>
   <xs:attribute name="bb" use="required">
     <xs:annotation>
      <xs:documentation xml:lang="en">
       Name of the BB that will be wrapped.
      </xs:documentation>
     </xs:annotation>
     <xs:simpleType>
      <xs:restriction base="xs:string">
       <xs:pattern value="[A-Za-z]([A-Za-z0-9_\.])*"/>
      </xs:restriction>
     </xs:simpleType>
   </xs:attribute>
   <xs:attribute name="scope" use="optional">
    <xs:annotation>
     <xs:documentation xml:lang="en">
      Define the scope of the wrapper; typically this is <i>migrate</i>, which gives a drc::Warn() and calls the new BB.
      After a longer while, it can be set to <i>fail</i> to indicate it will be removed from the design kit later on.<br/>
      Use <i>pass</i> to avoid the warnings and simply call the new one behind the scenes.<br/>
      <i>pxfactory</i> can be used to change / add arguments compared to the pxFactory definitions of elements. It acts as a <i>pass</i> flag, but is more specific in its purpose.<br/>
      For 'pass', 'pxfactory' and 'migrate' the BB will appear in the element dialog under the foundry; for 'fail' it will be
      hidden.
     </xs:documentation>
    </xs:annotation>
    <xs:simpleType>
     <xs:restriction base="xs:string">
      <xs:enumeration value="migrate"/>
      <xs:enumeration value="fail"/>
      <xs:enumeration value="pass"/>
      <xs:enumeration value="pxfactory"/>
     </xs:restriction>
    </xs:simpleType>
   </xs:attribute>
  <xs:attribute name="sptHeader"                 type="sptHeader"  use="optional">
  <xs:annotation>
   <xs:documentation xml:lang="en">
   Code before
   </xs:documentation>
  </xs:annotation>
  </xs:attribute>
  <xs:attribute name="sptFooter"                 type="sptFooter"  use="optional">
  <xs:annotation>
   <xs:documentation xml:lang="en">
   Code after
   </xs:documentation>
  </xs:annotation>
  </xs:attribute>
  </xs:extension>
 </xs:simpleContent>
</xs:complexType>

<xs:simpleType name="TechADK">
 <xs:annotation>
  <xs:documentation xml:lang="en">Use this at xPDK_Layout level to mark that this PDK is intended for use with ADKs.<br/>
  The ADK-option for the PDK adds additional xsection / layers in to the design kit to work with typical ADKs.
  </xs:documentation>
 </xs:annotation>
 <xs:restriction base="xs:boolean"/>
</xs:simpleType>

<xs:simpleType name="GDSCellPrefix">
 <xs:annotation>
  <xs:documentation xml:lang="en">The black/grey-box cells will get this prefix. If not set, then the <i>fabacronym</i> in upper case is used.
  </xs:documentation>
 </xs:annotation>
 <xs:restriction base="xs:boolean"/>
</xs:simpleType>

<xs:complexType name="pxFactory">
 <xs:annotation>
  <xs:documentation xml:lang="en">
   Define a pxFactory map.<br/>
   See OptoDesigner documentation.
  </xs:documentation>
 </xs:annotation>
 <xs:complexContent>
  <xs:restriction base="xs:anyType">
   <xs:attribute name="bbGenName" use="required" type="xs:string"/>
   <xs:attribute name="bbArgList" use="optional" type="xs:string"/>
   <xs:attribute name="portConversion" use="optional" type="xs:string"/>
   <xs:attribute name="Options" use="optional" type="xs:string"/>
  </xs:restriction>
 </xs:complexContent>
</xs:complexType>




<xs:complexType name="bbFlexWrapper">
 <xs:annotation>
  <xs:documentation xml:lang="en">
  Define Flex-wrapper.<br/>
  The BB's flex-wrapper is used for standardizing the port names (mask::setLayoutPort()) so we can use them consistently in the bus-routers,
  back-annotation of layouts back into schematic (for pose-layout simulation).<br/>
  </xs:documentation>
 </xs:annotation>
 <xs:all>
  <xs:element name="sptHeader"                 type="sptHeader" minOccurs="0">
  <xs:annotation>
   <xs:documentation xml:lang="en">
   Code before the layout_extends()
   </xs:documentation>
  </xs:annotation>
  </xs:element>
  <xs:element name="sptFooter"                 type="sptFooter" minOccurs="0">
  <xs:annotation>
   <xs:documentation xml:lang="en">
   Code after the layout_extends(), before mask::port2layout()
   </xs:documentation>
  </xs:annotation>
  </xs:element>
 </xs:all>
  <xs:attribute name="pathLength"               type="xs:string" use="optional">
  <xs:annotation>
   <xs:documentation xml:lang="en">
    If used, it will drop the equation below the layout_extends() and before the sptFooter() as a<br/>
    this{"centerPathLength"}=..<br/>
   </xs:documentation>
  </xs:annotation>
  </xs:attribute>
  <xs:attribute name="reverseName"               type="xs:string" use="optional">
  <xs:annotation>
   <xs:documentation xml:lang="en">
   Use if you want the in/out swapped BB also; this is typical for waveguide transitions.
   </xs:documentation>
  </xs:annotation>
  </xs:attribute>
</xs:complexType>


<xs:simpleType name="noParameterRangeTest">
 <xs:annotation>
  <xs:documentation xml:lang="en">The building blocks will normally be tested with:
   <ul>
    <li>Default value for all parameters</li>
    <li>Iterate through the parameters;
      <ul>
       <li>if min or max value defined, then use those to place more instances</li>
      </ul>
     </li>
   </ul>
   This provides for a convenient non-default value testing also, however it may be
   that those parameter combinations are not valid. Per parameter the min/max may work,
   but it can be that the minimum of one parameter requires a non-default value for
   another one.<br/>
   Setting this property in the BB definition allows to define such a test pattern,
   for now this is not yet used, so any string is fine.
  </xs:documentation>
 </xs:annotation>
 <xs:restriction base="xs:string"/>
</xs:simpleType>

<xs:simpleType name="nullable">
 <xs:annotation>
  <xs:documentation xml:lang="en">Mark this parameter as allowed to be <i>empty</i> or <i>null</i>. <br/>
  This aspect is key in the epLayoutInterface.
  </xs:documentation>
 </xs:annotation>
 <xs:restriction base="xs:boolean"/>
</xs:simpleType>


</xs:schema>

