From: adam Date: Fri, 29 Sep 2006 13:30:07 +0000 (+0100) Subject: checkpoint X-Git-Tag: mpar_demo_release~19 X-Git-Url: http://git.megacz.com/?p=slipway.git;a=commitdiff_plain;h=53c63cc472567d05e355cc71ac8159146b3cdcf3 checkpoint --- diff --git a/src/edu/berkeley/slipway/AsyncPaperDemo.java b/src/edu/berkeley/slipway/AsyncPaperDemo.java index 37f940f..9cef233 100644 --- a/src/edu/berkeley/slipway/AsyncPaperDemo.java +++ b/src/edu/berkeley/slipway/AsyncPaperDemo.java @@ -24,31 +24,37 @@ public class AsyncPaperDemo { Fpslic.Cell start; public void main(String[] s) throws Exception { - turnOnLeds(); + //turnOnLeds(); setupScanCell(); - runGui(24, 24); + //runGui(24, 24); for(int i=0; i<255; i++) fpslic.readCount(); //System.in.read(); - for(int i=90; i<400; i+=2) { + for(int i=256; ; i+=2) { go(i); } - System.out.println("done"); + //System.out.println("done"); } public void go(int size) throws Exception { start = fpslic.cell(20, 21); - int rsize = size-createPipeline(start, true, size, false)+2; + int rsize = size-createPipeline(start, true, size-4, false); System.out.println("actual size => " + rsize); pipe(start.west().north(), start.west(), new int[] { NE, EAST, SW, SOUTH }); - for(int i=1; i<22; i+=2) - divider(fpslic.cell(21, i)); - fpslic.cell(23,0).yo(fpslic.cell(22,0)); + Fpslic.Cell div = start.east(); + while(true) { + divider(div); + if (div.south()==null || div.south().south()==null) break; + div = div.south().south(); + } + div = div.south().east(); + div.east().yo(div); + //fpslic.cell(23,0).yo(fpslic.cell(22,0)); fpslic.cell(21,22).yo(fpslic.cell(20,22)); fpslic.cell(21,22).xo(fpslic.cell(20,22)); @@ -56,14 +62,11 @@ public class AsyncPaperDemo { reconfigTopRight(); fpslic.flush(); - Thread.sleep(2000); - String sizes = rsize+""; while(sizes.length()<3) sizes = "0"+sizes; String fname = "data/size"+sizes+".csv"; if (!new File(fname).exists()) { PrintWriter outfile = new PrintWriter(new OutputStreamWriter(new FileOutputStream(fname))); - //for(int i=0; i=0; i--) test(i, rsize, outfile); outfile.flush(); outfile.close(); @@ -88,59 +91,49 @@ public class AsyncPaperDemo { long then = System.currentTimeMillis(); int tokens = fpslic.readCount(); - double elapsed = (double)((FtdiBoard)fpslic).timer; + + int clockrate = 24; // (in mhz) + double elapsed = (double)((((FtdiBoard)fpslic).timer)/clockrate); double occupancy = ((double)(2*count))/((double)size); - //double elapsed = (then-now); - double result = (tokens*1000)/elapsed; + // eleven dividers... ...and the interrupt pin counts *pairs* of transitions + int multiplier = 2*2*2*2*2*2*2*2*2*2*2*2; - // eleven dividers... - //result *= 2*2*2*2*2*2*2*2*2*2*2; + int clockdivisor = 64; + multiplier /= clockdivisor; + + double result = (tokens*multiplier)/elapsed; // in millions - // ...and the interrupt pin counts *pairs* of transitions - //result *= 2; // result is transitions/sec => 633mcell/sec velocity! =) outfile.println(occupancy + ", " + result); - System.out.println((2*count)+"/"+size+" "+occupancy + ", " + result + " @ " + elapsed); + System.out.println((2*count)+"/"+size+" "+occupancy + ", " + result/* + " @ " + elapsed*/); outfile.flush(); } private void drain(int size) { while(true){ - topLeft().xlut(0x00); - for(int i=0; i " + rc); continue; } + + reconfigTopLeft(); + fpslic.flush(); - } - - fpslic.flush(); - fpslic.readCount(); - fpslic.readCount(); - try { Thread.sleep(100); } catch (Exception e) { } - int rc = fpslic.readCount(); - if (rc!=0) { - System.err.println("flush() failed REALLY BADLY => " + rc); - //try { System.in.read(); } catch (Exception _) { } - continue; - } - - reconfigTopLeft(); - - fpslic.flush(); - fpslic.readCount(); - fpslic.readCount(); - try { Thread.sleep(100); } catch (Exception e) { } - rc = fpslic.readCount(); - if (rc!=0) { - System.err.println("flush() failed => " + rc); - //try { System.in.read(); } catch (Exception _) { } - continue; - } - break; + fpslic.readCount(); + try { Thread.sleep(100); } catch (Exception e) { } + rc = fpslic.readCount(); + if (rc!=0) { System.err.println("flush() failed => " + rc); continue; } + break; } } @@ -245,8 +238,8 @@ public class AsyncPaperDemo { do { if (downward) { if (c.row < 6) { - if (length < 10+4) { stop = true; break; } - length -= 10; + if (length < 8+4) { stop = true; break; } + length -= 8; c = pipe(c, c.north(), new int[] { SW, EAST, SW, WEST, NW, NORTH }); c = c.se(); c = pipe(c, c.north(), new int[] { NE, NORTH }); @@ -268,8 +261,8 @@ public class AsyncPaperDemo { } } else { if (c.row > c.fpslic().getHeight()-7) { - if (length < 10+4) { stop = true; break; } - length -= 10; + if (length < 8+4) { stop = true; break; } + length -= 8; c = pipe(c, c.south(), new int[] { NW, SOUTH }); c = c.nw(); c = pipe(c, c.south(), new int[] { NE, EAST, SE, WEST, SE, SOUTH }); @@ -387,6 +380,7 @@ public class AsyncPaperDemo { return next; } + /* private void turnOnLeds() { for(int i=0; i<24; i++) { //fpslic.iob_bot(i, true).enableOutput(NORTH); @@ -395,7 +389,7 @@ public class AsyncPaperDemo { fpslic.cell(i, 0).ylut(0xff); } } - + */ private void setupScanCell() { fpslic.cell(23,15).h(3, true); fpslic.cell(23,15).yi(L3); diff --git a/src/edu/berkeley/slipway/gui/Gui.java b/src/edu/berkeley/slipway/gui/Gui.java index 829479f..7b8acee 100644 --- a/src/edu/berkeley/slipway/gui/Gui.java +++ b/src/edu/berkeley/slipway/gui/Gui.java @@ -70,14 +70,13 @@ public class Gui extends ZoomingPanel implements KeyListener, MouseMotionListene - /* - new Thread() { + + new Thread() { public void run() { - try { Thread.sleep(2000); } catch (Exception e) { } while(true) scan(); } - }.start(); - */ + }.start(); + /*