Question: Project:6__ Write an Assembler program in Matlab that translates programs written in the symbolic Hack assembly language into binary code that can execute on the

Project:6__ Write an Assembler program in Matlab that translates programs written in the symbolic Hack assembly language into binary code that can execute on the Hack hardware platform built in the previous projects

The supplied Hack Assembler shown below is guaranteed to generate correct binary code. This guaranteed performance can be used to test if another assembler, say the one written by you, also generates correct code. The following screen shot illustrates the comparison process

The comparison logic: Let Prog.asm be some program written in the symbolic Hack assembly language. Suppose we translate this program using the supplied assembler, producing a binary file called Prog.hack. Next, we use another assembler (e.g. the one that you wrote) to translate the same program into another file, say MyProg.hack. Now, if the latter assembler is working correctly, it follows that Prog.hack == MyProg.hack. Thus, one way to test a newly written assembler is as follows: (i) load into the supplied visual assembler Prog.asm as a source program and MyProg.hack as a compare file, (ii) translate the source program, and (iii) compare the resulting binary code with the compare file (see the figure above). If the comparison fails, the assembler that generated MyProg.hack must be buggy; otherwise, it may be OK.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!