X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Ffleet%2Ffpga%2FFpga.java;h=ec2ef1c3c091f2c673219ea5de4dd63f22dbc8ea;hb=8ef6f34f6a3eea2a8c2a60139e90fb07e3cf96de;hp=42cd3a7aa3723f20e053e11140dd3944854621ac;hpb=6db6a33919f27f3c5bdfdb407138196c33d78c3e;p=fleet.git diff --git a/src/edu/berkeley/fleet/fpga/Fpga.java b/src/edu/berkeley/fleet/fpga/Fpga.java index 42cd3a7..ec2ef1c 100644 --- a/src/edu/berkeley/fleet/fpga/Fpga.java +++ b/src/edu/berkeley/fleet/fpga/Fpga.java @@ -16,7 +16,7 @@ import static edu.berkeley.fleet.fpga.verilog.Verilog.*; import edu.berkeley.fleet.two.PercolatedPort; -public class Fpga extends FleetTwoFleet { +public abstract class Fpga extends FleetTwoFleet { public Module top; Ship debugShip; @@ -33,7 +33,7 @@ public class Fpga extends FleetTwoFleet { } public static void main(String[] s) throws Exception { - new Fpga(new Module("main")).top.dump(s[0]); + ((Fpga)Fleet.getDefaultImpl()).top.dump(s[0]); PrintWriter pw; pw = new PrintWriter(new OutputStreamWriter(new FileOutputStream(s[0]+"/timescale.v"))); @@ -73,41 +73,12 @@ public class Fpga extends FleetTwoFleet { return ship; } - public Fpga() throws Exception { this(new Module("main")); } - public Fpga(Module top) throws Exception { - this.top = top; - debugShip = createShip("Debug"); - - //boolean small = true; - boolean small = false; - - if (small) { - for(int i=0; i<2; i++) createShip("Alu"); - for(int i=0; i<1; i++) createShip("Memory"); - for(int i=0; i<2; i++) createShip("Fifo"); - createShip("Counter"); - createShip("CarrySaveAdder"); - createShip("Rotator"); - createShip("Lut3"); - - } else { - - for(int i=0; i<2; i++) createShip("Memory"); - for(int i=0; i<6; i++) createShip("Alu"); - for(int i=0; i<1; i++) createShip("Fifo"); - for(int i=0; i<12; i++) createShip("Counter"); - - //createShip("CarrySaveAdder"); - //createShip("Rotator"); - createShip("Random"); - createShip("Button"); - - } - - createShip("Timer"); - createShip("DDR2"); - createShip("Dvi"); + protected Fpga() throws IOException { + this.top = new Module("main"); + this.debugShip = createShip("Debug"); + } + protected void init() throws IOException { // for FifoShip new Module.InstantiatedModule(top, new FifoModule(8, WIDTH_WORD)); @@ -161,13 +132,16 @@ public class Fpga extends FleetTwoFleet { // Expand ////////////////////////////////////////////////////////////////////////////// + protected abstract String getDirName(); + public void expand(ShipDescription sd) { try { if (sd.getSection("fpga")==null) return; + if (getShip(sd.getName(),0)==null) return; // no ships of this type String filename = sd.getName().toLowerCase(); if (sd.getSection("ucf") != null) { - File outf = new File("build/fpga/"+filename+".ucf"); + File outf = new File("build/"+getDirName()+"/"+filename+".ucf"); FileOutputStream out = new FileOutputStream(outf); PrintWriter pw = new PrintWriter(out); pw.println(sd.getSection("ucf")); @@ -175,7 +149,7 @@ public class Fpga extends FleetTwoFleet { pw.close(); } - File outf = new File("build/fpga/"+filename+".v"); + File outf = new File("build/"+getDirName()+"/"+filename+".v"); new File(outf.getParent()).mkdirs(); System.err.println("writing to " + outf); FileOutputStream out = new FileOutputStream(outf);