Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PART 1: the initial simulator In your silao yo and a data memory which contains data for calculations, etc. Use a separate array for each
PART 1: the initial simulator In your silao yo and a data memory which contains data for calculations, etc. Use a separate array for each of these u will have an instruction memory, which contains the instructions to be e xecuted, 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 [O] 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 instru ction from memory location 300. IR 1940. Step 2 Execute the Instruction and increment the PC: load AC fr PC 301 AC 0003. IR 1940. rom memory location 940. Step 3 Fetch instru PC 301 AC 0003. IR 5941 ction from 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 EGIN SIMULATION Instruction Memo1 00 1940 ata Memory 40 3 941 2 942943 301 5941 302 2941 303 0 304 944 6 tep 1 etch instruction fron nenory loacation 300 C-300 IR 1948 tep 2 xecute the instruction and increment the PC: Load AC fron nenory location 940 IR 1940 tep etch instruction fron nenory loacation 301 C 301. IR5941 tep 4 xecute the instruction and increment the PC: Add to AC fron nemory location 941 C 302 R = 5941. tep 5 etch instruction fron nenory loacation 302 302 IR 2941 tep 6 xecute the instruction and increment the PC: Store AC to menory location 941 1-5 data nenory loaction update. C-303 IR 2941 Instruction Menory 00 1940 ata Memory 40 3 941 5 942943 301 5941 302 2941 303 304 6 944 ND 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 identfies a particular external device. Additional algebraic operations were also added. 0001 Load AC from memory 0010 Store AC to memory 0011 Load AC from I/O 0101 Add to AC from memory 0110 Subtract memory 0111 Store AC to I/O 1000 Multiply AC with memory 100 Divide AC by memory from AC 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. Ad 3. Store AC to device 6. d contents of memory location 940. 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 941 4. Store AC to device 6 5. Store AC 6. Load AC from device 5. 7. Multiply AC with contents of memory location 942. 8. Subtract contents of memory location 943 9. Store AC 10. Store AC to device 6. to memory location 942 from the AC to memory location 944. 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 ime. Submit Write out the above program Simulate the program. Either copy/paste the output into your submission or include a screenshot. The final code for the simulator. in hexadecimal - include the hexadecimal in your lab submission. PART 1: the initial simulator In your silao yo and a data memory which contains data for calculations, etc. Use a separate array for each of these u will have an instruction memory, which contains the instructions to be e xecuted, 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 [O] 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 instru ction from memory location 300. IR 1940. Step 2 Execute the Instruction and increment the PC: load AC fr PC 301 AC 0003. IR 1940. rom memory location 940. Step 3 Fetch instru PC 301 AC 0003. IR 5941 ction from 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 EGIN SIMULATION Instruction Memo1 00 1940 ata Memory 40 3 941 2 942943 301 5941 302 2941 303 0 304 944 6 tep 1 etch instruction fron nenory loacation 300 C-300 IR 1948 tep 2 xecute the instruction and increment the PC: Load AC fron nenory location 940 IR 1940 tep etch instruction fron nenory loacation 301 C 301. IR5941 tep 4 xecute the instruction and increment the PC: Add to AC fron nemory location 941 C 302 R = 5941. tep 5 etch instruction fron nenory loacation 302 302 IR 2941 tep 6 xecute the instruction and increment the PC: Store AC to menory location 941 1-5 data nenory loaction update. C-303 IR 2941 Instruction Menory 00 1940 ata Memory 40 3 941 5 942943 301 5941 302 2941 303 304 6 944 ND 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 identfies a particular external device. Additional algebraic operations were also added. 0001 Load AC from memory 0010 Store AC to memory 0011 Load AC from I/O 0101 Add to AC from memory 0110 Subtract memory 0111 Store AC to I/O 1000 Multiply AC with memory 100 Divide AC by memory from AC 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. Ad 3. Store AC to device 6. d contents of memory location 940. 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 941 4. Store AC to device 6 5. Store AC 6. Load AC from device 5. 7. Multiply AC with contents of memory location 942. 8. Subtract contents of memory location 943 9. Store AC 10. Store AC to device 6. to memory location 942 from the AC to memory location 944. 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 ime. Submit Write out the above program Simulate the program. Either copy/paste the output into your submission or include a screenshot. The final code for the simulator. in hexadecimal - include the hexadecimal in your lab submission
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