<?xml version="1.0" encoding="utf-8"?>
<circuit>
  <version>1</version>
  <attributes>
    <entry>
      <string>Description</string>
      <string>Barrel-Shifter with selectable bit width.
{{de Barrel-Shifter mit wählbarer Bitbreite.}}</string>
    </entry>
    <entry>
      <string>isGeneric</string>
      <boolean>true</boolean>
    </entry>
  </attributes>
  <visualElements>
    <visualElement>
      <elementName>Out</elementName>
      <elementAttributes>
        <entry>
          <string>Label</string>
          <string>D</string>
        </entry>
        <entry>
          <string>Bits</string>
          <int>16</int>
        </entry>
        <entry>
          <string>intFormat</string>
          <intFormat>bin</intFormat>
        </entry>
        <entry>
          <string>generic</string>
          <string>this.Bits=int(args.dataBits);</string>
        </entry>
      </elementAttributes>
      <pos x="500" y="140"/>
    </visualElement>
    <visualElement>
      <elementName>In</elementName>
      <elementAttributes>
        <entry>
          <string>Label</string>
          <string>D_in</string>
        </entry>
        <entry>
          <string>Bits</string>
          <int>16</int>
        </entry>
        <entry>
          <string>intFormat</string>
          <intFormat>bin</intFormat>
        </entry>
        <entry>
          <string>generic</string>
          <string>this.Bits=int(args.dataBits);</string>
        </entry>
      </elementAttributes>
      <pos x="400" y="120"/>
    </visualElement>
    <visualElement>
      <elementName>In</elementName>
      <elementAttributes>
        <entry>
          <string>Label</string>
          <string>sh</string>
        </entry>
        <entry>
          <string>Bits</string>
          <int>4</int>
        </entry>
        <entry>
          <string>generic</string>
          <string>this.Bits=bitsNeededFor(args.dataBits-1);</string>
        </entry>
      </elementAttributes>
      <pos x="400" y="160"/>
    </visualElement>
    <visualElement>
      <elementName>shift-inc.dig</elementName>
      <elementAttributes>
        <entry>
          <string>generic</string>
          <string>if (args.direction=&quot;right&quot;) {
      export circuit:=&quot;shift-fixed-right-inc.dig&quot;;
} else {
      if (args.direction=&quot;arith&quot;) {
          export circuit:=&quot;shift-fixed-arith-right-inc.dig&quot;;
      } else {
          if (args.direction=&quot;left&quot;) {
              export circuit:=&quot;shift-fixed-left-inc.dig&quot;;
          } else {
              panic(&quot;only \&quot;left\&quot;, \&quot;right\&quot; or \&quot;arith\&quot; is allowed as direction, not \&quot;&quot;+args.direction+&quot;\&quot;!&quot;);
          }
      }
}

shiftBits:=bitsNeededFor(args.dataBits-1);</string>
        </entry>
      </elementAttributes>
      <pos x="420" y="120"/>
    </visualElement>
    <visualElement>
      <elementName>GenericInitCode</elementName>
      <elementAttributes>
        <entry>
          <string>generic</string>
          <string>dataBits := 5;
direction := &quot;left&quot;;</string>
        </entry>
      </elementAttributes>
      <pos x="360" y="200"/>
    </visualElement>
    <visualElement>
      <elementName>Testcase</elementName>
      <elementAttributes>
        <entry>
          <string>Label</string>
          <string>4 bits, left</string>
        </entry>
        <entry>
          <string>Testdata</string>
          <testData>
            <dataString>D_in sh D

  1  0  1
  1  1  2
  1  2  4
  1  3  8
  1  4  1

  2  0  2
  2  1  4
  2  2  8
  2  3  0
  2  4  2
</dataString>
          </testData>
        </entry>
        <entry>
          <string>generic</string>
          <string>dataBits := 4;
direction := &quot;left&quot;;</string>
        </entry>
      </elementAttributes>
      <pos x="200" y="0"/>
    </visualElement>
    <visualElement>
      <elementName>Testcase</elementName>
      <elementAttributes>
        <entry>
          <string>Label</string>
          <string>4 bits, right</string>
        </entry>
        <entry>
          <string>Testdata</string>
          <testData>
            <dataString>D_in sh D

  1  0  1
  2  1  1
  4  2  1
  8  3  1
  1  4  1

  4  0  4
  4  1  2
  4  2  1
  4  3  0
  4  4  4

 15  1  7</dataString>
          </testData>
        </entry>
        <entry>
          <string>generic</string>
          <string>dataBits := 4;
direction := &quot;right&quot;;</string>
        </entry>
      </elementAttributes>
      <pos x="380" y="0"/>
    </visualElement>
    <visualElement>
      <elementName>Testcase</elementName>
      <elementAttributes>
        <entry>
          <string>Label</string>
          <string>4 bits, arith</string>
        </entry>
        <entry>
          <string>Testdata</string>
          <testData>
            <dataString>D_in sh D

  1  0  1
  2  1  1
  4  2  1
  8  3  15
  1  4  1

  4  0  4
  4  1  2
  4  2  1
  4  3  0
  4  4  4

 15  1  15</dataString>
          </testData>
        </entry>
        <entry>
          <string>generic</string>
          <string>dataBits := 4;
direction := &quot;arith&quot;;</string>
        </entry>
      </elementAttributes>
      <pos x="540" y="0"/>
    </visualElement>
    <visualElement>
      <elementName>Text</elementName>
      <elementAttributes>
        <entry>
          <string>Description</string>
          <string>A BarrelShifter implemented using recursion.
{{de Ein rekursiv implementierter BarrelShifter.}}</string>
        </entry>
      </elementAttributes>
      <pos x="180" y="-100"/>
    </visualElement>
  </visualElements>
  <wires>
    <wire>
      <p1 x="400" y="160"/>
      <p2 x="420" y="160"/>
    </wire>
    <wire>
      <p1 x="400" y="120"/>
      <p2 x="420" y="120"/>
    </wire>
    <wire>
      <p1 x="480" y="140"/>
      <p2 x="500" y="140"/>
    </wire>
  </wires>
  <measurementOrdering/>
</circuit>