forked from M-Labs/artiq
1
0
Fork 0

Compare commits

...

152 Commits

Author SHA1 Message Date
Robert Jördens 3aafcc621a conda: pin openocd (artiq, artiq-dev) #932 2018-02-24 18:05:50 +01:00
Robert Jördens 44c78a5e79 manual: deprecate old release
closes #863
2017-12-06 12:52:35 +01:00
Sebastien Bourdeauducq b84699873a RELEASE_NOTES: 2.5 2017-10-02 12:08:23 +08:00
Sebastien Bourdeauducq 09822457a3 runtime: link libm in ksupport 2017-10-02 11:23:03 +08:00
whitequark 8e3959d7ce compiler: disallow op= on mutable values (fix #835).
In general, we can't reallocate a value in earlier stack frames,
or fixup references to it. This mainly impacts lists.
2017-10-02 11:03:30 +08:00
whitequark 1001993e3f compiler: implement ~ operator (fix #836). 2017-10-02 11:03:30 +08:00
whitequark d0276abb5c compiler: minor intrinsic refactoring. 2017-10-02 11:03:30 +08:00
whitequark 05096a98a8 compiler: correct semantics of floating point % operator (fix #830). 2017-10-02 11:03:30 +08:00
whitequark 8fd9ba934b compiler: correct semantics of integer % operator (#830). 2017-10-02 11:03:30 +08:00
Sebastien Bourdeauducq 5c5f86cdea runtime: export floor() in ksupport. Closes #828 2017-09-10 12:09:25 +08:00
Robert Jördens 34bc8e3c03 doc: update proxy bitstream url 2017-08-15 14:34:13 -06:00
Robert Jördens d322a922f3 conda: use single-tap proxy bitstreams 2017-08-15 14:33:19 -06:00
Sebastien Bourdeauducq ef9bbcaa69 browser,dashboard: delete MDI subwindows when they are closed 2017-07-29 20:36:53 +08:00
Sebastien Bourdeauducq 6fa2dca402 synchronize introduction.rst with README 2017-07-22 00:41:42 +08:00
dhslichter 7faa727847 Update README links 2017-07-22 00:14:50 +08:00
Robert Jördens 0fbacb0002 setup.py etc: update license 2017-07-20 17:02:45 +02:00
Sebastien Bourdeauducq 0ffc752310 spi: fix typo in doc 2017-07-20 22:18:37 +08:00
whitequark 4e9165fd1d compiler: coerce `while` condition to bool.
Fixes #768.
2017-07-02 10:29:17 +08:00
Chris Ballance 4c552a481e protocols: increase another asyncio line limit (#671) 2017-06-22 09:44:44 +08:00
Sebastien Bourdeauducq e06b906369 RELEASE_NOTES: 2.4 2017-06-21 23:49:35 +08:00
Sebastien Bourdeauducq 2383ea748f versioneer: cut git hashes consistently (#753) 2017-06-19 23:46:14 +08:00
Sebastien Bourdeauducq 232f7a9512 conda: set ignore_prefix_files on all board packages 2017-06-15 16:10:07 +08:00
Sebastien Bourdeauducq e04014c761 coredevice: compare software and gateware versions strictly 2017-06-07 02:14:00 +08:00
Sebastien Bourdeauducq 72c94fc8af versioneer: always use 8 characters to abbreviate git commit hashes 2017-06-07 02:13:18 +08:00
Sebastien Bourdeauducq 596800e391 conda: use new noarch system for board packages as well 2017-06-06 16:01:31 +08:00
Sebastien Bourdeauducq b740023598 conda: remove environment descriptions
3.0 only.
2017-06-06 15:58:55 +08:00
Sebastien Bourdeauducq 2b18943947 conda: use new noarch system 2017-06-06 13:34:39 +08:00
Sebastien Bourdeauducq 50413980d2 manual: fix table formatting 2017-06-05 17:40:19 +08:00
Sebastien Bourdeauducq 478972a001 coredevice: compare gateware and software versions on release numbers only. Closes #738 2017-06-05 13:54:41 +08:00
Sebastien Bourdeauducq 45f62d4e2d update versioneer 2017-06-05 13:18:12 +08:00
Sebastien Bourdeauducq bbbeb90e64 conda: shorten git hash in strings to 8 characters instead of 12 2017-06-05 12:11:59 +08:00
Sebastien Bourdeauducq 85235bd3c1 bump setuptools (#705) 2017-06-05 12:06:35 +08:00
Sebastien Bourdeauducq dff446dba4 require Python 3.5.3+ (#737) 2017-06-05 00:53:10 +08:00
Sebastien Bourdeauducq a1cf632d14 remove pdq2_client 2017-05-22 19:19:21 +08:00
Robert Jördens 29809a5942 depend on python >=3.5.2 <3.6 2017-05-12 09:18:10 +02:00
Robert Jördens fbbfdb0729 setup.py: remove doc and test dependencies 2017-05-11 15:07:37 +02:00
whitequark c78aa86e72 compiler: remove dead code. 2017-04-22 15:31:32 +08:00
whitequark 032f28863f compiler: reject reachable implicit return if not returning TNone.
Fixes #718.
2017-04-22 15:31:22 +08:00
whitequark c33f9637c1 compiler: in codegen for delay(), round fp instead of truncating.
Consider delay(8*us). It results in the following computation...
  >>> 8*1e-06/1e-09
  7999.999999999999
with the result promptly getting truncated to 7999.

Fixes #706.
2017-04-22 15:31:13 +08:00
whitequark 6342829e68 conda: use GIT_FULL_HASH rather than GIT_DESCRIBE_HASH. 2017-04-22 15:30:29 +08:00
whitequark 5f53a13fec Commit missing parts of 0d0ddf2e. 2017-04-22 15:30:04 +08:00
whitequark 419042b5d3 conda: limit git hashes in build numbers to 8 chars exactly.
Before this commit, a nasty edge case was possible where repositories
on different builders have had different sets of objects fetched
into them, and so git-describe selected different lengths for
abbreviating hashes.

See also https://github.com/conda/conda-build/issues/1940.
2017-04-22 15:29:41 +08:00
Sebastien Bourdeauducq 1572d852aa conda: use conda-forge and depend on pyqtgraph 0.10.0 (#704) 2017-04-13 00:58:04 +08:00
whitequark be2683e097 compiler: fix monomorphization of coerced integer literals.
Fixes #703.
2017-04-12 13:18:24 +08:00
whitequark 90e2e22765 artiq_compile: make print() write to core log, not an invalid op.
Fixes #710.
2017-04-12 00:35:01 +08:00
Sebastien Bourdeauducq 49baba26e3 rtio: fix indentation 2017-04-06 12:41:08 +08:00
Sebastien Bourdeauducq 0a6dd963cb rtio: add a missing case for collision reporting 2017-04-06 12:41:02 +08:00
Sébastien Bourdeauducq 62068da232 scan: fix RandomScan seeding 2017-03-31 17:29:37 +08:00
Chris Ballance e8c5cb55cb language: fix PYONValue list defaults (fixes #682) 2017-03-29 21:59:48 +08:00
Chris Ballance 483a897db4 monkey_patches: fix 3af29f7 2017-03-29 09:24:41 +08:00
Sebastien Bourdeauducq bf86828445 add missing artiq-dev.yaml 2017-03-03 18:07:03 +08:00
Sebastien Bourdeauducq 55f217ceef conda: use artiq-dev system 2017-03-03 18:02:46 +08:00
whitequark 37c9b97bc4 compiler.types: add missing TTuple.__hash__ implementation. 2017-03-03 17:40:15 +08:00
whitequark 90aeb76a2c transforms.inferencer: do not unnecessarily mutate typedtree.
This caused the hash to change after every iteration of inference,
if the result of any coercion was an integer of indefinite width.
2017-03-03 11:02:16 +08:00
whitequark 007ae00459 compiler.embedding: fix an overly lax hasher. 2017-03-03 11:02:16 +08:00
whitequark fd5cdb7d1e compiler.transforms: implement a typedtree printer. 2017-03-03 11:02:16 +08:00
Robert Jördens 791976e6d0 conda: pyqt >= 5.5 2017-03-02 23:14:58 +01:00
Chris Ballance 3ae7fde21f conda: use anaconda default pyqt (fixes #670) 2017-03-02 23:14:58 +01:00
whitequark d4673d5b17 compiler.embedding: use attribute count in fixpoint condition.
Before this commit, we had a hack where inferencing would run
one more time, in case we can still infer more attributes even
after all the type information is there. This doesn't work
if *that* round of inferencing brings even more code, e.g.
this is easy to trigger with context managers.
2017-03-01 11:51:25 +08:00
Robert Jördens 72bf39f593 monkey_patches: cleanup 2017-02-28 21:42:25 +08:00
Chris Ballance 349774e65e monkey-patch Python 3.5.3 asyncio.base_events._ipaddr_info
this fixes #506 for py3.5.3
2017-02-28 21:42:21 +08:00
Sebastien Bourdeauducq c777ae8ae9 protocols: increase asyncio line limit. Closes #671 2017-02-17 20:46:38 +08:00
Sebastien Bourdeauducq f5cd0928c3 RELEASE_NOTES: 2.2 2017-02-01 09:38:26 +08:00
Robert Jördens abb5b8aba5 artiq_flash: fix scripts_path 2017-02-01 09:04:57 +08:00
Robert Jördens e3260beb0c RELEASING: use signed annotated tags 2017-02-01 08:28:19 +08:00
Sebastien Bourdeauducq 6e641427f0 RELEASING: mention GitHub releases 2017-02-01 08:28:09 +08:00
Sebastien Bourdeauducq e6a8d96b7c RELEASING: mention doc redirect 2017-02-01 08:28:09 +08:00
whitequark 31dd99e8bd compiler: the len builtin is not polymorphic, coerce the result.
Fixes #659.
2017-02-01 08:23:30 +08:00
whitequark 7516e6d800 Fix 2f37b1d. 2017-02-01 08:23:24 +08:00
whitequark 2dc8d417ca compiler: support methods defined on singleton instances.
Fixes #638.
2017-02-01 08:23:16 +08:00
Robert Jördens 1845a134e5 Relicense ARTIQ as LGPLv3+ (closes #570)
Kelly Stevens: 1481043941095.63542@gtri.gatech.edu
David Nadlinger: E7C03799-5D45-4C03-9DF9-029FE2B4F12B@klickverbot.at
whitequark: 69d1ca29d5ab03fbcfb446d65cbe1150@mail.whitequark.org
Felix Held: 9145cc19-2319-3516-b2a9-dde60aef11f7@felixheld.de
Robert Jordens: CANb+zoFgXVYgCji_vXPauK-fnnYKpm_QioMnvmh=hvLFWQONWA@mail.gmail.com
Daniel Slichter: BL2PR09MB1010FE3D3A325E889AD70A2591820@BL2PR09MB1010.namprd09.prod.outlook.com
Joe Britton: CAE2_b1V60_6PJ3VYx_s-p5XVfKJUx8kbQA7VwD3MdcmHdzROGw@mail.gmail.com
Florent Kermarrec: CA+96J6JHM8yZM=RYaporU36NdyOTL3BeSuO9oM8TTtdnXiJ5jw@mail.gmail.com
Zach Smith: CAAJ=EH+OzDs_rBJ_zTjbOZmumEZWONX2MSFUasJwf8josJGdkw@mail.gmail.com
David Leibrandt: CY1PR09MB0921C628EC76CDFC4CC7F64F95820@CY1PR09MB0921.namprd09.prod.outlook.com
Raghavendra Srinivas: DM5PR09MB1531C49EEE1774DF2BA80616F8850@DM5PR09MB1531.namprd09.prod.outlook.com
Yann Sionneau: CACi+aWbdY48D9CgKtXdtVsdX4NS1JwVN4v-PCC17F_rPKSt4XQ@mail.gmail.com
Sébastien Bourdeauducq: c3f235dc-e9c5-7f7a-10f2-bb4e4f85e7f5@m-labs.hk
2017-01-27 11:20:57 +01:00
Robert Jördens a69f45f7c8 doc: use napoleon (for pdq2) 2017-01-26 18:21:47 +01:00
Robert Jördens d16f5ce540 artiq_flash: make scripts_path a function (for doc generating) 2017-01-26 18:21:43 +01:00
Robert Jördens b4df00009b doc/conda: fix conda env description syntax 2017-01-26 18:20:30 +01:00
Robert Jördens 25ff94dbfa doc: use minimal conda environment to build 2017-01-26 18:20:30 +01:00
Robert Jördens 4a35428518 doc: fix autodoc search path 2017-01-26 18:20:30 +01:00
Robert Jördens 13912b66f3 doc: minimize dependencies for manual 2017-01-26 18:20:30 +01:00
Robert Jördens 6c995e1f07 conda: fix sphinx pin 2017-01-26 00:54:00 +01:00
Robert Jördens 364bd726bb conda: pin sphinx to 1.4.8 (closes #645)
can be reverted when https://github.com/snide/sphinx_rtd_theme/pull/346 is
released
2017-01-26 00:51:50 +01:00
Sebastien Bourdeauducq 4d5ba3fb03 doc: fix table formatting problem, add 'string constant' as supported compiler type 2017-01-16 13:58:27 -06:00
Sebastien Bourdeauducq ec130f967d update copyright year 2017-01-04 11:35:37 +01:00
Robert Jördens 660b067708 spi: fix xfers with full data_width (closes #615)
misoc 15000af43611bbe8be13cb2b016e408f043202cd
2017-01-03 19:50:15 +01:00
Sebastien Bourdeauducq 453b29ad78 RELEASE_NOTES: 2.1 2016-12-12 13:00:07 +08:00
Sebastien Bourdeauducq 2962c95148 set asyncio loop earlier in controllers (#627) 2016-12-12 11:38:52 +08:00
Sebastien Bourdeauducq b823e916f0 Revert "pc_rpc: use ProactorEventLoop on Windows (#627)"
This reverts commit 7d4297b9bb.
2016-12-12 11:38:52 +08:00
Sebastien Bourdeauducq 072e7f6628 pc_rpc: use ProactorEventLoop on Windows (#627) 2016-11-24 10:18:27 +08:00
whitequark ebae6d248f compiler: unbreak casts to int32/int64. 2016-11-21 14:22:35 +00:00
whitequark ebb3205dff analyses.constness: fix false positive on x[...]. 2016-11-21 14:22:34 +00:00
whitequark fd1d77767e inferencer: significantly improve the op-assignment diagnostic.
Before this commit, it displayed incorrect output if an error
appeared on 2nd run and beyond, and displayed messages for trying
to do "num32 -= num64" that made very little sense.
2016-11-21 14:22:32 +00:00
whitequark 372e8f9b2b llvm_ir_generator: handle no-op coercions. 2016-11-21 10:58:42 +08:00
Sebastien Bourdeauducq 0da2202179 moninj: add min declaration 2016-11-21 00:06:35 +08:00
whitequark ec645d3589 coredevice.dds: work around the round(numpy.float64()) snafu. 2016-11-20 21:54:21 +08:00
whitequark 5119fa394d coredevice.dds: update from obsolete int(width=) syntax (fixes #621). 2016-11-20 21:54:20 +08:00
David Leibrandt 99104499f9 gateware: increase RTIO FIFO sizes for NIST_CLOCK. Closes #623 2016-11-20 15:22:08 +08:00
Sebastien Bourdeauducq 2513511775 gui: 2.0 -> 2 in logo 2016-11-20 15:14:43 +08:00
whitequark b85ab712a9 artiq_compile: actually disable attribute writeback.
I wrote both halves of this condition but forgot to hook
them together.

Fixes #586.
2016-11-10 01:04:48 +00:00
David Nadlinger f368e1b228 compiler: Clarify recv_rpc value names and documentation [nfc]
Previously, the phi emitted for the pointer parameter to recv_rpc was –
rather confusingly – called "size", and the pseudo-code in the comment
had bit-rotted.

Signed-off-by: David Nadlinger <code@klickverbot.at>
2016-11-07 22:47:18 +08:00
David Nadlinger 4c2e921270 compiler: Fix break/continue targets in loop else blocks
Previously, they would still target the respective labels in the
just-exited loop.

Signed-off-by: David Nadlinger <code@klickverbot.at>
2016-11-05 17:27:36 +08:00
David Nadlinger d5974b3af5 runtime/moninj: Don't try to pack more than 64 channels
Since the status words are only 8 bytes wide, left-shifting
by more than that is undefined behaviour (although it seems like
we got lucky and Clang dind't decide to optimise the whole
implementation away).

See GitHub #601.

Signed-off-by: David Nadlinger <code@klickverbot.at>
2016-11-05 00:29:11 +08:00
David Nadlinger 4e03f7ab0a gui: Don't show more than the 64 working channels in moninj
Previously, you could irreversibly set the override since
the gateware part would accept commands for the higher channels,
but of coure not report back the results.

See GitHub #601.

Signed-off-by: David Nadlinger <code@klickverbot.at>
2016-11-05 00:29:11 +08:00
Sebastien Bourdeauducq 29e3333467 manual: Vivado is now default 2016-11-04 11:54:56 +08:00
Sebastien Bourdeauducq 67ce341adf master: keep dataset manager consistent when set_dataset is called with contradictory attributes 2016-10-18 17:11:29 +08:00
Sebastien Bourdeauducq 363a7ebe3a master: ensure same dataset is in broadcast and local when mutating 2016-10-18 17:11:29 +08:00
Sebastien Bourdeauducq 5ecfa8197f doc: clarify usage of pause/check_pause, closes #571 2016-10-17 20:08:43 +08:00
Sebastien Bourdeauducq 115204f2f4 dashboard/datasets: use scientific spinbox and increase number of decimals, closes #572 2016-10-17 20:08:39 +08:00
Sebastien Bourdeauducq 00402c9af9 conda: update migen version requirements 2016-09-24 21:02:32 +08:00
Robert Jördens a9bef3c7d0 RELEASE_NOTES: 2.0 2016-09-24 00:41:39 +02:00
Sebastien Bourdeauducq 03c26f9c96 novatech409b: fix get_status 2016-09-23 11:03:37 +08:00
Sebastien Bourdeauducq 638bbeca48 dashboard: make state restore failure on experiment opening non-fatal 2016-09-21 19:23:31 +08:00
Robert Jördens 122d48d2d5 pipistrello: shrink a few more fifos 2016-09-21 02:45:52 +02:00
Robert Jördens 6d715d0d4d README: GPLv3+ 2016-09-15 09:51:47 -04:00
Robert Jördens 6073aa7590 RELEASE_NOTES: 2.0rc2 2016-09-14 21:53:36 -04:00
whitequark 6f2125258c compiler: skip kernel_invariant linting for exception types. 2016-09-14 21:49:43 -04:00
whitequark ecb01d055f compiler: warn about unused kernel_invariant entries.
Fixes #543.
2016-09-14 21:49:43 -04:00
whitequark fb3585f5b0 coreanalyzer: fix rtio_log message extraction.
Fixes #550.
2016-09-14 18:36:55 +08:00
Sebastien Bourdeauducq 898fa43ecc dashboard: remember experiment editor scroll positions 2016-09-14 10:52:49 +08:00
Sebastien Bourdeauducq 9de0dacb94 dashboard: save/restore MDI window states when they are closed. Closes #559 2016-09-14 10:45:00 +08:00
Sebastien Bourdeauducq f644595489 gui: use bare QSpinBox for integer NumberEntries. Closes #558 2016-09-14 10:29:29 +08:00
Sebastien Bourdeauducq 736927b6da language: set NoScan default repetitions to 1 2016-09-13 11:49:21 +08:00
raghu d4af4414e7 added repetitions for no scan, repetitions set to one when disable other scans selected. Closes #532 2016-09-13 11:49:21 +08:00
whitequark b73d7e402c runtime: expose strlen (implicitly required for comparing strings).
Fixes #557.
2016-09-10 09:53:21 +08:00
Sebastien Bourdeauducq ad697d4320 master: optimize repository scan, closes #546 2016-09-10 00:19:53 +08:00
Sebastien Bourdeauducq f23ebc035b doc: move VADJ, closes #554 2016-09-09 18:41:36 +08:00
whitequark e75002a109 Also serialize numpy.int{32,64} like int in RPC return values.
Fixes #555.
2016-09-09 17:17:51 +08:00
Sebastien Bourdeauducq f2502026bf gui/applets: fix teardown of half-initialized applets 2016-09-06 23:07:29 +08:00
Sebastien Bourdeauducq 9e33bceb6f gui/applets: fix handling of process creation failure 2016-09-06 23:07:22 +08:00
Sebastien Bourdeauducq 76c407b4b9 dashboard: fix 'disable other scans' 2016-09-06 22:50:35 +08:00
Sebastien Bourdeauducq d571c52800 artiq_client: fix 'show log', closes #552 2016-09-05 23:05:58 +08:00
Robert Jördens 87fad87e8f RELEASE_NOTES: 2.0rc1 2016-09-04 16:33:33 +02:00
Robert Jördens 642c7abdad conda: fix nist_clock summary 2016-09-03 11:08:58 +02:00
Sebastien Bourdeauducq c9eeddbb9f import_cache: make sure last line ends with \n as linecache does. Closes #547 2016-09-02 11:02:40 +08:00
Sebastien Bourdeauducq bb12f563f6 gui: fix layout and scan disable bugs with argument recomputation 2016-09-02 11:02:35 +08:00
Sebastien Bourdeauducq e0cdda2760 dashboard: fix argument recomputation for experiments outside repository. Closes #548 2016-09-02 11:02:29 +08:00
Sebastien Bourdeauducq 584d88428f RELEASE_NOTES: None arguments during experiment examination (#545) 2016-09-02 11:02:25 +08:00
Robert Jördens fc4b3e44d5 spi: use misoc SPIMachine, closes #314 2016-08-26 14:09:05 +02:00
Robert Jördens 9d08011a1f conda: misoc 0.3 2016-08-26 14:09:05 +02:00
Robert Jördens 75731611cd doc/manual: no analytics_id with rtd 2016-08-25 22:21:40 +02:00
Robert Jördens c4559fcd99 doc: use sphinx_rtd_theme 2016-08-25 21:53:50 +02:00
Robert Jördens afd2a37e0d doc/rtio: cleanup 2016-08-25 21:53:50 +02:00
Robert Jördens 8f045911f1 doc/rtio: make vis coloring consistent 2016-08-25 19:28:36 +02:00
Robert Jördens 6b5424b118 doc/rtio: vis RTIOUndeflow tweak 2016-08-25 19:28:36 +02:00
Robert Jördens e0569a1531 doc/rtio: vis RTIOUnderflow 2016-08-25 19:28:36 +02:00
Robert Jördens 6e8ff374d7 doc/rtio: input vis 2016-08-25 19:28:36 +02:00
Robert Jördens aef99b5164 doc/rtio: vis: now_mu -> now since not didactically relevant 2016-08-25 19:28:36 +02:00
Robert Jördens 1c9005851e doc/rtio: handover vis, tweak other vis's 2016-08-25 19:28:36 +02:00
Robert Jördens 87d3b53bde doc/rtio: sync() visualization 2016-08-25 19:28:36 +02:00
Robert Jördens 19d6dbc8a9 doc: ship wavedrom js b/c https 2016-08-25 19:28:36 +02:00
Robert Jördens 1f31fa620a doc: use wavedrom to visualize stuff 2016-08-25 12:16:05 +02:00
Robert Jördens c8faff2ba7 doc/rtio: fix description of idle kernel/reset 2016-08-25 10:20:10 +02:00
Robert Jördens 2da1dbae91 doc: rtio concepts, closes #451 2016-08-24 17:50:39 +02:00
Robert Jördens 1c85e95ad0 doc: expand/refine getting_started_core 2016-08-24 17:50:39 +02:00
Robert Jördens e07fd019aa doc: cleanup git checkout instructions (see #542) 2016-08-24 17:50:39 +02:00
106 changed files with 2134 additions and 1812 deletions

5
.readthedocs.yml Normal file
View File

@ -0,0 +1,5 @@
python:
version: 3
pip_install: false
conda:
file: conda/artiq-doc.yml

View File

@ -51,7 +51,7 @@ Copyright and Sign-Off
---------------------- ----------------------
Authors retain copyright of their contributions to ARTIQ, but whenever possible Authors retain copyright of their contributions to ARTIQ, but whenever possible
should use the GNU GPL version 3 license for them to be merged. should use the GNU LGPL version 3 license for them to be merged.
Works of US government employees are not copyrighted but can also be merged. Works of US government employees are not copyrighted but can also be merged.

827
LICENSE
View File

@ -1,674 +1,165 @@
GNU GENERAL PUBLIC LICENSE GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007 Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed. of this license document, but changing it is not allowed.
Preamble
This version of the GNU Lesser General Public License incorporates
The GNU General Public License is a free, copyleft license for the terms and conditions of version 3 of the GNU General Public
software and other kinds of works. License, supplemented by the additional permissions listed below.
The licenses for most software and other practical works are designed 0. Additional Definitions.
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to As used herein, "this License" refers to version 3 of the GNU Lesser
share and change all versions of a program--to make sure it remains free General Public License, and the "GNU GPL" refers to version 3 of the GNU
software for all its users. We, the Free Software Foundation, use the General Public License.
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to "The Library" refers to a covered work governed by this License,
your programs, too. other than an Application or a Combined Work as defined below.
When we speak of free software, we are referring to freedom, not An "Application" is any work that makes use of an interface provided
price. Our General Public Licenses are designed to make sure that you by the Library, but which is not otherwise based on the Library.
have the freedom to distribute copies of free software (and charge for Defining a subclass of a class defined by the Library is deemed a mode
them if you wish), that you receive source code or can get it if you of using an interface provided by the Library.
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things. A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
To protect your rights, we need to prevent others from denying you with which the Combined Work was made is also called the "Linked
these rights or asking you to surrender the rights. Therefore, you have Version".
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others. The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
For example, if you distribute copies of such a program, whether for portions of the Combined Work that, considered in isolation, are
gratis or for a fee, you must pass on to the recipients the same based on the Application, and not on the Linked Version.
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they The "Corresponding Application Code" for a Combined Work means the
know their rights. object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Developers that use the GNU GPL protect your rights with two steps: Application, but excluding the System Libraries of the Combined Work.
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it. 1. Exception to Section 3 of the GNU GPL.
For the developers' and authors' protection, the GPL clearly explains You may convey a covered work under sections 3 and 4 of this License
that there is no warranty for this free software. For both users' and without being bound by section 3 of the GNU GPL.
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to 2. Conveying Modified Versions.
authors of previous versions.
If you modify a copy of the Library, and, in your modifications, a
Some devices are designed to deny users access to install or run facility refers to a function or data to be supplied by an Application
modified versions of the software inside them, although the manufacturer that uses the facility (other than as an argument passed when the
can do so. This is fundamentally incompatible with the aim of facility is invoked), then you may convey a copy of the modified
protecting users' freedom to change the software. The systematic version:
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we a) under this License, provided that you make a good faith effort to
have designed this version of the GPL to prohibit the practice for those ensure that, in the event an Application does not supply the
products. If such problems arise substantially in other domains, we function or data, the facility still operates, and performs
stand ready to extend this provision to those domains in future versions whatever part of its purpose remains meaningful, or
of the GPL, as needed to protect the freedom of users.
b) under the GNU GPL, with none of the additional permissions of
Finally, every program is threatened constantly by software patents. this License applicable to that copy.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to 3. Object Code Incorporating Material from Library Header Files.
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that The object code form of an Application may incorporate material from
patents cannot be used to render the program non-free. a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
The precise terms and conditions for copying, distribution and material is not limited to numerical parameters, data structure
modification follow. layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
TERMS AND CONDITIONS
a) Give prominent notice with each copy of the object code that the
0. Definitions. Library is used in it and that the Library and its use are
covered by this License.
"This License" refers to version 3 of the GNU General Public License.
b) Accompany the object code with a copy of the GNU GPL and this license
"Copyright" also means copyright-like laws that apply to other kinds of document.
works, such as semiconductor masks.
4. Combined Works.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and You may convey a Combined Work under terms of your choice that,
"recipients" may be individuals or organizations. taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
To "modify" a work means to copy from or adapt all or part of the work engineering for debugging such modifications, if you also do each of
in a fashion requiring copyright permission, other than the making of an the following:
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work. a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
A "covered work" means either the unmodified Program or a work based covered by this License.
on the Program.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
To "propagate" a work means to do anything with it that, without document.
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a c) For a Combined Work that displays copyright notices during
computer or modifying a private copy. Propagation includes copying, execution, include the copyright notice for the Library among
distribution (with or without modification), making available to the these notices, as well as a reference directing the user to the
public, and in some countries other activities as well. copies of the GNU GPL and this license document.
To "convey" a work means any kind of propagation that enables other d) Do one of the following:
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying. 0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
An interactive user interface displays "Appropriate Legal Notices" suitable for, and under terms that permit, the user to
to the extent that it includes a convenient and prominently visible recombine or relink the Application with a modified version of
feature that (1) displays an appropriate copyright notice, and (2) the Linked Version to produce a modified Combined Work, in the
tells the user that there is no warranty for the work (except to the manner specified by section 6 of the GNU GPL for conveying
extent that warranties are provided), that licensees may convey the Corresponding Source.
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a 1) Use a suitable shared library mechanism for linking with the
menu, a prominent item in the list meets this criterion. Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
1. Source Code. system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
The "source code" for a work means the preferred form of the work Version.
for making modifications to it. "Object code" means any non-source
form of a work. e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
A "Standard Interface" means an interface that either is an official GNU GPL, and only to the extent that such information is
standard defined by a recognized standards body, or, in the case of necessary to install and execute a modified version of the
interfaces specified for a particular programming language, one that Combined Work produced by recombining or relinking the
is widely used among developers working in that language. Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
The "System Libraries" of an executable work include anything, other the Minimal Corresponding Source and Corresponding Application
than the work as a whole, that (a) is included in the normal form of Code. If you use option 4d1, you must provide the Installation
packaging a Major Component, but which is not part of that Major Information in the manner specified by section 6 of the GNU GPL
Component, and (b) serves only to enable use of the work with that for conveying Corresponding Source.)
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A 5. Combined Libraries.
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system You may place library facilities that are a work based on the
(if any) on which the executable work runs, or a compiler used to Library side by side in a single library together with other library
produce the work, or an object code interpreter used to run it. facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
The "Corresponding Source" for a work in object code form means all choice, if you do both of the following:
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to a) Accompany the combined library with a copy of the same work based
control those activities. However, it does not include the work's on the Library, uncombined with any other library facilities,
System Libraries, or general-purpose tools or generally available free conveyed under the terms of this License.
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source b) Give prominent notice with the combined library that part of it
includes interface definition files associated with source files for is a work based on the Library, and explaining where to find the
the work, and the source code for shared libraries and dynamically accompanying uncombined form of the same work.
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those 6. Revised Versions of the GNU Lesser General Public License.
subprograms and other parts of the work.
The Free Software Foundation may publish revised and/or new versions
The Corresponding Source need not include anything that users of the GNU Lesser General Public License from time to time. Such new
can regenerate automatically from other parts of the Corresponding versions will be similar in spirit to the present version, but may
Source. differ in detail to address new problems or concerns.
The Corresponding Source for a work in source code form is that Each version is given a distinguishing version number. If the
same work. Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
2. Basic Permissions. applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
All rights granted under this License are granted for the term of published by the Free Software Foundation. If the Library as you
copyright on the Program, and are irrevocable provided the stated received it does not specify a version number of the GNU Lesser
conditions are met. This License explicitly affirms your unlimited General Public License, you may choose any version of the GNU Lesser
permission to run the unmodified Program. The output from running a General Public License ever published by the Free Software Foundation.
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your If the Library as you received it specifies that a proxy can decide
rights of fair use or other equivalent, as provided by copyright law. whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
You may make, run and propagate covered works that you do not permanent authorization for you to choose that version for the
convey, without conditions so long as your license otherwise remains Library.
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View File

@ -5,7 +5,7 @@
:target: https://m-labs.hk/artiq :target: https://m-labs.hk/artiq
ARTIQ (Advanced Real-Time Infrastructure for Quantum physics) is the next-generation control system for quantum information experiments. ARTIQ (Advanced Real-Time Infrastructure for Quantum physics) is the next-generation control system for quantum information experiments.
It is developed by `M-Labs <https://m-labs.hk>`_ for and in partnership with the `Ion Storage Group at NIST <http://www.nist.gov/pml/div688/grp10/index.cfm>`_ as free software. It is developed by `M-Labs <https://m-labs.hk>`_ for and in partnership with the `Ion Storage Group at NIST <https://www.nist.gov/pml/time-and-frequency-division/ion-storage>`_ as free software.
It is offered to the entire research community as a solution equally applicable to other challenging control tasks outside the field of ion trapping. It is offered to the entire research community as a solution equally applicable to other challenging control tasks outside the field of ion trapping.
The system features a high-level programming language that helps describing complex experiments, which is compiled and executed on dedicated hardware with nanosecond timing resolution and sub-microsecond latency. It includes graphical user interfaces to parametrize and schedule experiments and to visualize and explore the results. The system features a high-level programming language that helps describing complex experiments, which is compiled and executed on dedicated hardware with nanosecond timing resolution and sub-microsecond latency. It includes graphical user interfaces to parametrize and schedule experiments and to visualize and explore the results.
@ -15,7 +15,7 @@ It is designed to be portable to hardware platforms from different vendors and F
Currently, one configuration of a `low-cost open hardware FPGA board <http://pipistrello.saanlima.com/>`_ and several different configurations of a `high-end FPGA evaluation kit <http://www.xilinx.com/products/boards-and-kits/ek-k7-kc705-g.html>`_ are used and supported. Currently, one configuration of a `low-cost open hardware FPGA board <http://pipistrello.saanlima.com/>`_ and several different configurations of a `high-end FPGA evaluation kit <http://www.xilinx.com/products/boards-and-kits/ek-k7-kc705-g.html>`_ are used and supported.
Any of these FPGA platforms can be combined with any number of additional peripherals, either already accessible from ARTIQ or made accessible with little effort. Any of these FPGA platforms can be combined with any number of additional peripherals, either already accessible from ARTIQ or made accessible with little effort.
Custom hardware components with widely extended capabilities and advanced support for scalable and fully distributed real-time control of experiments `are being designed <https://github.com/m-labs/artiq-hardware>`_. Custom hardware components with widely extended capabilities and advanced support for scalable and fully distributed real-time control of experiments `are being designed <https://github.com/m-labs/sinara>`_.
ARTIQ and its dependencies are available in the form of `conda packages <https://conda.anaconda.org/m-labs/label/main>`_ for both Linux and Windows. ARTIQ and its dependencies are available in the form of `conda packages <https://conda.anaconda.org/m-labs/label/main>`_ for both Linux and Windows.
Packages containing pre-compiled binary images to be loaded onto the hardware platforms are supplied for each configuration. Packages containing pre-compiled binary images to be loaded onto the hardware platforms are supplied for each configuration.
@ -30,4 +30,17 @@ Website: https://m-labs.hk/artiq
`Cite ARTIQ <http://dx.doi.org/10.5281/zenodo.51303>`_ as ``Bourdeauducq, Sébastien et al. (2016). ARTIQ 1.0. Zenodo. 10.5281/zenodo.51303``. `Cite ARTIQ <http://dx.doi.org/10.5281/zenodo.51303>`_ as ``Bourdeauducq, Sébastien et al. (2016). ARTIQ 1.0. Zenodo. 10.5281/zenodo.51303``.
Copyright (C) 2014-2016 M-Labs Limited. Licensed under GNU GPL version 3. Copyright (C) 2014-2017 M-Labs Limited.
ARTIQ is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ARTIQ is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with ARTIQ. If not, see <http://www.gnu.org/licenses/>.

View File

@ -3,8 +3,50 @@
Release notes Release notes
============= =============
unreleased [2.x] 2.5
---------------- ---
No further notes.
2.4
---
No further notes.
2.3
---
* When using conda, add the conda-forge channel before installing ARTIQ.
2.2
---
No further notes.
2.1
---
No further notes.
2.0
---
No further notes.
2.0rc2
------
No further notes.
2.0rc1
------
* The format of the influxdb pattern file is simplified. The procedure to * The format of the influxdb pattern file is simplified. The procedure to
edit patterns is also changed to modifying the pattern file and calling: edit patterns is also changed to modifying the pattern file and calling:
@ -34,6 +76,8 @@ unreleased [2.x]
(i.e. grouping by day and then by hour, instead of by day and then by minute) (i.e. grouping by day and then by hour, instead of by day and then by minute)
* The ``parent`` keyword argument of ``HasEnvironment`` (and ``EnvExperiment``) * The ``parent`` keyword argument of ``HasEnvironment`` (and ``EnvExperiment``)
has been replaced. Pass the parent as first argument instead. has been replaced. Pass the parent as first argument instead.
* During experiment examination (and a fortiori repository scan), the values of
all arguments are set to ``None`` regardless of any default values supplied.
* In the dashboard's experiment windows, partial or full argument recomputation * In the dashboard's experiment windows, partial or full argument recomputation
takes into account the repository revision field. takes into account the repository revision field.
* By default, ``NumberValue`` and ``Scannable`` infer the scale from the unit * By default, ``NumberValue`` and ``Scannable`` infer the scale from the unit
@ -50,6 +94,7 @@ unreleased [2.x]
numpy.int64). If you pass an integer as a RPC argument, the target function numpy.int64). If you pass an integer as a RPC argument, the target function
receives a numpy type. receives a numpy type.
1.3 1.3
--- ---

View File

@ -11,9 +11,11 @@ Major releases
3. Ensure that release versions of all packages required are available under the ``main`` label in conda. Ensure that new packages in ``main`` do not break older ARTIQ releases. 3. Ensure that release versions of all packages required are available under the ``main`` label in conda. Ensure that new packages in ``main`` do not break older ARTIQ releases.
4. In the release-X branch, remove any unfinished features. 4. In the release-X branch, remove any unfinished features.
5. Test and fix any problems found. Apply fixes to both master and release-X. 5. Test and fix any problems found. Apply fixes to both master and release-X.
6. If you have willing testers for release candidates, tag X.0rc1 in the release-X branch, have it build, and point testers there. Iterate over the previous points with new release candidates if necessary. 6. If you have willing testers for release candidates, tag X.0rc1 in the release-X branch (generally use signed annotated tags, i.e. ``git tag -sa X.0rc1``), have it build, and point testers there. Iterate over the previous points with new release candidates if necessary.
7. Tag X.0 in the release-X branch, build it, and copy its packages to ``main`` channel. 7. Tag X.0 in the release-X branch, build it, and copy its packages to ``main`` channel.
8. Mint a new DOI from Zenodo and update the README/introduction. 8. Mint a new DOI from Zenodo and update the README/introduction.
9. Update the m-labs.hk/artiq/manual redirect to point to m-labs.hk/artiq/manual-release-X (edit /artiq/.htaccess).
10. "Draft a new release" on GitHub.
Minor (bugfix) releases Minor (bugfix) releases
----------------------- -----------------------
@ -21,3 +23,4 @@ Minor (bugfix) releases
1. Backport bugfixes from the master branch or fix bugs specific to old releases into the currently maintained release-X branch(es). 1. Backport bugfixes from the master branch or fix bugs specific to old releases into the currently maintained release-X branch(es).
2. When significant bugs have been fixed, tag X.Y+1. 2. When significant bugs have been fixed, tag X.Y+1.
3. To help dealing with regressions, no new features or refactorings should be implemented in release-X branches. Those happen in the master branch, and then a new release-X+1 branch is created. 3. To help dealing with regressions, no new features or refactorings should be implemented in release-X branches. Those happen in the master branch, and then a new release-X+1 branch is created.
4. "Draft a new release" on GitHub.

View File

@ -5,3 +5,7 @@ del get_versions
import os import os
__artiq_dir__ = os.path.dirname(os.path.abspath(__file__)) __artiq_dir__ = os.path.dirname(os.path.abspath(__file__))
del os del os
from ._version import get_versions
__version__ = get_versions()['version']
del get_versions

View File

@ -6,7 +6,7 @@
# that just contains the computed version number. # that just contains the computed version number.
# This file is released into the public domain. Generated by # This file is released into the public domain. Generated by
# versioneer-0.15+dev (https://github.com/warner/python-versioneer) # versioneer-0.18 (https://github.com/warner/python-versioneer)
"""Git implementation of _version.py.""" """Git implementation of _version.py."""
@ -25,12 +25,12 @@ def get_keywords():
# get_keywords(). # get_keywords().
git_refnames = "$Format:%d$" git_refnames = "$Format:%d$"
git_full = "$Format:%H$" git_full = "$Format:%H$"
keywords = {"refnames": git_refnames, "full": git_full} git_date = "$Format:%ci$"
keywords = {"refnames": git_refnames, "full": git_full, "date": git_date}
return keywords return keywords
class VersioneerConfig: class VersioneerConfig:
"""Container for Versioneer configuration parameters.""" """Container for Versioneer configuration parameters."""
@ -49,7 +49,6 @@ def get_config():
class NotThisMethod(Exception): class NotThisMethod(Exception):
"""Exception raised if a method is not valid for the current scenario.""" """Exception raised if a method is not valid for the current scenario."""
@ -68,7 +67,8 @@ def register_vcs_handler(vcs, method): # decorator
return decorate return decorate
def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False): def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False,
env=None):
"""Call the given command(s).""" """Call the given command(s)."""
assert isinstance(commands, list) assert isinstance(commands, list)
p = None p = None
@ -76,7 +76,8 @@ def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False):
try: try:
dispcmd = str([c] + args) dispcmd = str([c] + args)
# remember shell=False, so use git.cmd on windows, not just git # remember shell=False, so use git.cmd on windows, not just git
p = subprocess.Popen([c] + args, cwd=cwd, stdout=subprocess.PIPE, p = subprocess.Popen([c] + args, cwd=cwd, env=env,
stdout=subprocess.PIPE,
stderr=(subprocess.PIPE if hide_stderr stderr=(subprocess.PIPE if hide_stderr
else None)) else None))
break break
@ -87,36 +88,45 @@ def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False):
if verbose: if verbose:
print("unable to run %s" % dispcmd) print("unable to run %s" % dispcmd)
print(e) print(e)
return None return None, None
else: else:
if verbose: if verbose:
print("unable to find command, tried %s" % (commands,)) print("unable to find command, tried %s" % (commands,))
return None return None, None
stdout = p.communicate()[0].strip() stdout = p.communicate()[0].strip()
if sys.version_info[0] >= 3: if sys.version_info[0] >= 3:
stdout = stdout.decode() stdout = stdout.decode()
if p.returncode != 0: if p.returncode != 0:
if verbose: if verbose:
print("unable to run %s (error)" % dispcmd) print("unable to run %s (error)" % dispcmd)
return None print("stdout was %s" % stdout)
return stdout return None, p.returncode
return stdout, p.returncode
def versions_from_parentdir(parentdir_prefix, root, verbose): def versions_from_parentdir(parentdir_prefix, root, verbose):
"""Try to determine the version from the parent directory name. """Try to determine the version from the parent directory name.
Source tarballs conventionally unpack into a directory that includes Source tarballs conventionally unpack into a directory that includes both
both the project name and a version string. the project name and a version string. We will also support searching up
two directory levels for an appropriately named parent directory
""" """
dirname = os.path.basename(root) rootdirs = []
if not dirname.startswith(parentdir_prefix):
if verbose: for i in range(3):
print("guessing rootdir is '%s', but '%s' doesn't start with " dirname = os.path.basename(root)
"prefix '%s'" % (root, dirname, parentdir_prefix)) if dirname.startswith(parentdir_prefix):
raise NotThisMethod("rootdir doesn't start with parentdir_prefix") return {"version": dirname[len(parentdir_prefix):],
return {"version": dirname[len(parentdir_prefix):], "full-revisionid": None,
"full-revisionid": None, "dirty": False, "error": None, "date": None}
"dirty": False, "error": None} else:
rootdirs.append(root)
root = os.path.dirname(root) # up a level
if verbose:
print("Tried directories %s but none started with prefix %s" %
(str(rootdirs), parentdir_prefix))
raise NotThisMethod("rootdir doesn't start with parentdir_prefix")
@register_vcs_handler("git", "get_keywords") @register_vcs_handler("git", "get_keywords")
@ -138,6 +148,10 @@ def git_get_keywords(versionfile_abs):
mo = re.search(r'=\s*"(.*)"', line) mo = re.search(r'=\s*"(.*)"', line)
if mo: if mo:
keywords["full"] = mo.group(1) keywords["full"] = mo.group(1)
if line.strip().startswith("git_date ="):
mo = re.search(r'=\s*"(.*)"', line)
if mo:
keywords["date"] = mo.group(1)
f.close() f.close()
except EnvironmentError: except EnvironmentError:
pass pass
@ -149,6 +163,15 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose):
"""Get version information from git keywords.""" """Get version information from git keywords."""
if not keywords: if not keywords:
raise NotThisMethod("no keywords at all, weird") raise NotThisMethod("no keywords at all, weird")
date = keywords.get("date")
if date is not None:
# git-2.2.0 added "%cI", which expands to an ISO-8601 -compliant
# datestamp. However we prefer "%ci" (which expands to an "ISO-8601
# -like" string, which we must then edit to make compliant), because
# it's been around since git-1.5.3, and it's too difficult to
# discover which version we're using, or to work around using an
# older one.
date = date.strip().replace(" ", "T", 1).replace(" ", "", 1)
refnames = keywords["refnames"].strip() refnames = keywords["refnames"].strip()
if refnames.startswith("$Format"): if refnames.startswith("$Format"):
if verbose: if verbose:
@ -169,7 +192,7 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose):
# "stabilization", as well as "HEAD" and "master". # "stabilization", as well as "HEAD" and "master".
tags = set([r for r in refs if re.search(r'\d', r)]) tags = set([r for r in refs if re.search(r'\d', r)])
if verbose: if verbose:
print("discarding '%s', no digits" % ",".join(refs-tags)) print("discarding '%s', no digits" % ",".join(refs - tags))
if verbose: if verbose:
print("likely tags: %s" % ",".join(sorted(tags))) print("likely tags: %s" % ",".join(sorted(tags)))
for ref in sorted(tags): for ref in sorted(tags):
@ -180,14 +203,14 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose):
print("picking %s" % r) print("picking %s" % r)
return {"version": r, return {"version": r,
"full-revisionid": keywords["full"].strip(), "full-revisionid": keywords["full"].strip(),
"dirty": False, "error": None "dirty": False, "error": None,
} "date": date}
# no suitable tags, so version is "0+unknown", but full hex is still there # no suitable tags, so version is "0+unknown", but full hex is still there
if verbose: if verbose:
print("no suitable tags, using unknown + full revision id") print("no suitable tags, using unknown + full revision id")
return {"version": "0+unknown", return {"version": "0+unknown",
"full-revisionid": keywords["full"].strip(), "full-revisionid": keywords["full"].strip(),
"dirty": False, "error": "no suitable tags"} "dirty": False, "error": "no suitable tags", "date": None}
@register_vcs_handler("git", "pieces_from_vcs") @register_vcs_handler("git", "pieces_from_vcs")
@ -198,32 +221,35 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
expanded, and _version.py hasn't already been rewritten with a short expanded, and _version.py hasn't already been rewritten with a short
version string, meaning we're inside a checked out source tree. version string, meaning we're inside a checked out source tree.
""" """
if not os.path.exists(os.path.join(root, ".git")):
if verbose:
print("no .git in %s" % root)
raise NotThisMethod("no .git directory")
GITS = ["git"] GITS = ["git"]
if sys.platform == "win32": if sys.platform == "win32":
GITS = ["git.cmd", "git.exe"] GITS = ["git.cmd", "git.exe"]
out, rc = run_command(GITS, ["rev-parse", "--git-dir"], cwd=root,
hide_stderr=True)
if rc != 0:
if verbose:
print("Directory %s not under git control" % root)
raise NotThisMethod("'git rev-parse --git-dir' returned error")
# if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty] # if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty]
# if there isn't one, this yields HEX[-dirty] (no NUM) # if there isn't one, this yields HEX[-dirty] (no NUM)
describe_out = run_command(GITS, ["describe", "--tags", "--dirty", describe_out, rc = run_command(GITS, ["describe", "--tags", "--dirty",
"--always", "--long", "--always", "--long", "--abbrev=8",
"--match", "%s*" % tag_prefix], "--match", "%s*" % tag_prefix],
cwd=root) cwd=root)
# --long was added in git-1.5.5 # --long was added in git-1.5.5
if describe_out is None: if describe_out is None:
raise NotThisMethod("'git describe' failed") raise NotThisMethod("'git describe' failed")
describe_out = describe_out.strip() describe_out = describe_out.strip()
full_out = run_command(GITS, ["rev-parse", "HEAD"], cwd=root) full_out, rc = run_command(GITS, ["rev-parse", "HEAD"], cwd=root)
if full_out is None: if full_out is None:
raise NotThisMethod("'git rev-parse' failed") raise NotThisMethod("'git rev-parse' failed")
full_out = full_out.strip() full_out = full_out.strip()
pieces = {} pieces = {}
pieces["long"] = full_out pieces["long"] = full_out
pieces["short"] = full_out[:7] # maybe improved later pieces["short"] = full_out[:8] # maybe improved later
pieces["error"] = None pieces["error"] = None
# parse describe_out. It will be like TAG-NUM-gHEX[-dirty] or HEX[-dirty] # parse describe_out. It will be like TAG-NUM-gHEX[-dirty] or HEX[-dirty]
@ -267,10 +293,15 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
else: else:
# HEX: no tags # HEX: no tags
pieces["closest-tag"] = None pieces["closest-tag"] = None
count_out = run_command(GITS, ["rev-list", "HEAD", "--count"], count_out, rc = run_command(GITS, ["rev-list", "HEAD", "--count"],
cwd=root) cwd=root)
pieces["distance"] = int(count_out) # total number of commits pieces["distance"] = int(count_out) # total number of commits
# commit date: see ISO-8601 comment in git_versions_from_keywords()
date = run_command(GITS, ["show", "-s", "--format=%ci", "HEAD"],
cwd=root)[0].strip()
pieces["date"] = date.strip().replace(" ", "T", 1).replace(" ", "", 1)
return pieces return pieces
@ -417,7 +448,8 @@ def render(pieces, style):
return {"version": "unknown", return {"version": "unknown",
"full-revisionid": pieces.get("long"), "full-revisionid": pieces.get("long"),
"dirty": None, "dirty": None,
"error": pieces["error"]} "error": pieces["error"],
"date": None}
if not style or style == "default": if not style or style == "default":
style = "pep440" # the default style = "pep440" # the default
@ -438,7 +470,8 @@ def render(pieces, style):
raise ValueError("unknown style '%s'" % style) raise ValueError("unknown style '%s'" % style)
return {"version": rendered, "full-revisionid": pieces["long"], return {"version": rendered, "full-revisionid": pieces["long"],
"dirty": pieces["dirty"], "error": None} "dirty": pieces["dirty"], "error": None,
"date": pieces.get("date")}
def get_versions(): def get_versions():
@ -467,7 +500,8 @@ def get_versions():
except NameError: except NameError:
return {"version": "0+unknown", "full-revisionid": None, return {"version": "0+unknown", "full-revisionid": None,
"dirty": None, "dirty": None,
"error": "unable to find root of source tree"} "error": "unable to find root of source tree",
"date": None}
try: try:
pieces = git_pieces_from_vcs(cfg.tag_prefix, root, verbose) pieces = git_pieces_from_vcs(cfg.tag_prefix, root, verbose)
@ -483,4 +517,4 @@ def get_versions():
return {"version": "0+unknown", "full-revisionid": None, return {"version": "0+unknown", "full-revisionid": None,
"dirty": None, "dirty": None,
"error": "unable to compute version"} "error": "unable to compute version", "date": None}

