reset state wires too
authoradam <adam@megacz.com>
Wed, 30 Jan 2008 08:20:15 +0000 (09:20 +0100)
committeradam <adam@megacz.com>
Wed, 30 Jan 2008 08:20:15 +0000 (09:20 +0100)
src/edu/berkeley/fleet/fpga/Generator.java

index b44a299..f3f0adc 100644 (file)
@@ -150,6 +150,7 @@ public class Generator {
             public Action isEmpty() { return new SimpleAction(name+"==0"); }
             public Action doFill()  { return new SimpleAction(name+"<=1;"); }
             public Action doDrain() { return new SimpleAction(name+"<=0;"); }
+            public String doReset() { return name+"<="+(initiallyFull?"1":"0")+";"; }
             public StateWire(String name) { this(name, false); }
             public StateWire(String name, boolean initiallyFull) {
                 this.name = name;
@@ -354,6 +355,8 @@ public class Generator {
             pw.println(precrap);
             pw.println("always @(posedge clk) begin");
             pw.println("  if (!rst) begin");
+            for(StateWire sw : statewires.values())
+                pw.println(sw.doReset());
             for(Port p : ports.values()) {
                 if (p instanceof SourcePort) {
                     SourcePort ip = (SourcePort)p;