mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-17 00:44:40 -04:00
adds the 7482 2-bit adder chip, closes #459
This commit is contained in:
parent
91c9e89654
commit
1c223e9af4
341
src/main/dig/lib/DIL Chips/74xx/arithmetic/7482.dig
Normal file
341
src/main/dig/lib/DIL Chips/74xx/arithmetic/7482.dig
Normal file
@ -0,0 +1,341 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<circuit>
|
||||||
|
<version>1</version>
|
||||||
|
<attributes>
|
||||||
|
<entry>
|
||||||
|
<string>shapeType</string>
|
||||||
|
<shapeType>DIL</shapeType>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<string>Description</string>
|
||||||
|
<string>2-bit binary full adder</string>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<string>lockedMode</string>
|
||||||
|
<boolean>true</boolean>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<string>Width</string>
|
||||||
|
<int>5</int>
|
||||||
|
</entry>
|
||||||
|
</attributes>
|
||||||
|
<visualElements>
|
||||||
|
<visualElement>
|
||||||
|
<elementName>In</elementName>
|
||||||
|
<elementAttributes>
|
||||||
|
<entry>
|
||||||
|
<string>Label</string>
|
||||||
|
<string>C0</string>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<string>pinNumber</string>
|
||||||
|
<string>5</string>
|
||||||
|
</entry>
|
||||||
|
</elementAttributes>
|
||||||
|
<pos x="640" y="-300"/>
|
||||||
|
</visualElement>
|
||||||
|
<visualElement>
|
||||||
|
<elementName>In</elementName>
|
||||||
|
<elementAttributes>
|
||||||
|
<entry>
|
||||||
|
<string>Label</string>
|
||||||
|
<string>B1</string>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<string>pinNumber</string>
|
||||||
|
<string>3</string>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<string>Default</string>
|
||||||
|
<int>1</int>
|
||||||
|
</entry>
|
||||||
|
</elementAttributes>
|
||||||
|
<pos x="640" y="-400"/>
|
||||||
|
</visualElement>
|
||||||
|
<visualElement>
|
||||||
|
<elementName>In</elementName>
|
||||||
|
<elementAttributes>
|
||||||
|
<entry>
|
||||||
|
<string>Label</string>
|
||||||
|
<string>B2</string>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<string>pinNumber</string>
|
||||||
|
<string>13</string>
|
||||||
|
</entry>
|
||||||
|
</elementAttributes>
|
||||||
|
<pos x="500" y="-380"/>
|
||||||
|
</visualElement>
|
||||||
|
<visualElement>
|
||||||
|
<elementName>Out</elementName>
|
||||||
|
<elementAttributes>
|
||||||
|
<entry>
|
||||||
|
<string>Label</string>
|
||||||
|
<string>S1</string>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<string>pinNumber</string>
|
||||||
|
<string>1</string>
|
||||||
|
</entry>
|
||||||
|
</elementAttributes>
|
||||||
|
<pos x="880" y="-420"/>
|
||||||
|
</visualElement>
|
||||||
|
<visualElement>
|
||||||
|
<elementName>Out</elementName>
|
||||||
|
<elementAttributes>
|
||||||
|
<entry>
|
||||||
|
<string>Label</string>
|
||||||
|
<string>S2</string>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<string>pinNumber</string>
|
||||||
|
<string>12</string>
|
||||||
|
</entry>
|
||||||
|
</elementAttributes>
|
||||||
|
<pos x="1020" y="-400"/>
|
||||||
|
</visualElement>
|
||||||
|
<visualElement>
|
||||||
|
<elementName>In</elementName>
|
||||||
|
<elementAttributes>
|
||||||
|
<entry>
|
||||||
|
<string>Label</string>
|
||||||
|
<string>A1</string>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<string>pinNumber</string>
|
||||||
|
<string>2</string>
|
||||||
|
</entry>
|
||||||
|
</elementAttributes>
|
||||||
|
<pos x="640" y="-500"/>
|
||||||
|
</visualElement>
|
||||||
|
<visualElement>
|
||||||
|
<elementName>In</elementName>
|
||||||
|
<elementAttributes>
|
||||||
|
<entry>
|
||||||
|
<string>Label</string>
|
||||||
|
<string>A2</string>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<string>pinNumber</string>
|
||||||
|
<string>14</string>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<string>Default</string>
|
||||||
|
<int>1</int>
|
||||||
|
</entry>
|
||||||
|
</elementAttributes>
|
||||||
|
<pos x="500" y="-480"/>
|
||||||
|
</visualElement>
|
||||||
|
<visualElement>
|
||||||
|
<elementName>Out</elementName>
|
||||||
|
<elementAttributes>
|
||||||
|
<entry>
|
||||||
|
<string>Label</string>
|
||||||
|
<string>C2</string>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<string>pinNumber</string>
|
||||||
|
<string>10</string>
|
||||||
|
</entry>
|
||||||
|
</elementAttributes>
|
||||||
|
<pos x="880" y="-300"/>
|
||||||
|
</visualElement>
|
||||||
|
<visualElement>
|
||||||
|
<elementName>Testcase</elementName>
|
||||||
|
<elementAttributes>
|
||||||
|
<entry>
|
||||||
|
<string>Testdata</string>
|
||||||
|
<testData>
|
||||||
|
<dataString># A complete test of all 32 possible additions
|
||||||
|
#
|
||||||
|
|
||||||
|
C0 A2 A1 B2 B1 C2 S2 S1
|
||||||
|
loop(A,4)
|
||||||
|
loop(B,4)
|
||||||
|
0 bits(2,A) bits(2,B) bits(3,A+B)
|
||||||
|
1 bits(2,A) bits(2,B) bits(3,A+B+1)
|
||||||
|
end loop
|
||||||
|
end loop</dataString>
|
||||||
|
</testData>
|
||||||
|
</entry>
|
||||||
|
</elementAttributes>
|
||||||
|
<pos x="900" y="-520"/>
|
||||||
|
</visualElement>
|
||||||
|
<visualElement>
|
||||||
|
<elementName>Add</elementName>
|
||||||
|
<elementAttributes>
|
||||||
|
<entry>
|
||||||
|
<string>Bits</string>
|
||||||
|
<int>2</int>
|
||||||
|
</entry>
|
||||||
|
</elementAttributes>
|
||||||
|
<pos x="720" y="-420"/>
|
||||||
|
</visualElement>
|
||||||
|
<visualElement>
|
||||||
|
<elementName>Splitter</elementName>
|
||||||
|
<elementAttributes>
|
||||||
|
<entry>
|
||||||
|
<string>Input Splitting</string>
|
||||||
|
<string>1*2</string>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<string>Output Splitting</string>
|
||||||
|
<string>2</string>
|
||||||
|
</entry>
|
||||||
|
</elementAttributes>
|
||||||
|
<pos x="660" y="-400"/>
|
||||||
|
</visualElement>
|
||||||
|
<visualElement>
|
||||||
|
<elementName>Splitter</elementName>
|
||||||
|
<elementAttributes>
|
||||||
|
<entry>
|
||||||
|
<string>Input Splitting</string>
|
||||||
|
<string>1*2</string>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<string>Output Splitting</string>
|
||||||
|
<string>2</string>
|
||||||
|
</entry>
|
||||||
|
</elementAttributes>
|
||||||
|
<pos x="660" y="-500"/>
|
||||||
|
</visualElement>
|
||||||
|
<visualElement>
|
||||||
|
<elementName>Splitter</elementName>
|
||||||
|
<elementAttributes>
|
||||||
|
<entry>
|
||||||
|
<string>Input Splitting</string>
|
||||||
|
<string>2</string>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<string>Output Splitting</string>
|
||||||
|
<string>1*2</string>
|
||||||
|
</entry>
|
||||||
|
</elementAttributes>
|
||||||
|
<pos x="840" y="-420"/>
|
||||||
|
</visualElement>
|
||||||
|
<visualElement>
|
||||||
|
<elementName>PowerSupply</elementName>
|
||||||
|
<elementAttributes/>
|
||||||
|
<pos x="680" y="-240"/>
|
||||||
|
</visualElement>
|
||||||
|
<visualElement>
|
||||||
|
<elementName>In</elementName>
|
||||||
|
<elementAttributes>
|
||||||
|
<entry>
|
||||||
|
<string>Label</string>
|
||||||
|
<string>VCC</string>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<string>pinNumber</string>
|
||||||
|
<string>4</string>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<string>InDefault</string>
|
||||||
|
<value v="1" z="false"/>
|
||||||
|
</entry>
|
||||||
|
</elementAttributes>
|
||||||
|
<pos x="640" y="-240"/>
|
||||||
|
</visualElement>
|
||||||
|
<visualElement>
|
||||||
|
<elementName>In</elementName>
|
||||||
|
<elementAttributes>
|
||||||
|
<entry>
|
||||||
|
<string>Label</string>
|
||||||
|
<string>GND</string>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<string>pinNumber</string>
|
||||||
|
<string>11</string>
|
||||||
|
</entry>
|
||||||
|
</elementAttributes>
|
||||||
|
<pos x="640" y="-200"/>
|
||||||
|
</visualElement>
|
||||||
|
</visualElements>
|
||||||
|
<wires>
|
||||||
|
<wire>
|
||||||
|
<p1 x="700" y="-420"/>
|
||||||
|
<p2 x="720" y="-420"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="780" y="-420"/>
|
||||||
|
<p2 x="840" y="-420"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="860" y="-420"/>
|
||||||
|
<p2 x="880" y="-420"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="680" y="-500"/>
|
||||||
|
<p2 x="700" y="-500"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="640" y="-500"/>
|
||||||
|
<p2 x="660" y="-500"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="640" y="-200"/>
|
||||||
|
<p2 x="660" y="-200"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="800" y="-300"/>
|
||||||
|
<p2 x="880" y="-300"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="640" y="-300"/>
|
||||||
|
<p2 x="700" y="-300"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="500" y="-380"/>
|
||||||
|
<p2 x="660" y="-380"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="700" y="-380"/>
|
||||||
|
<p2 x="720" y="-380"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="660" y="-220"/>
|
||||||
|
<p2 x="680" y="-220"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="640" y="-400"/>
|
||||||
|
<p2 x="660" y="-400"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="680" y="-400"/>
|
||||||
|
<p2 x="720" y="-400"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="780" y="-400"/>
|
||||||
|
<p2 x="800" y="-400"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="860" y="-400"/>
|
||||||
|
<p2 x="1020" y="-400"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="640" y="-240"/>
|
||||||
|
<p2 x="680" y="-240"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="500" y="-480"/>
|
||||||
|
<p2 x="660" y="-480"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="800" y="-400"/>
|
||||||
|
<p2 x="800" y="-300"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="660" y="-220"/>
|
||||||
|
<p2 x="660" y="-200"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="700" y="-500"/>
|
||||||
|
<p2 x="700" y="-420"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="700" y="-380"/>
|
||||||
|
<p2 x="700" y="-300"/>
|
||||||
|
</wire>
|
||||||
|
</wires>
|
||||||
|
<measurementOrdering/>
|
||||||
|
</circuit>
|
@ -32,8 +32,8 @@ public class TestExamples extends TestCase {
|
|||||||
*/
|
*/
|
||||||
public void testDistExamples() throws Exception {
|
public void testDistExamples() throws Exception {
|
||||||
File examples = new File(Resources.getRoot().getParentFile().getParentFile(), "/main/dig");
|
File examples = new File(Resources.getRoot().getParentFile().getParentFile(), "/main/dig");
|
||||||
assertEquals(291, new FileScanner(this::check).scan(examples));
|
assertEquals(292, new FileScanner(this::check).scan(examples));
|
||||||
assertEquals(193, testCasesInFiles);
|
assertEquals(194, testCasesInFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user