Table of Contents Previous Chapter ACIS

34.0 Timed Exposure PRAM Builder Classes (36-53234 B)

34.1 Purpose

The purpose of the Timed Exposure PRAM Builder is to generate and load CCD-controller Program RAM instructions which clock the CCDs for the Timed Exposure Science Mode.

34.2 Uses

The following lists the uses of the Timed Exposure PRAM Builder:

  1. Build and load Program RAM instructions into a CCD-controller to perform Timed Exposure mode CCD clocking.

34.3 Organization

The following illustrates the relationships used by the Timed Exposure PRAM Builder class, PramTe, and a utility class which is used by the PRAM builder to manage PRAM Block output, PramBlock.

FIGURE 164. Timed Exposure PRAM Builder class relationships


PramTe - This class is responsible for generating and loading a series of sequencer Program RAM words needed to clock a CCD for Timed Exposure mode. It provides a function which sets the desired clocking parameters (configure), and provides a function which generates and loads the clocking sequence into a particular DEA CCD-controller (build).

PramBlock - This class is responsible for emitting PRAM blocks to the DEA, each containing a header and one or more couplet entries. It is used by PRAM builders, such as PramTe and PramCc (see Section 35.0), to load entries into PRAM. It provides functions which reset the instance to the start of PRAM and disable output to the DEA (reset), start and end a PRAM block (start, end), cause jump to a new PRAM page (jump), start writing to a new page within PRAM (setPage), track the total number of clock cycles used by a block of PRAM (resetTotalCycles, getTotalCycles), emit a PRAM couplet (emitCouplet), obtain the maximum repeat cycles supported by a single couplet (getMaxRepeatCount), determine if an error was encountered while writing to the DEA (hasIoError), and enable output of PRAM words to the DEA (enableOutput).

DeaManager - This class is provided by the Protocols class category, and is responsible for managing access to the DEA interface. It provides a function which the builder uses to load words into a CCD-controller's Program RAM (writePram).

SramLibrary - This class is responsible for providing the PRAM builder with the Sequencer RAM (SRAM) locations of various primitives. It provides functions which select certain clocking options to use, such as the attenuated timing for the output register clocking, or the direction to clock the output registers (selectGain, selectOrDirection). It provides functions which supply the address of an SRAM block which does nothing (getIdle), which clock and sample 1 pixel from the output register to the output node (getOrToOn), clock and sum two pixels from the output register to the output node (getOrToOnX2). It also provides functions which return the starting SRAM block and number of contiguous blocks used to clock one row from the image array to the framestore (getImageToFrame), and which clock one row from the framestore into the output registers (getFrameToOr).

34.4 PRAM Builder Design Issues

34.4.1 CCD Organization

Figure 165 illustrates a graphical representation of a single CCD. The figure on the left of the illustration presents a simplified picture of the main CCD components, and the figure on the right illustrates the pixel dimensions of each of the components.

FIGURE 165. Graphical CCD Representation


Each CCD consists of an Image Array, a Framestore, two output registers and four output nodes. Only 1024 of the 1026 Image Array rows are used for data acquisition.

34.4.2 Timed Exposure Clocking Sequence

The following illustrates the sequence of operations used to clock CCDs in Timed Exposure Mode (NOTE: For a description of the used SRAM primitives, see Section 34.4.3. The PRAM builder function associated with the action is posted at the bottom of each description).:

34.4.3 SRAM Primitives

SRAM consists of a collection of blocks, where each block performs a clocking operation. Some operations can be performed in a single SRAM block, whereas others, due to power constraints, require a series of SRAM blocks. Table 28 lists the SRAM operations used for Timed Exposure Clocking, where each SRAM block takes 1 pixel clock (~10Ás) to execute.

TABLE 28. Timed Exposure SRAM Operations

------------------------------------------------------------------------------------------------
Operation             Number of    Description                                                    
                      SRAM Blocks                                                                 
------------------------------------------------------------------------------------------------
Integrate             1            Do not perform any clocking operations.(a)                     
Image to Frame        4            Clock one row from the image array to the framestore, and      
                                   from the framestore to the output registers.                   
Frame to OR for       4            Clock one row from the framestore to the output registers,     
Discard                            without clocking the image array.                              
Frame to OR           4            Clock one row from the framestore to the output registers,     
                                   without clocking the image array.                              
OR to ON for dis      1            Clock one pixel from the output registers to their output      
card (no summing)                  nodes and discard the result.(b)                               
OR to ON discard      1            Clock two pixels from the output registers to their output     
(x2 summing)                       nodes and discard the result.                                  
OR to ON sample,      1            Clock one pixel from the output registers to their output      
standard                           nodes and sample the result (1 electron/ADU).                  
OR to ON sample,      1            Clock one pixel from the output registers to their output      
attenuated                         nodes and sample the result. Use signal timing to attenuate    
                                   the signal (4 electrons/ADU).                                  
OR to ON sample,      1            Clock two pixels from the output registers to their output     
x2, standard                       nodes, and sum and sample the pixels at the output nodes.      
OR to ON sample,      1            Clock two pixels from the output registers to their output     
x2, attenuated                     nodes, and sum and sample the pixels at the output nodes.      
Reverse OR to ON      1            Clock one pixel from the output registers to their opposite    
for discard (no sum                output nodes and discard the result.(c)                        
ming)                                                                                             
Reverse OR to ON      1            Clock two pixels from the output registers to their opposite   
discard (x2 sum                    output nodes and discard the result.                           
ming)                                                                                             
Reverse OR to ON      1            Clock one pixel from the output registers to their opposite    
sample, standard                   output nodes and sample the result.                            
Reverse OR to ON      1            Clock one pixel from the output registers to their opposite    
sample, attenuated                 output nodes and sample the result. Use signal timing to       
                                   attenuate the signal.                                          
