Clock: Difference between revisions
Started working on the clock article |
Completed the article |
||
| Line 3: | Line 3: | ||
The simplest clock is made of a single [[Inverter]] connected to itself, either directly or with a delay. | The simplest clock is made of a single [[Inverter]] connected to itself, either directly or with a delay. | ||
A single inverter clock alternates {{on}} and {{off}} every [[tick]]. | A single inverter clock alternates {{on}} and {{off}} every [[tick]]. | ||
With [[Delayer|delayer]] components it will have a longer period. | With [[Delayer|delayer]] components, it will have a longer period. | ||
== Terminology == | == Terminology == | ||
| Line 15: | Line 15: | ||
:<math>duration = delay + 1</math> | :<math>duration = delay + 1</math> | ||
The full period will be | The full period will be: | ||
:<math>2 \times (delay + 1)</math> | :<math>2 \times (delay + 1)</math> | ||
| Line 23: | Line 23: | ||
[[File:Not-clock.png|thumb|left|alt=Not-clock|A single inverter]] | [[File:Not-clock.png|thumb|left|alt=Not-clock|A single inverter]] | ||
| | | | ||
[[File:Delayer-clock.png|thumb|right|alt=Not-Clock|An inverter with a delayer]] | [[File:Delayer-clock.png|thumb|right|alt=Not-Clock|An inverter with a delayer, this example has a period of 22 ticks]] | ||
|} | |} | ||
In advanced circuits or during construction you may require clocks with different periods, signal shapes, and functionality. Good clocks are essential in complex designs. | |||
In advanced circuits or during construction you may require clocks with different periods, signal shapes, and functionality. | |||
== Construction == | == Construction == | ||
This article | This article is mostly agnostic towards the period of the clock. This means you may add different features that will work regardless of the period. | ||
To make a good clock you need to know what functionality you require. Here is a list of possible features you may want: | To make a good clock you need to know what functionality you require. Here is a list of possible features you may want: | ||
# | #Turning on/off | ||
# | #Manually adjustable period | ||
# | #Digitally adjustable period | ||
# | #Specific signal shape | ||
This article will show how to add features to a clock, starting from the simplest to the most advanced. | This article will show how to add features to a clock, starting from the simplest to the most advanced. | ||
=== | === Turning on/off === | ||
[[File:Clock-off.png|thumb|right|alt=Clock is turned off by the switch|Clock is turned off by the switch]] | |||
Any clock has an inverter, therefore it can always be turned off with an {{on}} signal applied to it. | |||
It's good practice to add a switch to all clocks. | |||
You can also use buttons to turn on/off the clock. With 1 button you will need a [[T Flip Flop]]. With 2 buttons you can use a [[Set Reset Trigger]]. | |||
=== Adjustable period === | === Adjustable period === | ||
You can adjust the period either manually or digitally. | |||
[[File:Adjust-delayer.png|thumb|right|alt=Delayer can be adjusted, up to 30 ticks.|Delayer can be adjusted, up to 30 ticks.]] | |||
If you are using a [[delayer]] you can [[editing|edit]] its delay up to 30 [[tick|ticks]]. Remember that with the inverter, the total duration will be 1 tick longer. | |||
For more than 30 ticks, you will need to connect several delayers one after another. | |||
Another approach is to build several clocks with different periods and enable one of them. | |||
With this approach you can also control the period digitally or programmatically, by selecting the clock with the required period, usually with a [[multiplexer]]. | |||
<div style="clear:right;"></div> | |||
=== Signal shape === | === Signal shape === | ||
Quite often you will need a clock with a long period, but produces 1 tick pulse each cycle. | |||
It is possible to achieve this by building a loop with multiple buffers and passing a 1-tick signal through it, but it will quickly become impractical.<br> | |||
A more efficient way is to attach a separate [[pulse generator]] to a normal clock. It will work with any clock configuration.<br> | |||
For long periods and long pulses, you can use the following design: clock → pulse generator → signal extender. | |||
== "Multitool" clock example == | |||
[[File:Mutliclock.png|frameless|right|alt=Multiclock with all the features|Multiclock with all the features]] | |||
The total period here is 8 ticks, and you can see the signal shape on the next screenshot. | |||
It is a good idea to construct a small but efficient clock for general use. | |||
It should have everything described above. The screenshot below demonstrates an example. It has a turn-off switch, adjustable period, and a pulse output. | |||
[[File:Oscilloscope.png|none|center|alt=Oscilloscope showing the shape of the signal|Oscilloscope showing the shape of the signal]] | |||
Revision as of 22:32, 2 October 2025
A Clock is a circuit that changes its output state periodically over time.
The simplest clock is made of a single Inverter connected to itself, either directly or with a delay. A single inverter clock alternates ON and OFF every tick. With delayer components, it will have a longer period.
Terminology
- Period is the duration of the entire cycle of the clock, measured in ticks. It includes the duration of the ON output and the OFF output.
- Duration of a signal is the number of ticks the signal remains unchanged.
With delay components the duration of a signal is calculated as follows:
The full period will be:
|
|
|
In advanced circuits or during construction you may require clocks with different periods, signal shapes, and functionality. Good clocks are essential in complex designs.
Construction
This article is mostly agnostic towards the period of the clock. This means you may add different features that will work regardless of the period.
To make a good clock you need to know what functionality you require. Here is a list of possible features you may want:
- Turning on/off
- Manually adjustable period
- Digitally adjustable period
- Specific signal shape
This article will show how to add features to a clock, starting from the simplest to the most advanced.
Turning on/off

Any clock has an inverter, therefore it can always be turned off with an ON signal applied to it. It's good practice to add a switch to all clocks. You can also use buttons to turn on/off the clock. With 1 button you will need a T Flip Flop. With 2 buttons you can use a Set Reset Trigger.
Adjustable period
You can adjust the period either manually or digitally.

If you are using a delayer you can edit its delay up to 30 ticks. Remember that with the inverter, the total duration will be 1 tick longer. For more than 30 ticks, you will need to connect several delayers one after another.
Another approach is to build several clocks with different periods and enable one of them. With this approach you can also control the period digitally or programmatically, by selecting the clock with the required period, usually with a multiplexer.
Signal shape
Quite often you will need a clock with a long period, but produces 1 tick pulse each cycle.
It is possible to achieve this by building a loop with multiple buffers and passing a 1-tick signal through it, but it will quickly become impractical.
A more efficient way is to attach a separate pulse generator to a normal clock. It will work with any clock configuration.
For long periods and long pulses, you can use the following design: clock → pulse generator → signal extender.
"Multitool" clock example

The total period here is 8 ticks, and you can see the signal shape on the next screenshot. It is a good idea to construct a small but efficient clock for general use. It should have everything described above. The screenshot below demonstrates an example. It has a turn-off switch, adjustable period, and a pulse output.