View File

@ -9,7 +9,7 @@ import h5py
from artiq import __artiq_dir__ as artiq_dir from artiq import __artiq_dir__ as artiq_dir
from artiq.gui.tools import LayoutWidget, log_level_to_name, get_open_file_name from artiq.gui.tools import LayoutWidget, log_level_to_name, get_open_file_name
from artiq.gui.entries import argty_to_entry from artiq.gui.entries import procdesc_to_entry
from artiq.protocols import pyon from artiq.protocols import pyon
from artiq.master.worker import Worker, log_worker_exception from artiq.master.worker import Worker, log_worker_exception
@ -48,7 +48,7 @@ class _ArgumentEditor(QtWidgets.QTreeWidget):
self.viewport().installEventFilter(_WheelFilter(self.viewport())) self.viewport().installEventFilter(_WheelFilter(self.viewport()))
self._groups = dict() self._groups = dict()
self._arg_to_entry_widgetitem = dict() self._arg_to_widgets = dict()
self._dock = dock self._dock = dock
if not self._dock.arguments: if not self._dock.arguments:
@ -59,12 +59,13 @@ class _ArgumentEditor(QtWidgets.QTreeWidget):
gradient.setColorAt(1, self.palette().midlight().color()) gradient.setColorAt(1, self.palette().midlight().color())
for name, argument in self._dock.arguments.items(): for name, argument in self._dock.arguments.items():
try: widgets = dict()
entry = argty_to_entry[argument["desc"]["ty"]](argument) self._arg_to_widgets[name] = widgets
except:
print(name, argument) entry = procdesc_to_entry(argument["desc"])(argument)
widget_item = QtWidgets.QTreeWidgetItem([name]) widget_item = QtWidgets.QTreeWidgetItem([name])
self._arg_to_entry_widgetitem[name] = entry, widget_item widgets["entry"] = entry
widgets["widget_item"] = widget_item
for col in range(3): for col in range(3):
widget_item.setBackground(col, gradient) widget_item.setBackground(col, gradient)
@ -77,6 +78,7 @@ class _ArgumentEditor(QtWidgets.QTreeWidget):
else: else:
self._get_group(argument["group"]).addChild(widget_item) self._get_group(argument["group"]).addChild(widget_item)
fix_layout = LayoutWidget() fix_layout = LayoutWidget()
widgets["fix_layout"] = fix_layout
fix_layout.addWidget(entry) fix_layout.addWidget(entry)
self.setItemWidget(widget_item, 1, fix_layout) self.setItemWidget(widget_item, 1, fix_layout)
@ -146,16 +148,18 @@ class _ArgumentEditor(QtWidgets.QTreeWidget):
argument = self._dock.arguments[name] argument = self._dock.arguments[name]
procdesc = arginfo[name][0] procdesc = arginfo[name][0]
state = argty_to_entry[procdesc["ty"]].default_state(procdesc) state = procdesc_to_entry(procdesc).default_state(procdesc)
argument["desc"] = procdesc argument["desc"] = procdesc
argument["state"] = state argument["state"] = state
old_entry, widget_item = self._arg_to_entry_widgetitem[name] widgets = self._arg_to_widgets[name]
old_entry.deleteLater()
entry = argty_to_entry[procdesc["ty"]](argument) widgets["entry"].deleteLater()
self._arg_to_entry_widgetitem[name] = entry, widget_item widgets["entry"] = procdesc_to_entry(procdesc)(argument)
self.setItemWidget(widget_item, 1, entry) widgets["fix_layout"] = LayoutWidget()
widgets["fix_layout"].addWidget(widgets["entry"])
self.setItemWidget(widgets["widget_item"], 1, widgets["fix_layout"])
self.updateGeometries()
def save_state(self): def save_state(self):
expanded = [] expanded = []
@ -314,7 +318,7 @@ class _ExperimentDock(QtWidgets.QMdiSubWindow):
"class_name": class_name, "class_name": class_name,
"log_level": self.options["log_level"], "log_level": self.options["log_level"],
"arguments": { "arguments": {
name: argty_to_entry[argument["desc"]["ty"]].state_to_value( name: procdesc_to_entry(argument["desc"]).state_to_value(
argument["state"]) argument["state"])
for name, argument in self.arguments.items()}, for name, argument in self.arguments.items()},
} }
@ -466,7 +470,7 @@ class ExperimentsArea(QtWidgets.QMdiArea):
def initialize_submission_arguments(self, arginfo): def initialize_submission_arguments(self, arginfo):
arguments = OrderedDict() arguments = OrderedDict()
for name, (procdesc, group) in arginfo.items(): for name, (procdesc, group) in arginfo.items():
state = argty_to_entry[procdesc["ty"]].default_state(procdesc) state = procdesc_to_entry(procdesc).default_state(procdesc)
arguments[name] = { arguments[name] = {
"desc": procdesc, "desc": procdesc,
"group": group, "group": group,
@ -500,6 +504,7 @@ class ExperimentsArea(QtWidgets.QMdiArea):
exc_info=True) exc_info=True)
dock = _ExperimentDock(self, expurl, {}) dock = _ExperimentDock(self, expurl, {})
asyncio.ensure_future(dock._recompute_arguments()) asyncio.ensure_future(dock._recompute_arguments())
dock.setAttribute(QtCore.Qt.WA_DeleteOnClose)
self.addSubWindow(dock) self.addSubWindow(dock)
dock.show() dock.show()
dock.sigClosed.connect(partial(self.on_dock_closed, dock)) dock.sigClosed.connect(partial(self.on_dock_closed, dock))

