This repository was archived by the owner on Jan 18, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 228
add suservo CPLD #2862
Open
DonovanWebb
wants to merge
1
commit into
m-labs:master
Choose a base branch
from
DonovanWebb:protorev_polymorph_compat
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
add suservo CPLD #2862
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -564,3 +564,66 @@ def set_y(self, profile, y): | |
| raise ValueError("Invalid SUServo y-value!") | ||
| self.set_y_mu(profile, y_mu) | ||
| return y_mu | ||
|
|
||
|
|
||
| class ProtoRev8(urukul.ProtoRev8): | ||
| """ | ||
| For use with suservo CPLD to get around polymorphic issues. | ||
| """ | ||
|
|
||
|
|
||
| class ProtoRev9(urukul.ProtoRev9): | ||
| """ | ||
| For use with suservo CPLD to get around polymorphic issues. | ||
| """ | ||
|
|
||
|
|
||
| class CPLD(urukul.CPLD): | ||
| """ | ||
| Needed to avoid polymorphic issues when using SUServo and regular Urukuls in the same experiment. | ||
| """ | ||
| rb_len = 8 | ||
|
|
||
| ProtoRev8 = ProtoRev8 # needed to avoid polymorphic issues | ||
| ProtoRev9 = ProtoRev9 # needed to avoid polymorphic issues | ||
|
|
||
| def __init__( | ||
| self, | ||
| dmgr, | ||
| spi_device, | ||
| io_update_device=None, | ||
| dds_reset_device=None, | ||
| sync_device=None, | ||
| sync_sel=0, | ||
| clk_sel=0, | ||
| clk_div=0, | ||
| rf_sw=0, | ||
| refclk=125e6, | ||
| att=0x00000000, | ||
| sync_div=None, | ||
| proto_rev=0x08, | ||
| core_device="core", | ||
| ): | ||
| # Separate IO_UPDATE TTL output device used by SUServo core, | ||
| # if active, else by artiq.coredevice.suservo.AD9910 | ||
| # :meth:`measure_io_update_alignment`. | ||
| # The urukul.CPLD driver utilises the CPLD CFG register | ||
| # option instead for pulsing IO_UPDATE of masked DDSs. | ||
| self.io_update_ttl = dmgr.get(io_update_device) | ||
| urukul.CPLD.__init__( | ||
| self, | ||
| dmgr, | ||
| spi_device, | ||
| io_update_device, | ||
| dds_reset_device, | ||
| sync_device, | ||
| sync_sel, | ||
| clk_sel, | ||
| clk_div, | ||
| rf_sw, | ||
| refclk, | ||
| att, | ||
| sync_div, | ||
| proto_rev, | ||
| core_device, | ||
| ) | ||
|
Comment on lines
+590
to
+629
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Which part of this is actually necessary for this PR? It seems like this might again all be related to phase-coherent SUServo support, so it doesn't make sense to upstream at this point. |
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems related to phase-coherent suservo support and probably shouldn't be in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest, this PR shouldn't exist at all. @DonovanWebb Can you just try on the nac3 branch? https://git.m-labs.hk/M-Labs/nac3/issues/664 appears to be fixed, which in theory was the last hurdle to get this to work properly. Though I have not tested it nor updated the Urukul driver yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nac3isn't anything close to a drop-in replacement, and in any case this driver is for the legacy compiler only. This PR is just cleaning up after the recentProtoRev9changes, which were merged onto the non-nac3 branch, but broke a common use case (mixing SUServo and non-SUServo Urukuls; cf. various forum discussions).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dnadlinger Your PR to fix the bug in the legacy compiler would be appreciated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And adding hacks/workarounds is never "cleaning up".
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not a bug per-se, it's a long-standing limitation. It would be possible to change to "monomorphising" types per instance with some sort of merging of identical shapes, but every Python class corresponding to an ARTIQ Python type is a pretty central part of the current design. The SUServo driver does not take into account this facet of the design (at least not while keeping compatibility with the non-SUServo Urukul driver in the same kernel). This is a real-world issue, as evidenced not just by the Oxford group's, but several other labs' reports here or on the forum, so it obviously needs to be fixed.
If you want to play games about the "proper fix", I'd argue that this points to reverting the ProtoRev9 refactor instead, as it broke an important use case. Of course, the sensible solution is just to tweak the refactored driver to once again allow running the two variants side-by-side.