Reverse OR to ON      1            Clock two pixels from the output registers to their opposite   
sample, x2, standard               output nodes, and sum and sample the pixels at the output      
                                   nodes.                                                         
Reverse OR to ON      1            Clock two pixels from the output registers to their opposite   
sample, x2, attenu                 output nodes, and sum and sample the pixels at the output      
ated                               nodes.                                                         
------------------------------------------------------------------------------------------------

(a)
`Integrate' may be identical to `OR to ON with discard'

(b)
`OR to ON with discard' may be identical to `OR to ON sample'. The pixel code is used to tell the DPA to ignore the pixel.

(c)
The use of only two output nodes, such as in AC and BD mode, is selected via a discrete command to the DEA CCD controller to swap the output register phase clocks.

34.4.4 PRAM Headers and Couplets

This section describes the format of the PRAM words. PRAM consists of collections of word pairs known as `couplets.' Each couplet contains the address of one SRAM block to invoke, a repeat counter indicating the number of times to repeat the block, and a pixel code, which instructs the Front End Processors (FEPs) how to process pixels being clocked while the SRAM block is being invoked. Each invocation of a couplet takes 1 pixel clock period (~10Ás).

While PRAM is running, pixel clocks are always being delivered to the FEPs, regardless of whether pixel data is being clocked out of the CCDs or not. The pixel code portion of the couplets indicate how the FEPs interpret the data. Valid pixel data is flagged using a "Valid Pixel" code, and overclock pixels are flagged using an "Overclock" code. All other codes cause the clocked pixel data to be ignored. These include the "Vsync" code, which indicates that a new image has been started, the "Hsync" code, which indicates that a new image row is about arrive, and the "Ignore" code, which indicates that the clocked pixel should be completely ignored by the FEPs.

Each collection of couplets is preceded by a pair of `header' words. The header consists of the number of couplets which follow the block, the number of times to repeat the collection of couplets, and an action to perform once the collection of couplets completes. These actions include: halt the sequencer, continue to the header immediately following the couplet collection, jump to the first PRAM location (restart), and jump to the indicated PRAM page.

The format of this header is as follows:

---------------------------------------------
15   14    13    12   11                      0  
---------------------------------------------
 1    1     Option     PRAM Block Repeat Count   
 1    0    Page Jump         Couplet Count        
---------------------------------------------

PRAM Block Repeat Count
This specifies the number of times to repeat the entire block minus 1

Option
This specifies the next sequence option [0: Restart, 1:Continue, 2:Halt, 3:Page Jump]

Couplet Count
This specifies the number of PRAM word pairs (couplets) following the block minus 1

Page Jump
If Option is 3, this specifies the PRAM page to jump to

The following illustrates the format of the PRAM couplets within a block:

------------------------------------------
15   14   13     12   11      5  4   3      0  
------------------------------------------
 0    1     SRAM Page Address    0    PixCode   
 0    0     0     0      Major Cycle Count    
------------------------------------------

PixCode
This code is sent to the Front End Processor with each major cycle (pixel), [0:Ignore, 3:Valid Pixel, 4:End of Row (HSYNCH), 8:Start of Image (VSYNCH), 12:Overclock]

SRAM Page Address
This specifies which block of 64 SRAM blocks should be sequenced during a major cycle.

Major Cycle Count
This specifies how many times to repeat the selected SRAM block minus 1

PRAM Memory is organized around four contiguous pages, each containing 8192 words. The "jump" option of the PRAM Header causes PRAM to transfer control to the beginning of the specified page once the current PRAM block completes execution.

34.4.5 Clocking Algorithm

The following illustrates the clocking algorithm using pseudo-code, where the bolded text indicates operations which utilize the header repeat counter, italicized text indicates operations which can be accomplished using a single SRAM block and utilize the couplet repeat counter, and the underlined text indicates looping operations which are "unrolled" by the builder:

PRAM Page 0:
  /* ---- Expose primary exposure time ---- */
  IF primary exposure time is less than transfer time
    Flush image array into framestore
  ENDIF
  Integrate CCD for (primary exposure time - transfer time)
  /* ---- Transfer image to DPA ---- */
  Move 1026 rows from the image array to the framestore
  Locate first row of subarray to first row of framestore
  Discard output register
  REPEAT for each subarray row
    IF 2x2 sum
      Move two rows from framestore to output registers
    ELSE
      Move one row from framestore to output registers
    ENDIF      
    Discard 4 dummy output register pixels
    REPEAT for all pixels in output register
      IF 2x2 sum
        Clock, sum and sample 2 pixels from output registers
      ELSE
        Clock and sample 1 pixel from output registers
      ENDIF
    ENDREPEAT
    Discard output register pixels prior to producing overclocks
    REPEAT for each overclock pixel
      IF 2x2 sum
        Clock, sum and sample 2 overclocks from output register    
      ELSE
        Clock and sample 1 overclock pixel from output register
      ENDIF
    ENDREPEAT
  ENDREPEAT
  /* ---- Secondary exposures ---- */
  REPEAT duty cycle times
    /* --- Expose Secondary exposure time --- */
    IF secondary exposure time is less than transfer time
      Flush image array into framestore
    ENDIF
    Integrate CCD for (secondary exposure time - transfer time)
    Transfer subarray image to DPA as described above
  ENDREPEAT
  Jump to PRAM Page 0

