Example #1
0
import os, sys, tempfile, subprocess, io
from artiq.compiler import types
from llvmlite_artiq import ir as ll, binding as llvm

llvm.initialize()
llvm.initialize_all_targets()
llvm.initialize_all_asmprinters()


class RunTool:
    def __init__(self, pattern, **tempdata):
        self._pattern = pattern
        self._tempdata = tempdata
        self._tempnames = {}
        self._tempfiles = {}

    def __enter__(self):
        for key, data in self._tempdata.items():
            if data is None:
                fd, filename = tempfile.mkstemp()
                os.close(fd)
                self._tempnames[key] = filename
            else:
                with tempfile.NamedTemporaryFile(delete=False) as f:
                    f.write(data)
                    self._tempnames[key] = f.name

        cmdline = []
        for argument in self._pattern:
            cmdline.append(argument.format(**self._tempnames))
Example #2
0
import os

import llvmlite_artiq.ir as ll
import llvmlite_artiq.binding as llvm

from artiq.py2llvm import base_types, fractions, lists
from artiq.language import units


llvm.initialize()
llvm.initialize_all_targets()
llvm.initialize_all_asmprinters()

_syscalls = {
    "now_init": "n:I",
    "now_save": "I:n",
    "watchdog_set": "i:i",
    "watchdog_clear": "i:n",
    "rtio_get_counter": "n:I",
    "ttl_set_o": "Iib:n",
    "ttl_set_oe": "Iib:n",
    "ttl_set_sensitivity": "Iii:n",
    "ttl_get": "iI:I",
    "ttl_clock_set": "Iii:n",
    "dds_init": "Ii:n",
    "dds_batch_enter": "I:n",
    "dds_batch_exit": "n:n",
    "dds_set": "Iiiii:n",
}