So we can add, subtract, negate, and, or, not or any combination of the above. Let's put it all together in an ALU. This is a big one, so I hope there is space on your computers screen. Be sure to click Settings, gate design, US and close the panel of modules on the left by clicking the left pointing triangle at the top of the dividing line. Once you can see the entire circuit, we can walk through the parts:
The inputs are the two digits in one box in the upper left. The first digit is B, the second is A (it just worked out that way). The buttons below the digits control the function that the ALU will perform on those two numbers.
The functions are listed under the circuit. The numbers next to each function represent the settings of the switches. For example, when all the switches are off or 0, the ALU will invert A, invert B and OR those two values together. Notice that this is the same as ANDing A and B then inverting the result. When the top two switches are off and the bottom two are on, the ALU will ignore A, and return B+1. This is handy for incrementing.
Let's walk through the blocks used. Keep in mind these blocks are all just
made up of collections of NAND gates wired into modules. Most of them have
been explained earlier in this tutorial, so if you don't remember what is
inside one of them just go back and review:
- INPUT just passes the lines from the left thru to the right. It defines the inputs that will be available when we use the AUL itself as a block.
- mux4 selects the first 4 inputs or the second 4 inputs to go through to the 4 outputs. Which set is selected is decided by the bottom input. 1 selects the top, 0 selects the bottom.
- buf4en passes the top 4 inputs thru to the output, or just outputs zeros depending on the bottom two inputs. If either of those is 1, the output is all 0.
- noten passes the top 4 inputs thru as is, or inverts them depending on the bottom input. 1 means invert, 0 means pass as is.
- add4 adds the top 4 inputs to the next 4 inputs and adds in the carry input from the bottom. The resulting sum is the top 4 outputs, and the bottom output is the carry out.
- nand4 is really simple: It just NAND's the top 4 inputs with the next 4 inputs and outputs that result. We just crammed those gates into a module block to make room.
- xor. The xor gate (just about the center of the circuit) is one when it's inputs match (both 0 or both 1). It can also be made of NANDS but we needed the space here.
- OUTPUT just passed the outputs on to the display and a couple of LED's. This, like INPUT, also defines the outputs to make the ALU a module block for future use.
Here is a tricky bit: Anything that has a little circle is being inverted.
In other words, if you see a circle on an input or output, know that the
value is actually the opposite. An input with a circle that looks likes it's
getting a 1, is actually getting a 0; getting a 0, is actually getting a
Remember: It's all done with NANDs!
Well, this is aready pretty darned advanced isn't it?
|file: /Techref/logic/ALU4b.htm, 4KB, , updated: 2017/3/29 20:59, local time: 2018/12/10 23:55,
|©2018 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?|
<A HREF="http://www.sxlist.com/techref/logic/ALU4b.htm"> Digital Logic Tutorial - Basic ALU</A>
|Did you find what you needed?|
Welcome to sxlist.com!
& kind contributors
just like you!
Please don't rip/copy
Copies of the site on CD
are available at minimal cost.
Welcome to www.sxlist.com!