ALU shows consistently the letter M when A register is selected
When debugging my Computer.hdl design with ComputerAdd.tst i noticed that the execution of the statement D=A caused the ALU to show an M instead of the expected A.
I think that this is a deliberate choice by the designers of the Hack hardware simulator. Could someone confirm this.
And while i am at it : showing D&M while executing an A-instruction is visually quite distracting.
These are the things i happen notice when i get struck.
I will survive.
Re: ALU shows consistently the letter M when A register is selected
The ALU actually doesn't know where its data is coming from or where the data is going. That is a function of the design of the CPU. If I were writing the Hardware Simulator, I would have labeled the ALU inputs x and y (inside the logic symbol) and used x and y in the function description, as this is the way the ALU is described and developed in chapter 2. In the case of D=A the function would be 'y'.
Showing a computation in the ALU during A-instructions is correct. The ALU is computing something during A-instructions. The result of this computation is ignored; it is not stored anywhere. If instruction bits 6-11 are tied directly to the ALU, it will be computing a random function during A-instructions depending on the value being loaded. If the control signals for the ALU are all forced to 0 during A-instructions, the ALU will always be computing x & y for A-instructions.