Write a program that adds two operands


Homework

Prompt

In this project you will design and build a simple CPU on Logisim and write programs that can run on it.

Your design will go through four phases. In the first phase, you will design and build the ALU using Logisim. In the second phase, you will design the instruction set that implements the instructions you designed in phase one. In the third phase, you will design and implement a control unit for this ALU using Logisim. By connecting the CPU to the ALU, you will get a functional CPU. In phase four of the project, you will write assembly language programs for the CPU you built.

Phase I

Start by building an 8-bit ALU using Logisim. This ALU can implement 16 instructions on 8-bit operands. We would suggest the following minimum list of instructions:

1. Arithmetic addition
2. Increment
3. Decrement
4. Comparison (with 3 outputs: one for equals, one for less than and one for greater than)
5. Logic bitwise Not
6. Logic bitwise And
7. Logic bitwise Or
8. Register right logic shift
9. Register left logic shift

In addition to these nine instructions, please suggest five more instructions that the ALU can implement for a total of 14 instructions (we are reserving 2 instructions for branching). Justify the importance of the five instructions you added in a Word doc to submitted as part of this homework. Label these instructions as 'Phase I.'

After you've suggested and justified your five suggested instructions, please build at least the nine above-mentioned operations as blocks in Logisim.

Phase III

In phase II of the project, you are required to design the instruction set of the ALU/CPU as follows:

1. Create the opcode table for the ALU by giving a binary code and a name for each instruction you built in Logisim in phase one.

2. Decide how many operands you want your instructions to handle and justify your choice. We suggest either one operand with accumulator or two operands with the result stored in one of the input registers.

3. In Logisim, add a multiplexer to the circuit you built in phase one that chooses one of the available operations. The simplest way to create this part of the CPU is to connect the outputs of the multiplexer to the inputs of AND arrays connected to the output of the operation blocks.

Phase III

In phase III, you are required to use Logisim to implement the control unit for at least the following three operations:

1. addition
2. logic bitwise AND
3. right logic shift

In order to finish this phase, you need to add operand registers according to the decision you took for the number of operands in phase two and, if needed, a flag register.

Phase IV

In order to be able to write assembly language for the CPU we need to add to instructions (without implementation):

1. branch to an address (name it JMP)

2. conditional branch to an address (name it CJMP and suppose that the jump takes place if the comparison operation result is 'equals')

Now, write the following programs using the assembly language you designed in the previous phases of the project as well as these two branching additional instructions:

1. Write a program that adds two operands.

2. Write a program that adds operands until the new value to be added is 0. You do not need to implement the input operations to modify the contents of the registers. Just assume that by the end of each iteration, the register content is modified.

3. Write a program that increments by 2 the content of a register 10 times.

4. Write a program that shifts the content of a register until the least significant bit is 0. Think of a way to stop shifting if the content of the register is 11111111 and add it to your program.

Format your homework according to the give formatting requirements:

1. The answer must be double spaced, typed, using Times New Roman font (size 12), with one-inch margins on all sides.

2. The response also includes a cover page containing the title of the homework, the course title, the student's name, and the date. The cover page is not included in the required page length.

3. Also include a reference page. The references and Citations should follow APA format. The reference page is not included in the required page length.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Write a program that adds two operands
Reference No:- TGS03155117

Expected delivery within 24 Hours