34.4.6 Parallel Transfers with Multiple CCDs

Due to constraints in the ability of the power-supply to deliver enough current to clock large numbers of pixels in all CCDs, each major set of contiguous row transfers from the image array to the framestore, or from the framestore to the output registers must be performed at different times on each CCD. In order to avoid noise from large row transfers on one CCD affecting the Analog-to-Digital conversion on another, all CCDs transfer their respective images to the DEA video system at the same time (NOTE: The time an image spends in the Framestore will be different for each CCD used in a single clocking sequence).

Figure 166 illustrates a one-and-a-half exposure time-line when clocking six CCDs.

FIGURE 166. Single CCD Clocking Sequence


Figure 167 illustrates various clocking scenarios for CCDs in parallel.

FIGURE 167. Multiple CCD Clocking


In order to schedule each portion of the clocking operation, the PRAM builder must compute the time required to perform the image array to framestore transfer for a CCD, the time to position the first row of a subarray to the bottom of the framestore, and the time to transfer the subarray image to the DEA video system, and subsequently, on to the DPA's FEPs.

The time to transfer one row from the image array to the framestore is determined by the number of SRAM major cycles needed to perform the operation. The time to transfer the entire image array, is computed by multiplying the answer by 1026 rows. The minimum exposure time supported by the instrument is this result, multiplied by one less than the number of CCDs.

The time to position the subarray to the end of the framestore is the number of SRAM major cycles needed to clock 1 row in the framestore times the location of the first row (row 0) of the subarray (relative to CCD image row 0) plus 2 (to handle the two unused rows at the bottom of the image array).

The time taken to transfer the subarray image from the framestore to the DPA is a function of the number of rows in the subarray, the output node configuration, and the on-chip summing selection. In order to reduce the possibility of error when and if changes are made in how images are transferred from the framestore, the builder uses a two-pass approach when building images (see Section 34.5.2).

34.5 Scenarios

34.5.1 Using the PramBlock class

This section describes the design and use of the PramBlock class. This class is responsible for generating PRAM blocks (see Section 34.4.4), and loading these blocks into the DEA.

Figure 168 illustrates the overall behavior of the PramBlock class, in the form of a finite-state machine. The substates and transitions within the Output Disabled and Output Enabled superstates are identical, except that while in the Output Disabled state, the PramBlock class does not issue write requests to the DeaManager.

FIGURE 168. PramBlock Behavior


Clients use the PramBlock class to construct a series of non-repeating and repeating PRAM blocks. Since all useful PRAM loads within ACIS consist of an infinite loop, and since such loops require a page-jump, the client terminates the with a call to jump(), which forms the main infinite-loop of the PRAM sequence, and closes out the last PRAM block in the load.

For example, to build and emit a sequence on PRAM Page 0 which consists of a series of non-repeating blocks, followed by a block which repeats its contents 10 times, followed by a jump to the beginning of the page, the client issues the following call-sequence:

pramBlock.reset()
pramBlock.enableOutput()
pramBlock.setPage(0)
pramBlock.emitCouplet(...)
pramBlock.emitCouplet(...)
.
.
.
pramBlock.start(10)
pramBlock.emitCouplet(...)
pramBlock.emitCouplet(...)
.
.
.
pramBlock.end()
pramBlock.jump(0)

This produces a PRAM load which consists two PRAM blocks. When run, the first block will execute once and will then continue to the next adjacent block. The second will be executed 10 times, and once complete, will jump to the block at the start of PRAM Page 0 (which contains the first block).

In order to determine the total number of PRAM clock cycles used by a PRAM block, the client adds calls to resetTotalCycles() and getTotalCycles(). For example, the following determines the time it will take to execute the 2nd PRAM block, in terms of PRAM cycles:

pramBlock.reset()
pramBlock.enableOutput()
pramBlock.setPage(0)
pramBlock.emitCouplet(...)
pramBlock.emitCouplet(...)
.
.
pramBlock.resetTotalCycles()
pramBlock.start(10)
pramBlock.emitCouplet(...)
pramBlock.emitCouplet(...)
.
.
.
pramBlock.end()
pramBlock.getTotalCycles()
pramBlock.jump(0)

34.5.2 Use 1: Build and load PRAM to perform Timed Exposure CCD clocking

Figure 169 illustrates the use of the PramTe class to generate a PRAM load for Timed Exposure mode clocking (NOTE: The load call to sramLibrary, and loadSequencer call to deaManager are for reference information only. For more detail, see Section 36.0).

FIGURE 169. Build PRAM Load


