1 package edu.berkeley.fleet.fpga;
2 import edu.berkeley.fleet.fpga.*;
3 import edu.berkeley.fleet.api.*;
9 import java.util.concurrent.Semaphore;
11 public class Bee2 extends Fpga {
14 Secondly, here is the EDK core:
16 http://repository.eecs.berkeley.edu/viewvc/Projects/BEE/trunk/2/hardware/pcores/interchip_block_v1_00_a/
18 This core generates the links for both control-user and user-user using some crazy scripts possibly written by Yury. Some EDK system examples are here:
20 http://repository.eecs.berkeley.edu/viewvc/Projects/BEE/trunk/2/applications/reference/MPI_demo/XPS_Ctrlfpga/
21 http://repository.eecs.berkeley.edu/viewvc/Projects/BEE/trunk/2/applications/reference/MPI_demo/XPS_Userfpga/
23 You can either attempt to execute these scripts in order to generate output for your desired configuration or use already generated output for a 100 Mhz configuration as we did when we converted RAMP Blue to RDL:
25 http://repository.eecs.berkeley.edu/viewvc/Projects/RAMP/tags/RAMPBlue_Final/Blue/UserFPGA/Infrastructure/Interchip/
27 You can see how we used the generated output here:
29 http://repository.eecs.berkeley.edu/viewvc/Projects/RAMP/tags/RAMPBlue_Final/Blue/UserFPGA/
31 I may be able to assist you further if you run into difficulties, but my memory of how this is supposed to work is hazy at best--and I never understood the interchip core scripts anyway.
36 protected String getDirName() { return "bee2"; }
38 public Bee2() throws IOException {
39 for(int i=0; i<2; i++) createShip("Alu");
40 for(int i=0; i<1; i++) createShip("Memory");
41 for(int i=0; i<2; i++) createShip("Fifo");
42 //createShip("Random");
43 //createShip("CarrySaveAdder");
44 createShip("Rotator");
46 createShip("Counter");
48 for(int i=0; i<2; i++) createShip("Memory");
49 for(int i=0; i<6; i++) createShip("Alu");
50 for(int i=0; i<1; i++) createShip("Fifo");
51 for(int i=0; i<12; i++) createShip("Counter");
53 //createShip("CarrySaveAdder");
54 //createShip("Rotator");
63 // Server //////////////////////////////////////////////////////////////////////////////
65 private static class Gobbler extends Thread {
66 private final BufferedReader br;
67 public Gobbler(InputStream is) {
68 this.br = new BufferedReader(new InputStreamReader(is));
72 for(String s = br.readLine(); s!=null; s=br.readLine())
73 System.err.println(" > " + s);
74 } catch (Exception e) { throw new RuntimeException(e); }
78 private static RandomAccessFile raf;
79 private static OutputStream fos;
80 private static InputStream fis;
82 public static String pass_string = "password=security_is_for_wimps ";
84 public static void main(String[] args) throws Exception {
85 if (args.length != 2) {
86 System.err.println("usage: java " + Bee2.class.getName() + " {-client|-server} <fpganum>");
90 int idx = Integer.parseInt(args[1]);
95 if (args[0].equals("-client")) {
97 System.err.println("== rsyncing");
98 proc = Runtime.getRuntime().exec("rsync -are ssh --progress --verbose fleet.jar build/bee2/main.bit misc/bicat.c "+host+":");
99 new Gobbler(proc.getInputStream()).start();
100 res = proc.waitFor();
101 if (res != 0) throw new RuntimeException("nonzero exit code");
103 System.err.println("== (un)programming fpga " + idx);
104 proc = Runtime.getRuntime().exec("ssh "+host+" -- user_unprogram "+idx+"; user_program "+idx+" main.bit");
105 new Gobbler(proc.getInputStream()).start();
106 res = proc.waitFor();
107 if (res != 0) throw new RuntimeException("nonzero exit code");
109 System.err.println("== launching java");
110 proc = Runtime.getRuntime().exec("ssh "+host+" -- gcc -o bicat bicat.c && ./bicat /dev/selectmap"+idx);
111 //return proc.getInputStream();
113 } else if (args[0].equals("-server")) {
115 raf = new RandomAccessFile(new File("/dev/selectmap"+idx), "rw");
116 fos = new FileOutputStream(raf.getFD());
117 fis = new BufferedInputStream(new FileInputStream(raf.getFD()));
119 //socket.setKeepAlive(true);
120 //final InputStream is = new BufferedInputStream(socket.getInputStream());
121 //final InputStream is = socket.getInputStream();
122 //final OutputStream os = socket.getOutputStream(); //new BufferedOutputStream(socket.getOutputStream());
124 final InputStream is = System.in;
125 final OutputStream os = System.out;
126 PrintStream log = new PrintStream(new FileOutputStream("log"));
128 //socket.setSoTimeout(10);
131 while (fis.available() > 0) {
133 int val = fis.read();
135 log.println("fpga->host: 0x"+Integer.toString(val & 0xff, 16));
136 if ((val & (3<<6)) == 0)
137 fos.write( (1<<6) | 1);
141 while(is.available() > 0) {
145 log.println("host->fpga: 0x"+Integer.toString(r & 0xff, 16));
149 log.println("flushing os...");
151 log.println("flushing fos...");
153 log.println("sleeping...");