public interface FabricElement {
public FpgaPath getPath(FpgaDestination dest, BitVector signal);
+ public int getPathLength(FpgaDestination dest);
public void addInput(FabricElement in, Module.Port inPort);
public void addOutput(FabricElement out, Module.Port outPort);
public static abstract class AbstractFabricElement implements FabricElement {
public abstract FpgaPath getPath(FpgaDestination dest, BitVector signal);
+ public abstract int getPathLength(FpgaDestination dest);
public void addInput(FabricElement in, Module.Port inPort) { throw new RuntimeException(); }
public void addOutput(FabricElement out, Module.Port outPort) { throw new RuntimeException(); }
public Module.SourcePort getOutputPort() { throw new RuntimeException(); }
final Module.SourcePort sp = sp0;
sources.add(new FabricElement.AbstractFabricElement() {
private FabricElement upstream;
+ public int getPathLength(FpgaDestination dest) { return upstream.getPathLength(dest); }
public FpgaPath getPath(FpgaDestination dest, BitVector signal) { return upstream.getPath(dest, signal); }
public void addOutput(FabricElement out, Module.Port outPort) {
this.upstream = out;
public Module.Port getInputPort() { throw new RuntimeException(); }
public void addOutput(FabricElement out, Module.Port outPort) { throw new RuntimeException(); }
+ public int getPathLength(FpgaDestination dest) {
+ if (dest==this) {
+ return isInstructionDestination ? 0 : FpgaDock.DATA_FIFO_SIZE;
+ }
+ return 0;
+ }
public FpgaPath getPath(FpgaDestination dest, BitVector signal) {
if (dest==this) return FpgaPath.emptyPath(this, signal);
return null;
private static final int INSTRUCTION_FIFO_SIZE = 12;
private static final int EPILOGUE_FIFO_SIZE = 0;
//private static final int DATA_FIFO_SIZE = 4;
- private static final int DATA_FIFO_SIZE = 8;
+ static final int DATA_FIFO_SIZE = 8;
private FpgaDestination dataDestination;
private FpgaDestination instructionDestination;
public Module.Port getInputPort() { throw new RuntimeException(); }
public Path getPath(Destination dest,BitVector signal) { return getPath((FpgaDestination)dest, signal); }
public FpgaPath getPath(FpgaDestination dest,BitVector signal) { return upstream.getPath(dest, signal); }
+ public int getPathLength(FpgaDestination dest) { return upstream.getPathLength(dest)-1; }
public void addInput(FabricElement in, Module.Port inPort) { throw new RuntimeException(); }
public void addOutput(FabricElement out, Module.Port outPort) {
this.upstream = out;
public void addInput(FabricElement in, Module.Port source) {
throw new RuntimeException("cannot add inputs to a funnel once constructed");
}
+ public int getPathLength(FpgaDestination dest) { return out.getPathLength(dest)+1; }
public FpgaPath getPath(FpgaDestination dest, BitVector signal) {
return out.getPath(dest, signal);
}
out1.addInput(this, getOutputPort("out1"));
}
public void addOutput(FabricElement out, Module.Port outPort) { throw new RuntimeException(); }
+ public int getPathLength(FpgaDestination dest) {
+ FpgaPath path0 = out0==null ? null : out0.getPath(dest, null);
+ FpgaPath path1 = out1==null ? null : out1.getPath(dest, null);
+ if (path0==null) return out1.getPathLength(dest)+1;
+ if (path1==null) return out0.getPathLength(dest)+1;
+ return Math.min(out1.getPathLength(dest)+1, out0.getPathLength(dest)+1);
+ }
public FpgaPath getPath(FpgaDestination dest, BitVector signal) {
FpgaPath path0 = out0==null ? null : out0.getPath(dest, signal);
FpgaPath path1 = out1==null ? null : out1.getPath(dest, signal);