Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In the description of the Hack machine language in chapter 4, it is stated that in well-written programs a C-instruction that may cause a jump

In the description of the Hack machine language in chapter 4, it is stated that in well-written programs a C-instruction that may cause a jump should not contain a reference to M, and vice versa. Discuss why this should be avoided.

From The Elements of Computing Systems PAGE 69 nand2tetris.org/chapters/chapter%2004.pdf

image text in transcribed

69 Machine Language 2 | Effect No jump If out > 0 jump If 0111 0 jump If out 2 0 jump If out 0) null JGT 0 JGE JLT JLE JMP Figure 4.5 The jump field of the C-instruction. Out refers to the ALU output (resulting from the instruction's comp part), and jump implies "continue execution with the instruction addressed by the A register The last instruction (0;JMP) effects an unconditional jump. Since the C-instruction syntax requires that we always effect some computation, we instruct the ALU to compute 0 (an arbitrary choice), which is ignored. Conflicting Uses of the A Register As was just illustrated, the programmer can use the A register to select either a data memory location for a subsequent C-instruction involving M, or an instruction memory location for a subsequent C-instruction involving a jump. Thus, to prevent conflicting use of the A register, in well-written programs a C-instruction that may cause a jump (i.e., with some non-zero bits) should not contain a reference to M, and vice versa

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

3. Comment on how diversity and equality should be managed.

Answered: 1 week ago

Question

describe the legislation that addresses workplace equality

Answered: 1 week ago