dests.addAll(outbox_dests);
top_horn = mkNode((FabricElement[])dests.toArray(new FabricElement[0]), true);
FabricElement source = mkNode((FabricElement[])sources.toArray(new FabricElement[0]), false);
- FunnelModule.FunnelInstance top_funnel = new FunnelModule.FunnelInstance(top, null, source.getOutputPort());
+ FunnelModule.FunnelInstance top_funnel = new FunnelModule.FunnelInstance(this, top, null, source.getOutputPort());
((FunnelModule.FunnelInstance)source).out = top_funnel;
//top_horn.addInput(top_funnel, top_funnel.getOutputPort());
top_funnel.addOutput(top_horn, top_horn.getInputPort());
FabricElement leftPort = mkNode(ports, is_horn, start, (end+start)/2);
FabricElement rightPort = mkNode(ports, is_horn, (end+start)/2, end);
return is_horn
- ? new HornModule.HornInstance(top, leftPort, rightPort)
- : new FunnelModule.FunnelInstance(top, leftPort, rightPort);
+ ? new HornModule.HornInstance(this, top, leftPort, rightPort)
+ : new FunnelModule.FunnelInstance(this, top, leftPort, rightPort);
}
}
}
public class FunnelModule extends Module {
- private static final int WIDTH = WIDTH_PACKET;
-
- public FunnelModule() {
+ public FunnelModule(Fpga fpga) {
super("funnel");
- Module.SinkPort outp = createOutputPort("out", WIDTH, "");
- Module.SourcePort in1p = createInputPort("in1", WIDTH_PACKET);
- Module.SourcePort in2p = createInputPort("in2", WIDTH_PACKET);
+ Module.SinkPort outp = createOutputPort("out", fpga.WIDTH_PACKET, "");
+ Module.SourcePort in1p = createInputPort("in1", fpga.WIDTH_PACKET);
+ Module.SourcePort in2p = createInputPort("in2", fpga.WIDTH_PACKET);
// FIXME: biased towards in2p side
new Event(new Object[] { in1p, outp, "!"+in2p.getReq() },
public FabricElement out = null;
public Module.SourcePort getOutputPort() { return getOutputPort("out"); }
public Module.Port getInputPort() { throw new RuntimeException("funnel has multiple inputs"); }
- public FunnelInstance(Module thisModule, Module.SourcePort p1, Module.SourcePort p2) {
- super(thisModule, new FunnelModule());
+ public FunnelInstance(Fpga fpga, Module thisModule, Module.SourcePort p1, Module.SourcePort p2) {
+ super(thisModule, new FunnelModule(fpga));
if (p1 != null) p1.connect(this.getInputPort("in1"));
if (p2 != null) p2.connect(this.getInputPort("in2"));
}
- public FunnelInstance(Module thisModule, FabricElement in1, FabricElement in2) {
- super(thisModule, new FunnelModule());
+ public FunnelInstance(Fpga fpga, Module thisModule, FabricElement in1, FabricElement in2) {
+ super(thisModule, new FunnelModule(fpga));
this.in1 = in1;
this.in2 = in2;
in1.addOutput(this, this.getInputPort("in1"));
public class HornModule extends Module {
- public HornModule() {
- this(PACKET_DEST.width-1,
- PACKET_DEST.valmaskmax,
- PACKET_DEST.valmaskmin,
+ public HornModule(Fpga fpga) {
+ this(fpga.PACKET_DEST.width-1,
+ fpga.PACKET_DEST.valmaskmax,
+ fpga.PACKET_DEST.valmaskmin,
0);
}
private HornModule(int top,
public void addInput(FabricElement in, Module.Port source) { source.connect(getInputPort("in")); }
public Module.SourcePort getOutputPort() { throw new RuntimeException("horn has multiple outputs"); }
public Module.Port getInputPort() { return getInputPort("in"); }
- public HornInstance(Module thisModule, FabricElement out0, FabricElement out1) {
- super(thisModule, new HornModule());
+ public HornInstance(Fpga fpga, Module thisModule, FabricElement out0, FabricElement out1) {
+ super(thisModule, new HornModule(fpga));
this.out0 = out0;
this.out1 = out1;
out0.addInput(this, getOutputPort("out0"));