Understanding the ALU operation

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Understanding the ALU operation

aradove
Hi, I've difficulties understanding the output of the alu operation.

|        x                |        y                  |zx |nx|zy |ny| f  |no|       out                |zr |ng |
0000000000000000 | 1111111111111111 | 1 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 | 0 | 0 |

In zx, x is given 0.
nx, makes x negative, x=-0=0

In zy, the given input y is made to a zero in the operation, and made negative in ny giving us y=-0= 0 to operate with.

F tells us to use and And16 operation, and after counting, x(0) and y(0) gives us an output value of 1.
How is this possible? In my project I get an output of 16 zeros. The simulation tells me its wrong but I cant figure out how this is supposed to count....

Best regards
//aradove
Reply | Threaded
Open this post in threaded view
|

Re: Understanding the ALU operation

cadet1620
Administrator
Read the description of the control bits carefully. Make sure you know whether to use arithmetic negation or Boolean negation.

Do the ALU worksheet.

See this post for test files that ignore the status bits and let you concentrate on getting the computation working before you worry about the status bits.

--Mark
Reply | Threaded
Open this post in threaded view
|

Re: Understanding the ALU operation

aradove
I put the nand2tetris project away for a while, until I suddenly found the fault of my no bit equation when I was wandering around.

Thanks for all the help!