Exemplo n.º 1
0
def _create_npu_dma_op(serial_copy):
    """This is a helper function to capture the list of arguments
    to create a NpuDmaOperation object"""
    src = vapi.NpuAddressRange(
        # region will be updated later
        region=0,
        address=serial_copy.read_address,
        length=int(serial_copy.length.value),
    )
    dest = vapi.NpuAddressRange(
        # region will be updated later
        region=0,
        address=serial_copy.write_address,
        length=int(serial_copy.length.value),
    )
    return vapi.NpuDmaOperation(src, dest)
Exemplo n.º 2
0
def _create_npu_dma_op(serial_copy):
    """This is a helper function to capture the list of arguments
    to create a NpuDmaOperation object"""
    data_type_bytes = np.iinfo(np.dtype(serial_copy.read_address.dtype)).bits // 8
    src = vapi.NpuAddressRange(
        # region will be updated later
        region=0,
        address=serial_copy.read_address,
        length=int(serial_copy.length.value) * data_type_bytes,
    )
    dest = vapi.NpuAddressRange(
        # region will be updated later
        region=0,
        address=serial_copy.write_address,
        length=int(serial_copy.length.value) * data_type_bytes,
    )
    return vapi.NpuDmaOperation(src, dest)