Designing a 4 bit ALU Shift LR

In summary, constructing a 4 bit ALU using only basic logic gates is a challenging task, but with the use of multiplexers and the two's complement approach, you can achieve the required functions of shifting, logical operations, and subtraction.
  • #1
sickkid
1
0

Homework Statement

HI

This 4 bit ALU requires 8 functions in a bit slice, and satisfies following criteria

Also, it can only be constructed via basic logic gate..and,or,not,xor...

No filp-flop...etc.

S1 S2 S3 OUTPUT
0 0 0 Shift A Through (X = A)
0 0 1 Shift input A Left (X = A Shifted right by 1 bit)
0 1 0 Shift Input A Right (X = A Shifted left by 1 bit)
0 1 1 Logical AND (X = A AND B)
1 0 0 Logical XOR (X = A XOR B)
1 0 1 Logical NOR (X = A NOR B)
1 1 0 Full adder (X = A + B)
1 1 1 Subtraction (using the Full Adder) (X = A - B)

Homework Equations



Designing a 4 bit ALU

https://www.physicsforums.com/showthread.php?t=265676

The Attempt at a Solution

I've complete the other six tasks(but subtractors doesn't work properly?!)

However,shifting right&left really beat me up...this is what i got in one bit ALU...and then got stuck

http://tinyurl.com/ybhqex2unable to build a shifter to fill in the blank

0 0 1 Shift input A Left (X = A Shifted right by 1 bit) =D1
0 1 0 Shift Input A Right (X = A Shifted left by 1 bit) =D2 somehow i hav rough ideas to build a shifter but seems can't satisfy the requirement or not this case

2 bit shifter
http://tinyurl.com/yjvdx344 bit shifter
http://tinyurl.com/ye9enhd
 
Physics news on Phys.org
  • #2


Hello,

Thank you for sharing your progress so far. Building an ALU using only basic logic gates can be challenging, but it is a great learning experience. I have a few suggestions for your design:

1. For the shift operations, you can use a multiplexer to select between the original input and the shifted input. This can be achieved by using the S3 bit as the selector for the multiplexer. For example, when S3 is 0, the output of the multiplexer will be the original input, and when S3 is 1, the output will be the shifted input. You can use this idea for both left and right shift operations.

2. For the subtraction operation, you can use a two's complement approach. This involves inverting all the bits of the second input (B) and adding 1 to it. This will give you the negative of B, which can then be added to A using the full adder to get the subtraction result.

I hope these suggestions help you in completing your design. Keep up the good work!
 

Related to Designing a 4 bit ALU Shift LR

1. What is an ALU and what is its purpose?

An ALU (Arithmetic Logic Unit) is a digital circuit that performs arithmetic and logical operations on binary numbers. It is a key component of a computer's central processing unit (CPU) and is responsible for carrying out calculations and making decisions based on those calculations.

2. Why is a 4-bit design used for an ALU?

A 4-bit design is used for an ALU because it allows for a wide range of calculations to be performed while keeping the circuitry relatively simple and compact. A 4-bit ALU can handle 4 bits of data at a time, allowing for a total of 16 possible inputs and outputs.

3. What is the purpose of a Shift LR operation in a 4-bit ALU?

A Shift LR (shift left/right) operation in a 4-bit ALU is used to move the bits of a binary number to the left or right by a specified number of positions. This operation is commonly used in data manipulation and can be used for tasks such as multiplication and division.

4. How is a Shift LR operation implemented in a 4-bit ALU?

A Shift LR operation is typically implemented using a combination of logic gates, such as AND, OR, and XOR gates, along with multiplexers and registers. The specific implementation may vary depending on the design of the ALU, but the basic concept is to shift the bits of a binary number in a specified direction.

5. What are the limitations of a 4-bit ALU Shift LR design?

One limitation of a 4-bit ALU Shift LR design is that it can only handle 4 bits of data at a time, which may not be sufficient for more complex calculations. Additionally, the number of shift positions may be limited, depending on the specific implementation. This design may also be less efficient and slower compared to larger bit designs.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
10
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
960
  • Engineering and Comp Sci Homework Help
Replies
7
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
6
Views
17K
  • Engineering and Comp Sci Homework Help
Replies
9
Views
36K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
10K
Back
Top