<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://gres.uninova.pt/iopt-flow/show-pf.xsl" type="text/xsl" ?>
<net name="pwm_gen" type="iopt-flow">
  <signal id="DutyCycle" mode="input" type="range" x="78" y="103" min="0" max="1023"/>
  <signal id="Period" mode="input" type="range" x="79" y="60" min="0" max="1023"/>
  <signal id="OutEnable" mode="input" type="boolean" x="78" y="146"/>
  <signal id="POS_PWM_OUT" mode="output" type="boolean" x="576" y="531"/>
  <operation id="SPOS_PWM_OUTP16" x="489" y="532" size="30">
    <name text="POS_PWM_OUT" off_x="-30" off_y="-30"/>
    <input id="SPOS_PWM_OUTP16.P16" name="P16" off_x="-30" off_y="-20" type="range"/>
    <input id="SPOS_PWM_OUTP16.Counter" name="Counter" off_x="-30" off_y="-3.333333333333332"/>
    <input id="SPOS_PWM_OUTP16.DutyCycle" name="DutyCycle" off_x="-30" off_y="13.333333333333336"/>
    <output id="SPOS_PWM_OUTP16.out" name="out" off_x="30" off_y="0" type="range">
      <expression>
        <operand type="literal" value="1"/>
        <operator type="when"/>
        <operand type="sub-expression">
          <operand type="signal" idRef="P16"/>
          <operator type="and"/>
          <operand type="sub-expression">
            <operand type="signal" idRef="Counter" delay="1"/>
            <operator type="less"/>
            <operand type="signal" idRef="DutyCycle"/>
          </operand>
        </operand>
        <text>1 WHEN (P16 AND (Counter[-1] &lt; DutyCycle))</text>
      </expression>
      <expression>
        <operand type="literal" value="0"/>
        <operator type="otherwise"/>
        <text>0 OTHERWISE</text>
      </expression>
    </output>
  </operation>
  <arc id="S_POS_PWM_OUTP16" type="read" source="16" target="SPOS_PWM_OUTP16.P16"/>
  <arc id="S_POS_PWM_OUTP_in1" type="read" source="Counter" target="SPOS_PWM_OUTP16.Counter" view="symbolic"/>
  <arc id="S_POS_PWM_OUTP_in2" type="read" source="DutyCycle" target="SPOS_PWM_OUTP16.DutyCycle" view="symbolic"/>
  <arc id="S_POS_PWM_OUTP16_out" type="read" source="SPOS_PWM_OUTP16.out" target="POS_PWM_OUT" view="xsymbolic"/>
  <signal id="Counter" mode="output" type="range" x="868" y="71" min="0" max="1023"/>
  <operation id="calc_Counter" x="863" y="147" size="40">
    <name text="Counter" off_x="-35" off_y="-40"/>
    <input id="calc_Counter.Counter" name="Counter" off_x="-40" off_y="-25" type="range"/>
    <input id="calc_Counter.IncCounter" name="IncCounter" off_x="-40" off_y="0" type="event"/>
    <input id="calc_Counter.DecCounter" name="DecCounter" off_x="-40" off_y="25" type="event"/>
    <output id="calc_Counter.out" name="out" off_x="40" off_y="0" type="range">
      <expression>
        <operand type="signal" idRef="Counter" delay="1"/>
        <operator type="add"/>
        <operand type="literal" value="1"/>
        <operator type="when"/>
        <operand type="signal" idRef="IncCounter"/>
        <text>Counter[-1] + 1 WHEN (IncCounter)</text>
      </expression>
      <expression>
        <operand type="signal" idRef="Counter" delay="1"/>
        <operator type="sub"/>
        <operand type="literal" value="1"/>
        <operator type="when"/>
        <operand type="signal" idRef="DecCounter"/>
        <text>Counter[-1] - 1 WHEN (DecCounter)</text>
      </expression>
      <expression>
        <operand type="signal" idRef="Counter" delay="1"/>
        <operator type="otherwise"/>
        <text>Counter[-1] OTHERWISE</text>
      </expression>
    </output>
  </operation>
  <arc id="Counter_drv" type="read" source="calc_Counter.out" target="Counter"/>
  <arc id="Counter_out" type="read" target="calc_Counter.Counter" source="Counter"/>
  <arc id="calc_Counter_1" type="read" source="IncCounter" target="calc_Counter.IncCounter"/>
  <arc id="calc_Counter_2" type="read" source="DecCounter" target="calc_Counter.DecCounter"/>
  <signal id="NEG_PWM_OUT" mode="output" type="boolean" x="575" y="433"/>
  <operation id="SNEG_PWM_OUTP16" x="490" y="435" size="30">
    <name text="NEG_PWM_OUT" off_x="-30" off_y="-30"/>
    <input id="SNEG_PWM_OUTP16.P16" name="P16" off_x="-30" off_y="-20" type="range"/>
    <input id="SNEG_PWM_OUTP16.Counter" name="Counter" off_x="-30" off_y="-3.333333333333332"/>
    <input id="SNEG_PWM_OUTP16.DutyCycle" name="DutyCycle" off_x="-30" off_y="13.333333333333336"/>
    <output id="SNEG_PWM_OUTP16.out" name="out" off_x="30" off_y="0" type="range">
      <expression>
        <operand type="literal" value="1"/>
        <operator type="when"/>
        <operand type="sub-expression">
          <operand type="signal" idRef="P16"/>
          <operator type="and"/>
          <operand type="sub-expression">
            <operand type="signal" idRef="Counter" delay="1"/>
            <operator type="more-or-equal"/>
            <operand type="signal" idRef="DutyCycle"/>
            <operator type="add"/>
            <operand type="literal" value="30"/>
          </operand>
        </operand>
        <text>1 WHEN (P16 AND (Counter[-1] &gt;= DutyCycle + 30))</text>
      </expression>
      <expression>
        <operand type="literal" value="0"/>
        <operator type="otherwise"/>
        <text>0 OTHERWISE</text>
      </expression>
    </output>
  </operation>
  <arc id="S_NEG_PWM_OUTP16" type="read" source="16" target="SNEG_PWM_OUTP16.P16"/>
  <arc id="S_NEG_PWM_OUTP_in1" type="read" source="Counter" target="SNEG_PWM_OUTP16.Counter" view="symbolic"/>
  <arc id="S_NEG_PWM_OUTP_in2" type="read" source="DutyCycle" target="SNEG_PWM_OUTP16.DutyCycle" view="symbolic"/>
  <arc id="S_NEG_PWM_OUTP16_out" type="read" source="SNEG_PWM_OUTP16.out" target="NEG_PWM_OUT" view="xsymbolic"/>
  <signal id="UpdCLK" mode="output" type="boolean" x="862" y="245" min="0" max="1"/>
  <operation id="calc_UpdCLK" x="852" y="317" size="40">
    <name text="UpdCLK" off_x="-35" off_y="-40"/>
    <input id="calc_UpdCLK.UpdCLK" name="UpdCLK" off_x="-40" off_y="-25" type="range"/>
    <input id="calc_UpdCLK.UpdClk" name="UpdClk" off_x="-40" off_y="25" type="event"/>
    <output id="calc_UpdCLK.out" name="out" off_x="40" off_y="0" type="range">
      <expression>
        <operand type="signal" idRef="UpdCLK" delay="1"/>
        <operator type="add"/>
        <operand type="literal" value="1"/>
        <operator type="when"/>
        <operand type="signal" idRef="UpdClk"/>
        <text>UpdCLK[-1] + 1 WHEN (UpdClk)</text>
      </expression>
      <expression>
        <operand type="signal" idRef="UpdCLK" delay="1"/>
        <operator type="otherwise"/>
        <text>UpdCLK[-1] OTHERWISE</text>
      </expression>
    </output>
  </operation>
  <arc id="UpdCLK_drv" type="read" source="calc_UpdCLK.out" target="UpdCLK"/>
  <arc id="UpdCLK_out" type="read" target="calc_UpdCLK.UpdCLK" source="UpdCLK"/>
  <arc id="calc_UpdCLK_1" type="read" source="UpdClk" target="calc_UpdCLK.UpdClk"/>
  <signal id="BlankSWNoise" mode="output" type="boolean" x="358" y="545" min="0" max="1"/>
  <operation id="SBlankSWNoiseP16" x="280" y="546" size="30">
    <name text="BlankSWNoise" off_x="-30" off_y="-30"/>
    <input id="SBlankSWNoiseP16.P16" name="P16" off_x="-30" off_y="-20" type="range"/>
    <input id="SBlankSWNoiseP16.Counter" name="Counter" off_x="-30" off_y="-3.333333333333332"/>
    <input id="SBlankSWNoiseP16.DutyCycle" name="DutyCycle" off_x="-30" off_y="13.333333333333336"/>
    <output id="SBlankSWNoiseP16.out" name="out" off_x="30" off_y="0" type="range">
      <expression>
        <operand type="literal" value="1"/>
        <operator type="when"/>
        <operand type="sub-expression">
          <operand type="signal" idRef="P16"/>
          <operator type="and"/>
          <operand type="sub-expression">
            <operand type="signal" idRef="Counter" delay="1"/>
            <operator type="more"/>
            <operand type="signal" idRef="DutyCycle"/>
            <operator type="sub"/>
            <operand type="literal" value="40"/>
          </operand>
        </operand>
        <text>1 WHEN (P16 AND (Counter[-1] &gt; DutyCycle - 40))</text>
      </expression>
      <expression>
        <operand type="literal" value="0"/>
        <operator type="otherwise"/>
        <text>0 OTHERWISE</text>
      </expression>
    </output>
  </operation>
  <arc id="S_BlankSWNoiseP16" type="read" source="16" target="SBlankSWNoiseP16.P16"/>
  <arc id="S_BlankSWNoiseP_in1" type="read" source="Counter" target="SBlankSWNoiseP16.Counter" view="symbolic"/>
  <arc id="S_BlankSWNoiseP_in2" type="read" source="DutyCycle" target="SBlankSWNoiseP16.DutyCycle" view="symbolic"/>
  <arc id="S_BlankSWNoiseP16_out" type="read" source="SBlankSWNoiseP16.out" target="BlankSWNoise" view="xsymbolic"/>
  <event id="IncCounter" mode="internal" x="739" y="145"/>
  <arc id="IncCounter_in_evt" type="read" source="4" target="IncCounter" view="symbolic"/>
  <event id="DecCounter" mode="internal" x="738" y="174"/>
  <arc id="DecCounter_in_evt" type="read" source="7" target="DecCounter" view="symbolic"/>
  <event id="UpdClk" mode="internal" x="744" y="341"/>
  <operation id="UpdClk_or" x="662" y="341" size="30">
    <name text="OR" off_x="-10" off_y="4"/>
    <input id="UpdClk_or.tr1" name="tr1" off_x="-30" off_y="-10" type="event"/>
    <input id="UpdClk_or.tr2" name="tr2" off_x="-30" off_y="10" type="event"/>
    <output id="UpdClk_or.out" name="out" off_x="30" off_y="0" type="event">
      <expression>
        <operand type="signal" idRef="tr1"/>
        <operator type="or"/>
        <operand type="signal" idRef="tr2"/>
        <text>tr1 OR tr2</text>
      </expression>
    </output>
  </operation>
  <arc id="UpdClk_in_1" type="read" source="6" target="UpdClk_or.tr1" view="symbolic"/>
  <arc id="UpdClk_in_2" type="read" source="8" target="UpdClk_or.tr2" view="symbolic"/>
  <arc id="UpdClk-in-evt" type="read" source="UpdClk_or.out" target="UpdClk"/>
  <place id="2" x="456" y="65" init_marking="1">
    <name text="P_CNT_UP" off_x="-22" off_y="-44"/>
    <comment text="" off_x="-30" off_y="20"/>
  </place>
  <place id="3" x="455" y="225" init_marking="0">
    <name text="P_CNT_DN" off_x="-19" off_y="35"/>
    <comment text="" off_x="-30" off_y="20"/>
  </place>
  <place id="16" x="252" y="413" init_marking="0">
    <name text="PEnabled" off_x="31" off_y="7"/>
    <comment text="" off_x="-30" off_y="20"/>
  </place>
  <place id="17" x="250" y="227" init_marking="1">
    <name text="PDisabled" off_x="36" off_y="-1"/>
    <comment text="" off_x="-30" off_y="20"/>
  </place>
  <transition id="4" x="565" y="65" priority="2">
    <name text="T_CNT_UP" off_x="7" off_y="24"/>
    <comment text="" off_x="-30" off_y="20"/>
  </transition>
  <transition id="6" x="378" y="145" priority="1">
    <name text="T_MAX" off_x="-23" off_y="-24"/>
    <comment text="" off_x="-30" off_y="20"/>
  </transition>
  <operation id="6_guard" size="25" x="311" y="145">
    <name text="Guard" off_x="-20" off_y="-22"/>
    <input id="6_guard.Counter" name="Counter" off_x="-25" off_y="-6.666666666666666"/>
    <input id="6_guard.Period" name="Period" off_x="-25" off_y="6.666666666666668"/>
    <output id="6_guard.C" name="C" off_x="25" off_y="0" type="boolean">
      <expression>
        <operand type="signal" idRef="Counter" delay="1"/>
        <operator type="more-or-equal"/>
        <operand type="signal" idRef="Period"/>
        <text>Counter[-1] &gt;= Period</text>
      </expression>
    </output>
  </operation>
  <arc id="6_gc" type="read" source="6_guard.C" target="6"/>
  <arc id="6_guard_in1" type="read" source="Counter" target="6_guard.Counter" view="symbolic"/>
  <arc id="6_guard_in2" type="read" source="Period" target="6_guard.Period" view="symbolic"/>
  <transition id="7" x="565" y="225" priority="2">
    <name text="T_CNT_DN" off_x="6" off_y="-21"/>
    <comment text="" off_x="-30" off_y="20"/>
  </transition>
  <transition id="8" x="542" y="148" priority="1">
    <name text="T_MIN" off_x="13" off_y="-24"/>
    <comment text="" off_x="-30" off_y="20"/>
  </transition>
  <operation id="8_guard" size="25" x="478" y="148">
    <name text="Guard" off_x="-20" off_y="-22"/>
    <input id="8_guard.Counter" name="Counter" off_x="-25" off_y="0"/>
    <output id="8_guard.C" name="C" off_x="25" off_y="0" type="boolean">
      <expression>
        <operand type="signal" idRef="Counter" delay="1"/>
        <operator type="equal"/>
        <operand type="literal" value="0"/>
        <text>Counter[-1] = 0</text>
      </expression>
    </output>
  </operation>
  <arc id="8_gc" type="read" source="8_guard.C" target="8"/>
  <arc id="8_guard_in1" type="read" source="Counter" target="8_guard.Counter" view="symbolic"/>
  <transition id="18" x="357" y="324" priority="1">
    <name text="TEnb" off_x="6" off_y="-21"/>
    <comment text="" off_x="-30" off_y="20"/>
  </transition>
  <operation id="18_guard" size="25" x="268" y="324">
    <name text="Guard" off_x="-20" off_y="-22"/>
    <input id="18_guard.OutEnable" name="OutEnable" off_x="-25" off_y="-10"/>
    <input id="18_guard.Counter" name="Counter" off_x="-25" off_y="0"/>
    <input id="18_guard.Period" name="Period" off_x="-25" off_y="10"/>
    <output id="18_guard.C" name="C" off_x="25" off_y="0" type="boolean">
      <expression>
        <operand type="signal" idRef="OutEnable"/>
        <operator type="equal"/>
        <operand type="literal" value="1"/>
        <operator type="and"/>
        <operand type="signal" idRef="Counter" delay="1"/>
        <operator type="equal"/>
        <operand type="signal" idRef="Period"/>
        <text>OutEnable = 1 AND Counter[-1] = Period</text>
      </expression>
    </output>
  </operation>
  <arc id="18_gc" type="read" source="18_guard.C" target="18"/>
  <arc id="18_guard_in1" type="read" source="OutEnable" target="18_guard.OutEnable" view="symbolic"/>
  <arc id="18_guard_in2" type="read" source="Counter" target="18_guard.Counter" view="symbolic"/>
  <arc id="18_guard_in3" type="read" source="Period" target="18_guard.Period" view="symbolic"/>
  <transition id="19" x="155" y="323" priority="1">
    <name text="Tdis" off_x="3" off_y="-19"/>
    <comment text="" off_x="-30" off_y="20"/>
  </transition>
  <operation id="19_guard" size="25" x="84" y="324">
    <name text="Guard" off_x="-20" off_y="-22"/>
    <input id="19_guard.OutEnable" name="OutEnable" off_x="-25" off_y="0"/>
    <output id="19_guard.C" name="C" off_x="25" off_y="0" type="boolean">
      <expression>
        <operand type="signal" idRef="OutEnable"/>
        <operator type="equal"/>
        <operand type="literal" value="0"/>
        <text>OutEnable = 0</text>
      </expression>
    </output>
  </operation>
  <arc id="19_gc" type="read" source="19_guard.C" target="19"/>
  <arc id="19_guard_in1" type="read" source="OutEnable" target="19_guard.OutEnable" view="symbolic"/>
  <arc id="5" source="2" target="4" type="normal"/>
  <arc id="9" source="4" target="2" type="normal"/>
  <arc id="10" source="3" target="7" type="normal"/>
  <arc id="11" source="7" target="3" type="normal"/>
  <arc id="12" source="2" target="6" type="normal"/>
  <arc id="13" source="6" target="3" type="normal"/>
  <arc id="14" source="3" target="8" type="normal"/>
  <arc id="15" source="8" target="2" type="normal"/>
  <arc id="20" source="17" target="18" type="normal"/>
  <arc id="21" source="18" target="16" type="normal"/>
  <arc id="22" source="16" target="19" type="normal"/>
  <arc id="23" source="19" target="17" type="normal"/>
</net>
