4CS015 Fundamentals of Computing - Workshop 6: Von Neumann Simulator
VerifiedAdded on 2020/05/16
|5
|1038
|118
Homework Assignment
AI Summary
This document presents the solutions to Workshop 6 of the 4CS015 Fundamentals of Computing course, focusing on the Von Neumann simulator. The assignment tasks involve understanding and programming the simulator, including instructions like LOADTEMP, ADD, DISPACC, and HALT. The solutions include programs to add and subtract numbers, along with programs to add multiple numbers together using loops, and even a multiplication program. The document provides step-by-step explanations and answers to questions about the functionality of the programs and how they achieve their results, demonstrating a practical understanding of the Von Neumann architecture and assembly-level programming.

4CS015 Fundamentals of Computing – Workshop #6
This is a marked workshop. It forms the Fourth part of your portfolio. You will need to complete the
workshop and then submit a copy of this document with a title that follows the following format
(“DENNETT 1234567 wsp3.docx”), via CANVAS, before 11.59pm, Sunday, 26th November 2017
The Von Neumann simulator can be found on CANVAS.
Workshop tasks:
1. Von Neumann Simulator. This program simulates a very simple computer with the von Neumann
architecture.
a. Download the von Neumann Simulator (VonNeumann.exe) program from WOLF in the
Week 5 folder. Save it in your Documents folder and run it. You will see a window similar
to this:
The simulator has a small program memory area which is available for programming. To
enter your program instructions simply click on the “Available” instruction on the list on the
right and then click on the “Memory” location you wish to put it in.
This simulator understands only the following ten instructions:
This is a marked workshop. It forms the Fourth part of your portfolio. You will need to complete the
workshop and then submit a copy of this document with a title that follows the following format
(“DENNETT 1234567 wsp3.docx”), via CANVAS, before 11.59pm, Sunday, 26th November 2017
The Von Neumann simulator can be found on CANVAS.
Workshop tasks:
1. Von Neumann Simulator. This program simulates a very simple computer with the von Neumann
architecture.
a. Download the von Neumann Simulator (VonNeumann.exe) program from WOLF in the
Week 5 folder. Save it in your Documents folder and run it. You will see a window similar
to this:
The simulator has a small program memory area which is available for programming. To
enter your program instructions simply click on the “Available” instruction on the list on the
right and then click on the “Memory” location you wish to put it in.
This simulator understands only the following ten instructions:
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

NOP No Operation, i.e. do nothing.
LOADTEMP
Get a number from the keypad, completed
by the Enter key, into the Temporary
Register.
LOADLOOP Get a number from the keypad, completed
by the Enter key, into the Loop Register.
CLRDISP Clear the Display.
ADD Add the Temporary Register to the
Accumulator
SUB Subtract the Temporary Register from the
Accumulator
DISPACC Display the contents of the Accumulator
STRTBLK Start of Loop Block
ENDBLK End of Loop Block
HALT Halt. Stop Program
b. Load the following program into the memory:
LOADTEMP
ADD
DISPACC
HALT
To do this, first click on the “LOADTEMP” in the list of instructions on the right of
simulator window. Then click on Memory location with “Address 0 Contains NOP”. This
will then change into “Address 0 Contains LOADTEMP”. Repeat the process with
“Address 1” and so on until the whole program is loaded.
c. Run the program by clicking on the “Run” button. The simulator would highlight the
Address 0 location and then pause. It is executing the instruction “LOADTEMP” which
requires you to input a number into the keypad.
Click 2 or 3 numbers on the keypad and then click the “Enter” button. The simulator will
then resume running the program and execute the instruction “ADD”. This adds the
number that you just entered, to the zero in the accumulator.
The next instruction is “DISPACC” which stands for “Display Accumulator”, and it does
exactly that. After than the simulator stops running the program when it executes the
instruction “HALT”.
d. Load the following program into the simulator:
LOADTEMP
LOADTEMP
Get a number from the keypad, completed
by the Enter key, into the Temporary
Register.
LOADLOOP Get a number from the keypad, completed
by the Enter key, into the Loop Register.
CLRDISP Clear the Display.
ADD Add the Temporary Register to the
Accumulator
SUB Subtract the Temporary Register from the
Accumulator
DISPACC Display the contents of the Accumulator
STRTBLK Start of Loop Block
ENDBLK End of Loop Block
HALT Halt. Stop Program
b. Load the following program into the memory:
LOADTEMP
ADD
DISPACC
HALT
To do this, first click on the “LOADTEMP” in the list of instructions on the right of
simulator window. Then click on Memory location with “Address 0 Contains NOP”. This
will then change into “Address 0 Contains LOADTEMP”. Repeat the process with
“Address 1” and so on until the whole program is loaded.
c. Run the program by clicking on the “Run” button. The simulator would highlight the
Address 0 location and then pause. It is executing the instruction “LOADTEMP” which
requires you to input a number into the keypad.
Click 2 or 3 numbers on the keypad and then click the “Enter” button. The simulator will
then resume running the program and execute the instruction “ADD”. This adds the
number that you just entered, to the zero in the accumulator.
The next instruction is “DISPACC” which stands for “Display Accumulator”, and it does
exactly that. After than the simulator stops running the program when it executes the
instruction “HALT”.
d. Load the following program into the simulator:
LOADTEMP

