This maps basic Python types (float, str, bool, np.int32, np.int64) as well as
some generics (list, tuple) to ARTIQ's own type instances.
Signed-off-by: Jonathan Coates <jonathan.coates@oxionics.com>
The type checker/inferer visits every node in an AST tree, including
function return annotations. This means for a function definition like
def f() -> TTuple([TInt32, TBool]):
...
We attempt to type check the list [TInt32, TBool], which generates the
unification constraint builtins.TBool ~ builtins.TInt. This causes an
internal error due to compiler weirdness.
We can avoid this by just nulling-out the return annotation in the
embedding stage. The return type isn't actually used anywhere (it's
extracted via the inspect module instead), so this is entirely safe.
Arguments aren't affected by this, as we already nulled out the
annotation (see visit_arg in embedding.py).
Signed-off-by: Jonathan Coates <jonathan.coates@oxionics.com>
The original fix in 21574bdfa9
was incomplete, as it only addressed the TInstance types, but
not their linked (typ.constructor) TConstructor instances.
This would (potentially among other issues) cause assertion
errors in llvm_ir_generator due to the wrong associated globals
being referenced; see added test case for an example that
previously caused such a crash.
Also modified the name collision detection from O(len(type_map))
(so quadratic overall in the number of custom types) to cache
names in sets for O(1) lookup.
* ddb: generate shuttler coredevice entries
* ddb: split-off all DRTIO-over-EEM peripherals
Only EFC uses DRTIO-over-EEM at this moment. It will be relevant to phaser-DRTIO in the future.
* ddb: generalize efc processing into drtio-over-eem peripherals
* ddb: check DRTIO role validity before processing
This example code:
- Demonstrates the init flow for Shuttler
- Blinks LED L0, L1
- Demonstrates the real-time control of relay
- Includes example fns for configuring the PDQ Output Channel in mu
- Intend to maintain the same pipeline latency across all DACs on Shuttler
- Force the RETIMER-CLK to be PHASE 1 on all DACs
- See Issue #2200 for details
These were introduced in 82bd913f63, and for Kasli only set from
the JSON description in the *Generic subclasses. Not all firmware
is built through that API, however, e.g. the CI system at the
University of Oxford. The missing attribute breaks artiq.build_soc.
I had introduced this in f11aef74b as a means of quickly cleaning up
after e.g. an exploratory session where a lot of transient applets were
opened from ndscan, or for a dashboard that has been running for a while
with CCBs enabled but without anybody actually working there.
It turns out that one usually wants the few docked applets to stay open,
as they were necessarily arranged manually at some prior point. And as a
corollary to the latter, if one did want to close them as well, doing so
manually would not be too onerous either.
This only allows for indexing with a constant value (e.g. x[0]).
While slices would be possible to implement, it's not clear how to
preserve type inference here. The current typing rule is:
Γ ⊢ x : τ Γ ⊢ a : Int Γ ⊢ b : Int
------------------------------------
Γ ⊢ x[a:b] : τ
However, tuples would require a different typing rule, and so we'd need
to defer type inference if τ is a tyvar. I'm not confident that this
won't change behaviour, so we leave as-is for now.
Signed-off-by: Jonathan Coates <jonathan.coates@oxionics.com>