Electrical – logic gates simplest square wave generator

digital-logic

Using CMOS technology, where tp=tHL=tLH=10ns, I need to make an simple circuit which generates square waves with frequency of 50MHz. I know that T=1/f = 20ns. I also have another formula that I found in a book and it says T = tHL+tLH = 10ns + 10ns = 20ns. I know how to convert logic gates to CMOS, but I don't know how to build this circuit using only logic gates, because of that frequency.
The simplest circuit that I know, is that: 1 NAND gate, with one of it's inputs x = 1, and another input y = feedback of output.

EDIT: If I have 50 Mhz frequency and I want to divide it by 2 so it will be 50/2 = 25, is that possible with the circuit that I designed below?
enter image description here

Best Answer

The simplest circuit, given your data, is

schematic

simulate this circuit – Schematic created using CircuitLab

Look at the inverter. Assume, just for the moment, that the output is high. Since this is applied to the input, 10 nsec later the output will go low. 10 nsec after that the output will go high again, and the cycle repeats with a 20 nsec period, or 50 MHz.

As I commented, this won't work well in real life. The problem is that in addition to propagation delay a simple inverter will have limited slew rate, and when operated at these speeds it will not have time to settle at either logic level. Instead, it will probably give a pretty good sine wave output, and may not reach the full output levels you expect.

The NAND version is perhaps slightly easier to understand (or maybe not, depending on what gives you trouble). The problem with the inverter circuit is that, when thinking about it the first time, it's hard to see how the input and output can be the same, since this is an inverter. The trick, of course, is to think about the fact that this can only happen for one propagation delay, which is why it oscillates. The NAND version at least allows you to start with a 0 input on the control line, and then think about what happens when you bring it high. But the inverter is internally simpler than a NAND gate, so the inverter circuit qualifies as the simplest.

EDIT - It has been asked, "how about if we have 25 MHz frequency?", since doubling the delay around the loop requires 2 inverters, which won't oscillate. Right on. The answer is that you can't do it using only logic elements. Instead you do something like

schematic

simulate this circuit

where the values of R and C are adjusted to give the proper delay. As a rough estimate, the product of R and C should just about equal the delay required.

But why the second inverter, you ask? Well, the first inverter has a certain output resistance, on the order of 10s to hundreds of ohms. Any load capacitance (and all loads have capacitance) will create a secondary delay network,

schematic

simulate this circuit

and the output frequency will be exquisitely sensitive to things like printed circuit layout and wiring. Adding the second inverter provides a buffer which will stabilize the output frequency, and the effect of its input capacitance can be compensated for by modifying R and C.