forked from M-Labs/artiq
1
0
Fork 0
Commit Graph

7365 Commits

Author SHA1 Message Date
David Nadlinger d37503f21d compiler: T{C -> External}Function, clarify docs [nfc] 2020-08-09 03:54:41 +01:00
David Nadlinger da255bee1b compiler: Implement element type coercion for arrays
So far, this is not exposed to the user beyond implicit conversions.

Note that all the implicit conversions, such as triggered by adding
arrays of mismatching types, or dividing integer arrays, are currently
emitted in a maximally inefficient way, where a temporary copy is first
made for the type conversion. The conversions would more sensibly be
implemented during the per-element operations to save on the extra
copies, but the current behaviour fell out of the rest of the IR
generator structure without extra changes.
2020-08-09 03:54:41 +01:00
David Nadlinger 4426e4144f compiler: Implement unary plus/minus for arrays
Implementation is needlessly generic to anticipate
coercion/transcendental functions.
2020-08-09 03:54:41 +01:00
David Nadlinger 0d8fbd4f19 test/lit: Add a test for matrix binary operations
No reason to believe other operations won't work the same.
(More exhaustive tests to follow using embedding for comparison
against NumPy.)
2020-08-09 03:54:41 +01:00
David Nadlinger 7bdd6785b7 test/lit: Basic ndarray smoke tests for all binops 2020-08-09 03:54:41 +01:00
David Nadlinger 4d002c7934 compiler: Explain use of rpc_tag() in array ops, formatting [nfc] 2020-08-09 03:54:41 +01:00
David Nadlinger a7e855b319 compiler.types: Change invalid default value [nfc]
This wasn't actually ever used, but was a dict instead of a set.
2020-08-09 03:54:41 +01:00
David Nadlinger 48fb80017f compiler: Implement basic element-wise array operations 2020-08-09 03:54:41 +01:00
David Nadlinger 9af6e5747d compiler: Factor rpc_tag() out of llvm_ir_generator 2020-08-09 03:54:41 +01:00
David Nadlinger e77c7d1c39 compiler: Add inferencer support for array operations 2020-08-09 03:54:41 +01:00
David Nadlinger ef57cad1a3 compiler: Test ndarray element assignment 2020-08-09 03:54:41 +01:00
David Nadlinger a9a975e5d4 language: Allow instantating TArray using bare ints 2020-08-09 03:54:41 +01:00
David Nadlinger 504b8f0148 language: Export TArray 2020-08-09 03:54:41 +01:00
David Nadlinger dea3c0c572 compiler: Don't store redundant ndarray buffer length, match list layout
This adds `elt` to _TPointer and the ir.Offset IR instruction,
which is like GetElem but without the final load.
2020-08-09 03:54:41 +01:00
David Nadlinger e82357d180 compiler: Fix inferencer tests after adding TArray.num_dims 2020-08-09 03:54:41 +01:00
David Nadlinger cb1cadb46a compiler: Fix/test 1D array construction from generic iterables 2020-08-09 03:54:41 +01:00
David Nadlinger 38c17622cc compiler: Axis-wise iteration of ndarrays
Matches NumPy. Slicing a TList reallocates, this doesn't; offsetting
couldn't be handled in the IR without introducing new semantics
(the Alloc kludge; could/should be made its own IR type).
2020-08-09 03:54:41 +01:00
David Nadlinger c95a978ab6 compiler: Iteration for 1D ndarrays 2020-08-09 03:54:41 +01:00
David Nadlinger bc17bb4d1a compiler: Parametrize TArray in number of dimensions 2020-08-09 03:54:41 +01:00
David Nadlinger 632c5bc937 compiler: Add ndarray .shape access 2020-08-09 03:54:41 +01:00
David Nadlinger 40f59561f2 compiler: Add test for length of empty arrays [nfc]
This makes sure we are actually emitting this as an 1D array
(like NumPy does).
2020-08-09 03:54:41 +01:00
David Nadlinger d882f8a3f0 compiler: Implement len() for ndarrays 2020-08-09 03:54:41 +01:00
David Nadlinger 575be2aeca compiler: Basic support for creation of multidimensional arrays
Breaks all uses of array(), as indexing is not yet implemented.
2020-08-09 03:54:41 +01:00
David Nadlinger 56010c49fb compiler/inferencer: Detect rectangular array()s
Still needs support through all the rest of the compiler, and
support for higher-dimensional arrays.

Alternatively, we could always assume ndarrays of ndarrays
are rectangular (i.e. ban array/list element types), and
detect mismatch at runtime. This might turn out to be
preferrable to be able to construct matrices from rows/columns.

