Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

I have attached the previous assignments, this one builds off of them. ICSI 404 – Assignment 5 – memory & computer setup This assignment builds on the previous assignment. Part 1 Now that we have an...

1 answer below »
I have attached the previous assignments, this one builds off of them.

ICSI 404 – Assignment 5 – memory & computer setup

This assignment builds on the previous assignment.

Part 1

Now that we have an ALU, we need to add some memory to build the next portion of our computer.

Build a class called “memory”. Unlike the ALU, the rippleAdder and the multiplier, the memory needs to have state (members). It should have the following method calls:

public longword read(longword address)

public void write(longword address, longword value)

You must hard code the amount of memory our computer will have – 1024 bytes. The storage must be constructed from our existing bit class.

You must provide a test file (memory_test.java) that implements void runTests() and call it from your main, along with your existing tests. As with the other tests, these tests must be independent of each other and there must be reasonable coverage. You cannot reasonably test all of the billions of possible combinations, but you can test a few representative samples.

Part 2

With memory and an ALU, we can start working on building a functional CPU.

Start by creating a class: computer.

Add a bit to indicate if the computer is halted or not. This should default to NOT running (for now).

Create a void run() method that runs in a while loop until the halted bit indicates that the computer should not run anymore. Within this loop, four methods needs to be called:
void fetch(), void decode(), void execute(), void store(), in that order.

Add a memory member (private) to your computer.

There are no tests that we can reasonably run on your computer yet.

You must submit buildable .java files for credit.



Rubric

OK

Good

Great

Comments

“What” not “Why”, few (5)

Some “what” comments or missing some (7)

Anything not obvious has reasoning (10)

Variable/Function naming

Lots of abbreviations (5)

Full words most of the time (8)

Full words, descriptive (10)

Unit Tests

Partial Coverage

(7)

All methods covered, needs more cases (13)

All methods/cases covered (20)

Memory

Attempted (10)

Some cases work (20)

Completely working (30)

Computer – Run Loop

Correct(10)

Computer – Halt Bit

Exists(10)

Computer - Memory

Exists(10)

 

 

Answered 123 days After May 24, 2022

Solution

Robert answered on Sep 25 2022
60 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers