**where do todays computers store almost all motherboard configuration data** This is a topic that many people are looking for. **newyorkcityvoices.org** is a channel providing useful information about learning, life, digital marketing and online courses …. it will help you have an overview and solid multi-faceted knowledge . Today, ** newyorkcityvoices.org ** would like to introduce to you **How Computers Calculate – the ALU: Crash Course Computer Science #5**. Following along are instructions in the video below:

“I m carrie ann. And this is crash course computer science. So last episode. We we talked about how numbers can be represented in binary nrepresenting like 00101010 is 42 decimal.

Representing and storing numbers is an important function of a computer. But the real goal is computation or manipulating numbers in a structured and purposeful way like adding. Two numbers together these operations are handled by a computer s arithmetic and logic unit. But most people call it by its street name the alu.

The alu is the mathematical brain of a computer. When you understand an alu s design and function you ll understand a fundamental part of modern computers. It is the thing nthat does all of the computation in a computer. So basically everything uses it first though look at this beauty.

This is perhaps the most famous alu ever the intel 74181 when it was released in 1970. It was it was the first complete alu that fit entirely inside of a single chip. Which was a huge engineering feat at the time so today. We re going to take those boolean logic.

Gates. We learned about last week to build a simple alu circuit with much of the same functionality as the 74181 and over the next few episodes. We ll use this to construct a computer from scratch. So it s going to get a little bit complicated.

But i think you guys can handle it intro an alu is really two units in one there s nan arithmetic unit and a logic unit let s start with the arithmetic unit. Which is responsible for handling all numerical operations in a computer like addition and subtraction. It nalso does a bunch of other simple. Things like add one to a number which is called an increment operation.

But we ll talk about those later today we re going to focus on the pi ce de r sistance the cr me de la cr me of operations that underlies almost everything else a computer does adding two numbers together we could build this circuit entirely out of individual transistors. But that would get nconfusing really fast so instead as we talked about in episode. 3. We can use a high level of abstraction and build our components out of logic gates in this case and or nnot and xor gates.

The simplest adding circuit that we can build takes two binary digits and adds them together. So we have two inputs. A and b. And one output.

Which is the sum of those two digits just to clarify a b and the output are all single bits there are only four possible input combinations. The first three are n0 0 0. 1 0 1 n0 1 1 remember that in binary 1 is the same as ntrue and 0. Is the same as false so this set of inputs exactly matches.

The boolean logic of an xor gate..

And we can use it as our 1 bit adder. But the fourth input combination 1 1. Nis. A special case 1 1 is 2 obviously.

But there s no 2 digit in binary so as we talked about last episode the result is 0. And the 1 is carried to the next column. So the sum is really 10 in binary. Now the output of our xor gate is partially correct 1 plus.

1 outputs. 0. But we need an extra output wire for that carry bit the carry bit is only true when the inputs are 1 and 1. Because that s the only time when the result two is bigger than n1 bit can store and conveniently we have a gate for that an and gate.

Which is nonly true when both inputs are true so we ll add that to our circuit. Too and that s it this circuit is called a half adder. It s it s not that complicated just two logic gates. But let s abstract away even this level of detail and encapsulate our newly minted half adder as its own component.

With two inputs bits a and b. And two outputs. The sum and the carry bits this takes us to another level of abstraction heh. I feel like i say that a lot i wonder if this is going to become a thing anyway if you want to add more than 1 1.

We re going to need a full adder that half adder left us with a carry bit as output that means that when we move non to the next column in a multi column. Addition and every column after that we are going to have to add three bits together. No two a full adder is a bit more complicated. It takes three bits as inputs a b and c.

So. Nthe maximum possible input is 1 1. 1. Which equals 1 carry out 1.

So we still nonly need two output. Wires sum and carry we can build a full adder using half adders to do this we use a half adder to add a plus b. Just like before. But then feed that nresult and input c into a second half adder lastly.

We need a or gate to check if either one of the carry bits was true that s it we just made a full adder. Againwe can go up a level of abstraction and wrap up this full adder as its own component. It ntakes three inputs adds. Them and outputs the sum and the carry if there is one armed with our new components.

We can now build a circuit that takes two 8 bit numbers..

Let s call them a and b and adds. Them together let s start with the very first bit of a and b. Which we ll call a0 and b0 at nthis point. There is no carry bit to deal with because this is our first addition nso.

We can use our half adder to add these two bits together the output is sum0 nnow. We want to add a1 and b1. Together. It s possible.

There was a carry from the previous addition of a0 and b0. So this time we need to use a full adder that also inputs the carry nbit we output this result as sum1 then we take any carry from this full adder and run it into the next full adder that handles a2 and b2. And we just keep doing this in na big chain until all 8 bits have been added notice how the carry bits ripple forward to neach subsequent adder for this reason. This is called an 8 bit ripple carry adder notice.

