C++ Application programming interface
Data types for sequence representation
Class hierarchy for counter value objects:
-
Counter(defined inelements.hh): containers that hold the count value (number of repetitions)Strobe: regular elements that are strobed outNoStrobe: elements that are not strobed out (and the qout_valid signal is deasserted)
Interface of Counter objects:
count(): returns the count valuecount_str(): the count value as a string in hexadecimal and decimal form for inspection and troubleshootingcontrol_bits(): returns the bits to be or'd in the control registerdesc(): get a descriptive string about the control settings; empty for the default case ofStrobeclone(): generate a std::share_ptr to a cloned object for use in class compositions (elementelobjects, see below)
Update types (d is the input value, q_prev is the previous output value, q is the new output value to be streamed out):
LOAD: loads new data, i.e., verbatim assignment,q = dSET: sets bits according to a mask pattern,q = q_prev | dCLEAR: clears bits according to a mask pattern,q = q_prev & ~dFLIP: flips bits according to a mask pattern,q = q_prev ^ dNOT: invert bits,q = ~q_prev(same as FLIP with all ones)AND: bitwise and,q = q_prev & d(same as CLEAR with inverted values)OR: bitwise or,q = q_prev | d(same as SET)XOR: bitwise xor,q = q_prev ^ d(same as FLIP)XNOR: bitwise xnor,q = q_prev ^~ d(equivalence)SLL: shift left logical (fill with zero),q = q_prev << dSRL: shift right logical (fill with zero),q = q_prev >> d
Corresponding class hierarchy:
-
Value(defined inelements.hh): parent classBitLoadBitSetBitClearBitFlipBitNotBitAndBitOrBitXorBitXnorBitSllBitSrl
Interface of Value objects:
value(): returns the stored valuevalue_str(): the count value as a string in hexadecimal and decimal form for inspection and troubleshootingresult(value_t v_prev): returns the result of the updated value, wherev_previs the previous valuemode_bits(): returns the mode bits to be or'd in the control registerdesc(): get a descriptive string describing the update modeclone(): generate a std::share_ptr to a cloned object for use in compositions (elementelobjects, see below)
An additional class derived from Value is the class TriggerCondition. It has a bespoke constructor that takes
pattern and mask bits as input and converts that into a value_t quantity. Furthermore, the value_str() method
decomposes this value into pattern and mask and represents them as hexadecimal value and bitsets.
Class el (defined in elements.hh) represents elements of the sequence. There are multiple constructors:
el(): sequence terminator with a default value of the output bus (0xFFFFFFFF)el(value_t): sequence terminator with a selected final value of the output busel(count_t, value_t): regular element,BitLoadupdateel(Count, value_t): regular element, eitherStrobeorNoStrobe,BitLoadupdateel(Count, Value): regular element, general interface (BitLoad, BitSet, BitClear, etc.)el(trigger_t, trigger_t, bool): trigger condition elementel(Replay, count_t, value_t): replay a subsequence stored in the preprocessor a given number of timesel(Retrig, value_t): stop streaming and wait for a retrigger eventel(Random, count_t): generate random numbers
The counter and value are internally stored as std::shared_ptr objects for easy expandability. The
control parameter is stored as a control_t integer value using bit patters obtained from Counter
and Value objects using the control_bits and mode_bits member functions.
The public interface of el objects:
control(),count(),value(): integer representation to be sent to the RLE-decoder coreset_control(),set_count(),set_value(): low-level update functionsupdated_value(): returns avalue_tvalue that results from the update; the function takes the previous value as the inputdesc(): obtain a string representation of the element for inspection and debuggingstore(int): tag an element for storing in the chosen register of the preprocessorupdated_value(value_t): determine what will be the output from the streaming core corresponding to the given element for a given previous output stateis_regular(),is_trigger(),is_final(): tests for element type
el objects can be compared and passed to an std stream.
Class Sequence (defined in sequence.hh) represent a sequence of elements. Internally, this is an overloaded std::deque of el objects.
Public member functions are:
size(): total number of elementsdata_size(): number of regular elementslength(): total duration of the sequence in units of clock periods (length)dump(): print out the entire sequenceconvert_to_BitLoad(): return a sequence where all regular (data) elements are converted to BITLOAD updatesmerge(): return a sequence where neighbouring data elements with the same value are merged together
Two sequences can be compared using function compare() and using operator==.
Streamer control interface
Class streamer_control (defined in streamer.hh) is the high-level interface for controlling the RLE-decoder core. Member functions:
status(): read the status register (buffer error, done, triggered, armed); these are outputs from the coreget_control(): returns the control register (stop, internal trigger force, internal trigger enable, reset, internal trigger reset); these are inputs to the coreget_qout(): current value at the output (on the "device pins", if there is no postprocessing)get_qout_streamer(): current value at the streamer output (which may be overriden, see below)qout_select(): determine what data is presented at the output (streamer output or override value)qout_set(): override the output with the chosen valuemonitor_ext_trig(): debugging tool for external trigger signalsset_initial_value(): set the value that is present at the streamer data output before triggeringbuffer_error(): buffer error detecteddone(): sequence decoding completed successfullystatus_report(): dump the status in textual representationreset_streamer(): reset the streamer and erase data in all FIFO buffersreset(): reset the streamer core (set control register to zero and callsreset_streamer)trigger_enable(): enable the trigger circuit; the trigger signals are ignored until this member function is called (or using an external trigger enable signal)trigger_force(): assert the internal trigger force signaltrigger_reset(): assert the internal trigger reset signalgating(): control gatting (control of the streaming using an external output enable signal)
Class streamer_fifo (defined in streamer.hh) is the high-level interface for spooling the sequence to the RLE-decoder core. Member functions:
out(): send one elementsend_sequence(): send entire sequencecheck_fill_status(): check FIFO status
Class streamer_dma (defined in streamer.hh) is the high-level interface for transmitting the sequence to the
RLE-decoder code using direct memory access (DMA). Member functions:
write_element(): write an element at given memory locationprepare(): write an entire sequence in the memory bufferverify(): verity the correctness of the sequence stored in the memorytransfer(): perform the transfersend_sequence(): high-level function for transmitting a sequence to the streamer via DMA
FPGA (defined in fpga.hh): container for memory-mapped interfacing with the FPGA.
The constructor of this class blinks the on-board diagnostic LED at startup.
If also asserts the output enable oe signal (by default, can be overriden).
Streamer classes (defined in basic_multi_dma.hh):
basic_streamer: streamer interface and the associated FIFO bufferstreamer: high-level interface; adds PLL clock control and FPGA fabric reset interface to thebasic_streamerdma_streamer: DMA interfacemultistreamer: container for four instances ofbasic_streamer
Combiner class (defined in combiner.hh): interface for advanced multiplexers.
combiner_qout, qout (defined in qout.hh)
readback (defined in readback.hh)
st_mux (defined in st_mux.hh)
trigger (defined in trigger.hh)