public class FifoModule extends Module {
private int len;
private int width;
- public FifoModule(int len, int width) {
- super("fifo"+len+"x"+width);
+ private boolean doubleSpeed;
+ public FifoModule(int len, int width) { this(len, width, false); }
+ public FifoModule(int len, int width, boolean doubleSpeed) {
+ super("fifo"+len+"x"+width+(doubleSpeed?"_2x":""));
this.len = len;
this.width = width;
+ this.doubleSpeed = doubleSpeed;
Module.SourcePort in = createInputPort("in", width);
Module.SinkPort out = createOutputPort("out", width);
Module.InstantiatedModule[] stages = new Module.InstantiatedModule[len];
if (len==0) {
in.connect(out);
} else if (len==1) {
+ if (doubleSpeed) throw new RuntimeException();
new Event(new Object[] { in, out },
new Action[] { in, out, new AssignAction(out, in) });
} else {
pw.println("`define ADDR_BITS "+dislog(len));
pw.println("`define WIDTH " + width);
pw.println("`define MODULE_NAME "+name);
+ if (doubleSpeed) {
+ pw.println("`define DELAY 2");
+ } else {
+ pw.println("`define DELAY 5");
+ }
pw.println("`include \"ramfifo.inc\"");
pw.flush();
return;
}
+ if (doubleSpeed) throw new RuntimeException();
super.dump(prefix);
return;