Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The things commented out on my code are what needs to be done I believe The Hypothetical Machine instructions 0001 Load AC from memory 0010

image text in transcribedimage text in transcribedimage text in transcribed

The things commented out on my code are what needs to be done I believe

The Hypothetical Machine instructions 0001 Load AC from memory 0010 Store AC to memory 0101 Add to AC from memory Assume that instructions begin in memory at location location 940 (see textbook). Assume instructions are in hexadecimal. 300 and da ta is stored in memory beginning at PART 1: the initial simulator In your simulator you will have an instruction memory, which contains the instructions to be executed, and a data memory which contains data for calculations, etc. Use a separate array for each of these Your instructions will start from index [0] and populate the array sequentially. When the simulation is written to the file the first memory location is displayed as 300. Similarly, your data will start from index [0] and populate the array sequentially. When the simulation is written to the file the first memory location is displayed as 940 When the simulator initializes, print BEGIN SIMULATION at the top of the screen and display the contents of both memories. Instruction Memory 300 1940 301 5941 302 2941 Data Memory 940 3 941 2 For each Step, give a description and the value of the PC, AC, and IR registers. For example: Step 1 Fetch instruction from PC 300 AC 0 IR- 1940 memory location 300 Step 2 Execute the Instruction and increment the PC: load AC from PC = 301 AC 0003. IR 1940 memory location 940 Step 3 Fetch instruction from PC 301 AC = 0003. IR= 5941 memory location 301 If memory is updated it should be described in the appropriate step Finally, display both memory contents and the print END SIMULATION Instruction Memory 300 1940 301 5941 302 2941 Data Memory 940 3 941 5 Pay attention to formatting each memory location is separated by a tab, each step is separated by an empty line, etc. #include 1 2 3 int imem[5]1940,5941,2941); 4 int dmem [5]-3,2); 5 int i, IR, opcode, adress, AC; 6 int main () 7 8 | for (i=0; 3;i++); 9 10 //fetch IR-inen(1); 12 13 opcode-IR/1000; //opcode-1 14 | adress=1RX1000; //adress-940 15 16L if(opcode-4) 17 18 19 20 21 //1-Load from mem Location AC-dmem [adress-940]; to AC | else if(opcode=-2) 23 //2- store ac in memory 24 25 261 else(opcode=:5) 27 28 1/5-AC AC+mem 29 30 eed print f statemnts 32 L

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Analysis Using SQL And Excel

Authors: Gordon S Linoff

2nd Edition

111902143X, 9781119021438

More Books

Students also viewed these Databases questions

Question

Define indirect financial compensation (employee benefits).

Answered: 1 week ago