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.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
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 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.
Example:
Input File
55
//IN 5
//OUT 7
//STORE O
//IN 5
//OUT 7
67
30
55
67
31
I/STORE 1
10
/LOAD O
41
//SUB 1
//STORE O
//OUT 7
30
67
I/LOAD 1
//OUT 7
11
67
70
//END
Output Specifications
Your simulator 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 simulator. Áfter 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.
Transcribed Image Text: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 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. Example: Input File 55 //IN 5 //OUT 7 //STORE O //IN 5 //OUT 7 67 30 55 67 31 I/STORE 1 10 /LOAD O 41 //SUB 1 //STORE O //OUT 7 30 67 I/LOAD 1 //OUT 7 11 67 70 //END Output Specifications Your simulator 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 simulator. Áfter 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.
The Problem
Using C programming language write a program that simulates a variant of the Tiny Machine
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:
1 LOAD
2→ ADD
3→ STORE
4 → SUB
5> IN
6> OUT
7> END
8 → JMP
9> SKIPZ
Each piece of the architecture must be accurately represented in your code (Instruction Register, Program
Counter, Memory Address Registers, Instruction Memory, Data Memory, Memory Data Registers, and
Accumulator). Data Memory will be represented by an integer array. Your Program Counter will begin
pointing to the first instruction of the program.
For the sake of simplicity Instruction Memory (IM) and Data Memory (DM) may be implemented
as separate arrays.
Hint: Implementing a struct for your Instructions and an array of these structs as your Instruction
Memory greatly simplifies this program.
Example:
typedef struct {
int opCode, device Or Address;
} Instruction;
Instruction IM[MAXPROGRAMSIZE];
Note: IM, MDR1, and IR are of type Instruction. All other CPU registers and Data Memory (DM) are of
type int.
Transcribed Image Text:The Problem Using C programming language write a program that simulates a variant of the Tiny Machine 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: 1 LOAD 2→ ADD 3→ STORE 4 → SUB 5> IN 6> OUT 7> END 8 → JMP 9> SKIPZ Each piece of the architecture must be accurately represented in your code (Instruction Register, Program Counter, Memory Address Registers, Instruction Memory, Data Memory, Memory Data Registers, and Accumulator). Data Memory will be represented by an integer array. Your Program Counter will begin pointing to the first instruction of the program. For the sake of simplicity Instruction Memory (IM) and Data Memory (DM) may be implemented as separate arrays. Hint: Implementing a struct for your Instructions and an array of these structs as your Instruction Memory greatly simplifies this program. Example: typedef struct { int opCode, device Or Address; } Instruction; Instruction IM[MAXPROGRAMSIZE]; Note: IM, MDR1, and IR are of type Instruction. All other CPU registers and Data Memory (DM) are of type int.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY