Class Chip
- All Implemented Interfaces:
HasChipLocation
- Author:
- Christian-B
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal InetAddressThe IP address of the chip ornullif no Ethernet attached.final @Valid ChipLocationThe nearest Ethernet-enabled chip coordinates, ornullif none known.final RouterA router for the chip.final intThe size of the SDRAM. -
Constructor Summary
ConstructorsConstructorDescriptionChip(ChipLocation location, Iterable<Processor> processors, Router router, int sdram, InetAddress ipAddress, List<Integer> tagIds, ChipLocation nearestEthernet) Main constructor which sets all parameters.Chip(ChipLocation location, Iterable<Processor> processors, Router router, int sdram, InetAddress ipAddress, ChipLocation nearestEthernet) Constructor which fills in some default values.Chip(ChipLocation location, Iterable<Processor> processors, Router router, InetAddress ipAddress, ChipLocation nearestEthernet) Constructor for a chip with non-default processors.Chip(ChipLocation location, Router router, InetAddress ipAddress, ChipLocation nearestEthernet) Constructor for a chip with the default processors. -
Method Summary
Modifier and TypeMethodDescriptionReturn a list off all the processors on this chip.Converts (if required) this to a simple X, Y tuple.difference(Chip other) Describes one difference found between this chip and another chip.booleanGet the first processor in the list which is not a monitor core.Get the IDs of the tags of the chip.getUserProcessor(int processorId) Obtains the user processor with this ID, or returnsnull.intgetX()intgetY()inthashCode()booleanhasUserProcessor(int processorId) Determines if a user processor with the given ID exists in the chip.intThe total number of processors.intThe total number of user processors.toString()Return a view over the user processors on this chip.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface uk.ac.manchester.spinnaker.machine.HasChipLocation
getScampCore, onSameChipAs
-
Field Details
-
router
A router for the chip. -
sdram
public final int sdramThe size of the SDRAM. -
ipAddress
The IP address of the chip ornullif no Ethernet attached. -
nearestEthernet
The nearest Ethernet-enabled chip coordinates, ornullif none known. ("Nearest" here means "on the same board".)
-
-
Constructor Details
-
Chip
public Chip(ChipLocation location, Iterable<Processor> processors, Router router, int sdram, InetAddress ipAddress, List<Integer> tagIds, ChipLocation nearestEthernet) Main constructor which sets all parameters.- Parameters:
location- The coordinates of the chip's position in the two-dimensional grid of chips.processors- An iterable of processor objects.router- A router for the chip.sdram- The size of the SDRAM.ipAddress- The IP address of the chip's Ethernet connection, ornullif no Ethernet attached.tagIds- List of SDP identifiers available. Can be empty to force empty. Ifnull, will use the default list for Ethernet-enabled chips and empty for non-Ethernet-enabled chipsnearestEthernet- The nearest Ethernet-enabled chip coordinates ornullif none known.- Throws:
IllegalArgumentException- Thrown if multiple chips share the same ID.
-
Chip
public Chip(ChipLocation location, Iterable<Processor> processors, Router router, int sdram, InetAddress ipAddress, ChipLocation nearestEthernet) Constructor which fills in some default values.- Parameters:
location- The coordinates of the chip's position in the two-dimensional grid of chips.processors- An iterable of processor objects.router- A router for the chip.sdram- The size of the SDRAM.ipAddress- The IP address of the chip's attached Ethernet connection, ornullif no Ethernet attached.nearestEthernet- The nearest Ethernet-enabled chip coordinates, ornullif none known.- Throws:
IllegalArgumentException- Thrown if multiple links share the samesourceLinkDirection, or if multiple chips share the same ID.
-
Chip
public Chip(ChipLocation location, Iterable<Processor> processors, Router router, InetAddress ipAddress, ChipLocation nearestEthernet) Constructor for a chip with non-default processors.- Parameters:
location- The coordinates of the chip's position in the two-dimensional grid of chips.processors- An iterable of processor objects.router- A router for the chip.ipAddress- The IP address of the chip ornullif no Ethernet attached.nearestEthernet- The nearest Ethernet coordinates ornullif none known.- Throws:
IllegalArgumentException- Indicates another Link with thissourceLinkDirectionhas already been added.
-
Chip
public Chip(ChipLocation location, Router router, InetAddress ipAddress, ChipLocation nearestEthernet) Constructor for a chip with the default processors.- Parameters:
location- The coordinates of the chip's position in the two-dimensional grid of chips.router- A router for the chip.ipAddress- The IP address of the chip ornullif no Ethernet attached.nearestEthernet- The nearest Ethernet-connected chip's coordinates ornullif none known.- Throws:
IllegalArgumentException- Indicates another link with thissourceLinkDirectionhas already been added.
-
-
Method Details
-
getX
public int getX()- Specified by:
getXin interfaceHasChipLocation- Returns:
- The X coordinate of the chip.
-
getY
public int getY()- Specified by:
getYin interfaceHasChipLocation- Returns:
- The Y coordinate of the chip.
-
asChipLocation
Description copied from interface:HasChipLocationConverts (if required) this to a simple X, Y tuple.- Specified by:
asChipLocationin interfaceHasChipLocation- Returns:
- A ChipLocation representation of the X and Y tuple
-
hasUserProcessor
public boolean hasUserProcessor(int processorId) Determines if a user processor with the given ID exists in the chip.Warning: If a monitor processor exists with this ID, this method will return
false.- Parameters:
processorId- ID of the potential processor.- Returns:
- True if and only if there is a user processor for this ID.
-
getUserProcessor
Obtains the user processor with this ID, or returnsnull.This method will only check user processors so will return
nulleven if a monitor processor exists with this ID.- Parameters:
processorId- ID of the potential processor.- Returns:
- The processor, or
nullif not is found.
-
allProcessors
Return a list off all the processors on this chip. This method will check both the user and monitor processors.The processors will be ordered by their ID, which are guaranteed to all be different.
The current implementation builds a new list on the fly so this list is mutable without affecting the chip. Future implementations could return an unmodifiable list.
- Returns:
- A list of all the processors including both monitor and user.
-
userProcessors
Return a view over the user processors on this chip. Monitor processors are not included so every processor in the list is guaranteed to have the propertyisMonitor == false!The processors will be ordered by their ID, which are guaranteed to all be different.
- Returns:
- A unmodifiable view over the processors.
-
nProcessors
public int nProcessors()The total number of processors.- Returns:
- The size of the processor collection.
-
nUserProcessors
public int nUserProcessors()The total number of user processors.For just the user processors so ignores monitor processors.
- Returns:
- The size of the Processor Collection
-
getFirstUserProcessor
Get the first processor in the list which is not a monitor core.- Returns:
- A processor
- Throws:
NoSuchElementException- If all the Processor(s) are monitors.
-
getTagIds
Get the IDs of the tags of the chip.- Returns:
- the tag IDs
-
toString
-
hashCode
public int hashCode() -
equals
-
difference
Describes one difference found between this chip and another chip. This method will always returnnullif no difference is found between the two machines.This method returns as soon as it has found a difference; there may be other unspecified differences.
Warning: This method could change over time, so there is no implied guarantee to the order that variables are checked or to the message that is returned.
The only guarantee is that
nullis returned if no difference is detected.- Parameters:
other- Another chip to check if it has the same variables.- Returns:
nullif no difference is detected, otherwise a string describing the difference.
-