LMC Flashcards
(179 cards)
components of LMC
- mailboxes: 3 digits –> 100 is max
- counter: 2 buttons- 1 increments and other resets to 00
- calculator: 3 digits: 0-9, +, - buttons, flag for -ve results
- input/output trays: input by user, output sent to user
routine in LMC
- looks at counter for mailbox number
- increments counter by 1
- goes to mailbox + reads 3 digits
- completes action indicated by digits
- restarts…
how do instructions work
3 digits: first is opcode (instructions), last digits are operand (mailbox number)
opcode 1
add: go to specified mailbox, read 3 dig number at address, go to calculator and add number to that on calculator
opcode 2
subtract: go to specified mailbox, read 3 dig number at address, go to calculator and subtract number from that on calculator
opcode 3
store: go to calculator, read 3 dig value, go to specified mailbox and store value there (overriding currently stored value)
opcode 5
load: go to mailbox specified in instruction, read in the 3 dig number, and enter into calculator (overriding current value)
opcode 6
branch: set program counter to the 2 address specified in instruction, and start fetch of instruction
opcode 7
branch on zero: check calculator, if value = 0, set program counter to address specified in instruction and start fetch else continue with next instruction as normal
opcode 8
branch on positive: check calculator, if +ve (inc 0), set program counter to address specified in instruction and start fetch else continue with next instruction as normal
instruction 901
input: go to IN tray, read 3 dig number there, go to calculator and enter value there. only read one input slip, then remove it, any others are used for future visits
instruction 902
output: go to calculator, read 3 digit value there and leave slip with value on OUT tray
opcode 0
break
fetch
find the instruction to execute: reads program counter, goes to mailbox at that address in instruction, reads 3 dig value
execute e.g. store
target address remembered. 3 digits in calculator read, 3 digits written in mailbox at target address. program counter incremented
von neumann
- same memory for instructions and data
- memory is addressed linearly: there is a number for every mailbox
- memory addressed by location: contents is irrelevant
- instructions executed sequentially unless branch or reset
harvard
-separate memory for instructions and data:
-avoids potential for malware and bugs from self-modifying code
-simpler to read and analyse code
-quicker to execute as can access instructions and data simultaneously
modern processors have split cache so best of harvard and VN
five major components of a CPU
- memory (RAM)
- registers
- ALU
- control unit
- buses
memory (RAM)
mailboxes
registers
special memory locations that can be accessed very fast and are manipulated directly by the CU 1-128 bits: includes program counter (PC), instruction register (IR), accumulator
have a defined purpose and wired to perform that purpose
holds binary values temporarily for storage, manipulation, calculations
ALU
calculator
buses
bundles of tiny wires- electrical conductors i.e. lines carrying signals- that carry data between components: address, data, control, power
- -carries data between different points on CPU
- carries data between CPU and main memory/computer peripherals*
control unit
responsible for directing flow of data and instructions within the CPU- compromised of multiplexor and decoder
accumulator
register part of the ALU. holds data + interim and final results of calculations + data to be transferred between different memory locations + (I/O+memory)