Doubt about writter affirmation

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

Doubt about writter affirmation

Filipe Canatto
At section 4.3, paragraph 3, the writter says: " For example, the + char-
acter plays no algebraic role whatsoever in the command D=D+M "

In my point of view, the "+" character plays a algebra role, because the instruction D = D+M, will interact with the ALU and perform a sum operation, so it is clearly a algebraic role.
Reply | Threaded
Open this post in threaded view
|

Re: Doubt about writter affirmation

ybakos
Not quite. Keep in mind the importance of the context of the paragraph. The mnemonic D+M is equivalent to 000010, and we did no math to get there. An instruction with D+M does not involve any math itself, despite causing two registers to be the input to operations in the ALU.
Reply | Threaded
Open this post in threaded view
|

Re: Doubt about writter affirmation

cadet1620
Administrator
In reply to this post by Filipe Canatto
Part of the confusion is that there are two perspectives to consider:

From the CPU's perspective, when the program is running, the D=D+M instruction does indeed involve arithmetic.

However, from the Assembler's perspective, when it is translating the program from Hack to binary, the D=D+M instruction is 3 textual tokens, "D", "=" and "D+M" that need to be processed into the text "111100001001000".

This will make more sense when you write your own Assembler in project 6.

-----
For me, algebra has too many meanings in common English. I'd have written this something like
    Although "D=D+M" appears to be an arithmetic expression, it is
    3 textual elements: "D", "=" and "D+M". The "D+M" ...

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

Re: Doubt about writter affirmation

Filipe Canatto
Thanks for the answers,

I was seeing this scenario by cpu`s point of view, now looking again by assembler`s perspective the text make sense. but are there some situation that the assembler interact with the ALU to transalate an instruction from assembly to machine code?. if it never happen why discuss this scenario in the text?.