added Choice ship
[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
10 == TeX ==============================================================
11 To Do:
12 - deal with sign-extension
13 - rotate (in addition to shift)?
14 - rotate, shift, and sign-extend subfields of a word?
15 - scan for lowest/highest bit which is set/clear?
16 - bitfields crossing two words
17
18 == Fleeterpreter ====================================================
19     public void service() {
20         if (box_in.dataReadyForShip() && box_inShift.dataReadyForShip()) {
21             int val = box_in.removeDataForShip();
22             int inShift = box_inShift.removeDataForShip();
23             if (inShift < 0) val = val >> (-1 * inShift);
24             else           val = val << inShift;
25             box_out.addDataFromShip(val);
26         }
27     }
28
29 == FleetSim ==============================================================
30 == FPGA ==============================================================
31 // not implemented FIXME!
32
33 == Contributors =========================================================
34 Adam Megacz <megacz@cs.berkeley.edu>