The PramTe builder uses a two-pass approach to constructing PRAM. The first pass is used to calculate the minimum integration time (in terms of clock cycles) which the current parameter set can support without an added flush of the image-array. The second pass is used to actually produce and store the generated sequence.

  1. The client configures the builder, passing the clocking parameters, and pointer to the sramLibrary to pramTe.configure().

  2. configure() initializes the pramTe's instance variables and then selects which gain and output register clocking direction primitives to use, using sramLibrary.selectGain() and sramLibrary.selectOrDirection(), respectively.

  3. The client then passes the CCD Id and parallel-transfer phase slot number to pramTe.build() to generate the clocking sequence, and load the sequence into the DEA.

  4. build() first invokes pramBlock.reset() to set the current page to PRAM Page 0, and to disable output to the DEA.

  5. build() then computes the minimum non-flushed integration time, given the configured clocking parameters using generateSequence().

  6. generateSequence() uses pramBlock.setPage() to set the initial PRAM page to use.

  7. generateSequence() uses a variety of pramTe.emit*() functions to emit the various phases of the clocking sequence (see Figure 170 for a call structure chart).

  8. The emit*() functions use the various sramLibrary.get*() functions to obtain the address and block count of the SRAM primitives used to perform certain functions.

  9. The emit*() functions use pramBlock.start()/emitCouplet()/end()/jump() functions to generate the PRAM blocks (i.e. header followed by one or more couplets) needed to clock the CCD (see Section 34.5.1for the use of the PramBlock class). Since DEA output had been disabled by the earlier call to pramBlock.reset(), no words are actually written to the DEA.

  10. Once the minimum non-flushed integration time is computed, pramTe.build() calls pramBlock.enableOutput() to enable writes to the DEA.

  11. build() then proceeds with pass-2 by calling generateSequence() to generate and load the final clocking sequence, this time with appropriate image-array flush sequences.

  12. During the second pass of generateSequence(), the pramBlock functions use deaManager.writePram() to load the PRAM words into the DEA.

  13. If an error is encountered during a write, pramBlock sets an internal I/O error flag and disables further writes, but allows the sequence generation to complete. pramTe.build() then can examine whether or not an I/O error was encountered during the second-pass using pramBlock.hasIoError(), and reports the condition in its return to the calling client.

Figure 170 illustrates a structure chart, indicating the functional hierarchy within the PramTe class:

FIGURE 170. PramTe Class Internal Structure Chart



34.6 Class PramTe

Documentation:
This class generates the Program RAM sequence needed to perform Timed Exposure clocking of a CCD.
Export Control:
Public
Cardinality:
n

Hierarchy:

Superclasses:

none

Public Uses:

SramLibrary

Public Interface:

Operations:

PramTe()
build()
configure()

Protected Interface:

Operations:

emitDiscardOr()
emitExposure()
emitFlushImage()
emitFrameToOr()
emitImageToFrame()
emitIntegrate()
emitOutputPixel()
emitOverclockPixel()
emitSumOr()
emitSumOverclock()
emitTransferFrame()
generateSequence()

Implementation:

Has-A Relationships:


unsigned exposureTime[2]: Primary and Secondary Exposure Times, in units of 1/10th's of a second. Copied by configure().

unsigned dutyCycle: Number of exposureTime[1]'s per exposureTime[0]'s, starting with exposureTime[0]. Copied by configure().

unsigned rowStart: First row of subarray, not including the two dummy rows at the start of the image (see dummyRows). Copied by configure().

unsigned rowEnd: Last row of subarray. Copied by configure().

QuadMode qMode: Output node configuration, either Full, Diagnostic, AC, or BD. Copied by configure().

unsigned overclockPairs: Number of pairs of overclock pixels to output. Copied by configure().

Boolean sumFlag: 2x2 On-chip summing flag. If BoolFalse, no on-chip summing, if BoolTrue, sum pairs of columns and rows. Copied by configure().

Boolean gain4: Determines whether or not to use attenuated SRAM timing. If BoolFalse, use 1 electron:1 ADU SRAM, if BoolTrue, use 4 electrons:1 ADU SRAM timing. Copied by configure().

const unsigned arrayRows: Number of non-summed rows in the CCD Image and Frame Store.

const unsigned nodeCols: Number of un-summed columns per output node (assuming all 4 nodes in use).

const unsigned dummyCols: Number of dummy columns between the output register and the output node.

const unsigned dummyRows: Number of rows to skip between each image.

const unsigned clocksPerExpTime: Number of pixel clocks per input exposure time units (i.e. number of clocks per 0.1 second).

const unsigned ocDummy: This contains the number of dummy pixels to clock out of the output register prior to clocking out overclock pixels.

const unsigned orDiscardCount: This contains the number of times the entire Output Register should be clocked to flush charge from the registers.

unsigned exposureClocks[2]: These indicate the primary and secondary exposure times, expressed in units of pixel clocks.

unsigned shiftCols: This specifies the number of unsummed columns per output node (not including dummy columns).

unsigned summedRows: This is the total number of summed rows to clock out of the CCD.

unsigned summedShiftCols: This specifies the number of summed columns to shift out for each row.

unsigned xfrSlots: This contains the number of chips being configured. This value is used to stagger the parallel transfers of each CCD being used.

