SimpleRectangularSubmodelComponent now supports pin names
[Mograsim.git] / net.mograsim.logic.ui / src / net / mograsim / logic / ui / model / components / mi / nandbased / GUIram2.java
index 14697a7..8517745 100644 (file)
@@ -13,24 +13,24 @@ public class GUIram2 extends SimpleRectangularSubmodelComponent
        {
                super(model, 1, "GUIram2");
                setSubmodelScale(.1);
-               setInputCount(9);
-               setOutputCount(8);
+               setInputPins("A0", "A1", "B0", "B1", "WE", "D1", "D2", "D3", "D4");
+               setOutputPins("QA1", "QA2", "QA3", "QA4", "QB1", "QB2", "QB3", "QB4");
                initSubmodelComponents();
        }
 
-       // TODO clean up D lines
        @SuppressWarnings("unused") // for GUIWires being created
        private void initSubmodelComponents()
        {
-               Pin A0 = getInputSubmodelPins().get(0);
-               Pin A1 = getInputSubmodelPins().get(1);
-               Pin B0 = getInputSubmodelPins().get(2);
-               Pin B1 = getInputSubmodelPins().get(3);
-               Pin WE = getInputSubmodelPins().get(4);
-               Pin D1 = getInputSubmodelPins().get(5);
-               Pin D2 = getInputSubmodelPins().get(6);
-               Pin D3 = getInputSubmodelPins().get(7);
-               Pin D4 = getInputSubmodelPins().get(8);
+               //@formatter:off
+               Pin  A0 = getInputSubmodelPins() .get(0);
+               Pin  A1 = getInputSubmodelPins() .get(1);
+               Pin  B0 = getInputSubmodelPins() .get(2);
+               Pin  B1 = getInputSubmodelPins() .get(3);
+               Pin  WE = getInputSubmodelPins() .get(4);
+               Pin  D1 = getInputSubmodelPins() .get(5);
+               Pin  D2 = getInputSubmodelPins() .get(6);
+               Pin  D3 = getInputSubmodelPins() .get(7);
+               Pin  D4 = getInputSubmodelPins() .get(8);
                Pin QA1 = getOutputSubmodelPins().get(0);
                Pin QA2 = getOutputSubmodelPins().get(1);
                Pin QA3 = getOutputSubmodelPins().get(2);
@@ -40,30 +40,30 @@ public class GUIram2 extends SimpleRectangularSubmodelComponent
                Pin QB3 = getOutputSubmodelPins().get(6);
                Pin QB4 = getOutputSubmodelPins().get(7);
 
-               GUIdemux2 demuxA = new GUIdemux2(submodelModifiable);
-               GUIdemux2 demuxB = new GUIdemux2(submodelModifiable);
-               GUIand41 weAndB = new GUIand41(submodelModifiable);
-               GUIdlatch4 cell00 = new GUIdlatch4(submodelModifiable);
-               GUIdlatch4 cell01 = new GUIdlatch4(submodelModifiable);
-               GUIdlatch4 cell10 = new GUIdlatch4(submodelModifiable);
-               GUIdlatch4 cell11 = new GUIdlatch4(submodelModifiable);
-               GUIand41 andA00 = new GUIand41(submodelModifiable);
+               GUIdemux2   demuxA   = new GUIdemux2  (submodelModifiable);
+               GUIdemux2   demuxB   = new GUIdemux2  (submodelModifiable);
+               GUIand41    weAndB   = new GUIand41   (submodelModifiable);
+               GUIdlatch4  cell00   = new GUIdlatch4 (submodelModifiable);
+               GUIdlatch4  cell01   = new GUIdlatch4 (submodelModifiable);
+               GUIdlatch4  cell10   = new GUIdlatch4 (submodelModifiable);
+               GUIdlatch4  cell11   = new GUIdlatch4 (submodelModifiable);
+               GUIand41    andA00   = new GUIand41   (submodelModifiable);
                GUIandor414 andorA01 = new GUIandor414(submodelModifiable);
                GUIandor414 andorA10 = new GUIandor414(submodelModifiable);
                GUIandor414 andorA11 = new GUIandor414(submodelModifiable);
-               GUIand41 andB00 = new GUIand41(submodelModifiable);
+               GUIand41    andB00   = new GUIand41   (submodelModifiable);
                GUIandor414 andorB01 = new GUIandor414(submodelModifiable);
                GUIandor414 andorB10 = new GUIandor414(submodelModifiable);
                GUIandor414 andorB11 = new GUIandor414(submodelModifiable);
 
-               WireCrossPoint cpB00 = new WireCrossPoint(submodelModifiable, 1);
-               WireCrossPoint cpB01 = new WireCrossPoint(submodelModifiable, 1);
-               WireCrossPoint cpB10 = new WireCrossPoint(submodelModifiable, 1);
-               WireCrossPoint cpB11 = new WireCrossPoint(submodelModifiable, 1);
-               WireCrossPoint cpD100 = new WireCrossPoint(submodelModifiable, 1);
-               WireCrossPoint cpD200 = new WireCrossPoint(submodelModifiable, 1);
-               WireCrossPoint cpD300 = new WireCrossPoint(submodelModifiable, 1);
-               WireCrossPoint cpD400 = new WireCrossPoint(submodelModifiable, 1);
+               WireCrossPoint cpB00  = new WireCrossPoint(submodelModifiable, 1);
+               WireCrossPoint cpB01  = new WireCrossPoint(submodelModifiable, 1);
+               WireCrossPoint cpB10  = new WireCrossPoint(submodelModifiable, 1);
+               WireCrossPoint cpB11  = new WireCrossPoint(submodelModifiable, 1);
+               WireCrossPoint cpD1in = new WireCrossPoint(submodelModifiable, 1);
+               WireCrossPoint cpD2in = new WireCrossPoint(submodelModifiable, 1);
+               WireCrossPoint cpD3in = new WireCrossPoint(submodelModifiable, 1);
+               WireCrossPoint cpD4in = new WireCrossPoint(submodelModifiable, 1);
                WireCrossPoint cpD101 = new WireCrossPoint(submodelModifiable, 1);
                WireCrossPoint cpD201 = new WireCrossPoint(submodelModifiable, 1);
                WireCrossPoint cpD301 = new WireCrossPoint(submodelModifiable, 1);
@@ -89,37 +89,37 @@ public class GUIram2 extends SimpleRectangularSubmodelComponent
                WireCrossPoint cpQ311 = new WireCrossPoint(submodelModifiable, 1);
                WireCrossPoint cpQ411 = new WireCrossPoint(submodelModifiable, 1);
 
-               demuxA.moveTo(55, 45);
-               demuxB.moveTo(55, 150);
-               weAndB.moveTo(130, 150);
-               cell00.moveTo(55, 325);
-               cell01.moveTo(55, 475);
-               cell10.moveTo(55, 625);
-               cell11.moveTo(55, 775);
-               andA00.moveTo(235, 375);
+               demuxA  .moveTo( 55,  45);
+               demuxB  .moveTo( 55, 150);
+               weAndB  .moveTo(130, 150);
+               cell00  .moveTo( 55, 325);
+               cell01  .moveTo( 55, 475);
+               cell10  .moveTo( 55, 625);
+               cell11  .moveTo( 55, 775);
+               andA00  .moveTo(235, 375);
                andorA01.moveTo(235, 485);
                andorA10.moveTo(235, 635);
                andorA11.moveTo(235, 785);
-               andB00.moveTo(135, 325);
+               andB00  .moveTo(135, 325);
                andorB01.moveTo(135, 435);
                andorB10.moveTo(135, 585);
                andorB11.moveTo(135, 735);
-               cpB00.moveCenterTo(110, 155);
-               cpB01.moveCenterTo(105, 165);
-               cpB10.moveCenterTo(100, 175);
-               cpB11.moveCenterTo(95, 185);
-               cpD100.moveCenterTo(50, 330);
-               cpD200.moveCenterTo(45, 340);
-               cpD300.moveCenterTo(40, 350);
-               cpD400.moveCenterTo(35, 360);
-               cpD101.moveCenterTo(50, 480);
-               cpD201.moveCenterTo(45, 490);
-               cpD301.moveCenterTo(40, 500);
-               cpD401.moveCenterTo(35, 510);
-               cpD110.moveCenterTo(50, 630);
-               cpD210.moveCenterTo(45, 640);
-               cpD310.moveCenterTo(40, 650);
-               cpD410.moveCenterTo(35, 660);
+               cpB00 .moveCenterTo(110, 155);
+               cpB01 .moveCenterTo(105, 165);
+               cpB10 .moveCenterTo(100, 175);
+               cpB11 .moveCenterTo( 95, 185);
+               cpD1in.moveCenterTo( 35, 550);
+               cpD2in.moveCenterTo( 40, 650);
+               cpD3in.moveCenterTo( 45, 750);
+               cpD4in.moveCenterTo( 50, 810);
+               cpD101.moveCenterTo( 35, 480);
+               cpD201.moveCenterTo( 40, 490);
+               cpD301.moveCenterTo( 45, 500);
+               cpD401.moveCenterTo( 50, 510);
+               cpD110.moveCenterTo( 35, 630);
+               cpD210.moveCenterTo( 40, 640);
+               cpD310.moveCenterTo( 45, 650);
+               cpD410.moveCenterTo( 50, 660);
                cpQ100.moveCenterTo(130, 330);
                cpQ200.moveCenterTo(125, 340);
                cpQ300.moveCenterTo(120, 350);
@@ -137,7 +137,6 @@ public class GUIram2 extends SimpleRectangularSubmodelComponent
                cpQ311.moveCenterTo(120, 800);
                cpQ411.moveCenterTo(115, 810);
 
-               //@formatter:off
                new GUIWire(submodelModifiable, A0, demuxA.getInputPins().get(0), new Point[0]);
                new GUIWire(submodelModifiable, A1, demuxA.getInputPins().get(1), new Point(10, 150), new Point(10,  60));
                new GUIWire(submodelModifiable, B0, demuxB.getInputPins().get(0), new Point( 5, 250), new Point( 5, 155));
@@ -155,23 +154,20 @@ public class GUIram2 extends SimpleRectangularSubmodelComponent
                new GUIWire(submodelModifiable, weAndB.getOutputPins().get(1), cell01.getInputPins().get(4), new Point(180, 165), new Point(180, 245), new Point(25, 245), new Point(25, 520));
                new GUIWire(submodelModifiable, weAndB.getOutputPins().get(2), cell10.getInputPins().get(4), new Point(175, 175), new Point(175, 240), new Point(20, 240), new Point(20, 670));
                new GUIWire(submodelModifiable, weAndB.getOutputPins().get(3), cell11.getInputPins().get(4), new Point(170, 185), new Point(170, 235), new Point(15, 235), new Point(15, 820));
-               new GUIWire(submodelModifiable, D1, cpD100                          , new Point[0]);
-               new GUIWire(submodelModifiable, D2, cpD200                          , new Point[0]);
-               new GUIWire(submodelModifiable, D3, cpD300                          , new Point[0]);
-               new GUIWire(submodelModifiable, D4, cpD400                          , new Point[0]);
-               new GUIWire(submodelModifiable, cpD100, cell00.getInputPins().get(0), new Point[0]);
-               new GUIWire(submodelModifiable, cpD200, cell00.getInputPins().get(1), new Point[0]);
-               new GUIWire(submodelModifiable, cpD300, cell00.getInputPins().get(2), new Point[0]);
-               new GUIWire(submodelModifiable, cpD400, cell00.getInputPins().get(3), new Point[0]);
-               new GUIWire(submodelModifiable, cpD100, cpD101                      , new Point[0]);
-               new GUIWire(submodelModifiable, cpD200, cpD201                      , new Point[0]);
-               new GUIWire(submodelModifiable, cpD300, cpD301                      , new Point[0]);
-               new GUIWire(submodelModifiable, cpD400, cpD401                      , new Point[0]);
+               new GUIWire(submodelModifiable, D1, cpD1in                          , new Point[0]);
+               new GUIWire(submodelModifiable, D2, cpD2in                          , new Point[0]);
+               new GUIWire(submodelModifiable, D3, cpD3in                          , new Point[0]);
+               new GUIWire(submodelModifiable, D4, cpD4in                          , new Point(50, 850));
+               new GUIWire(submodelModifiable, cpD101, cell00.getInputPins().get(0), new Point(35, 330));
+               new GUIWire(submodelModifiable, cpD201, cell00.getInputPins().get(1), new Point(40, 340));
+               new GUIWire(submodelModifiable, cpD301, cell00.getInputPins().get(2), new Point(45, 350));
+               new GUIWire(submodelModifiable, cpD401, cell00.getInputPins().get(3), new Point(50, 360));
                new GUIWire(submodelModifiable, cpD101, cell01.getInputPins().get(0), new Point[0]);
                new GUIWire(submodelModifiable, cpD201, cell01.getInputPins().get(1), new Point[0]);
                new GUIWire(submodelModifiable, cpD301, cell01.getInputPins().get(2), new Point[0]);
                new GUIWire(submodelModifiable, cpD401, cell01.getInputPins().get(3), new Point[0]);
-               new GUIWire(submodelModifiable, cpD101, cpD110                      , new Point[0]);
+               new GUIWire(submodelModifiable, cpD101, cpD1in                      , new Point[0]);
+               new GUIWire(submodelModifiable, cpD1in, cpD110                      , new Point[0]);
                new GUIWire(submodelModifiable, cpD201, cpD210                      , new Point[0]);
                new GUIWire(submodelModifiable, cpD301, cpD310                      , new Point[0]);
                new GUIWire(submodelModifiable, cpD401, cpD410                      , new Point[0]);
@@ -179,10 +175,13 @@ public class GUIram2 extends SimpleRectangularSubmodelComponent
                new GUIWire(submodelModifiable, cpD210, cell10.getInputPins().get(1), new Point[0]);
                new GUIWire(submodelModifiable, cpD310, cell10.getInputPins().get(2), new Point[0]);
                new GUIWire(submodelModifiable, cpD410, cell10.getInputPins().get(3), new Point[0]);
-               new GUIWire(submodelModifiable, cpD110, cell11.getInputPins().get(0), new Point(50, 780));
-               new GUIWire(submodelModifiable, cpD210, cell11.getInputPins().get(1), new Point(45, 790));
-               new GUIWire(submodelModifiable, cpD310, cell11.getInputPins().get(2), new Point(40, 800));
-               new GUIWire(submodelModifiable, cpD410, cell11.getInputPins().get(3), new Point(35, 810));
+               new GUIWire(submodelModifiable, cpD210, cpD2in                      , new Point[0]);
+               new GUIWire(submodelModifiable, cpD310, cpD3in                      , new Point[0]);
+               new GUIWire(submodelModifiable, cpD410, cpD4in                      , new Point[0]);
+               new GUIWire(submodelModifiable, cpD110, cell11.getInputPins().get(0), new Point(35, 780));
+               new GUIWire(submodelModifiable, cpD2in, cell11.getInputPins().get(1), new Point(40, 790));
+               new GUIWire(submodelModifiable, cpD3in, cell11.getInputPins().get(2), new Point(45, 800));
+               new GUIWire(submodelModifiable, cpD4in, cell11.getInputPins().get(3), new Point[0]);
                new GUIWire(submodelModifiable, cell00.getOutputPins().get(0), cpQ100, new Point[0]);
                new GUIWire(submodelModifiable, cell00.getOutputPins().get(1), cpQ200, new Point[0]);
                new GUIWire(submodelModifiable, cell00.getOutputPins().get(2), cpQ300, new Point[0]);