ship: Lut
== Ports ===========================================================
-data in: a
-data in: b
-data in: lut
+data in: in1
+data in: in2
+data in: in3
+data in: inLut
data out: out
== Constants ========================================================
+
== TeX ==============================================================
+
+This ship implements a {\bf L}ook {\bf U}p {\bf T}able. The least
+significant eight bits of the {\tt inLut} value form a truth table
+with two inputs and one output (FIXME: specify the layout).
+
+When values are available at all three inputs they are consumed and a
+value is produced at {\tt out}. Each bit of {\tt out} is produced by
+looking up the corresponding bits of {\tt in1} and {\tt in2} in the
+{\tt inLut} truth table.
+
== Fleeterpreter ====================================================
public void service() {
- if (box_a.dataReadyForShip() && box_b.dataReadyForShip() && box_lut.dataReadyForShip()) {
- int a = box_a.removeDataForShip();
- int b = box_b.removeDataForShip();
- int lut = box_lut.removeDataForShip();
+ if (box_in1.dataReadyForShip() &&
+ box_in2.dataReadyForShip() &&
+ box_inLut.dataReadyForShip()) {
+ int a = box_in1.removeDataForShip();
+ int b = box_in2.removeDataForShip();
+ int lut = box_inLut.removeDataForShip();
int ret = 0;
if ((lut & 1) != 0) ret |= (~a) & (~b);
if ((lut & 2) != 0) ret |= (a) & (~b);
}
}
-== ArchSim ==============================================================
+== FleetSim ==============================================================
== FPGA ==============================================================
// not implemented FIXME