|
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
***
|