Esempio n. 1
0
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,
    })
Esempio n. 2
0
 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)
Esempio n. 3
0
 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({})
Esempio n. 4
0
 def memory_entries(self):
     """:obj:`Mapping` [:obj:`str`, `YosysMemoryTemplateEntry` ]: A mapping from module names to template
     entries."""
     return ReadonlyMappingProxy(self._memory_entries)
Esempio n. 5
0
 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)
Esempio n. 6
0
 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)
Esempio n. 7
0
 def _ports(self):
     """:obj:`Mapping` [:obj:`Hashable`, `AbstractPort` ]: Internal variable holding the ports."""
     return ReadonlyMappingProxy({})
Esempio n. 8
0
 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)
Esempio n. 9
0
 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)
Esempio n. 10
0
 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)
Esempio n. 11
0
 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)
Esempio n. 12
0
 def segments(self):
     """:obj:`Mapping` [:obj:`str`, `Segment` ]: A mapping from names to wire segment prototypes."""
     return ReadonlyMappingProxy(self._segments)
Esempio n. 13
0
 def direct_tunnels(self):
     """:obj:`Mapping` [:obj:`str`, `DirectTunnel` ]: A mapping from names to direct inter-block tunnels."""
     return ReadonlyMappingProxy(self._directs)
Esempio n. 14
0
 def globals_(self):
     """:obj:`Mapping` [:obj:`str`, `Global` ]: A mapping from names to global wire prototypes."""
     return ReadonlyMappingProxy(self._globals)
Esempio n. 15
0
 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)
Esempio n. 16
0
 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)
Esempio n. 17
0
 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)
Esempio n. 18
0
 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)
Esempio n. 19
0
 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)
Esempio n. 20
0
 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)
Esempio n. 21
0
 def _instances(self):
     """:obj:`Mapping` [:obj:`Hashable`, `AbstractInstance` ]: Internal variable holding the instances."""
     return ReadonlyMappingProxy({})
Esempio n. 22
0
 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)
Esempio n. 23
0
 def blackbox_entries(self):
     """:obj:`Mapping` [:obj:`str`, `YosysTemplateEntry` ]: A mapping from module names to template entries."""
     return ReadonlyMappingProxy(self._blackbox_entries)
Esempio n. 24
0
 def modules(self):
     """:obj:`Mapping` [:obj:`str`, `AbstractModule` ]: A mapping from names to modules."""
     return ReadonlyMappingProxy(self._modules)