Fpslic.Cell start;
public void main(String[] s) throws Exception {
- turnOnLeds();
+ //turnOnLeds();
setupScanCell();
//runGui(24, 24);
fpslic.readCount();
//System.in.read();
- for(int i=46; i<400; i+=2) {
+ for(int i=16; i<400; 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);
+ 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;
+
+ int clockdivisor = 64;
+ multiplier /= clockdivisor;
- // eleven dividers...
- //result *= 2*2*2*2*2*2*2*2*2*2*2;
+ 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();
+ for(int x=0; x<24; x++)
+ for(int y=0; y<24; y++)
+ fpslic.cell(x,y).wi(L0);
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;
+ for(int x=0; x<24; x++)
+ for(int y=0; y<24; y++)
+ fpslic.cell(x,y).wi(NONE);
+ fpslic.flush();
+
+ fpslic.readCount();
+ try { Thread.sleep(100); } catch (Exception e) { }
+ rc = fpslic.readCount();
+ if (rc!=0) { System.err.println("flush() failed => " + rc); continue; }
+ break;
}
}
if (count>0)
topLeft().ylut(0x00);
boolean yes = true;
- for(int i=0; i<count; i++) {
+ if (count==1) {
+ topLeft().xlut(0x00);
+ yes = true;
+ } else {
+ for(int i=0; i<count-1; i++) {
if (yes) {
topLeft().xlut(0xff);
} else {
topLeft().xlut(0x00);
}
fpslic.flush();
- yes = !yes;
+ yes = !yes;
//System.out.println("fill => " + yes);
//try { Thread.sleep(500); } catch (Exception _) { }
+ }
}
//System.out.println("done filling.");
//try { Thread.sleep(2000); } catch (Exception _) { }
//try { System.in.read(); } catch (Exception _) { }
- if (count>0 && count<size/2-1) {
+ if (count>0 && count!=size/2-1) {
reconfigTopLeftPreserve(yes);
} else if (count>0) {
topLeft().xlut(0xff);
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 });
private Fpslic.Cell micropipelineStage(Fpslic.Cell c, Fpslic.Cell prev, Fpslic.Cell next, boolean configDir) {
c.b(false);
c.f(false);
- c.yo(false);
- c.xo(false);
switch(c.dir(next)) {
case NORTH: case SOUTH: case EAST: case WEST:
switch (c.dir(prev)) {
c.xi(prev);
}
+ if (c.row==topLeft().row && c.col==topLeft().col) {
+ c.yo(false);
+ c.xo(false);
+ } else {
+ c.yo(false);
+ c.xo(true);
+ }
+
c.c(YLUT);
c.ylut(0x00);
c.xlut(0x00);
c.yi(prev);
}
- c.c(XLUT);
+ c.yo(true);
+ c.xo(true);
+ c.c(ZMUX);
+ c.zi(NONE);
+
+ //c.c(XLUT);
c.xlut(0x00);
c.ylut(0x00);
c.wi(L0);
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);