Sequential Logic - Nand2Tetris

Sequential Logic - Nand2Tetris

Computers have a Lub Dub too.

Some of the quotes and information are part of the Nand2Tetris course available on Coursera.

The Heart Beat

Sequential Logic is when we introduce the concept of time to computing. I see it this way, let's just say we made an AND gate to calculate the AND for a pair of binary digits. Now, when should I read the output? immediately? after eternity?

Now time is in reality, not discrete enough to say, "I'll wait a millisecond and then read it". So, the computer has its own way of calculating this. It's called a clock. So, there is a tick-tock inside the computer maintained by an oscillator, and we do something during the tick and read its value during the tock. In reality, this happens a lot of times, like a few billion times a second. That's what that Ghz is. So each GHz is 1 billion clock cycles per second. A cycle is a complete tick-tock.

So far what I did was Combinatorial Logic. Let me explain this. Consider that time is divided into integer time steps. And let us consider an instant of time to be 't'. Then we can represent combinatorial logic and sequential logic this way.

Combinatorial Logic: out[t] = function(in[t])

Sequential Logic: out[t] = function(in[t-1])

It's important to make it clear that this sequential logic is how computers remember things.

The basis of Sequential Logic in Computers

Like how NAND are the fundamental building blocks of logic, Clocked Data Flip Flops are the fundamental blocks of sequential logic. In reality, they are also built using NAND gates but this fact is generally ignored to keep the two types of logic separate and isolated.