Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Software Engineering Expert

This project is about building an Assembly Language Interpreter (ALI) for a Simple Assembly Language (SAL) in C++11. Fortunately for you SAL has the same limited set of instructions, described below, as Project 2 in this semester. SAL programs are executed on a virtual (emulated) machine con- sisting of a memory, which stores program code and program data, an accumulator register, an additional register and a Program Counter (PC), which keeps track of the instruction being currently executed. For the C++ version ALI does not include a graphical user interface. Instead ALI reads a SAL program from a file and executes the program either one line at a time (in debug mode) or all the way to completion (normal run mode). ALI interacts with a user through the following command line:

1. r - This command reads a SAL program from a file named input.sal. The file should be in the same directory as your executable ALI file. You may assume that the input program is syntactally correct. The program is stored in internal ALI memory and displayed on the user's console.

2. d - Execute the program in debug mode. This command causes one line of code to be executed. The PC, registers, bits and the state of memory are updated as a result of the execution. The value of the registers, the PC, the bits and the content of memory after the instruction is executed are diplayed on the user's screen.

3. r - Run the program to completion. This command causes the execution of program starting from the current PC instruction until the halt instruction is found or the program reaches its last instruction. The content of the registers, PC, bits and memory are displayed on the user's console.

4. s - Save the program state. This command causes the content of memory, the bits and the registers to be saved to a file named output.txt.

5. q - Quits the ALI.

The computer hardware uses 32-bit words and consists of the following components:

1. Memory. A 32-bit, word-addressable memory (RAM) for data, holding 256 words. Words are addressed by their location, starting from location 0 all the way up to location 255. Each location may either hold a signed integer in 2's complement notation or a SAL instruction.

2. Accumulator. A 32-bit register. It is also known as Register A or A for short.

3. Additional register. A 32-bit register also known as Register B or B for short.

4. Program counter (PC). An 8-bit program counter (PC). The PC holds the address (number in program memory) of the next instruction to be executed. Before the program starts execution, the PC holds the value 0. It is subsequently updated as each instruction is executed.

5. A zero-result bit. This bit is set if the last ADD instruction produced a zero result. This bit is cleared if the last ADD instruction produced a result different from zero. The initial value is zero. The bit is changed only after ADD instructions are executed.

6. An overflow bit. This bit is set whenever an ADD instruction produces an overflow (i.e., a result that cannot be stored in 2's complement notation with 32 bits). It is cleared if the ADD instruction did not produce an overflow. The initial value is zero.

The registers are used to hold data in arithmetic operations (i.e., additions). The program counter holds the index value (starting at 0) of the next instruction to be executed. SAL has the instruction set shown in Table 1.

DEC symbol

Declares a symbolic variable consisting of a single letter (e.g., X ). The

variable is stored at the memory location of this instruction.

LDA symbol

Loads byte at data memory address of symbol into the accumulator.

LDB symbol

Loads byte at data memory address symbol into B.

LDI value

Loads the integer value into the accumulator register. The value could be negative

but must be in the range of 32-bit 2's complement numbers.

ST symbol

Stores content of accumulator into data memory at address of symbol.

XCH

Exchanges the content of registers A and B.

JMP number

Transfers control to instruction at address number in program memory.

JZS number

Transfers control to instruction at address number if the zero-result bit is set.

JVS number

Transfers control to instruction at address number if the overflow bit is set.

ADD

Adds the content of registers A and B. The sum is stored

in A. The overflow and zero-result bits are set or cleared as needed.

HLT

Terminates program execution.

Table 1: Instruction set of SAL.

You may assume that SAL programs are entered correctly by users of ALI. (You are not required to perform error diagnosis or correction). Information in data memory and the registers should be displayed in decimal format. Program source code should be displayed in symbolic (i.e., textual) format. Finally, you must use inheritance in your implementation. One good place for inheritance is to define an abstract superclass for SAL instructions with concrete subclasses for each particular instruction. Beware of infinite loops in SAL.

Extra credit. If you implement correctly the Command pattern from the Gang-of-Four book, you will receive a 20% increase on your project grade, up to 20 extra points.

You must work alone on this project. Save all your code in a collection of header and code files and submit a zip archive with a (short) readme file containing instructions on how to use your ALI. The archive should also contain a sample input.sal file. Submit the archive by clicking on the link provided with this assignment. Your code should compile under the GNU C++11 or the CLANG C++11 compiler. No late submissions will be accepted.

Software Engineering, Computer Science

  • Category:- Software Engineering
  • Reference No.:- M92801219
  • Price:- $70

Guranteed 36 Hours Delivery, In Price:- $70

Have any Question?


Related Questions in Software Engineering

Overviewyou are required to modify and logically extend

Overview You are required to modify and logically extend the functionality of a provided code base to implement a game. This requires you to modify the code base as well as create documentation and implement various user ...

Write reply to this article with references with apa

Write reply to this article with references with APA bibliography. Hate Crimes Over the past couple of years, hate crimes have been on the rise in America's largest cities. Studies show that there were sharp spikes in th ...

Reply to this article with apa referencehate crimes

Reply to this article with APA reference. Hate crimes According to Merriam-Webster, hate crime is any of various crimes (such as assault or defacement of property) when motivated by hostility to the victim as a member of ...

Address the following integrating biblical perspectives

Address the following, integrating biblical perspectives where appropriate: Define a hate crime and describe how white supremacist groups use the Internet to spread their message of hate. Explain why hate crime legislati ...

Write review on this article with apa formatgovernment

Write review on this article with APA format. Government surveillance is a major issue in the United States and globally. Surveillance refers to any collection and processing of personal data, whether, identifiable or no ...

In this assignment you will answer the following review

In this assignment, you will answer the following review questions from the reading materials of the module/week. 1. "What are the key components of a typical P2P application? Describe their functions." 2. "What are the ...

The research paper for this course is about some of the

The research paper for this course is about some of the best sources of digital evidence for child abuse and exploitation, domestic violence, and gambling according to the National Institute of Justice. Research commerci ...

Instructions - onion routingin this assignment you will

INSTRUCTIONS - ONION ROUTING In this assignment, you will answer the following questions related to Onion Routing and Tor. 1. Describe the infrastructure of Onion Routing and explain how it works for providing anonymity ...

Assignment part 1objectives to learn to identify the

Assignment Part 1 Objectives: To learn to identify the relevant use cases for a given application, describe the use cases and develop an object-oriented domain model. Problem Statement - Standing Orders Management System ...

Research projectin the course we have covered various

RESEARCH PROJECT In the course, we have covered various security and privacy issues that arise in the cyberspace field. We have learned to identify these risks and have discussed the current approaches and developments f ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As