Что такое findslide.org?

FindSlide.org - это сайт презентаций, докладов, шаблонов в формате PowerPoint.


Для правообладателей

Обратная связь

Email: Нажмите что бы посмотреть 

Яндекс.Метрика

Презентация на тему Assembly language

Содержание

Overview and AimsLMC is a computer simulator… understanding how a computer workTo program the LMC, must understand:Memory addressesInstructionsFetch-execute cyclePractical exercisesWhat we can learn from LMC
CAS London CPD Day 2016Little Man ComputerTeaching London ComputingWilliam Marsh School of Overview and AimsLMC is a computer simulator… understanding how a computer workTo What is in a Computer?MemoryCPUI/O Simple ComputerProcessorCPUMemoryDataProgram instructionsI/OKeyboardDisplayDiskMemoryKeyboard I/FCPUDisk I/FDisplay I/Fdatadataaddresses MemoryEach locationhas an addresshold a valueTwo interfacesaddress – which location?data – what value? 	addressdata Quiz – What is the Memory? Registers (or Accumulators)Control linesA storage area inside the CPUVERY FASTUsed for arguments MemoryI/OI/OCPUWrite a program here LMC CPU StructureVisible registers shown in redAccumulatorsData for calculationDataWord to/from memoryPCAddress of InstructionsThe primitive language of a computer InstructionsInstructionOpCodeAddress InstructionsOpcode: 1decimaldigitAddress:two decimaldigits – xxBinaryversusdecimalOpCodeAddress Add and Subtract InstructionADD	AddressSUB	AddressOne address and accumulator (ACC)Value at address combined with Load and Store InstructionLDA	AddressSTA	AddressMove data between memory and accumulator (ACC)Load: ACC ß Memory[Address]Store: Memory[Address] ß ACC Input and OutputInput: ACC ß	input valueoutput: output area ß ACCIt is more Branch InstructionsChanges program counterMay depend on accumulator (ACC) valueBR: PC ß AddressBRZ: Assembly CodeNumbersMemory holds numbersOpcode: 0 to 9Address: 00 to 99Instructions in textInstruction LMC Example Simple Programx = y + zLDA yADD zSTA x HLTxy z Running the Simple ProgramPCIRLDALDA yADD zSTA x HLTxy z179ACC	17 Running the Simple ProgramPCIRADDLDA yADD zSTA x HLTxy z179ACC	2167 Running the Simple ProgramPCACCIR	STALDA yADD zSTA x HLTxy z2626179 Running the Simple ProgramPCACCIR	HLTLDA yADD zSTA x HLTxy z2626179 Practice ExercisesTry the first three exercises on the practical sheet Fetch-Execute CycleHow the Computer Processes Instructions Fetch-ExecuteEach instruction cycle consists on two subcyclesFetch cycleLoad the next instruction (Opcode Fetch InstructionProgramcounter to address registerRead memory at addressMemory data to ‘Data’‘Data’ toinstruction registerAdvanceprogram counterProgramCounterAddressInstructionDataAccumulatorsmemoryaddressdataControl UnitALU1234ALUControlUnit Execute InstructionDecode instructionAddress from instruction to ‘address register’Access memoryData from memory to What We Can Learn from LMCHow programming language workWhat a compiler doesWhy we need an OS Understanding Variables and AssignmentWhat is a variable?What is on the left hand side of:x	=	x	+	1 Understanding Variables and AssignmentWhat is a variable?What is on the left hand side of:A[x+1] =	42 Understanding If and LoopsCalculate the address of the next instructionif x	>	42:large =	large +	1 else:small =	small +	1 CompilerCompiler translates high level program to lowCompiled languagesStatically typedClose to machineExamples: C, Why We Need An OSLMCOnly one programProgram at fixed place in memoryNoDiskScreen•	…Real Summary of CPU ArchitectureMemory contains data and programProgram counter: address of next Project: Writing an LMC Interpreter Write a Simple LMC Emulatordef	fetch(memory): global pc, mar mar =	pcpc =	pc +	1readMem(memory)def	readMem(memory):
Слайды презентации

Слайд 2
Overview and Aims
LMC is a computer simulator
… understanding

Overview and AimsLMC is a computer simulator… understanding how a computer

how a computer work
To program the LMC, must understand:
Memory

addresses
Instructions
Fetch-execute cycle
Practical exercises
What we can learn from LMC

Слайд 3

What is in a Computer?
Memory
CPU
I/O

What is in a Computer?MemoryCPUI/O

Слайд 4
Simple Computer
Processor
CPU
Memory
Data
Program instructions
I/O
Keyboard
Display
Disk

Memory




Keyboard I/F
CPU
Disk I/F
Display I/F




















data
data
addresses


Simple ComputerProcessorCPUMemoryDataProgram instructionsI/OKeyboardDisplayDiskMemoryKeyboard I/FCPUDisk I/FDisplay I/Fdatadataaddresses

Слайд 5


Memory
Each location
has an address
hold a value

Two interfaces
address –

MemoryEach locationhas an addresshold a valueTwo interfacesaddress – which location?data – what value? 	addressdata

which location?
data – what value?



































address



data


Слайд 6

Quiz – What is the Memory?

Quiz – What is the Memory?

Слайд 7
Registers (or Accumulators)

Control lines




A storage area inside the

Registers (or Accumulators)Control linesA storage area inside the CPUVERY FASTUsed for

CPU
VERY FAST
Used for arguments and results to one calculation

step
data

Register – 1 memory location





Read register

Write to register


Слайд 8
Memory
I/O
I/O
CPU
Write a program here

MemoryI/OI/OCPUWrite a program here

Слайд 9

LMC CPU Structure

Visible registers shown in red
Accumulators
Data for

LMC CPU StructureVisible registers shown in redAccumulatorsData for calculationDataWord to/from memoryPCAddress

calculation
Data
Word to/from memory
PC
Address of next instruction
Instruction
Address
For memory access




Program Counter

Mem

Address

Instruction

MEM Data



ALU

Accumulator



Control

Unit


m

e

m

o

r

y










address

data



Control Unit

ALU
























Слайд 10

Instructions
The primitive language of a computer

InstructionsThe primitive language of a computer

Слайд 11 Instructions
Instruction

OpCode

Address

InstructionsInstructionOpCodeAddress

Слайд 12 Instructions
Opcode: 1
decimal
digit
Address:
two decimal
digits – xx
Binary
versus
decimal

OpCode

Address

InstructionsOpcode: 1decimaldigitAddress:two decimaldigits – xxBinaryversusdecimalOpCodeAddress

Слайд 13
Add and Subtract Instruction




ADD Address
SUB Address

One address and accumulator (ACC)
Value

Add and Subtract InstructionADD	AddressSUB	AddressOne address and accumulator (ACC)Value at address combined

at address combined with accumulator value
Accumulator changed

Add: ACC ß

ACC + Memory[Address]
Subtract: ACC ß ACC – Memory[Address]

Слайд 14
Load and Store Instruction




LDA Address
STA Address

Move data between memory and

Load and Store InstructionLDA	AddressSTA	AddressMove data between memory and accumulator (ACC)Load: ACC ß Memory[Address]Store: Memory[Address] ß ACC

accumulator (ACC)

Load: ACC ß Memory[Address]
Store: Memory[Address] ß ACC


Слайд 15
Input and Output
Input: ACC ß input value
output: output area

Input and OutputInput: ACC ß	input valueoutput: output area ß ACCIt is

ß ACC

It is more usual for I/O to use

special memory addresses


INP


1 (Address)


OUT


2 (Address)


Слайд 16
Branch Instructions
Changes program counter
May depend on accumulator (ACC)

Branch InstructionsChanges program counterMay depend on accumulator (ACC) valueBR: PC ß

value

BR: PC ß Address
BRZ: if ACC == 0 then

PC ß Address
BRP: if ACC > 0 then PC ß Address


BR


Address


Слайд 17

Assembly Code
Numbers
Memory holds numbers
Opcode: 0 to 9
Address: 00

Assembly CodeNumbersMemory holds numbersOpcode: 0 to 9Address: 00 to 99Instructions in

to 99


Instructions in text
Instruction name: STA, LDA
Address: name using

DAT
Line

Location


Слайд 18

LMC Example

LMC Example

Слайд 19
Simple Program
x = y + z





LDA y
ADD z
STA

Simple Programx = y + zLDA yADD zSTA x HLTxy z

x HLT


x
y z














Слайд 20
Running the Simple Program


PC
IR


LDA





LDA y
ADD z
STA x HLT


x
y

Running the Simple ProgramPCIRLDALDA yADD zSTA x HLTxy z179ACC	17

z
17
9















ACC 17


Слайд 21
Running the Simple Program


PC
IR


ADD





LDA y
ADD z
STA x HLT


x
y

Running the Simple ProgramPCIRADDLDA yADD zSTA x HLTxy z179ACC	2167

z
17
9















ACC 2167


Слайд 22
Running the Simple Program



PC
ACC


IR STA





LDA y
ADD z
STA x HLT


x
y

Running the Simple ProgramPCACCIR	STALDA yADD zSTA x HLTxy z2626179

z















26
26
17
9


Слайд 23
Running the Simple Program



PC
ACC


IR HLT





LDA y
ADD z
STA x HLT


x
y

Running the Simple ProgramPCACCIR	HLTLDA yADD zSTA x HLTxy z2626179

z













26
26
17
9


Слайд 24
Practice Exercises
Try the first three exercises on the

Practice ExercisesTry the first three exercises on the practical sheet

practical sheet


Слайд 25

Fetch-Execute Cycle
How the Computer Processes Instructions

Fetch-Execute CycleHow the Computer Processes Instructions

Слайд 26
Fetch-Execute
Each instruction cycle consists on two subcycles
Fetch cycle
Load

Fetch-ExecuteEach instruction cycle consists on two subcyclesFetch cycleLoad the next instruction

the next instruction (Opcode + address)
Use Program Counter
Execute cycle
Control

unit interprets the opcode
... an operation to be executed on the data by the ALU


Start


Decode & execute instruction














Fetch next instruction


Halt


Слайд 27

Fetch Instruction
Program
counter to address register
Read memory at address
Memory

Fetch InstructionProgramcounter to address registerRead memory at addressMemory data to ‘Data’‘Data’ toinstruction registerAdvanceprogram counterProgramCounterAddressInstructionDataAccumulatorsmemoryaddressdataControl UnitALU1234ALUControlUnit

data to ‘Data’
‘Data’ to
instruction register
Advance
program counter



Program
Counter

Address
Instruction
Data

Accumulators



m
e
m
o
r
y









address
data


Control Unit
ALU

























1




2



3



4


ALU



Control
Unit


Слайд 28

Execute Instruction
Decode instruction
Address from instruction to ‘address register’
Access

Execute InstructionDecode instructionAddress from instruction to ‘address register’Access memoryData from memory

memory
Data from memory to ‘data register’
Add (e.g.) data and

accumulator value
Update
accumulator




Program Counter


Address

Instruction

Data


Accumulators




m

e

m

o

r

y










address

data



Control Unit

ALU


























1




2




3





4





5




5




6




ALU




Control

Unit


Слайд 29

What We Can Learn from LMC
How programming language

What We Can Learn from LMCHow programming language workWhat a compiler doesWhy we need an OS

work
What a compiler does
Why we need an OS


Слайд 30
Understanding Variables and Assignment
What is a variable?
What is

Understanding Variables and AssignmentWhat is a variable?What is on the left hand side of:x	=	x	+	1

on the left hand side of:

x = x + 1











Слайд 31
Understanding Variables and Assignment
What is a variable?
What is

Understanding Variables and AssignmentWhat is a variable?What is on the left hand side of:A[x+1] =	42

on the left hand side of:

A[x+1] = 42










Слайд 32
Understanding If and Loops
Calculate the address of the

Understanding If and LoopsCalculate the address of the next instructionif x	>	42:large =	large +	1 else:small =	small +	1

next instruction

if x > 42:
large = large + 1 else:
small = small + 1
















Слайд 33
Compiler
Compiler translates high level program to low
Compiled languages
Statically

CompilerCompiler translates high level program to lowCompiled languagesStatically typedClose to machineExamples:

typed
Close to machine
Examples: C, C++, (Java)
Compiler for each CPU




level
source

code
x = y + z

assembly code

object code


Слайд 34
Why We Need An OS
LMC
Only one program
Program at

Why We Need An OSLMCOnly one programProgram at fixed place in

fixed place in memory
No
Disk
Screen
• …
Real Computer
Many programs at once
Program goes

anywhere in memory
Complex I/O

Слайд 35
Summary of CPU Architecture
Memory contains data and program
Program

Summary of CPU ArchitectureMemory contains data and programProgram counter: address of

counter: address of next instruction
Instructions represented in binary
Each instruction

has an ‘opcode’
Instructions contain addresses
Addresses used to access data
Computer does ‘fetch-execute’
‘Execute’ depends on opcode
Computer can be built from < 10,000 electronic switches (transistors)

Слайд 36

Project: Writing an LMC Interpreter

Project: Writing an LMC Interpreter

  • Имя файла: assembly-language.pptx
  • Количество просмотров: 123
  • Количество скачиваний: 0