GET_NET_FROM_PIN
The GET_NET_FROM_PIN function returns a string containing the name of the net that contains a pin.
Syntax
The function can take either the name of a bus and an optional index, or a STRING containing a pin reference.
GET_NET_FROM_PIN( BUS bus )
GET_NET_FROM_PIN( BUS bus [ INT index ] )
GET_NET_FROM_PIN( STRING pinReference )
Parameters
- bus
- The name of a bus defined in the current test device file. If the bus contains more than one pin, then an index needs to be specified to identify which pin in the bus is to be returned.
- pinReference
- A string that identifies a pin in the netlist in the form 'board.component.pin'. This may be a string returned from the GET_PIN function. The board name is optional, but the pin reference must uniquely identify the pin, so if there is any ambiguity with the device reference, then the board name must be supplied.
Return value
A STRING value that contains the name of the net that contains the specified pin. This is guaranteed to work as an argument to PRINT_NET_LINK, PRINT_NETS_LINK and their TEST_DETAILS variations.
Errors
An error can occur in the following circumstances:
- An index is supplied for bus, which is greater than or equal to the number of pins in the bus.
- No index was supplied for bus and the bus contains more than one pin.
- The device referenced by pinReference does not match any device in the project.
- The pin referenced by pinReference does not exist on the device.
- The pinReference supplied does not contain a board name and matches more than one device.
In all these cases, if the expressions are constant, the error will occur at compile-time. Otherwise, the error will occur at run-time, when the function is run.
Example
// Busses defined in this device file: // DATA := 17, 16, 15, 14, 13, 11, 10, 9; // nCE := 18; LOCAL PrintNetNames()() INT i; PRINT("nCE net is ", GET_NET_FROM_PIN(nCE[0]), "\n"); FOR i := 0 FOR WIDTHOF(DATA) PRINT(FORMAT(i, "DATA[%i] is "), GET_NET_FROM_PIN(DATA[i]), "\n"); END; END;
Output
nCE net is XJDemo.NCSR DATA[0] is XJDemo.D0 DATA[1] is D1A-D1 DATA[2] is XJDemo.D2 DATA[3] is XJDemo.D3 DATA[4] is XJDemo.D4 DATA[5] is XJDemo.D5 DATA[6] is XJDemo.D6 DATA[7] is XJDemo.D7
XJTAG v4.1.100