<?xml version="1.0" encoding="UTF-8"?>
<net name="cntr_up_dn" type="iopt-flow">
  <place id="p1" x="300" y="180" init_marking="1">
    <name off_x="-10" off_y="-10" text="PCntUp"/>
    <comment off_x="0" off_y="20" text="-"/>
  </place>
  <place id="p2" x="300" y="285" init_marking="0">
    <name off_x="-10" off_y="-10" text="PCntDown"/>
    <comment off_x="0" off_y="20" text="-"/>
  </place>
  <transition id="t3" x="350" y="230" priority="0">
    <name off_x="-10" off_y="-10" text="TMax"/>
    <comment off_x="0" off_y="20" text="-"/>
  </transition>
  <transition id="t4" x="240" y="230" priority="0">
    <name off_x="-10" off_y="-10" text="TMin"/>
    <comment off_x="0" off_y="20" text="-"/>
  </transition>
  <signal id="Period" x="65" y="310" mode="input" type="range" min="1" max="4096" frac="0" value="1024" dynamic="none"/>
  <signal id="Cntr" x="565" y="145" mode="output" type="range" min="0" max="4095" dynamic="none" frac="0" value="0"/>
  <event id="Rst" x="290" y="110" mode="input"/>
  <signal id="Enable" x="325" y="130" mode="input" type="boolean" min="0" max="1"/>
  <arc id="a11" type="normal" source="p1" target="t3"/>
  <arc id="a12" type="normal" source="t3" target="p2"/>
  <arc id="a13" type="normal" source="p2" target="t4"/>
  <arc id="a14" type="normal" source="t4" target="p1"/>
  <operation id="o16" x="460" y="145" rot="0" shape="arrow" size="48">
    <name off_x="-10" off_y="5" text="o16"/>
    <input off_x="-48" off_y="-32" name="Rst" id="o16.Rst" type="range" min="-32768" max="32767" dynamic="all"/>
    <input off_x="-48" off_y="-16" name="Enable" id="o16.Enable" type="boolean" min="0" max="1" dynamic="all"/>
    <input off_x="-48" off_y="0" name="p1" id="o16.p1" type="range" min="-32768" max="32767" dynamic="all"/>
    <input off_x="-48" off_y="16" name="p2" id="o16.p2" type="range" min="-32768" max="32767" dynamic="all"/>
    <input off_x="-48" off_y="32" name="Cntr_in" id="o16.Cntr_in" type="range" min="0" max="4095" dynamic="type" frac="0"/>
    <output off_x="48" off_y="0" name="out" id="o16.out" type="range" min="0" max="4095" dynamic="none" frac="0">
      <expression>
        <operand type="literal" value="0"/>
        <operator type="when"/>
        <operand type="sub-expression">
          <operand type="signal" idRef="Rst"/>
        </operand>
        <text>0 WHEN (Rst)</text>
      </expression>
      <expression>
        <operand type="signal" idRef="Cntr_in" delay="1"/>
        <operator type="when"/>
        <operand type="signal" idRef="Enable"/>
        <operator type="equal"/>
        <operand type="literal" value="0"/>
        <text>Cntr_in[-1] WHEN (Enable = 0)</text>
      </expression>
      <expression>
        <operand type="signal" idRef="Cntr_in" delay="1"/>
        <operator type="add"/>
        <operand type="literal" value="1"/>
        <operator type="when"/>
        <operand type="signal" idRef="p1"/>
        <text>Cntr_in[-1] + 1 WHEN (p1)</text>
      </expression>
      <expression>
        <operand type="signal" idRef="Cntr_in" delay="1"/>
        <operator type="sub"/>
        <operand type="literal" value="1"/>
        <text>Cntr_in[-1] - 1 OTHERWISE</text>
      </expression>
    </output>
  </operation>
  <arc id="a17" type="read" source="Rst" target="o16.Rst"/>
  <arc id="a18" type="read" source="Enable" target="o16.Enable"/>
  <arc id="a19" type="read" source="p1" target="o16.p1"/>
  <arc id="a21" type="read" source="p2" target="o16.p2"/>
  <arc id="a22" type="read" source="o16.out" target="o16.Cntr_in" view="symbolic"/>
  <arc id="a23" type="read" source="o16.out" target="Cntr"/>
  <operation id="o26" x="160" y="230" rot="0" shape="arrow" size="24">
    <name off_x="-20" off_y="-10" text="o26"/>
    <input off_x="-25" off_y="0" name="Cntr" id="o26.Cntr" type="range" min="0" max="4095" dynamic="all" frac="0"/>
    <output off_x="24" off_y="0" name="out" id="o26.out" type="boolean" min="0" max="1" dynamic="type" frac="0">
      <expression>
        <operand type="signal" idRef="Cntr"/>
        <operator type="less-or-equal"/>
        <operand type="literal" value="0"/>
        <text>Cntr &lt;= 0</text>
      </expression>
    </output>
  </operation>
  <arc id="a28" type="read" source="Cntr" target="o26.Cntr" view="symbolic"/>
  <arc id="a29" type="read" source="o26.out" target="t4"/>
  <operation id="o30" x="160" y="300" rot="0" shape="arrow" size="24">
    <name off_x="-10" off_y="5" text="o26"/>
    <input off_x="-24" off_y="-8" name="Cntr_B" id="o30.Cntr_B" type="range" min="0" max="4095" dynamic="all" frac="0"/>
    <input off_x="-24" off_y="8" name="Period_B" id="o30.Period_B" type="range" min="1" max="4096" dynamic="all" frac="0"/>
    <output off_x="24" off_y="0" name="out" id="o30.out" type="boolean" min="0" max="1" dynamic="type" frac="0">
      <expression>
        <operand type="signal" idRef="Cntr_B"/>
        <operator type="more-or-equal"/>
        <operand type="signal" idRef="Period_B"/>
        <text>Cntr_B &gt;= Period_B</text>
      </expression>
    </output>
  </operation>
  <arc id="a31" type="read" source="Period" target="o30.Period_B"/>
  <arc id="a32" type="read" source="Cntr" target="o30.Cntr_B" view="symbolic"/>
  <arc id="a33" type="read" source="o30.out" target="t3"/>
  <event id="Max" x="565" y="225" mode="output"/>
  <event id="Min" x="565" y="290" mode="output"/>
  <arc id="a3" type="read" source="t3" target="Max" view="symbolic"/>
  <arc id="a4" type="read" source="t4" target="Min" view="symbolic"/>
</net>
