Uploaded by William Shakes

computer architecture organization report

advertisement
FINAL REPORT
CODE/COURSE
: BEJ30303 COMPUTER ARCHITECTURE ORGANIZATION
SECTION
: TWO (2)
GROUP
:
GROUP
MEMBERS
1. MUHAMMAD AIMAN BIN RASHIDI (CE190191)
2. MUHAMAD RIDZUAN BIN IDRUS (CE190219)
3. NURKHAIRUL DANIEL BIN KHAIRUL YUSHAINI
(CE190139)
SEMESTER
: 1 - 2021/2022
LECTURE’S
: DR. DANIAL BIN MD NOR
MARKS
:
TABLE OF CONTENT
1.0 BACKGROUND
1.1 Introduction
1.2 Equation Derived
2-3
3
2.0 METHODOLOGY
2.1 Simulation flow chart
4
2.1 Assembly language code
5
3.0 RESULT AND ANALYSIS
3.1 First input value
6
3.2 Second input value
7
3.3 Analysis
8
4.0 DISCUSSION
8
5.0 CONCLUSION
9
6.0 REFERENCE
9
1
1.0 INTRODUCTION
The word "programme execution" refers to the loading of instructions that make up a programme
to be executed by a computer into consecutive locations in the computer's main memory. [1] To
run the programme, the CPU acquires one instruction at a time and executes the functions given,
then fetches instructions from successive memory locations until a branch or jump instruction is
executed.
Furthermore, when referred to as the programme counter, the CPU uses a specific CPU
register to keep track of the address of the memory location where the next instruction is located.
Following the retrieval of an instruction, the Programme Counter's contents are modified to point
to the next instruction in the sequence. Let's pretend that each instruction takes up one memory
word for the sake of simplicity. As a result, the CPU must conduct the following three steps in
order to execute one instruction. [2]
-
Step 1: Fetch the contents of the memory address pointed at by the computer, and
interpret the contents as an instruction to be executed.
-
Step 2: The fetch phase. The fetch cycle entails reading the next instruction from memory
into the CPU while also updating the contents of the programme counter.
-
Step 3: The execution phase. The instruction fetch and execution phases are combined to
produce the instruction cycle, which understands the opcode and performs the indicated
operation.
Steps 1 and 2 can be repeated as many times which necessitates a memory access (indirect
addressing requires more memory access) as necessary to retrieve the whole instruction when an
instruction contains more than one word. The processor reads the command and executes the
needed action, which can be divided into four categories. [1]
a. Processor-memory: Data can be transmitted from the CPU to the memory or
conversely.
b. Processor - Input/Output: By transmitting data between the processor and an input or
output module, data can be sent to or received from a peripheral device.
c. Data processing: Data may be subjected to arithmetic or logic operations by the
processor.
d. Control: An instruction can specify that the execution sequence be changed. The main
line of activity alternates between fetching instructions and executing instructions. After
2
retrieving an instruction, it is checked to see if it contains any indirect addressing. If this
is the case, the required operands are obtained by indirect addressing.
A single instruction's execution cycle may have more than one memory reference. An instruction
can also specify an I/O operation instead of memory references. The LMC simulation there are
100 memory addresses that are assembly instructions RAM. In the LMC simulation there are six
parts of the CPU which contain an accumulator (to store data for calculations and to do simple
addition and subtraction), program counter (the memory address of the next instruction to be
loaded), instruction register (to store the instruction's top digit read from memory), address
register (to store the bottom two digits of the memory command), input and output. The purpose
of an accumulator is to store data for calculations and to do simple addition and subtraction.
1.2 EQUATION DERIVED
The equation that is chosen in this assignment is shown below which fulfills the minimum
requirement to use in this assignment in order to derive it into assembly language code and test
the simulation. The operation that we use is add, subtraction and multiplication presented as:
(A+B)*(C-D)
3
2.0 METHODOLOGY
2.1 SIMULATION FLOW CHART
This section explains how the simulation of our equation is implemented on the Little Man
Computer (LMS). As the flow chart below shows, the total accumulation equals 6, because every
input that is loaded into the system, its display on the accumulation so by our understanding it
follows the number of our total input.
Figure 1: Flow chart of the simulation
4
2.2 ASSEMBLY LANGUAGE CODE
INP
STA A
INP
STA B
INP
STA C
INP
STA D
LDA A
ADD B
OUT
LDA C
SUB D
OUT
LOOP
ENDTHIS
A
B
C
D
FIRST
SECOND
ONE
ANS
INP
STA FIRST
INP
STA SECOND
LDA SECOND
BRZ ENDTHIS
SUB ONE
STA SECOND
LDA ANS
ADD FIRST
STA ANS
BRA LOOP
LDA ANS
OUT
SUB ANS
STA ANS
HLT
DAT
DAT
DAT
DAT
DAT
DAT
DAT 1
DAT 0
5
3.0 RESULT AND ANALYSIS
3.1 FIRST INPUT VALUE
Figure 2: Using input value A = 4 , B = 3 , C = 6 , D = 2
Calculation
=
=
=
(4 + 3) * (6 - 2)
7*4
28
6
3.2 SECOND INPUT VALUE
Figure 3: Using input value A = 20 , B = 4 , C = 7 , D = 2
Calculation
=
=
=
(20 + 4) * (7 - 2)
24 * 5
120
7
3.3 ANALYSIS
The assembly language code for our equation consists of the operation for the add, subtraction
and multiply. By observation on the way LMC works is by; The LMC will begin loading the
instruction from the programme counter's memory address. Before the simulation can execute,
the assembly code will be translated to LMC code. After loading and running our assembly
language code, the CPU program counter will start to count and the address will be registered
which means the program counter is incremented to the next memory location when the data is
loaded. The data will start to store into the RAM. The input load to the LMC will display on the
accumulator. There are six input numbers to be loaded, of which the first four is the operation for
add (A + B) and subtraction (C - D). Then the simulation will ask the fifth and sixth input, for
the multiplication of the (A+B)*(C-D). Last but not least, there are three outputs representing the
operation of add, subtraction and multiplication. The LMC processor is capable of understanding
10 basic commands and the instructions are only understood by the LMC in numerical form.
4.0 DISCUSSION
The Little Man Computer (LMC) is a computer simulator that simulates the fundamental
functions of a modern computer. It is built around a central processing unit with an arithmetic
logic unit and registers, a control unit with an instruction register and programme counter, input
and output mechanisms, and memory for data and instructions. The LMC is built on the idea of a
small man (in a small room or within a computer) working as the CPU's control unit.[3] The
LMC that we programmed in this study assignment is written as Assembly Language. The
computer has ways to acquire data from the user and ways to give the user the results of any
processing as outputs. Modern computers are extremely complicated things, but we can work
with a simplified version of one to learn a lot about how they work while keeping the intricacies
simple to deal with.
8
5.0 CONCLUSION
According to our understanding, we conclude that the LMC simulation is closely related to the
computer internal system where it can be understood as a Lite version of a modem computer
where it contains all of the basic features. It can be difficult to write an LMC programme
assembly language code because the instruction set is so minimal, we frequently have to do what
appears to be a basic activity in an even simpler manner. The way we presented our assembly
language code is by solving the operation by part.
6.0 REFERENCE
[1] Concept of Execution, Exam radar, 2021
Computer Organization and Architecture - Concept of Program Execution - EXAMRADAR
[2] Program execution, Geeks for geeks, May 19, 2019
Program Execution in the CPU - GeeksforGeeks
[3] Little man computer, Teach with ICT, 2020
Little Man Computer - teachwithict.com
[4] LMC Tutorial, Vivax solution, 2021
Little Man Computer - LMC- Tutorial: examples in multiplication, iteration, bit shift | Vivax
Solutions
[5] Little man computer tutorial 1, Random tutorial, Oct 3, 2015
Little Man Computer Tutorial - 1 - Intro, Basics and Adding/Subtracting - YouTube
9
Download