polybori.blocks
index
polybori/blocks.py

 
Modules
       
sys

 
Classes
       
__builtin__.object
AlternatingBlock
AdderBlock
Block
HigherOrderBlock
IfThen
InOutBlock
MacroBlock
MultiBlock
PrefixedDictProxy

 
class AdderBlock(AlternatingBlock)
    
Method resolution order:
AdderBlock
AlternatingBlock
__builtin__.object

Methods defined here:
__init__(self, adder_bits, sums='s', carries='c', input1='a', input2='b', start_index=0)
implement(self, equations)
#def s(i):
#  return self.add_results[i-self.start_index]
#def c(i):
#  return self.carries_polys[i-self.start_index]
#context[self.sums]=s
#context[self.carries]=c
register(self, start, context)

Methods inherited from AlternatingBlock:
__getitem__(self, i)
__iter__(self)
__len__(self)

Data descriptors inherited from AlternatingBlock:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class AlternatingBlock(__builtin__.object)
    The Alternating Block class is used for doing tricky variable
schemes,where base names vary, e.g.
a(0),b(0),a(1),b(1),a(2),b(2)
 
  Methods defined here:
__getitem__(self, i)
__init__(self, var_names, size_per_variable, start_index=0, reverse=False)
__iter__(self)
__len__(self)
register(self, start, context)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class Block(__builtin__.object)
    The block class represents a block of variables
<var_name>(start_index,...,start_index+size-1), it is the preferred
block type for simple one-dimensional variable sets
 
  Methods defined here:
__getitem__(self, i)
__init__(self, var_name, size, start_index=0, reverse=False)
__iter__(self)
__len__(self)
register(self, start, context)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class HigherOrderBlock(__builtin__.object)
    HigherOrderBlocks are multidimensional blocks of variables, for each dimension a seperate start_index and size can be specified
 
var_name : variables will be called <var_name>(multiindex), where multiindex is a tuple of the size <size_tuple>
size_tuple : specifies the sizes of the ranges of each component of the multi-indices
start_index_tuple : the multi-indices will be of the form start_index_tuple + a, where a is a multi-index with non-negative components
 
  Methods defined here:
__getitem__(self, i)
__init__(self, var_name, size_tuple, start_index_tuple=None, reverse=False)
__iter__(self)
__len__(self)
register(self, start, context)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class IfThen(__builtin__.object)
     Methods defined here:
__init__(self, ifpart, thenpart, supposed_to_be_valid=True)
__str__(self)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class InOutBlock(__builtin__.object)
     Methods defined here:
__getitem__(self, i)
__init__(self, out_size, in_size, output='out', input='in', in_start_index=0, out_start_index=0, out_reverse=False, in_reverse=False)
__iter__(self)
__len__(self)
register(self, start, context)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class MacroBlock(__builtin__.object)
     Methods defined here:
__getitem__(self, i)
__init__(self, prefix)
__iter__(self)
__len__(self)
connect(self, combinations)
declare(self, blocks)
implement(self, equations)
register(self, start, context)
resolve(self, localname)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class MultiBlock(__builtin__.object)
     Methods defined here:
__getitem__(self, i)
__init__(self, sizes=[], var_names=['v'], start_indices=[], reverses=[])
__iter__(self)
__len__(self)
register(self, start, context)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class PrefixedDictProxy(__builtin__.object)
    docstring for PrefixedDictProxy
 
  Methods defined here:
__getitem__(self, k)
__init__(self, wrapped, prefix)
__setitem__(self, k, v)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Functions
       
declare_block_scheme(blocks, context)
declare_ring(blocks, context=None)
Declare Ring is the preferred function to create a ring and declare a variable scheme,
the number of variables is automatically determined,
usually you pass globals() as context argument to store the ring and the variable mapping.
Example
declare_ring([Block("x",10),Block("y",5)],globals())
gives  a ring with x(0..9),y(0..4) and registers the ring as r,
and the variable blocks x and y in the context dictionary globals(), which consists of the global variables of the python module
if_then(i, t, supposed_to_be_valid=True)
main()
shift(f, i)