`array()` is disallowed for no particularly good reason but
numpy API compatibility.
2020-08-09 03:54:41 +01:00
David Nadlinger 6ea836183d test/lit: Move some list tests to appropriate module [nfc] 2020-08-09 03:54:41 +01:00
pmldrmota 1df62862cd
AD9910: Write correct number of bits to POW register (#1498)
* coredevice.ad9910: Add return type hints to conversion functions

* coredevice.ad9910: Make set_pow write correct number of bits
The AD9910 expects 16 bits. Thus, if writing 32 bits to the POW register, the chip would likely enter a locked-up state.

* coredevice.ad9910: Correct data alignment in write_16

Co-authored-by: Robert Jördens <rj@quartiq.de>

* coredevice.ad9910: Add function to read from 16 bit registers

Co-authored-by: drmota <peter.drmota@physics.ox.ac.uk>
Co-authored-by: Robert Jördens <rj@quartiq.de>
2020-08-07 10:10:44 +02:00
Sebastien Bourdeauducq 504f72a02c rtio: remove legacy i_overflow_reset CSR 2020-08-06 17:52:32 +08:00
Sebastien Bourdeauducq 5f36e49f91 test_rtio: make DMA test generic wrt TTL channel 2020-08-06 16:36:14 +08:00
pca006132 3bfd372c20 compiler: linker discard local symbols.
Fixes exception backtrace problem for ARM.
2020-08-06 16:07:28 +08:00
Sebastien Bourdeauducq e3c5775584 test: skip CacheTest.test_borrow on Zynq 2020-08-06 10:54:30 +08:00
Sebastien Bourdeauducq 9c9dc3d0ef manual: Kasli now supports 10/100 Ethernet 2020-08-01 10:35:37 +08:00
David Nadlinger ae999db8f6 compiler: Revert function call lifetime tracking fix
This reverts commits f8d1506922
and cf19c9512d.

While the commit just fixes a clear typo in the implementation,
it turns out the original algorithm isn't flexible enough to
capture functions that transitively return references to
long-lived data. For instance, while cache_get() is special-cased
in the compiler to be recognised as returning a value of Global()
lifetime, a function just forwarding to it (as seen in the
embedding tests) isn't anymore.

A separate issue is also that this makes implementing functions
that take lists and return references to global data in user code
impossible, which central parts of the Oxford codebase rely on.

Just reverting for now to unblock master; a fix is easily designed,
but needs testing.
2020-07-30 16:40:39 +01:00
Sebastien Bourdeauducq 709026d945 test: relax device_to_host_rate 2020-07-30 17:46:22 +08:00
Sebastien Bourdeauducq 455e4859b7 simplify versioneer
Original version is very complex and still has a number of problems.
2020-07-30 00:54:07 +08:00
Sebastien Bourdeauducq 5fd0d0bbb6 gui: work around quamash bug with python 3.8 2020-07-28 12:08:47 +08:00
David Nadlinger cf19c9512d RELEASE_NOTES: Add entry for compiler lifetime tracking fix
I contemplated putting this in the "Breaking changes" section,
as it might break user code that has avoided being hit by
memory corruption from the use-after free by chance (even
though it was always an accepts-illegal bug).
2020-07-28 00:54:20 +01:00
David Nadlinger f8d1506922 compiler: Fix lifetime tracking for function call return values
GitHub: Fixes #1497.
2020-07-28 00:33:28 +01:00
cw-mlabs e4b16428f5 wrpll: fix run signal 2020-07-27 13:02:02 +08:00
cw-mlabs 8dd9a6d024 wrpll: fix scl signal 2020-07-27 12:59:32 +08:00
Charles Baynham 9b44ec7bc6 parameters: Allow forcing a NumberValue to return a float
Signed-off-by: Charles Baynham <charles.baynham@npl.co.uk>
2020-07-27 12:25:51 +08:00
David Nadlinger 1c72585c1b compiler: Handle None-returning function calls used as values
GitHub: Fixes #1493.
2020-07-25 02:20:53 +01:00
David Nadlinger 57e759a1ed compiler: Consistently use llunit through llvm_ir_generator [nfc] 2020-07-25 02:20:52 +01:00
Sebastien Bourdeauducq 2a2f5c4d58 comm_analyzer: make header error flag more general 2020-07-20 19:39:19 +08:00
Sebastien Bourdeauducq 553a49e194 test_moninj: set loop_out as output 2020-07-19 17:59:43 +08:00
Sebastien Bourdeauducq 8510bf4e55 test_analyzer: configure loop_out as output 2020-07-16 19:28:58 +08:00
pca006132 eb28d7be3a firmware/rpc: fixed typo 2020-07-16 15:15:47 +08:00
pca006132 f78d673079 firmware/rpc: added `#[repr(C)]` for structs.
Previously the structs are in repr(Rust) which has no layout guarantee.
2020-07-16 15:11:17 +08:00
Robert Jördens e31ee1f0b3 firmware/i2c: rewrite I2C implementation
* Never drive SDL or SDA high. They are specified to be open
  collector/drain and pulled up by resistive pullups. Driving
  high fails miserably in a multi-master topology (e.g. with
  a USB I2C interface). It would only ever be implemented to
  speed up the bus actively but that's tricky and completely
  unnecessary here.
* Make the handover states between the I2C protocol phases (start, stop,
  restart, write, read) well defined. Add comments stressing those
  pre/postconditions.
* Add checks for SDA arbitration failures and stuck SCL.
* Remove wrong, misleading or redundant comments.
2020-07-15 16:43:07 +08:00
Sebastien Bourdeauducq 4340a5cfc1 rtio/dma: fix previous commit 2020-07-12 10:14:22 +08:00
Sebastien Bourdeauducq f2e0d27334 rtio/dma: remove dead/broken code 2020-07-12 10:13:18 +08:00