Esempio n. 1
0
 def exitStore(self, ctx):
     # type: (QuilParser.StoreContext) -> None
     if ctx.number():
         right = _number(ctx.number())
     else:
         right = _addr(ctx.addr(1))
     self.result.append(ClassicalStore(ctx.IDENTIFIER(), _addr(ctx.addr(0)), right))
Esempio n. 2
0
def STORE(region_name, offset_reg, source):
    """
    Produce a STORE instruction.

    :param region_name: Named region of memory to store to.
    :param offset_reg: Offset into memory region. Must be a MemoryReference.
    :param source: Source data. Can be either a MemoryReference or a constant.
    :return: A ClassicalStore instance.
    """
    return ClassicalStore(region_name, unpack_classical_reg(offset_reg), source)
Esempio n. 3
0
def STORE(region_name: str,
          offset_reg: MemoryReferenceDesignator,
          source: Union[MemoryReferenceDesignator, int, float]) -> ClassicalStore:
    """
    Produce a STORE instruction.

    :param region_name: Named region of memory to store to.
    :param offset_reg: Offset into memory region. Must be a MemoryReference.
    :param source: Source data. Can be either a MemoryReference or a constant.
    :return: A ClassicalStore instance.
    """
    if not isinstance(source, int) and not isinstance(source, float):
        source = unpack_classical_reg(source)
    return ClassicalStore(region_name, unpack_classical_reg(offset_reg), source)
Esempio n. 4
0
 def store(self, left, subscript, right):
     return ClassicalStore(left, subscript, right)