|
@@ -457,22 +457,24 @@ public class DuPALAnalyzer {
|
|
|
ArrayList<Byte> pinstate = new ArrayList<>();
|
|
|
boolean[] instate = null;
|
|
|
|
|
|
- writePINs(idx);
|
|
|
- pins_1 = readPINs();
|
|
|
+ writePINs(idx); // Write the address to the inputs, attempt to force the current outputs to 0
|
|
|
+ pins_1 = readPINs(); // And read back
|
|
|
|
|
|
- // Check that inputs really are inputs
|
|
|
+ // Check that inputs really are inputs,
|
|
|
+ // We'd expect that what we wrote to the IO pins that we consider inputs is not forced to a different level,
|
|
|
+ // E.g. if we write an address that contains a high level into an input and we detect a low level, it means that what
|
|
|
+ // we considered as an input, is actually behaving as an output. We probably did not detect them correctly.
|
|
|
if((pins_1 & (pspecs.getIO_READMask() & ~IOasOUT_Mask)) != ((idx >> PALSpecs.READ_WRITE_SHIFT) & (pspecs.getIO_READMask() & ~IOasOUT_Mask))) {
|
|
|
- logger.warn("Detected an input that is acting as output when in MS ["+ms+"] -> " + String.format("%02X", pins_1) + " expected outs: " + String.format("%02X", IOasOUT_Mask));
|
|
|
+ int extraOut = (pins_1 & (pspecs.getIO_READMask() & ~IOasOUT_Mask)) ^ ((idx >> PALSpecs.READ_WRITE_SHIFT) & (pspecs.getIO_READMask() & ~IOasOUT_Mask));
|
|
|
+ logger.error("Detected an input that is acting as output when in MS ["+ms+"] -> expected outs: " + String.format("%02X", IOasOUT_Mask) + " actual outs: " + String.format("%02X", IOasOUT_Mask | extraOut));
|
|
|
}
|
|
|
|
|
|
+ // Write the address to the inputs, this time try to force the outputs to 1
|
|
|
writePINs(idx | (IOasOUT_Mask << PALSpecs.READ_WRITE_SHIFT));
|
|
|
pins_2 = readPINs();
|
|
|
|
|
|
- // Check that inputs really are inputs
|
|
|
- if((pins_2 & (pspecs.getIO_READMask() & ~IOasOUT_Mask)) != ((idx >> PALSpecs.READ_WRITE_SHIFT) & (pspecs.getIO_READMask() & ~IOasOUT_Mask))) {
|
|
|
- logger.warn("Detected an input that is acting as output when in MS ["+ms+"] -> " + String.format("%02X", pins_2) + " expected outs: " + String.format("%02X", IOasOUT_Mask));
|
|
|
- }
|
|
|
-
|
|
|
+ // Check if forcing the outputs has create a difference in the result:
|
|
|
+ // If a difference is detected, it means the pin is in high impedence state.
|
|
|
hiz_pins = (pins_1 ^ pins_2) & IOasOUT_Mask;
|
|
|
|
|
|
for(int pin_idx = 0; pin_idx < 8; pin_idx++) {
|