36 lines
745 B
Python
36 lines
745 B
Python
|
from artiq.experiment import *
|
||
|
|
||
|
|
||
|
class CachePut(EnvExperiment):
|
||
|
def build(self):
|
||
|
self.setattr_device("core")
|
||
|
self.setattr_device("core_cache")
|
||
|
|
||
|
@kernel
|
||
|
def put(self, key, value):
|
||
|
self.core_cache.put(key, value)
|
||
|
|
||
|
# First experiment
|
||
|
@kernel
|
||
|
def run(self):
|
||
|
self.put("data", [0xCAFE, 0xDEAD, 0xBEEF])
|
||
|
|
||
|
|
||
|
class CacheGet(EnvExperiment):
|
||
|
def build(self):
|
||
|
self.setattr_device("core")
|
||
|
self.setattr_device("core_cache")
|
||
|
|
||
|
@kernel
|
||
|
def get(self, key):
|
||
|
return self.core_cache.get(key)
|
||
|
|
||
|
@rpc(flags={"async"})
|
||
|
def p(self, p):
|
||
|
print([hex(_) for _ in p])
|
||
|
|
||
|
# Second experiment
|
||
|
@kernel
|
||
|
def run(self):
|
||
|
self.p(self.get("data"))
|