From 1c223e9af4f36c3f0aa46c0ab8d34137d4e3df23 Mon Sep 17 00:00:00 2001 From: hneemann Date: Thu, 21 May 2020 07:51:29 +0200 Subject: [PATCH] adds the 7482 2-bit adder chip, closes #459 --- .../lib/DIL Chips/74xx/arithmetic/7482.dig | 341 ++++++++++++++++++ .../digital/integration/TestExamples.java | 4 +- 2 files changed, 343 insertions(+), 2 deletions(-) create mode 100644 src/main/dig/lib/DIL Chips/74xx/arithmetic/7482.dig diff --git a/src/main/dig/lib/DIL Chips/74xx/arithmetic/7482.dig b/src/main/dig/lib/DIL Chips/74xx/arithmetic/7482.dig new file mode 100644 index 000000000..65d323d7a --- /dev/null +++ b/src/main/dig/lib/DIL Chips/74xx/arithmetic/7482.dig @@ -0,0 +1,341 @@ + + + 1 + + + shapeType + DIL + + + Description + 2-bit binary full adder + + + lockedMode + true + + + Width + 5 + + + + + In + + + Label + C0 + + + pinNumber + 5 + + + + + + In + + + Label + B1 + + + pinNumber + 3 + + + Default + 1 + + + + + + In + + + Label + B2 + + + pinNumber + 13 + + + + + + Out + + + Label + S1 + + + pinNumber + 1 + + + + + + Out + + + Label + S2 + + + pinNumber + 12 + + + + + + In + + + Label + A1 + + + pinNumber + 2 + + + + + + In + + + Label + A2 + + + pinNumber + 14 + + + Default + 1 + + + + + + Out + + + Label + C2 + + + pinNumber + 10 + + + + + + Testcase + + + Testdata + + # 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 + + + + + + + Add + + + Bits + 2 + + + + + + Splitter + + + Input Splitting + 1*2 + + + Output Splitting + 2 + + + + + + Splitter + + + Input Splitting + 1*2 + + + Output Splitting + 2 + + + + + + Splitter + + + Input Splitting + 2 + + + Output Splitting + 1*2 + + + + + + PowerSupply + + + + + In + + + Label + VCC + + + pinNumber + 4 + + + InDefault + + + + + + + In + + + Label + GND + + + pinNumber + 11 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/java/de/neemann/digital/integration/TestExamples.java b/src/test/java/de/neemann/digital/integration/TestExamples.java index f3959c87b..cd765eea4 100644 --- a/src/test/java/de/neemann/digital/integration/TestExamples.java +++ b/src/test/java/de/neemann/digital/integration/TestExamples.java @@ -32,8 +32,8 @@ public class TestExamples extends TestCase { */ public void testDistExamples() throws Exception { File examples = new File(Resources.getRoot().getParentFile().getParentFile(), "/main/dig"); - assertEquals(291, new FileScanner(this::check).scan(examples)); - assertEquals(193, testCasesInFiles); + assertEquals(292, new FileScanner(this::check).scan(examples)); + assertEquals(194, testCasesInFiles); } /**