class WiltonSwitchBoxPattern(Object): """Host of two prebuilt wilton switch box patterns.""" _clockwise = ( (Orientation.east, Orientation.south), (Orientation.south, Orientation.west), (Orientation.west, Orientation.north), (Orientation.north, Orientation.east), ) _counterclockwise = ( (Orientation.south, Orientation.east), (Orientation.east, Orientation.north), (Orientation.north, Orientation.west), (Orientation.west, Orientation.south), ) classic = ReadonlyMappingProxy({ # clockwise (Orientation.east, Orientation.south): 1, (Orientation.south, Orientation.west): 1, (Orientation.west, Orientation.north): -1, (Orientation.north, Orientation.east): 1, # counter-clockwise (Orientation.south, Orientation.east): -1, (Orientation.east, Orientation.north): 1, (Orientation.north, Orientation.west): 1, (Orientation.west, Orientation.south): 1, }) cfoptimal = ReadonlyMappingProxy({ # clockwise (Orientation.east, Orientation.south): 1, (Orientation.south, Orientation.west): 1, (Orientation.west, Orientation.north): 1, (Orientation.north, Orientation.east): -2, # counter-clockwise (Orientation.south, Orientation.east): 1, (Orientation.east, Orientation.north): 1, (Orientation.north, Orientation.west): 1, (Orientation.west, Orientation.south): -2, })
def physical_ports(self): """:obj:`Mapping` [:obj:`Hashable`, `AbstractPort` ]: A mapping from some hashable indices to physical ports in this module.""" return ReadonlyMappingProxy(self.all_ports, lambda kv: kv[1].in_physical_domain)
def parameters(self): """:obj:`Mapping` [:obj:`Mapping` [:obj:`str`, Any ]]: A mapping from parameter names to a dict of related info, e.g. "default" for the default value of the parameter.""" return ReadonlyMappingProxy({})
def memory_entries(self): """:obj:`Mapping` [:obj:`str`, `YosysMemoryTemplateEntry` ]: A mapping from module names to template entries.""" return ReadonlyMappingProxy(self._memory_entries)
def logical_modules(self): """:obj:`Mapping` [:obj:`str`, `AbstractModule` ]: A mapping from names to logical modules.""" return ReadonlyMappingProxy(self._modules, lambda kv: kv[1].in_logical_domain)
def ports(self): """:obj:`Mapping` [:obj:`Hashable`, `AbstractPort` ]: A mapping from some hashable indices to user-accessible ports.""" return ReadonlyMappingProxy(self._ports, lambda kv: kv[1].in_user_domain)
def _ports(self): """:obj:`Mapping` [:obj:`Hashable`, `AbstractPort` ]: Internal variable holding the ports.""" return ReadonlyMappingProxy({})
def logic_blocks(self): """:obj:`Mapping` [:obj:`str`, `LogicBlock` ]: A mapping from names to CLBs.""" return ReadonlyMappingProxy( self._modules, lambda kv: kv[1].module_class.is_logic_block)
def connection_boxes(self): """:obj:`Mapping` [:obj:`str`, `ConnectionBox` ]: A mapping from names to connection boxes.""" return ReadonlyMappingProxy( self._modules, lambda kv: kv[1].module_class.is_connection_box)
def clusters(self): """:obj:`Mapping` [:obj:`str`, `Cluster` ]: A mapping from names to clusters.""" return ReadonlyMappingProxy(self._modules, lambda kv: kv[1].module_class.is_cluster)
def io_blocks(self): """:obj:`Mapping` [:obj:`str`, `IOBlock` ]: A mapping from names to IOBs.""" return ReadonlyMappingProxy(self._modules, lambda kv: kv[1].module_class.is_io_block)
def segments(self): """:obj:`Mapping` [:obj:`str`, `Segment` ]: A mapping from names to wire segment prototypes.""" return ReadonlyMappingProxy(self._segments)
def direct_tunnels(self): """:obj:`Mapping` [:obj:`str`, `DirectTunnel` ]: A mapping from names to direct inter-block tunnels.""" return ReadonlyMappingProxy(self._directs)
def globals_(self): """:obj:`Mapping` [:obj:`str`, `Global` ]: A mapping from names to global wire prototypes.""" return ReadonlyMappingProxy(self._globals)
def logical_instances(self): """:obj:`Mapping` [:obj:`Hashable`, `AbstractPort` ]: A mapping from some hashable indices to logical instances in this module.""" return ReadonlyMappingProxy(self.all_instances, lambda kv: kv[1].in_logical_domain)
def switch_boxes(self): """:obj:`Mapping` [:obj:`str`, `SwitchBox` ]: A mapping from names to switch boxes.""" return ReadonlyMappingProxy( self._modules, lambda kv: kv[1].module_class.is_switch_box)
def all_instances(self): """:obj:`Mapping` [:obj:`Hashable`, `AbstractInstance` ]: A mapping from some hashable indices to instances in this module. Note that physical/logical/user instances are mixed together in this mapping.""" return ReadonlyMappingProxy(self._instances)
def tiles(self): """:obj:`Mapping` [:obj:`str`, `Tile` ]: A mapping from names to tiles.""" return ReadonlyMappingProxy(self._modules, lambda kv: kv[1].module_class.is_tile)
def instances(self): """:obj:`Mapping` [:obj:`Hashable`, `AbstractInstance` ]: A mapping from some hashable indices to user-accessible instances.""" return ReadonlyMappingProxy(self._instances, lambda kv: kv[1].in_user_domain)
def arrays(self): """:obj:`Mapping` [:obj:`str`, `Array` ]: A mapping from names to arrays.""" return ReadonlyMappingProxy(self._modules, lambda kv: kv[1].module_class.is_array)
def _instances(self): """:obj:`Mapping` [:obj:`Hashable`, `AbstractInstance` ]: Internal variable holding the instances.""" return ReadonlyMappingProxy({})
def nongrid_instances(self): """:obj:`Mapping` [:obj:`Hashable`, `AbstractInstance` ]: A mapping from some hashable key to instances not part of the grid.""" return ReadonlyMappingProxy(self._nongrid_instances)
def blackbox_entries(self): """:obj:`Mapping` [:obj:`str`, `YosysTemplateEntry` ]: A mapping from module names to template entries.""" return ReadonlyMappingProxy(self._blackbox_entries)
def modules(self): """:obj:`Mapping` [:obj:`str`, `AbstractModule` ]: A mapping from names to modules.""" return ReadonlyMappingProxy(self._modules)