READABLE

The READABLE function determines whether a bus or specific pins on a bus are currently readable by XJTAG, either via JTAG pins, on-board logic or other controllable hardware. This allows more generic code to be written that can be re-used across a variety of projects.

If an attempt is made to read an unreadable pin, then a runtime error is generated and XJEase code execution is stopped, and so using READABLE allows the user to avoid such errors.

Syntax

READABLE( BUS bus )

Parameters

bus

The name of a bus defined in the current test device file. Optionally a single bit or range of bits can be specified in square brackets to just test the ability to read one or more of the pins of a bus.

Return value

READABLE returns a boolean value indicating whether XJTAG believes it can currently read the bus specified.

If the net is driven by a buffer pin (i.e. JTAG controls the value but cannot prevent the pin from driving the net) then even if there are input-capable pins on the net, READABLE will return FALSE; a value cannot be read from any test device on this net due to the always-driving buffer pin. (Note that the value driven on such a net could be read using :=* in a SET statement.)

Another reason that READABLE might return FALSE is if the JTAG pin on the net is input-capable but is not in the JTAG chain with the current profile at the time of calling the READABLE function.

If the bus contains more than one pin and no index or range of bits is specified, then all the pins in the bus must be readable for the function to return TRUE.

Errors

If an index or range is applied to the bus and it is beyond the bounds of the bus, a run-time error occurs. Note that the indices are 0 based.

Example

This code will only read the value of each clock pin if there is read access to the pin.

timeout := NOW() + 5000;
DO
  FOR i := 0 TO 5
    IF READABLE(CLOCKS[i]) THEN
      SET temp[i] := CLOCKS[i];
      tests[i] := 1;
    END;
  END;
  ones := ones | ( temp & tests);
  zeros := zeros | (~temp & tests);
WHILE (ones != tests ||? zeros != tests) &&? NOW() <= timeout
END;