Question: Using C programming language write a program that simulates a variant of the Tiny Harvard Architecture. In this implementation memory ( RAM ) is split

Using C programming language write a program that simulates a variant of the Tiny Harvard Architecture. In this implementation memory (RAM) is split into Instruction Memory (IM) and Data Memory (DM). Your code must implement the basic instruction set architecture (ISA) of the Tiny Machine Architecture. Each piece of the architecture must be accurately represented in your code (Instruction Register, Program Counter, Instruction Memory (IM), MAR1, MDR-1(MAR-1 and MDR-1 are connected to the IM). Data Memory, MAR-2, MDR2(MAR-2 and MDR-2 are connected to the DM), and Accumulator. Instruction Memory will be represented by an integer array and each instruction will use 2 elements of the array(one
for OP and the other one for address) Data Memory will be represented by an integer array and each data value uses an element of the DM array. Your Program Counter will begin pointing to the first instruction of the program (PC =0). For the sake of simplicity Instruction Memory (IM) and Data Memory (DM) may be implemented
as separate integer arrays.
IM size 250
DM size 10
Hint: All CPU registers and Data Memory (DM) are of type int. You must run a program to multiply 2 numbers. We will test your HW4 running a program to multiply 2 numbers;. numbers will not be validated. you can use two integers as inputs 3 and 4.
The program must accept the input values in this order
input1=0(to accumulate the result here)
input2=1( top decrement variable that control the loop).
input3: first number to be multiplied (for example, 5)
input4: second number to be multiplied (for example, 3). Your simulator must run from the command line with a single input file as a parameter to main. This file will contain a sequence of instructions for your simulator to store in Instruction Memory and then run via the fetch/execute cycle. In the input file each instruction is represented with two integers: the first one represents the opcode and the second one a memory address or a device number depending on the instruction.The virtual machine(VM) you are implementing should provide output according to the input file. Along
with this output your program should provide status messages identifying details on the workings of your
simulator. Output text does not have to reflect my example word-for-word, but please provide detail on
the program as it runs in a readable format that does not conflict with the actual output of your VM. After
each instruction print the current state of the Program Counter, Accumulator, and Data Memory. The
INPUT instruction is the only one that should prompt an interaction from the user.
Example:
Reading Program...
Program Loaded.
Run.
PC =10| A = NULL | DM =[0,0,0,0,0,0,0,0,0,0]
/* input value */
X
PC =12| A = X | DM =[0,0,0,0,0,0,0,0,0,0]
/* outputting accumulator to screen */
X
PC =14| A = X | DM =[0,0,0,0,0,0,0,0,0,0]
/* storing accumulator to memory location 0*/
PC =16| A = X | DM =[X,0,0,0,0,0,0,0,0,0]
... etc
Program complete.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!