Question: PLEASE DON T USE STRUCTS Using C programming language write a program that simulates a variant of the Tiny Harvard Architecture. In this implementation memory
PLEASE DONT USE STRUCTS
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 TinyMachine Architecture:
LOAD
ADD
STORE
SUB
IN
OUT
END
JMP
SKIPZ
Each piece of the architecture must be accurately represented in your code Instruction Register, Program Counter, Instruction Memory IM MAR MDRMAR and MDR are connected to the IM Data Memory, MAR MDRMAR and MDR are connected to the DM and Accumulator. Instruction Memory will be represented by an integer array and each instruction will use elements of the arrayone 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
For the sake of simplicity Instruction Memory IM and Data Memory DM may be implemented as separate integer arrays.
IM size
DM size
Hint: All CPU registers and Data Memory DM are of type int.
Input Specifications
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 fetchexecute 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 text file should be named elf.txt YOU MUST MAKE SURE THAT THE PROGRAM BEING RAN MULTIPLIES TWO NUMBERS. YOU CAN USE THE OBJECT FILE BELOW TO HELP WITH THIS. The numbers will not be validated. you can use two integers as inputs and
The program must accept the input values in this order
inputto accumulate the result here
input top decrement variable that control the loop
input: first number to be multiplied for example,
input: second number to be multiplied for example,
Example of reading the object file and printing the Assembly language:
Read
Object File
Print it
IN
OUT
STORE
IN
OUT
STORE
IN
OUT
STORE
IN
OUT
STORE
LOAD
ADD
STORE
LOAD
SUB
STORE
SKIP
JUMP
LOAD
OUT
END
Output Specifications
The virtual machineVM 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 wordforword, 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 A NULL DM
input value
X
PC A X DM
outputting accumulator to screen
X
PC A X DM
storing accumulator to memory location
PC A X DM X
etc
Program complete.
Your program should compile and run from the command line with one input file parameter.
For instance, to implement FETCH and instruction LOAD you must implement each step:
FETCH
MARPC
PC PC
MDR IM MAR IM stands for Instruction Memory program memory
IR MDR
Case IROP Load is executed.
LOAD Execute cycle
MARIRADDR
MDR DM MARDM stands for Data Memory
A MDR
Note: you can use MAR or MAR for IM and MAR for DM
Tiny Machine ISA:
FETCH
MAR PC
PC PC
MDR IM MAR IM stands for Instruction Memory program memory
IR MDR
Depending on IROP one of the following instructions will be executed:
Execute cycle
LOAD
MAR IRADDR
MDRDMMAR
A MDR
ADD
MAR IRADDR
MDR DMMAR
A A MDR
STORE
MAR IRADDR
MDR A
DMMAR MDR
SUB
MARIRADDR
MDR DMMAR
A A MDR
IN
A Input value from keyboard emit a message to the user: Input data:
OUT
Screen A emit message to the user: The result is:
END
Run In your program Run must be initialized to to control the instruction cycle.
JMP
PC IRADDR
SKIP
IF A PC PC
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
