"Starting from scratch CPU Learning Chapter 07" The simplest alu-full-add device

Source: Internet
Author: User

The ALU is an arithmetic logical unit that is an important part of the CPU because the CPU is essentially repeating the simplest computations. And our version of the CPU of the ALU part is more simple, is a can only add the ALU.

Theoretical part

We need a circuit design that can help us with our mathematical calculations . Once you get through this, you can say that you have learned all about the computer, because the computer does everything, only calculate , more absolutely, calculate everything, also only add . Here I make a bold hypothesis, reading this article you already know the meaning of the binary, How to make yourself a 8-bit binary number of the addition calculator ? It's probably supposed to be like this.

In fact, this is not a new knowledge, I believe that give you enough time you will be designed, you may wish to pause for some time to take out a piece of paper to try. Let's start with the simplest one, how do we design a calculator that adds up to one count? We should first sort out such a clear table, 0+0=00;0+1=01;1+0=01;1+1=10, where we take the rounding directly into account.

Addend A Addend b Add and output Rounding output
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1

No matter what method you use, the correspondence of this table can always be converted into some kind of gate circuit. If you have just memorized the effects of various gate circuits, it is easy to find that their correspondence is very simple and rude. and is the XOR gate , carry is with the door . The painting is the following, because we only consider to the backward bit, and do not consider the previous number of carry, so we call this device as a half adder .

If the previous carry takes into account, just one more half of the adder can be, as to why the carry output plus and not use a half adder but use one or the door, please pause for a minute to think about it. This time we've built a perfect calculator that we can proudly call the full-add .

Once a calculator has been made, the 8-bit calculator simply adds the full adder one by one and again abstracts the whole, which we call the 8-bit adder .

OK, you are done. I do not know how you feel at this time, unconsciously we have 3 times a continuous abstraction (that is, to encapsulate the previous device), there is no deep understanding of what has been said before you must begin to get used to this abstraction . Whenever a complex structure is put into a black box, you will never consider the structure inside, as long as you do this, the three-step abstraction will be so easy. With the addition calculator, subtraction is not a problem, in this blog will omit this part of the content, if you are interested, you can find out how the computer is a complement to the subtraction, then you will find that subtraction is addition.

Part of the real exercise

Like 8-bit registers, the Alu inserted on our breadboard is also directly implemented with an integrated circuit,74ls283, with the following pin graphs:

    

    • A1-A4: Addend A
    • B1-B4: Addend b
    • C0: Carry Input
    • S1-S4: Add and output
    • C4: Carry Output

The two pieces together is a 8-bit adder, with the previous register (two) together, output to the bus end and then a three-state control, completed the entire circuit.

This adder is not like the previous register, there is a signal to control whether the data is stored, it will be added and calculated directly and output from the output. We turn on CLK, manually set the register a (red bulb) and B (blue bulb) A few numbers, you will see the ALU output Plus and results (yellow bulb, squeezed dead ...) )

Reference Video : Eater.net

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.