checkpoint
[slipway.git] / src / edu / berkeley / slipway / gui / Gui.java
index 1ab98ee..829479f 100644 (file)
@@ -59,6 +59,7 @@ public class Gui extends ZoomingPanel implements KeyListener, MouseMotionListene
         this(at40k, drone, 24, 24);
     }
     public Gui(Fpslic at40k, FtdiBoard drone, int width, int height) {
+        super(drone);
         this.at40k = at40k;
         this.drone = drone;
         for(int i=0; i<ca.length; i++)
@@ -68,11 +69,16 @@ public class Gui extends ZoomingPanel implements KeyListener, MouseMotionListene
                 new Cell(x,y, at40k.cell(x, y));
 
 
-        new Thread() {
+
+        /*
+          new Thread() {
             public void run() {
+                try { Thread.sleep(2000); } catch (Exception e) { }
                 while(true) scan();
             }
-        }.start();
+            }.start();
+        */
+
 
         /*
         Fpslic.Cell c = at40k.cell(0,0);
@@ -99,13 +105,16 @@ public class Gui extends ZoomingPanel implements KeyListener, MouseMotionListene
             this.cell = cell;
             cells.add(this);
         }
+        public boolean scanme() { 
+            return cell.relevant();
+        }
         public void clear() {
-            gg.color(in ? selectedcell : (scanme ? new Color(0xbb, 0xbb, 0xbb) : nonselectedcell));
+            gg.color(in ? selectedcell : (scanme() ? new Color(0xbb, 0xbb, 0xbb) : nonselectedcell));
             g.fillRect(0, 0, SIZE, SIZE);
         }
         public void draw() {
 
-            if (cell.relevant() || scanme) {
+            if (cell.relevant() || scanme()) {
                 drawWires();
                 drawLocal();
                 
@@ -424,7 +433,7 @@ public class Gui extends ZoomingPanel implements KeyListener, MouseMotionListene
 
 
                 g.translate(2,   5f);
-                if (xlut_relevant(cell) || scanme) {
+                if (xlut_relevant(cell) || scanme()) {
                     Gate gate = getGate(cell.xlut(), true);
                     gate.draw(g,
                               !xknown ? Color.gray : xon ? Color.red : Color.white,
@@ -434,7 +443,7 @@ public class Gui extends ZoomingPanel implements KeyListener, MouseMotionListene
                 }
 
                 g.translate(34f, 0f);
-                if (cell.ylut_relevant() || scanme) {
+                if (cell.ylut_relevant() || scanme()) {
                     Gate gate = getGate(cell.ylut(), false);
                     gate.draw(g,
                               !yknown ? Color.gray : yon ? Color.blue : Color.white,
@@ -630,7 +639,16 @@ public class Gui extends ZoomingPanel implements KeyListener, MouseMotionListene
                          getWidth() - 200 + 10, (line += 15));
             g.drawString("z-in mux: " + (newcell.cell.zi()==NONE ? "." : ("L"+(newcell.cell.zi()-L0))),
                          getWidth() - 200 + 10, (line += 15));
-            g.drawString("t-in mux: ", getWidth() - 200 + 10, (line += 15));
+
+            String tm = "??";
+            switch(newcell.cell.t()) {
+                case TMUX_FB:       tm = "fb"; break;
+                case TMUX_W_AND_FB: tm = "w&fb"; break;
+                case TMUX_Z:        tm = "z"; break;
+                case TMUX_W_AND_Z:  tm = "w&z"; break;
+                case TMUX_W:        tm = "w"; break;
+            }
+            g.drawString("t-in mux: " + tm, getWidth() - 200 + 10, (line += 15));
 
             g.drawString(" set/rst: " + (newcell.cell.ff_reset_value() ? "reset=SET" : "."),
                          getWidth() - 200 + 10, (line += 15));
@@ -741,7 +759,7 @@ public class Gui extends ZoomingPanel implements KeyListener, MouseMotionListene
         for(int x=0; x<at40k.getWidth(); x++)
             for(int y=0; y<at40k.getHeight(); y++)
                 if (ca[x][y] != null)
-                    if (ca[x][y].scanme)
+                    if (ca[x][y].scanme())
                         scan(ca[x][y]);
     }
     public void scan(final Gui.Cell c) {
@@ -777,6 +795,7 @@ public class Gui extends ZoomingPanel implements KeyListener, MouseMotionListene
                         } else {
                             drone.readBus(new BCB(c, XLUT));
                         }
+                        /*
                         if (!cell.yo())
                         for(Fpslic.Cell c2 : new Fpslic.Cell[] { cell.north(), cell.south(), cell.east(), cell.west() })
                             if (c2!=null && !c2.relevant()) {
@@ -789,6 +808,7 @@ public class Gui extends ZoomingPanel implements KeyListener, MouseMotionListene
                                 c2.yi(NONE);
                                 return;
                             }
+                        */
                         c.yknown = false;
                         break;
                     case YLUT:
@@ -797,6 +817,7 @@ public class Gui extends ZoomingPanel implements KeyListener, MouseMotionListene
                         } else {
                             drone.readBus(new BCB(c, YLUT));
                         }
+                        /*
                         if (!cell.xo())
                         for(Fpslic.Cell c2 : new Fpslic.Cell[] { cell.nw(), cell.sw(), cell.ne(), cell.se() })
                             if (c2!=null && !c2.relevant()) {
@@ -809,9 +830,11 @@ public class Gui extends ZoomingPanel implements KeyListener, MouseMotionListene
                                 c2.xi(NONE);
                                 return;
                             }
+                        */
                         c.xknown = false;
                         break;
                     case ZMUX: {
+                        /*
                         scan(at40k, cell, NONE, false);
                         c.xknown = false;
                         c.yknown = false;
@@ -839,6 +862,7 @@ public class Gui extends ZoomingPanel implements KeyListener, MouseMotionListene
                                 break;
                             }
                         return;
+                        */
                     }
                 }