Connect with us

N Bit ALU

Discussion in 'Electronics Homework Help' started by vead, Sep 6, 2014.

Scroll to continue with content
  1. vead

    vead

    473
    14
    Nov 27, 2011
    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: Sep 6, 2014
  2. Harald Kapp

    Harald Kapp Moderator Moderator

    10,368
    2,262
    Nov 17, 2011
    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 likes this.
  3. vead

    vead

    473
    14
    Nov 27, 2011
    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
     
  4. Harald Kapp

    Harald Kapp Moderator Moderator

    10,368
    2,262
    Nov 17, 2011
    Did you read the ínformation I linked in post #2?
     
  5. vead

    vead

    473
    14
    Nov 27, 2011
    yes I read and I made following for example

    function F= A&b (A and B logic )
    A B F
    0 0 0
    0 1 0
    1 0 0
    1 1 1
     
  6. Harald Kapp

    Harald Kapp Moderator Moderator

    10,368
    2,262
    Nov 17, 2011
    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).
     
  7. vead

    vead

    473
    14
    Nov 27, 2011
    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
     
  8. vead

    vead

    473
    14
    Nov 27, 2011
    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
     
  9. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,412
    2,780
    Jan 21, 2010
    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.
     
  10. Harald Kapp

    Harald Kapp Moderator Moderator

    10,368
    2,262
    Nov 17, 2011
    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.
     
  11. vead

    vead

    473
    14
    Nov 27, 2011
    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
     
  12. Harald Kapp

    Harald Kapp Moderator Moderator

    10,368
    2,262
    Nov 17, 2011
    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.
     
  13. vead

    vead

    473
    14
    Nov 27, 2011
    thanks for looking
    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
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-