ADD
LOADTEMP
ADD
DISPACC
HALT
What do you think it does? Write your answer below (10 marks)
ANS:-
The above program just do the addition of two numbers. The first LOADTEMP will wait
for the first number which is enter from keyboard and the second LOADTEMP is for the
second number. After the ADD instruction for addition the DISPACC instruction will help
to display the addition result in the accumulator. The last command HALT help to halt
the program.
e. Write a program to add 3 numbers together. List your program below (10 marks)
ANS: -
LOADTEMP
ADD
LOADTEMP
ADD
LOADTEMP
ADD
DISPACC
HALT
f. Write a program to subtract a number from another. List your program below (10
marks)
ANS:-
LOADTEMP
ADD
LOADTEMP
SUB
DISPACC
LOADTEMP
ADD
DISPACC
HALT
What do you think it does? Write your answer below (10 marks)
ANS:-
The above program just do the addition of two numbers. The first LOADTEMP will wait
for the first number which is enter from keyboard and the second LOADTEMP is for the
second number. After the ADD instruction for addition the DISPACC instruction will help
to display the addition result in the accumulator. The last command HALT help to halt
the program.
e. Write a program to add 3 numbers together. List your program below (10 marks)
ANS: -
LOADTEMP
ADD
LOADTEMP
ADD
LOADTEMP
ADD
DISPACC
HALT
f. Write a program to subtract a number from another. List your program below (10
marks)
ANS:-
LOADTEMP
ADD
LOADTEMP
SUB
DISPACC
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

HALT
g. Load the following program into the simulator:
LOADTEMP
ADD
LOADLOOP
STRTBLK
ADD
DISPACC
ENDBLK
HALT
Run it and when it reach the LOADTEMP instruction, enter 5 on the keypad and click the
“Enter” button. When it reaches the LOADLOOP instruction, enter 6. What do you think
the program does? Write your answer below in the form of an equation (10 marks)
ANS:-
First LOADTEMP is used to enter a number which is 5 and the LOADLOOP is used for how
many times the loop will run. In here the loop is run 6 times. Therefore, the addition of 5
is happen 6 times. In start of the program one ADD instruction is used. Therefore, the
LOADTEMP number which is 5 is added one more time. The equation form of the above
program is 5+(5+5+5+5+5+5) or 5+(6*5).
h. Write a program that will let you add 5, or 10 or 20 numbers together. List your program
below and explain how it works (25 marks)
ANS:-
LOADLOOP
STRTBLK
LOADTEMP
ADD
DISPACC
ENDBLK
HALT
The above program will help to add 5, 10 or 20 number together. First LOADLOOP
instruction used to determine how many times the loop will be execute. Then the loop is
start by executing the STRBLK instruction. After that the LOADTEMP is used to enter the
g. Load the following program into the simulator:
LOADTEMP
ADD
LOADLOOP
STRTBLK
ADD
DISPACC
ENDBLK
HALT
Run it and when it reach the LOADTEMP instruction, enter 5 on the keypad and click the
“Enter” button. When it reaches the LOADLOOP instruction, enter 6. What do you think
the program does? Write your answer below in the form of an equation (10 marks)
ANS:-
First LOADTEMP is used to enter a number which is 5 and the LOADLOOP is used for how
many times the loop will run. In here the loop is run 6 times. Therefore, the addition of 5
is happen 6 times. In start of the program one ADD instruction is used. Therefore, the
LOADTEMP number which is 5 is added one more time. The equation form of the above
program is 5+(5+5+5+5+5+5) or 5+(6*5).
h. Write a program that will let you add 5, or 10 or 20 numbers together. List your program
below and explain how it works (25 marks)
ANS:-
LOADLOOP
STRTBLK
LOADTEMP
ADD
DISPACC
ENDBLK
HALT
The above program will help to add 5, 10 or 20 number together. First LOADLOOP
instruction used to determine how many times the loop will be execute. Then the loop is
start by executing the STRBLK instruction. After that the LOADTEMP is used to enter the
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

number and the ADD instruction is helping to add the numbers. The loop executions
depend on the LOADLOOP number which is enter by the user. After end of the loop the
program will stop by HALT instruction.
i. Write a program that will let you multiply 2 numbers together. List your program below
and explain how it works (35 marks)
ANS:-
LOADLOOP
LOADTEMP
STRBLK
ADD
DISPACC
ENDBLK
HALT
The above program is used to multiply two numbers together. First LOADLOOP
instruction is used for how many times the loop will be execute which is the first
number. On the other hand, the LOADTEMP instruction used for second number. After
that the loop is start and adding the second number until the loop end. From this
process the multiplication of two numbers can be found.
depend on the LOADLOOP number which is enter by the user. After end of the loop the
program will stop by HALT instruction.
i. Write a program that will let you multiply 2 numbers together. List your program below
and explain how it works (35 marks)
ANS:-
LOADLOOP
LOADTEMP
STRBLK
ADD
DISPACC
ENDBLK
HALT
The above program is used to multiply two numbers together. First LOADLOOP
instruction is used for how many times the loop will be execute which is the first
number. On the other hand, the LOADTEMP instruction used for second number. After
that the loop is start and adding the second number until the loop end. From this
process the multiplication of two numbers can be found.
1 out of 5
Your All-in-One AI-Powered Toolkit for Academic Success.
+13062052269
info@desklib.com
Available 24*7 on WhatsApp / Email
Unlock your academic potential
Copyright © 2020–2025 A2Z Services. All Rights Reserved. Developed and managed by ZUCOL.

