From fbcc3d6cf2124697ec08ceae081aa233d584a712 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BCdiger=20Heintz?= Date: Fri, 7 Jul 2017 10:28:27 +0000 Subject: [PATCH] added a barrel shifter Merged in roy77/digital (pull request #2) --- .../core/arithmetic/BarrelShifter.java | 120 +++ .../core/arithmetic/BarrelShifterMode.java | 22 + .../core/arithmetic/LeftRightFormat.java | 18 + .../de/neemann/digital/core/element/Keys.java | 20 + .../digital/draw/elements/Circuit.java | 4 + .../digital/draw/library/ElementLibrary.java | 1 + .../digital/gui/components/EditorFactory.java | 16 + src/main/resources/lang/lang_de.xml | 16 + src/main/resources/lang/lang_en.xml | 18 +- .../core/arithmetic/BarrelShifterTest.java | 157 ++++ .../digital/integration/TestExamples.java | 4 +- .../dig/test/arith/barrelShifterTest.dig | 731 ++++++++++++++++++ 12 files changed, 1124 insertions(+), 3 deletions(-) create mode 100644 src/main/java/de/neemann/digital/core/arithmetic/BarrelShifter.java create mode 100644 src/main/java/de/neemann/digital/core/arithmetic/BarrelShifterMode.java create mode 100644 src/main/java/de/neemann/digital/core/arithmetic/LeftRightFormat.java create mode 100644 src/test/java/de/neemann/digital/core/arithmetic/BarrelShifterTest.java create mode 100644 src/test/resources/dig/test/arith/barrelShifterTest.dig diff --git a/src/main/java/de/neemann/digital/core/arithmetic/BarrelShifter.java b/src/main/java/de/neemann/digital/core/arithmetic/BarrelShifter.java new file mode 100644 index 000000000..4ac81d768 --- /dev/null +++ b/src/main/java/de/neemann/digital/core/arithmetic/BarrelShifter.java @@ -0,0 +1,120 @@ +package de.neemann.digital.core.arithmetic; + +import de.neemann.digital.core.Node; +import de.neemann.digital.core.NodeException; +import de.neemann.digital.core.ObservableValue; +import de.neemann.digital.core.ObservableValues; +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 static de.neemann.digital.core.element.PinInfo.input; + +/** + * A barrelshifter + * + * @author heintz + */ +public class BarrelShifter extends Node implements Element { + + /** + * The barrelshifter description + */ + public static final ElementTypeDescription DESCRIPTION = new ElementTypeDescription(BarrelShifter.class, input("in"), input("shift")) + .addAttribute(Keys.ROTATE) + .addAttribute(Keys.LABEL) + .addAttribute(Keys.BITS) + .addAttribute(Keys.BARREL_SIGNED) + .addAttribute(Keys.DIRECTION) + .addAttribute(Keys.BARREL_SHIFTER_MODE); + + private final ObservableValue out; + private final int bits; + private final int shiftbits; + private final BarrelShifterMode mode; + private final boolean signed; + private final LeftRightFormat direction; + + private ObservableValue in; + private ObservableValue shift; + private long value; + + /** + * Creates a new instance + * + * @param attributes + * the attributes + */ + public BarrelShifter(ElementAttributes attributes) { + direction = attributes.get(Keys.DIRECTION); + mode = attributes.get(Keys.BARREL_SHIFTER_MODE); + bits = attributes.get(Keys.BITS); + signed = attributes.get(Keys.BARREL_SIGNED); + + int sbits = 1; + while ((1 << sbits) < bits) + sbits++; + + if (signed) + sbits++; + shiftbits = sbits; + + this.out = new ObservableValue("out", bits).setPinDescription(DESCRIPTION); + } + + @Override + public void readInputs() throws NodeException { + long inval = in.getValue(); + long shiftval; + + if (signed) { + shiftval = shift.getValueSigned(); + } else { + shiftval = shift.getValue(); + } + + if (direction == LeftRightFormat.right) { + shiftval = -shiftval; + } + + value = 0; + + if (shiftval < 0) { // shift or rotate right + shiftval = -shiftval; + if (mode == BarrelShifterMode.rotate) { + shiftval = shiftval % bits; + value |= inval << (bits - shiftval); + } + value |= inval >> shiftval; + if ((mode == BarrelShifterMode.arithmetic) && ((inval & (1 << (bits - 1))) != 0)) { + int mask = (1 << (bits)) - 1; + mask = mask >> shiftval; + value |= ~mask; + } + + } else { // shift or rotate left + if (mode == BarrelShifterMode.rotate) { + shiftval = shiftval % bits; + value |= inval >> (bits - shiftval); + } + value |= inval << shiftval; + } + } + + @Override + public void writeOutputs() throws NodeException { + out.setValue(value); + } + + @Override + public void setInputs(ObservableValues inputs) throws NodeException { + in = inputs.get(0).addObserverToValue(this).checkBits(bits, this, 0); + shift = inputs.get(1).addObserverToValue(this).checkBits(shiftbits, this, 1); + } + + @Override + public ObservableValues getOutputs() { + return out.asList(); + } + +} diff --git a/src/main/java/de/neemann/digital/core/arithmetic/BarrelShifterMode.java b/src/main/java/de/neemann/digital/core/arithmetic/BarrelShifterMode.java new file mode 100644 index 000000000..ad2f18b16 --- /dev/null +++ b/src/main/java/de/neemann/digital/core/arithmetic/BarrelShifterMode.java @@ -0,0 +1,22 @@ +package de.neemann.digital.core.arithmetic; + + +import de.neemann.digital.core.ObservableValue; + +/** + * @author heintz + */ +public enum BarrelShifterMode { + /** + * the default format as defined in {@link ObservableValue#getValueString()} + */ + normal, + /** + * rotate + */ + rotate, + /** + * arithmetic + */ + arithmetic; +} diff --git a/src/main/java/de/neemann/digital/core/arithmetic/LeftRightFormat.java b/src/main/java/de/neemann/digital/core/arithmetic/LeftRightFormat.java new file mode 100644 index 000000000..534db8eda --- /dev/null +++ b/src/main/java/de/neemann/digital/core/arithmetic/LeftRightFormat.java @@ -0,0 +1,18 @@ +package de.neemann.digital.core.arithmetic; + + +import de.neemann.digital.core.ObservableValue; + +/** + * @author heintz + */ +public enum LeftRightFormat { + /** + * the default format as defined in {@link ObservableValue#getValueString()} + */ + left, + /** + * right + */ + right; +} diff --git a/src/main/java/de/neemann/digital/core/element/Keys.java b/src/main/java/de/neemann/digital/core/element/Keys.java index 25c27f376..e249f8d6b 100644 --- a/src/main/java/de/neemann/digital/core/element/Keys.java +++ b/src/main/java/de/neemann/digital/core/element/Keys.java @@ -1,6 +1,8 @@ package de.neemann.digital.core.element; import de.neemann.digital.analyse.expression.format.FormatToExpression; +import de.neemann.digital.core.arithmetic.BarrelShifterMode; +import de.neemann.digital.core.arithmetic.LeftRightFormat; import de.neemann.digital.core.io.InValue; import de.neemann.digital.core.io.IntFormat; import de.neemann.digital.core.memory.DataField; @@ -300,6 +302,24 @@ public final class Keys { public static final Key RELAY_NORMALLY_CLOSED = new Key<>("relayNormallyClosed", false); + /** + * flag used by a barrelshifter to indicate if data are rotated + */ + public static final Key BARREL_SHIFTER_MODE + = new Key.KeyEnum<>("barrelShifterMode", BarrelShifterMode.normal, BarrelShifterMode.values()); + + /** + * flag used by a barrelshifter to indicate shift direction + */ + public static final Key DIRECTION + = new Key.KeyEnum<>("direction", LeftRightFormat.left, LeftRightFormat.values()); + + /** + * flag used by a barrelshifter to indicate if shift value is signed + */ + public static final Key BARREL_SIGNED + = new Key<>("barrelSigned", false); + /** * Used to indicate if the 7-seg display has a common cathode output */ diff --git a/src/main/java/de/neemann/digital/draw/elements/Circuit.java b/src/main/java/de/neemann/digital/draw/elements/Circuit.java index 8e203326c..09f5884dc 100644 --- a/src/main/java/de/neemann/digital/draw/elements/Circuit.java +++ b/src/main/java/de/neemann/digital/draw/elements/Circuit.java @@ -6,6 +6,8 @@ import com.thoughtworks.xstream.io.xml.StaxDriver; import de.neemann.digital.core.ObservableValue; import de.neemann.digital.core.ObservableValues; import de.neemann.digital.core.Observer; +import de.neemann.digital.core.arithmetic.BarrelShifterMode; +import de.neemann.digital.core.arithmetic.LeftRightFormat; import de.neemann.digital.core.element.ElementAttributes; import de.neemann.digital.core.element.Keys; import de.neemann.digital.core.element.PinDescription; @@ -68,6 +70,8 @@ public class Circuit { xStream.alias("wire", Wire.class); xStream.alias("circuit", Circuit.class); xStream.alias("intFormat", IntFormat.class); + xStream.alias("barrelShifterMode", BarrelShifterMode.class); + xStream.alias("direction", LeftRightFormat.class); xStream.alias("rotation", Rotation.class); xStream.aliasAttribute(Rotation.class, "rotation", "rotation"); xStream.alias("language", Language.class); diff --git a/src/main/java/de/neemann/digital/draw/library/ElementLibrary.java b/src/main/java/de/neemann/digital/draw/library/ElementLibrary.java index 441a21eaf..d7d50492f 100644 --- a/src/main/java/de/neemann/digital/draw/library/ElementLibrary.java +++ b/src/main/java/de/neemann/digital/draw/library/ElementLibrary.java @@ -119,6 +119,7 @@ public class ElementLibrary implements Iterable .add(Add.DESCRIPTION) .add(Sub.DESCRIPTION) .add(Mul.DESCRIPTION) + .add(BarrelShifter.DESCRIPTION) .add(Comparator.DESCRIPTION) .add(Neg.DESCRIPTION) .add(BitCount.DESCRIPTION)) diff --git a/src/main/java/de/neemann/digital/gui/components/EditorFactory.java b/src/main/java/de/neemann/digital/gui/components/EditorFactory.java index d162961ab..374ea72b0 100644 --- a/src/main/java/de/neemann/digital/gui/components/EditorFactory.java +++ b/src/main/java/de/neemann/digital/gui/components/EditorFactory.java @@ -2,6 +2,8 @@ package de.neemann.digital.gui.components; import de.neemann.digital.analyse.expression.format.FormatToExpression; import de.neemann.digital.core.NodeException; +import de.neemann.digital.core.arithmetic.BarrelShifterMode; +import de.neemann.digital.core.arithmetic.LeftRightFormat; import de.neemann.digital.core.element.*; import de.neemann.digital.core.io.InValue; import de.neemann.digital.core.io.IntFormat; @@ -51,6 +53,8 @@ public final class EditorFactory { add(Boolean.class, BooleanEditor.class); add(DataField.class, DataFieldEditor.class); add(Rotation.class, RotationEditor.class); + add(BarrelShifterMode.class, BarrelShifterModeEditor.class); + add(LeftRightFormat.class, LeftRightFormatsEditor.class); add(IntFormat.class, IntFormatsEditor.class); add(Language.class, LanguageEditor.class); add(TestCaseDescription.class, TestCaseDesctiptionEditor.class); @@ -464,6 +468,18 @@ public final class EditorFactory { } } + private static final class BarrelShifterModeEditor extends EnumEditor { + public BarrelShifterModeEditor(BarrelShifterMode value, Key key) { + super(value, key); + } + } + + private static final class LeftRightFormatsEditor extends EnumEditor { + public LeftRightFormatsEditor(LeftRightFormat value, Key key) { + super(value, key); + } + } + private static class LanguageEditor extends LabelEditor { private JComboBox comb; diff --git a/src/main/resources/lang/lang_de.xml b/src/main/resources/lang/lang_de.xml index c91b0fa6c..cdf3950ef 100644 --- a/src/main/resources/lang/lang_de.xml +++ b/src/main/resources/lang/lang_de.xml @@ -211,6 +211,11 @@ Es können sowohl komplette Takte als auch einzelne Gatter-Veränderungen angeze Eingang a für Multiplikation. Eingang b für Multiplikation. Ausgang mit dem Ergebnis der Multiplikation. + Verschieber + Ein Baustein zum Bitschieben. Verschiebt Eingang in den an Eingang shift angegebenen Wert. + Eingang mit zu verschiebenden Bits. + Eingang mit Weite der Verschiebung. + Ausgang mit dem Ergebnis der Verschiebeoperation. Multiplexer Der {0}. Eingang des Multiplexers. Ausgeben wird der Wert, der am gewählten Eingang anliegt. @@ -608,6 +613,17 @@ Sind evtl. die Namen der Variablen nicht eindeutig? Dezimal Vorgabe Hexadezimal + Verschiebeweite hat Vorzeichen + Verschiebeweite verwendet Zweierkomplement + Modus + Modus des Verschiebung. + Normal + Rotation + Arithmetisch + Richtung + Richtungsangabe. + Links + Rechts Maximale Messpunktezahl Die maximale Anzahl an Messpunkten die gespeichert werden, bevor die ältesten Messungen verworfen werden. Zeige Einzelgatterschritte diff --git a/src/main/resources/lang/lang_en.xml b/src/main/resources/lang/lang_en.xml index dc5099171..0947e5bb5 100644 --- a/src/main/resources/lang/lang_en.xml +++ b/src/main/resources/lang/lang_en.xml @@ -207,6 +207,11 @@ Input a for multiplication. Input b for multiplication. Output for the result of the multiplication. + Shift + A component for bit shifting. Shift input in by the value defined from input shift. + Input with bits to be shifted. + Input with shift width. + Output with shifted value. Multiplexer The {0}. input of the multiplexer. The value of the selected input. @@ -597,7 +602,18 @@ The names of the variables may not be unique. bin decimal default - hex + hex + shift input has sign + shift input data has two complement format + Mode + Mode of barrel shifter + Normal + Rotate + Arithmetic + Direction + Set direction. + left + right Max number of steps to show The maximal number of values stored. If the maximum number is reached, the oldest values are discarded. Show single gate steps diff --git a/src/test/java/de/neemann/digital/core/arithmetic/BarrelShifterTest.java b/src/test/java/de/neemann/digital/core/arithmetic/BarrelShifterTest.java new file mode 100644 index 000000000..3a3fee730 --- /dev/null +++ b/src/test/java/de/neemann/digital/core/arithmetic/BarrelShifterTest.java @@ -0,0 +1,157 @@ +package de.neemann.digital.core.arithmetic; + +import static de.neemann.digital.core.ObservableValues.ovs; + +import de.neemann.digital.TestExecuter; +import de.neemann.digital.core.Model; +import de.neemann.digital.core.ObservableValue; +import de.neemann.digital.core.ObservableValues; +import de.neemann.digital.core.element.ElementAttributes; +import de.neemann.digital.core.element.Keys; +import junit.framework.TestCase; + +/** + * Created by heintz on 05.07.17. + */ +public class BarrelShifterTest extends TestCase { + + public void testNormalUnsignedLeft() throws Exception{ + TestExecuter bsTest=getTestExecuter( BarrelShifterMode.normal, false, LeftRightFormat.left,6, 3); + bsTest.check(0b001100, 0, 0b001100); + bsTest.check(0b001100, 1, 0b011000); + bsTest.check(0b001100, 2, 0b110000); + bsTest.check(0b010001, 2, 0b000100); + bsTest.check(0b001100, 3, 0b100000); + bsTest.check(0b001100, 5, 0b000000); + bsTest.check(0b001100, -1, 0b000000); + bsTest.check(0b001100, -4, 0b000000); + bsTest.check(0b001100, -5, 0b100000); + } + + public void testRotateUnsignedLeft() throws Exception{ + TestExecuter bsTest =getTestExecuter( BarrelShifterMode.rotate, false, LeftRightFormat.left,6, 3); + bsTest.check(0b001100, 0, 0b001100); + bsTest.check(0b001100, 1, 0b011000); + bsTest.check(0b001100, 2, 0b110000); + bsTest.check(0b010001, 2, 0b000101); + bsTest.check(0b001100, 3, 0b100001); + bsTest.check(0b001100, 5, 0b000110); + bsTest.check(0b001100, -1, 0b011000); + bsTest.check(0b001100, -4, 0b000011); + bsTest.check(0b001100, -5, 0b100001); + } + + public void testNormalSignedLeft() throws Exception{ + TestExecuter bsTest=getTestExecuter( BarrelShifterMode.normal, true , LeftRightFormat.left, 6, 4); + bsTest.check(0b001100, 0, 0b001100); + bsTest.check(0b001100, 1, 0b011000); + bsTest.check(0b001100, 2, 0b110000); + bsTest.check(0b010001, 2, 0b000100); + bsTest.check(0b001100, 3, 0b100000); + bsTest.check(0b001100, 5, 0b000000); + bsTest.check(0b001100, -1, 0b000110); + bsTest.check(0b001100, -4, 0b000000); + bsTest.check(0b001100, -5, 0b000000); + } + + public void testRotateSignedLeft() throws Exception{ + TestExecuter bsTest =getTestExecuter( BarrelShifterMode.rotate, true , LeftRightFormat.left, 6, 4); + bsTest.check(0b001100, 0, 0b001100); + bsTest.check(0b001100, 1, 0b011000); + bsTest.check(0b001100, 2, 0b110000); + bsTest.check(0b010001, 2, 0b000101); + bsTest.check(0b001100, 3, 0b100001); + bsTest.check(0b001100, 5, 0b000110); + bsTest.check(0b001100, -1, 0b000110); + bsTest.check(0b001100, -4, 0b110000); + bsTest.check(0b001100, -5, 0b011000); + } + + public void testNormalUnsignedRigth() throws Exception{ + TestExecuter bsTest =getTestExecuter( BarrelShifterMode.normal, false, LeftRightFormat.right,6, 3); + bsTest.check(0b001100, 0, 0b001100); + bsTest.check(0b001100, 1, 0b000110); + bsTest.check(0b001100, 2, 0b000011); + bsTest.check(0b010001, 2, 0b000100); + bsTest.check(0b001100, 3, 0b000001); + bsTest.check(0b001100, 5, 0b000000); + bsTest.check(0b001100, -1, 0b000000); + bsTest.check(0b001100, -4, 0b000000); + bsTest.check(0b001100, -5, 0b000001); + } + + public void testRotateUnsignedRigth() throws Exception{ + TestExecuter bsTest =getTestExecuter( BarrelShifterMode.rotate, false, LeftRightFormat.right,6, 3); + bsTest.check(0b001100, 0, 0b001100); + bsTest.check(0b001100, 1, 0b000110); + bsTest.check(0b001100, 2, 0b000011); + bsTest.check(0b010001, 2, 0b010100); + bsTest.check(0b001100, 3, 0b100001); + bsTest.check(0b001100, 5, 0b011000); + bsTest.check(0b001100, -1, 0b000110); + bsTest.check(0b001100, -4, 0b110000); + bsTest.check(0b001100, -5, 0b100001); + } + + public void testArithmeticUnsignedRigth() throws Exception{ + TestExecuter bsTest =getTestExecuter( BarrelShifterMode.arithmetic, false, LeftRightFormat.right,6, 3); + bsTest.check(0b001100, 0, 0b001100); + bsTest.check(0b001100, 1, 0b000110); + bsTest.check(0b001100, 2, 0b000011); + bsTest.check(0b010001, 2, 0b000100); + bsTest.check(0b001100, 3, 0b000001); + bsTest.check(0b001100, 5, 0b000000); + bsTest.check(0b001100, -1, 0b000000); + bsTest.check(0b001100, -4, 0b000000); + bsTest.check(0b001100, -5, 0b000001); + bsTest.check(0b101000, 0, 0b101000); + bsTest.check(0b101000, 1, 0b110100); + bsTest.check(0b101000, 2, 0b111010); + bsTest.check(0b101000, 3, 0b111101); + bsTest.check(0b101000, 5, 0b111111); + bsTest.check(0b101000, -1, 0b111111); + bsTest.check(0b101000, -4, 0b111110); + bsTest.check(0b101000, -5, 0b111101); + } + + public void testShiftSizeCalculationTest() throws Exception{ + getTestExecuter( BarrelShifterMode.rotate, false ,LeftRightFormat.left, 7, 3); + getTestExecuter( BarrelShifterMode.rotate, true ,LeftRightFormat.left, 7, 4); + getTestExecuter( BarrelShifterMode.rotate, true ,LeftRightFormat.right, 7, 4); + getTestExecuter( BarrelShifterMode.rotate, false ,LeftRightFormat.left, 8, 3); + getTestExecuter( BarrelShifterMode.rotate, true ,LeftRightFormat.left, 8, 4); + getTestExecuter( BarrelShifterMode.rotate, true ,LeftRightFormat.right, 8, 4); + getTestExecuter( BarrelShifterMode.rotate, false ,LeftRightFormat.left, 9, 4); + getTestExecuter( BarrelShifterMode.rotate, true ,LeftRightFormat.left, 9, 5); + getTestExecuter( BarrelShifterMode.rotate, true ,LeftRightFormat.right, 9, 5); + getTestExecuter( BarrelShifterMode.rotate, false ,LeftRightFormat.left, 16, 4); + getTestExecuter( BarrelShifterMode.rotate, true ,LeftRightFormat.left, 16, 5); + getTestExecuter( BarrelShifterMode.rotate, false ,LeftRightFormat.left, 17, 5); + getTestExecuter( BarrelShifterMode.rotate, true ,LeftRightFormat.left, 17, 6); + getTestExecuter( BarrelShifterMode.rotate, true ,LeftRightFormat.right, 17, 6); + } + + private TestExecuter getTestExecuter(BarrelShifterMode mode, boolean signed, LeftRightFormat direction, int valueWidth, int shiftWidth) throws Exception { + ObservableValue value = new ObservableValue("value", valueWidth); + ObservableValue shift = new ObservableValue("shift", shiftWidth); + + ElementAttributes attributes = new ElementAttributes() + .set(Keys.BARREL_SHIFTER_MODE,mode) + .set(Keys.BARREL_SIGNED,signed) + .set(Keys.DIRECTION,direction) + .set(Keys.BITS,valueWidth); + + Model model = new Model(); + BarrelShifter bs = new BarrelShifter(attributes); + + bs.setInputs(ovs(value, shift)); + model.add(bs); + + ObservableValues outputs = bs.getOutputs(); + assertEquals(1, outputs.size()); + assertEquals(value.getBits(), outputs.get(0).getBits()); + + return new TestExecuter(model).setInputs(value, shift).setOutputs(outputs); + } + +} \ 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 6bd327897..7d143dc43 100644 --- a/src/test/java/de/neemann/digital/integration/TestExamples.java +++ b/src/test/java/de/neemann/digital/integration/TestExamples.java @@ -39,8 +39,8 @@ public class TestExamples extends TestCase { */ public void testTestExamples() throws Exception { File examples = new File(Resources.getRoot(), "/dig/test"); - assertEquals(80, new FileScanner(this::check).scan(examples)); - assertEquals(74, testCasesInFiles); + assertEquals(81, new FileScanner(this::check).scan(examples)); + assertEquals(75, testCasesInFiles); } diff --git a/src/test/resources/dig/test/arith/barrelShifterTest.dig b/src/test/resources/dig/test/arith/barrelShifterTest.dig new file mode 100644 index 000000000..84ad905bd --- /dev/null +++ b/src/test/resources/dig/test/arith/barrelShifterTest.dig @@ -0,0 +1,731 @@ + + + 1 + + + Description + D flip flop based on a SRAM cell. + + + + + BarrelShifter + + + Label + U_N_L + + + Bits + 6 + + + + + + In + + + Label + Data + + + Bits + 6 + + + InDefault + + + + + + + In + + + Label + Shift + + + Bits + 3 + + + InDefault + + + + + + + Out + + + Label + UNL + + + Bits + 6 + + + + + + Probe + + + Label + Data + + + intFormat + bin + + + + + + Probe + + + Label + UNL + + + intFormat + bin + + + + + + BarrelShifter + + + Label + U_R_L + + + datarotate + true + + + Bits + 6 + + + barrelShifterMode + rotate + + + + + + In + + + Label + Signed + + + InDefault + + + + + + + BarrelShifter + + + Signed + true + + + Label + S_R_L + + + datarotate + true + + + Bits + 6 + + + barrelShifterMode + rotate + + + barrelSigned + true + + + + + + Out + + + Label + URL + + + Bits + 6 + + + + + + Out + + + Label + SRL + + + Bits + 6 + + + + + + Splitter + + + Input Splitting + 3,1 + + + Output Splitting + 4 + + + + + + Testcase + + + Testdata + + Data Shift Signed UNL URL SNL SRL +12 0 0 12 12 12 12 +12 1 0 24 24 24 24 +12 2 0 48 48 48 48 +17 2 0 4 5 4 5 +12 3 0 32 33 32 33 +12 3 1 32 33 0 24 +12 7 1 0 24 6 6 + + + + + + + + Probe + + + Label + URL + + + intFormat + bin + + + + + + Probe + + + Label + SRL + + + intFormat + bin + + + + + + Neg + + + Bits + 4 + + + + + + Probe + + + Label + shift + + + + + + BarrelShifter + + + Signed + true + + + Label + S_N_R + + + datarotate + true + + + Bits + 6 + + + barrelSigned + true + + + + + + Out + + + Label + SNR + + + Bits + 6 + + + + + + Probe + + + Label + SNR + + + intFormat + bin + + + + + + BarrelShifter + + + Label + U_N_R + + + Bits + 6 + + + direction + right + + + + + + Out + + + Label + UNR + + + Bits + 6 + + + + + + Probe + + + Label + UNR + + + intFormat + bin + + + + + + BarrelShifter + + + Signed + true + + + Label + S_N_L + + + Bits + 6 + + + barrelSigned + true + + + + + + Out + + + Label + SNL + + + Bits + 6 + + + + + + Probe + + + Label + SNL + + + intFormat + bin + + + + + + BarrelShifter + + + Label + U_A_R + + + datarotate + true + + + Bits + 6 + + + barrelShifterMode + arithmetic + + + direction + right + + + + + + Out + + + Label + UAR + + + Bits + 6 + + + + + + Probe + + + Label + UAR + + + intFormat + bin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file