How does n =17 flow into the CPU?

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

How does n =17 flow into the CPU?

eVh1955
I'd like to ask how the command flows let's say in the pseudo-code

n = 17

In Hack language, it would be:

@17
D = A
@n
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.  

Reply | Threaded
Open this post in threaded view
|

Re: How does n =17 flow into the CPU?

WBahn
Administrator
eVh1955 wrote
I'd like to ask how the command flows let's say in the pseudo-code

n = 17

In Hack language, it would be:

@17
D = A
@n
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.

Hopefully you can figure it out from here.
Reply | Threaded
Open this post in threaded view
|

Re: How does n =17 flow into the CPU?

eVh1955
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.    
Reply | Threaded
Open this post in threaded view
|

Re: How does n =17 flow into the CPU?

WBahn
Administrator
The second instruction is

D=A

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.