Is it possible to shift the signal phase in the digital domain without the use of a microcontroller, only with the help of logic gates? I would like to have control and, for example, use a potentiometer to continuously variable phase shift of one clock signal in relation to the other - both of the same frequency. The phase shift range between 0-170 degrees. Thank you.

  • \$\begingroup\$ How would you attach a potentiometer to "just logic gates"? It is an analog device. Other than that you are looking for delay circuit rather than "phase shift" \$\endgroup\$
    – Eugene Sh.
    Commented Apr 22, 2021 at 21:36
  • 1
    \$\begingroup\$ A microcontroller is just logic gates. Just lots and lots and lots of logic gates. So -- yes. You certainly could do this with "just logic gates" in the sense of a whole bunch of 7400-series logic on a really big, power-hungry board, but you'd be talking square feet of board instead of square inches. Tell us what you're really trying to do, and why you want to complicate things by not using a microcontroller. \$\endgroup\$
    – TimWescott
    Commented Apr 22, 2021 at 21:45
  • 1
    \$\begingroup\$ Just as an example of the type of questions you need to answer: A potentiometer has near infinite resolution while digital circuits do not. What is the smallest increment of phase you want? Also is this for one frequency or a band of frequencies? What accuracy do you want? etc. \$\endgroup\$
    – Barry
    Commented Apr 22, 2021 at 21:54
  • \$\begingroup\$ I don't want to use a microcontroller because I set myself such a task. It can be said that it is a form of exercise. I figured it out so that if I take two signals - one of which will have a phase shift - to the input of the XOR gate - the result will be a PWM signal with a variable, adjustable duty cycle. Thanks. \$\endgroup\$ Commented Apr 23, 2021 at 6:35
  • \$\begingroup\$ @EugeneSh. Yes, it could be a delay circuit, but is it not the same at the end? \$\endgroup\$ Commented Apr 23, 2021 at 6:37

1 Answer 1


The preferred way to perform such task is by using phase-locked loop (PLL), which is not a solution with only logic gates though. So this only partially solves your task in that it doesn't use a microcontroller. However, from the context of your question I will assume that FPGA-based implementation also suits your needs and most modern FPGAs have some kind of PLL on a chip.

You will need a PLL with a dynamic phase shift feature. For example, in Intel FPGA PLLs:

The dynamic phase shifting feature allows the output phases of individual fractional PLL outputs to be dynamically adjusted relative to each other and to the reference clock. The smallest incremental step equals to 1/8th of the VCO period. The output clocks are active during this dynamic phase-shift process.

Depending on a particular FPGA this option can be not present at all or can be limited. For example, this FPGA's PLL from Gowin allows dynamic phase shift, but doesn't have inputs to change a phase shift direction.

Another option is to use a DLL, for example DLLDLY module in Gowin's FPGAs allows some form of phase shift.

Third option, based on the stated 20Hz - 1kHz frequency range, may be using a system clock with higher frequency for desired phase resolution and with the help of counter-dividers with adjustable starting values. This will be a fully digital solution, but not "frequency independent".


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.