# ALU Testing

3 messages
Open this post in threaded view
|
Report Content as Inappropriate

## ALU Testing

 This post was updated on . Hi i've implemented the ALU chip, but the test failed in the second line, i can't figure out why my interpretation is wrong. Here is a detailed info. The second line of the ALU.cmp file has the following data (this is the correct output supplied by the authors): |        x                  |        y                  |zx |nx |zy|ny| f  |no |       out                |zr |ng | | 0000000000000000 | 1111111111111111 | 1 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 | 0 | 0 | If we go step by step: Step 1: zx, Zero the X Input:     x = 0000 0000 0000 0000     zx = 1 Implementation     *** Output step 1     v0 = 0000 0000 0000 0000 Step 2: nx, Negate the X Input:     v0 (from step 1)     nx = 1 Implementation    **** Output step 2     v1 = 1111111111111111                 Step 3: zy, zero the Y Input:    y = 1111 1111 1111 1111    zy = 1 Implementation:   *** Output step 3     v2 = 0000 0000 0000 0000 Step 4: ny, Negate the Y Input:     v2 (from step 3) = 0000 0000 0000 0000     ny = 1 Implementation:     *** Output step 4     v3 = 1111 1111 1111 1111 Step 5: Add / And Input:     v1 (from step 2) = 1111 1111 1111 1111     v3 (from step 4) = 1111 1111 1111 1111     f = 1 Implementation:     **** Output step 5: //And operation is selected    v6 = 1111 1111 1111 1111 Step 6:  Negate Output Input:     v6 = 1111 1111 1111 1111     no = 1 Implementation: *** Output step 6:     v8 = 0000 0000 0000 0000 Step 7: If v8 = 0 then output = 1 else output = 0 Input:     v8 = 0000 0000 0000 0000 Implementation    *** Output step 7: zr = 1 Step 8: If v8 < 0 then output = 1 else output = 0 Input:     v8 = 0000 0000 0000 0000 Implementation    *** Output step 8:     ng =  0 Final     ***
Open this post in threaded view
|
Report Content as Inappropriate

## Re: ALU Testing

 Administrator Recheck the definitions of the control bits.  It often helps to work through a circuit backwards:     out s/b 00...01,     no is 1, therefore function output s/b 11...10 = -2,     etc. Also note that you can save yourself some work by hooking more that one bus/wire to an output.     Xxx(..., out=v8, out=out); Saves you from needing Echo16.  Figure out how to do something similar to eliminate SelBit16/Not/Not. Once you've got your ALU working, please edit your post to remove the implementation details.  It's best not to have complete solutions posted.  People learn more by having to figure them out themselves. --Mark