COMEFROM - Hardware Implementation

Hardware Implementation

The SHARC DSP supports a DO..UNTIL instruction, intended for do..while loops, that is essentially a COMEFROM. Example:

LCNTR=42; DO x UNTIL LCE; /* COMEFROM x, unless the loop counter is zero */ F12=F0*F4, F8=F8+F12, F0=dm(I0,M3), F4=pm(I8,M9); IF NZ dm(I2,M2) = F12; IF ZF dm(I2,M2) = F1; x: R2 = R3 + 76; /* the label "x" does not exist in the machine code */

Note that the loop termination condition, here specified as LCE (loop counter expired), can be set to other values including always-true and always-false. With an always-true condition, we have a genuine COMEFROM. The hardware supports up to six simultaneously active COMEFROMs.

A similar feature exists in Microchip dsPIC's for (unnested) loops provided by the 'DO' assembly instruction. Its interruptible and trivial nesting goes up to one level with an additional 5 levels in software.

Read more about this topic:  COMEFROM

Famous quotes containing the word hardware:

    A friend of mine spoke of books that are dedicated like this: “To my wife, by whose helpful criticism ...” and so on. He said the dedication should really read: “To my wife. If it had not been for her continual criticism and persistent nagging doubt as to my ability, this book would have appeared in Harper’s instead of The Hardware Age.”
    Brenda Ueland (1891–1985)