Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LoadRepeat should come before the loop label #33

Merged
merged 1 commit into from
May 20, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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