# Creating an Arithmetic Logic Unit (ALU)

#### The_Cook

Joined May 29, 2014
48
I need some help with creating an ALU. It will be a part of a bigger control unit. It needs to have the following functions: ALU/inc_y(by 2), ALU/add, ALU/sub (other input from y), ALU/or, ALU/and, ALU/shift_right, ALU/shift_left, ALU/not. I've looked online and found these :

Truth Table :

Circuit:

Can some please tell me if this is correct and explain what is going on in the diagram. The A and B inverts, the carry in and outs and the operation.

#### ian field

Joined Oct 27, 2012
6,536
I need some help with creating an ALU. It will be a part of a bigger control unit. It needs to have the following functions: ALU/inc_y(by 2), ALU/add, ALU/sub (other input from y), ALU/or, ALU/and, ALU/shift_right, ALU/shift_left, ALU/not. I've looked online and found these :

Truth Table :

Circuit:

Can some please tell me if this is correct and explain what is going on in the diagram. The A and B inverts, the carry in and outs and the operation.
Watch eBay for a vintage 8008 - its pretty much an ALU and not much else.

#### bertus

Joined Apr 5, 2008
22,216
Hello,

You might want to have a look at the 74181.

Bertus

#### Attachments

• 493.2 KB Views: 23

#### The_Cook

Joined May 29, 2014
48
Hello,

You might want to have a look at the 74181.

Bertus
So if I were to use that for a 16 bit design, what would I need to do? I was skimming through the specs, couldn't find anything on a carry bit

#### WBahn

Joined Mar 31, 2012
29,153
Is this some kind of school project? If so, a bit more context might be helpful (such as what the constraints are on what you can and can't use). If not, what is the purpose of doing this from the gate level?

#### ian field

Joined Oct 27, 2012
6,536
So if I were to use that for a 16 bit design, what would I need to do? I was skimming through the specs, couldn't find anything on a carry bit
archive.org has some old databook manuals, some from obscure semiconductor companies. Among that lot are some very detailed descriptions of complex (for the day) logic functions.

It'll take a bit of research effort, but I'm reasonably sure you'll find what you need there.

#### bertus

Joined Apr 5, 2008
22,216
Hello,

You can make use of a 74182 in combination with 4 X 74181 to make it 16 bits.

Bertus

#### Attachments

• 493.2 KB Views: 10
• 178.1 KB Views: 4

#### The_Cook

Joined May 29, 2014
48
Is this some kind of school project? If so, a bit more context might be helpful (such as what the constraints are on what you can and can't use). If not, what is the purpose of doing this from the gate level?
Yeah it is. So the constraints are we can use gate level components and other things that are provided in logisim

#### WBahn

Joined Mar 31, 2012
29,153
Yeah it is. So the constraints are we can use gate level components and other things that are provided in logisim
Thanks. So this thread should be in Homework Help, where it will get the attention of more people that like to focus on helping students with schoolwork in a way that they can learn the concepts. So we'll get it moved over.

#### WBahn

Joined Mar 31, 2012
29,153
MOD NOTE: Thread moved from forum The Projects Forum

#### The_Cook

Joined May 29, 2014
48
Thanks for moving the thread. In addition to performing those functions, the ALU has to support these functions for control unit it will go into:
• word size of 16-bits
• memory address bus size of 16-bits
• 64K byte main memory
• a 16-bit program status word (PSW) with status bits.
• 16 conditionally executed instructions
• 8 16-bit General Purpose Registers
• a 16-bit program counter (PC) which is also Reg[7]
• a 16-bit count-down timer that causes a timer interrupt
• 2’s complement number representation

#### WBahn

Joined Mar 31, 2012
29,153
Yeah it is. So the constraints are we can use gate level components and other things that are provided in logisim
So does a 74181 fall under "gate level components" or "other things provided in logisim"? If you are relying on the second one, I would recommend asking your instructor if it is really far game since the wording implies that the "other things" is exclusive of the logic components (and, instead, includes switches, displays, timers, clocks, and stuff like that).

#### The_Cook

Joined May 29, 2014
48
So does a 74181 fall under "gate level components" or "other things provided in logisim"? If you are relying on the second one, I would recommend asking your instructor if it is really far game since the wording implies that the "other things" is exclusive of the logic components (and, instead, includes switches, displays, timers, clocks, and stuff like that).
We're only allowed to use the gates provided in Logisim.

#### WBahn

Joined Mar 31, 2012
29,153
The first thing you need to do is draw a black box that has all the needed I/O. So identify ALL of your inputs and ALL of your outputs.

After you get that done, identify ALL of the functions that the ALU needs to perform. Then figure out how to perform them one at a time. I would recommend grouping them into two categories -- Arithmetic and Logic (hence the name ALU).

Once you have figured out how to perform each of them, then you are ready to consider how you can use the control inputs to determine which function gets performed.

There are many ways of doing this. One brute force way would be to have your ALU always perform all possible functions and then just use the control signals to select which function feeds the output via a MUX.

But don't try to do it all at once. Once approach is to add the functions one at a time until you have the entire ALU built up.