added bitcount to IOs

This commit is contained in:
hneemann 2019-07-11 11:32:12 +02:00
parent 25b03f205f
commit 5c65720a51
6 changed files with 89 additions and 71 deletions

View File

@ -28,6 +28,12 @@
<string>intFormat</string>
<intFormat>bin</intFormat>
</entry>
<entry>
<string>generic</string>
<string>if (isPresent(args)) {
this.Bits=int(args.dataBits);
}</string>
</entry>
</elementAttributes>
<pos x="500" y="140"/>
</visualElement>
@ -46,6 +52,12 @@
<string>intFormat</string>
<intFormat>bin</intFormat>
</entry>
<entry>
<string>generic</string>
<string>if (isPresent(args)) {
this.Bits=int(args.dataBits);
}</string>
</entry>
</elementAttributes>
<pos x="400" y="120"/>
</visualElement>
@ -60,6 +72,12 @@
<string>Bits</string>
<int>4</int>
</entry>
<entry>
<string>generic</string>
<string>if (isPresent(args)) {
this.Bits=bitsNeededFor(args.dataBits-1);
}</string>
</entry>
</elementAttributes>
<pos x="400" y="160"/>
</visualElement>

View File

@ -33,6 +33,12 @@
<string>Bits</string>
<int>8</int>
</entry>
<entry>
<string>generic</string>
<string>if (isPresent(args)) {
this.Bits=int(args.dataBits);
}</string>
</entry>
</elementAttributes>
<pos x="600" y="140"/>
</visualElement>
@ -47,6 +53,12 @@
<string>Bits</string>
<int>8</int>
</entry>
<entry>
<string>generic</string>
<string>if (isPresent(args)) {
this.Bits=int(args.dataBits);
}</string>
</entry>
</elementAttributes>
<pos x="280" y="120"/>
</visualElement>

View File

@ -33,6 +33,12 @@
<string>Bits</string>
<int>8</int>
</entry>
<entry>
<string>generic</string>
<string>if (isPresent(args)) {
this.Bits=int(args.dataBits);
}</string>
</entry>
</elementAttributes>
<pos x="600" y="140"/>
</visualElement>
@ -47,6 +53,12 @@
<string>Bits</string>
<int>8</int>
</entry>
<entry>
<string>generic</string>
<string>if (isPresent(args)) {
this.Bits=int(args.dataBits);
}</string>
</entry>
</elementAttributes>
<pos x="300" y="120"/>
</visualElement>

View File

@ -33,6 +33,12 @@
<string>Bits</string>
<int>8</int>
</entry>
<entry>
<string>generic</string>
<string>if (isPresent(args)) {
this.Bits=int(args.dataBits);
}</string>
</entry>
</elementAttributes>
<pos x="600" y="140"/>
</visualElement>
@ -47,6 +53,12 @@
<string>Bits</string>
<int>8</int>
</entry>
<entry>
<string>generic</string>
<string>if (isPresent(args)) {
this.Bits=int(args.dataBits);
}</string>
</entry>
</elementAttributes>
<pos x="300" y="120"/>
</visualElement>

View File

@ -49,6 +49,12 @@ if (isPresent(args)) {
<string>intFormat</string>
<intFormat>bin</intFormat>
</entry>
<entry>
<string>generic</string>
<string>if (isPresent(args)) {
this.Bits=int(args.dataBits);
}</string>
</entry>
</elementAttributes>
<pos x="540" y="140"/>
</visualElement>
@ -67,6 +73,12 @@ if (isPresent(args)) {
<string>intFormat</string>
<intFormat>bin</intFormat>
</entry>
<entry>
<string>generic</string>
<string>if (isPresent(args)) {
this.Bits=int(args.dataBits);
}</string>
</entry>
</elementAttributes>
<pos x="180" y="100"/>
</visualElement>
@ -81,6 +93,12 @@ if (isPresent(args)) {
<string>Bits</string>
<int>4</int>
</entry>
<entry>
<string>generic</string>
<string>if (isPresent(args)) {
this.Bits=int(args.shiftBits);
}</string>
</entry>
</elementAttributes>
<pos x="180" y="140"/>
</visualElement>
@ -96,8 +114,23 @@ if (isPresent(args)) {
dataBits = args.dataBits;
shiftBits = args.shiftBits-1;
dir=args.dir;
if (args.shiftBits=1) {
setCircuit(&quot;shift-nop-inc.dig&quot;);
if (args.shiftBits=2) {
export shift := 1;
if (args.dir=&quot;right&quot;) {
setCircuit(&quot;shift-fixed-right-inc.dig&quot;);
} else {
if (args.dir=&quot;arith&quot;) {
setCircuit(&quot;shift-fixed-arith-right-inc.dig&quot;);
} else {
if (args.dir!=&quot;left&quot;) {
panic(&quot;only \&quot;left\&quot;, \&quot;right\&quot; or \&quot;arith\&quot; is allowed as direction, not \&quot;&quot;+args.dir+&quot;\&quot;!&quot;);
}
setCircuit(&quot;shift-fixed-left-inc.dig&quot;);
}
}
}
}</string>
</entry>

View File

@ -1,69 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<circuit>
<version>1</version>
<attributes>
<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>
</elementAttributes>
<pos x="220" y="100"/>
</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>
</elementAttributes>
<pos x="180" y="100"/>
</visualElement>
<visualElement>
<elementName>In</elementName>
<elementAttributes>
<entry>
<string>Label</string>
<string>sh</string>
</entry>
<entry>
<string>Bits</string>
<int>5</int>
</entry>
</elementAttributes>
<pos x="180" y="140"/>
</visualElement>
</visualElements>
<wires>
<wire>
<p1 x="180" y="100"/>
<p2 x="220" y="100"/>
</wire>
</wires>
<measurementOrdering/>
</circuit>