fix bug wherein Instruction.toString() would print the Dock rather than the Destination
[fleet.git] / src / edu / berkeley / fleet / fpga / FpgaDestination.java
1 package edu.berkeley.fleet.fpga;
2 import edu.berkeley.fleet.api.*;
3 import edu.berkeley.fleet.two.*;
4 import edu.berkeley.fleet.*;
5 import java.lang.reflect.*;
6 import edu.berkeley.sbp.chr.*;
7 import edu.berkeley.sbp.misc.*;
8 import edu.berkeley.sbp.meta.*;
9 import edu.berkeley.sbp.util.*;
10 import java.util.*;
11 import java.io.*;
12 import static edu.berkeley.fleet.two.FleetTwoFleet.*;
13 import static edu.berkeley.fleet.fpga.verilog.Verilog.*;
14 import edu.berkeley.fleet.api.*;
15 import edu.berkeley.fleet.api.Dock;
16 import java.util.*;
17
18
19 public class FpgaDestination extends Destination implements FabricElement {
20     private Module.Port port;
21     private boolean isInstructionDestination;
22     FpgaDock dock;
23
24     public FpgaDestination(FpgaDock dock, Module.Port port, boolean isInstructionDestination) {
25         super(dock);
26         this.port = port;
27         this.dock = dock;
28         this.isInstructionDestination = isInstructionDestination;
29     }
30
31     public Module.SourcePort getOutputPort() { throw new RuntimeException(); }
32     public Module.Port getInputPort()  { throw new RuntimeException(); }
33     public void addOutput(FabricElement out, Module.Port outPort) { throw new RuntimeException(); }
34
35     public FpgaPath getPath(FpgaDestination dest, BitVector signal) {
36         if (dest==this) return FpgaPath.emptyPath(this, signal);
37         return null;
38     }
39     public void addInput(FabricElement in, Module.Port inPort) {
40         ((Module.SourcePort)inPort).connect((Module.SinkPort)port);
41     }
42     public String toString() {
43         return dock.toString() + (isInstructionDestination ? ":i" : "");
44     }
45 }