Ask Computer Engineering Expert

Learning objectives

Upon successful completion of this coursework, the student is expected to:

Be aware of the diversity in Instruction Set Architectures and the issues architects consider when designing new ISAs.

Become familiar with assembly language programming and its relationship to high-level languages, both in theory and practice.
Understand the details of CPU and memory organization.

Understand the operation of the CPU Fetch-Decode-Execute cycle.

Appreciate the technique of software simulation to test designs, such as Instruction Set Architectures.
Be familiar with information units (bits, bytes, words) and number systems (binary, decimal, hexadecimal).

Description / Scenario

As a computer architect, you are given the task to design a simplified computer with its own RISC Instruction Set Architecture. Having this task completed, your next step is to test the new ISA by writing an interpreter that simulates programs in this language.

The designed computer has a 2 -byte word size (hence, the term "word" is redefined in this project to mean 2 rather than 4 bytes), is equipped with a total of 16 general purpose registers of size one word, numbered 0 to 15, and a small main memory (RAM) of 256 words. The computer CPU also contains one program counter (PC) register and one instruction register (IR) where the current instruction is temporarily stored. Given these characteristics, the new ISA is a simplified version of MIPS, which consists of fixed-size 16-bit instructions, i.e. they occupy one word of the memory. More details in attached file.

Task 1

Manually write machine language programs in the newly-designed ISA for the following:

a) Read a positive number n from the keyboard and compute and display its partial sum, calculated by n(n+1)/2

b) Read a positive number from the keyboard and compute and display the smallest power of two, which is larger than the read number. E.g. for 1000, the program should produce 1024.

c) Read a series of integer numbers, and determine and display the largest number. The first number read indicates how many numbers should be processed.

Associate each line of the program with a short comment or explanation.

Task 2

In this task you are going to develop your own interpreter of the new ISA, in your programming language of choice. This will turn the machine into a simulator of the newly- designed computer system and test its operation, before having to invest huge sums of money in the manufacture of its hardware chips!

Although students have the choice of command-line versus graphical interface for the ISA simulator, they are recommended to keep it simple with a Command Line Interface (CLI). The simulator begins its execution by prompting the user to enter the program one hexadecimal line (word) at a time for each memory address, starting from 00. User signals the end of the program by a special value, e.g. -11111. As the program is entered, the simulator loads it into the memory.

The memory can be represented with a one- dimensional array of 256 integer elements (since instructions as well as data are numbers). In this design the memory is word-addressed rather than byte-addressed. If the second were the case, the simulator would be slightly more complex by accessing memory at even-number locations, and PC would have to be incremented by 2 each time.

Next, the simulator executes the program. Execution begins with the instruction in location 00 and continues sequentially, unless a transfer of control instruction is encountered.

CPU registers (16 general, 1 PC and 1 IR) will have to be stored in separate variables. Also use a variable to hold the op-code of the instruction currently being executed. Do not execute instructions directly from memory. Rather, "fetch" the next instruction to be performed (incrementing PC as appropriate) from the memory array to the IR. Then "pick off" the leftmost hexadecimal digit and place it in op-code variable. Decode the instruction based on the op-code (e.g. through a "switch" structure) and based on the instruction type read the rest of the fields in separate variables. Keep in mind that when the simulated computer begins execution, the registers are all initialized to zero.

When the assembly program completes execution, the name and contents of each register, as well as the contents of memory should be displayed ("computer dump"). In order to keep the output size manageable, do not display all 256 words, but say the first 100 words in memory.

At this point, you should be able to implement the new ISA simulator and run each of the assembly programs in Task 1.

You are encouraged to extend the simulator to check for various types of errors. For example, during the program-loading phase, each hexadecimal number that is entered must be in the range -ffff to +ffff.

During the execution phase, the simulator should check for various types of errors, such as detecting an instruction with invalid op-code, or outside the range (e.g. negative), register overflows and underflows during arithmetic instructions, etc. Other types of execution errors could be attempts to divide by zero. Whenever errors are encountered, the simulator should terminate with the display of the appropriate message, as well as a full computer dump. This treatment will help the user debug the assembly programs.

The student should be careful to make the necessary conversions between hexadecimal and decimal number systems and not confuse the two. In Java, the library class Integer provides methods that parse a hexadecimal string to an integer, and vice versa, output an integer as a hexadecimal string.

Attachment:- Handout.rar

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92682627
  • Price:- $40

Priced at Now at $40, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Does bmw have a guided missile corporate culture and

Does BMW have a guided missile corporate culture, and incubator corporate culture, a family corporate culture, or an Eiffel tower corporate culture?

Rebecca borrows 10000 at 18 compounded annually she pays

Rebecca borrows $10,000 at 18% compounded annually. She pays off the loan over a 5-year period with annual payments, starting at year 1. Each successive payment is $700 greater than the previous payment. (a) How much was ...

Jeff decides to start saving some money from this upcoming

Jeff decides to start saving some money from this upcoming month onwards. He decides to save only $500 at first, but each month he will increase the amount invested by $100. He will do it for 60 months (including the fir ...

Suppose you make 30 annual investments in a fund that pays

Suppose you make 30 annual investments in a fund that pays 6% compounded annually. If your first deposit is $7,500 and each successive deposit is 6% greater than the preceding deposit, how much will be in the fund immedi ...

Question -under what circumstances is it ethical if ever to

Question :- Under what circumstances is it ethical, if ever, to use consumer information in marketing research? Explain why you consider it ethical or unethical.

What are the differences between four types of economics

What are the differences between four types of economics evaluations and their differences with other two (budget impact analysis (BIA) and cost of illness (COI) studies)?

What type of economic system does norway have explain some

What type of economic system does Norway have? Explain some of the benefits of this system to the country and some of the drawbacks,

Among the who imf and wto which of these governmental

Among the WHO, IMF, and WTO, which of these governmental institutions do you feel has most profoundly shaped healthcare outcomes in low-income countries and why? Please support your reasons with examples and research/doc ...

A real estate developer will build two different types of

A real estate developer will build two different types of apartments in a residential area: one- bedroom apartments and two-bedroom apartments. In addition, the developer will build either a swimming pool or a tennis cou ...

Question what some of the reasons that evolutionary models

Question : What some of the reasons that evolutionary models are considered by many to be the best approach to software development. The response must be typed, single spaced, must be in times new roman font (size 12) an ...

  • 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