How our last full adder has a carry out if there is a carry into the 9th bit it means the sum of the two numbers is too large to fit into 8 bits. This is called an overflow in general an overflow occurs when the result of an addition is too large to be represented by the number of bits. You are using this can usually cause errors and unexpected behavior famously the original pacman arcade game used 8 bits to keep track of what level. You were on this meant that if you made it past level 255 the largest number storablein 8 bits to level 256.

The alu overflowed this caused a bunch of errors and glitches making the level unbeatable. The bug became a rite of passage for the greatest pacman players so if we want to avoid overflows. We can extend our circuit with more full adders allowing us to add 16 or 32. Bit numbers.

This makes overflows less likely to happen. But at the expense of more gates. An additional downside is that it takes a little bit of time for each of the carries to ripple forward admittedly not very much time electrons move pretty fast. So we re talking about billionths of a second.

But that s enough to make a difference in today s fast computers for this reason. Modern. Computers. Use a slightly different adding circuit called a carry look ahead adder.

Which is faster. But ultimately does exactly the same thing. Adds. Binary numbers.

The alu s arithmetic unit. Also has circuits for other math operations and in general these. 8. Operations are always supported and like our adder.

These..

Other operations are built from individual logic. Gates. Interestingly. You may have noticed that there are no multiply and divide operations.

That s because simple alus. Don t have a circuit for this and instead just perform a series of additions. Let s say you want to multiply 12 by 5. That s the same thing as adding 12 to itself.

5 times so it would take 5 passes through the alu to do this one multiplication and nthis is how many simple processors like those in your thermostat. Tv. Remote and microwave do multiplication. It s slow.

But it gets the job done however fancier processors like those in your laptop or smartphone have arithmetic units with dedicated circuits for multiplication and as you might expect the circuit is more complicated than addition. There s no magic it just takes a lot more logic gates n. Which is why less expensive processors. Don t have this feature.

Ok. Let s move on to the other half of the alu. The logic unit instead of arithmetic noperations. The logic unit performs well logical operations like and or and not which we ve talked about previously.

It also performs simple numerical tests like checking if a number is negative for example here s a circuit that tests nif the output of the alu is zero. It does this using a bunch of or gates to see if any of the bits are 1. Even if one single bit is 1. We know the number can t be zero.

And then we use a final not gate to flip this input. So the output is 1. Only if the input number is 0. So that s a high level overview of what makes up an alu.

We even built several of the main components from scratch. Like our ripple. Adder as you saw. It s just a big bunch of logic.

Gates connected in clever ways. Which brings us back to that alu you admired so much at the beginning of the episode. The intel 74181 unlike the 8 bit alu. We made today the 74181 could only handle.

4..

Bit inputs which means you built an alu that s like twice as good as that super famous one with nyour mind well sort of we didn t build the whole thing. But you get the idea the 74181 used about 70 logic. Gates. And it couldn t multiply or divide.

But it was a huge step forward in miniaturization opening the doors to more capable and less expensive computers this 4 bit alu circuit is already a lot to take in but our. 8. Bit alu would require hundreds of logic gates to fully build and engineers don t want to see all that complexity when using an alu. So they came up with a special symbol to wrap it all up.

Which looks like na big v. just another level of abstraction our. 8. Bit alu has two inputs a and b each with 8 bits.

We also need a way to specify what operation. The alu should perform for example addition or subtraction for that we use a 4 bit operation code. We ll talk about this more in a later episode. But in brief 1000 might be the command to add.

While 1100 is the command for subtract basically the operation code tells the alu. What operation to perform and the result of that operation on inputs. A and b is an 8 bit output alus also output a series of flags. Which are 1 bit outputs for particular states and statuses for example.

If we subtract two numbers and the result is 0. Our zero testing circuit the. One we made earlier sets the zero flag to true 1 . This is useful if we are trying to determine if two numbers are are equal.

If we wanted to test if a was less than b. We can use the alu to calculate a subtract b and look to see if the negative flag was set to true if it was we know that a was nsmaller than b. And finally. There s also a wire attached to the carry out on the adder.

We built so if there is an overflow. We ll know about it this is called the overflow flag fancier alus will have more flags. But these three flags are universal and frequently used in fact we ll be using them soon in a future episode. So now you know how your computer does all its basic mathematical operations digitally with no gears or levers required we re going to use this alu when we construct our cpu two episodes from now ” .

.

Thank you for watching all the articles on the topic **How Computers Calculate – the ALU: Crash Course Computer Science #5**. All shares of newyorkcityvoices.org are very good. We hope you are satisfied with the article. For any questions, please leave a comment below. Hopefully you guys support our website even more.

description:

tags: