An Efficient Algorithm for the Real-Time Generation of Synchronous Reference Signals