checkpoint
authoradam <adam@megacz.com>
Wed, 7 Jun 2006 07:14:35 +0000 (08:14 +0100)
committeradam <adam@megacz.com>
Wed, 7 Jun 2006 07:14:35 +0000 (08:14 +0100)
src/edu/berkeley/obits/AtmelSerial.java
src/edu/berkeley/obits/device/atmel/At40k.java
src/edu/berkeley/obits/device/atmel/AtmelDevice.java

index 114adf8..a67d936 100644 (file)
@@ -222,6 +222,7 @@ public class AtmelSerial {
             }
             */
 
+            /* LAST
             System.out.println("doit");
             if (mullers) doitx(at40k, device);
             //System.out.println("counter");
@@ -232,11 +233,133 @@ public class AtmelSerial {
 
             at40k.cell(22,15).yi(WEST);
             at40k.cell(22,15).ylut(0xAA);
-
+            */
             at40k.cell(23,15).h(3, true);
             at40k.cell(23,15).yi(L3);
             at40k.cell(23,15).ylut(0xAA);
             at40k.iob_right(15, true).enableOutput(WEST);
+
+
+            At40k.Cell c = at40k.cell(10,10);
+            c.ylut(~LUT_SELF);
+            c.xlut(LUT_Z);
+            c.yi(WEST);
+            c.c(YLUT);
+            c.f(false);
+            c.t(TMUX_FB);
+            copy(c.west(), EAST, NW);
+            copy(c.west().north().west(), SE, SE);
+
+            c = c.east();
+            c.ylut(~LUT_SELF);
+            c.xlut(LUT_Z);
+            c.yi(EAST);
+            c.c(YLUT);
+            c.f(false);
+            c.t(TMUX_FB);
+            copy(c.east(), WEST, SE);
+            copy(c.east().south().east(), NW, NW);
+
+            c = c.north();
+            copy(c.north(), SOUTH, SOUTH);
+            c.xlut((LUT_SELF & ~LUT_OTHER) | LUT_Z);
+            c.ylut(LUT_Z);
+            c.yi(SOUTH);
+            c.c(XLUT);
+            c.xi(SW);
+            c.wi(L4);
+            c.f(false);
+            c.t(TMUX_W_AND_FB);
+            c.v(L4, false);
+            c.h(L4, true);
+            c.v(L2, false);
+            c.h(L2, true);
+
+            c = c.west();
+            copy(c.north(), SOUTH, SOUTH);
+            c.xlut((LUT_SELF & ~LUT_OTHER) | LUT_Z);
+            c.ylut(~LUT_Z);
+            c.yi(SOUTH);
+            c.xi(SE);
+            c.c(XLUT);
+            c.wi(L4);
+            c.f(false);
+            c.t(TMUX_W_AND_FB);
+            c.v(L4, false);
+            c.h(L4, true);
+            c.v(L2, false);
+            c.h(L2, true);
+
+            c = c.west();
+            c.v(L4, false);
+            c.h(L4, true);
+            c.out(L4, true);
+            c.f(false);
+            c.b(false);
+            c.oe(NONE);
+            c.c(YLUT);
+            c.hwire(L4).west().drives(c.hwire(L4), false);
+            c.hwire(L4).east().drives(c.hwire(L4), false);
+
+            c = c.south();
+            c = c.south();
+            c.v(L4, false);
+            c.h(L4, true);
+            c.out(L4, true);
+            c.f(false);
+            c.b(false);
+            c.oe(NONE);
+            c.c(YLUT);
+            c.hwire(L4).west().drives(c.hwire(L4), false);
+            c.hwire(L4).east().drives(c.hwire(L4), false);
+
+            c = c.east();
+            c = c.east();
+            copy(c.south(), NORTH, NORTH);
+            c.xlut(((~LUT_SELF) & (~LUT_OTHER)) | LUT_Z);
+            c.ylut(LUT_Z);
+            c.yi(NORTH);
+            c.c(XLUT);
+            c.xi(NW);
+            c.wi(L4);
+            c.f(false);
+            c.t(TMUX_W_AND_FB);
+            c.v(L4, false);
+            c.h(L4, true);
+            c.v(L2, false);
+            c.h(L2, true);
+
+            c = c.west();
+            copy(c.south(), NORTH, NORTH);
+            c.xlut((LUT_SELF & LUT_OTHER) | LUT_Z);
+            c.ylut(LUT_Z);
+            c.yi(NORTH);
+            c.xi(NE);
+            c.c(XLUT);
+            c.wi(L4);
+            c.f(false);
+            c.t(TMUX_W_AND_FB);
+            c.v(L4, false);
+            c.h(L4, true);
+            c.v(L2, false);
+            c.h(L2, true);
+
+
+
+            // catch a rising transition
+            /*
+            c = c.west();
+            c.v(L2, false);
+            c.h(L2, true);
+            c.out(L2, true);
+            c.f(false);
+            c.b(false);
+            c.oe(NONE);
+            c.c(YLUT);
+            */
+            c.hwire(L2).west().drives(c.hwire(L2), false);
+            c.hwire(L2).east().drives(c.hwire(L2), false);
+
             //for(int x=5; x<PIPELEN; x++) {
             //at40k.cell(x,23).hwire(L0).drives(at40k.cell(x,23).hwire(L0).east());
             //}
