Maker Pro
Maker Pro

N Bit ALU

vead

Nov 27, 2011
473
Joined
Nov 27, 2011
Messages
473
how to make N bit ALU
ALU has two input word A, B
N bit ALU
An input
Bn input
F input
example
1 bit alu
0+1=1

2 bit ALU
01+10=11

4 bit ALU
0101+1010=1111

example -
1 bit ALU
1 bit input A
1 bit input B
1 bit output F
Code:
s         ALU performance
0        F= addition
1        F= A and B
same for 2 bit ALU
2 bit ALU
2 bit input A
2 bit input B
2 bit output F
Code:
S0  S1          F
0    0         F= addition
0    1         F= subtraction
1    0         F= A and B
1    1         F= A or B

for 4 Bit ALU
4 bit ALU
4 bit input A
4 bit input B
4 bit output F
Code:
S2  S1  S0              F
0     0    0            F= addition
0     0    1            F= subtraction
0     1    0            F= shift right
0     1    1            F=shift right
1     0    0            F= A and B
1     0    1            F=A or B
1     1    0            F= A not B
1     1    1            F= A and B
 
Last edited:

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,722
Joined
Nov 17, 2011
Messages
13,722
You need a funvtional unit where the function can be controlled by the S-inputs. Tis is described e.g.here.

Check your function codes: S= 100 and S=111 both are F=A and B. Is this what you want? Also you should clarif S=110. I do not understand what F=A not B means.because "not" is a unary operator, not a biary one (not works with one input only, it does not calculate an output from two inputs).
 

vead

Nov 27, 2011
473
Joined
Nov 27, 2011
Messages
473
I am not sure what function are you talking ?
lets see for 2 bit ALU
same for 2 bit ALU
2 bit ALU
2 bit input A
2 bit input B
2 bit output F

Code:
S0  S1          F
0    0         F= addition
0    1         F= subtraction
1    0         F= A and B
1    1         F= A or B

function F= A&b (A and B logic )
A B F
0 0 0
0 1 0
1 0 0
1 1 1
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,722
Joined
Nov 17, 2011
Messages
13,722
Did you read the ínformation I linked in post #2?
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,722
Joined
Nov 17, 2011
Messages
13,722
O.K. Now where' the question?

This is just one function (A & B). You want to make the function being controlled by the function code inputs (S0, S1, S2). How would you do that? (hint: it's in the linked text).
 

vead

Nov 27, 2011
473
Joined
Nov 27, 2011
Messages
473
for 4 Bit ALU
4 bit ALU
4 bit input A
4 bit input B

Code:
S2  S1  S0              F
0     0    0            F= A and B
0     0    1            F= A or B
0     1    0            F= A Nand B
0     1    1            F= A nor B
1     0    0            F= A Xor B
1     0    1            F=A X nor B
1     1    0            F= A addition B
1     1    1            F= A subtraction B

Code:
S2  S1  S0             A     B     F
0     0    0           0     0      0         AND
                       0     1      0
                       1     0      0
                       1     1      1
0     0    1           0     0      0        or
                       0     1      1
                       1     0      1
                       1     1      1
0     1    0            0     0      1          NAND
                        0     1      1
                        1     0      1
                        1     1      0
0     1    1            0     0      1        NOR
                        0    1     0
                        1    0      0
                        1     1      0
1     0    0            0     0      0          Xor
                         0    1     1
                          1    0      1
                          1     1      0
1     0    1            0     0      1          X nor
                          0    1     0
                          1    0      0
                          1     1      1
1     1    0           0     0      0          addition
                        0    1     1
                        1    0      1
                        1     1      0
1     1    1            0     0      0        subtraction
                        0    1     1
                        1    0      1
                        1     1      0
 

vead

Nov 27, 2011
473
Joined
Nov 27, 2011
Messages
473
please some one check out this table. and tell me its correct or wrong ?
I read in every blog that processor made with ALU and control unit. so after some reading I made this table. i am not going to make for company. I am just going to make specific one for my basic understanding
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
I think the problem is that you don't understand what an ALU is or does.

The big hint is that it doesn't perform just a single function.
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,722
Joined
Nov 17, 2011
Messages
13,722
Maybe a video is beter than reading stuff?
Sorry, I don't have the time to check the full function table. As these are basic functions, you should be able to verify by yourself.
 

vead

Nov 27, 2011
473
Joined
Nov 27, 2011
Messages
473
I think the problem is that you don't understand what an ALU is or does.

The big hint is that it doesn't perform just a single function.
I already mention function for ALU in my previous post

ok look at this

ALU perform following function

AND logic
OR logic
NAND logic
NOR logic
X or logic
X nor logic
addition
subtraction
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,722
Joined
Nov 17, 2011
Messages
13,722
If you design so, yes.

You don't necessarily have to design an ALU this way. ALU stands for Arithmetic Logic Unit. Which means it is a unit that can perform arithmetic and logic operations on its inputs and generate an output accordingly. You can use the functions as indicated by your table, bt as a designer you are free to chose any set of functions that is suitable for the purpose which can be very different from your table. This is your own design decision.
 

vead

Nov 27, 2011
473
Joined
Nov 27, 2011
Messages
473
Maybe a video is beter than reading stuff?
Sorry, I don't have the time to check the full function table. As these are basic functions, you should be able to verify by yourself.
thanks for looking
Maybe a video is beter than reading stuff?
Sorry, I don't have the time to check the full function table. As these are basic functions, you should be able to verify by yourself.

thanks for looking this post

4 bit processor
component for 4 bit processor
1)4 bit ALU
2)3:8 decoder

now If I want to make 8 bit processor then I think I need following things ( I am not sure ?
1)8 bit ALU
2)3:8 decoder
 
Top