mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-26 14:31:02 -04:00
create an error if add or sub with more then 63 bits are used
This commit is contained in:
parent
007015f461
commit
0368177fc2
@ -5,6 +5,7 @@ import de.neemann.digital.core.element.Element;
|
||||
import de.neemann.digital.core.element.ElementAttributes;
|
||||
import de.neemann.digital.core.element.ElementTypeDescription;
|
||||
import de.neemann.digital.core.element.Keys;
|
||||
import de.neemann.digital.lang.Lang;
|
||||
|
||||
import static de.neemann.digital.core.ObservableValues.ovs;
|
||||
import static de.neemann.digital.core.element.PinInfo.input;
|
||||
@ -75,6 +76,9 @@ public class Add extends Node implements Element {
|
||||
a = inputs.get(0).addObserverToValue(this).checkBits(bits, this);
|
||||
b = inputs.get(1).addObserverToValue(this).checkBits(bits, this);
|
||||
cIn = inputs.get(2).addObserverToValue(this).checkBits(1, this);
|
||||
|
||||
if (bits > 63)
|
||||
throw new BitsException(Lang.get("err_toManyBits_Found_N0_maxIs_N1", bits, 63), this, new ObservableValues(a, b));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -489,6 +489,7 @@ Sind evtl. die Namen der Variablen nicht eindeutig?</string>
|
||||
<string name="err_diodeNeedsPullUpResistorAtOutput">Diode benötigt am Ausgang einen PullUp-Widerstand!</string>
|
||||
<string name="err_diodeNeedsPullDownResistorAtOutput">Diode benötigt am Ausgang einen PullDown-Widerstand!</string>
|
||||
<string name="err_testSignal_N_notFound">Testsignal {0} in der Schaltung nicht gefunden!</string>
|
||||
<string name="err_toManyBits_Found_N0_maxIs_N1">Es sind nur {1} Bits erlaubt, es sind jedoch {0} Bits angegeben!</string>
|
||||
|
||||
<string name="key_AddrBits">Adress-Bits</string>
|
||||
<string name="key_AddrBits_tt">Anzahl der Adress-Bits die verwendet werden.</string>
|
||||
|
@ -479,6 +479,7 @@ The names of the variables may not be unique.</string>
|
||||
<string name="err_diodeNeedsPullUpResistorAtOutput">Diode needs a pull up resistor at its output!</string>
|
||||
<string name="err_diodeNeedsPullDownResistorAtOutput">Diode needs a pull down resistor at its output!</string>
|
||||
<string name="err_testSignal_N_notFound">Test signal {0} not found in the circuit!</string>
|
||||
<string name="err_toManyBits_Found_N0_maxIs_N1">Only {1} bits allowed, but {0} bits found!</string>
|
||||
|
||||
<string name="key_AddrBits">Address Bits</string>
|
||||
<string name="key_AddrBits_tt">Number of address bits used.</string>
|
||||
|
@ -39,8 +39,8 @@ public class TestExamples extends TestCase {
|
||||
*/
|
||||
public void testTestExamples() throws Exception {
|
||||
File examples = new File(Resources.getRoot(), "/dig/test");
|
||||
assertEquals(55, new FileScanner(this::check).scan(examples));
|
||||
assertEquals(51, testCasesInFiles);
|
||||
assertEquals(60, new FileScanner(this::check).scan(examples));
|
||||
assertEquals(56, testCasesInFiles);
|
||||
}
|
||||
|
||||
|
||||
|
160
src/test/resources/dig/test/arith/FullSub.dig
Normal file
160
src/test/resources/dig/test/arith/FullSub.dig
Normal file
@ -0,0 +1,160 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<circuit>
|
||||
<version>1</version>
|
||||
<attributes>
|
||||
<entry>
|
||||
<string>Description</string>
|
||||
<string>FullSub</string>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>Width</string>
|
||||
<int>4</int>
|
||||
</entry>
|
||||
</attributes>
|
||||
<visualElements>
|
||||
<visualElement>
|
||||
<elementName>In</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>A_i</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="220" y="80"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>In</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>B_i</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="220" y="140"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>In</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>BO_i-1</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="220" y="200"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>HalfSub.dig</elementName>
|
||||
<elementAttributes/>
|
||||
<pos x="360" y="80"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>HalfAdder.dig</elementName>
|
||||
<elementAttributes/>
|
||||
<pos x="260" y="140"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Out</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>BO_i</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="540" y="140"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Or</elementName>
|
||||
<elementAttributes/>
|
||||
<pos x="460" y="120"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Out</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>S_i</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="540" y="80"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Testcase</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Testdata</string>
|
||||
<testData>
|
||||
<dataString>A_i B_i BO_i-1 BO_i S_i
|
||||
0 0 0 0 0
|
||||
0 0 1 1 1
|
||||
0 1 0 1 1
|
||||
0 1 1 1 0
|
||||
1 0 0 0 1
|
||||
1 0 1 0 0
|
||||
1 1 0 0 0
|
||||
1 1 1 1 1
|
||||
</dataString>
|
||||
</testData>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="500" y="220"/>
|
||||
</visualElement>
|
||||
</visualElements>
|
||||
<wires>
|
||||
<wire>
|
||||
<p1 x="220" y="80"/>
|
||||
<p2 x="360" y="80"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="420" y="80"/>
|
||||
<p2 x="540" y="80"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="320" y="160"/>
|
||||
<p2 x="460" y="160"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="240" y="160"/>
|
||||
<p2 x="260" y="160"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="340" y="100"/>
|
||||
<p2 x="360" y="100"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="420" y="100"/>
|
||||
<p2 x="440" y="100"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="220" y="200"/>
|
||||
<p2 x="240" y="200"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="440" y="120"/>
|
||||
<p2 x="460" y="120"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="220" y="140"/>
|
||||
<p2 x="260" y="140"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="320" y="140"/>
|
||||
<p2 x="340" y="140"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="520" y="140"/>
|
||||
<p2 x="540" y="140"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="240" y="160"/>
|
||||
<p2 x="240" y="200"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="340" y="100"/>
|
||||
<p2 x="340" y="140"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="440" y="100"/>
|
||||
<p2 x="440" y="120"/>
|
||||
</wire>
|
||||
</wires>
|
||||
</circuit>
|
354
src/test/resources/dig/test/arith/FullSubRC.dig
Normal file
354
src/test/resources/dig/test/arith/FullSubRC.dig
Normal file
@ -0,0 +1,354 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<circuit>
|
||||
<version>1</version>
|
||||
<attributes>
|
||||
<entry>
|
||||
<string>Width</string>
|
||||
<int>4</int>
|
||||
</entry>
|
||||
</attributes>
|
||||
<visualElements>
|
||||
<visualElement>
|
||||
<elementName>Out</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>S_0</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="540" y="340"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>In</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>A_0</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="300" y="320"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>In</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>A_1</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="300" y="220"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Out</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>S_1</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="540" y="240"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>In</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>A_2</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="300" y="120"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>In</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>A_3</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="300" y="20"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Out</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>S_2</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="540" y="140"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>In</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>B_0</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="300" y="360"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>In</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>B_1</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="300" y="260"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Out</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>S_3</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="540" y="40"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>In</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>B_2</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="300" y="160"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>In</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>B_3</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="300" y="60"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Out</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>C_3</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="540" y="-20"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>In</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>C_-1</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="300" y="420"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>FullSub.dig</elementName>
|
||||
<elementAttributes/>
|
||||
<pos x="400" y="320"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>FullSub.dig</elementName>
|
||||
<elementAttributes/>
|
||||
<pos x="400" y="220"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>FullSub.dig</elementName>
|
||||
<elementAttributes/>
|
||||
<pos x="400" y="120"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>FullSub.dig</elementName>
|
||||
<elementAttributes/>
|
||||
<pos x="400" y="20"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Testcase</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Testdata</string>
|
||||
<testData>
|
||||
<dataString># complete test of all 512 possible additions
|
||||
C_-1 A_3 A_2 A_1 A_0 B_3 B_2 B_1 B_0 C_3 S_3 S_2 S_1 S_0
|
||||
repeat(256) 0 bits(4,n>>4) bits(4,n) bits(5,(n>>4)-(n&15))
|
||||
repeat(256) 1 bits(4,n>>4) bits(4,n) bits(5,(n>>4)-(n&15)-1)
|
||||
</dataString>
|
||||
</testData>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="520" y="380"/>
|
||||
</visualElement>
|
||||
</visualElements>
|
||||
<wires>
|
||||
<wire>
|
||||
<p1 x="300" y="320"/>
|
||||
<p2 x="400" y="320"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="480" y="320"/>
|
||||
<p2 x="500" y="320"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="300" y="160"/>
|
||||
<p2 x="340" y="160"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="380" y="160"/>
|
||||
<p2 x="400" y="160"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="300" y="260"/>
|
||||
<p2 x="340" y="260"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="380" y="260"/>
|
||||
<p2 x="400" y="260"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="380" y="100"/>
|
||||
<p2 x="500" y="100"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="300" y="420"/>
|
||||
<p2 x="380" y="420"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="300" y="360"/>
|
||||
<p2 x="340" y="360"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="380" y="360"/>
|
||||
<p2 x="400" y="360"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="380" y="200"/>
|
||||
<p2 x="500" y="200"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="480" y="40"/>
|
||||
<p2 x="540" y="40"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="340" y="40"/>
|
||||
<p2 x="400" y="40"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="380" y="300"/>
|
||||
<p2 x="500" y="300"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="480" y="140"/>
|
||||
<p2 x="540" y="140"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="340" y="140"/>
|
||||
<p2 x="400" y="140"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="480" y="240"/>
|
||||
<p2 x="540" y="240"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="340" y="240"/>
|
||||
<p2 x="400" y="240"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="500" y="-20"/>
|
||||
<p2 x="540" y="-20"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="480" y="340"/>
|
||||
<p2 x="540" y="340"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="340" y="340"/>
|
||||
<p2 x="400" y="340"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="300" y="20"/>
|
||||
<p2 x="400" y="20"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="480" y="20"/>
|
||||
<p2 x="500" y="20"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="300" y="120"/>
|
||||
<p2 x="400" y="120"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="480" y="120"/>
|
||||
<p2 x="500" y="120"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="300" y="220"/>
|
||||
<p2 x="400" y="220"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="480" y="220"/>
|
||||
<p2 x="500" y="220"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="300" y="60"/>
|
||||
<p2 x="340" y="60"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="380" y="60"/>
|
||||
<p2 x="400" y="60"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="340" y="340"/>
|
||||
<p2 x="340" y="360"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="340" y="240"/>
|
||||
<p2 x="340" y="260"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="340" y="140"/>
|
||||
<p2 x="340" y="160"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="340" y="40"/>
|
||||
<p2 x="340" y="60"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="500" y="300"/>
|
||||
<p2 x="500" y="320"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="500" y="200"/>
|
||||
<p2 x="500" y="220"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="500" y="100"/>
|
||||
<p2 x="500" y="120"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="500" y="-20"/>
|
||||
<p2 x="500" y="20"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="380" y="260"/>
|
||||
<p2 x="380" y="300"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="380" y="160"/>
|
||||
<p2 x="380" y="200"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="380" y="60"/>
|
||||
<p2 x="380" y="100"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="380" y="360"/>
|
||||
<p2 x="380" y="420"/>
|
||||
</wire>
|
||||
</wires>
|
||||
</circuit>
|
115
src/test/resources/dig/test/arith/HalfAdder.dig
Normal file
115
src/test/resources/dig/test/arith/HalfAdder.dig
Normal file
@ -0,0 +1,115 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<circuit>
|
||||
<version>1</version>
|
||||
<visualElements>
|
||||
<visualElement>
|
||||
<elementName>XOr</elementName>
|
||||
<elementAttributes/>
|
||||
<pos x="600" y="240"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>And</elementName>
|
||||
<elementAttributes/>
|
||||
<pos x="600" y="320"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>In</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>$A$</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="540" y="240"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>In</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>$B$</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="540" y="360"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Out</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>$S$</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="720" y="260"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Out</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>$C$</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="720" y="340"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Testcase</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Testdata</string>
|
||||
<testData>
|
||||
<dataString>A B C S
|
||||
0 0 0 0
|
||||
0 1 0 1
|
||||
1 0 0 1
|
||||
1 1 1 0
|
||||
</dataString>
|
||||
</testData>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="700" y="380"/>
|
||||
</visualElement>
|
||||
</visualElements>
|
||||
<wires>
|
||||
<wire>
|
||||
<p1 x="560" y="240"/>
|
||||
<p2 x="580" y="320"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="580" y="280"/>
|
||||
<p2 x="560" y="360"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="580" y="320"/>
|
||||
<p2 x="600" y="320"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="540" y="240"/>
|
||||
<p2 x="560" y="240"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="560" y="240"/>
|
||||
<p2 x="600" y="240"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="660" y="260"/>
|
||||
<p2 x="720" y="260"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="660" y="340"/>
|
||||
<p2 x="720" y="340"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="580" y="280"/>
|
||||
<p2 x="600" y="280"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="540" y="360"/>
|
||||
<p2 x="560" y="360"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="560" y="360"/>
|
||||
<p2 x="600" y="360"/>
|
||||
</wire>
|
||||
</wires>
|
||||
</circuit>
|
124
src/test/resources/dig/test/arith/HalfSub.dig
Normal file
124
src/test/resources/dig/test/arith/HalfSub.dig
Normal file
@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<circuit>
|
||||
<version>1</version>
|
||||
<visualElements>
|
||||
<visualElement>
|
||||
<elementName>XOr</elementName>
|
||||
<elementAttributes/>
|
||||
<pos x="620" y="240"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>And</elementName>
|
||||
<elementAttributes/>
|
||||
<pos x="620" y="320"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>In</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>$A$</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="500" y="240"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>In</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>$B$</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="500" y="360"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Out</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>$S$</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="720" y="260"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Out</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>$BO$</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="720" y="340"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Not</elementName>
|
||||
<elementAttributes/>
|
||||
<pos x="540" y="320"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Testcase</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Testdata</string>
|
||||
<testData>
|
||||
<dataString>A B BO S
|
||||
0 0 0 0
|
||||
0 1 1 1
|
||||
1 0 0 1
|
||||
1 1 0 0
|
||||
</dataString>
|
||||
</testData>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="700" y="380"/>
|
||||
</visualElement>
|
||||
</visualElements>
|
||||
<wires>
|
||||
<wire>
|
||||
<p1 x="500" y="240"/>
|
||||
<p2 x="520" y="240"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="520" y="240"/>
|
||||
<p2 x="620" y="240"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="580" y="320"/>
|
||||
<p2 x="620" y="320"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="520" y="320"/>
|
||||
<p2 x="540" y="320"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="680" y="260"/>
|
||||
<p2 x="720" y="260"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="680" y="340"/>
|
||||
<p2 x="720" y="340"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="600" y="280"/>
|
||||
<p2 x="620" y="280"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="500" y="360"/>
|
||||
<p2 x="600" y="360"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="600" y="360"/>
|
||||
<p2 x="620" y="360"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="600" y="280"/>
|
||||
<p2 x="600" y="360"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="520" y="240"/>
|
||||
<p2 x="520" y="320"/>
|
||||
</wire>
|
||||
</wires>
|
||||
</circuit>
|
292
src/test/resources/dig/test/arith/subTest.dig
Normal file
292
src/test/resources/dig/test/arith/subTest.dig
Normal file
@ -0,0 +1,292 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<circuit>
|
||||
<version>1</version>
|
||||
<attributes/>
|
||||
<visualElements>
|
||||
<visualElement>
|
||||
<elementName>Sub</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Bits</string>
|
||||
<int>4</int>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="400" y="340"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>In</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>B</string>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>Bits</string>
|
||||
<int>4</int>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="280" y="360"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>In</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>A</string>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>Bits</string>
|
||||
<int>4</int>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="280" y="300"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>In</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>C</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="280" y="400"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Splitter</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Input Splitting</string>
|
||||
<string>4,1</string>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>Output Splitting</string>
|
||||
<string>5</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="500" y="340"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Comparator</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Bits</string>
|
||||
<int>5</int>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="600" y="320"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Out</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>Y</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="680" y="340"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>FullSubRC.dig</elementName>
|
||||
<elementAttributes/>
|
||||
<pos x="400" y="120"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Splitter</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Input Splitting</string>
|
||||
<string>4</string>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>Output Splitting</string>
|
||||
<string>1*4</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="340" y="120"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Splitter</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Input Splitting</string>
|
||||
<string>4</string>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>Output Splitting</string>
|
||||
<string>1*4</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="340" y="200"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Splitter</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Input Splitting</string>
|
||||
<string>1*5</string>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>Output Splitting</string>
|
||||
<string>5</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="500" y="120"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Testcase</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Testdata</string>
|
||||
<testData>
|
||||
<dataString>A B C Y
|
||||
|
||||
repeat(1<<9) ((n>>4)&0xf) (n & 0xf) (n>>8) 1</dataString>
|
||||
</testData>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="600" y="100"/>
|
||||
</visualElement>
|
||||
</visualElements>
|
||||
<wires>
|
||||
<wire>
|
||||
<p1 x="580" y="320"/>
|
||||
<p2 x="600" y="320"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="360" y="160"/>
|
||||
<p2 x="400" y="160"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="480" y="160"/>
|
||||
<p2 x="500" y="160"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="360" y="260"/>
|
||||
<p2 x="400" y="260"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="360" y="200"/>
|
||||
<p2 x="400" y="200"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="320" y="200"/>
|
||||
<p2 x="340" y="200"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="480" y="200"/>
|
||||
<p2 x="500" y="200"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="280" y="360"/>
|
||||
<p2 x="320" y="360"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="460" y="360"/>
|
||||
<p2 x="500" y="360"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="320" y="360"/>
|
||||
<p2 x="400" y="360"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="360" y="140"/>
|
||||
<p2 x="400" y="140"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="480" y="140"/>
|
||||
<p2 x="500" y="140"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="280" y="300"/>
|
||||
<p2 x="300" y="300"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="360" y="240"/>
|
||||
<p2 x="400" y="240"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="280" y="400"/>
|
||||
<p2 x="300" y="400"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="360" y="180"/>
|
||||
<p2 x="400" y="180"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="480" y="180"/>
|
||||
<p2 x="500" y="180"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="300" y="340"/>
|
||||
<p2 x="400" y="340"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="460" y="340"/>
|
||||
<p2 x="500" y="340"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="520" y="340"/>
|
||||
<p2 x="600" y="340"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="660" y="340"/>
|
||||
<p2 x="680" y="340"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="360" y="120"/>
|
||||
<p2 x="400" y="120"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="300" y="120"/>
|
||||
<p2 x="340" y="120"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="480" y="120"/>
|
||||
<p2 x="500" y="120"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="520" y="120"/>
|
||||
<p2 x="580" y="120"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="360" y="280"/>
|
||||
<p2 x="400" y="280"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="360" y="220"/>
|
||||
<p2 x="400" y="220"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="300" y="380"/>
|
||||
<p2 x="360" y="380"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="360" y="380"/>
|
||||
<p2 x="400" y="380"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="320" y="200"/>
|
||||
<p2 x="320" y="360"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="580" y="120"/>
|
||||
<p2 x="580" y="320"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="360" y="280"/>
|
||||
<p2 x="360" y="380"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="300" y="120"/>
|
||||
<p2 x="300" y="300"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="300" y="380"/>
|
||||
<p2 x="300" y="400"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="300" y="300"/>
|
||||
<p2 x="300" y="340"/>
|
||||
</wire>
|
||||
</wires>
|
||||
</circuit>
|
Loading…
x
Reference in New Issue
Block a user