X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.core%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fcore%2Ftypes%2FBit.java;h=119ee53ae308d6faafb035d9175ff0f450ac30b0;hb=0ab3dafe756a69ff8b1e0137058caf2f5ac564aa;hp=e6278104bffa03b4b6ab42804aa53eeb0e4585d5;hpb=153f81323a215691a0477af3fd1dd4a9d5b02958;p=Mograsim.git diff --git a/net.mograsim.logic.core/src/net/mograsim/logic/core/types/Bit.java b/net.mograsim.logic.core/src/net/mograsim/logic/core/types/Bit.java index e6278104..119ee53a 100644 --- a/net.mograsim.logic.core/src/net/mograsim/logic/core/types/Bit.java +++ b/net.mograsim.logic.core/src/net/mograsim/logic/core/types/Bit.java @@ -34,18 +34,36 @@ public enum Bit implements StrictLogicType return fromTable(AND_TABLE, this, other); } + public static void and(Bit[] dst, Bit[] src) + { + for (int i = 0; i < dst.length; i++) + dst[i] = dst[i].and(src[i]); + } + @Override public Bit or(Bit other) { return fromTable(OR_TABLE, this, other); } + public static void or(Bit[] dst, Bit[] src) + { + for (int i = 0; i < dst.length; i++) + dst[i] = dst[i].or(src[i]); + } + @Override public Bit xor(Bit other) { return fromTable(XOR_TABLE, this, other); } + public static void xor(Bit[] dst, Bit[] src) + { + for (int i = 0; i < dst.length; i++) + dst[i] = dst[i].xor(src[i]); + } + @Override public Bit not() { @@ -69,9 +87,9 @@ public enum Bit implements StrictLogicType return bits; } - public BitVector toVector(int width) + public BitVector toVector(int length) { - return BitVector.of(this, width); + return BitVector.of(this, length); } @Override @@ -80,6 +98,12 @@ public enum Bit implements StrictLogicType return fromTable(JOIN_TABLE, this, other); } + public static void join(Bit[] dst, Bit[] src) + { + for (int i = 0; i < dst.length; i++) + dst[i] = dst[i].join(src[i]); + } + @Override public String toString() {