From b11fd3abab932ba859b99a8effbfe08216affbc9 Mon Sep 17 00:00:00 2001 From: hneemann Date: Sat, 26 Nov 2016 20:05:45 +0100 Subject: [PATCH] Fixed splitter inconsistency bug. The splitter can not handle high z inputs correctly. If the splitter is used in that way now an exception is thrown. --- src/main/dig/processor/Control.dig | 20 +- src/main/dig/processor/FlagsRW.dig | 1128 +++++++++-------- src/main/dig/processor/Graphics.dig | 49 +- src/main/dig/processor/Processor.dig | 26 +- .../neemann/digital/core/wiring/DataBus.java | 6 +- .../neemann/digital/core/wiring/Splitter.java | 2 + src/main/resources/lang/lang_de.xml | 1 + src/main/resources/lang/lang_en.xml | 1 + .../digital/integration/TestExamples.java | 2 +- .../resources/dig/test/BusSplitterError.dig | 123 ++ 10 files changed, 792 insertions(+), 566 deletions(-) create mode 100644 src/test/resources/dig/test/BusSplitterError.dig diff --git a/src/main/dig/processor/Control.dig b/src/main/dig/processor/Control.dig index 8f88f2fb5..b4876e7b7 100644 --- a/src/main/dig/processor/Control.dig +++ b/src/main/dig/processor/Control.dig @@ -426,6 +426,16 @@ realisiert, und nicht durch 24 einzelne Schaltnetze. + + PullDown + + + Bits + 24 + + + + @@ -458,12 +468,16 @@ realisiert, und nicht durch 24 einzelne Schaltnetze. - + + + + + @@ -532,5 +546,9 @@ realisiert, und nicht durch 24 einzelne Schaltnetze. + + + + \ No newline at end of file diff --git a/src/main/dig/processor/FlagsRW.dig b/src/main/dig/processor/FlagsRW.dig index f42f66b87..4adbd80e8 100644 --- a/src/main/dig/processor/FlagsRW.dig +++ b/src/main/dig/processor/FlagsRW.dig @@ -1,560 +1,578 @@ - 1 - + 1 + + + Description + Speichert die Prozessorflags + + + + + In + - Description - Speichert die Prozessorflags + Label + Zi - - - - In - - - Label - Zi - - - - - - Out - - - Label - Zo - - - - - - D_FF - - - - - In - - - Label - Ni - - - - - - Out - - - Label - No - - - - - - D_FF - - - - - In - - - Label - Ci - - - - - - Out - - - Label - Co - - - - - - D_FF - - - - - In - - - Label - C - - - - - - In - - - Label - store - - - - - - And - - - - - Splitter - - - Input Splitting - 1,1,1,13 - - - Output Splitting - 16 - - - - - - Const - - - Value - 0 - - - Bits - 13 - - - - - - In - - - Label - A - - - Bits - 16 - - - - - - Driver - - - Bits - 16 - - - flipSelPos - true - - - - - - Comparator - - - Bits - 16 - - - - - - Const - - - Value - 0 - - - Bits - 16 - - - - - - And - - - - - In - - - Description - IOR - - - Label - IOR - - - - - - In - - - Label - IOW - - - - - - And - - - - - Or - - - - - Multiplexer - - - - - Multiplexer - - - - - Multiplexer - - - - - Splitter - - - Input Splitting - 16 - - - Output Splitting - 1,1,1,13 - - - - - - In - - - Label - Data - - - Bits - 16 - - - isHighZ - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + Out + + + Label + Zo + + + + + + D_FF + + + + + In + + + Label + Ni + + + + + + Out + + + Label + No + + + + + + D_FF + + + + + In + + + Label + Ci + + + + + + Out + + + Label + Co + + + + + + D_FF + + + + + In + + + Label + C + + + + + + In + + + Label + store + + + + + + And + + + + + Splitter + + + Input Splitting + 1,1,1,13 + + + Output Splitting + 16 + + + + + + Const + + + Value + 0 + + + Bits + 13 + + + + + + In + + + Label + A + + + Bits + 16 + + + + + + Driver + + + Bits + 16 + + + flipSelPos + true + + + + + + Comparator + + + Bits + 16 + + + + + + Const + + + Value + 0 + + + Bits + 16 + + + + + + And + + + + + In + + + Description + IOR + + + Label + IOR + + + + + + In + + + Label + IOW + + + + + + And + + + + + Or + + + + + Multiplexer + + + + + Multiplexer + + + + + Multiplexer + + + + + Splitter + + + Input Splitting + 16 + + + Output Splitting + 1,1,1,13 + + + + + + In + + + Label + Data + + + Bits + 16 + + + isHighZ + true + + + + + + PullDown + + + Bits + 16 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/dig/processor/Graphics.dig b/src/main/dig/processor/Graphics.dig index 381afefc4..9e5c8142b 100644 --- a/src/main/dig/processor/Graphics.dig +++ b/src/main/dig/processor/Graphics.dig @@ -5,15 +5,22 @@ Description Eine einfache "Grafikkarte". -Sie enthält ein Grafik-RAM um die eigentliche Grafik -anzuzeigen. Dieses Grafik-RAM ist auf die -Darstellung von 20x20 Pixel konfiguriert. +Sie enthält ein Grafik-RAM um die eigentliche +Grafik anzuzeigen. Dieses Grafik-RAM ist auf die +Darstellung von 20x20 Pixel konfiguriert. +Die erforderlichen 800 Bytes Speicher werden +ab Adresse 0x8000 in den Adressbereich +eingeblendet. In + + Description + Adresse + Label A @@ -28,6 +35,10 @@ Darstellung von 20x20 Pixel konfiguriert. In + + Description + Read enable + Label R @@ -105,6 +116,10 @@ Darstellung von 20x20 Pixel konfiguriert. In + + Description + Takt + Label C @@ -183,6 +198,10 @@ Darstellung von 20x20 Pixel konfiguriert. In + + Description + Write enable + Label W @@ -211,6 +230,10 @@ Darstellung von 20x20 Pixel konfiguriert. Out + + Description + Bidirektionaler Datenanschluss + Label D @@ -222,6 +245,16 @@ Darstellung von 20x20 Pixel konfiguriert. + + PullDown + + + Bits + 16 + + + + @@ -290,7 +323,7 @@ Darstellung von 20x20 Pixel konfiguriert. - + @@ -300,6 +333,10 @@ Darstellung von 20x20 Pixel konfiguriert. + + + + @@ -388,6 +425,10 @@ Darstellung von 20x20 Pixel konfiguriert. + + + + diff --git a/src/main/dig/processor/Processor.dig b/src/main/dig/processor/Processor.dig index 5bc999c7c..c88623cda 100644 --- a/src/main/dig/processor/Processor.dig +++ b/src/main/dig/processor/Processor.dig @@ -864,6 +864,16 @@ Single-Cycle CPU. + + PullDown + + + Bits + 16 + + + + @@ -1138,10 +1148,6 @@ Single-Cycle CPU. - - - - @@ -1154,10 +1160,18 @@ Single-Cycle CPU. + + + + + + + + @@ -1334,6 +1348,10 @@ Single-Cycle CPU. + + + + diff --git a/src/main/java/de/neemann/digital/core/wiring/DataBus.java b/src/main/java/de/neemann/digital/core/wiring/DataBus.java index b2b17de6f..3ce42f051 100644 --- a/src/main/java/de/neemann/digital/core/wiring/DataBus.java +++ b/src/main/java/de/neemann/digital/core/wiring/DataBus.java @@ -75,7 +75,11 @@ public class DataBus { break; } } - commonOut = new ObservableValue("common", bits); + + if (resistor == PinDescription.PullResistor.none) + commonOut = new ObservableValue("common", bits, true); + else + commonOut = new ObservableValue("common", bits); BusModelStateObserver obs = model.getObserver(BusModelStateObserver.class); if (obs == null) { diff --git a/src/main/java/de/neemann/digital/core/wiring/Splitter.java b/src/main/java/de/neemann/digital/core/wiring/Splitter.java index 2c3332505..4e884738a 100644 --- a/src/main/java/de/neemann/digital/core/wiring/Splitter.java +++ b/src/main/java/de/neemann/digital/core/wiring/Splitter.java @@ -68,6 +68,8 @@ public class Splitter implements Element { Port inPort = inPorts.getPort(i); if (inPort.getBits() != inputs.get(i).getBits()) throw new BitsException(Lang.get("err_splitterBitsMismatch"), null, inputs); + if (inputs.get(i).supportsHighZ()) + throw new BitsException(Lang.get("err_splitterDoesNotSupportHighZInputs"), null, inputs); } for (Port out : outPorts) diff --git a/src/main/resources/lang/lang_de.xml b/src/main/resources/lang/lang_de.xml index e4b77e86c..5731ed610 100644 --- a/src/main/resources/lang/lang_de.xml +++ b/src/main/resources/lang/lang_de.xml @@ -239,6 +239,7 @@ Zur Analyse können Sie die Schaltung im Gatterschrittmodus ausführen. Fehler beim Ausführen eines Befehls Es können nicht ein Pull-Up-Widerstand und ein Pull-Down-Widerstand auf eine Leitung geschaltet werden. Browser konnte nicht geöffnet werden. + Der Splitter unterstützt keine HighZ Eingänge! Adress-Bits Anzahl der Adress-Bits die verwendet werden. Daten-Bits diff --git a/src/main/resources/lang/lang_en.xml b/src/main/resources/lang/lang_en.xml index 588ce79db..96b60e800 100644 --- a/src/main/resources/lang/lang_en.xml +++ b/src/main/resources/lang/lang_en.xml @@ -234,6 +234,7 @@ To analyse you can run the circuit in single gate step mode. Error during execution of a remote command It's not allowed to connect a pull up and a pull down resistor to a single wire. Could not open the browser. + The splitter does not support high z inputs! Address Bits Number of address bits used. diff --git a/src/test/java/de/neemann/digital/integration/TestExamples.java b/src/test/java/de/neemann/digital/integration/TestExamples.java index b93127c48..342c4cfae 100644 --- a/src/test/java/de/neemann/digital/integration/TestExamples.java +++ b/src/test/java/de/neemann/digital/integration/TestExamples.java @@ -37,7 +37,7 @@ public class TestExamples extends TestCase { */ public void testTestExamples() throws Exception { File examples = new File(Resources.getRoot(), "/dig/test"); - assertEquals(12, new FileScanner(this::check).scan(examples)); + assertEquals(13, new FileScanner(this::check).scan(examples)); assertEquals(12,testCasesInFiles); } diff --git a/src/test/resources/dig/test/BusSplitterError.dig b/src/test/resources/dig/test/BusSplitterError.dig new file mode 100644 index 000000000..6031ef01a --- /dev/null +++ b/src/test/resources/dig/test/BusSplitterError.dig @@ -0,0 +1,123 @@ + + + 1 + + + Driver + + + Bits + 8 + + + + + + Splitter + + + Input Splitting + 8,1 + + + Output Splitting + 4,5 + + + + + + In + + + Bits + 8 + + + + + + In + + + rotation + + + + + + + Driver + + + Bits + 8 + + + + + + In + + + Bits + 8 + + + + + + In + + + rotation + + + + + + + In + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file