Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Chapter 4 of the Nisan and Schocken text describes the machine language instructions that are supported by the Hack computer system. It is important to

Chapter 4 of the Nisan and Schocken text describes the machine language instructions that are supported by the Hack computer system. It is important to understand that different computer architectures will support different capabilities and of course this translates into differences in both the machine language instructions of the computer and the assembler language that supports the system.
In the Hack computer platform, there are essentially two types of machine language instructions the A instruction (see below)
01.jpg
And the C instruction as follows. ALL Hack computer programs can be developed using these two instructions.
02.jpg
The C instruction allows the programmer to interact with the CPU(and in particular the ALU) to perform computations against the values in the registers. If you recall, in Unit 2 we presented the ALU for the Hack computer as follows:
03.jpg
Each of the instructions that the Hack ALU is capable of running can be specified to the ALU through a set of control bits. These control bits or the C bits in the instruction and their associated functions are listed below.
04.jpg
IT IS IMPORTANT TO COMPLETE THIS EXERCISE. I caution you not to take any shortcuts. The best way to really gain an understanding of how machine language and assembler language works is by learning how to convert assembler into machine language. We will gain an understanding of the relationship between hardware and software in this process. As such I urge you to NOT be tempted to cheat and use a compiler for this task.
Once you have been able to translate each of the following two programs written in Hack Assembler into binary machine code, Load your machine language program into the cpu simulator and execute it.
For your assignment post a description of YOUR process to convert the assembler symbols into machine language and what you learned in the process. Also include both your assembler program and corresponding machine language program in your assignment.
//Program 1 to convert to machine language
// Computes R0=2+3
@2
D=A
@3
D=D+A
@0
M=D
// Program 2 to convert to machine language
// Symbol-less version of the Max.asm program.
@0
D=M
@1
D=D-M
@10
D;JGT
@1
D=M
@12
0;JMP
@0
D=M
@2
M=D
@14
0;JMP

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

Big Data Fundamentals Concepts, Drivers & Techniques

Authors: Thomas Erl, Wajid Khattak, Paul Buhler

1st Edition

0134291204, 9780134291208

More Books

Students also viewed these Databases questions

Question

What is regret ? (p. 2 49)

Answered: 1 week ago