View File

@ -17,6 +17,12 @@ class Constness(algorithm.Visitor):
self.visit(node.targets) self.visit(node.targets)
self.in_assign = False self.in_assign = False
def visit_SubscriptT(self, node):
old_in_assign, self.in_assign = self.in_assign, False
self.visit(node.value)
self.visit(node.slice)
self.in_assign = old_in_assign
def visit_AttributeT(self, node): def visit_AttributeT(self, node):
self.generic_visit(node) self.generic_visit(node)
if self.in_assign: if self.in_assign:

View File

@ -126,10 +126,10 @@ def fn_int():
return types.TConstructor(TInt()) return types.TConstructor(TInt())
def fn_int32(): def fn_int32():
return types.TConstructor(TInt32()) return types.TBuiltinFunction("int32")
def fn_int64(): def fn_int64():
return types.TConstructor(TInt64()) return types.TBuiltinFunction("int64")
def fn_float(): def fn_float():
return types.TConstructor(TFloat()) return types.TConstructor(TFloat())

View File

@ -15,7 +15,7 @@ from Levenshtein import ratio as similarity, jaro_winkler
from ..language import core as language_core from ..language import core as language_core
from . import types, builtins, asttyped, prelude from . import types, builtins, asttyped, prelude
from .transforms import ASTTypedRewriter, Inferencer, IntMonomorphizer from .transforms import ASTTypedRewriter, Inferencer, IntMonomorphizer, TypedtreePrinter
from .transforms.asttyped_rewriter import LocalExtractor from .transforms.asttyped_rewriter import LocalExtractor
@ -85,6 +85,14 @@ class EmbeddingMap:
n += 1 n += 1
new_instance_type.name = "{}.{}".format(new_instance_type.name, n) new_instance_type.name = "{}.{}".format(new_instance_type.name, n)
def attribute_count(self):
count = 0
for host_type in self.type_map:
instance_type, constructor_type = self.type_map[host_type]
count += len(instance_type.attributes)
count += len(constructor_type.attributes)
return count
# Functions # Functions
def store_function(self, function, ir_function_name): def store_function(self, function, ir_function_name):
self.function_map[function] = ir_function_name self.function_map[function] = ir_function_name
@ -382,23 +390,6 @@ class ASTSynthesizer:
return node return node
def assign_attribute(self, obj, attr_name, value):
obj_node = self.quote(obj)
dot_loc = self._add(".")
name_loc = self._add(attr_name)
_ = self._add(" ")
equals_loc = self._add("=")
_ = self._add(" ")
value_node = self.quote(value)
attr_node = asttyped.AttributeT(value=obj_node, attr=attr_name, ctx=None,
type=value_node.type,
dot_loc=dot_loc, attr_loc=name_loc,
loc=obj_node.loc.join(name_loc))
return ast.Assign(targets=[attr_node], value=value_node,
op_locs=[equals_loc], loc=name_loc.join(value_node.loc))
def suggest_identifier(id, names): def suggest_identifier(id, names):
sorted_names = sorted(names, key=lambda other: jaro_winkler(id, other), reverse=True) sorted_names = sorted(names, key=lambda other: jaro_winkler(id, other), reverse=True)
@ -561,7 +552,13 @@ class StitchingInferencer(Inferencer):
# of having the host-to-ARTIQ mapping code in only one place and # of having the host-to-ARTIQ mapping code in only one place and
# also immediately getting proper diagnostics on type errors. # also immediately getting proper diagnostics on type errors.
attr_value = getattr(object_value, attr_name) attr_value = getattr(object_value, attr_name)
if inspect.ismethod(attr_value) and types.is_instance(object_type): if (inspect.ismethod(attr_value) and
types.is_instance(object_type) and
# Check that the method is indeed defined on the class,
# and not just this instance. The check is written in
# the inverted form and not as hasattr(type(attr_value))
# since the method may as well be defined on a superclass.
attr_name not in object_value.__dict__):
# In cases like: # In cases like:
# class c: # class c:
# @kernel # @kernel
@ -671,6 +668,8 @@ class TypedtreeHasher(algorithm.Visitor):
def freeze(obj): def freeze(obj):
if isinstance(obj, ast.AST): if isinstance(obj, ast.AST):
return self.visit(obj) return self.visit(obj)
elif isinstance(obj, list):
return hash(tuple(freeze(elem) for elem in obj))
elif isinstance(obj, types.Type): elif isinstance(obj, types.Type):
return hash(obj.find()) return hash(obj.find())
else: else:
@ -683,7 +682,7 @@ class TypedtreeHasher(algorithm.Visitor):
return hash(tuple(freeze(getattr(node, field_name)) for field_name in fields)) return hash(tuple(freeze(getattr(node, field_name)) for field_name in fields))
class Stitcher: class Stitcher:
def __init__(self, core, dmgr, engine=None): def __init__(self, core, dmgr, engine=None, print_as_rpc=True):
self.core = core self.core = core
self.dmgr = dmgr self.dmgr = dmgr
if engine is None: if engine is None:
@ -699,7 +698,8 @@ class Stitcher:
# We don't want some things from the prelude as they are provided in # We don't want some things from the prelude as they are provided in
# the host Python namespace and gain special meaning when quoted. # the host Python namespace and gain special meaning when quoted.
self.prelude = prelude.globals() self.prelude = prelude.globals()
self.prelude.pop("print") if print_as_rpc:
self.prelude.pop("print")
self.prelude.pop("array") self.prelude.pop("array")
self.functions = {} self.functions = {}
@ -719,22 +719,48 @@ class Stitcher:
inferencer = StitchingInferencer(engine=self.engine, inferencer = StitchingInferencer(engine=self.engine,
value_map=self.value_map, value_map=self.value_map,
quote=self._quote) quote=self._quote)
hasher = TypedtreeHasher() typedtree_hasher = TypedtreeHasher()
# Iterate inference to fixed point. # Iterate inference to fixed point.
old_typedtree_hash = None old_typedtree_hash = None
old_attr_count = None
while True: while True:
inferencer.visit(self.typedtree) inferencer.visit(self.typedtree)
typedtree_hash = hasher.visit(self.typedtree) typedtree_hash = typedtree_hasher.visit(self.typedtree)
attr_count = self.embedding_map.attribute_count()
if old_typedtree_hash == typedtree_hash: if old_typedtree_hash == typedtree_hash and old_attr_count == attr_count:
break break
old_typedtree_hash = typedtree_hash old_typedtree_hash = typedtree_hash
old_attr_count = attr_count
# When we have an excess of type information, sometimes we can infer every type # After we've discovered every referenced attribute, check if any kernel_invariant
# in the AST without discovering every referenced attribute of host objects, so # specifications refers to ones we didn't encounter.
# do one last pass unconditionally. for host_type in self.embedding_map.type_map:
inferencer.visit(self.typedtree) instance_type, constructor_type = self.embedding_map.type_map[host_type]
if not hasattr(instance_type, "constant_attributes"):
# Exceptions lack user-definable attributes.
continue
for attribute in instance_type.constant_attributes:
if attribute in instance_type.attributes:
# Fast path; if the ARTIQ Python type has the attribute, then every observed
# value is guaranteed to have it too.
continue
for value, loc in self.value_map[instance_type]:
if hasattr(value, attribute):
continue
diag = diagnostic.Diagnostic("warning",
"object {value} of type {typ} declares attribute '{attr}' as "
"kernel invariant, but the instance referenced here does not "
"have this attribute",
{"value": repr(value),
"typ": types.TypePrinter().name(instance_type, max_depth=0),
"attr": attribute},
loc)
self.engine.process(diag)
# After we have found all functions, synthesize a module to hold them. # After we have found all functions, synthesize a module to hold them.
source_buffer = source.Buffer("", "<synthesized>") source_buffer = source.Buffer("", "<synthesized>")

View File

@ -29,7 +29,10 @@ def hook_exec_module(self, module):
fn = module.__file__ fn = module.__file__
try: try:
with tokenize.open(fn) as fp: with tokenize.open(fn) as fp:
cache[fn] = fp.readlines() lines = fp.readlines()
if lines and not lines[-1].endswith("\n"):
lines[-1] += "\n"
cache[fn] = lines
except: except:
logger.warning("failed to add '%s' to cache", fn, exc_info=True) logger.warning("failed to add '%s' to cache", fn, exc_info=True)
else: else:

View File

@ -40,7 +40,8 @@ class Source:
return cls(source.Buffer(f.read(), filename, 1), engine=engine) return cls(source.Buffer(f.read(), filename, 1), engine=engine)
class Module: class Module:
def __init__(self, src, ref_period=1e-6): def __init__(self, src, ref_period=1e-6, attribute_writeback=True):
self.attribute_writeback = attribute_writeback
self.engine = src.engine self.engine = src.engine
self.embedding_map = src.embedding_map self.embedding_map = src.embedding_map
self.name = src.name self.name = src.name
@ -79,7 +80,8 @@ class Module:
llvm_ir_generator = transforms.LLVMIRGenerator( llvm_ir_generator = transforms.LLVMIRGenerator(
engine=self.engine, module_name=self.name, target=target, engine=self.engine, module_name=self.name, target=target,
embedding_map=self.embedding_map) embedding_map=self.embedding_map)
return llvm_ir_generator.process(self.artiq_ir, attribute_writeback=True) return llvm_ir_generator.process(self.artiq_ir,
attribute_writeback=self.attribute_writeback)
def entry_point(self): def entry_point(self):
"""Return the name of the function that is the entry point of this module.""" """Return the name of the function that is the entry point of this module."""

View File

@ -14,6 +14,8 @@ def globals():
"list": builtins.fn_list(), "list": builtins.fn_list(),
"array": builtins.fn_array(), "array": builtins.fn_array(),
"range": builtins.fn_range(), "range": builtins.fn_range(),
"int32": builtins.fn_int32(),
"int64": builtins.fn_int64(),
# Exception constructors # Exception constructors
"Exception": builtins.fn_Exception(), "Exception": builtins.fn_Exception(),

View File

@ -6,3 +6,4 @@ from .artiq_ir_generator import ARTIQIRGenerator
from .dead_code_eliminator import DeadCodeEliminator from .dead_code_eliminator import DeadCodeEliminator
from .llvm_ir_generator import LLVMIRGenerator from .llvm_ir_generator import LLVMIRGenerator
from .interleaver import Interleaver from .interleaver import Interleaver
from .typedtree_printer import TypedtreePrinter

View File

