WRITEABLE
The
If an attempt is made to write to an inaccessible pin, then a runtime warning is generated, but XJEase code execution continues.
Syntax
The WRITEABLE function has a number of variations: the supplied bus can optionally have a single bit or a range of bits selected and a second optional parameter can be supplied to indicate a specific value that is to be written.
WRITEABLE( BUS bus )
WRITEABLE( BUS bus, I )
WRITEABLE( BUS bus, INT value )
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.
- value
-
An optional value indicating the proposed value to be written so a more precise check can be made. Valid values are 0 to query whether the pins can be written low, 1 to query whether it can be driven high and I to query whether the pins' drivers can be disabled.
Return value
WRITEABLE returns a boolean value indicating whether XJTAG believes it can write to the bus specified.
If no value is supplied then the return value indicates if there is any possible scenario where the bus can be driven. It does not imply that the bus can be driven to a particular value or that it can be driven at the current time. However it will return FALSE if the net is driven by a JTAG pin on a device which is not in the JTAG chain with the current profile at the time of calling the WRITEABLE function.
If the second value parameter is supplied, then the check is more precise and WRITEABLE will return TRUE if XJEase believes the bus can currently be driven to the requested value.
A typical reason that a bus might not currently be writeable to a particular value is if this would cause conflicts with SET statements previously applied to logic blocks, and therefore the value of WRITEABLE(bus, value) may change during testing as the state of the circuit changes.
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 writeable 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.
Examples
INT val = 0xAA; // Is ADDR generally writeable (may not actually be writeable to all values) IF WRITEABLE(ADDR) THEN SET ADDR := 0xFF; END; // Is ADDR writeable to 0xAA? IF WRITEABLE(ADDR, val) THEN SET ADDR := val; END; // Can ADDR[0] be disabled? IF WRITEABLE(ADDR[0], I) THEN SET ADDR[0] := I; END;
See Also
XJTAG v4.1.100