bitfifo notes
[fleet.git] / ships / Shift.ship
index dfba5e1..18ef138 100644 (file)
@@ -1,24 +1,32 @@
 ship: Shift
 
 == Ports ===========================================================
-data in:  val
-data in:  shamt
+data in:  in
+data in:  inShift
 data out: out
 
 == Constants ========================================================
+
 == TeX ==============================================================
+To Do:
+- deal with sign-extension
+- rotate (in addition to shift)?
+- rotate, shift, and sign-extend subfields of a word?
+- scan for lowest/highest bit which is set/clear?
+- bitfields crossing two words
+
 == Fleeterpreter ====================================================
     public void service() {
-        if (box_val.dataReadyForShip() && box_shamt.dataReadyForShip()) {
-            int val = box_val.removeDataForShip();
-            int shamt = box_shamt.removeDataForShip();
-            if (shamt < 0) val = val >> (-1 * shamt);
-            else           val = val << shamt;
+        if (box_in.dataReadyForShip() && box_inShift.dataReadyForShip()) {
+            long val = box_in.removeDataForShip();
+            long inShift = box_inShift.removeDataForShip();
+            if (inShift < 0) val = val >> (-1 * inShift);
+            else           val = val << inShift;
             box_out.addDataFromShip(val);
         }
     }
 
-== ArchSim ==============================================================
+== FleetSim ==============================================================
 == FPGA ==============================================================
 // not implemented FIXME!