I'd like to ask how the command flows let's say in the pseudo-code
n = 17
In Hack language, it would be:
D = A
M = D
Just confused how the value 17 would go through the registers, into ALU, etc., let alone the rest of the variables? Thank you.
The command @17 loads the instruction into the A register. The instruction is the binary value for 17.
The D=A command tells the ALU to execute the instruction 'A', which puts the value in the A register at the output of the ALU. The 'D=' part tells it to store the value of the output of the ALU into the D register.
Hi. I'd like to ask for further clarification. I am still confused how it moves across the CPU.
So @17, the binary code for 17 enters the Mux16. Because the 16th bit is 0, it is understood as the A-instruction. It goes to the A-register and ... that's where the confusion is from. I just couldn't fathom how it would go through the second Mux16 register, the ALU then go to the D register and to the top left Mux16. There's also the PC. I'm pretty much stuck here.
This is a C-type instruction and the 'A' is the comp which tells the second Mux to select the contents of the A register and route it to the Y input of the ALU. It also tells the ALU to output the value at the Y input. The 'D=' part tells the CPU to then store the output of the ALU into the D register.