6476ab17aa2a819b2dc41d8c36e06bc18fc10af3
[fleet.git] / ships / Shift.ship
1 ship: Shift
2
3 == Ports ===========================================================
4 data in:  in
5 data in:  inShift
6 data out: out
7
8 == Constants ========================================================
9 == TeX ==============================================================
10 == Fleeterpreter ====================================================
11     public void service() {
12         if (box_in.dataReadyForShip() && box_inShift.dataReadyForShip()) {
13             int val = box_in.removeDataForShip();
14             int inShift = box_inShift.removeDataForShip();
15             if (inShift < 0) val = val >> (-1 * inShift);
16             else           val = val << inShift;
17             box_out.addDataFromShip(val);
18         }
19     }
20
21 == ArchSim ==============================================================
22 == FPGA ==============================================================
23 // not implemented FIXME!
24
25 == Contributors =========================================================
26 Adam Megacz <megacz@cs.berkeley.edu>