Skip to content

Commit

Permalink
Merge pull request #33 from BBN-Q/fix/label-repeat
Browse files Browse the repository at this point in the history
LoadRepeat should come before the loop label
  • Loading branch information
caryan committed May 20, 2016
2 parents 50eae62 + 8f520cf commit b65e898
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion QGL/drivers/APS2Pattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,7 @@ def create_seq_instructions(seqs, offsets):
# 3. SET_PHASE should happen after RESET_PHASE
# 4. instructions to different engines should have single write flag
# 5. labels should be moved to the first instruction
# 6. LoadRepeat should be moved before the label for the repeated instructions
def find_and_pop_entries(predicate):
matched = []
for ct, entry in enumerate(entries):
Expand All @@ -550,6 +551,7 @@ def find_and_pop_entries(predicate):

if len(entries) > 1:
#reorder
load_entry = find_and_pop_entries(lambda e: isinstance(e[0], ControlFlow.LoadRepeat))
label_entry = find_and_pop_entries(lambda e: isinstance(e[0], BlockLabel.BlockLabel))
sync_entry = find_and_pop_entries(lambda e: isinstance(e[0], ControlFlow.Sync))
trig_entry = find_and_pop_entries(lambda e: isinstance(e[0], ControlFlow.Wait))
Expand All @@ -558,7 +560,7 @@ def find_and_pop_entries(predicate):
frame_entry = find_and_pop_entries(lambda e: isinstance(e[0], ModulationCommand) and e[0].instruction == "UPDATE_FRAME")
phase_entry = find_and_pop_entries(lambda e: isinstance(e[0], ModulationCommand) and e[0].instruction == "SET_PHASE")
freq_entry = find_and_pop_entries(lambda e: isinstance(e[0], ModulationCommand) and e[0].instruction == "SET_FREQ")
reordered_entries = label_entry + sync_entry + control_flow_entries + reset_entry + phase_entry + freq_entry + frame_entry + trig_entry
reordered_entries = load_entry + label_entry + sync_entry + control_flow_entries + reset_entry + phase_entry + freq_entry + frame_entry + trig_entry
write_flags = [True]*len(reordered_entries)
for entry in entries:
reordered_entries.append(entry)
Expand Down

0 comments on commit b65e898

Please sign in to comment.