<?xml version="1.0" encoding="utf-8"?>
<!--
Cadence Design Systems 


(C) COPYRIGHT, Cadence Design Systems, Inc. 2013
All Rights Reserved
Licensed Materials - Property of Cadence Design Systems

No part of this file may be reproduced, stored in a retrieval system,
or transmitted in any form or by any means electronic, mechanical,
photocopying, recording, or otherwise without prior written permission
of Cadence Design Systems, Inc. 

WARRANTY:
Use all material in this file at your own risk.  Cadence Design Systems
makes no claims about any material contained in this file.
-->
<xs:schema
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.cadence.com/xsd/objects"
    xmlns:l="http://www.cadence.com/xsd/objects"
    elementFormDefault="qualified"
    >

  <xs:include schemaLocation="common.xsd"/>

  <xs:element name="root">
    <xs:complexType>
      <xs:choice>
        <xs:annotation>
          <xs:documentation>For &lt;cft:xml-opFlags&gt; use the list of attributes, for all the rest - list of objects...</xs:documentation>
        </xs:annotation>
        <xs:sequence>
          <xs:element ref="l:object" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:sequence>
          <xs:element ref="l:attribute" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
      </xs:choice>
    </xs:complexType>
  </xs:element>

  <xs:group name="member">
    <xs:choice>
      <xs:element name="member" type="l:ObjRefTp"/>
      <xs:element name="memberDefn">
        <xs:annotation>
          <xs:documentation>
            Parent tag for instances grouped by definition. So far supported only for listing Power rail's capacitors: memberDefn is capacitor definition, instance capacitors are children
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="l:ObjRefTp">
              <xs:sequence>
                <xs:element name="member" type="l:ObjRefTp" maxOccurs="unbounded"/>
              </xs:sequence>
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>
    </xs:choice>
  </xs:group>

  <xs:element name="object">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="flags" minOccurs="0" type="l:ObjFlagsListTp"/>
        <xs:element ref="l:attribute" minOccurs="0" maxOccurs="unbounded"/>
        <xs:element name="reference" type="l:ObjRefTp" minOccurs="0" maxOccurs="unbounded"/>
        <xs:element name="alias" type="l:ObjRefTp" minOccurs="0" maxOccurs="unbounded"/>
        <xs:group ref="l:member" minOccurs="0" maxOccurs="unbounded"/>
        <xs:element ref="l:object" minOccurs="0" maxOccurs="unbounded">
          <xs:annotation>
            <xs:documentation>For nested NetGroups only</xs:documentation>
          </xs:annotation>
        </xs:element>
        <xs:element name="children" minOccurs="0" maxOccurs="unbounded">
          <xs:annotation>
            <xs:documentation>Child objects, grouped by kind: ECSet MatchGroups, Pins and PinPairs; Region-Class(-Classes) AND results for any object</xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element ref="l:object" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="Kind" type="l:ObjKindEnum" use="required">
              <xs:annotation>
                <xs:documentation>Only child objects of this kind will be listed in this &lt;children&gt; tag</xs:documentation>
              </xs:annotation>
            </xs:attribute>
          </xs:complexType>
        </xs:element>
        <xs:element name="instance" minOccurs="0" maxOccurs="unbounded">
          <xs:annotation>
            <xs:documentation>Instances of this INTERFACE object</xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element name="scope" type="l:ObjRefTp">
                <xs:annotation>
                  <xs:documentation>Scope of the instance object (next tag)</xs:documentation>
                </xs:annotation>
              </xs:element>
              <xs:element name="object" type="l:ObjRefTp"/>
            </xs:sequence>
            <xs:attribute name="AutoMapped" type="l:bool" use="optional"/>
          </xs:complexType>
        </xs:element>
        <xs:element name="config" minOccurs="0">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="v" minOccurs="0" maxOccurs="unbounded">
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:enumeration value="RetainECnsOnNet"/>
                    <xs:enumeration value="DmlAuditRequired"/>
                    <xs:enumeration value="XNetsDMLOn"/>
                    <xs:enumeration value="XNetsGatesOn"/>
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="x-section" minOccurs="0">
          <xs:annotation>
            <xs:documentation>Applicable only to design</xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element name="generic">
                <xs:complexType>
                  <xs:choice>
                    <xs:element name="t" type="xs:string" minOccurs="1" maxOccurs="unbounded">
                      <xs:annotation>
                        <xs:documentation>pre-17.210 files, before Generic layers could hold CSet references</xs:documentation>
                      </xs:annotation>
                    </xs:element>
                    <xs:element ref="l:object" minOccurs="1" maxOccurs="unbounded"/>
                  </xs:choice>
                </xs:complexType>
              </xs:element>
              <xs:element name="children" minOccurs="0">
                <xs:annotation>
                  <xs:documentation>The real x-section</xs:documentation>
                </xs:annotation>
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="object" minOccurs="5" maxOccurs="unbounded">
                      <xs:annotation>
                        <xs:documentation>There must be at least 5 real layers: 2 x surface, TOP, BOTTOM and dielectric between them</xs:documentation>
                      </xs:annotation>
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element ref="l:attribute" maxOccurs="unbounded"/>
                        </xs:sequence>
                        <xs:attribute name="Type" use="required">
                          <xs:simpleType>
                            <xs:restriction base="xs:string">
                              <xs:enumeration value="Surface"/>
                              <xs:enumeration value="Conductor"/>
                              <xs:enumeration value="Dielectric"/>
                              <xs:enumeration value="Plane"/>
                              <xs:enumeration value="Mask"/>
                              <xs:enumeration value="Die Stack"/>
                            </xs:restriction>
                          </xs:simpleType>
                        </xs:attribute>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                  <xs:attribute name="TopIndex" type="xs:decimal" use="required"/>
                  <xs:attribute name="BottomIndex" type="xs:decimal" use="required"/>
                  <xs:attribute name="StackupOrder">
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:pattern value="([0-9]+[ ])+"/>
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="PrimaryStackup" type="xs:string" use="optional"/>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <!-- stackupOrder attribute shouldn't be here, but adding it to the schema to support techfiles written by v17-2-30 and 31-->
            <xs:attribute name="StackupOrder">
              <xs:simpleType>
                <xs:restriction base="xs:string">
                  <xs:pattern value="([0-9]+[ ])+"/>
                </xs:restriction>
              </xs:simpleType>
            </xs:attribute>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
      <xs:attribute name="AltName" type="xs:string"/>
      <xs:attribute name="Name" type="xs:string" use="required"/>
      <xs:attribute name="TopologyID" use="optional" type="l:TopologyIDPattern">
        <xs:annotation>
          <xs:documentation>For ECSets only: the value of the /cft:root/cft:dir-skill/cft:dir[@Name='topology']/cft:txt@Name attribute containing the topology data for this ECSet</xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="Generic" use="optional" type="l:bool">
        <xs:annotation>
          <xs:documentation>Only for layer objects, '1' if the layer is generic</xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="AutoXNetsUsingGates" use="optional" type="l:bool">
        <xs:annotation>
          <xs:documentation>Only for Design objects, '1' if the Design will automatically create XNets using Gates.</xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="DmlAuditRequired" use="optional" type="l:bool">
        <xs:annotation>
          <xs:documentation>Only for Design objects, '1' if running DML Audit is required.</xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="XNetState" use="optional" type="xs:decimal">
      </xs:attribute>
    </xs:complexType>
  </xs:element>

  <xs:element name="attribute">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="value">
          <xs:complexType>
            <xs:attribute name="Generic" type="xs:string" use="optional"/>
            <xs:attribute name="Value" type="xs:string" use="optional"/>
          </xs:complexType>
        </xs:element>
        <xs:element name="status" type="l:AttrStatusListTp" minOccurs="0"/>
        <xs:element name="origin" type="l:AttrOriginListTp" minOccurs="0"/>
        <xs:element name="parent" type="l:ObjRefTp" minOccurs="0"/>
      </xs:sequence>
      <xs:attribute name="Name" type="xs:string" use="required"/>
    </xs:complexType>
  </xs:element>

  <xs:complexType name="AttrStatusListTp">
    <xs:sequence>
      <xs:element name="v" maxOccurs="unbounded">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:enumeration value="Violation"/>
            <xs:enumeration value="Verified"/>
            <xs:enumeration value="Verifyfailed"/>
            <xs:enumeration value="Nan"/>
            <xs:enumeration value="CsetFlattened"/>
            <xs:enumeration value="Locked"/>
            <xs:enumeration value="Sysflattened"/>
            <xs:enumeration value="BlockFlattened"/>
            <xs:enumeration value="Fromopf"/>
            <xs:enumeration value="AliasFlattened"/>
            <xs:enumeration value="AliasConflict"/>
            <xs:enumeration value="ResolvedConflict"/>
            <xs:enumeration value="DMLAudit"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="AttrOriginListTp">
    <xs:sequence>
      <xs:element name="v" maxOccurs="unbounded">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:enumeration value="BE"/>
            <xs:enumeration value="FE"/>
            <xs:enumeration value="Symbol"/>
            <xs:enumeration value="Keyptf"/>
            <xs:enumeration value="InjectedPTF"/>
            <xs:enumeration value="Packager"/>
            <xs:enumeration value="ThirdParty"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="ObjFlagsListTp">
    <xs:sequence>
      <xs:element name="v" maxOccurs="unbounded">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:enumeration value="PowerIntegrity"/>
            <xs:enumeration value="Assembly"/>
            <xs:enumeration value="Electrical"/>
            <xs:enumeration value="Spacing"/>
            <xs:enumeration value="Physical"/>
            <xs:enumeration value="LibDefined"/>
            <xs:enumeration value="SNSpacing"/>
            <xs:enumeration value="Renamed"/>
            <xs:enumeration value="Alias"/>
            <xs:enumeration value="PreDefined"/>
            <xs:enumeration value="ReadOnly"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="AttributeContainerTp">
    <xs:sequence>
      <xs:element ref="l:attribute" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>
  <xs:simpleType name="TopologyIDPattern">
    <xs:restriction base="xs:string">
      <xs:pattern value="T[0-9]+"/>
    </xs:restriction>
  </xs:simpleType>

</xs:schema>
