Skip to content

Commit e1aa131

Browse files
committed
Merged in ReneKolb/Pulseblaster_MaxInstructions (pull request labscript-suite#1)
Added a check to allow for an error message when the maximum number of instructions is exceeded. The number can be configured in the constructor / ConnectionTable. For our Pulseblaster this is 4000, so I chose this as the default value.
2 parents 4e479df + 3e9e5dc commit e1aa131

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

PulseBlaster.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ class PulseBlaster(PseudoclockDevice):
9595

9696
@set_passed_properties(
9797
property_names = {"connection_table_properties": ["firmware", "programming_scheme"],
98-
"device_properties": ["pulse_width"]}
98+
"device_properties": ["pulse_width", "max_instructions"]}
9999
)
100-
def __init__(self, name, trigger_device=None, trigger_connection=None, board_number=0, firmware = '', programming_scheme='pb_start/BRANCH', pulse_width=None, **kwargs):
100+
def __init__(self, name, trigger_device=None, trigger_connection=None, board_number=0, firmware = '', programming_scheme='pb_start/BRANCH', pulse_width=None, max_instructions=4000, **kwargs):
101101
PseudoclockDevice.__init__(self, name, trigger_device, trigger_connection, **kwargs)
102102
self.BLACS_connection = board_number
103103
# TODO: Implement capability checks based on firmware revision of PulseBlaster
@@ -143,7 +143,7 @@ def __init__(self, name, trigger_device=None, trigger_connection=None, board_num
143143
pulse_width = 'symmetric'
144144
self.pulse_width = None
145145

146-
146+
self.max_instructions = max_instructions
147147

148148
# Create the internal pseudoclock
149149
self._pseudoclock = Pseudoclock('%s_pseudoclock'%name, self, 'clock') # possibly a better connection name than 'clock'?
@@ -507,6 +507,10 @@ def convert_to_pb_inst(self, dig_outputs, dds_outputs, freqs, amps, phases):
507507
'data': 0, 'delay': 10.0/self.clock_limit*1e9})
508508
else:
509509
raise AssertionError('Invalid programming scheme %s'%str(self.programming_scheme))
510+
511+
if len(pb_inst) > self.max_instructions:
512+
raise LabscriptError("The Pulseblaster memory cannot store more than 4000 instuctions, but the PulseProgram contains {:d} instructions.".format(len(pb_inst)))
513+
510514
return pb_inst
511515

512516
def write_pb_inst_to_h5(self, pb_inst, hdf5_file):

0 commit comments

Comments
 (0)