<?xml version="1.0" encoding="utf-8"?>
<circuit>
  <version>1</version>
  <attributes/>
  <visualElements>
    <visualElement>
      <elementName>Counter</elementName>
      <elementAttributes>
        <entry>
          <string>Bits</string>
          <int>4</int>
        </entry>
      </elementAttributes>
      <pos x="300" y="200"/>
    </visualElement>
    <visualElement>
      <elementName>In</elementName>
      <elementAttributes>
        <entry>
          <string>Label</string>
          <string>clk</string>
        </entry>
      </elementAttributes>
      <pos x="180" y="220"/>
    </visualElement>
    <visualElement>
      <elementName>In</elementName>
      <elementAttributes>
        <entry>
          <string>Label</string>
          <string>en</string>
        </entry>
      </elementAttributes>
      <pos x="280" y="200"/>
    </visualElement>
    <visualElement>
      <elementName>In</elementName>
      <elementAttributes>
        <entry>
          <string>Label</string>
          <string>clr</string>
        </entry>
      </elementAttributes>
      <pos x="280" y="240"/>
    </visualElement>
    <visualElement>
      <elementName>Out</elementName>
      <elementAttributes>
        <entry>
          <string>Label</string>
          <string>out</string>
        </entry>
        <entry>
          <string>Bits</string>
          <int>4</int>
        </entry>
      </elementAttributes>
      <pos x="460" y="200"/>
    </visualElement>
    <visualElement>
      <elementName>Out</elementName>
      <elementAttributes>
        <entry>
          <string>Label</string>
          <string>ov</string>
        </entry>
      </elementAttributes>
      <pos x="380" y="220"/>
    </visualElement>
    <visualElement>
      <elementName>Testcase</elementName>
      <elementAttributes>
        <entry>
          <string>Testdata</string>
          <testData>
            <dataString>clk clr en out ov
 0   1   0  0  0
# not counting if clr is high
 C   1   1  0  0
 C   1   1  0  0

# not counting if en is low
 C   0   0  0  0
 C   0   0  0  0

# normal operation
repeat(14) C   0   1  (n+1)  0

 C   0   1  15  1

# combinatorial ov output
 0   0   0  15  0
 0   0   1  15  1

# overflow
 C   0   1  0  0
 C   0   0  0  0

#sync clr
 C   0   1  1  0
 0   0   0  1  0
 0   1   0  1  0
 C   1   0  0  0
</dataString>
          </testData>
        </entry>
      </elementAttributes>
      <pos x="280" y="300"/>
    </visualElement>
  </visualElements>
  <wires>
    <wire>
      <p1 x="280" y="240"/>
      <p2 x="300" y="240"/>
    </wire>
    <wire>
      <p1 x="360" y="200"/>
      <p2 x="460" y="200"/>
    </wire>
    <wire>
      <p1 x="280" y="200"/>
      <p2 x="300" y="200"/>
    </wire>
    <wire>
      <p1 x="180" y="220"/>
      <p2 x="300" y="220"/>
    </wire>
    <wire>
      <p1 x="360" y="220"/>
      <p2 x="380" y="220"/>
    </wire>
  </wires>
</circuit>