update everything to naming conventions agreed upon in class last week
[fleet.git] / ships / Lut.ship
1 ship: Lut
2
3 == Ports ===========================================================
4 data  in:   in1
5 data  in:   in2
6 data  in:   inLut
7
8 data  out:  out
9
10 == Constants ========================================================
11 == TeX ==============================================================
12 == Fleeterpreter ====================================================
13     public void service() {
14         if (box_in1.dataReadyForShip() && box_in2.dataReadyForShip() && box_inLut.dataReadyForShip()) {
15             int a      = box_in1.removeDataForShip();
16             int b      = box_in2.removeDataForShip();
17             int lut    = box_inLut.removeDataForShip();
18             int ret = 0;
19             if ((lut & 1) != 0) ret |= (~a) & (~b);
20             if ((lut & 2) != 0) ret |= (a)  & (~b);
21             if ((lut & 4) != 0) ret |= (~a) &  (b);
22             if ((lut & 8) != 0) ret |=   a  &    b;
23             box_out.addDataFromShip(ret);
24         }
25     }
26
27 == ArchSim ==============================================================
28 == FPGA ==============================================================
29 // not implemented FIXME
30
31 == Contributors =========================================================
32 Adam Megacz <megacz@cs.berkeley.edu>