<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href='http://gres.uninova.pt/iopt-flow/show-pf.xsl' type='text/xsl' ?>
<net name="VideoScan" type="iopt-flow">
  <event id="Reset" x="70" y="65" mode="input"/>
  <operation id="o2" x="120" y="120" rot="0" shape="arrow" size="24">
    <name off_x="-10" off_y="5" text="CntX"/>
    <input off_x="-24" off_y="-8" name="Reset" id="o2.Reset" type="event"/>
    <input off_x="-24" off_y="8" name="X" id="o2.X" type="boolean" min="0" max="1"/>
    <output off_x="24" off_y="0" name="out" id="o2.out">
      <expression>
        <operand type="literal" value="0"/>
        <operator type="when"/>
        <operand type="sub-expression">
          <operand type="signal" idRef="Reset"/>
        </operand>
        <text>0 WHEN (Reset)</text>
      </expression>
      <expression>
        <operand type="signal" idRef="X" delay="1"/>
        <operator type="add"/>
        <operand type="literal" value="1"/>
        <operator type="when"/>
        <operand type="sub-expression">
          <operand type="signal" idRef="X" delay="1"/>
          <operator type="less"/>
          <operand type="literal" value="1304"/>
        </operand>
        <text>X[-1] + 1 WHEN (X[-1] &lt; 1304)</text>
      </expression>
      <expression>
        <operand type="literal" value="0"/>
        <text>0 OTHERWISE</text>
      </expression>
    </output>
  </operation>
  <signal id="X" x="190" y="120" mode="output" type="boolean" min="0" max="1"/>
  <arc id="a4" type="read" source="Reset" target="o2.Reset"/>
  <arc id="a5" type="read" source="X" target="o2.X" view="symbolic"/>
  <arc id="a6" type="read" source="o2.out" target="X"/>
  <operation id="o7" x="275" y="120" rot="0" shape="arrow" size="32">
    <name off_x="-10" off_y="5" text="CntY"/>
    <input off_x="-32" off_y="-16" name="Reset" id="o7.Reset" type="event"/>
    <input off_x="-32" off_y="0" name="X" id="o7.X" type="boolean" min="0" max="1"/>
    <input off_x="-32" off_y="16" name="Y" id="o7.Y" type="boolean" min="0" max="1"/>
    <output off_x="32" off_y="0" name="out" id="o7.out">
      <expression>
        <operand type="literal" value="0"/>
        <operator type="when"/>
        <operand type="sub-expression">
          <operand type="signal" idRef="Reset"/>
        </operand>
        <text>0 WHEN (Reset)</text>
      </expression>
      <expression>
        <operand type="signal" idRef="Y" delay="1"/>
        <operator type="when"/>
        <operand type="sub-expression">
          <operand type="signal" idRef="X"/>
          <operator type="diff"/>
          <operand type="literal" value="0"/>
        </operand>
        <text>Y[-1] WHEN (X &lt;&gt; 0)</text>
      </expression>
      <expression>
        <operand type="signal" idRef="Y" delay="1"/>
        <operator type="add"/>
        <operand type="literal" value="1"/>
        <operator type="when"/>
        <operand type="sub-expression">
          <operand type="signal" idRef="Y" delay="1"/>
          <operator type="less"/>
          <operand type="literal" value="806"/>
        </operand>
        <text>Y[-1] + 1 WHEN (Y[-1] &lt; 806)</text>
      </expression>
      <expression>
        <operand type="literal" value="0"/>
        <text>0 OTHERWISE</text>
      </expression>
    </output>
  </operation>
  <signal id="Y" x="365" y="120" mode="output" type="boolean" min="0" max="1"/>
  <arc id="a9" type="read" source="o7.out" target="Y"/>
  <arc id="a10" type="read" source="Reset" target="o7.Reset"/>
  <arc id="a11" type="read" source="Y" target="o7.Y" view="symbolic"/>
  <arc id="a12" type="read" source="X" target="o7.X"/>
  <operation id="o13" x="445" y="55" rot="0" shape="arrow" size="16">
    <name off_x="-10" off_y="5" text="sX"/>
    <input off_x="-16" off_y="0" name="X" id="o13.X" type="boolean" min="0" max="1"/>
    <output off_x="16" off_y="0" name="out" id="o13.out">
      <expression>
        <operand type="literal" value="1"/>
        <operator type="when"/>
        <operand type="sub-expression">
          <operand type="signal" idRef="X"/>
          <operator type="more"/>
          <operand type="literal" value="1048"/>
          <operator type="and"/>
          <operand type="signal" idRef="X"/>
          <operator type="less"/>
          <operand type="literal" value="1184"/>
        </operand>
        <text>1 WHEN (X &gt; 1048 AND X &lt; 1184)</text>
      </expression>
      <expression>
        <operand type="literal" value="0"/>
        <text>0 OTHERWISE</text>
      </expression>
    </output>
  </operation>
  <signal id="XSync" x="545" y="55" mode="output" type="boolean" min="0" max="1"/>
  <arc id="a15" type="read" source="o13.out" target="XSync"/>
  <arc id="a16" type="read" source="X" target="o13.X" view="symbolic"/>
  <operation id="o17" x="450" y="120" rot="0" shape="arrow" size="16">
    <name off_x="-10" off_y="5" text="sY"/>
    <input off_x="-16" off_y="0" name="Y" id="o17.Y" type="boolean" min="0" max="1"/>
    <output off_x="16" off_y="0" name="out" id="o17.out">
      <expression>
        <operand type="literal" value="1"/>
        <operator type="when"/>
        <operand type="sub-expression">
          <operand type="signal" idRef="Y"/>
          <operator type="more-or-equal"/>
          <operand type="literal" value="771"/>
          <operator type="and"/>
          <operand type="signal" idRef="Y"/>
          <operator type="less-or-equal"/>
          <operand type="literal" value="777"/>
        </operand>
        <text>1 WHEN (Y &gt;= 771 AND Y &lt;= 777)</text>
      </expression>
      <expression>
        <operand type="literal" value="0"/>
        <text>0 OTHERWISE</text>
      </expression>
    </output>
  </operation>
  <signal id="YSync" x="545" y="120" mode="output" type="boolean" min="0" max="1"/>
  <arc id="a19" type="read" source="Y" target="o17.Y"/>
  <arc id="a20" type="read" source="o17.out" target="YSync"/>
  <operation id="o21" x="235" y="245" rot="0" shape="arrow" size="56">
    <name off_x="-10" off_y="5" text="window1"/>
    <input off_x="-56" off_y="-40" name="X" id="o21.X" type="boolean" min="0" max="1"/>
    <input off_x="-56" off_y="-24" name="Y" id="o21.Y" type="boolean" min="0" max="1"/>
    <input off_x="-56" off_y="-8" name="Input1" id="o21.Input1" type="boolean" min="0" max="1"/>
    <input off_x="-56" off_y="8" name="Input2" id="o21.Input2" type="boolean" min="0" max="1"/>
    <input off_x="-56" off_y="24" name="Input3" id="o21.Input3" type="boolean" min="0" max="1"/>
    <input off_x="-56" off_y="40" name="Input4" id="o21.Input4" type="boolean" min="0" max="1"/>
    <output off_x="56" off_y="0" name="out" id="o21.out">
      <expression>
        <operand type="signal" idRef="Input1"/>
        <operator type="when"/>
        <operand type="sub-expression">
          <operand type="signal" idRef="X"/>
          <operator type="more"/>
          <operand type="literal" value="100"/>
          <operator type="and"/>
          <operand type="signal" idRef="X"/>
          <operator type="less"/>
          <operand type="literal" value="300"/>
          <operator type="and"/>
          <operand type="signal" idRef="Y"/>
          <operator type="more"/>
          <operand type="literal" value="80"/>
          <operator type="and"/>
          <operand type="signal" idRef="Y"/>
          <operator type="less"/>
          <operand type="literal" value="120"/>
        </operand>
        <text>Input1 WHEN (X &gt; 100 AND X &lt; 300 AND Y &gt; 80 AND Y &lt; 120)</text>
      </expression>
      <expression>
        <operand type="signal" idRef="Input2"/>
        <operator type="when"/>
        <operand type="sub-expression">
          <operand type="signal" idRef="X"/>
          <operator type="more"/>
          <operand type="literal" value="100"/>
          <operator type="and"/>
          <operand type="signal" idRef="X"/>
          <operator type="less"/>
          <operand type="literal" value="300"/>
          <operator type="and"/>
          <operand type="signal" idRef="Y"/>
          <operator type="more"/>
          <operand type="literal" value="160"/>
          <operator type="and"/>
          <operand type="signal" idRef="Y"/>
          <operator type="less"/>
          <operand type="literal" value="200"/>
        </operand>
        <text>Input2 WHEN (X &gt; 100 AND X &lt; 300 AND Y &gt; 160 AND Y &lt; 200)</text>
      </expression>
      <expression>
        <operand type="signal" idRef="Input3"/>
        <operator type="when"/>
        <operand type="sub-expression">
          <operand type="signal" idRef="X"/>
          <operator type="more"/>
          <operand type="literal" value="100"/>
          <operator type="and"/>
          <operand type="signal" idRef="X"/>
          <operator type="less"/>
          <operand type="literal" value="300"/>
          <operator type="and"/>
          <operand type="signal" idRef="Y"/>
          <operator type="more"/>
          <operand type="literal" value="240"/>
          <operator type="and"/>
          <operand type="signal" idRef="Y"/>
          <operator type="less"/>
          <operand type="literal" value="280"/>
        </operand>
        <text>Input3 WHEN (X &gt; 100 AND X &lt; 300 AND Y &gt; 240 AND Y &lt; 280)</text>
      </expression>
      <expression>
        <operand type="signal" idRef="Input4"/>
        <operator type="when"/>
        <operand type="sub-expression">
          <operand type="signal" idRef="X"/>
          <operator type="more"/>
          <operand type="literal" value="100"/>
          <operator type="and"/>
          <operand type="signal" idRef="X"/>
          <operator type="less"/>
          <operand type="literal" value="300"/>
          <operator type="and"/>
          <operand type="signal" idRef="Y"/>
          <operator type="more"/>
          <operand type="literal" value="320"/>
          <operator type="and"/>
          <operand type="signal" idRef="Y"/>
          <operator type="less"/>
          <operand type="literal" value="360"/>
        </operand>
        <text>Input4 WHEN (X &gt; 100 AND X &lt; 300 AND Y &gt; 320 AND Y &lt; 360)</text>
      </expression>
      <expression>
        <operand type="literal" value="0"/>
        <text>0 OTHERWISE</text>
      </expression>
    </output>
  </operation>
  <signal id="Input1" x="95" y="235" mode="input" type="boolean" min="0" max="1"/>
  <signal id="Input2" x="75" y="255" mode="input" type="boolean" min="0" max="1"/>
  <signal id="Input3" x="105" y="270" mode="input" type="boolean" min="0" max="1"/>
  <signal id="Input4" x="75" y="285" mode="input" type="boolean" min="0" max="1"/>
  <arc id="a26" type="read" source="Input4" target="o21.Input4"/>
  <arc id="a27" type="read" source="Input3" target="o21.Input3"/>
  <arc id="a28" type="read" source="Input2" target="o21.Input2"/>
  <arc id="a29" type="read" source="Input1" target="o21.Input1"/>
  <arc id="a30" type="read" source="X" target="o21.X" view="symbolic"/>
  <arc id="a31" type="read" source="Y" target="o21.Y" view="symbolic"/>
  <operation id="o32" x="225" y="400" rot="0" shape="arrow" size="48">
    <name off_x="-10" off_y="5" text="window2"/>
    <input off_x="-48" off_y="-32" name="X" id="o32.X" type="boolean" min="0" max="1"/>
    <input off_x="-48" off_y="-16" name="Y" id="o32.Y" type="boolean" min="0" max="1"/>
    <input off_x="-48" off_y="0" name="InA" id="o32.InA" type="boolean" min="0" max="1"/>
    <input off_x="-48" off_y="16" name="InB" id="o32.InB" type="boolean" min="0" max="1"/>
    <input off_x="-48" off_y="32" name="InC" id="o32.InC" type="boolean" min="0" max="1"/>
    <output off_x="48" off_y="0" name="out" id="o32.out">
      <expression>
        <operand type="signal" idRef="InA"/>
        <operator type="when"/>
        <operand type="sub-expression">
          <operand type="signal" idRef="X"/>
          <operator type="more"/>
          <operand type="literal" value="400"/>
          <operator type="and"/>
          <operand type="signal" idRef="X"/>
          <operator type="less"/>
          <operand type="literal" value="600"/>
          <operator type="and"/>
          <operand type="signal" idRef="Y"/>
          <operator type="more"/>
          <operand type="literal" value="100"/>
          <operator type="and"/>
          <operand type="signal" idRef="Y"/>
          <operator type="less"/>
          <operand type="literal" value="200"/>
        </operand>
        <text>InA WHEN (X &gt; 400 AND X &lt; 600 AND Y &gt; 100 AND Y &lt; 200)</text>
      </expression>
      <expression>
        <operand type="signal" idRef="InB"/>
        <operator type="when"/>
        <operand type="sub-expression">
          <operand type="signal" idRef="X"/>
          <operator type="more"/>
          <operand type="literal" value="400"/>
          <operator type="and"/>
          <operand type="signal" idRef="X"/>
          <operator type="less"/>
          <operand type="literal" value="600"/>
          <operator type="and"/>
          <operand type="signal" idRef="Y"/>
          <operator type="more"/>
          <operand type="literal" value="250"/>
          <operator type="and"/>
          <operand type="signal" idRef="Y"/>
          <operator type="less"/>
          <operand type="literal" value="350"/>
        </operand>
        <text>InB WHEN (X &gt; 400 AND X &lt; 600 AND Y &gt; 250 AND Y &lt; 350)</text>
      </expression>
      <expression>
        <operand type="signal" idRef="InC"/>
        <operator type="when"/>
        <operand type="sub-expression">
          <operand type="signal" idRef="X"/>
          <operator type="more"/>
          <operand type="literal" value="400"/>
          <operator type="and"/>
          <operand type="signal" idRef="X"/>
          <operator type="less"/>
          <operand type="literal" value="600"/>
          <operator type="and"/>
          <operand type="signal" idRef="Y"/>
          <operator type="more"/>
          <operand type="literal" value="400"/>
          <operator type="and"/>
          <operand type="signal" idRef="Y"/>
          <operator type="less"/>
          <operand type="literal" value="500"/>
        </operand>
        <text>InC WHEN (X &gt; 400 AND X &lt; 600 AND Y &gt; 400 AND Y &lt; 500)</text>
      </expression>
      <expression>
        <operand type="literal" value="0"/>
        <text>0 OTHERWISE</text>
      </expression>
    </output>
  </operation>
  <arc id="a33" type="read" source="Y" target="o32.Y" view="symbolic"/>
  <arc id="a34" type="read" source="X" target="o32.X" view="symbolic"/>
  <signal id="InA" x="120" y="400" mode="input" type="boolean" min="0" max="1"/>
  <signal id="InB" x="90" y="415" mode="input" type="boolean" min="0" max="1"/>
  <signal id="InC" x="65" y="430" mode="input" type="boolean" min="0" max="1"/>
  <arc id="a38" type="read" source="InC" target="o32.InC"/>
  <arc id="a39" type="read" source="InB" target="o32.InB"/>
  <arc id="a40" type="read" source="InA" target="o32.InA"/>
  <operation id="o41" x="415" y="325" rot="0" shape="arrow" size="25" locked="true">
    <name text="MIX" off_x="-12" off_y="-5"/>
    <input id="o41.window1" name="window1" type="boolean" off_x="-25" off_y="-10"/>
    <input id="o41.window2" name="window2" type="boolean" off_x="-25" off_y="10"/>
    <output id="o41.out" name="out" type="boolean" off_x="25" off_y="0">
      <expression>
        <text>window1 OR window2</text>
        <operand type="signal" idRef="window1"/>
        <operator type="or"/>
        <operand type="signal" idRef="window2"/>
      </expression>
    </output>
  </operation>
  <arc id="a42" type="read" source="o32.out" target="o41.window2"/>
  <arc id="a43" type="read" source="o21.out" target="o41.window1"/>
  <signal id="RGB" x="595" y="310" mode="output" type="boolean" min="0" max="1"/>
  <operation id="o8" x="515" y="310" rot="0" shape="arrow" size="32">
    <name off_x="-10" off_y="5" text="Video"/>
    <input off_x="-32" off_y="-16" name="X" id="o8.X" type="boolean" min="0" max="1"/>
    <input off_x="-32" off_y="0" name="Y" id="o8.Y" type="boolean" min="0" max="1"/>
    <input off_x="-32" off_y="16" name="MIX" id="o8.MIX" type="boolean"/>
    <output off_x="32" off_y="0" name="out" id="o8.out">
      <expression>
        <operand type="signal" idRef="MIX"/>
        <operator type="when"/>
        <operand type="signal" idRef="X"/>
        <operator type="less-or-equal"/>
        <operand type="literal" value="1024"/>
        <operator type="and"/>
        <operand type="signal" idRef="Y"/>
        <operator type="less"/>
        <operand type="literal" value="768"/>
        <text>MIX WHEN (X &lt;= 1024 AND Y &lt; 768)</text>
      </expression>
      <expression>
        <operand type="literal" value="0"/>
        <text>0 OTHERWISE</text>
      </expression>
    </output>
  </operation>
  <arc id="a13" type="read" source="X" target="o8.X" view="symbolic"/>
  <arc id="a14" type="read" source="Y" target="o8.Y" view="symbolic"/>
  <arc id="a17" type="read" source="o41.out" target="o8.MIX"/>
  <arc id="a18" type="read" source="o8.out" target="RGB"/>
</net>