unsigned xfrTime: Total transfer time for an exposure, including time taken by other CCDs to clock their image array to their framestore, time for all CCDs to position their first subarray row to the bottom of their framestore, and time taken to transfer the subarray image to the video chains. This time does NOT include the time taken by the current CCD to transfer its image array to its framestore (`smear' time).

Boolean configured: This flag indicates whether or not configure() has been called. If not, this field contains BoolFalse. If configure() has been called the field is BoolTrue.

unsigned curslot: This specifies the current parallel transfer slot to use for the selected CCD-controller board.

SramLibrary* sramLibrary: This is a pointer to the SramLibrary instance used to use for the build (as passed into configure()).

unsigned xfrImageToFrame: This contains the number of clock cycles needed for one CCD to transfer all rows from its image array to its framestore (i.e. # SRAM cycles/row * 1026 rows).

unsigned xfrSubarrayStart: This contains the number of clock cycles needed for one CCD to position the first row of its subarray to the bottom of the framestore (i.e. # SRAM cycles/row * (subarray start + 2 dummy rows).

PramBlock pramBlock: This is used by the Timed Exposure Builder to emit blocks of PRAM couplets.
Concurrency:
Guarded
Persistence:
Transient

34.6.1 PramTe()

Public member of:
PramTe
Documentation:
This function is the constructor for the PramTe class. This function initializes the instance variables for the PramTe class and sets the configured state variable to BoolFalse. The body of the constructor invokes pramBlock.reset() to place the PRAM Block writer instance into a known state.
Concurrency:
Guarded

34.6.2 build()

Public member of:
PramTe
Return Class:
Boolean

Arguments:

CcdId ccdId
unsigned phaseslot
Documentation:
This function builds a PRAM sequence and loads the sequence into the DEA CCD-controller specified by ccdId. phaseSlot specifies the parallel transfer slot used by the CCD. phaseSlot can range from 0 to one minus the number of configured CCDs (see configure()). The function returns BoolTrue if the sequence is successfully built and loaded into the DEA. It returns BoolFalse if an error was encountered while trying to write to the DEA.
Preconditions:
configure() must have been called (configured == BoolTrue), and phaseslot must be less than the total number of boards specified by the most recent call to configure() (phaseslot < xfrSlots).
Semantics
Store phaseslot into the private curslot variable.
Pass 1: Disable builder output to the DEA and reset pramBlock using pramBlock.reset(). Compute and store the image transfer time by passing BoolTrue to generateSequence(). generateSequence() stores the computed time in xfrTime.
Pass 2: Enable DEA output by passing ccdId to pramBlock.enableOutput(). Generate and emit the clocking sequence for the CCD by passing BoolFalse to generateSequence(). Check for output errors using pramBlock.hasIoError(). If there is an error, return BoolFalse, otherwise, return BoolTrue.
Concurrency:
Guarded

34.6.3 configure()

Public member of:
PramTe
Return Class:
Boolean

Arguments:

unsigned boardcnt
unsigned expPrimary
unsigned expSecondary
unsigned expDuty
unsigned rowstart
unsigned rowend
Boolean sum2x2
QuadMode quadrants
unsigned ocPairs
Boolean attenuate
const SramLibrary& sramlib
Documentation:
This function configures the Timed Exposure PRAM builder. boardcnt is the total number of CCDs being clocked, expPrimary is the primary exposure time, expSecondary is the secondary exposure time, and expDuty is the number of expSecondary exposures per expPrimary exposures. rowstart is the index of the first CCD row of the subarray, and rowend is the index of the last row. sum2x2 indicates whether or not to perform 2x2 on-chip summation. quadrants indicates the output node configuration and clocking direction (Full, Diagnostic, AC, or BD). ocPairs indicates the number of pairs of overclock pixels to generate. attenuate indicates whether or not to use 4:1 SRAM video timing. sramlib is a reference to the SRAM library to use for the run.
Preconditions:
rowstart must be less than or equal to rowend, which must be less than 1024. It is the caller's responsibility to configure swapped Output register clocks for AC and BD quadrant clocking modes.
Semantics
Copy the parameters into the corresponding instance variables, configure the SRAM library's gain and output register direction, and compute derived clocking count information. Finally, set configured to BoolTrue.
Concurrency:
Guarded

34.6.4 emitDiscardOr()

Protected member of:
PramTe
Return Class:
void

Arguments:

unsigned npix
PramPixCode pixcode
Documentation:
Emit PRAM couplets which clock npix columns from the output register into the output node, each time, discharging the output node, effectively discarding the pixels. pixcode indicates the pixel code to use when discarding the pixels.
Semantics
If npix is greater than or equal to 2, start by discarding pixels two at a time by fetching the SRAM block using sramLibrary->getOrToOnX2(), and emitting the couplet with a repeat count of npix/2, using pramBlock.emitCouplet(). Pass pixcode as the pixel code to emit while performing the clocking. Then adjust npix to contain the remainder (NOTE: Use of a remainder is a hook in case faster SRAM blocks become available).
If npix is not zero (in this case, it will be 1), get the SRAM block to discard 1 pixel using sramLibrary->getOrToOn(), and emit the couplet to repeat npix times, using pramBlock.emitCouplet() and passing pixcode as the pixel code to emit while performing the clocking.
Concurrency:
Guarded

34.6.5 emitExposure()

Protected member of:
PramTe
Return Class:
unsigned

Arguments:

unsigned expclocks
Documentation:
Emit PRAM instructions to integrate the CCD for a period of time, and then transfer the exposed image to the DPA. The total integration of the image is specified by expclocks. This function returns the number of clock cycles taken to clock the image from the Framestore to the DPA (i.e. the minimum integration time that can be supported without a flush of the image-array).
Preconditions:
If not performing a timing run, xfrTime must contain the number of clock cycles used to transfer an image from the framestore to the DPA. This function assumes that previous cycles have integrated the CCD for this period of time.
Semantics
If xfrTime is greater than expclocks, emit instructions to align the CCD to its designated parallel transfer slot, using emitIntegrate(), and then flush the contents of the image array, using emitFlushImage(). If not, subtract xfrTime from expclocks, and add in the additional time required to align the CCD to its parallel transfer slot. If the result is not zero, emit instructions to integrate the CCDs for the remaining time using emitIntegrate().
After the CCD has been integrated and aligned to the appropriate parallel transfer slot, emit instructions to transfer the image array into the framestore using emitImageToFrame(). Start measuring the number of cycles taken to transfer the image to the DPA, using pramBlock.resetTotalCycles(). Use emitIntegrate() to align the CCD with its sub-array positioning parallel transfer slot. Once aligned, call emitFrameToOr() to emit instructions to clock the framestore until the first row of the subarray is in the first row of the framestore, call emitIntegrate() to align the CCD with the other CCDs for A/D conversion, and then call emitDiscardOr() to discard the contents of the output registers.
Then emit instructions to transfer the image from the framestore to the DPA using emitTransferFrame().
Compute the minimum number of integration cycles that can be supported without an intervening flush. First, obtain the number of cycles since the image-to-frame transfer using pramBlock.getTotalCycles(). Then compute the additional number of cycles needed to align the next image-to-frame transfer to the CCD's parallel transfer slot, and add it to the measured value. Return the result to the caller.
Concurrency:
Guarded

34.6.6 emitFlushImage()

Protected member of:
PramTe
Return Class:
void

Arguments:

unsigned nrows
Documentation:
Emit PRAM instructions to transfer nrows rows from the image array to framestore and from the framestore to the output register for discard. This function calls emitImageToFrame() to emit the instructions for the transfer.
Concurrency:
Guarded

34.6.7 emitFrameToOr()

Protected member of:
PramTe
Return Class:
void

Arguments:

unsigned nrows
Documentation:
Emit PRAM couplets which transfer nrows from the framestore into the output register. The charge from the rows will be summed together and with whatever charge exists in the output register.
Semantics
Call sramLibrary->getFrameToOr() to obtain the starting index of the series of blocks which transfer one row from the framestore to the output register, and to obtain the number of adjacent blocks need for the transfer. If only 1 block is required, call pramBlock.emitCouplet(), passing the index of the block, and a repeat count of nrows to emit the PRAM instructions for the transfer.
If more than one block is needed and more than one row is being output, call pramBlock.start() to start a repeating PRAM block, which, when executed, repeats nrows times. If only one row is being output, a repeating block is not required. Then call pramBlock.emitCouplet() for each SRAM block in the series. If a repeating PRAM block was started, call pramBlock.end() to finish of the block (NOTE: The header of the block won't actually be written until the next pramBlock.start()/emitCouplet()/jump() operation is invoked).
Concurrency:
Guarded

34.6.8 emitImageToFrame()

Protected member of:
PramTe
Return Class:
void

Arguments:

unsigned nrows
Documentation:
Emits PRAM directives to transfer nrows from the image array to the framestore and from the framestore to the output register.The charge from the framestore rows will be summed together with whatever charge exists in the output register.
Semantics
Call sramLibrary->getImageToFrame() to obtain the starting index of the series of blocks which transfer one row from the image array to the framestore and from the framestore to the output register, and to obtain the number of adjacent blocks need for the transfer. If only 1 block is required, call pramBlock.emitCouplet(), passing the index of the block, and a repeat count of nrows to emit the PRAM instructions for the transfer.
If more than one block is needed and more than one row is being output, call pramBlock.start() to start a repeating PRAM block, which, when executed, repeats nrows times. If only one row is being output, a repeating block is not required. Then call pramBlock.emitCouplet() for each SRAM block in the series. If a repeating PRAM block was started, call pramBlock.end() to finish of the block (NOTE: The header of the block won't actually be written until the next pramBlock.start()/emitCouplet()/jump() operation is invoked).
Concurrency:
Guarded

34.6.9 emitIntegrate()

Protected member of:
PramTe
Return Class:
void

Arguments:

unsigned expcounts
Documentation:
This function emits an SRAM block which lets the CCD sit still (expose) for expcounts pixel clock cycles. (NOTE: If expcounts is 0, then no action is taken and the function immediately returns).
Preconditions:
expcounts must be less than PRAM_MAX_HDR_REPEAT times PRAM_MAX_BLK_REPEAT (assuming that both constants have a value of 4096, and that 1 SRAM block executes in 10Ás, the maximum interaction time supported by one call to this function is about 170 seconds).
Semantics
This function calls sramLibrary>getIdle() to obtain the index of the SRAM block to use. It then compares expcounts to the maximum cycles handled by a single couplet, PRAM_MAX_BLK_REPEAT. If expcounts is greater than PRAM_MAX_BLK_REPEAT, start a repeating block using pramBlock.start(), passing expcounts divided by PRAM_MAX_BLK_REPEAT as the number of times to repeat the couplets. Then call pramBlock.emitCouplet(), passing PRAM_MAX_BLK_REPEAT as the number of times to execute the block, and call pramBlock.end() to mark the end of the repeating block.
If expcounts was less than PRAM_MAX_BLK_REPEAT, or the remainder was not zero, call pramBlock.emitCouplet() to continue to integrate for the required time.
Concurrency:
Guarded

34.6.10 emitOutputPixel()

Protected member of:
PramTe
Return Class:
void

Arguments:

unsigned npix
Documentation:
Emit PRAM couplets which transfer npix pixels from the output register to the output node and sample each pixel at the output node. This function calls sramLibrary>getOrToOn() to obtain the index of the SRAM block to use to output and sample a single pixel, and then calls pramBlock.emitCouplet(), passing npix as the repeat count, and using the PIXCODE_PIXEL pixel code to indicate to the DPA that the pixel is part of the image data.
Concurrency:
Guarded

34.6.11 emitOverclockPixel()

Protected member of:
PramTe
Return Class:
void

Arguments:

unsigned npix
Documentation:
Emit PRAM instructions to clock and sample npix overclock pixels from the output register. This function calls sramLibrary>getOrToOn() to obtain the index of the SRAM block to use to output and sample a single pixel, and then calls pramBlock.emitCouplet(), passing npix as the repeat count, and using the PIXCODE_OVERCLOCK pixel code to indicate to the DPA that the pixel is part of the image's overclock data.
Concurrency:
Guarded

34.6.12 emitSumOr()

Protected member of:
PramTe
Return Class:
void

Arguments:

unsigned npix
Documentation:
Emit PRAM instructions to clock and sum two pixels from the output register into the output node, and then sample and transmit the result to the DPA. npix indicates the number of pairs of pixels to clock. This function calls sramLibrary>getOrToOnX2() to obtain the index of the SRAM block to use to sum and sample two pixels at a time, and then calls pramBlock.emitCouplet(), passing npix as the repeat count, and using the PIXCODE_PIXEL pixel code to indicate to the DPA that the pixel is part of the image data.
Concurrency:
Guarded

34.6.13 emitSumOverclock()

Protected member of:
PramTe
Return Class:
void

Arguments:

unsigned npix
Documentation:
Emit PRAM instructions to clock and sum pairs of overclock pixels from the output register. npix indicates the number of pairs of overclock pixels to clock. This function calls sramLibrary>getOrToOnX2() to obtain the index of the SRAM block to use to sum and sample two pixels, and then calls pramBlock.emitCouplet(), passing npix as the repeat count, and using the PIXCODE_OVERCLOCK pixel code to indicate to the DPA that the pixel is part of the image's overclock data.
Concurrency:
Guarded

34.6.14 emitTransferFrame()

Protected member of:
PramTe
Return Class:
void

Arguments:

unsigned nrows
Documentation:
Emit PRAM instructions to transfer nrows of an image from the framestore to the DEA/DPA via the output registers and output node.
Semantics
No 2x2 Summation:
Transfer first row of image from framestore to output register, using emitFrameToOr(), discard first 4 dummy pixels by calling emitDiscardOr(). On the fourth dummy pixel, indicate the start of a new image, by passing a PIXCODE_VSYNCH pixel code. Output the contents of the first row by calling emitOutputPixel(). If any overclocks where configured, discard the first few overclocks using emitDiscardOr(), and then output the desired number of overclocks using emitOverclockPixel(). Indicate the end of the row by passing PIXCODE_HSYNCH to emitDiscardOr(). If there is more than 1 row remaining in the image, start a repeat block header using pramBlock.start(). If there is only one row remaining, a repeating block is not needed. Transfer the subsequent rows from the framestore to the output register in the same fashion as the first row, except that no PIXCODE_VSYNCH is required. If a repeating block was created to handle the subsequent rows, call pramBlock.end() to end it.
2x2 Summation:
Perform most of the same steps described above, however, clock two rows at a time from the framestore to the output register, and use emitSumOr(), rather than emitOutputPixel(), to output pixels, and use emitSumOverclock(), rather than emitOverclockPixel(), to output overclocks.
Concurrency:
Guarded

34.6.15 generateSequence()

Protected member of:
PramTe
Return Class:
void

Arguments:

Boolean timingRun
Documentation:
This function runs through the PRAM generation process. If timingRun is BoolTrue, then the function computes and stores the minimum un-flushed integration time, into xfrTime, otherwise, xfrTime is not modified. Upon returning, xfrTime contains the transfer time for an exposure.
Semantics
Generate the main exposure sequence in PRAM Page 0. Call pramBlock.setPage() to start writing to PRAM Page 0. Generate the PRAM load for the primary exposure, by passing exposureClocks[0] to emitExposure(). If measuring timing (timingRun is BoolTrue), store the result in xfrTime. If the secondary exposure time is different than the primary time, and the dutyCycle parameter is not zero, produce a series of secondary exposures by calling emitExposure() dutyCycle times, passing exposureClocks[1] as the desired exposure time. NOTE: The transfer time of the primary and secondary exposures must be identical.
Once the main exposures have been produced, form the main loop of the sequence by producing a jump back to PRAM Page 0 using pramBlock.jump().
Concurrency:
Guarded

34.7 Class PramBlock

Documentation:
This class represents a header/couplet array within PRAM. It provides functions which incrementally build and load a block into a DEA CCD Controller.
Export Control:
Public
Cardinality:
n

Hierarchy:

Superclasses:

none

Implementation Uses:

DeaManager

Public Interface:

Operations:

PramBlock()
emitCouplet()
enableOutput()
end()
getMaxRepeatCount()
getTotalCycles()
hasIoError()
jump()
reset()
resetTotalCycles()
setPage()
start()

Protected Interface:

Operations:

buildCouplet()
buildHeader()
emitHeader()

Private Interface:

Has-A Relationships:


unsigned _headerAddr: This is the address in PRAM of the block header.

enum BlockState _state: This represents the state of the current PRAM block. BLK_NONE indicates that no block has been started, BLK_STARTED indicates that a PRAM block has been started, and, BLK_ENDED indicates that the end of a PRAM has been marked.

unsigned _coupletCnt: This represents the number of couplets emitted within the block so far.

unsigned _coupletCycles: This represents the number of cycles taken to execute the block's cycles once.

unsigned _repeat: This is the number of times the block is to be repeated.

unsigned _totalCycles: This represents the total number of effective execution cycles since the last call to resetTotalCycles().

unsigned _curAddr: This is the next address to write to within PRAM.

CcdId _ccd: This specifies which CCD controller is being loaded by the builder.

Boolean _enabledOutput: This indicates if output to the DEA is enabled. If BoolFalse, don't write to the DEA. If BoolTrue, then generated headers and couplets are written to the DEA.

Boolean _ioError: This indicates if a write to the DEA failed. If BoolFalse, then no errors have been encountered since the last reset(). If BoolTrue, then a write error occurred, and further writes have been disabled until the next reset().
Concurrency:
Guarded
Persistence:
Transient

34.7.1 PramBlock()

Public member of:
PramBlock
Documentation:
This function is the constructor for the PramBlock class. This function calls reset() to initialize the instance variables and disable output to the DEA.
Concurrency:
Guarded

34.7.2 buildCouplet()

Protected member of:
PramBlock
Return Class:
void

Arguments:

unsigned sramaddr
PramPixCode pixcode
unsigned repeat
unsigned short[2] couplet
Documentation:
This function formats a PRAM couplet word pair, storing the formatted words into couplet. sramaddr is the SRAM block address to invoke, pixcode is the pixel code to emit during execution of the block and repeat is the number of times to repeat the block.
Concurrency:
Guarded

34.7.3 buildHeader()

Protected member of:
PramBlock
Return Class:
void

Arguments:

PramOp operation
PramPage page
unsigned couplets
unsigned repeat
unsigned short[2] header
Documentation:
This function formats a PRAM block header and stores the formatted words in header. operation is the action to take once the PRAM couplets have been processed and page is the PRAM page to jump to if operation specifies a jump. couplets is the total number of couplets in the block, and repeat is the number of times to repeat the block.
Concurrency:
Guarded

34.7.4 emitCouplet()

Public member of:
PramBlock
Return Class:
void

Arguments:

unsigned sramaddr
PramPixCode pixcode
unsigned repeat
Documentation:
This function builds a couplet word pair and writes the pair into the DEA's PRAM. sramaddr is the SRAM address of the SRAM block to invoke for the couplet. pixcode is the pixel code to associate with the pixels produced while the block is being invoked. repeat is the number of times to repeat the block.
Concurrency:
Guarded

34.7.5 emitHeader()

Protected member of:
PramBlock
Return Class:
void

Arguments:

PramOp operation
PramPage page
Documentation:
This function writes the block header to PRAM. operation is the action to take once the block has been executed, and page specifies which page to jump to if the operation warrants it.
Concurrency:
Guarded

34.7.6 enableOutput()

Public member of:
PramBlock
Return Class:
void

Arguments:

CcdId ccd
Documentation:
This function enables output to the CCD indicated by ccd. To disable output, call reset().
Concurrency:
Guarded

34.7.7 end()

Public member of:
PramBlock
Return Class:
void
Documentation:
This function closes the current block, but does not write the header. The header is written upon the next call to start or jump.
Concurrency:
Guarded

34.7.8 getMaxRepeatCount()

Public member of:
PramBlock
Return Class:
unsigned
Documentation:
This function returns the maximum number of repeat cycles that a single couplet can support.
Concurrency:
Guarded

34.7.9 getTotalCycles()

Public member of:
PramBlock
Return Class:
unsigned
Documentation:
This function returns the total number of effective execution cycles since the last call to resetTotalCycles().
Concurrency:
Guarded

34.7.10 hasIoError()

Public member of:
PramBlock
Return Class:
Boolean
Documentation:
This function indicates whether or not an I/O error was encountered when loading PRAM. BoolFalse indicates that no error has been encountered since the last call to reset(). BoolTrue indicates that a write failed, and that further writes have been disabled.
Concurrency:
Guarded

34.7.11 jump()

Public member of:
PramBlock
Return Class:
void

Arguments:

PramPage page
Documentation:
This function writes the header to the current block, issuing a jump operation to the PRAM page indicated by page.
Concurrency:
Guarded

34.7.12 reset()

Public member of:
PramBlock
Return Class:
void
Documentation:
This function resets the instance's state variables, disables output to the DEA, clears the I/O error flag, and sets the current PRAM address to the start of PRAM.
Concurrency:
Guarded

34.7.13 resetTotalCycles()

Public member of:
PramBlock
Return Class:
void
Documentation:
This function zeros the total execution cycle counter.
Concurrency:
Guarded

34.7.14 setPage()

Public member of:
PramBlock
Return Class:
void

Arguments:

PramPage page
Documentation:
This function sets the current PRAM address to the location corresponding to page.
Concurrency:
Guarded

34.7.15 start()

Public member of:
PramBlock
Return Class:
void

Arguments:

unsigned repeat
Documentation:
This function flushes any previous block, and opens a new block at the current PRAM address. The opened block is configured to be executed repeat times.
Concurrency:
Guarded

Table of Contents Next Chapter