Skip to content

Draft: Inline Q1ASM operation

Axel E. Andersson requested to merge q1asm_inject_939 into main

Example

def test_schedule(qubit_name : str, sweepable_dummy : ManualParameter | list, repetitions : int = 1):
    sched = Schedule("qasm injections", repetitions)

    # Ensure iterable when passing a float
    sweepable_dummy = np.asarray(sweepable_dummy)
    sweepable_dummy = sweepable_dummy.reshape(sweepable_dummy.shape or (1,))

    for acq_idx, _ in enumerate(sweepable_dummy):
        sched.add(InlineQ1ASM(
        program ="""
            set_awg_gain 8192,0 # setting gain for Measure q0   
            play 0,0,4 # play Measure q0 (300 ns)               
            acquire 0,0,4                                       
            wait 292 # auto generated wait (292 ns)             
            set_awg_gain 32756,0 # setting gain for GaussPulse  
            play 1,1,4 # play GaussPulse (200 ns)               
            wait 196 # auto generated wait (196 ns)                       
        """, port="q1:res", clock = "q1.ro", duration = 10000e-9))
        sched.add(Measure(qubit_name, acq_index=acq_idx))
        sched.add(GaussPulse(G_amp=1, phase=0, duration=300e-9, port="q0:res", clock="q0.ro"))


    return sched

Output

Here the program duration is set by the user to 10 µs, which is not valid. It is just to show what happens when user specifies duration


 TIME (NS)  CLUSTER0_MODULE7:SEQ0                                CLUSTER0_MODULE7:SEQ1                                                           
    
  0           set_mrk 3 # set markers to 3                         set_mrk 3 # set markers to 3                                                   
              wait_sync 4                                          wait_sync 4                                                                    
  4           upd_param 4                                          upd_param 4                                                                    
  8           wait 4 # latency correction of 4 + 0 ns              wait 4 # latency correction of 4 + 0 ns                                        
  12          move 1,R0 # iterator for loop with label start       move 1,R0 # iterator for loop with label start                                 
             start:                                               start:                                                                          
              reset_ph                                             reset_ph                                                                       
              upd_param 4                                          upd_param 4                                                                    
  16          wait 10000 # auto generated wait (10000 ns)           set_awg_gain 8192,0  # [INJECTION]  setting gain for Measure q0               
                                                                    play 0,0,4  # [INJECTION]  play Measure q0 (300 ns)                           
  20                                                                acquire 0,0,4  # [INJECTION]                                                  
  24                                                                wait 292  # [INJECTION]  auto generated wait (292 ns)                         
  316                                                               set_awg_gain 32756,0  # [INJECTION]  setting gain for GaussPulse              
                                                                    play 1,1,4  # [INJECTION]  play GaussPulse (200 ns)                           
  320                                                               wait 196  # [INJECTION]  auto generated wait (196 ns)                         
  516                                                              wait 600 # auto generated wait (600 ns)                                        
  1116                                                             loop R0,@start                                                                 
                                                                   stop                                                                           
  10016       reset_ph                                                                                                                            
              set_awg_gain 8192,0 # setting gain for Measure q0                                                                                   
              play 0,0,4 # play Measure q0 (300 ns)                                                                                               
  10020       acquire 0,0,4                                                                                                                       
  10024       wait 292 # auto generated wait (292 ns)                                                                                             
  10316       set_awg_gain 32756,0 # setting gain for GaussPulse                                                                                  
              play 1,1,4 # play GaussPulse (300 ns)                                                                                               
  10320       wait 296 # auto generated wait (296 ns)                                                                                             
  10616       loop R0,@start                                                                                                                      
              stop   

Merge checklist

See also merge request guidelines

  • Merge request has been reviewed (in-depth by a knowledgeable contributor), and is approved by a project maintainer.
  • New code is covered by unit tests (or N/A).
  • New code is documented and docstrings use numpydoc format (or N/A).
  • New functionality: considered making private instead of extending public API (or N/A).
  • Public API changed: added @deprecated and entry in deprecated code suggestions (or N/A).
  • Newly added/adjusted documentation and docstrings render properly (or N/A).
  • Pipeline fix or dependency update: post in #software-for-developers channel to merge main back in or update local packages (or N/A).
  • Tested on hardware (or N/A).
  • CHANGELOG.md and AUTHORS.md have been updated (or N/A).
  • Update Hardware backends documentation if backend interface change or N/A
  • Performance tests: if changes can affect performance, trigger CI manually and evaluate results (or N/A).
  • Windows tests in CI pipeline pass (manually triggered by maintainers before merging).
    • Maintainers do not hit Auto-merge, we need to actively check as manual tests do not block pipeline

For reference, the issues workflow is described in the contribution guidelines.

Edited by Axel E. Andersson

Merge request reports