.. _register_device:

		Register the WordDevice_ ``word_device`` in the bus
		returns the start address of the device.

		raises: BUSSetupError_, if the device cannot be registered.

def register_device(self, word_device):
		"""
		.. _register_device:

		Register the WordDevice_ ``word_device`` in the bus
		returns the start address of the device.

		raises: BUSSetupError_, if the device cannot be registered.

		"""
		if(self._lock):
			raise BUSSetupError("BUS already locked.")
		size = word_device.size
		if(self.current_max_offset + size >= self.max_addr):
			raise BUSSetupError("Addresspace({}) would exceed width of BUS({})".format(self.current_max_offset+ size,
						self.width))
		self.start_addresses[word_device] = self.current_max_offset
		res = self.current_max_offset
		self.current_max_offset += size
		self.index[range(res, self.current_max_offset)] = word_device
		self.devices.append(word_device)
		return res