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));
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<rsize/2+1; i++) test(i, rsize, outfile);
for(int i=rsize/2; i>=0; i--) test(i, rsize, outfile);
outfile.flush();
outfile.close();
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<size*4; i++) {
- topLeft().ylut(0xff);
+ topLeft().xlut(0x00);
+ for(int i=0; i<size*4; i++) {
+ topLeft().ylut(0xff);
+ topLeft().ylut(0x00);
+ }
+
fpslic.flush();
- topLeft().ylut(0x00);
+ fpslic.readCount();
+ try { Thread.sleep(100); } catch (Exception e) { }
+ int rc = fpslic.readCount();
+ if (rc!=0) { System.err.println("flush() failed REALLY BADLY => " + 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;
}
}
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 });
}
} 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 });
return next;
}
+ /*
private void turnOnLeds() {
for(int i=0; i<24; i++) {
//fpslic.iob_bot(i, true).enableOutput(NORTH);
fpslic.cell(i, 0).ylut(0xff);
}
}
-
+ */
private void setupScanCell() {
fpslic.cell(23,15).h(3, true);
fpslic.cell(23,15).yi(L3);