Você está na página 1de 8

FACULTY OF ENGINEERING

ELECTRICAL AND ELECTRONIC ENGINEERING DEPARTMENT

KNL 237\3 COMPUTER SYSTEM OPERATIONS


Assignment 1

2014/2015 SEMESTER 2 (PKET)


LEC TURER: Dr. Kismet Anak Hong Ping

GROUP
1.

PATRUS MAXSION ANAK TINGGAL

43714

2.

RICK FALCO POLODIUS

43822

Introduction
C++ is a high level programming language. It features object-oriented and generic
programming which contribute the efficiency for low-level memory manipulation. It is useful in
many aspects such as desktop application, servers, performance-critical applications, and
entertainment software (Wikipedia, n.d.). C++ gives a collection of predefined classes with the
competency of user-defined classes. Class definitions determine data objects and functions.
Thus, it mainly used for software engineering and graphics.

What is Little Man Computer?


The Little Man Computer is a simulation of a basic computer system which follows the Von
Neumann architecture.
Imagine a little man in a room with an Input letterbox and an Output letterbox, and a set of
pigeonholes on the wall.
When he gets something through the input letterbox he puts it on his desk (the accumulator)
before reading the instruction to decide what to do with it. He can only handle one piece of data
on his desk at any time, so he has to keep putting things into the storage pigeonholes (memory
locations) in between. Despite this, by following a sequence of very simple instructions it is
possible to perform quite complex tasks.
Operations:
LOAD instruction -op code 5
STORE instruction -op code 3
ADD instruction -op code 1
SUBTRACT instruction -op code 2
INPUT instruction -op code 9, address 01
OUTPUT instruction -op code 9, address 02
COFFEE BREAK instruction -op code 0

Result
QUESTION 1

When the SEEMMMMM is 54512345, the 10s complement is 87655.


Notes:
a) For S value, 1 is for positive, 5 is for negative.
b) The stored excess is always at 40
c) 5 digits is need for the MMMMM value.

QUESTION 2
Compiler Log

First input 10
Second input 2
Highest common factor we cannot get.

# Code to compute a divided by b

IN
(first input)
STO a
(store input)
IN
(second input)
STO b
(store second input)
# Keep subtracting a from b until you go negative
# Keep a count of how many times you do it
start LDA count (load the number that had been minus for a and b)
ADD one
(add the input)
STO count (store the number that already count)
LDA a
(load the input a)
SUB b
(a subtract b)
STO a
(store a)
BRP start (branch continue if positive)
done LDA count (load number that have count)
# Subtract one as we went one too far
SUB one
(subctract the number again)
OUT
(output)
HLT
(stop)
a
DAT 000
b
DAT 000
count DAT 000
one
DAT 001

Discussion
In question 1, the program is very simple. It used the cmath and iostream to make it works.
The function like if,else and goto have been used in this program to make sure key in the
right value. Instructions also have been include in the program to guide the user.
Firstly, the user will have entered his S value, follow by entering the EE value and MMMMM
value. After that the program will calculate the mantissa and change it to 10s complementary.
For question 2, we have a bit problem to understand how to use Euclidean Algorithm. Based on example
given below:

From what we know, no division in LMC. To make a divide operation, we need to minus the
value example above 3084-1424.
As we can see, at the first, we plan to make a program that used two inputs of course, and
3084-1424=1660. Then 1660-1424=236 and if minus again the answer will be 0. So 236 we
stored the value. Next, 1424 will minus the value that we have stored until get 0 but not negative.
The answer we get if minus 1424 continuously by using loop will get 8. Thats mean the
COUNT is 6. But the solution is not finish. After we get 8 as a remainder, next the remainder 236
minus with remainder 8 until get 0 but the remainder we get is 4. Then, 8 minus 4 until
remainder get 0. If the remainder get 0, so that is the final answer. Therefore greatest common
divisor is 4 and COUNT is 4. But we cannot do this program because we lack of information
about coding although in the internet we still not get the information we want. We already do it
but always fail. Below is a picture that we want to establish our idea but failed.

Next, we have discussed with a few groups how to do the LMC program and we get it but we
still cannot get the greatest common factor but the COUNT probably correct. The result can be
seen on result on the other page.

Conclusion
In conclusion, for question 1, we have built a C++ program to convert SEEMMMMM to 10s
complimentary and for question 2, we already do the Little Man Computer program but the
problem is we cannot get the highest common factor.

Reference
1. https://www.rit.edu/~w-asc/documents/services/resources/handouts/DM%20%206%20Euclidean%20Algorithm.pdf
2. https://answers.yahoo.com/question/index?qid=20130618035050AApbNV8
3. http://www.ict4ocr.com/computing/lmc_blocks.html

Você também pode gostar