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: 11d88402776d
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: 140b4eb594dd
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Sep 15, 2014

  1. Copy the full SHA
    8bf7b27 View commit details
  2. Copy the full SHA
    140b4eb View commit details
Showing with 35 additions and 6 deletions.
  1. +34 −5 artiq/devices/rtio_core.py
  2. +1 −1 artiq/devices/runtime.py
39 changes: 34 additions & 5 deletions artiq/devices/rtio_core.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from artiq.language.core import *


class RTIOOut(AutoContext):
class _RTIOBase(AutoContext):
parameters = "channel"

def build(self):
@@ -10,6 +10,10 @@ def build(self):

kernel_attr = "previous_timestamp previous_value"

@kernel
def _set_oe(self, oe):
syscall("rtio_oe", self.channel, oe)

@kernel
def _set_value(self, value):
if self.previous_value != value:
@@ -20,6 +24,12 @@ def _set_value(self, value):
self.previous_timestamp = now()
self.previous_value = value


class RTIOOut(_RTIOBase):
def build(self):
_RTIOBase.build(self)
self._set_oe(1)

@kernel
def sync(self):
syscall("rtio_sync", self.channel)
@@ -39,13 +49,32 @@ def pulse(self, duration):
self.off()


class RTIOCounter(AutoContext):
parameters = "channel"
class RTIOCounter(_RTIOBase):
def build(self):
_RTIOBase.build(self)
self._set_oe(0)

@kernel
def count_rising(self, duration):
pass
self._set_value(1)
delay(duration)
self._set_value(0)

@kernel
def count_falling(self, duration):
self._set_value(2)
delay(duration)
self._set_value(0)

@kernel
def count_both_edges(self, duration):
self._set_value(3)
delay(duration)
self._set_value(0)

@kernel
def sync(self):
return 42
count = 0
while syscall("rtio_get", self.channel) >= 0:
count += 1
return count
2 changes: 1 addition & 1 deletion artiq/devices/runtime.py
Original file line number Diff line number Diff line change
@@ -75,7 +75,7 @@ def syscall(self, syscall_name, args, builder):
class Environment(LinkInterface):
def __init__(self, ref_period):
self.ref_period = ref_period
self.initial_time = 2000
self.initial_time = 4000

def emit_object(self):
tm = lt.TargetMachine.new(triple="or1k", cpu="generic")