(self)
return backend.IR(blocks=ir_blocks, inputs=ir_inputs, outputs=ir_outputs)
Transforms the relations between blocks into an intermediate
            representation in O(n), n being the number of pins.
Transforms the relations between blocks into an intermediate
            representation in O(n), n being the number of pins.
Transforms the relations between blocks into an intermediate representation in O ( n ) n being the number of pins .
def to_ir(self) -> IR:
        """ Transforms the relations between blocks into an intermediate
            representation in O(n), n being the number of pins. """
        ir_blocks = {}
        ir_inputs = {}
        ir_outputs = {}
        logger.debug('Transforming to IR')
        for block in self.block_div.children:
            if block.is_orphan():  # Ignore orphaned blocks
                continue
            block_hash = id(block)
            block_inputs, block_outputs = [], []
            avoid = False
            for in_pin in block.input_pins:
                pin_hash = id(in_pin)
                block_inputs.append(pin_hash)
                other = id(in_pin.origin.end)  # Always origin
                ir_inputs[pin_hash] = backend.InputEntry(origin=other,
                                                         pin=in_pin,
                                                         block=block_hash)
            for out_pin in block.output_pins:
                pin_hash = id(out_pin)
                block_outputs.append(pin_hash)
                dest = list(map(id, out_pin.destinations))
                ir_outputs[pin_hash] = backend.OutputEntry(destinations=dest,
                                                           pin=out_pin,
                                                           block=block_hash)
            ir_blocks[block_hash] = backend.BlockEntry(inputs=block_inputs,
                                                       function=block.function,
                                                       outputs=block_outputs)
        self.block_hashes = ir_blocks
        return backend.IR(blocks=ir_blocks, inputs=ir_inputs, outputs=ir_outputs)
def to_ir ( self ) -> IR : ir_blocks = { } ir_inputs = { } ir_outputs = { } logger . debug ( 'Transforming to IR' ) for block in self . block_div . children : if block . is_orphan ( ) : # Ignore orphaned blocks continue block_hash = id ( block ) block_inputs , block_outputs = [ ] , [ ] avoid = False for in_pin in block . input_pins : pin_hash = id ( in_pin ) block_inputs . append ( pin_hash ) other = id ( in_pin . origin . end ) # Always origin ir_inputs [ pin_hash ] = backend . InputEntry ( origin = other , pin = in_pin , block = block_hash ) for out_pin in block . output_pins : pin_hash = id ( out_pin ) block_outputs . append ( pin_hash ) dest = list ( map ( id , out_pin . destinations ) ) ir_outputs [ pin_hash ] = backend . OutputEntry ( destinations = dest , pin = out_pin , block = block_hash ) ir_blocks [ block_hash ] = backend . BlockEntry ( inputs = block_inputs , function = block . function , outputs = block_outputs ) self . block_hashes = ir_blocks return backend . IR ( blocks = ir_blocks , inputs = ir_inputs , outputs = ir_outputs )