Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/artiq
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: f6bbcb678971
Choose a base ref
...
head repository: m-labs/artiq
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 7a90f4f4eccb
Choose a head ref
  • 3 commits
  • 3 files changed
  • 1 contributor

Commits on Aug 18, 2014

  1. Copy the full SHA
    f8e9f1f View commit details
  2. Copy the full SHA
    7d8dc4e View commit details
  3. Copy the full SHA
    7a90f4f View commit details
Showing with 18 additions and 14 deletions.
  1. +14 −10 artiq/devices/runtime.py
  2. +2 −2 examples/coredev_test.py
  3. +2 −2 soc/runtime/main.c
24 changes: 14 additions & 10 deletions artiq/devices/runtime.py
Original file line number Diff line number Diff line change
@@ -8,16 +8,24 @@
_syscalls = {
"rpc": "i+:i",
"gpio_set": "ii:n",
"rtio_set": "iii:n",
"rtio_set": "Iii:n",
"rtio_sync": "i:n",
"dds_program": "ii:n",
}

_chr_to_type = {
"n": lambda: lc.Type.void(),
"i": lambda: lc.Type.int(32),
"I": lambda: lc.Type.int(64)
}

_chr_to_value = {
"n": lambda: ir_values.VNone(),
"i": lambda: ir_values.VInt(),
"I": lambda: ir_values.VInt(64)
}

def _str_to_functype(s):
_chr_to_type = {
"n": lc.Type.void,
"i": lc.Type.int
}
assert(s[-2] == ":")
type_ret = _chr_to_type[s[-1]]()

@@ -42,10 +50,6 @@ def set_module(self, module):
self.module.add_function(func_type, "__syscall_"+func_name)

def syscall(self, syscall_name, args, builder):
_chr_to_value = {
"n": ir_values.VNone,
"i": ir_values.VInt
}
r = _chr_to_value[_syscalls[syscall_name][-1]]()
if builder is not None:
args = [arg.llvm_value for arg in args]
@@ -61,7 +65,7 @@ def syscall(self, syscall_name, args, builder):
class Environment(LinkInterface):
def __init__(self, ref_period):
self.ref_period = ref_period
self.initial_time = 8000
self.initial_time = 2000

def emit_object(self):
tm = lt.TargetMachine.new(triple="or1k", cpu="generic")
4 changes: 2 additions & 2 deletions examples/coredev_test.py
Original file line number Diff line number Diff line change
@@ -21,10 +21,10 @@ def run(self):
while d*d <= x:
if x % d == 0:
prime = False
d = d + 1
d += 1
if prime:
self.output(x)
x = x + 1
x += 1
self.led.set(0)

if __name__ == "__main__":
4 changes: 2 additions & 2 deletions soc/runtime/main.c
Original file line number Diff line number Diff line change
@@ -140,8 +140,9 @@ static void gpio_set(int channel, int value)
leds_out_write(csr_value);
}

static void rtio_set(int timestamp, int channel, int value)
static void rtio_set(long long int timestamp, int channel, int value)
{
rtio_reset_write(0);
rtio_chan_sel_write(channel);
rtio_o_timestamp_write(timestamp);
rtio_o_value_write(value);
@@ -224,7 +225,6 @@ int main(void)
if(load_elf(syscalls, kbuf, length, kcode, sizeof(kcode))) {
flush_cpu_icache();
dds_init();
rtio_reset_write(0);
k();
rtio_reset_write(1);
send_sync();