Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask C/C++ Expert


Home >> C/C++

Overall Program Objective:

You will design and simulate a basic RISC processor.   You will create and encode an instruction set.  Your final task will be to "compile" a program into your processor's machine code, and execute that program on your simulated processor.

DESIGN AN INSTRUCTION SET

Part 1 Objective:

For this first stage of the project, you should design and encode your own original instruction set.  You will design both an assembly language and a machine code.  To complete this stage, you must do the following:

  • List all of your registers
  • List all of your instructions, and indicate what operands each instruction requires.
  • Create a unique numerical encoding for each instruction, and list out the encoding
  • Prove that your instruction set is Turing Complete.
  • Translate the C program given in this project into your assembly language and machine code.

 

Limitations:

            Your instruction set must conform to the following limitations:

  • Your instruction set must be Turing Complete.
  • You should not directly reproduce any existing instruction set (you may, of course, borrow instructions here and there).
  • Your processor must be able to access at least 256 bytes of memory, where each memory entry is 1 byte long. You may access more, but are not required to.
  • Your processor should start executing at address 0
  • You should be creative!

 

Designing an Instruction Set:

            The following is an example Turing Complete instruction set that meets the requirements of the project:

registers:

4 one-byte general purpose registers: $r0-$r3, each of which holds a two's complement number A one-byte program counter

 

            instructions:

            ADD               RA, RB           add registers RA+RB, store result in RA

            SUB                RA, RB           subtract registers RA-RB, store result in RA

            LOAD             RA, [RB]        load 1 byte from memory at address in RB into RA

            STORE           RA, [RB]        store 1 byte from RA into memory at address in RB

            LUI                 RC, IMM        load 4 bit immediate into upper 4 bits of RC, lower bits are unchanged

            LLI                  RC, IMM        load 4 bit immediate into lower 4 bits of RC, upper bits are unchanged

            JALR              RA, RB           branch to address in RB, store PC+1 into RA

            BEQZ             RA, RB           branch to address in RB only if RA contains zero

            encodings:

            ADD:              0 0 0 0 RA1 RA0 RB1 RB0

            SUB:               0 0 0 1 RA1 RA0 RB1 RB0

            LOAD:            0 0 1 0 RA1 RA0 RB1 RB0

            STORE:          0 0 1 1 RA1 RA0 RB1 RB0

            JALR:             0 1 0 0 RA1 RA0 RB1 RB0

            BEQZ:                        0 1 0 1 RA1 RA0 RB1 RB0

            LUI:                1 0 RC1 RC0 IMM3 IMM2 IMM1 IMM0

            LLI                  1 0 RC1 RC0 IMM3 IMM2 IMM1 IMM0

            all other bit combinations are "NOP" - the instruction does nothing

You may not use the above instruction set.  However, you are required to show how each of the above eight instructions can be modeled by one or more of your own instructions.

Testing Your Instruction Set:

You should translate the following C program into your assembly language and into your machine code:

char x, n, i;

n=5;

x=0;

for (i=0; i!=n; i++)

      x=x+i;

You may use registers for n and i, if you choose, but you must use address 0xA0 for x.

Part 1 Submissions:

  • A list of your instructions and a description of what they do
  • A list of all your registers and flags, and a description of how they are used
  • The bit encodings for each of your instructions
  • For each of the instructions from the example instruction set, an example of how that instruction can be simulated by your instructions
  • The C program translated into your assembly language
  • The C program translated into your machine code (include addresses)

C/C++, Programming

  • Category:- C/C++
  • Reference No.:- M9526825

Have any Question?


Related Questions in C/C++

1 implement the binary search tree bst in c using the node

1. Implement the Binary Search Tree (BST) in C++, using the Node class template provided below. Please read the provided helper methods in class BST, especially for deleteValue(), make sure you get a fully understanding ...

There are several ways to calculate the pulse width of a

There are several ways to calculate the pulse width of a digital input signal. One method is to directly read the input pin and another method (more efficient) is to use a timer and pin change interrupt. Function startTi ...

Why do researcher drop the ewaste and where does it end

Why do researcher drop the ewaste and where does it end up?

What are the legal requirements with which websites must

What are the legal requirements with which websites must comply in order to meet the needs of persons with disabilities? Why is maximizing accessibility important to everyone?

Question 1find the minimum and maximum of a list of numbers

Question: 1. Find the Minimum and Maximum of a List of Numbers: 10 points File: find_min_max.cpp Write a program that reads some number of integers from the user and finds the minimum and maximum numbers in this list. Th ...

Assignment word matchingwhats a six-letter word that has an

Assignment: Word Matching What's a six-letter word that has an e as its first, third, and fifth letter? Can you find an anagram of pine grave. Or how about a word that starts and ends with ant (other than ant itself, of ...

Project - space race part a console Project - Space Race Part A: Console Implementation

Project - Space Race Part A: Console Implementation INTRODUCTION This assignment aims to give you a real problem-solving experience, similar to what you might encounter in the workplace. You have been hired to complete a ...

Assign ment - genetic algorithmin this assignment you will

ASSIGN MENT - GENETIC ALGORITHM In this assignment, you will use your C programming skills to build a simple Genetic Algorithm. DESCRIPTION OF THE PROGRAM - CORE REQUIREMENTS - REQ1: Command-line arguments The user of yo ...

Software development fundamentals assignment 1 -details amp

Software Development Fundamentals Assignment 1 - Details & Problems - In this assignment, you are required to answer the short questions, identify error in the code, give output of the code and develop three C# Console P ...

  • 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