Professional Documents
Culture Documents
COMP 2
Revision Notes
Physicalcomponentsofthecomputer
Sequencesofinstructionsorprogramswhichrunonthecomputer
Disadvantages
Itistheonlylanguageacomputercanactually
understand.Allotherlanguagesmustbetranslated
intomachinecodetorun.Machinecodeneedsno
translation.
Itsprettymuchimpossibleforhumanbeingsto
read.
Disadvantages
Simplerforhumanstounderstand.Asimpleoneto
onetranslationofmachinecodeinstructionsallows
directmanipulationofthecomputer.
Needstobetranslated(assembled),inordertorun.
Thisisntdifficult,butitsanextrastep.
Becauseitsaonetoonetranslationofmachine
code,itsverylongwindedandmachineratherthan
problemfocused.
Examples
Advantages
Disadvantages
Examples
Advantages
Disadvantages
Assembler
2ndGenAssemblyLanguage
Compilerallatonce
Interpreterlineatatime
Assembler
Process
Use
Reason
Compiler
Process
3rdand4thGen
ImperativeandDeclarative
languages
TranslatessecondgenerationAssemblylanguageinto
machinecodeinaonetooneoperation
RunninganAssemblyLanguageprogram
RequiretorunAssemblyLanguage.Therearenoother
optionsforAssemblyLanguage
Translatesthird/fourthgenerationlanguagesintoMachine
Codeinaonetomanyrelationship.Checksthesyntaxof
theprogram,thentranslatesallofthecodeinonegoand
producesanoutputfilewhichcanthenberundirectly
withoutthecompilerbeingpresent.
Use
Reason
Interpreter
Process
Use
Reason
Wheretestedsoftwareistobeshippedouttoauser,
wheretheprogramneedstobeasfastaspossibleorneeds
toberunwithoutadditionalprogramsupport.Cannotbe
easilychanged.
Speedofexecution,simplicityofproduct,cantbechanged
Translatesthird/fourthgenerationlanguagesintoMachine
Codeonelineatatime.Checksthesyntaxofeachlineand
thentranslatesintomachinecodeandexecutesthe
programonthecomputer.
Softwareunderdevelopment,softwarerunincontrolled
environment.
Softwaredebugging,linebylineanalysis.
Address Bus
Identifies
locations
Most arrows are
double headed
Data Bus
Carriesdatato
andfromthe
processor
Control Bus
Carriescontrol
signals,
controls
devices
Processor
Buses
Main
Memory
Thesethree
componentsare
knownastheCentral
ProcessingUnit,or
CPU
AnythingnotpartoftheCPUiscalledaPeripheral.Peripheralsareusually
consideredexternaldevices.AnexampleofaperipheralisSecondarystorage,the
Keyboard,theMonitor.
SecondarystorageisstoragethatisnotMainMemory.Anexamplewouldbethe
HardDisk.
Mainmemoryisaddressable,inotherwords,eachlocationinmemoryhasaunique
codeitsaddress.Toreadorwritetomemory,theprocessorwritestheaddressto
theaddressbus,thenusesthecontrolbustoindicateareadorwriteoperation.The
dataistransferredtoorfromtheselectedaddressoverthedatabus.Allthreebuses
worktogethertogethertheyarecalledtheSystemBus.
General purpose
and dedicated
registers
Fetchesprograminstructionsfrommemory,decodesthem
andthenexecutesthemoneatatime.
Performsarithmeticandlogicaloperationsondata(for
example,adding,ANDing)
Eachpulseisthesignalforanothercycleofoperations.The
clockcoordinatesalldevicesinacomputer,makingsurethey
allacttogether.
Fast,temporarystoragelocationsinsidetheprocessor.
Shoulddirectlyincreasetheperformance
ofacomputerbyspeedingupthecycle,
thetimeittakestheprocessorto
completeaninstruction.
Thesystembusisasignificant
bottleneck.Largenumbersorcomplex
instructionsmustbesplitintosmaller
partstofitacrossthebus.Wideningthe
busmeanslesssplittingandbetter
performance.
Wordlengthaffectsthesizeofthe
registersandreducestheneedtosplit
largenumbersorcomplexoperations
acrossmultipleregisters,thusimproving
performance.
+1
Program Counter
Main
Memory
Step2:ProgramCounter
incrementedby1
Step4:ContentofMBR
copiedtoCIR
Step3:Contentsofmemory
addressedbyMARcopiedtoMBR
ALU
Step5:ContentofCIR
decodedandexecuted
Note: Its essential to remember the name and Mnemonic of the four
special purpose registers here. PC, MAR, MBR, CIR.
Machine code instructions are often represented in Hexadecimal
Machinecodeinstructionsarestoredinmainmemory,fromwhichtheyarefetched
andexecuted.Theseinstructionscanbereplacedbyothersatanytime.
Logic Gates
AND
A
0
0
1
1
B
0
1
0
1
Q
0
0
0
1
A.B
Outputisononlywhen
bothinputsareon,
otherwiseitsoff.
OR
NOT
XOR
NAND
NOR
XNOR
A
0
0
1
1
A
0
1
B
0
1
0
1
Q
1
0
Q
0
1
1
1
A
0
0
1
1
B
0
1
0
1
Q
0
1
1
0
A
0
0
1
1
B
0
1
0
1
Q
1
1
1
0
A
0
0
1
1
B
0
1
0
1
Q
1
0
0
0
A
0
0
1
1
B
0
1
0
1
Q
1
0
0
1
A+B
A
A B
Outputisonifeitherofthe
inputsison,orboth.
Outputisoniftheinputis
off,andoffiftheinputis
on.
Outputisonifoneinputis
onandtheotherisoff,
otherwisetheoutputis
off.
A.B
ThereverseofanAND
gate,outputisonunless
bothinputsareon,in
whichcaseitisoff.
A+B
ThereverseofanORgate,
outputisononlyifboth
inputsareoff.Ifanyinput
ison,theoutputisoff.
A B
ThereverseofanXOR,
outputisononlyifboth
inputsarethesame.If
theyaredifferent,output
isoff.
( X Y ) X.Y
X.X=X
X. X 0
1+A = 1
0+A=0
0.A=A
1.A=A
X.Y X Y