mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-14 23:36:27 -04:00
bus splitter is able to transfer high-z states
This commit is contained in:
parent
4e8fc4d72e
commit
6acf49138d
@ -37,6 +37,7 @@ public class BusSplitter extends Node implements Element {
|
|||||||
private ObservableValue commonIn;
|
private ObservableValue commonIn;
|
||||||
private boolean oe;
|
private boolean oe;
|
||||||
private long commonD;
|
private long commonD;
|
||||||
|
private long commonZ;
|
||||||
private ObservableValues outputValues;
|
private ObservableValues outputValues;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -77,12 +78,16 @@ public class BusSplitter extends Node implements Element {
|
|||||||
oe = oeValue.getBool();
|
oe = oeValue.getBool();
|
||||||
if (oe) {
|
if (oe) {
|
||||||
commonD = commonIn.getValue();
|
commonD = commonIn.getValue();
|
||||||
|
commonZ = commonIn.getHighZ();
|
||||||
} else {
|
} else {
|
||||||
commonD = 0;
|
commonD = 0;
|
||||||
|
commonZ = 0;
|
||||||
long mask = 1;
|
long mask = 1;
|
||||||
for (int i = 0; i < bits; i++) {
|
for (int i = 0; i < bits; i++) {
|
||||||
if (in[i].getBool())
|
if (in[i].getBool())
|
||||||
commonD |= mask;
|
commonD |= mask;
|
||||||
|
if (in[i].isHighZ())
|
||||||
|
commonZ |= mask;
|
||||||
mask <<= 1;
|
mask <<= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -94,13 +99,16 @@ public class BusSplitter extends Node implements Element {
|
|||||||
commonOut.setToHighZ();
|
commonOut.setToHighZ();
|
||||||
long mask = 1;
|
long mask = 1;
|
||||||
for (int i = 0; i < bits; i++) {
|
for (int i = 0; i < bits; i++) {
|
||||||
|
if ((commonZ & mask) != 0)
|
||||||
|
out[i].setToHighZ();
|
||||||
|
else
|
||||||
out[i].setBool((commonD & mask) != 0);
|
out[i].setBool((commonD & mask) != 0);
|
||||||
mask <<= 1;
|
mask <<= 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < bits; i++)
|
for (int i = 0; i < bits; i++)
|
||||||
out[i].setToHighZ();
|
out[i].setToHighZ();
|
||||||
commonOut.setValue(commonD);
|
commonOut.set(commonD, commonZ);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user