Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In this assignment, you will create a program in C to simulate the instruction life cycle of a simplified computer architecture. You will implement a
In this assignment, you will create a program in C to simulate the instruction life cycle of a simplified
computer architecture. You will implement a fetchdecodeexecute cycle and demonstrate how different
op codes affect the execution of instructions. Marks
Scenario Description:
Imagine you are a computer architect tasked with building a simulator for a basic computer architecture.
Your goal is to create a program that can execute a series of instructions, each with its own op code, and
show how the fetchdecodeexecute cycle works.
Requirements:
Write a C program named instructionsimulator.c
Define a simplified instruction set with at least five different op codes. Each op code should
correspond to a specific operation eg ADD, SUB, LOAD, STORE, etc. Create an enum or
constants to represent these op codes.
Implement a fetchdecodeexecute cycle within a loop that processes a sequence of instructions.
The cycle should include the following steps:
a Fetch: Fetch the next instruction from memory.
b Decode: Determine the operation to be performed based on the op code.
c Execute: Perform the operation and update the program state accordingly.
Create a data structure eg an array to represent the memory of the computer. Initialize this
memory with a sequence of instructions using the op codes defined in step
Print the state of the computer eg memory contents, registers before and after each
instruction is executed.
Implement at least two sample programs using your defined op codes and memory layout.
These programs should consist of sequences of instructions that demonstrate various operations
and interactions between instructions.
Use comments to explain the purpose of each part of your code and how the fetchdecodeexecute cycle works.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started