@ -317,7 +317,15 @@ class ARTIQIRGenerator(algorithm.Visitor):
self.current_block.append(ir.Return(ir.Constant(None, builtins.TNone()))) self.current_block.append(ir.Return(ir.Constant(None, builtins.TNone())))
else: else:
if not self.current_block.is_terminated(): if not self.current_block.is_terminated():
if len(self.current_block.predecessors()) != 0:
diag = diagnostic.Diagnostic("error",
"this function must return a value of type {typ} explicitly",
{"typ": types.TypePrinter().name(typ.ret)},
node.keyword_loc)
self.engine.process(diag)
self.current_block.append(ir.Unreachable()) self.current_block.append(ir.Unreachable())
finally: finally:
self.name = old_name self.name = old_name
self.current_args = old_args self.current_args = old_args
@ -443,6 +451,7 @@ class ARTIQIRGenerator(algorithm.Visitor):
self.current_block = head self.current_block = head
old_continue, self.continue_target = self.continue_target, head old_continue, self.continue_target = self.continue_target, head
cond = self.visit(node.test) cond = self.visit(node.test)
cond = self.coerce_to_bool(cond)
post_head = self.current_block post_head = self.current_block
break_block = self.add_block("while.break") break_block = self.add_block("while.break")
@ -452,38 +461,39 @@ class ARTIQIRGenerator(algorithm.Visitor):
self.current_block = body self.current_block = body
self.visit(node.body) self.visit(node.body)
post_body = self.current_block post_body = self.current_block
if any(node.orelse):
else_tail = self.add_block("while.else")
self.current_block = else_tail
self.visit(node.orelse)
post_else_tail = self.current_block
tail = self.add_block("while.tail")
self.current_block = tail
if any(node.orelse):
if not post_else_tail.is_terminated():
post_else_tail.append(ir.Branch(tail))
else:
else_tail = tail
post_head.append(ir.BranchIf(cond, body, else_tail))
if not post_body.is_terminated():
post_body.append(ir.Branch(head))
break_block.append(ir.Branch(tail))
finally: finally:
self.break_target = old_break self.break_target = old_break
self.continue_target = old_continue self.continue_target = old_continue
if any(node.orelse):
else_tail = self.add_block("while.else")
self.current_block = else_tail
self.visit(node.orelse)
post_else_tail = self.current_block
tail = self.add_block("while.tail")
self.current_block = tail
if any(node.orelse):
if not post_else_tail.is_terminated():
post_else_tail.append(ir.Branch(tail))
else:
else_tail = tail
post_head.append(ir.BranchIf(cond, body, else_tail))
if not post_body.is_terminated():
post_body.append(ir.Branch(head))
break_block.append(ir.Branch(tail))
def iterable_len(self, value, typ=_size_type): def iterable_len(self, value, typ=_size_type):
if builtins.is_listish(value.type): if builtins.is_listish(value.type):
if isinstance(value, ir.Constant): if isinstance(value, ir.Constant):
name = None name = None
else: else:
name = "{}.len".format(value.name) name = "{}.len".format(value.name)
return self.append(ir.Builtin("len", [value], typ, len = self.append(ir.Builtin("len", [value], builtins.TInt32(),
name=name)) name=name))
return self.append(ir.Coerce(len, typ))
elif builtins.is_range(value.type): elif builtins.is_range(value.type):
start = self.append(ir.GetAttr(value, "start")) start = self.append(ir.GetAttr(value, "start"))
stop = self.append(ir.GetAttr(value, "stop")) stop = self.append(ir.GetAttr(value, "stop"))
@ -541,33 +551,33 @@ class ARTIQIRGenerator(algorithm.Visitor):
self.current_assign = None self.current_assign = None
self.visit(node.body) self.visit(node.body)
post_body = self.current_block post_body = self.current_block
if any(node.orelse):
else_tail = self.add_block("for.else")
self.current_block = else_tail
self.visit(node.orelse)
post_else_tail = self.current_block
tail = self.add_block("for.tail")
self.current_block = tail
if any(node.orelse):
if not post_else_tail.is_terminated():
post_else_tail.append(ir.Branch(tail))
else:
else_tail = tail
if node.trip_count is not None:
head.append(ir.Loop(node.trip_count, phi, cond, body, else_tail))
else:
head.append(ir.BranchIf(cond, body, else_tail))
if not post_body.is_terminated():
post_body.append(ir.Branch(continue_block))
break_block.append(ir.Branch(tail))
finally: finally:
self.break_target = old_break self.break_target = old_break
self.continue_target = old_continue self.continue_target = old_continue
if any(node.orelse):
else_tail = self.add_block("for.else")
self.current_block = else_tail
self.visit(node.orelse)
post_else_tail = self.current_block
tail = self.add_block("for.tail")
self.current_block = tail
if any(node.orelse):
if not post_else_tail.is_terminated():
post_else_tail.append(ir.Branch(tail))
else:
else_tail = tail
if node.trip_count is not None:
head.append(ir.Loop(node.trip_count, phi, cond, body, else_tail))
else:
head.append(ir.BranchIf(cond, body, else_tail))
if not post_body.is_terminated():
post_body.append(ir.Branch(continue_block))
break_block.append(ir.Branch(tail))
def visit_Break(self, node): def visit_Break(self, node):
self.append(ir.Branch(self.break_target)) self.append(ir.Branch(self.break_target))
@ -1279,6 +1289,10 @@ class ARTIQIRGenerator(algorithm.Visitor):
return self.append(ir.Select(cond, return self.append(ir.Select(cond,
ir.Constant(False, builtins.TBool()), ir.Constant(False, builtins.TBool()),
ir.Constant(True, builtins.TBool()))) ir.Constant(True, builtins.TBool())))
elif isinstance(node.op, ast.Invert):
operand = self.visit(node.operand)
return self.append(ir.Arith(ast.BitXor(loc=None),
ir.Constant(-1, operand.type), operand))
elif isinstance(node.op, ast.USub): elif isinstance(node.op, ast.USub):
operand = self.visit(node.operand) operand = self.visit(node.operand)
return self.append(ir.Arith(ast.Sub(loc=None), return self.append(ir.Arith(ast.Sub(loc=None),
@ -1309,7 +1323,7 @@ class ARTIQIRGenerator(algorithm.Visitor):
lambda: self.alloc_exn(builtins.TException("ValueError"), lambda: self.alloc_exn(builtins.TException("ValueError"),
ir.Constant("shift amount must be nonnegative", builtins.TStr())), ir.Constant("shift amount must be nonnegative", builtins.TStr())),
loc=node.right.loc) loc=node.right.loc)
elif isinstance(node.op, (ast.Div, ast.FloorDiv)): elif isinstance(node.op, (ast.Div, ast.FloorDiv, ast.Mod)):
self._make_check( self._make_check(
self.append(ir.Compare(ast.NotEq(loc=None), rhs, ir.Constant(0, rhs.type))), self.append(ir.Compare(ast.NotEq(loc=None), rhs, ir.Constant(0, rhs.type))),
lambda: self.alloc_exn(builtins.TException("ZeroDivisionError"), lambda: self.alloc_exn(builtins.TException("ZeroDivisionError"),
@ -1599,7 +1613,8 @@ class ARTIQIRGenerator(algorithm.Visitor):
return self.coerce_to_bool(arg) return self.coerce_to_bool(arg)
else: else:
assert False assert False
elif types.is_builtin(typ, "int"): elif types.is_builtin(typ, "int") or \
types.is_builtin(typ, "int32") or types.is_builtin(typ, "int64"):
if len(node.args) == 0 and len(node.keywords) == 0: if len(node.args) == 0 and len(node.keywords) == 0:
return ir.Constant(0, node.type) return ir.Constant(0, node.type)
elif len(node.args) == 1 and \ elif len(node.args) == 1 and \
@ -1723,7 +1738,7 @@ class ARTIQIRGenerator(algorithm.Visitor):
if len(node.args) == 1 and len(node.keywords) == 0: if len(node.args) == 1 and len(node.keywords) == 0:
arg = self.visit(node.args[0]) arg = self.visit(node.args[0])
arg_mu_float = self.append(ir.Arith(ast.Div(loc=None), arg, self.ref_period)) arg_mu_float = self.append(ir.Arith(ast.Div(loc=None), arg, self.ref_period))
arg_mu = self.append(ir.Coerce(arg_mu_float, builtins.TInt64())) arg_mu = self.append(ir.Builtin("round", [arg_mu_float], builtins.TInt64()))
return self.append(ir.Builtin("delay_mu", [arg_mu], builtins.TNone())) return self.append(ir.Builtin("delay_mu", [arg_mu], builtins.TNone()))
else: else:
assert False assert False

View File

@ -5,6 +5,7 @@
from collections import OrderedDict from collections import OrderedDict
from pythonparser import algorithm, diagnostic, ast from pythonparser import algorithm, diagnostic, ast
from .. import asttyped, types, builtins from .. import asttyped, types, builtins
from .typedtree_printer import TypedtreePrinter
class Inferencer(algorithm.Visitor): class Inferencer(algorithm.Visitor):
""" """
@ -293,7 +294,8 @@ class Inferencer(algorithm.Visitor):
return coerced_node return coerced_node
elif isinstance(coerced_node, asttyped.CoerceT): elif isinstance(coerced_node, asttyped.CoerceT):
node = coerced_node node = coerced_node
node.type, node.other_value = typ, other_node node.type.unify(typ)
node.other_value = other_node
else: else:
node = asttyped.CoerceT(type=typ, value=coerced_node, other_value=other_node, node = asttyped.CoerceT(type=typ, value=coerced_node, other_value=other_node,
loc=coerced_node.loc) loc=coerced_node.loc)
@ -622,14 +624,28 @@ class Inferencer(algorithm.Visitor):
self._unify(node.type, builtins.TBool(), self._unify(node.type, builtins.TBool(),
node.loc, None) node.loc, None)
elif types.is_builtin(typ, "int"): elif types.is_builtin(typ, "int") or \
valid_forms = lambda: [ types.is_builtin(typ, "int32") or types.is_builtin(typ, "int64"):
valid_form("int() -> numpy.int?"), if types.is_builtin(typ, "int"):
valid_form("int(x:'a) -> numpy.int?"), valid_forms = lambda: [
valid_form("int(x:'a, width=?) -> numpy.int?") valid_form("int() -> numpy.int?"),
] valid_form("int(x:'a) -> numpy.int? where 'a is numeric")
]
result_typ = builtins.TInt()
elif types.is_builtin(typ, "int32"):
valid_forms = lambda: [
valid_form("numpy.int32() -> numpy.int32"),
valid_form("numpy.int32(x:'a) -> numpy.int32 where 'a is numeric")
]
result_typ = builtins.TInt32()
elif types.is_builtin(typ, "int64"):
valid_forms = lambda: [
valid_form("numpy.int64() -> numpy.int64"),
valid_form("numpy.int64(x:'a) -> numpy.int64 where 'a is numeric")
]
result_typ = builtins.TInt64()
self._unify(node.type, builtins.TInt(), self._unify(node.type, result_typ,
node.loc, None) node.loc, None)
if len(node.args) == 0 and len(node.keywords) == 0: if len(node.args) == 0 and len(node.keywords) == 0:
@ -639,20 +655,7 @@ class Inferencer(algorithm.Visitor):
pass # undetermined yet pass # undetermined yet
elif len(node.args) == 1 and len(node.keywords) == 0 and \ elif len(node.args) == 1 and len(node.keywords) == 0 and \
builtins.is_numeric(node.args[0].type): builtins.is_numeric(node.args[0].type):
self._unify(node.type, builtins.TInt(), self._unify(node.type, result_typ,
node.loc, None)
elif len(node.args) == 1 and len(node.keywords) == 1 and \
builtins.is_numeric(node.args[0].type) and \
node.keywords[0].arg == 'width':
width = node.keywords[0].value
if not (isinstance(width, asttyped.NumT) and isinstance(width.n, int)):
diag = diagnostic.Diagnostic("error",
"the width argument of int() must be an integer literal", {},
node.keywords[0].loc)
self.engine.process(diag)
return
self._unify(node.type, builtins.TInt(types.TValue(width.n)),
node.loc, None) node.loc, None)
else: else:
diagnose(valid_forms()) diagnose(valid_forms())
@ -1049,22 +1052,10 @@ class Inferencer(algorithm.Visitor):
if coerced: if coerced:
return_type, target_type, value_type = coerced return_type, target_type, value_type = coerced
try: if isinstance(node.value, asttyped.CoerceT):
node.target.type.unify(target_type) orig_value_type = node.value.value.type
except types.UnificationError as e: else:
printer = types.TypePrinter() orig_value_type = node.value.type
note = diagnostic.Diagnostic("note",
"expression of type {typec}",
{"typec": printer.name(node.value.type)},
node.value.loc)
diag = diagnostic.Diagnostic("error",
"expression of type {typea} has to be coerced to {typeb}, "
"which makes assignment invalid",
{"typea": printer.name(node.target.type),
"typeb": printer.name(target_type)},
node.op.loc, [node.target.loc], [note])
self.engine.process(diag)
return
try: try:
node.target.type.unify(return_type) node.target.type.unify(return_type)
@ -1072,17 +1063,34 @@ class Inferencer(algorithm.Visitor):
printer = types.TypePrinter() printer = types.TypePrinter()
note = diagnostic.Diagnostic("note", note = diagnostic.Diagnostic("note",
"expression of type {typec}", "expression of type {typec}",
{"typec": printer.name(node.value.type)}, {"typec": printer.name(orig_value_type)},
node.value.loc) node.value.loc)
diag = diagnostic.Diagnostic("error", diag = diagnostic.Diagnostic("error",
"the result of this operation has type {typeb}, " "the result of this operation has type {typeb}, "
"which makes assignment to a slot of type {typea} invalid", "which cannot be assigned to a left-hand side of type {typea}",
{"typea": printer.name(node.target.type), {"typea": printer.name(node.target.type),
"typeb": printer.name(return_type)}, "typeb": printer.name(return_type)},
node.op.loc, [node.target.loc], [note]) node.op.loc, [node.target.loc], [note])
self.engine.process(diag) self.engine.process(diag)
return return
try:
node.target.type.unify(target_type)
except types.UnificationError as e:
printer = types.TypePrinter()
note = diagnostic.Diagnostic("note",
"expression of type {typec}",
{"typec": printer.name(orig_value_type)},
node.value.loc)
diag = diagnostic.Diagnostic("error",
"this operation requires the left-hand side of type {typea} "
"to be coerced to {typeb}, which cannot be done",
{"typea": printer.name(node.target.type),
"typeb": printer.name(target_type)},
node.op.loc, [node.target.loc], [note])
self.engine.process(diag)
return
node.value = self._coerce_one(value_type, node.value, other_node=node.target) node.value = self._coerce_one(value_type, node.value, other_node=node.target)
def visit_ForT(self, node): def visit_ForT(self, node):

View File

@ -5,7 +5,7 @@ do not.
""" """
from pythonparser import algorithm, diagnostic from pythonparser import algorithm, diagnostic
from .. import types, builtins from .. import types, builtins, asttyped
class IntMonomorphizer(algorithm.Visitor): class IntMonomorphizer(algorithm.Visitor):
def __init__(self, engine): def __init__(self, engine):
@ -35,3 +35,13 @@ class IntMonomorphizer(algorithm.Visitor):
typ = node.type.find() typ = node.type.find()
if types.is_var(typ["width"]): if types.is_var(typ["width"]):
typ["width"].unify(types.TValue(32)) typ["width"].unify(types.TValue(32))
def visit_CoerceT(self, node):
if isinstance(node.value, asttyped.NumT) and \
builtins.is_int(node.type) and \
builtins.is_int(node.value.type) and \
not types.is_var(node.type["width"]) and \
types.is_var(node.value.type["width"]):
node.value.type.unify(node.type)
self.generic_visit(node)

View File

@ -334,6 +334,12 @@ class LLVMIRGenerator:
llty = ll.FunctionType(llptr, []) llty = ll.FunctionType(llptr, [])
elif name == "llvm.stackrestore": elif name == "llvm.stackrestore":
llty = ll.FunctionType(llvoid, [llptr]) llty = ll.FunctionType(llvoid, [llptr])
elif name == "__py_modsi3":
llty = ll.FunctionType(lli32, [lli32, lli32])
elif name == "__py_moddi3":
llty = ll.FunctionType(lli64, [lli64, lli64])
elif name == "__py_moddf3":
llty = ll.FunctionType(lldouble, [lldouble, lldouble])
elif name == self.target.print_function: elif name == self.target.print_function:
llty = ll.FunctionType(llvoid, [llptr], var_arg=True) llty = ll.FunctionType(llvoid, [llptr], var_arg=True)
elif name == "rtio_log": elif name == "rtio_log":
@ -369,11 +375,94 @@ class LLVMIRGenerator:
if name in ("rtio_log", "send_rpc", "watchdog_set", "watchdog_clear", if name in ("rtio_log", "send_rpc", "watchdog_set", "watchdog_clear",
self.target.print_function): self.target.print_function):
llglobal.attributes.add("nounwind") llglobal.attributes.add("nounwind")
if name.find("__py_") == 0:
llglobal.linkage = 'linkonce_odr'
self.emit_intrinsic(name, llglobal)
else: else:
llglobal = ll.GlobalVariable(self.llmodule, llty, name) llglobal = ll.GlobalVariable(self.llmodule, llty, name)
return llglobal return llglobal
def emit_intrinsic(self, name, llfun):
llbuilder = ll.IRBuilder()
llbuilder.position_at_end(llfun.append_basic_block("entry"))
if name == "__py_modsi3" or name == "__py_moddi3":
if name == "__py_modsi3":
llty = lli32
elif name == "__py_moddi3":
llty = lli64
else:
assert False
"""
Reference Objects/intobject.c
xdivy = x / y;
xmody = (long)(x - (unsigned long)xdivy * y);
/* If the signs of x and y differ, and the remainder is non-0,
* C89 doesn't define whether xdivy is now the floor or the
* ceiling of the infinitely precise quotient. We want the floor,
* and we have it iff the remainder's sign matches y's.
*/
if (xmody && ((y ^ xmody) < 0) /* i.e. and signs differ */) {
xmody += y;
// ...
}
"""
llx, lly = llfun.args
llxdivy = llbuilder.sdiv(llx, lly)
llxremy = llbuilder.srem(llx, lly)
llxmodynonzero = llbuilder.icmp_signed('!=', llxremy, ll.Constant(llty, 0))
lldiffsign = llbuilder.icmp_signed('<', llbuilder.xor(llx, lly), ll.Constant(llty, 0))
llcond = llbuilder.and_(llxmodynonzero, lldiffsign)
with llbuilder.if_then(llcond):
llbuilder.ret(llbuilder.add(llxremy, lly))
llbuilder.ret(llxremy)
elif name == "__py_moddf3":
"""
Reference Objects/floatobject.c
mod = fmod(vx, wx);
/* fmod is typically exact, so vx-mod is *mathematically* an
exact multiple of wx. But this is fp arithmetic, and fp
vx - mod is an approximation; the result is that div may
not be an exact integral value after the division, although
it will always be very close to one.
*/
// ...
if (mod) {
/* ensure the remainder has the same sign as the denominator */
if ((wx < 0) != (mod < 0)) {
mod += wx;
// ...
}
}
else {
/* the remainder is zero, and in the presence of signed zeroes
fmod returns different results across platforms; ensure
it has the same sign as the denominator; we'd like to do
"mod = wx * 0.0", but that may get optimized away */
mod *= mod; /* hide "mod = +0" from optimizer */
if (wx < 0.0)
mod = -mod;
}
"""
llv, llw = llfun.args
llrem = llbuilder.frem(llv, llw)
llremnonzero = llbuilder.fcmp_unordered('!=', llrem, ll.Constant(lldouble, 0.0))
llwltzero = llbuilder.fcmp_ordered('<', llw, ll.Constant(lldouble, 0.0))
llremltzero = llbuilder.fcmp_ordered('<', llrem, ll.Constant(lldouble, 0.0))
lldiffsign = llbuilder.icmp_unsigned('!=', llwltzero, llremltzero)
llcond = llbuilder.and_(llremnonzero, lldiffsign)
with llbuilder.if_then(llcond):
llbuilder.ret(llbuilder.fadd(llrem, llw))
llbuilder.ret(llrem)
else:
assert False
def get_function(self, typ, name): def get_function(self, typ, name):
llfun = self.llmodule.get_global(name) llfun = self.llmodule.get_global(name)
if llfun is None: if llfun is None:
@ -849,6 +938,8 @@ class LLVMIRGenerator:
def process_Coerce(self, insn): def process_Coerce(self, insn):
typ, value_typ = insn.type, insn.value().type typ, value_typ = insn.type, insn.value().type
if typ == value_typ:
return self.map(insn.value())
if builtins.is_int(typ) and builtins.is_float(value_typ): if builtins.is_int(typ) and builtins.is_float(value_typ):
return self.llbuilder.fptosi(self.map(insn.value()), self.llty_of_type(typ), return self.llbuilder.fptosi(self.map(insn.value()), self.llty_of_type(typ),
name=insn.name) name=insn.name)
@ -920,22 +1011,15 @@ class LLVMIRGenerator:
return self.llbuilder.sdiv(self.map(insn.lhs()), self.map(insn.rhs()), return self.llbuilder.sdiv(self.map(insn.lhs()), self.map(insn.rhs()),
name=insn.name) name=insn.name)
elif isinstance(insn.op, ast.Mod): elif isinstance(insn.op, ast.Mod):
# Python only has the modulo operator, LLVM only has the remainder lllhs, llrhs = map(self.map, (insn.lhs(), insn.rhs()))
if builtins.is_float(insn.type): if builtins.is_float(insn.type):
llvalue = self.llbuilder.frem(self.map(insn.lhs()), self.map(insn.rhs())) intrinsic = "__py_moddf3"
self.add_fast_math_flags(llvalue) elif builtins.is_int32(insn.type):
return self.llbuilder.call(self.llbuiltin("llvm.copysign.f64"), intrinsic = "__py_modsi3"
[llvalue, self.map(insn.rhs())], elif builtins.is_int64(insn.type):
name=insn.name) intrinsic = "__py_moddi3"
else: return self.llbuilder.call(self.llbuiltin(intrinsic), [lllhs, llrhs],
lllhs, llrhs = map(self.map, (insn.lhs(), insn.rhs())) name=insn.name)
llxorsign = self.llbuilder.and_(self.llbuilder.xor(lllhs, llrhs),
ll.Constant(lllhs.type, 1 << lllhs.type.width - 1))
llnegate = self.llbuilder.icmp_unsigned('!=',
llxorsign, ll.Constant(llxorsign.type, 0))
llvalue = self.llbuilder.srem(lllhs, llrhs)
llnegvalue = self.llbuilder.sub(ll.Constant(llvalue.type, 0), llvalue)
return self.llbuilder.select(llnegate, llnegvalue, llvalue)
elif isinstance(insn.op, ast.Pow): elif isinstance(insn.op, ast.Pow):
if builtins.is_float(insn.type): if builtins.is_float(insn.type):
return self.llbuilder.call(self.llbuiltin("llvm.pow.f64"), return self.llbuilder.call(self.llbuiltin("llvm.pow.f64"),
@ -1252,10 +1336,12 @@ class LLVMIRGenerator:
self.llbuilder.call(self.llbuiltin("llvm.stackrestore"), [llstackptr]) self.llbuilder.call(self.llbuiltin("llvm.stackrestore"), [llstackptr])
# T result = { # T result = {
# void *ptr = NULL; # void *ret_ptr = alloca(sizeof(T));
# loop: int size = rpc_recv("tag", ptr); # void *ptr = ret_ptr;
# loop: int size = recv_rpc(ptr);
# // Non-zero: Provide `size` bytes of extra storage for variable-length data.
# if(size) { ptr = alloca(size); goto loop; } # if(size) { ptr = alloca(size); goto loop; }
# else *(T*)ptr # else *(T*)ret_ptr
# } # }
llprehead = self.llbuilder.basic_block llprehead = self.llbuilder.basic_block
llhead = self.llbuilder.append_basic_block(name="rpc.head") llhead = self.llbuilder.append_basic_block(name="rpc.head")
@ -1270,7 +1356,7 @@ class LLVMIRGenerator:
self.llbuilder.branch(llhead) self.llbuilder.branch(llhead)
self.llbuilder.position_at_end(llhead) self.llbuilder.position_at_end(llhead)
llphi = self.llbuilder.phi(llslotgen.type, name="rpc.size") llphi = self.llbuilder.phi(llslotgen.type, name="rpc.ptr")
llphi.add_incoming(llslotgen, llprehead) llphi.add_incoming(llslotgen, llprehead)
if llunwindblock: if llunwindblock:
llsize = self.llbuilder.invoke(self.llbuiltin("recv_rpc"), [llphi], llsize = self.llbuilder.invoke(self.llbuiltin("recv_rpc"), [llphi],

View File

@ -0,0 +1,89 @@
"""
:class:`TypedtreePrinter` prints a human-readable representation of typedtrees.
"""
from pythonparser import algorithm, ast
from .. import types, asttyped
class TypedtreePrinter(algorithm.Visitor):
def __init__(self):
self.str = None
self.level = None
self.last_nl = None
self.type_printer = None
def print(self, node):
try:
self.str = ""
self.level = 0
self.last_nl = 0
self.type_printer = types.TypePrinter()
self.visit(node)
self._nl()
return self.str
finally:
self.str = None
self.level = None
self.last_nl = 0
self.type_printer = None
def _nl(self):
# self.str += "·"
if len(self.str) != self.last_nl:
self.str += "\n" + (" " * self.level)
self.last_nl = len(self.str)
def _indent(self):
self.level += 1
self._nl()
def _dedent(self):
self._nl()
self.level -= 1
self.str = self.str[:-2]
self.last_nl -= 2
def visit(self, obj):
if isinstance(obj, ast.AST):
attrs = set(obj._fields) - {'ctx'}
if isinstance(obj, asttyped.commontyped):
attrs.update(set(obj._types))
for attr in set(attrs):
if not getattr(obj, attr):
attrs.remove(attr) # omit falsey stuff
self.str += obj.__class__.__name__ + "("
if len(attrs) > 1:
self._indent()
for attr in attrs:
if len(attrs) > 1:
self._nl()
self.str += attr + "="
self.visit(getattr(obj, attr))
if len(attrs) > 1:
self._nl()
if len(attrs) > 1:
self._dedent()
self.str += ")"
elif isinstance(obj, types.Type):
self.str += self.type_printer.name(obj, max_depth=0)
elif isinstance(obj, list):
self.str += "["
if len(obj) > 1:
self._indent()
for elem in obj:
if len(obj) > 1:
self._nl()
self.visit(elem)
if len(obj) > 1:
self._nl()
if len(obj) > 1:
self._dedent()
self.str += "]"
else:
self.str += repr(obj)

View File

@ -194,6 +194,9 @@ class TTuple(Type):
def __ne__(self, other): def __ne__(self, other):
return not (self == other) return not (self == other)
def __hash__(self):
return hash(tuple(self.elts))
class _TPointer(TMono): class _TPointer(TMono):
def __init__(self): def __init__(self):
super().__init__("pointer") super().__init__("pointer")

View File

@ -298,8 +298,8 @@ class EscapeValidator(algorithm.Visitor):
# and exceptions can only refer to strings, so we don't actually check # and exceptions can only refer to strings, so we don't actually check
# this property. But we will need to, if string operations are ever added. # this property. But we will need to, if string operations are ever added.
def visit_assignment(self, target, value, is_aug_assign=False): def visit_assignment(self, target, value):
value_region = self._region_of(value) if not is_aug_assign else self.youngest_region value_region = self._region_of(value)
# If this is a variable, we might need to contract the live range. # If this is a variable, we might need to contract the live range.
if isinstance(value_region, Region): if isinstance(value_region, Region):
@ -316,19 +316,11 @@ class EscapeValidator(algorithm.Visitor):
target_regions = [self._region_of(name) for name in target_names] target_regions = [self._region_of(name) for name in target_names]
for target_region in target_regions: for target_region in target_regions:
if not Region.outlives(value_region, target_region): if not Region.outlives(value_region, target_region):
if is_aug_assign:
target_desc = "the assignment target, allocated here,"
else:
target_desc = "the assignment target"
note = diagnostic.Diagnostic("note",
"this expression has type {type}",
{"type": types.TypePrinter().name(value.type)},
value.loc)
diag = diagnostic.Diagnostic("error", diag = diagnostic.Diagnostic("error",
"the assigned value does not outlive the assignment target", {}, "the assigned value does not outlive the assignment target", {},
value.loc, [target.loc], value.loc, [target.loc],
notes=self._diagnostics_for(target_region, target.loc, notes=self._diagnostics_for(target_region, target.loc,
target_desc) + "the assignment target") +
self._diagnostics_for(value_region, value.loc, self._diagnostics_for(value_region, value.loc,
"the assigned value")) "the assigned value"))
self.engine.process(diag) self.engine.process(diag)
@ -339,9 +331,19 @@ class EscapeValidator(algorithm.Visitor):
def visit_AugAssign(self, node): def visit_AugAssign(self, node):
if builtins.is_allocated(node.target.type): if builtins.is_allocated(node.target.type):
# If the target is mutable, op-assignment will allocate note = diagnostic.Diagnostic("note",
# in the youngest region. "try using `{lhs} = {lhs} {op} {rhs}` instead",
self.visit_assignment(node.target, node.value, is_aug_assign=True) {"lhs": node.target.loc.source(),
"rhs": node.value.loc.source(),
"op": node.op.loc.source()[:-1]},
node.loc)
diag = diagnostic.Diagnostic("error",
"values cannot be mutated in-place", {},
node.op.loc, [node.target.loc],
notes=[note])
self.engine.process(diag)
self.visit_assignment(node.target, node.value)
def visit_Return(self, node): def visit_Return(self, node):
region = self._region_of(node.value) region = self._region_of(node.value)

View File

@ -263,7 +263,7 @@ def _extract_log_chars(data):
n = data >> 24 n = data >> 24
data = (data << 8) & 0xffffffff data = (data << 8) & 0xffffffff
if not n: if not n:
return r continue
r += chr(n) r += chr(n)
return r return r

View File

@ -233,8 +233,7 @@ class CommGeneric:
raise UnsupportedDevice("Unsupported runtime ID: {}" raise UnsupportedDevice("Unsupported runtime ID: {}"
.format(runtime_id)) .format(runtime_id))
gateware_version = self._read_chunk(self._read_length).decode("utf-8") gateware_version = self._read_chunk(self._read_length).decode("utf-8")
if gateware_version != software_version and \ if gateware_version != software_version:
gateware_version + ".dirty" != software_version:
logger.warning("Mismatch between gateware (%s) " logger.warning("Mismatch between gateware (%s) "
"and software (%s) versions", "and software (%s) versions",
gateware_version, software_version) gateware_version, software_version)
@ -396,11 +395,13 @@ class CommGeneric:
lambda: "bool") lambda: "bool")
self._write_int8(value) self._write_int8(value)
elif tag == "i": elif tag == "i":
check(isinstance(value, int) and (-2**31 < value < 2**31-1), check(isinstance(value, (int, numpy.int32)) and
(-2**31 < value < 2**31-1),
lambda: "32-bit int") lambda: "32-bit int")
self._write_int32(value) self._write_int32(value)
elif tag == "I": elif tag == "I":
check(isinstance(value, int) and (-2**63 < value < 2**63-1), check(isinstance(value, (int, numpy.int32, numpy.int64)) and
(-2**63 < value < 2**63-1),
lambda: "64-bit int") lambda: "64-bit int")
self._write_int64(value) self._write_int64(value)
elif tag == "f": elif tag == "f":

View File

@ -81,15 +81,19 @@ class Core:
self.core = self self.core = self
self.comm.core = self self.comm.core = self
def compile(self, function, args, kwargs, set_result=None, with_attr_writeback=True): def compile(self, function, args, kwargs, set_result=None,
attribute_writeback=True, print_as_rpc=True):
try: try:
engine = _DiagnosticEngine(all_errors_are_fatal=True) engine = _DiagnosticEngine(all_errors_are_fatal=True)
stitcher = Stitcher(engine=engine, core=self, dmgr=self.dmgr) stitcher = Stitcher(engine=engine, core=self, dmgr=self.dmgr,
print_as_rpc=print_as_rpc)
stitcher.stitch_call(function, args, kwargs, set_result) stitcher.stitch_call(function, args, kwargs, set_result)
stitcher.finalize() stitcher.finalize()
module = Module(stitcher, ref_period=self.ref_period) module = Module(stitcher,
ref_period=self.ref_period,
attribute_writeback=attribute_writeback)
target = OR1KTarget() target = OR1KTarget()
library = target.compile_and_link([module]) library = target.compile_and_link([module])

View File

@ -1,6 +1,7 @@
from artiq.language.core import * from artiq.language.core import *
from artiq.language.types import * from artiq.language.types import *
from artiq.language.units import * from artiq.language.units import *
from numpy import int64
_PHASE_MODE_DEFAULT = -1 _PHASE_MODE_DEFAULT = -1
@ -111,20 +112,20 @@ class _DDSGeneric:
"""Returns the frequency tuning word corresponding to the given """Returns the frequency tuning word corresponding to the given
frequency. frequency.
""" """
return round(int(2, width=64)**32*frequency/self.core_dds.sysclk) return round(float(int64(2)**32*frequency/self.core_dds.sysclk))
@portable(flags=["fast-math"]) @portable(flags=["fast-math"])
def ftw_to_frequency(self, ftw): def ftw_to_frequency(self, ftw):
"""Returns the frequency corresponding to the given frequency tuning """Returns the frequency corresponding to the given frequency tuning
word. word.
""" """
return ftw*self.core_dds.sysclk/int(2, width=64)**32 return ftw*self.core_dds.sysclk/int64(2)**32
@portable(flags=["fast-math"]) @portable(flags=["fast-math"])
def turns_to_pow(self, turns): def turns_to_pow(self, turns):
"""Returns the phase offset word corresponding to the given phase """Returns the phase offset word corresponding to the given phase
in turns.""" in turns."""
return round(turns*2**self.pow_width) return round(float(turns*2**self.pow_width))
@portable(flags=["fast-math"]) @portable(flags=["fast-math"])
def pow_to_turns(self, pow): def pow_to_turns(self, pow):
@ -135,7 +136,7 @@ class _DDSGeneric:
@portable(flags=["fast-math"]) @portable(flags=["fast-math"])
def amplitude_to_asf(self, amplitude): def amplitude_to_asf(self, amplitude):
"""Returns amplitude scale factor corresponding to given amplitude.""" """Returns amplitude scale factor corresponding to given amplitude."""
return round(amplitude*0x0fff) return round(float(amplitude*0x0fff))
@portable(flags=["fast-math"]) @portable(flags=["fast-math"])
def asf_to_amplitude(self, asf): def asf_to_amplitude(self, asf):

View File

@ -74,7 +74,7 @@ class SPIMaster:
def set_config(self, flags=0, write_freq=20*MHz, read_freq=20*MHz): def set_config(self, flags=0, write_freq=20*MHz, read_freq=20*MHz):
"""Set the configuration register. """Set the configuration register.
* If ``config.cs_polarity`` == 0 (```cs`` active low, the default), * If ``config.cs_polarity`` == 0 (``cs`` active low, the default),
"``cs_n`` all deasserted" means "all ``cs_n`` bits high". "``cs_n`` all deasserted" means "all ``cs_n`` bits high".
* ``cs_n`` is not mandatory in the pads supplied to the gateware core. * ``cs_n`` is not mandatory in the pads supplied to the gateware core.
Framing and chip selection can also be handled independently Framing and chip selection can also be handled independently

View File

@ -7,6 +7,7 @@ from PyQt5 import QtCore, QtWidgets
from artiq.tools import short_format from artiq.tools import short_format
from artiq.gui.tools import LayoutWidget, QRecursiveFilterProxyModel from artiq.gui.tools import LayoutWidget, QRecursiveFilterProxyModel
from artiq.gui.models import DictSyncTreeSepModel from artiq.gui.models import DictSyncTreeSepModel
from artiq.gui.scientific_spinbox import ScientificSpinBox
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -50,10 +51,10 @@ class Editor(QtWidgets.QDialog):
class NumberEditor(Editor): class NumberEditor(Editor):
def get_edit_widget(self, initial_value): def get_edit_widget(self, initial_value):
self.edit_widget = QtWidgets.QDoubleSpinBox() self.edit_widget = ScientificSpinBox()
self.edit_widget.setMinimum(float("-inf")) self.edit_widget.setDecimals(13)
self.edit_widget.setMaximum(float("+inf")) self.edit_widget.setPrecision()
self.edit_widget.setDecimals(8) self.edit_widget.setRelativeStep()
self.edit_widget.setValue(float(initial_value)) self.edit_widget.setValue(float(initial_value))
return self.edit_widget return self.edit_widget

View File

@ -8,7 +8,7 @@ from PyQt5 import QtCore, QtGui, QtWidgets
import h5py import h5py
from artiq.gui.tools import LayoutWidget, log_level_to_name, get_open_file_name from artiq.gui.tools import LayoutWidget, log_level_to_name, get_open_file_name
from artiq.gui.entries import argty_to_entry, ScanEntry from artiq.gui.entries import procdesc_to_entry, ScanEntry
from artiq.protocols import pyon from artiq.protocols import pyon
@ -56,7 +56,7 @@ class _ArgumentEditor(QtWidgets.QTreeWidget):
self.viewport().installEventFilter(_WheelFilter(self.viewport())) self.viewport().installEventFilter(_WheelFilter(self.viewport()))
self._groups = dict() self._groups = dict()
self._arg_to_entry_widgetitem = dict() self._arg_to_widgets = dict()
arguments = self.manager.get_submission_arguments(self.expurl) arguments = self.manager.get_submission_arguments(self.expurl)
@ -68,9 +68,13 @@ class _ArgumentEditor(QtWidgets.QTreeWidget):
gradient.setColorAt(0, self.palette().base().color()) gradient.setColorAt(0, self.palette().base().color())
gradient.setColorAt(1, self.palette().midlight().color()) gradient.setColorAt(1, self.palette().midlight().color())
for name, argument in arguments.items(): for name, argument in arguments.items():
entry = argty_to_entry[argument["desc"]["ty"]](argument) widgets = dict()
self._arg_to_widgets[name] = widgets
entry = procdesc_to_entry(argument["desc"])(argument)
widget_item = QtWidgets.QTreeWidgetItem([name]) widget_item = QtWidgets.QTreeWidgetItem([name])
self._arg_to_entry_widgetitem[name] = entry, widget_item widgets["entry"] = entry
widgets["widget_item"] = widget_item
for col in range(3): for col in range(3):
widget_item.setBackground(col, gradient) widget_item.setBackground(col, gradient)
@ -83,6 +87,7 @@ class _ArgumentEditor(QtWidgets.QTreeWidget):
else: else:
self._get_group(argument["group"]).addChild(widget_item) self._get_group(argument["group"]).addChild(widget_item)
fix_layout = LayoutWidget() fix_layout = LayoutWidget()
widgets["fix_layout"] = fix_layout
fix_layout.addWidget(entry) fix_layout.addWidget(entry)
self.setItemWidget(widget_item, 1, fix_layout) self.setItemWidget(widget_item, 1, fix_layout)
recompute_argument = QtWidgets.QToolButton() recompute_argument = QtWidgets.QToolButton()
@ -97,18 +102,20 @@ class _ArgumentEditor(QtWidgets.QTreeWidget):
tool_buttons = LayoutWidget() tool_buttons = LayoutWidget()
tool_buttons.addWidget(recompute_argument, 1) tool_buttons.addWidget(recompute_argument, 1)
if isinstance(entry, ScanEntry): disable_other_scans = QtWidgets.QToolButton()
disable_other_scans = QtWidgets.QToolButton() widgets["disable_other_scans"] = disable_other_scans
disable_other_scans.setIcon( disable_other_scans.setIcon(
QtWidgets.QApplication.style().standardIcon( QtWidgets.QApplication.style().standardIcon(
QtWidgets.QStyle.SP_DialogResetButton)) QtWidgets.QStyle.SP_DialogResetButton))
disable_other_scans.setToolTip("Disable all other scans in " disable_other_scans.setToolTip("Disable all other scans in "
"this experiment") "this experiment")
disable_other_scans.clicked.connect( disable_other_scans.clicked.connect(
partial(self._disable_other_scans, name)) partial(self._disable_other_scans, name))
tool_buttons.layout.setRowStretch(0, 1) tool_buttons.layout.setRowStretch(0, 1)
tool_buttons.layout.setRowStretch(3, 1) tool_buttons.layout.setRowStretch(3, 1)
tool_buttons.addWidget(disable_other_scans, 2) tool_buttons.addWidget(disable_other_scans, 2)
if not isinstance(entry, ScanEntry):
disable_other_scans.setVisible(False)
self.setItemWidget(widget_item, 2, tool_buttons) self.setItemWidget(widget_item, 2, tool_buttons)
@ -161,28 +168,41 @@ class _ArgumentEditor(QtWidgets.QTreeWidget):
argument = self.manager.get_submission_arguments(self.expurl)[name] argument = self.manager.get_submission_arguments(self.expurl)[name]
procdesc = arginfo[name][0] procdesc = arginfo[name][0]
state = argty_to_entry[procdesc["ty"]].default_state(procdesc) state = procdesc_to_entry(procdesc).default_state(procdesc)
argument["desc"] = procdesc argument["desc"] = procdesc
argument["state"] = state argument["state"] = state
old_entry, widget_item = self._arg_to_entry_widgetitem[name] # Qt needs a setItemWidget() to handle layout correctly,
old_entry.deleteLater() # simply replacing the entry inside the LayoutWidget
# results in a bug.
entry = argty_to_entry[procdesc["ty"]](argument) widgets = self._arg_to_widgets[name]
self._arg_to_entry_widgetitem[name] = entry, widget_item
self.setItemWidget(widget_item, 1, entry) widgets["entry"].deleteLater()
widgets["entry"] = procdesc_to_entry(procdesc)(argument)
widgets["disable_other_scans"].setVisible(
isinstance(widgets["entry"], ScanEntry))
widgets["fix_layout"].deleteLater()
widgets["fix_layout"] = LayoutWidget()
widgets["fix_layout"].addWidget(widgets["entry"])
self.setItemWidget(widgets["widget_item"], 1, widgets["fix_layout"])
self.updateGeometries()
def _disable_other_scans(self, current_name): def _disable_other_scans(self, current_name):
for name, (entry, _) in self._arg_to_entry_widgetitem.items(): for name, widgets in self._arg_to_widgets.items():
if name != current_name and isinstance(entry, ScanEntry): if (name != current_name
entry.disable() and isinstance(widgets["entry"], ScanEntry)):
widgets["entry"].disable()
def save_state(self): def save_state(self):
expanded = [] expanded = []
for k, v in self._groups.items(): for k, v in self._groups.items():
if v.isExpanded(): if v.isExpanded():
expanded.append(k) expanded.append(k)
return {"expanded": expanded} return {
"expanded": expanded,
"scroll": self.verticalScrollBar().value()
}
def restore_state(self, state): def restore_state(self, state):
for e in state["expanded"]: for e in state["expanded"]:
@ -190,6 +210,7 @@ class _ArgumentEditor(QtWidgets.QTreeWidget):
self._groups[e].setExpanded(True) self._groups[e].setExpanded(True)
except KeyError: except KeyError:
pass pass
self.verticalScrollBar().setValue(state["scroll"])
log_levels = ["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"] log_levels = ["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"]
@ -445,6 +466,7 @@ class ExperimentManager:
self.schedule_ctl = schedule_ctl self.schedule_ctl = schedule_ctl
self.experiment_db_ctl = experiment_db_ctl self.experiment_db_ctl = experiment_db_ctl
self.dock_states = dict()
self.submission_scheduling = dict() self.submission_scheduling = dict()
self.submission_options = dict() self.submission_options = dict()
self.submission_arguments = dict() self.submission_arguments = dict()
@ -502,7 +524,7 @@ class ExperimentManager:
def initialize_submission_arguments(self, expurl, arginfo): def initialize_submission_arguments(self, expurl, arginfo):
arguments = OrderedDict() arguments = OrderedDict()
for name, (procdesc, group) in arginfo.items(): for name, (procdesc, group) in arginfo.items():
state = argty_to_entry[procdesc["ty"]].default_state(procdesc) state = procdesc_to_entry(procdesc).default_state(procdesc)
arguments[name] = { arguments[name] = {
"desc": procdesc, "desc": procdesc,
"group": group, "group": group,
@ -536,12 +558,22 @@ class ExperimentManager:
del self.submission_arguments[expurl] del self.submission_arguments[expurl]
dock = _ExperimentDock(self, expurl) dock = _ExperimentDock(self, expurl)
self.open_experiments[expurl] = dock self.open_experiments[expurl] = dock
dock.setAttribute(QtCore.Qt.WA_DeleteOnClose)
self.main_window.centralWidget().addSubWindow(dock) self.main_window.centralWidget().addSubWindow(dock)
dock.show() dock.show()
dock.sigClosed.connect(partial(self.on_dock_closed, expurl)) dock.sigClosed.connect(partial(self.on_dock_closed, expurl))
if expurl in self.dock_states:
try:
dock.restore_state(self.dock_states[expurl])
except:
logger.warning("Failed to restore dock state when opening "
"experiment %s", expurl,
exc_info=True)
return dock return dock
def on_dock_closed(self, expurl): def on_dock_closed(self, expurl):
dock = self.open_experiments[expurl]
self.dock_states[expurl] = dock.save_state()
del self.open_experiments[expurl] del self.open_experiments[expurl]
async def _submit_task(self, expurl, *args): async def _submit_task(self, expurl, *args):
@ -556,7 +588,7 @@ class ExperimentManager:
argument_values = dict() argument_values = dict()
for name, argument in arguments.items(): for name, argument in arguments.items():
entry_cls = argty_to_entry[argument["desc"]["ty"]] entry_cls = procdesc_to_entry(argument["desc"])
argument_values[name] = entry_cls.state_to_value(argument["state"]) argument_values[name] = entry_cls.state_to_value(argument["state"])
expid = { expid = {
@ -606,6 +638,8 @@ class ExperimentManager:
file, class_name, use_repository = self.resolve_expurl(expurl) file, class_name, use_repository = self.resolve_expurl(expurl)
if use_repository: if use_repository:
revision = self.get_submission_options(expurl)["repo_rev"] revision = self.get_submission_options(expurl)["repo_rev"]
else:
revision = None
description = await self.experiment_db_ctl.examine( description = await self.experiment_db_ctl.examine(
file, use_repository, revision) file, use_repository, revision)
return description[class_name]["arginfo"] return description[class_name]["arginfo"]
@ -620,21 +654,22 @@ class ExperimentManager:
self.open_experiment(expurl) self.open_experiment(expurl)
def save_state(self): def save_state(self):
docks = {expurl: dock.save_state() for expurl, dock in self.open_experiments.items():
for expurl, dock in self.open_experiments.items()} self.dock_states[expurl] = dock.save_state()
return { return {
"scheduling": self.submission_scheduling, "scheduling": self.submission_scheduling,
"options": self.submission_options, "options": self.submission_options,
"arguments": self.submission_arguments, "arguments": self.submission_arguments,
"docks": docks "docks": self.dock_states,
"open_docks": set(self.open_experiments.keys())
} }
def restore_state(self, state): def restore_state(self, state):
if self.open_experiments: if self.open_experiments:
raise NotImplementedError raise NotImplementedError
self.dock_states = state["docks"]
self.submission_scheduling = state["scheduling"] self.submission_scheduling = state["scheduling"]
self.submission_options = state["options"] self.submission_options = state["options"]
self.submission_arguments = state["arguments"] self.submission_arguments = state["arguments"]
for expurl, dock_state in state["docks"].items(): for expurl in state["open_docks"]:
dock = self.open_experiment(expurl) self.open_experiment(expurl)
dock.restore_state(dock_state)

View File

@ -207,6 +207,10 @@ class _DeviceManager:
widget = None widget = None
if v["module"] == "artiq.coredevice.ttl": if v["module"] == "artiq.coredevice.ttl":
channel = v["arguments"]["channel"] channel = v["arguments"]["channel"]
if channel > 63:
# The moninj protocol is limited to 64 channels; ignore
# any beyond that for now to avoid confusion.
return
force_out = v["class"] == "TTLOut" force_out = v["class"] == "TTLOut"
widget = _TTLWidget( widget = _TTLWidget(
channel, self.send_to_device, force_out, k) channel, self.send_to_device, force_out, k)

View File

@ -177,7 +177,8 @@ class Novatech409B:
"00989680 2000 01F5 0000 00000000 00000000 000301", "00989680 2000 01F5 0000 00000000 00000000 000301",
"80 BC0000 0000 0102 21"] "80 BC0000 0000 0102 21"]
else: else:
self.port.reset_input_buffer() self.port.ser.reset_input_buffer()
result = []
await self.port.write(("QUE" + "\r\n").encode()) await self.port.write(("QUE" + "\r\n").encode())
for i in range(5): for i in range(5):
m = (await self._ser_readline()).rstrip().decode() m = (await self._ser_readline()).rstrip().decode()

View File

@ -13,6 +13,7 @@ from prettytable import PrettyTable
from artiq.protocols.pc_rpc import Client from artiq.protocols.pc_rpc import Client
from artiq.protocols.sync_struct import Subscriber from artiq.protocols.sync_struct import Subscriber
from artiq.protocols.broadcast import Receiver
from artiq.protocols import pyon from artiq.protocols import pyon
from artiq.tools import short_format from artiq.tools import short_format
@ -236,8 +237,6 @@ def _show_datasets(datasets):
def _run_subscriber(host, port, subscriber): def _run_subscriber(host, port, subscriber):
if port is None:
port = 3250
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()
try: try:
loop.run_until_complete(subscriber.connect(host, port)) loop.run_until_complete(subscriber.connect(host, port))
@ -259,7 +258,8 @@ def _show_dict(args, notifier_name, display_fun):
return d return d
subscriber = Subscriber(notifier_name, init_d, subscriber = Subscriber(notifier_name, init_d,
lambda mod: display_fun(d)) lambda mod: display_fun(d))
_run_subscriber(args.server, args.port, subscriber) port = 3250 if args.port is None else args.port
_run_subscriber(args.server, port, subscriber)
def _print_log_record(record): def _print_log_record(record):
@ -268,30 +268,10 @@ def _print_log_record(record):
print(level, source, t, message) print(level, source, t, message)
class _LogPrinter:
def __init__(self, init):
for record in init:
_print_log_record(record)
def append(self, record):
_print_log_record(record)
def insert(self, i, record):
_print_log_record(record)
def pop(self, i=-1):
pass
def __delitem__(self, x):
pass
def __setitem__(self, k, v):
pass
def _show_log(args): def _show_log(args):
subscriber = Subscriber("log", _LogPrinter) subscriber = Receiver("log", [_print_log_record])
_run_subscriber(args.server, args.port, subscriber) port = 1067 if args.port is None else args.port
_run_subscriber(args.server, port, subscriber)
def main(): def main():

View File

@ -55,7 +55,7 @@ def main():
object_map, kernel_library, _, _ = \ object_map, kernel_library, _, _ = \
core.compile(exp.run, [exp_inst], {}, core.compile(exp.run, [exp_inst], {},
with_attr_writeback=False) attribute_writeback=False, print_as_rpc=False)
except CompileError as error: except CompileError as error:
return return
finally: finally:

View File

@ -11,12 +11,14 @@ from artiq import __artiq_dir__ as artiq_dir
from artiq.frontend.bit2bin import bit2bin from artiq.frontend.bit2bin import bit2bin
scripts_path = ["share", "openocd", "scripts"] def scripts_path():
if os.name == "nt": p = ["share", "openocd", "scripts"]
scripts_path.insert(0, "Library") if os.name == "nt":
scripts_path = os.path.abspath(os.path.join( p.insert(0, "Library")
os.path.dirname(shutil.which("openocd")), p = os.path.abspath(os.path.join(
"..", *scripts_path)) os.path.dirname(shutil.which("openocd")),
"..", *p))
return p
def get_argparser(): def get_argparser():
@ -139,7 +141,7 @@ def main():
target_file = opts.target_file target_file = opts.target_file
subprocess.check_call([ subprocess.check_call([
"openocd", "openocd",
"-s", scripts_path, "-s", scripts_path(),
"-f", target_file, "-f", target_file,
"-c", "; ".join(prog), "-c", "; ".join(prog),
]) ])

View File

@ -1,22 +1,7 @@
#!/usr/bin/env python3.5 #!/usr/bin/env python3.5
# Copyright 2014-2015 Robert Jordens <jordens@gmail.com> # Copyright 2014-2017 Robert Jordens <jordens@gmail.com>
# after # after
# https://github.com/mfischer/fpgadev-zynq/blob/master/top/python/bit_to_zynq_bin.py # https://github.com/mfischer/fpgadev-zynq/blob/master/top/python/bit_to_zynq_bin.py
#
# This file is part of redpid.
#
# redpid is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# redpid is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with redpid. If not, see <http://www.gnu.org/licenses/>.
import struct import struct

View File

@ -5,6 +5,7 @@
import argparse import argparse
import logging import logging
import sys import sys
import os
import asyncio import asyncio
from artiq.devices.novatech409b.driver import Novatech409B from artiq.devices.novatech409b.driver import Novatech409B
@ -33,6 +34,9 @@ def main():
args = get_argparser().parse_args() args = get_argparser().parse_args()
init_logger(args) init_logger(args)
if os.name == "nt":
asyncio.set_event_loop(asyncio.ProactorEventLoop())
if not args.simulation and args.device is None: if not args.simulation and args.device is None:
print("You need to specify either --simulation or -d/--device " print("You need to specify either --simulation or -d/--device "
"argument. Use --help for more information.") "argument. Use --help for more information.")

View File

@ -1,73 +0,0 @@
#!/usr/bin/python
# Copyright (C) 2012-2015 Robert Jordens <jordens@gmail.com>
import argparse
from scipy import interpolate
import numpy as np
from artiq.protocols.pc_rpc import Client
from artiq.tools import verbosity_args, init_logger
def get_argparser():
parser = argparse.ArgumentParser(description="""PDQ2 client.
Evaluates times and voltages, interpolates and uploads
them to the controller.""")
parser.add_argument("-s", "--server", default="::1",
help="hostname or IP of the controller to connect to")
parser.add_argument("--port", default=3252, type=int,
help="TCP port to use to connect to the controller")
parser.add_argument("-c", "--channel", default=0, type=int,
help="channel: 3*board_num+dac_num [%(default)s]")
parser.add_argument("-f", "--frame", default=0, type=int,
help="frame [%(default)s]")
parser.add_argument("-t", "--times", default="np.arange(5)*1e-6",
help="sample times (s) [%(default)s]")
parser.add_argument("-u", "--voltages",
default="(1-np.cos(t/t[-1]*2*np.pi))/2",
help="sample voltages (V) [%(default)s]")
parser.add_argument("-o", "--order", default=3, type=int,
help="interpolation (0: const, 1: lin, 2: quad,"
" 3: cubic) [%(default)s]")
parser.add_argument("-e", "--free", default=False, action="store_true",
help="software trigger [%(default)s]")
verbosity_args(parser)
return parser
def main():
args = get_argparser().parse_args()
init_logger(args)
dev = Client(args.server, args.port, "pdq2")
freq = dev.get_freq()
times = np.around(eval(args.times, globals(), {})*freq)
voltages = eval(args.voltages, globals(), dict(t=times/freq))
dt = np.diff(times.astype(np.int))
if args.order:
tck = interpolate.splrep(times, voltages, k=args.order, s=0)
u = interpolate.spalde(times, tck)
else:
u = voltages[:, None]
segment = []
for dti, ui in zip(dt, u):
segment.append({
"duration": int(dti),
"channel_data": [{
"bias": {
"amplitude": [float(uij) for uij in ui]
}
}]
})
program = [[] for i in range(args.frame)]
program.append(segment)
dev.park()
dev.program(program, [args.channel])
dev.unpark()
dev.cmd("TRIGGER", args.free)
if __name__ == "__main__":
main()

View File

@ -2,6 +2,8 @@
import argparse import argparse
import sys import sys
import os
import asyncio
from artiq.devices.thorlabs_tcube.driver import Tdc, Tpz, TdcSim, TpzSim from artiq.devices.thorlabs_tcube.driver import Tdc, Tpz, TdcSim, TpzSim
from artiq.protocols.pc_rpc import simple_server_loop from artiq.protocols.pc_rpc import simple_server_loop
@ -28,6 +30,9 @@ def main():
args = get_argparser().parse_args() args = get_argparser().parse_args()
init_logger(args) init_logger(args)
if os.name == "nt":
asyncio.set_event_loop(asyncio.ProactorEventLoop())
if not args.simulation and args.device is None: if not args.simulation and args.device is None:
print("You need to specify either --simulation or -d/--device " print("You need to specify either --simulation or -d/--device "
"argument. Use --help for more information.") "argument. Use --help for more information.")

View File

@ -153,8 +153,8 @@ class _OutputManager(Module):
# Note: replace may be asserted at the same time as collision # Note: replace may be asserted at the same time as collision
# when addresses are different. In that case, it is a collision. # when addresses are different. In that case, it is a collision.
self.sync.rsys += replace.eq(self.ev.timestamp == buf.timestamp) self.sync.rsys += replace.eq(self.ev.timestamp == buf.timestamp)
# Detect sequence errors on coarse timestamps only # Detect sequence errors on coarse timestamps only
# so that they are mutually exclusive with collision errors. # so that they are mutually exclusive with collision errors.
self.sync.rsys += sequence_error.eq(self.ev.timestamp[fine_ts_width:] < self.sync.rsys += sequence_error.eq(self.ev.timestamp[fine_ts_width:] <
buf.timestamp[fine_ts_width:]) buf.timestamp[fine_ts_width:])
if interface.enable_replace: if interface.enable_replace:
@ -167,6 +167,9 @@ class _OutputManager(Module):
(self.ev.timestamp[fine_ts_width:] == buf.timestamp[fine_ts_width:]) (self.ev.timestamp[fine_ts_width:] == buf.timestamp[fine_ts_width:])
& ((self.ev.timestamp[:fine_ts_width] != buf.timestamp[:fine_ts_width]) & ((self.ev.timestamp[:fine_ts_width] != buf.timestamp[:fine_ts_width])
|different_addresses)) |different_addresses))
else:
self.sync.rsys += collision.eq(
(self.ev.timestamp == buf.timestamp) & different_addresses)
else: else:
self.sync.rsys += collision.eq( self.sync.rsys += collision.eq(
self.ev.timestamp[fine_ts_width:] == buf.timestamp[fine_ts_width:]) self.ev.timestamp[fine_ts_width:] == buf.timestamp[fine_ts_width:])

View File

@ -1,163 +1,8 @@
from itertools import product from itertools import product
from migen import * from migen import *
from migen.genlib.fsm import FSM, NextState
from misoc.interconnect import wishbone from misoc.interconnect import wishbone
from misoc.cores.spi.core import SPIMachine
class SPIClockGen(Module):
def __init__(self, width):
self.load = Signal(width)
self.bias = Signal() # bias this clock phase to longer times
self.edge = Signal()
self.clk = Signal(reset=1)
cnt = Signal.like(self.load)
bias = Signal()
zero = Signal()
self.comb += [
zero.eq(cnt == 0),
self.edge.eq(zero & ~bias),
]
self.sync += [
If(zero,
bias.eq(0),
).Else(
cnt.eq(cnt - 1),
),
If(self.edge,
cnt.eq(self.load[1:]),
bias.eq(self.load[0] & (self.clk ^ self.bias)),
self.clk.eq(~self.clk),
)
]
class SPIRegister(Module):
def __init__(self, width):
self.data = Signal(width)
self.o = Signal()
self.i = Signal()
self.lsb = Signal()
self.shift = Signal()
self.sample = Signal()
self.comb += [
self.o.eq(Mux(self.lsb, self.data[0], self.data[-1])),
]
self.sync += [
If(self.shift,
If(self.lsb,
self.data[:-1].eq(self.data[1:]),
).Else(
self.data[1:].eq(self.data[:-1]),
)
),
If(self.sample,
If(self.lsb,
self.data[-1].eq(self.i),
).Else(
self.data[0].eq(self.i),
)
)
]
class SPIBitCounter(Module):
def __init__(self, width):
self.n_read = Signal(width)
self.n_write = Signal(width)
self.read = Signal()
self.write = Signal()
self.done = Signal()
self.comb += [
self.write.eq(self.n_write != 0),
self.read.eq(self.n_read != 0),
self.done.eq(~(self.write | self.read)),
]
self.sync += [
If(self.write,
self.n_write.eq(self.n_write - 1),
).Elif(self.read,
self.n_read.eq(self.n_read - 1),
)
]
class SPIMachine(Module):
def __init__(self, data_width, clock_width, bits_width):
ce = CEInserter()
self.submodules.cg = ce(SPIClockGen(clock_width))
self.submodules.reg = ce(SPIRegister(data_width))
self.submodules.bits = ce(SPIBitCounter(bits_width))
self.div_write = Signal.like(self.cg.load)
self.div_read = Signal.like(self.cg.load)
self.clk_phase = Signal()
self.start = Signal()
self.cs = Signal()
self.oe = Signal()
self.done = Signal()
# # #
fsm = CEInserter()(FSM("IDLE"))
self.submodules += fsm
fsm.act("IDLE",
If(self.start,
If(self.clk_phase,
NextState("WAIT"),
).Else(
NextState("SETUP"),
)
)
)
fsm.act("SETUP",
self.reg.sample.eq(1),
NextState("HOLD"),
)
fsm.act("HOLD",
If(self.bits.done & ~self.start,
If(self.clk_phase,
NextState("IDLE"),
).Else(
NextState("WAIT"),
)
).Else(
self.reg.shift.eq(~self.start),
NextState("SETUP"),
)
)
fsm.act("WAIT",
If(self.bits.done,
NextState("IDLE"),
).Else(
NextState("SETUP"),
)
)
write0 = Signal()
self.sync += [
If(self.cg.edge & self.reg.shift,
write0.eq(self.bits.write),
)
]
self.comb += [
self.cg.ce.eq(self.start | self.cs | ~self.cg.edge),
If(self.bits.write | ~self.bits.read,
self.cg.load.eq(self.div_write),
).Else(
self.cg.load.eq(self.div_read),
),
self.cg.bias.eq(self.clk_phase),
fsm.ce.eq(self.cg.edge),
self.cs.eq(~fsm.ongoing("IDLE")),
self.reg.ce.eq(self.cg.edge),
self.bits.ce.eq(self.cg.edge & self.reg.sample),
self.done.eq(self.cg.edge & self.bits.done & fsm.ongoing("HOLD")),
self.oe.eq(write0 | self.bits.write),
]
class SPIMaster(Module): class SPIMaster(Module):
@ -293,7 +138,7 @@ class SPIMaster(Module):
assert len(xfer) <= len(bus.dat_w) assert len(xfer) <= len(bus.dat_w)
self.submodules.spi = spi = SPIMachine( self.submodules.spi = spi = SPIMachine(
data_width=len(bus.dat_w), data_width=len(bus.dat_w) + 1,
clock_width=len(config.div_read), clock_width=len(config.div_read),
bits_width=len(xfer.read_length)) bits_width=len(xfer.read_length))
@ -311,13 +156,18 @@ class SPIMaster(Module):
] ]
self.sync += [ self.sync += [
If(spi.done, If(spi.done,
data_read.eq(spi.reg.data), data_read.eq(
Mux(spi.reg.lsb, spi.reg.data[1:], spi.reg.data[:-1])),
), ),
If(spi.start, If(spi.start,
cs.eq(xfer.cs), cs.eq(xfer.cs),
spi.bits.n_write.eq(xfer.write_length), spi.bits.n_write.eq(xfer.write_length),
spi.bits.n_read.eq(xfer.read_length), spi.bits.n_read.eq(xfer.read_length),
spi.reg.data.eq(data_write), If(spi.reg.lsb,
spi.reg.data[:-1].eq(data_write),
).Else(
spi.reg.data[1:].eq(data_write),
),
pending.eq(0), pending.eq(0),
), ),
# wb.ack a transaction if any of the following: # wb.ack a transaction if any of the following:

View File

@ -248,16 +248,16 @@ class NIST_CLOCK(_NIST_Ions):
if i % 4 == 3: if i % 4 == 3:
phy = ttl_serdes_7series.Inout_8X(platform.request("ttl", i)) phy = ttl_serdes_7series.Inout_8X(platform.request("ttl", i))
self.submodules += phy self.submodules += phy
rtio_channels.append(rtio.Channel.from_phy(phy, ififo_depth=512)) rtio_channels.append(rtio.Channel.from_phy(phy, ififo_depth=1024))
else: else:
phy = ttl_serdes_7series.Output_8X(platform.request("ttl", i)) phy = ttl_serdes_7series.Output_8X(platform.request("ttl", i))
self.submodules += phy self.submodules += phy
rtio_channels.append(rtio.Channel.from_phy(phy)) rtio_channels.append(rtio.Channel.from_phy(phy, ofifo_depth=1024))
for i in range(2): for i in range(2):
phy = ttl_serdes_7series.Inout_8X(platform.request("pmt", i)) phy = ttl_serdes_7series.Inout_8X(platform.request("pmt", i))
self.submodules += phy self.submodules += phy
rtio_channels.append(rtio.Channel.from_phy(phy, ififo_depth=512)) rtio_channels.append(rtio.Channel.from_phy(phy, ififo_depth=16384))
phy = ttl_serdes_7series.Inout_8X(platform.request("user_sma_gpio_n_33")) phy = ttl_serdes_7series.Inout_8X(platform.request("user_sma_gpio_n_33"))
self.submodules += phy self.submodules += phy
@ -297,7 +297,7 @@ class NIST_CLOCK(_NIST_Ions):
phy = dds.AD9914(platform.request("dds"), 11, onehot=True) phy = dds.AD9914(platform.request("dds"), 11, onehot=True)
self.submodules += phy self.submodules += phy
rtio_channels.append(rtio.Channel.from_phy(phy, rtio_channels.append(rtio.Channel.from_phy(phy,
ofifo_depth=512, ofifo_depth=16384,
ififo_depth=4)) ififo_depth=4))
self.config["RTIO_LOG_CHANNEL"] = len(rtio_channels) self.config["RTIO_LOG_CHANNEL"] = len(rtio_channels)

View File

@ -176,7 +176,7 @@ trce -v 12 -fastpaths -tsi {build_name}.tsi -o {build_name}.twr {build_name}.ncd
phy = ttl_serdes_spartan6.Inout_4X(platform.request("pmt", i), phy = ttl_serdes_spartan6.Inout_4X(platform.request("pmt", i),
self.rtio_crg.rtiox4_stb) self.rtio_crg.rtiox4_stb)
self.submodules += phy self.submodules += phy
rtio_channels.append(rtio.Channel.from_phy(phy, ififo_depth=256, rtio_channels.append(rtio.Channel.from_phy(phy, ififo_depth=128,
ofifo_depth=4)) ofifo_depth=4))
# the last TTL is used for ClockGen # the last TTL is used for ClockGen
@ -223,7 +223,7 @@ trce -v 12 -fastpaths -tsi {build_name}.tsi -o {build_name}.twr {build_name}.ncd
phy = dds.AD9858(dds_pins, 8) phy = dds.AD9858(dds_pins, 8)
self.submodules += phy self.submodules += phy
rtio_channels.append(rtio.Channel.from_phy(phy, rtio_channels.append(rtio.Channel.from_phy(phy,
ofifo_depth=256, ofifo_depth=128,
ififo_depth=4)) ififo_depth=4))
self.config["RTIO_LOG_CHANNEL"] = len(rtio_channels) self.config["RTIO_LOG_CHANNEL"] = len(rtio_channels)

View File

@ -81,13 +81,14 @@ class AppletIPCServer(AsyncioParentComm):
finally: finally:
self.datasets_sub.notify_cbs.remove(self._on_mod) self.datasets_sub.notify_cbs.remove(self._on_mod)
def start(self, embed_cb, fix_initial_size_cb): def start_server(self, embed_cb, fix_initial_size_cb):
self.server_task = asyncio.ensure_future( self.server_task = asyncio.ensure_future(
self.serve(embed_cb, fix_initial_size_cb)) self.serve(embed_cb, fix_initial_size_cb))
async def stop(self): async def stop_server(self):
self.server_task.cancel() if hasattr(self, "server_task"):
await asyncio.wait([self.server_task]) self.server_task.cancel()
await asyncio.wait([self.server_task])
class _AppletDock(QDockWidgetCloseDetect): class _AppletDock(QDockWidgetCloseDetect):
@ -137,13 +138,14 @@ class _AppletDock(QDockWidgetCloseDetect):
except: except:
logger.warning("Applet %s failed to start", self.applet_name, logger.warning("Applet %s failed to start", self.applet_name,
exc_info=True) exc_info=True)
return
asyncio.ensure_future( asyncio.ensure_future(
LogParser(self._get_log_source).stream_task( LogParser(self._get_log_source).stream_task(
self.ipc.process.stdout)) self.ipc.process.stdout))
asyncio.ensure_future( asyncio.ensure_future(
LogParser(self._get_log_source).stream_task( LogParser(self._get_log_source).stream_task(
self.ipc.process.stderr)) self.ipc.process.stderr))
self.ipc.start(self.embed, self.fix_initial_size) self.ipc.start_server(self.embed, self.fix_initial_size)
finally: finally:
self.starting_stopping = False self.starting_stopping = False
@ -165,18 +167,19 @@ class _AppletDock(QDockWidgetCloseDetect):
self.starting_stopping = True self.starting_stopping = True
if hasattr(self, "ipc"): if hasattr(self, "ipc"):
await self.ipc.stop() await self.ipc.stop_server()
self.ipc.write_pyon({"action": "terminate"}) if hasattr(self.ipc, "process"):
try: self.ipc.write_pyon({"action": "terminate"})
await asyncio.wait_for(self.ipc.process.wait(), 2.0)
except:
logger.warning("Applet %s failed to exit, killing",
self.applet_name)
try: try:
self.ipc.process.kill() await asyncio.wait_for(self.ipc.process.wait(), 2.0)
except ProcessLookupError: except:
pass logger.warning("Applet %s failed to exit, killing",
await self.ipc.process.wait() self.applet_name)
try:
self.ipc.process.kill()
except ProcessLookupError:
pass
await self.ipc.process.wait()
del self.ipc del self.ipc
if hasattr(self, "embed_widget"): if hasattr(self, "embed_widget"):

View File

@ -69,7 +69,41 @@ class EnumerationEntry(QtWidgets.QComboBox):
return procdesc["choices"][0] return procdesc["choices"][0]
class NumberEntry(ScientificSpinBox): class NumberEntryInt(QtWidgets.QSpinBox):
def __init__(self, argument):
QtWidgets.QSpinBox.__init__(self)
disable_scroll_wheel(self)
procdesc = argument["desc"]
self.setSingleStep(procdesc["step"])
if procdesc["min"] is not None:
self.setMinimum(procdesc["min"])
else:
self.setMinimum(-((1 << 31) - 1))
if procdesc["max"] is not None:
self.setMaximum(procdesc["max"])
else:
self.setMaximum((1 << 31) - 1)
if procdesc["unit"]:
self.setSuffix(" " + procdesc["unit"])
self.setValue(argument["state"])
def update(value):
argument["state"] = value
self.valueChanged.connect(update)
@staticmethod
def state_to_value(state):
return state
@staticmethod
def default_state(procdesc):
if "default" in procdesc:
return procdesc["default"]
else:
return 0
class NumberEntryFloat(ScientificSpinBox):
def __init__(self, argument): def __init__(self, argument):
ScientificSpinBox.__init__(self) ScientificSpinBox.__init__(self)
disable_scroll_wheel(self) disable_scroll_wheel(self)
@ -136,6 +170,19 @@ class _NoScan(LayoutWidget):
state["value"] = value*scale state["value"] = value*scale
self.value.valueChanged.connect(update) self.value.valueChanged.connect(update)
self.repetitions = QtWidgets.QSpinBox()
self.repetitions.setMinimum(1)
self.repetitions.setMaximum((1 << 31) - 1)
disable_scroll_wheel(self.repetitions)
self.addWidget(QtWidgets.QLabel("Repetitions:"), 1, 0)
self.addWidget(self.repetitions, 1, 1)
self.repetitions.setValue(state["repetitions"])
def update_repetitions(value):
state["repetitions"] = value
self.repetitions.valueChanged.connect(update_repetitions)
class _RangeScan(LayoutWidget): class _RangeScan(LayoutWidget):
def __init__(self, procdesc, state): def __init__(self, procdesc, state):
@ -272,6 +319,7 @@ class ScanEntry(LayoutWidget):
def disable(self): def disable(self):
self.radiobuttons["NoScan"].setChecked(True) self.radiobuttons["NoScan"].setChecked(True)
self.widgets["NoScan"].repetitions.setValue(1)
@staticmethod @staticmethod
def state_to_value(state): def state_to_value(state):
@ -285,7 +333,7 @@ class ScanEntry(LayoutWidget):
scale = procdesc["scale"] scale = procdesc["scale"]
state = { state = {
"selected": "NoScan", "selected": "NoScan",
"NoScan": {"value": 0.0}, "NoScan": {"value": 0.0, "repetitions": 1},
"LinearScan": {"start": 0.0, "stop": 100.0*scale, "npoints": 10}, "LinearScan": {"start": 0.0, "stop": 100.0*scale, "npoints": 10},
"RandomScan": {"start": 0.0, "stop": 100.0*scale, "npoints": 10}, "RandomScan": {"start": 0.0, "stop": 100.0*scale, "npoints": 10},
"ExplicitScan": {"sequence": []} "ExplicitScan": {"sequence": []}
@ -299,6 +347,7 @@ class ScanEntry(LayoutWidget):
ty = default["ty"] ty = default["ty"]
if ty == "NoScan": if ty == "NoScan":
state[ty]["value"] = default["value"] state[ty]["value"] = default["value"]
state[ty]["repetitions"] = default["repetitions"]
elif ty == "LinearScan" or ty == "RandomScan": elif ty == "LinearScan" or ty == "RandomScan":
state[ty]["start"] = default["start"] state[ty]["start"] = default["start"]
state[ty]["stop"] = default["stop"] state[ty]["stop"] = default["stop"]
@ -317,11 +366,21 @@ class ScanEntry(LayoutWidget):
break break
argty_to_entry = { def procdesc_to_entry(procdesc):
"PYONValue": StringEntry, ty = procdesc["ty"]
"BooleanValue": BooleanEntry, if ty == "NumberValue":
"EnumerationValue": EnumerationEntry, is_int = (procdesc["ndecimals"] == 0
"NumberValue": NumberEntry, and int(procdesc["step"]) == procdesc["step"]
"StringValue": StringEntry, and procdesc["scale"] == 1)
"Scannable": ScanEntry if is_int:
} return NumberEntryInt
else:
return NumberEntryFloat
else:
return {
"PYONValue": StringEntry,
"BooleanValue": BooleanEntry,
"EnumerationValue": EnumerationEntry,
"StringValue": StringEntry,
"Scannable": ScanEntry
}[ty]

View File

@ -2,7 +2,6 @@
<!-- Generator: Adobe Illustrator 16.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> <!-- Generator: Adobe Illustrator 16.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg <svg
xmlns:i="&amp;ns_ai;"
xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#" xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
@ -13,14 +12,14 @@
version="1.1" version="1.1"
x="0px" x="0px"
y="0px" y="0px"
width="360.147" width="324.483"
height="432.04401" height="432.04401"
viewBox="0 0 360.147 432.04401" viewBox="0 0 324.483 432.04401"
enable-background="new 0 0 800 800" enable-background="new 0 0 800 800"
xml:space="preserve" xml:space="preserve"
id="svg2" id="svg2"
inkscape:version="0.91 r13725" inkscape:version="0.91 r13725"
sodipodi:docname="Artiq_logo_final_cleaned.svg"><metadata sodipodi:docname="logo20.svg"><metadata
id="metadata548"><rdf:RDF><cc:Work id="metadata548"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
@ -34,20 +33,20 @@
inkscape:pageopacity="0" inkscape:pageopacity="0"
inkscape:pageshadow="2" inkscape:pageshadow="2"
inkscape:window-width="1920" inkscape:window-width="1920"
inkscape:window-height="1156" inkscape:window-height="1162"
id="namedview544" id="namedview544"
showgrid="false" showgrid="false"
fit-margin-top="0" fit-margin-top="0"
fit-margin-left="0" fit-margin-left="0"
fit-margin-right="0" fit-margin-right="0"
fit-margin-bottom="0" fit-margin-bottom="0"
inkscape:zoom="0.417193" inkscape:zoom="0.834386"
inkscape:cx="-963.25369" inkscape:cx="43.474611"
inkscape:cy="-371.05578" inkscape:cy="345.52987"
inkscape:window-x="0" inkscape:window-x="0"
inkscape:window-y="44" inkscape:window-y="38"
inkscape:window-maximized="1" inkscape:window-maximized="1"
inkscape:current-layer="svg2" /><path inkscape:current-layer="g423" /><path
inkscape:connector-curvature="0" inkscape:connector-curvature="0"
style="fill:#ffffff" style="fill:#ffffff"
id="path381" id="path381"
@ -121,29 +120,21 @@
d="m 366.13,593.558 c 7.498,-5.083 10.756,-15.119 7.922,-24.407 -2.773,-9.089 -10.521,-14.536 -20.727,-14.573 l -26.715,0 0,61.202 14.156,0 0,-18.602 9.979,0 10.836,18.602 16.479,0 0,-1.06 -12.725,-20.623 0.795,-0.539 z m -12.801,-8.731 -12.562,0 0,-17.809 1.004,0 c 1.254,0 2.529,-0.01 3.811,-0.02 2.6,-0.021 5.225,-0.041 7.771,0.02 5.328,0.052 7.74,4.621 7.719,8.845 -0.022,4.454 -2.688,8.964 -7.743,8.964 z" /><polygon d="m 366.13,593.558 c 7.498,-5.083 10.756,-15.119 7.922,-24.407 -2.773,-9.089 -10.521,-14.536 -20.727,-14.573 l -26.715,0 0,61.202 14.156,0 0,-18.602 9.979,0 10.836,18.602 16.479,0 0,-1.06 -12.725,-20.623 0.795,-0.539 z m -12.801,-8.731 -12.562,0 0,-17.809 1.004,0 c 1.254,0 2.529,-0.01 3.811,-0.02 2.6,-0.021 5.225,-0.041 7.771,0.02 5.328,0.052 7.74,4.621 7.719,8.845 -0.022,4.454 -2.688,8.964 -7.743,8.964 z" /><polygon
style="fill:#ffffff" style="fill:#ffffff"
id="polygon417" id="polygon417"
points="432.151,554.577 387.202,554.577 387.202,567.019 402.733,567.019 402.733,615.779 416.71,615.779 416.71,567.019 432.151,567.019 " /><polygon points="402.733,567.019 402.733,615.779 416.71,615.779 416.71,567.019 432.151,567.019 432.151,554.577 387.202,554.577 387.202,567.019 " /><polygon
style="fill:#ffffff" style="fill:#ffffff"
id="polygon419" id="polygon419"
points="464.571,566.657 471.976,566.657 471.976,554.577 443.19,554.577 443.19,566.657 450.595,566.657 450.595,603.608 442.558,603.608 442.558,615.779 472.606,615.779 472.606,603.608 464.571,603.608 " /><path points="443.19,554.577 443.19,566.657 450.595,566.657 450.595,603.608 442.558,603.608 442.558,615.779 472.606,615.779 472.606,603.608 464.571,603.608 464.571,566.657 471.976,566.657 471.976,554.577 " /><path
inkscape:connector-curvature="0" inkscape:connector-curvature="0"
style="fill:#ffffff" style="fill:#ffffff"
id="path421" id="path421"
d="m 542.927,603.421 c 3.252,-5.109 4.9,-11.218 4.9,-18.153 0,-21.831 -16.283,-31.774 -31.414,-31.774 -15.129,0 -31.414,9.943 -31.414,31.774 0,21.683 16.174,31.56 31.199,31.56 5.541,0 10.949,-1.321 15.637,-3.82 l 0.885,-0.472 1.725,3.244 14.828,0 0,-0.794 -6.68,-11.039 0.334,-0.526 z m -26.514,0.053 c -8.094,0 -16.805,-5.697 -16.805,-18.206 0,-12.415 8.711,-18.069 16.805,-18.069 8.094,0 16.807,5.654 16.807,18.069 0,12.508 -8.713,18.206 -16.807,18.206 z" /></g><g d="m 542.927,603.421 c 3.252,-5.109 4.9,-11.218 4.9,-18.153 0,-21.831 -16.283,-31.774 -31.414,-31.774 -15.129,0 -31.414,9.943 -31.414,31.774 0,21.683 16.174,31.56 31.199,31.56 5.541,0 10.949,-1.321 15.637,-3.82 l 0.885,-0.472 1.725,3.244 14.828,0 0,-0.794 -6.68,-11.039 0.334,-0.526 z m -26.514,0.053 c -8.094,0 -16.805,-5.697 -16.805,-18.206 0,-12.415 8.711,-18.069 16.805,-18.069 8.094,0 16.807,5.654 16.807,18.069 0,12.508 -8.713,18.206 -16.807,18.206 z" /></g><g
style="fill:#ffffff" style="fill:#000000"
id="g423" id="g423"
transform="translate(-250.847,-184.784)"><path transform="translate(-250.847,-184.784)"><path
inkscape:connector-curvature="0" inkscape:connector-curvature="0"
style="fill:#ffffff" style="fill:#ffffff"
id="path425" id="path425"
d="m 556.841,538.933 -0.145,0.182 c 0.328,-1.058 0.766,-2.006 1.348,-2.881 0.584,-0.875 1.277,-1.604 2.08,-2.225 0.801,-0.62 1.713,-1.094 2.734,-1.422 1.021,-0.328 2.152,-0.511 3.355,-0.511 1.35,0 2.59,0.219 3.719,0.62 1.131,0.401 2.08,0.984 2.881,1.714 0.803,0.729 1.424,1.604 1.861,2.589 0.438,0.985 0.656,2.079 0.656,3.246 0,1.24 -0.184,2.334 -0.584,3.246 -0.4,0.911 -0.912,1.75 -1.531,2.479 -0.621,0.729 -1.312,1.386 -2.078,1.969 -0.768,0.584 -1.533,1.167 -2.299,1.715 -0.619,0.438 -1.24,0.875 -1.859,1.312 -0.619,0.437 -1.168,0.839 -1.678,1.203 -0.51,0.365 -0.912,0.657 -1.24,0.876 l -0.473,0.328 0.035,0.036 c 0.037,0 0.584,-0.036 1.605,-0.073 1.021,-0.036 2.443,-0.072 4.23,-0.072 l 5.871,0 0,4.704 -18.416,0 0,-4.121 c 1.822,-1.568 3.646,-3.136 5.434,-4.704 1.788,-1.568 3.609,-3.137 5.434,-4.705 0.729,-0.619 1.312,-1.312 1.75,-2.042 0.438,-0.73 0.656,-1.495 0.656,-2.261 0,-1.021 -0.365,-1.896 -1.094,-2.626 -0.729,-0.73 -1.715,-1.094 -2.953,-1.094 -0.693,0 -1.277,0.109 -1.787,0.328 -0.512,0.219 -0.949,0.511 -1.314,0.875 -0.363,0.365 -0.691,0.766 -0.947,1.204 -0.256,0.438 -0.438,0.875 -0.584,1.349 l -4.667,-1.238 z" /><path d="m 556.841,538.933 -0.145,0.182 c 0.328,-1.058 0.766,-2.006 1.348,-2.881 0.584,-0.875 1.277,-1.604 2.08,-2.225 0.801,-0.62 1.713,-1.094 2.734,-1.422 1.021,-0.328 2.152,-0.511 3.355,-0.511 1.35,0 2.59,0.219 3.719,0.62 1.131,0.401 2.08,0.984 2.881,1.714 0.803,0.729 1.424,1.604 1.861,2.589 0.438,0.985 0.656,2.079 0.656,3.246 0,1.24 -0.184,2.334 -0.584,3.246 -0.4,0.911 -0.912,1.75 -1.531,2.479 -0.621,0.729 -1.312,1.386 -2.078,1.969 -0.768,0.584 -1.533,1.167 -2.299,1.715 -0.619,0.438 -1.24,0.875 -1.859,1.312 -0.619,0.437 -1.168,0.839 -1.678,1.203 -0.51,0.365 -0.912,0.657 -1.24,0.876 l -0.473,0.328 0.035,0.036 c 0.037,0 0.584,-0.036 1.605,-0.073 1.021,-0.036 2.443,-0.072 4.23,-0.072 l 5.871,0 0,4.704 -18.416,0 0,-4.121 c 1.822,-1.568 3.646,-3.136 5.434,-4.704 1.788,-1.568 3.609,-3.137 5.434,-4.705 0.729,-0.619 1.312,-1.312 1.75,-2.042 0.438,-0.73 0.656,-1.495 0.656,-2.261 0,-1.021 -0.365,-1.896 -1.094,-2.626 -0.729,-0.73 -1.715,-1.094 -2.953,-1.094 -0.693,0 -1.277,0.109 -1.787,0.328 -0.512,0.219 -0.949,0.511 -1.314,0.875 -0.363,0.365 -0.691,0.766 -0.947,1.204 -0.256,0.438 -0.438,0.875 -0.584,1.349 l -4.667,-1.238 z" /></g><path
inkscape:connector-curvature="0"
style="fill:#ffffff"
id="path427"
d="m 579.813,557.677 c -0.473,-0.474 -0.729,-1.058 -0.729,-1.75 0,-0.693 0.256,-1.276 0.729,-1.751 0.475,-0.474 1.059,-0.729 1.752,-0.729 0.691,0 1.275,0.256 1.75,0.729 0.475,0.475 0.729,1.058 0.729,1.751 0,0.692 -0.254,1.276 -0.729,1.75 -0.475,0.438 -1.059,0.693 -1.75,0.693 -0.693,0 -1.277,-0.256 -1.752,-0.693 z" /><path
inkscape:connector-curvature="0"
style="fill:#ffffff"
id="path429"
d="m 599.286,532.076 c 1.824,0 3.465,0.364 4.924,1.058 1.459,0.692 2.699,1.641 3.684,2.845 0.984,1.203 1.75,2.589 2.297,4.193 0.547,1.604 0.803,3.319 0.803,5.143 0,1.824 -0.256,3.537 -0.803,5.142 -0.547,1.605 -1.312,2.99 -2.297,4.194 -0.984,1.203 -2.225,2.151 -3.684,2.845 -1.459,0.656 -3.1,1.021 -4.924,1.021 -1.822,0 -3.463,-0.364 -4.922,-1.021 -1.459,-0.693 -2.699,-1.642 -3.721,-2.845 -1.021,-1.204 -1.787,-2.626 -2.297,-4.23 -0.51,-1.604 -0.766,-3.318 -0.766,-5.143 0,-1.823 0.256,-3.537 0.766,-5.142 0.51,-1.605 1.275,-3.027 2.297,-4.23 1.022,-1.203 2.262,-2.151 3.721,-2.845 1.459,-0.692 3.1,-1.058 4.922,-1.058 l 0,0.073 z m 0,4.923 c -1.094,0 -2.041,0.219 -2.844,0.657 -0.803,0.438 -1.459,1.021 -1.969,1.75 -0.512,0.729 -0.912,1.604 -1.168,2.626 -0.254,1.021 -0.363,2.078 -0.363,3.209 0,1.131 0.145,2.188 0.4,3.209 0.256,1.021 0.656,1.896 1.166,2.662 0.512,0.767 1.168,1.35 1.971,1.787 0.803,0.437 1.75,0.656 2.844,0.656 1.094,0 2.043,-0.219 2.846,-0.656 0.801,-0.438 1.457,-1.021 1.969,-1.787 0.51,-0.766 0.912,-1.641 1.166,-2.662 0.256,-1.021 0.402,-2.115 0.402,-3.245 0,-1.131 -0.146,-2.225 -0.402,-3.246 -0.254,-1.021 -0.656,-1.896 -1.166,-2.626 -0.512,-0.729 -1.168,-1.312 -1.969,-1.75 -0.803,-0.438 -1.752,-0.656 -2.846,-0.656 l -0.037,0.072 z" /></g><path
inkscape:connector-curvature="0" inkscape:connector-curvature="0"
style="fill:#ffffff" style="fill:#ffffff"
id="path431" id="path431"

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -48,6 +48,12 @@ class _SimpleArgProcessor:
class PYONValue(_SimpleArgProcessor): class PYONValue(_SimpleArgProcessor):
"""An argument that can be any PYON-serializable value.""" """An argument that can be any PYON-serializable value."""
def __init__(self, default=NoDefault):
# Override the _SimpleArgProcessor init, as list defaults are valid
# PYON values
if default is not NoDefault:
self.default_value = default
def process(self, x): def process(self, x):
return pyon.decode(x) return pyon.decode(x)

View File

@ -36,23 +36,27 @@ class ScanObject:
class NoScan(ScanObject): class NoScan(ScanObject):
"""A scan object that yields a single value.""" """A scan object that yields a single value for a specified number
def __init__(self, value): of repetitions."""
def __init__(self, value, repetitions=1):
self.value = value self.value = value
self.repetitions = repetitions
@portable @portable
def _gen(self): def _gen(self):
yield self.value for i in range(self.repetitions):
yield self.value
@portable @portable
def __iter__(self): def __iter__(self):
return self._gen() return self._gen()
def __len__(self): def __len__(self):
return 1 return self.repetitions
def describe(self): def describe(self):
return {"ty": "NoScan", "value": self.value} return {"ty": "NoScan", "value": self.value,
"repetitions": self.repetitions}
class LinearScan(ScanObject): class LinearScan(ScanObject):
@ -99,7 +103,7 @@ class RandomScan(ScanObject):
if seed is None: if seed is None:
rf = random.random rf = random.random
else: else:
rf = Random(seed).random rf = random.Random(seed).random
random.shuffle(self.sequence, rf) random.shuffle(self.sequence, rf)
@portable @portable

View File

@ -2,6 +2,7 @@ import asyncio
import os import os
import tempfile import tempfile
import shutil import shutil
import time
import logging import logging
from artiq.protocols.sync_struct import Notifier from artiq.protocols.sync_struct import Notifier
@ -13,60 +14,71 @@ from artiq.tools import get_windows_drives, exc_to_warning
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
async def _get_repository_entries(entry_dict, class _RepoScanner:
root, filename, worker_handlers): def __init__(self, worker_handlers):
worker = Worker(worker_handlers) self.worker_handlers = worker_handlers
try: self.worker = None
description = await worker.examine("scan", os.path.join(root, filename))
except:
log_worker_exception()
raise
finally:
await worker.close()
for class_name, class_desc in description.items():
name = class_desc["name"]
arginfo = class_desc["arginfo"]
if "/" in name:
logger.warning("Character '/' is not allowed in experiment "
"name (%s)", name)
name = name.replace("/", "_")
if name in entry_dict:
basename = name
i = 1
while name in entry_dict:
name = basename + str(i)
i += 1
logger.warning("Duplicate experiment name: '%s'\n"
"Renaming class '%s' in '%s' to '%s'",
basename, class_name, filename, name)
entry = {
"file": filename,
"class_name": class_name,
"arginfo": arginfo
}
entry_dict[name] = entry
async def process_file(self, entry_dict, root, filename):
logger.debug("processing file %s %s", root, filename)
try:
description = await self.worker.examine(
"scan", os.path.join(root, filename))
except:
log_worker_exception()
raise
for class_name, class_desc in description.items():
name = class_desc["name"]
arginfo = class_desc["arginfo"]
if "/" in name:
logger.warning("Character '/' is not allowed in experiment "
"name (%s)", name)
name = name.replace("/", "_")
if name in entry_dict:
basename = name
i = 1
while name in entry_dict:
name = basename + str(i)
i += 1
logger.warning("Duplicate experiment name: '%s'\n"
"Renaming class '%s' in '%s' to '%s'",
basename, class_name, filename, name)
entry = {
"file": filename,
"class_name": class_name,
"arginfo": arginfo
}
entry_dict[name] = entry
async def _scan_experiments(root, worker_handlers, subdir=""): async def _scan(self, root, subdir=""):
entry_dict = dict() entry_dict = dict()
for de in os.scandir(os.path.join(root, subdir)): for de in os.scandir(os.path.join(root, subdir)):
if de.name.startswith("."): if de.name.startswith("."):
continue continue
if de.is_file() and de.name.endswith(".py"): if de.is_file() and de.name.endswith(".py"):
filename = os.path.join(subdir, de.name) filename = os.path.join(subdir, de.name)
try: try:
await _get_repository_entries( await self.process_file(entry_dict, root, filename)
entry_dict, root, filename, worker_handlers) except Exception as exc:
except Exception as exc: logger.warning("Skipping file '%s'", filename,
logger.warning("Skipping file '%s'", filename, exc_info=not isinstance(exc, WorkerInternalException))
exc_info=not isinstance(exc, WorkerInternalException)) # restart worker
if de.is_dir(): await self.worker.close()
subentries = await _scan_experiments( self.worker = Worker(self.worker_handlers)
root, worker_handlers, if de.is_dir():
os.path.join(subdir, de.name)) subentries = await self._scan(
entries = {de.name + "/" + k: v for k, v in subentries.items()} root, os.path.join(subdir, de.name))
entry_dict.update(entries) entries = {de.name + "/" + k: v for k, v in subentries.items()}
return entry_dict entry_dict.update(entries)
return entry_dict
async def scan(self, root):
self.worker = Worker(self.worker_handlers)
try:
r = await self._scan(root)
finally:
await self.worker.close()
return r
def _sync_explist(target, source): def _sync_explist(target, source):
@ -109,7 +121,9 @@ class ExperimentDB:
self.repo_backend.release_rev(self.cur_rev) self.repo_backend.release_rev(self.cur_rev)
self.cur_rev = new_cur_rev self.cur_rev = new_cur_rev
self.status["cur_rev"] = new_cur_rev self.status["cur_rev"] = new_cur_rev
new_explist = await _scan_experiments(wd, self.worker_handlers) t1 = time.monotonic()
new_explist = await _RepoScanner(self.worker_handlers).scan(wd)
logger.info("repository scan took %d seconds", time.monotonic()-t1)
_sync_explist(self.explist, new_explist) _sync_explist(self.explist, new_explist)
finally: finally:

View File

@ -446,6 +446,9 @@ class Scheduler:
whether returning control to the host and pausing would have an effect, whether returning control to the host and pausing would have an effect,
in order to avoid the cost of switching kernels in the common case in order to avoid the cost of switching kernels in the common case
where ``pause`` does nothing. where ``pause`` does nothing.
This function does not have side effects, and does not have to be
followed by a call to ``pause``.
""" """
for pipeline in self._pipelines.values(): for pipeline in self._pipelines.values():
if rid in pipeline.pool.runs: if rid in pipeline.pool.runs:

View File

@ -76,6 +76,8 @@ class Worker:
return "worker({},{})".format(self.rid, self.filename) return "worker({},{})".format(self.rid, self.filename)
async def _create_process(self, log_level): async def _create_process(self, log_level):
if self.ipc is not None:
return # process already exists, recycle
await self.io_lock.acquire() await self.io_lock.acquire()
try: try:
if self.closed.is_set(): if self.closed.is_set():

View File

@ -190,14 +190,20 @@ class DatasetManager:
broadcast = True broadcast = True
if broadcast: if broadcast:
self.broadcast[key] = persist, value self.broadcast[key] = persist, value
elif key in self.broadcast.read:
del self.broadcast[key]
if save: if save:
self.local[key] = value self.local[key] = value
elif key in self.local:
del self.local[key]
def mutate(self, key, index, value): def mutate(self, key, index, value):
target = None target = None
if key in self.local: if key in self.local:
target = self.local[key] target = self.local[key]
if key in self.broadcast.read: if key in self.broadcast.read:
if target is not None:
assert target is self.broadcast.read[key][1]
target = self.broadcast[key][1] target = self.broadcast[key][1]
if target is None: if target is None:
raise KeyError("Cannot mutate non-existing dataset") raise KeyError("Cannot mutate non-existing dataset")

View File

@ -4,7 +4,7 @@ import sys
__all__ = [] __all__ = []
if sys.version_info[:3] == (3, 5, 2): if sys.version_info[:3] >= (3, 5, 2):
import asyncio import asyncio
# See https://github.com/m-labs/artiq/issues/506 # See https://github.com/m-labs/artiq/issues/506

View File

@ -17,7 +17,7 @@ class Receiver:
async def connect(self, host, port): async def connect(self, host, port):
self.reader, self.writer = \ self.reader, self.writer = \
await asyncio.open_connection(host, port, limit=4*1024*1024) await asyncio.open_connection(host, port, limit=100*1024*1024)
try: try:
self.writer.write(_init_string) self.writer.write(_init_string)
self.writer.write((self.name + "\n").encode()) self.writer.write((self.name + "\n").encode())

View File

@ -201,7 +201,7 @@ class AsyncioClient:
this method is a coroutine. See ``Client`` for a description of the this method is a coroutine. See ``Client`` for a description of the
parameters.""" parameters."""
self.__reader, self.__writer = \ self.__reader, self.__writer = \
await asyncio.open_connection(host, port, limit=4*1024*1024) await asyncio.open_connection(host, port, limit=100*1024*1024)
try: try:
self.__writer.write(_init_string) self.__writer.write(_init_string)
server_identification = await self.__recv() server_identification = await self.__recv()

View File

@ -22,7 +22,7 @@ class _BaseIO:
if os.name != "nt": if os.name != "nt":
async def _fds_to_asyncio(rfd, wfd, loop): async def _fds_to_asyncio(rfd, wfd, loop):
reader = asyncio.StreamReader(loop=loop, limit=4*1024*1024) reader = asyncio.StreamReader(loop=loop, limit=100*1024*1024)
reader_protocol = asyncio.StreamReaderProtocol(reader, loop=loop) reader_protocol = asyncio.StreamReaderProtocol(reader, loop=loop)
rf = open(rfd, "rb", 0) rf = open(rfd, "rb", 0)
rt, _ = await loop.connect_read_pipe(lambda: reader_protocol, rf) rt, _ = await loop.connect_read_pipe(lambda: reader_protocol, rf)
@ -128,7 +128,7 @@ else: # windows
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()
def factory(): def factory():
reader = asyncio.StreamReader(loop=loop, limit=4*1024*1024) reader = asyncio.StreamReader(loop=loop, limit=100*1024*1024)
protocol = asyncio.StreamReaderProtocol(reader, protocol = asyncio.StreamReaderProtocol(reader,
self._child_connected, self._child_connected,
loop=loop) loop=loop)
@ -189,7 +189,7 @@ else: # windows
async def connect(self): async def connect(self):
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()
self.reader = asyncio.StreamReader(loop=loop, limit=4*1024*1024) self.reader = asyncio.StreamReader(loop=loop, limit=100*1024*1024)
reader_protocol = asyncio.StreamReaderProtocol( reader_protocol = asyncio.StreamReaderProtocol(
self.reader, loop=loop) self.reader, loop=loop)
transport, _ = await loop.create_pipe_connection( transport, _ = await loop.create_pipe_connection(

View File

@ -64,7 +64,7 @@ class Subscriber:
async def connect(self, host, port, before_receive_cb=None): async def connect(self, host, port, before_receive_cb=None):
self.reader, self.writer = \ self.reader, self.writer = \
await asyncio.open_connection(host, port, limit=4*1024*1024) await asyncio.open_connection(host, port, limit=100*1024*1024)
try: try:
if before_receive_cb is not None: if before_receive_cb is not None:
before_receive_cb() before_receive_cb()

View File

@ -49,10 +49,11 @@ ksupport.elf: $(OBJECTS_KSUPPORT)
../libbase/crt0-$(CPU).o \ ../libbase/crt0-$(CPU).o \
$^ \ $^ \
-L../libbase \ -L../libbase \
-L../libm \
-L../libcompiler-rt \ -L../libcompiler-rt \
-L../libunwind \ -L../libunwind \
-L../libdyld \ -L../libdyld \
-lbase-nofloat -lcompiler-rt -ldyld -lunwind -lbase-nofloat -lm -lcompiler-rt -ldyld -lunwind
@chmod -x $@ @chmod -x $@
ksupport_data.o: ksupport.elf ksupport_data.o: ksupport.elf

View File

@ -18,8 +18,9 @@
#include "dds.h" #include "dds.h"
#include "i2c.h" #include "i2c.h"
double round(double x);
double sqrt(double x); double sqrt(double x);
double round(double x);
double floor(double x);
void ksupport_abort(void); void ksupport_abort(void);
static void attribute_writeback(void *); static void attribute_writeback(void *);
@ -88,8 +89,9 @@ static const struct symbol runtime_exports[] = {
{"__powidf2", &__powidf2}, {"__powidf2", &__powidf2},
/* libm */ /* libm */
{"round", &round},
{"sqrt", &sqrt}, {"sqrt", &sqrt},
{"round", &round},
{"floor", &floor},
/* exceptions */ /* exceptions */
{"_Unwind_Resume", &_Unwind_Resume}, {"_Unwind_Resume", &_Unwind_Resume},
@ -97,6 +99,7 @@ static const struct symbol runtime_exports[] = {
{"__artiq_raise", &__artiq_raise}, {"__artiq_raise", &__artiq_raise},
{"__artiq_reraise", &__artiq_reraise}, {"__artiq_reraise", &__artiq_reraise},
{"strcmp", &strcmp}, {"strcmp", &strcmp},
{"strlen", &strlen},
{"abort", &ksupport_abort}, {"abort", &ksupport_abort},
/* proxified syscalls */ /* proxified syscalls */

View File

@ -12,6 +12,8 @@
#include "log.h" #include "log.h"
#include "moninj.h" #include "moninj.h"
#define min(a, b) (a>b?b:a)
enum { enum {
MONINJ_REQ_MONITOR = 1, MONINJ_REQ_MONITOR = 1,
MONINJ_REQ_TTLSET = 2 MONINJ_REQ_TTLSET = 2
@ -52,7 +54,8 @@ static void moninj_monitor(const ip_addr_t *addr, u16_t port)
reply.ttl_levels = 0; reply.ttl_levels = 0;
reply.ttl_oes = 0; reply.ttl_oes = 0;
reply.ttl_overrides = 0; reply.ttl_overrides = 0;
for(i=0;i<CONFIG_RTIO_REGULAR_TTL_COUNT;i++) { /* send at most 64 channels, the protocol doesn't support more */
for(i=0;i<min(CONFIG_RTIO_REGULAR_TTL_COUNT, 64);i++) {
rtio_moninj_mon_chan_sel_write(i); rtio_moninj_mon_chan_sel_write(i);
rtio_moninj_mon_probe_sel_write(0); rtio_moninj_mon_probe_sel_write(0);
rtio_moninj_mon_value_update_write(1); rtio_moninj_mon_value_update_write(1);

View File

@ -249,6 +249,19 @@ class Handover(EnvExperiment):
self.k("t2") self.k("t2")
class Rounding(EnvExperiment):
def build(self):
self.setattr_device("core")
@kernel
def run(self):
self.core.reset()
t1 = now_mu()
delay(8*us)
t2 = now_mu()
self.set_dataset("delta", t2 - t1)
class DummyException(Exception): class DummyException(Exception):
pass pass
@ -353,6 +366,11 @@ class CoredeviceTest(ExperimentCase):
self.assertEqual(self.dataset_mgr.get("t1") + 1234, self.assertEqual(self.dataset_mgr.get("t1") + 1234,
self.dataset_mgr.get("t2")) self.dataset_mgr.get("t2"))
def test_rounding(self):
self.execute(Rounding)
dt = self.dataset_mgr.get("delta")
self.assertEqual(dt, 8000)
class RPCTiming(EnvExperiment): class RPCTiming(EnvExperiment):

View File

@ -0,0 +1,9 @@
# RUN: %python -m artiq.compiler.testbench.signature +diag %s >%t
# RUN: OutputCheck %s --file-to-check=%t
# CHECK-L: ${LINE:+1}: error: this function must return a value of type numpy.int32 explicitly
def foo(x):
if x:
return 1
foo(True)

View File

@ -0,0 +1,4 @@
# RUN: %python -m artiq.compiler.testbench.llvmgen %s
def f():
return float(1.0)

View File

@ -0,0 +1,9 @@
# RUN: %python -m artiq.compiler.testbench.signature %s
def foo(x):
if x:
return 1
else:
return 2
foo(True)

View File

@ -0,0 +1,22 @@
# RUN: %python -m artiq.compiler.testbench.embedding %s
from artiq.language.core import *
from artiq.language.types import *
class a:
def foo(self, x):
print(x)
class b:
def __init__(self):
self.obj = a()
self.meth = self.obj.foo
@kernel
def run(self):
self.meth(1)
bi = b()
@kernel
def entrypoint():
bi.run()

View File

@ -0,0 +1,20 @@
# RUN: %python -m artiq.compiler.testbench.embedding +diag %s 2>%t
# RUN: OutputCheck %s --file-to-check=%t
from artiq.language.core import *
from artiq.language.types import *
class c:
kernel_invariants = {"a", "b"}
a = 0
def __repr__(self):
return "<testbench.c object>"
i = c()
@kernel
def entrypoint():
# CHECK-L: <synthesized>:1: warning: object <testbench.c object> of type <instance testbench.c> declares attribute 'b' as kernel invariant, but the instance referenced here does not have this attribute
# CHECK-L: ${LINE:+1}: note: expanded from here
i

View File

@ -0,0 +1,12 @@
# RUN: %python -m artiq.compiler.testbench.embedding +diag %s 2>%t
# RUN: OutputCheck %s --file-to-check=%t
from artiq.experiment import *
@kernel
def entrypoint():
a = [1,2]
# CHECK-L: ${LINE:+2}: error: values cannot be mutated in-place
# CHECK-L: ${LINE:+1}: note: try using `a = a + [3,4]`
a += [3,4]

View File

@ -13,8 +13,8 @@ int()
# CHECK-L: int:<constructor int>(1.0:float):numpy.int? # CHECK-L: int:<constructor int>(1.0:float):numpy.int?
int(1.0) int(1.0)
# CHECK-L: int:<constructor int>(1.0:float, width=64:numpy.int?):numpy.int64 # CHECK-L: int64:<function int64>(1.0:float):numpy.int64
int(1.0, width=64) int64(1.0)
# CHECK-L: float:<constructor float {}>():float # CHECK-L: float:<constructor float {}>():float
float() float()

View File

@ -0,0 +1,5 @@
# RUN: %python -m artiq.compiler.testbench.inferencer +mono %s >%t
# RUN: OutputCheck %s --file-to-check=%t
# CHECK-L: numpy.int64
int64(2)**32

View File

@ -1,10 +1,6 @@
# RUN: %python -m artiq.compiler.testbench.inferencer +diag %s >%t # RUN: %python -m artiq.compiler.testbench.inferencer +diag %s >%t
# RUN: OutputCheck %s --file-to-check=%t # RUN: OutputCheck %s --file-to-check=%t
a = 1
# CHECK-L: ${LINE:+1}: error: the width argument of int() must be an integer literal
int(1.0, width=a)
# CHECK-L: ${LINE:+1}: error: the argument of len() must be of an iterable type # CHECK-L: ${LINE:+1}: error: the argument of len() must be of an iterable type
len(1) len(1)

View File

@ -28,10 +28,10 @@
# CHECK-L: ${LINE:+1}: error: cannot coerce list(elt='a) to a numeric type # CHECK-L: ${LINE:+1}: error: cannot coerce list(elt='a) to a numeric type
[] - 1.0 [] - 1.0
# CHECK-L: ${LINE:+2}: error: expression of type numpy.int? has to be coerced to float, which makes assignment invalid # CHECK-L: ${LINE:+2}: error: the result of this operation has type float, which cannot be assigned to a left-hand side of type numpy.int?
# CHECK-L: ${LINE:+1}: note: expression of type float # CHECK-L: ${LINE:+1}: note: expression of type float
a = 1; a += 1.0 a = 1; a += 1.0
# CHECK-L: ${LINE:+2}: error: the result of this operation has type (numpy.int?, float), which makes assignment to a slot of type (numpy.int?,) invalid # CHECK-L: ${LINE:+2}: error: the result of this operation has type (numpy.int?, float), which cannot be assigned to a left-hand side of type (numpy.int?,)
# CHECK-L: ${LINE:+1}: note: expression of type (float,) # CHECK-L: ${LINE:+1}: note: expression of type (float,)
b = (1,); b += (1.0,) b = (1,); b += (1.0,)

View File

@ -1,5 +1,5 @@
# RUN: %python -m artiq.compiler.testbench.jit %s
# RUN: %python %s # RUN: %python %s
# RUN: %python -m artiq.compiler.testbench.jit %s
# REQUIRES: exceptions # REQUIRES: exceptions
assert -(-1) == 1 assert -(-1) == 1
@ -20,6 +20,12 @@ assert 3 % 2 == 1
assert -3 % 2 == 1 assert -3 % 2 == 1
assert 3 % -2 == -1 assert 3 % -2 == -1
assert -3 % -2 == -1 assert -3 % -2 == -1
assert -1 % 8 == 7
#ARTIQ#assert int64(3) % 2 == 1
#ARTIQ#assert int64(-3) % 2 == 1
#ARTIQ#assert int64(3) % -2 == -1
#ARTIQ#assert int64(-3) % -2 == -1
assert -1 % 8 == 7
assert 3.0 % 2.0 == 1.0 assert 3.0 % 2.0 == 1.0
assert -3.0 % 2.0 == 1.0 assert -3.0 % 2.0 == 1.0
assert 3.0 % -2.0 == -1.0 assert 3.0 % -2.0 == -1.0
@ -35,6 +41,24 @@ assert -1 >> 32 == -1
assert 0x18 & 0x0f == 0x08 assert 0x18 & 0x0f == 0x08
assert 0x18 | 0x0f == 0x1f assert 0x18 | 0x0f == 0x1f
assert 0x18 ^ 0x0f == 0x17 assert 0x18 ^ 0x0f == 0x17
#ARTIQ#assert ~0x18 == -25
#ARTIQ#assert ~int64(0x18) == -25
assert [1] + [2] == [1, 2] try:
assert [1] * 3 == [1, 1, 1] 1 / 0
except ZeroDivisionError:
pass
else:
assert False
try:
1 // 0
except ZeroDivisionError:
pass
else:
assert False
try:
1 % 0
except ZeroDivisionError:
pass
else:
assert False

View File

@ -3,3 +3,6 @@
ary = array([1, 2, 3]) ary = array([1, 2, 3])
assert [x*x for x in ary] == [1, 4, 9] assert [x*x for x in ary] == [1, 4, 9]
assert [1] + [2] == [1, 2]
assert [1] * 3 == [1, 1, 1]

View File

@ -7,7 +7,7 @@ assert bool() is False
assert int() is 0 assert int() is 0
assert int(1.0) is 1 assert int(1.0) is 1
#ARTIQ#assert int(1, width=64) << 40 is 1099511627776 #ARTIQ#assert int64(1) << 40 is 1099511627776
#ARTIQ#assert float() is 0.0 #ARTIQ#assert float() is 0.0
#ARTIQ#assert float(1) is 1.0 #ARTIQ#assert float(1) is 1.0

View File

@ -27,3 +27,27 @@ for x in range(10):
assert False assert False
else: else:
assert False assert False
# Verify continue target is reset in else block.
cond = False
while True:
if cond:
break
cond = True
for _ in range(1):
pass
else:
continue
assert False
else:
assert False
# Verify for target is reset in else block.
while True:
for _ in range(1):
pass
else:
break
assert False
else:
assert False

View File

@ -19,3 +19,9 @@ else:
assert (0 if True else 1) == 0 assert (0 if True else 1) == 0
assert (0 if False else 1) == 1 assert (0 if False else 1) == 1
if 0:
assert True
if 1:
assert True

View File

@ -29,3 +29,34 @@ while cond:
cond = False cond = False
continue continue
assert False assert False
# Verify continue target is reset in else block.
cond = False
while True:
if cond:
break
cond = True
while False:
assert False
else:
continue
assert False
else:
assert False
# Verify break target is reset in else block.
while True:
while False:
assert False
else:
break
assert False
else:
assert False
while 0:
assert False
while 1:
assert True
break

View File

@ -0,0 +1,10 @@
# RUN: %python -m artiq.compiler.testbench.signature %s >%t
# RUN: OutputCheck %s --file-to-check=%t
def f(x):
x = int64(0)
return x
# CHECK-L: g: ()->numpy.int64
def g():
return f(1 + 0)

View File

@ -0,0 +1,17 @@
# RUN: %python -m artiq.compiler.testbench.embedding %s
from artiq.language.core import *
from artiq.language.types import *
import numpy as np
@kernel
def rotate(array):
'''Rotates an array, deleting the oldest value'''
length = len(array)
for i in range(np.int64(len(array)) - 1):
array[length - i - 1] = array[length - i - 2]
array[0] = 0
@kernel
def entrypoint():
rotate([1,2,3,4])

View File

@ -0,0 +1,14 @@
{
"comm": {
"type": "local",
"module": "artiq.coredevice.comm_dummy",
"class": "Comm",
"arguments": {}
},
"core": {
"type": "local",
"module": "artiq.coredevice.core",
"class": "Core",
"arguments": {"ref_period": 1e-9}
}
}

47
conda/artiq-dev/meta.yaml Normal file
View File

@ -0,0 +1,47 @@
package:
name: artiq-dev
version: {{ environ.get("GIT_DESCRIBE_TAG", "") }}
source:
git_url: ../..
build:
noarch: python
number: {{ environ.get("GIT_DESCRIBE_NUMBER", 0) }}
string: py_{{ environ.get("GIT_DESCRIBE_NUMBER", 0) }}+git{{ environ.get("GIT_FULL_HASH", "")[:8] }}
requirements:
run:
- python >=3.5.3,<3.6
- setuptools 33.1.1
- migen 0.4
- misoc 0.3
- binutils-or1k-linux
- llvm-or1k
- llvmlite-artiq 0.10.0.dev py35_24
- openocd 0.10.0 1
- lit
- outputcheck
- coverage
- scipy
- numpy
- prettytable
- asyncserial
- sphinx 1.4.8
- sphinx-argparse
- sphinxcontrib-wavedrom
- sphinx_rtd_theme
- h5py
- dateutil
- pyqt >=5.5
- quamash
- pyqtgraph
- pygit2
- aiohttp
- pythonparser 1.0
- levenshtein
about:
home: https://m-labs.hk/artiq
license: LGPL
summary: 'ARTIQ development metapackage'

View File

@ -11,4 +11,4 @@ cp misoc_nist_clock_kc705/gateware/top.bit $SOC_PREFIX
cp misoc_nist_clock_kc705/software/bios/bios.bin $SOC_PREFIX cp misoc_nist_clock_kc705/software/bios/bios.bin $SOC_PREFIX
cp misoc_nist_clock_kc705/software/runtime/runtime.fbi $SOC_PREFIX cp misoc_nist_clock_kc705/software/runtime/runtime.fbi $SOC_PREFIX
wget -P $SOC_PREFIX https://raw.githubusercontent.com/jordens/bscan_spi_bitstreams/master/bscan_spi_xc7k325t.bit wget -P $SOC_PREFIX https://raw.githubusercontent.com/jordens/bscan_spi_bitstreams/single-tap/bscan_spi_xc7k325t.bit

View File

@ -6,20 +6,18 @@ source:
git_url: ../.. git_url: ../..
build: build:
noarch_python: true noarch: generic
ignore_prefix_files: True
number: {{ environ.get("GIT_DESCRIBE_NUMBER", 0) }} number: {{ environ.get("GIT_DESCRIBE_NUMBER", 0) }}
string: py_{{ environ.get("GIT_DESCRIBE_NUMBER", 0) }}+git{{ environ.get("GIT_DESCRIBE_HASH", "")[1:] }} string: py_{{ environ.get("GIT_DESCRIBE_NUMBER", 0) }}+git{{ environ.get("GIT_FULL_HASH", "")[:8] }}
requirements: requirements:
build: build:
- migen 0.2 - artiq-dev {{ "{tag} py_{number}+git{hash}".format(tag=environ.get("GIT_DESCRIBE_TAG"), number=environ.get("GIT_DESCRIBE_NUMBER"), hash=environ.get("GIT_FULL_HASH", "")[:8]) if "GIT_DESCRIBE_TAG" in environ else "" }}
- misoc 0.2
- llvm-or1k
- binutils-or1k-linux
run: run:
- artiq {{ "{tag} py_{number}+git{hash}".format(tag=environ.get("GIT_DESCRIBE_TAG"), number=environ.get("GIT_DESCRIBE_NUMBER"), hash=environ.get("GIT_DESCRIBE_HASH")[1:]) if "GIT_DESCRIBE_TAG" in environ else "" }} - artiq {{ "{tag} py_{number}+git{hash}".format(tag=environ.get("GIT_DESCRIBE_TAG"), number=environ.get("GIT_DESCRIBE_NUMBER"), hash=environ.get("GIT_FULL_HASH", "")[:8]) if "GIT_DESCRIBE_TAG" in environ else "" }}
about: about:
home: https://m-labs.hk/artiq home: https://m-labs.hk/artiq
license: GPL license: LGPL
summary: 'Bitstream, BIOS and runtime for NIST_QC2 on the KC705 board' summary: 'Bitstream, BIOS and runtime for NIST_CLOCK on the KC705 board'

View File

@ -1,14 +0,0 @@
#!/bin/bash
BUILD_SETTINGS_FILE=$HOME/.m-labs/build_settings.sh
[ -f $BUILD_SETTINGS_FILE ] && . $BUILD_SETTINGS_FILE
SOC_PREFIX=$PREFIX/lib/python3.5/site-packages/artiq/binaries/kc705-nist_qc1
mkdir -p $SOC_PREFIX
$PYTHON -m artiq.gateware.targets.kc705 -H nist_qc1 --toolchain vivado $MISOC_EXTRA_VIVADO_CMDLINE
cp misoc_nist_qc1_kc705/gateware/top.bit $SOC_PREFIX
cp misoc_nist_qc1_kc705/software/bios/bios.bin $SOC_PREFIX
cp misoc_nist_qc1_kc705/software/runtime/runtime.fbi $SOC_PREFIX
wget -P $SOC_PREFIX https://raw.githubusercontent.com/jordens/bscan_spi_bitstreams/master/bscan_spi_xc7k325t.bit

View File

@ -1,25 +0,0 @@
package:
name: artiq-kc705-nist_qc1
version: {{ environ.get("GIT_DESCRIBE_TAG", "") }}
source:
git_url: ../..
build:
noarch_python: true
number: {{ environ.get("GIT_DESCRIBE_NUMBER", 0) }}
string: py_{{ environ.get("GIT_DESCRIBE_NUMBER", 0) }}+git{{ environ.get("GIT_DESCRIBE_HASH", "")[1:] }}
requirements:
build:
- migen 0.2
- misoc 0.2
- llvm-or1k
- binutils-or1k-linux
run:
- artiq {{ "{tag} py_{number}+git{hash}".format(tag=environ.get("GIT_DESCRIBE_TAG"), number=environ.get("GIT_DESCRIBE_NUMBER"), hash=environ.get("GIT_DESCRIBE_HASH")[1:]) if "GIT_DESCRIBE_TAG" in environ else "" }}
about:
home: https://m-labs.hk/artiq
license: GPL
summary: 'Bitstream, BIOS and runtime for NIST_QC1 on the KC705 board'

View File

@ -11,4 +11,4 @@ cp misoc_nist_qc2_kc705/gateware/top.bit $SOC_PREFIX
cp misoc_nist_qc2_kc705/software/bios/bios.bin $SOC_PREFIX cp misoc_nist_qc2_kc705/software/bios/bios.bin $SOC_PREFIX
cp misoc_nist_qc2_kc705/software/runtime/runtime.fbi $SOC_PREFIX cp misoc_nist_qc2_kc705/software/runtime/runtime.fbi $SOC_PREFIX
wget -P $SOC_PREFIX https://raw.githubusercontent.com/jordens/bscan_spi_bitstreams/master/bscan_spi_xc7k325t.bit wget -P $SOC_PREFIX https://raw.githubusercontent.com/jordens/bscan_spi_bitstreams/single-tap/bscan_spi_xc7k325t.bit

View File

@ -6,20 +6,18 @@ source:
git_url: ../.. git_url: ../..
build: build:
noarch_python: true noarch: generic
ignore_prefix_files: True
number: {{ environ.get("GIT_DESCRIBE_NUMBER", 0) }} number: {{ environ.get("GIT_DESCRIBE_NUMBER", 0) }}
string: py_{{ environ.get("GIT_DESCRIBE_NUMBER", 0) }}+git{{ environ.get("GIT_DESCRIBE_HASH", "")[1:] }} string: py_{{ environ.get("GIT_DESCRIBE_NUMBER", 0) }}+git{{ environ.get("GIT_FULL_HASH", "")[:8] }}
requirements: requirements:
build: build:
- migen 0.2 - artiq-dev {{ "{tag} py_{number}+git{hash}".format(tag=environ.get("GIT_DESCRIBE_TAG"), number=environ.get("GIT_DESCRIBE_NUMBER"), hash=environ.get("GIT_FULL_HASH", "")[:8]) if "GIT_DESCRIBE_TAG" in environ else "" }}
- misoc 0.2
- llvm-or1k
- binutils-or1k-linux
run: run:
- artiq {{ "{tag} py_{number}+git{hash}".format(tag=environ.get("GIT_DESCRIBE_TAG"), number=environ.get("GIT_DESCRIBE_NUMBER"), hash=environ.get("GIT_DESCRIBE_HASH")[1:]) if "GIT_DESCRIBE_TAG" in environ else "" }} - artiq {{ "{tag} py_{number}+git{hash}".format(tag=environ.get("GIT_DESCRIBE_TAG"), number=environ.get("GIT_DESCRIBE_NUMBER"), hash=environ.get("GIT_FULL_HASH", "")[:8]) if "GIT_DESCRIBE_TAG" in environ else "" }}
about: about:
home: https://m-labs.hk/artiq home: https://m-labs.hk/artiq
license: GPL license: LGPL
summary: 'Bitstream, BIOS and runtime for NIST_QC2 on the KC705 board' summary: 'Bitstream, BIOS and runtime for NIST_QC2 on the KC705 board'

View File

@ -6,20 +6,18 @@ source:
git_url: ../.. git_url: ../..
build: build:
noarch_python: true noarch: generic
ignore_prefix_files: True
number: {{ environ.get("GIT_DESCRIBE_NUMBER", 0) }} number: {{ environ.get("GIT_DESCRIBE_NUMBER", 0) }}
string: py_{{ environ.get("GIT_DESCRIBE_NUMBER", 0) }}+git{{ environ.get("GIT_DESCRIBE_HASH", "")[1:] }} string: py_{{ environ.get("GIT_DESCRIBE_NUMBER", 0) }}+git{{ environ.get("GIT_FULL_HASH", "")[:8] }}
requirements: requirements:
build: build:
- migen 0.2 - artiq-dev {{ "{tag} py_{number}+git{hash}".format(tag=environ.get("GIT_DESCRIBE_TAG"), number=environ.get("GIT_DESCRIBE_NUMBER"), hash=environ.get("GIT_FULL_HASH", "")[:8]) if "GIT_DESCRIBE_TAG" in environ else "" }}
- misoc 0.2
- llvm-or1k
- binutils-or1k-linux
run: run:
- artiq {{ "{tag} py_{number}+git{hash}".format(tag=environ.get("GIT_DESCRIBE_TAG"), number=environ.get("GIT_DESCRIBE_NUMBER"), hash=environ.get("GIT_DESCRIBE_HASH")[1:]) if "GIT_DESCRIBE_TAG" in environ else "" }} - artiq {{ "{tag} py_{number}+git{hash}".format(tag=environ.get("GIT_DESCRIBE_TAG"), number=environ.get("GIT_DESCRIBE_NUMBER"), hash=environ.get("GIT_FULL_HASH", "")[:8]) if "GIT_DESCRIBE_TAG" in environ else "" }}
about: about:
home: http://m-labs.hk/artiq home: http://m-labs.hk/artiq
license: GPL license: LGPL
summary: 'Bitstream, BIOS and runtime for NIST_QC1 on the Pipistrello board' summary: 'Bitstream, BIOS and runtime for NIST_QC1 on the Pipistrello board'

View File

@ -1,5 +0,0 @@
#!/bin/bash
ARTIQ_PREFIX=$PREFIX/lib/python3.5/site-packages/artiq
$PYTHON setup.py install --single-version-externally-managed --record=record.txt

View File

@ -5,37 +5,44 @@ package:
source: source:
git_url: ../.. git_url: ../..
{% set data = load_setup_py_data() %}
build: build:
noarch_python: true noarch: python
number: {{ environ.get("GIT_DESCRIBE_NUMBER", 0) }} number: {{ environ.get("GIT_DESCRIBE_NUMBER", 0) }}
string: py_{{ environ.get("GIT_DESCRIBE_NUMBER", 0) }}+git{{ environ.get("GIT_DESCRIBE_HASH", "")[1:] }} string: py_{{ environ.get("GIT_DESCRIBE_NUMBER", 0) }}+git{{ environ.get("GIT_FULL_HASH", "")[:8] }}
entry_points:
# NOTE: conda-build cannot distinguish between console and gui scripts
{% for entry_point_type, entry_points in data.get("entry_points", dict()).items() -%}
{% for entry_point in entry_points -%}
- {{ entry_point }}
{% endfor %}
{% endfor %}
script: $PYTHON setup.py install --single-version-externally-managed --record=record.txt
requirements: requirements:
build: build:
- python >=3.5.2 - python >=3.5.3,<3.6
- setuptools - setuptools 33.1.1
- numpy
- binutils-or1k-linux
run: run:
- python >=3.5.2 - python >=3.5.3,<3.6
- llvmlite-artiq 0.10.0.dev py35_24 - llvmlite-artiq 0.10.0.dev py35_24
- binutils-or1k-linux
- pythonparser 1.0
- openocd 0.10.0 1
- lit - lit
- outputcheck - outputcheck
- scipy - scipy
- numpy - numpy
- prettytable - prettytable
- asyncserial - asyncserial
- sphinx
- sphinx-argparse
- h5py - h5py
- dateutil - dateutil
- pyqt5 - pyqt >=5.5
- quamash - quamash
- pyqtgraph - pyqtgraph 0.10.0
- pygit2 - pygit2
- aiohttp - aiohttp
- binutils-or1k-linux
- pythonparser
- levenshtein - levenshtein
test: test:
@ -44,5 +51,5 @@ test:
about: about:
home: https://m-labs.hk/artiq home: https://m-labs.hk/artiq
license: GPL license: LGPL
summary: 'ARTIQ (Advanced Real-Time Infrastructure for Quantum physics) is a next-generation control system for quantum information experiments. It is being developed in partnership with the Ion Storage Group at NIST, and its applicability reaches beyond ion trapping.' summary: 'ARTIQ (Advanced Real-Time Infrastructure for Quantum physics) is a next-generation control system for quantum information experiments. It is being developed in partnership with the Ion Storage Group at NIST, and its applicability reaches beyond ion trapping.'

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,18 @@
{% extends "!layout.html" %}
{# since sphinx_rtd_theme moves scripts to the end, hook up WaveDrom again #}
{%- block footer %}
{{ super() }}
<script>(function(){
window.addEventListener(
"load",
(function(){ try {
WaveDrom.ProcessAll();
} catch(e) {} }),
false);
})();</script>
<div style="background-color: #FFBABA; color: #6A0E0E; position: fixed; min-width: 768px; top: 0; width: 100%; padding: 8px 20px 8px; font-size: 14px; line-height: 1.6; text-align: center; z-index: 300">
WARNING: This document is for an old version of ARTIQ. For the most recent release go to <a href="https://m-labs.hk/artiq/manual/">https://m-labs.hk/artiq/manual/</a>.
</div>
{% endblock %}

View File

@ -10,9 +10,10 @@ A number of Python features can be used inside a kernel for compilation and exec
* Booleans * Booleans
* 32-bit signed integers (default size) * 32-bit signed integers (default size)
* 64-bit signed integers (use ``int(n, width=64)`` to convert) * 64-bit signed integers (use ``numpy.int64`` to convert)
* Double-precision floating point numbers * Double-precision floating point numbers
* Lists of any supported types * Lists of any supported types
* String constants
* User-defined classes, with attributes of any supported types (attributes that are not used anywhere in the kernel are ignored) * User-defined classes, with attributes of any supported types (attributes that are not used anywhere in the kernel are ignored)
For a demonstration of some of these features, see the ``mandelbrot.py`` example. For a demonstration of some of these features, see the ``mandelbrot.py`` example.
@ -29,23 +30,50 @@ Kernel code can call host functions without any additional ceremony. However, su
The Python types correspond to ARTIQ type annotations as follows: The Python types correspond to ARTIQ type annotations as follows:
+-------------+-------------------------+ +---------------+-------------------------+
| Python | ARTIQ | | Python | ARTIQ |
+=============+=========================+ +===============+=========================+
| NoneType | TNone | | NoneType | TNone |
+-------------+-------------------------+ +---------------+-------------------------+
| bool | TBool | | bool | TBool |
+-------------+-------------------------+ +---------------+-------------------------+
| int | TInt32, TInt64 | | int | TInt32 or TInt64 |
+-------------+-------------------------+ +---------------+-------------------------+
| float | TFloat | | float | TFloat |
+-------------+-------------------------+ +---------------+-------------------------+
| str | TStr | | str | TStr |
+-------------+-------------------------+ +---------------+-------------------------+
| list of T | TList(T) | | list of T | TList(T) |
+-------------+-------------------------+ +---------------+-------------------------+
| range | TRange32, TRange64 | | range | TRange32, TRange64 |
+-------------+-------------------------+ +---------------+-------------------------+
| numpy.int32 | TInt32 |
+---------------+-------------------------+
| numpy.int64 | TInt64 |
+---------------+-------------------------+
| numpy.float64 | TFloat |
+---------------+-------------------------+
Pitfalls
--------
The ARTIQ compiler accepts *nearly* a strict subset of Python 3. However, by necessity there
is a number of differences that can lead to bugs.
Arbitrary-length integers are not supported at all on the core device; all integers are
either 32-bit or 64-bit. This especially affects calculations that result in a 32-bit signed
overflow; if the compiler detects a constant that doesn't fit into 32 bits, the entire expression
will be upgraded to 64-bit arithmetics, however if all constants are small, 32-bit arithmetics
will be used even if the result will overflow. Overflows are not detected.
The result of calling the builtin ``round`` function is different when used with
the builtin ``float`` type and the ``numpy.float64`` type on the host interpreter; ``round(1.0)``
returns an integer value 1, whereas ``round(numpy.float64(1.0))`` returns a floating point value
``numpy.float64(1.0)``. Since both ``float`` and ``numpy.float64`` are mapped to
the builtin ``float`` type on the core device, this can lead to problems in functions marked
``@portable``; the workaround is to explicitly cast the argument of ``round`` to ``float``:
``round(float(numpy.float64(1.0)))`` returns an integer on the core device as well as on the host
interpreter.
Additional optimizations Additional optimizations
------------------------ ------------------------

View File

@ -16,6 +16,7 @@
import sys import sys
import os import os
import sphinx_rtd_theme
from unittest.mock import MagicMock from unittest.mock import MagicMock
@ -27,7 +28,13 @@ class Mock(MagicMock):
return Mock() return Mock()
mock_modules = ["artiq.gui.moninj", "quamash", "pyqtgraph", "matplotlib"] mock_modules = ["artiq.gui.moninj",
"artiq.gui.waitingspinnerwidget",
"artiq.gui.flowlayout",
"quamash", "pyqtgraph", "matplotlib",
"numpy", "dateutil", "dateutil.parser", "prettytable", "PyQt5",
"h5py", "serial", "scipy", "scipy.interpolate", "asyncserial",
"llvmlite_artiq", "Levenshtein", "aiohttp"]
for module in mock_modules: for module in mock_modules:
sys.modules[module] = Mock() sys.modules[module] = Mock()
@ -36,7 +43,7 @@ for module in mock_modules:
# If extensions (or modules to document with autodoc) are in another directory, # If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the # add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here. # documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('..')) sys.path.insert(0, os.path.abspath('../..'))
from artiq import __version__ as artiq_version from artiq import __version__ as artiq_version
@ -52,7 +59,9 @@ extensions = [
'sphinx.ext.autodoc', 'sphinx.ext.autodoc',
'sphinx.ext.mathjax', 'sphinx.ext.mathjax',
'sphinx.ext.viewcode', 'sphinx.ext.viewcode',
'sphinx.ext.napoleon',
'sphinxarg.ext', 'sphinxarg.ext',
'sphinxcontrib.wavedrom', # see also below for config
] ]
# Add any paths that contain templates here, relative to this directory. # Add any paths that contain templates here, relative to this directory.
@ -69,7 +78,7 @@ master_doc = 'index'
# General information about the project. # General information about the project.
project = 'ARTIQ' project = 'ARTIQ'
copyright = '2014-2016, M-Labs Limited' copyright = '2014-2017, M-Labs Limited'
# The version info for the project you're documenting, acts as replacement for # The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the # |version| and |release|, also used in various other places throughout the
@ -123,24 +132,16 @@ pygments_style = 'sphinx'
# The theme to use for HTML and HTML Help pages. See the documentation for # The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes. # a list of builtin themes.
html_theme = 'classic' html_theme = 'sphinx_rtd_theme'
# Theme options are theme-specific and customize the look and feel of a theme # Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the # further. For a list of options available for each theme, see the
# documentation. # documentation.
html_theme_options = { html_theme_options = {}
'sidebarbgcolor': '#171814',
'sidebarlinkcolor': '#7389ae',
'sidebartextcolor': '#b3b3bb',
'footerbgcolor': '#171814',
'footertextcolor': '#b3b3bb',
'relbarbgcolor': '#171814',
'relbarlinkcolor': '#7389ae',
'relbartextcolor': '#b3b3bb',
}
# Add any paths that contain custom themes here, relative to this directory. # Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = [] #html_theme_path = []
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
# The name for this set of Sphinx documents. If None, it defaults to # The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation". # "<project> v<release> documentation".
@ -151,7 +152,7 @@ html_theme_options = {
# The name of an image file (relative to this directory) to place at the top # The name of an image file (relative to this directory) to place at the top
# of the sidebar. # of the sidebar.
html_logo = "../logo/artiq_white.png" html_logo = '../logo/artiq_white.png'
# The name of an image file (within the static path) to use as favicon of the # The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
@ -290,3 +291,7 @@ texinfo_documents = [
# If true, do not generate a @detailmenu in the "Top" node's menu. # If true, do not generate a @detailmenu in the "Top" node's menu.
#texinfo_no_detailmenu = False #texinfo_no_detailmenu = False
# -- Options for sphinxcontrib-wavedrom -----------------------------------
offline_skin_js_path = '_static/default.js'
offline_wavedrom_js_path = '_static/WaveDrom.js'

View File

@ -38,6 +38,12 @@ Common problems
* When connected, QC1 and CLOCK adapters break the JTAG chain due to TDI not being connect to TDO on the FMC mezzanine. * When connected, QC1 and CLOCK adapters break the JTAG chain due to TDI not being connect to TDO on the FMC mezzanine.
* On some boards, the JTAG USB connector is not correctly soldered. * On some boards, the JTAG USB connector is not correctly soldered.
VADJ
++++
With the NIST CLOCK and QC2 adapters, for safe operation of the DDS buses (to prevent damage to the IO banks of the FPGA), the FMC VADJ rail of the KC705 should be changed to 3.3V. Plug the Texas Instruments USB-TO-GPIO PMBus adapter into the PMBus connector in the corner of the KC705 and use the Fusion Digital Power Designer software to configure (requires Windows). Write to chip number U55 (address 52), channel 4, which is the VADJ rail, to make it 3.3V instead of 2.5V. Power cycle the KC705 board to check that the startup voltage on the VADJ rail is now 3.3V.
NIST QC1 NIST QC1
++++++++ ++++++++
@ -149,8 +155,6 @@ To avoid I/O contention, the startup kernel should first program the TCA6424A ex
See :mod:`artiq.coredevice.i2c` for more details. See :mod:`artiq.coredevice.i2c` for more details.
For safe operation of the DDS buses (to prevent damage to the IO banks of the FPGA), the FMC VADJ rail of the KC705 should be changed to 3.3V. Plug the Texas Instruments USB-TO-GPIO PMBus adapter into the PMBus connector in the corner of the KC705 and use the Fusion Digital Power Designer software to configure (requires Windows). Write to chip number U55 (address 52), channel 4, which is the VADJ rail, to make it 3.3V instead of 2.5V. Power cycle the KC705 board to check that the startup voltage on the VADJ rail is now 3.3V.
Pipistrello Pipistrello
----------- -----------

View File

@ -21,15 +21,9 @@ As a very first step, we will turn on a LED on the core device. Create a file ``
self.core.reset() self.core.reset()
self.led.on() self.led.on()
The central part of our code is our ``LED`` class, that derives from :class:`artiq.language.environment.EnvExperiment`. Among other features, ``EnvExperiment`` calls our ``build`` method and provides the ``setattr_device`` method that interfaces to the device database to create the appropriate device drivers and make those drivers accessible as ``self.core`` and ``self.led``. The ``@kernel`` decorator tells the system that the ``run`` method must be executed on the core device (instead of the host). The decorator uses ``self.core`` internally, which is why we request the core device using ``setattr_device`` like any other. The central part of our code is our ``LED`` class, that derives from :class:`artiq.language.environment.EnvExperiment`. Among other features, ``EnvExperiment`` calls our ``build`` method and provides the ``setattr_device`` method that interfaces to the device database to create the appropriate device drivers and make those drivers accessible as ``self.core`` and ``self.led``. The ``@kernel`` decorator tells the system that the ``run`` method must be compiled for and executed on the core device (instead of being interpreted and executed as regular Python code on the host). The decorator uses ``self.core`` internally, which is why we request the core device using ``setattr_device`` like any other.
Copy the file ``device_db.pyon`` (containing the device database) from the ``examples/master`` folder of ARTIQ into the same directory as ``led.py`` (alternatively, you can use the ``--device-db`` option of ``artiq_run``). You can open PYON database files using a text editor - their contents are in a human-readable format. You will probably want to set the IP address of the core device in ``device_db.pyon`` so that the computer can connect to it (it is the ``host`` parameter of the ``comm`` entry). See :ref:`device-db` for more information. The example device database is designed for the NIST QC1 hardware on the KC705; see :ref:`board-ports` for RTIO channel assignments if you need to adapt the device database to a different hardware platform. Copy the file ``device_db.pyon`` (containing the device database) from the ``examples/master`` folder of ARTIQ into the same directory as ``led.py`` (alternatively, you can use the ``--device-db`` option of ``artiq_run``). You can open PYON database files using a text editor - their contents are in a human-readable format. You will probably want to set the IP address of the core device in ``device_db.pyon`` so that the computer can connect to it (it is the ``host`` parameter of the ``comm`` entry). See :ref:`device-db` for more information. The example device database is designed for the ``nist_clock`` hardware adapter on the KC705; see :ref:`board-ports` for RTIO channel assignments if you need to adapt the device database to a different hardware platform.
.. note::
If the ``led`` device is a bidirectional TTL (i.e. ``TTLInOut`` instead of ``TTLOut``), you need to put it in output (driving) mode. Add the following at the beginning of ``run``: ::
self.led.output()
delay(0.1*us)
.. note:: .. note::
To obtain the examples, you can find where the ARTIQ package is installed on your machine with: :: To obtain the examples, you can find where the ARTIQ package is installed on your machine with: ::
@ -42,8 +36,8 @@ Run your code using ``artiq_run``, which is part of the ARTIQ front-end tools: :
The process should terminate quietly and the LED of the device should turn on. Congratulations! You have a basic ARTIQ system up and running. The process should terminate quietly and the LED of the device should turn on. Congratulations! You have a basic ARTIQ system up and running.
Host/core device interaction Host/core device interaction (RPC)
---------------------------- ----------------------------------
A method or function running on the core device (which we call a "kernel") may communicate with the host by calling non-kernel functions that may accept parameters and may return a value. The "remote procedure call" (RPC) mechanisms handle automatically the communication between the host and the device of which function to call, with which parameters, and what the returned value is. A method or function running on the core device (which we call a "kernel") may communicate with the host by calling non-kernel functions that may accept parameters and may return a value. The "remote procedure call" (RPC) mechanisms handle automatically the communication between the host and the device of which function to call, with which parameters, and what the returned value is.
@ -77,12 +71,16 @@ You can then turn the LED off and on by entering 0 or 1 at the prompt that appea
What happens is the ARTIQ compiler notices that the ``input_led_state`` function does not have a ``@kernel`` decorator and thus must be executed on the host. When the core device calls it, it sends a request to the host to execute it. The host displays the prompt, collects user input, and sends the result back to the core device, which sets the LED state accordingly. What happens is the ARTIQ compiler notices that the ``input_led_state`` function does not have a ``@kernel`` decorator and thus must be executed on the host. When the core device calls it, it sends a request to the host to execute it. The host displays the prompt, collects user input, and sends the result back to the core device, which sets the LED state accordingly.
RPC functions must always return a value of the same type. When they return a non-``None`` value, the compiler should be informed in advance of the type of the value, which is what the ``-> TBool`` annotation is for. RPC functions must always return a value of the same type. When they return a value that is not ``None``, the compiler should be informed in advance of the type of the value, which is what the ``-> TBool`` annotation is for.
The ``break_realtime`` call is necessary to waive the real-time requirements of the LED state change (as the ``input_led_state`` function can take an arbitrarily long time). This will become clearer later as we explain timing control. Without the ``break_realtime()`` call, the RTIO events emitted by ``self.led.on()`` or ``self.led.off()`` would be scheduled at a fixed and very short delay after entering ``run()``.
These events would fail because the RPC to ``input_led_state()`` can take an arbitrary amount of time and therefore the deadline for submission of RTIO events would have long passed when ``self.led.on()`` or ``self.led.off()`` are called.
The ``break_realtime()`` call is necessary to waive the real-time requirements of the LED state change.
It advances the timeline far enough to ensure that events can meet the submission deadline.
Real-time I/O
------------- Real-time I/O (RTIO)
--------------------
The point of running code on the core device is the ability to meet demanding real-time constraints. In particular, the core device can respond to an incoming stimulus or the result of a measurement with a low and predictable latency. We will see how to use inputs later; first, we must familiarize ourselves with how time is managed in kernels. The point of running code on the core device is the ability to meet demanding real-time constraints. In particular, the core device can respond to an incoming stimulus or the result of a measurement with a low and predictable latency. We will see how to use inputs later; first, we must familiarize ourselves with how time is managed in kernels.
@ -99,18 +97,28 @@ Create a new file ``rtio.py`` containing the following: ::
@kernel @kernel
def run(self): def run(self):
self.core.reset() self.core.reset()
self.ttl0.output()
for i in range(1000000): for i in range(1000000):
self.ttl0.pulse(2*us)
delay(2*us) delay(2*us)
self.ttl0.pulse(2*us)
In its ``build()`` method, the experiment obtains the core device and a TTL device called ``ttl0`` as defined in the device database.
In ARTIQ, TTL is used roughly synonymous with "a single generic digital signal" and does not refer to a specific signaling standard or voltage/current levels.
.. note:: When ``run()``, the experiment first ensures that ``ttl0`` is in output mode and actively driving the device it is connected to.
If ``ttl0`` is a bidirectional channel (``TTLInOut``), it is in input (non-driving) mode by default. You need to call ``self.ttl0.output()`` as explained above for the LED. Bidirectional TTL channels (i.e. ``TTLInOut``) are in input (high impedance) mode by default, output-only TTL channels (``TTLOut``) are always in output mode.
There are no input-only TTL channels.
The experiment then drives one million 2 µs long pulses separated by 2 µs each.
Connect an oscilloscope or logic analyzer to TTL0 and run ``artiq_run.py rtio.py``.
Notice that the generated signal's period is precisely 4 µs, and that it has a duty cycle of precisely 50%.
This is not what you would expect if the delay and the pulse were implemented with register-based general purpose input output (GPIO) that is CPU-controlled.
The signal's period would depend on CPU speed, and overhead from the loop, memory management, function calls, etc, all of which are hard to predict and variable.
Any asymmetry in the overhead would manifest itself in a distorted and variable duty cycle.
Connect an oscilloscope or logic analyzer to TTL0 and run ``artiq_run.py led.py``. Notice that the generated signal's period is precisely 4 microseconds, and that it has a duty cycle of precisely 50%. This is not what you would expect if the delay and the pulse were implemented with CPU-controlled GPIO: overhead from the loop management, function calls, etc. would increase the signal's period, and asymmetry in the overhead would cause duty cycle distortion. Instead, inside the core device, output timing is generated by the gateware and the CPU only programs switching commands with certain timestamps that the CPU computes.
Instead, inside the core device, output timing is generated by the gateware and the CPU only programs switching commands with certain timestamps that the CPU computes. This guarantees precise timing as long as the CPU can keep generating timestamps that are increasing fast enough. In case it fails to do that (and attempts to program an event with a timestamp in the past), the :class:`artiq.coredevice.exceptions.RTIOUnderflow` exception is raised. The kernel causing it may catch it (using a regular ``try... except...`` construct), or it will be propagated to the host. This guarantees precise timing as long as the CPU can keep generating timestamps that are increasing fast enough. In case it fails to do that (and attempts to program an event with a timestamp smaller than the current RTIO clock timestamp), a :class:`artiq.coredevice.exceptions.RTIOUnderflow` exception is raised. The kernel causing it may catch it (using a regular ``try... except...`` construct), or it will be propagated to the host.
Try reducing the period of the generated waveform until the CPU cannot keep up with the generation of switching events and the underflow exception is raised. Then try catching it: :: Try reducing the period of the generated waveform until the CPU cannot keep up with the generation of switching events and the underflow exception is raised. Then try catching it: ::
@ -135,6 +143,38 @@ Try reducing the period of the generated waveform until the CPU cannot keep up w
except RTIOUnderflow: except RTIOUnderflow:
print_underflow() print_underflow()
Parallel and sequential blocks
------------------------------
It is often necessary that several pulses overlap one another. This can be expressed through the use of ``with parallel`` constructs, in which the events generated by the individual statements are executed at the same time. The duration of the ``parallel`` block is the duration of its longest statement.
Try the following code and observe the generated pulses on a 2-channel oscilloscope or logic analyzer: ::
for i in range(1000000):
with parallel:
self.ttl0.pulse(2*us)
self.ttl1.pulse(4*us)
delay(4*us)
ARTIQ can implement ``with parallel`` blocks without having to resort to any of the typical parallel processing approaches.
It simply remembers the position on the timeline when entering the ``parallel`` block and then seeks back to that position after submitting the events generated by each statement.
In other words, the statements in the ``parallel`` block are actually executed sequentially, only the RTIO events generated by them are scheduled to be executed in parallel.
Note that if a statement takes a lot of CPU time to execute (this different from the events scheduled by a statement taking a long time), it may cause a subsequent statement to miss the deadline for timely submission of its events.
This then causes a ``RTIOUnderflow`` exception to be raised.
Within a parallel block, some statements can be made sequential again using a ``with sequential`` construct. Observe the pulses generated by this code: ::
for i in range(1000000):
with parallel:
with sequential:
self.ttl0.pulse(2*us)
delay(1*us)
self.ttl0.pulse(1*us)
self.ttl1.pulse(4*us)
delay(4*us)
RTIO analyzer RTIO analyzer
------------- -------------
@ -157,30 +197,3 @@ The core device records the real-time I/O waveforms into a circular buffer. It i
delay(...) delay(...)
Afterwards, the recorded data can be extracted and written to a VCD file using ``artiq_coreanalyzer -w rtio.vcd`` (see: :ref:`core-device-rtio-analyzer-tool`). VCD files can be viewed using third-party tools such as GtkWave. Afterwards, the recorded data can be extracted and written to a VCD file using ``artiq_coreanalyzer -w rtio.vcd`` (see: :ref:`core-device-rtio-analyzer-tool`). VCD files can be viewed using third-party tools such as GtkWave.
Parallel and sequential blocks
------------------------------
It is often necessary that several pulses overlap one another. This can be expressed through the use of ``with parallel`` constructs, in which all statements execute at the same time. The execution time of the ``parallel`` block is the execution time of its longest statement.
Try the following code and observe the generated pulses on a 2-channel oscilloscope or logic analyzer: ::
for i in range(1000000):
with parallel:
self.ttl0.pulse(2*us)
self.ttl1.pulse(4*us)
delay(4*us)
Within a parallel block, some statements can be made sequential again using a ``with sequential`` construct. Observe the pulses generated by this code: ::
for i in range(1000000):
with parallel:
with sequential:
self.ttl0.pulse(2*us)
delay(1*us)
self.ttl0.pulse(1*us)
self.ttl1.pulse(4*us)
delay(4*us)
.. note::
Branches of a ``parallel`` block are executed one after another, with a reset of the internal RTIO time variable before moving to the next branch. If a branch takes a lot of CPU time, it may cause an underflow when the next branch begins its execution.

View File

@ -10,6 +10,7 @@ Contents:
installing installing
installing_from_source installing_from_source
release_notes release_notes
rtio
getting_started_core getting_started_core
compiler compiler
getting_started_mgmt getting_started_mgmt

View File

@ -31,7 +31,11 @@ Executing just ``conda`` should print the help of the ``conda`` command [1]_.
Installing the ARTIQ packages Installing the ARTIQ packages
----------------------------- -----------------------------
Add the M-Labs ``main`` Anaconda package repository containing stable releases and release candidates to your conda configuration:: First add the conda-forge repository containing ARTIQ dependencies to your conda configuration::
$ conda config --add channels http://conda.anaconda.org/conda-forge/label/main
Then add the M-Labs ``main`` Anaconda package repository containing stable releases and release candidates::
$ conda config --add channels http://conda.anaconda.org/m-labs/label/main $ conda config --add channels http://conda.anaconda.org/m-labs/label/main

View File

@ -43,10 +43,9 @@ and the ARTIQ kernels.
* Install LLVM and Clang: :: * Install LLVM and Clang: ::
$ cd ~/artiq-dev $ cd ~/artiq-dev
$ git clone https://github.com/openrisc/llvm-or1k $ git clone -b artiq-3.8 https://github.com/m-labs/llvm-or1k
$ cd llvm-or1k/tools $ cd llvm-or1k
$ git clone https://github.com/openrisc/clang-or1k clang $ git clone -b artiq-3.8 https://github.com/m-labs/clang-or1k tools/clang
$ cd ..
$ mkdir build $ mkdir build
$ cd build $ cd build
@ -89,8 +88,8 @@ These steps are required to generate gateware bitstream (``.bit``) files, build
:: ::
$ cd ~/artiq-dev $ cd ~/artiq-dev
$ wget https://raw.githubusercontent.com/jordens/bscan_spi_bitstreams/master/bscan_spi_xc7k325t.bit $ wget https://raw.githubusercontent.com/jordens/bscan_spi_bitstreams/single-tap/bscan_spi_xc7k325t.bit
$ wget https://raw.githubusercontent.com/jordens/bscan_spi_bitstreams/master/bscan_spi_xc6slx45.bit $ wget https://raw.githubusercontent.com/jordens/bscan_spi_bitstreams/single-tap/bscan_spi_xc6slx45.bit
Then move both files ``~/artiq-dev/bscan_spi_xc6slx45.bit`` and ``~/artiq-dev/bscan_spi_xc7k325t.bit`` to ``~/.migen``, ``/usr/local/share/migen``, or ``/usr/share/migen``. Then move both files ``~/artiq-dev/bscan_spi_xc6slx45.bit`` and ``~/artiq-dev/bscan_spi_xc7k325t.bit`` to ``~/.migen``, ``/usr/local/share/migen``, or ``/usr/share/migen``.
@ -146,7 +145,7 @@ These steps are required to generate gateware bitstream (``.bit``) files, build
$ python3.5 -m artiq.gateware.targets.kc705 -H nist_qc1 # or nist_qc2 $ python3.5 -m artiq.gateware.targets.kc705 -H nist_qc1 # or nist_qc2
.. note:: Add ``--toolchain vivado`` if you wish to use Vivado instead of ISE. .. note:: Add ``--toolchain ise`` if you wish to use ISE instead of Vivado.
* Then, gather the binaries and flash them: :: * Then, gather the binaries and flash them: ::

Some files were not shown because too many files have changed in this diff Show More