Ayubowan 🙏🏾, my name is Asanka

Cover
 
🤔 Knowing how to code makes you look at the world from a different perspective 🌏. That's why I'm so passionate about coding. Hello World 👋; welcome to my Blog 🚧. I'm still a student and am 23 years of age, so there's a long journey ahead of me 🙆. I like to dream 💬 big and to see other peoples dreams come true. I'm a tech nerd 🐱‍💻 and a coding enthusiast. Hope you might find me amusing.🤩

  “It is man that ends, but his works can endure.” - The Watchmakers Apprentice

facebook github instagram twitter linkedin YouTube Deviant Pinterest

Catch me on Fiverr        Learn more

02. Clock - Eight-Bit Computer

PosterClock

The clock is an essential part of any computer system. It enables each instruction to be executed in sequential order. However, the clock is an external part of the computer system. This is because a clock is basically a periodic pulse generated at fixed intervals. The rising or falling edge is used to trigger a new state or instruction of the computer. Thus, generating a clock signal requires analogue components and can't be done using an FPGA.

A clock pulse  

    A clock pulse

However, there are certain functions Ben Eater incorporates into his clock modules. This is the option to choose between the astable clock pulse and manual clock pulse and the capability of the computer to halt itself. Obviously, an astable clock is important for the operation of the computer as discussed before. However, Ben Eater also discusses how having a manual clock pulse which you can click through can help with debugging the circuitry. On top of this, once the computer completes all the set of instructions, it must have the ability to prevent itself from executing further instructions.

For this, Ben Eater proposes a simple logic circuit. This circuit is able to handle all three of these functions. This circuit can be implemented on an FPGA. This module will need four inputs and will give out one output. The four inputs are the apulse or the astable pulse, the mpulse or the manual pulse, select or the selection signal and hlt or halt signal. The output is clk or the clock pulse that the computer can use.

Clock module design 

    Clock module design

This can be implemented quite easily with a single line.

module clock (apulse, select, mpulse, hlt, clk);

    input apulse, select, mpulse, hlt;
    output clk;

    assign clk = ((apulse && select) || (mpulse && ~select)) && ~hlt;

endmodule

In order to test this, the test bench would need to always send a clock signal to the apulse input. We will first set the select signal low. This selects the astable clock pulse as output. So sending a high signal through mpulse won't do anything. However, if we set the halt signal to high, no matter what we do to the other three inputs, the output clock will always output a low signal.

Output waveform of the testbench 

    Output waveform of the testbench

With this we have the clock logic implemented within the computer.

Structure of the computer

    Structure of the computer

 

External Links:

Comments