Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

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

image text in transcribedimage text in transcribedimage text in transcribed

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 s will start from index [0) and populate the Your instructions 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. e array sequentially. When the simulation is When the simulator initializes, print BEGIN SIMULATION at the top of the screen and display the cont ents of both memories Instruction Memory 300 1940 301 5941 302 2941 Data Memory 40 3 941 2 For each Step, give a description and the value of the PC, AC, and IR registers. For example Step 1 etc h instruction from memory location 300. PC = 300. IR 1940. Step 2 Execute the Instruction and increment the PC: load AC from PC 301 AC 0003. R 1940. memory location 940 Step 3 Fetch instruction from memory location 301 AC = 0003. IR = 5941 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. Submit: Simulate the simple "program" on pages 5-7 of your textbook using the instruction and data values given above. Either copy/paste the output into your submission or include a screenshot. The figure below shows the expected outcome for the program in the textbook BEGIN SIMULATION Instruction Memor 00 1940 Data Memory 40 3 941 2 942 943 9440 301 5941 302 2941 303 304 0 tep 1 Fetch instruction from nenory loacation 300. PC300 IR 1940 tep 2 Execute the instruction and increment the PC: Load AC from nenory location 940 PC301 C3. IR = 1940. tep 3 etch instruction from menory loacation 301. PC301 IR5941 tep 4 Execute the instruction and increment the PC: Add to AC fron memory location 941 PC302. IR 5941. tep 5 Fetch instruction from menory loacation 302 PC302 IR 2941. tep 6 Execute the instruction and increment the PC: Store AC to nemory location 941 415 data memory loaction update PC303 IR-2941 Instruction Memory 00 1940 Data Memory 40 3 941 5 942 943 301 5941 302 2941 303 3040 944 END SIMULATION Figure L1-1 PART 2: extend the simulator The Hypothetical machine has been updated to read from and write to I/O devices. In these cases, the 12 bit address identifies a particular external device. Additional algebraic operations were also added. 0001 Load AC from memory 0010 Store AC to memory 001 Load AC from I/O 0101 Add to AC from memory 0110 Subtract memory from AC 0111 Store AC to I/O 1000 Multiply AC with memory 1001 Divide AC by memory Suppose that we want to read a value from device 5, add that to the contents of memory location 940, and write the answer to I/O device 6. Assume that device 5 has the value 3 and memory location 940 has the value of 2. We can write a "program" as follows: 1. Load AC from device 5 (this is 3005 in hexadecimal) 2. Add contents of memory location 940 3. Store AC to device 6 Update your simulator to handle I/O devices. The updates should include: Updating the description of the step where applicable. Creating arrays for devices - the lab deals with devices 5 and 6 only so you will only need a arrays for device 5 and device 6. Displaying the contents of the devices before and after simulation. Any other updates you think you require. Simulate the following program 1. Load AC from device 5 2. Add AC with contents of memory location 940. 3. Divide AC by contents of memory location 9 4. Store AC to device 6) 5. Store AC to memory location 942. 6. Load AC from device 5. 7. Multiply AC with contents of memory location 942. 8. Subtract contents of memory location 943 from the AC. 9. Store AC to memory location 944 10. Store AC to device 6. Assume that following values initially: Data memory 940 3 941 5 942 0 943 10 944 0 Device 5 contains two values: the value 2 is read the first time and the value 13 is read the second time. 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 s will start from index [0) and populate the Your instructions 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. e array sequentially. When the simulation is When the simulator initializes, print BEGIN SIMULATION at the top of the screen and display the cont ents of both memories Instruction Memory 300 1940 301 5941 302 2941 Data Memory 40 3 941 2 For each Step, give a description and the value of the PC, AC, and IR registers. For example Step 1 etc h instruction from memory location 300. PC = 300. IR 1940. Step 2 Execute the Instruction and increment the PC: load AC from PC 301 AC 0003. R 1940. memory location 940 Step 3 Fetch instruction from memory location 301 AC = 0003. IR = 5941 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. Submit: Simulate the simple "program" on pages 5-7 of your textbook using the instruction and data values given above. Either copy/paste the output into your submission or include a screenshot. The figure below shows the expected outcome for the program in the textbook BEGIN SIMULATION Instruction Memor 00 1940 Data Memory 40 3 941 2 942 943 9440 301 5941 302 2941 303 304 0 tep 1 Fetch instruction from nenory loacation 300. PC300 IR 1940 tep 2 Execute the instruction and increment the PC: Load AC from nenory location 940 PC301 C3. IR = 1940. tep 3 etch instruction from menory loacation 301. PC301 IR5941 tep 4 Execute the instruction and increment the PC: Add to AC fron memory location 941 PC302. IR 5941. tep 5 Fetch instruction from menory loacation 302 PC302 IR 2941. tep 6 Execute the instruction and increment the PC: Store AC to nemory location 941 415 data memory loaction update PC303 IR-2941 Instruction Memory 00 1940 Data Memory 40 3 941 5 942 943 301 5941 302 2941 303 3040 944 END SIMULATION Figure L1-1 PART 2: extend the simulator The Hypothetical machine has been updated to read from and write to I/O devices. In these cases, the 12 bit address identifies a particular external device. Additional algebraic operations were also added. 0001 Load AC from memory 0010 Store AC to memory 001 Load AC from I/O 0101 Add to AC from memory 0110 Subtract memory from AC 0111 Store AC to I/O 1000 Multiply AC with memory 1001 Divide AC by memory Suppose that we want to read a value from device 5, add that to the contents of memory location 940, and write the answer to I/O device 6. Assume that device 5 has the value 3 and memory location 940 has the value of 2. We can write a "program" as follows: 1. Load AC from device 5 (this is 3005 in hexadecimal) 2. Add contents of memory location 940 3. Store AC to device 6 Update your simulator to handle I/O devices. The updates should include: Updating the description of the step where applicable. Creating arrays for devices - the lab deals with devices 5 and 6 only so you will only need a arrays for device 5 and device 6. Displaying the contents of the devices before and after simulation. Any other updates you think you require. Simulate the following program 1. Load AC from device 5 2. Add AC with contents of memory location 940. 3. Divide AC by contents of memory location 9 4. Store AC to device 6) 5. Store AC to memory location 942. 6. Load AC from device 5. 7. Multiply AC with contents of memory location 942. 8. Subtract contents of memory location 943 from the AC. 9. Store AC to memory location 944 10. Store AC to device 6. Assume that following values initially: Data memory 940 3 941 5 942 0 943 10 944 0 Device 5 contains two values: the value 2 is read the first time and the value 13 is read the second time

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

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

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions