test_program_rpc.py 728 Bytes
Newer Older
1
import os
2
import tvm
3
from tvm import rpc
4
from vta import get_bitstream_path, download_bitstream, program_fpga, reconfig_runtime
5

6 7 8
host = os.environ.get("VTA_PYNQ_RPC_HOST", "pynq")
port = int(os.environ.get("VTA_PYNQ_RPC_PORT", "9091"))

9 10
def program_rpc_bitstream(path=None):
    """Program the FPGA on the RPC server
11

12 13 14 15
    Parameters
    ----------
    path : path to bitstream (optional)
    """
16 17
    assert tvm.module.enabled("rpc")
    remote = rpc.connect(host, port)
18
    program_fpga(remote, path)
19

20 21 22
def reconfig_rpc_runtime():
    """Reconfig the RPC server runtime
    """
23
    assert tvm.module.enabled("rpc")
24 25
    remote = rpc.connect(host, port)
    reconfig_runtime(remote)
26

27 28
program_rpc_bitstream()
reconfig_rpc_runtime()