3 == Ports ===========================================================
9 == Constants ========================================================
15 == TeX ==============================================================
16 == Fleeterpreter ====================================================
17 public void service() {
18 if (box_in.dataReadyForShip() && box_inOp.dataReadyForShip()) {
19 long data = box_in.removeDataForShip();
20 long opcode = box_inOp.removeDataForShip();
22 case 0: box_out.addDataFromShip(-1 * data); // NEG
24 case 1: box_out.addDataFromShip(data+1); // INC
26 case 2: box_out.addDataFromShip(data-1); // DEC
28 case 3: box_out.addDataFromShip(Math.abs(data)); // ABS
30 default: box_out.addDataFromShip(0);
36 == FleetSim ==============================================================
37 == FPGA ==============================================================
39 reg [(`DATAWIDTH-1):0] reg_a;
41 reg [(`DATAWIDTH-1):0] reg_op;
43 always @(posedge clk) begin
45 `onread(in_r, in_a) have_a = 1; reg_a = in_d; end
48 `onread(inOp_r, inOp_a) have_op = 1; reg_op = inOp_d; end
51 if (have_a && have_op) begin
56 3: out_d = (reg_a<0) ? (-reg_a) : reg_a;
57 4: out_d = 37'b1111111111111111111111111111111111111;
60 `onwrite(out_r, out_a)
68 == Contributors =========================================================
69 Adam Megacz <megacz@cs.berkeley.edu>