index c19e238..c7aace0 100644 (file)
@@ -142,6 +142,10 @@ public class At40k {
 
         public SectorWire hwire(int plane)  { return new SectorWire(true, plane, col, row); }
         public SectorWire vwire(int plane)  { return new SectorWire(false, plane, col, row); }
+        public Cell east() { return cell(col+1, row); }
+        public Cell west() { return cell(col-1, row); }
+        public Cell north() { return cell(col,   row+1); }
+        public Cell south() { return cell(col,   row-1); }
 
         public Sector sector() { return new Sector(this); }
         public Cell(int col, int row) {
@@ -260,15 +264,41 @@ public class At40k {
                 default: throw new Error("ack!");
             }
         }
-        public void t(boolean z, boolean w, boolean fb) {
+        public void t(int code) {
+            int result = 0;
+            switch(code) {
+                case TMUX_Z: throw new Error("not implemented, but should be possible");
+                case TMUX_W_AND_Z: result = 0x20; break;
+
+                case TMUX_FB: result = 0x04; break; /* I think this is actually W_AND_FB, sadly */
+                case TMUX_W_AND_FB: result = 0x14; break;
+                case TMUX_W: result = 0x00; break;
+            }
+            dev.mode4(1, row, col, result, 0x34);
+        }
+        public void t(boolean ignore_z_and_fb, boolean zm_drives_fb, boolean fb_drives_wm) {
             // still not totally satisfied...
             //     how to we distinguish between z&w vs z or w&fb vs fb? ==> you can't!  this is a false connection in my diagram
             //     what does it mean for both bits (0x30) to be set to 1?
-            if (fb && z) throw new RuntimeException("invalid combination");
+            //if (fb && z) throw new RuntimeException("invalid combination");
             int result = 0;
-            if (z)  result |= 0x20;
-            if (fb) result |= 0x10;
-            dev.mode4(1, row, col, result, 0x30);
+            // ZM->FB = 0x04
+            // FB->WM = 0x10
+            // WZ->WM = 0x20
+            // tff => w&z
+            // fff => w
+            // ttt => fb&w
+            // ftt => fb&w
+            // fft => fb&w
+
+            // ttf => w&z
+            // ftf => w
+            // tft => fb&w
+            if (ignore_z_and_fb) result |= 0x20;
+            if (zm_drives_fb) result |= 0x04;
+            if (fb_drives_wm) result |= 0x10;
+            dev.mode4(1, row, col, result, 0x34);
         }
 
         public void c(int source) {
index 03db123..50c5c47 100644 (file)
@@ -57,6 +57,12 @@ public abstract class AtmelDevice extends Bits implements Device {
         public static final int LUT_SELF  = 0xAA;
         public static final int LUT_Z     = 0xF0;
         public static final int LUT_OTHER = 0xCC;
+
+        public static final int TMUX_W_AND_Z   = 0x00001001;
+        public static final int TMUX_W         = 0x00001002;
+        public static final int TMUX_Z         = 0x00001004;
+        public static final int TMUX_W_AND_FB  = 0x00001008;
+        public static final int TMUX_FB        = 0x00001010;
     }
 
     /** issue a command to the device in Mode4 format; see Gosset's documentation for further details */