1.1.1 structure and function of processor Flashcards
contains 1.1.1 and assembly code + addressing modes from 1.2 (SLR07)
Why was assembly language developed?
- allow humans to input instructions easily, without having to remember long strings of 1’s and 0’s.
- allows programmer to write machine code using a set of mnemonics that represent binary equivalent in machine code
What are Mnemonics?
- Simplified instructions, used in assembly language, to easily write instructions.
Give examples of some mnemonics
- ADD, SUB, STA (store), LDA(load), BRA (branch always), BRZ(branch if zero), BRP(branch if positive), INP, OUT, HLT (end), DAT(data location), AVG.
what does HLT do?
- Ends the program
what does ADD do?
- Adds contents stored in specified memory location (uses operand) to value held in accumulator
what does SUB do?
- Subtracts contents stored in specified memory location using operand from value held in accumulator
what does BRA do?
- Always branches to address specified by operand. Unconditional branch
what does BRZ do?
Branches to address specified by operand if value in accumulator = zero. Conditional branch
what does BRP do?
- branches to address specified by operand if value in accumulator is 0 or positive. A conditional branch
what does STA do?
- Copies value held in accumulator to be stored in memory location specified by operand
what does LDA do?
Loads/copies value from specified memory location given by operand into accumulator
what does INP do?
Takes an input value from input area and stores into accumulator (opcode is 9 and operand is 01)
what does OUT do?
- Displays value held in accumulator in output area (opcode is 9 and operand is 02)
what does DAT do?
- indicate a location that contains data and an optional value for instruction (initialisation: it creates a variable identifier that can be used instead of an address in instructions).
where do you put data definitions for LMC
- Data definitions go at bottom of program
What will this do?
num1 DAT 100
- it will map a memory location to identifier num1 and set its initial value as 100.
in machine code, there are different types of addressing modes specified by what?
- opcode
the addressing mode specifies the way in which _________ will be interpreted.
- operand
what does direct addressing mode do
- value in operand is referencing address in memory where the required value is located
what does immediate addressing mode do
- data to be used is the actual value of the operand.
- often denoted with # in assembly language.
what does indirect addressing mode do
- value in operand is a reference to memory location that contains address in memory where required value is located
why is indirect addressing so useful
- large address ranges can be used to reference data and instructions
what does indexed addressing mode do
- index register = dedicated registers in the CPU.
- Indexed referencing makes use of this register to access array with data in contiguous memory locations.
if operand is 1010 and index register stored value 0011, what would happen using indexed addressing if instruction is ADD 10
- operand specifies that memory location to be used is 10. it finds value in location and adds value in index register to that value (10+3=13)
- therefore go to memory address 13 to access data to add.
Benefits of Mnemonics
- Simplified –> Easier for a developer to remember compared to binary instructions.
explain why LMC instructions BRA / BRP would cause contents of PC to change
- BRA and BRP are branch instructions, equivalent to IF, FOR, WHILE in high level language.
- they change flow of program so next instruction not always executed
what is the purpose of the Little Man Computer
- it’s a simulator of the Von Neumann architecture and uses the idea of a little man running around between ACC and main memory with the pieces of data required to perform operations such as calculations etc
how many memory allocations does it have
100 ( they are numbered 0 to 99)
how can you ensure an instruction isn’t overwritten when program writes to main memory (where program is loaded)?
- use named locations (using DAT). Or, use high value locations in case you need to add more instructions as you test and debug code.
What is an Opcode?
- Part of an instruction that specifies which operation the processor should perform. i.e what to do with data
What is Operand?
- contains a value/set of values, relevant to the opcode. it can be an actual piece of data, or a reference to memory location of the data for the opcode to act on. (what to do it to
What does operand store if opcode is a STORE instruction
- e.g when the opcode is a ‘store’ instruction, the operand contains the memory location where the data should be stored.
Components in a CPU:
- CU
-Clock
-Buses
-ALU
-Registers
-Cache
What is CPU
- internal hardware component of computer, responsible for executing the instructions of programs.
- The processor is made up of several important components, each of which have a specific role.
what does the cpu contain that creates logic circuits to process data, do instructions and control computer components
- transistors
What is Control Unit
-Coordinates activities of a CPU, directing flow of data in, within + out of cpu i.e organise sequence of micro operations needed to be performed to execute. (manages fde cycle)
-responsible for sending signals to direct flow of data between cpu + other devices and control signals on control bus to enable data to be read (loaded) from and written (stored) to the main memory
-accepts, decodes instruction cpu will execute to determine what needs to be done + stores resulting data to memory/registers
-directing operations of all other components of processor
-determine operation ALU will carry out at each instance
what is meant by decoding?
- Decoding means that opcode and operand of an instruction are analysed to determine what needs to be done to execute
what does CU use extensively?
- clock and status registers
What is the ALU?
- performs arithmetic, logical and bitwise shift operations.
what is ALU connected to and why
- set of general-purpose registers used to keep results of the intermediate calculations that are produced as part of a larger one
What is a clock?
-emits signal (pulse) that continuously oscillates between a low (0) and a high (1) state –> synchronise operations of the processor components.
what is clock period?
- time taken between two sequential rising edges (0 to 1) and it corresponds to 1 clock cycle
what is clock speed?
- number of clock cycles that can be completed in one second, measured in Hz.
what is clock speed the inverse of
- clock period, i.e. clock frequency=1/clock period.
What are registers?
- locations of computer memory within the processor that provide extremely fast access.
What are dedicated/special-purpose registers?
- processor-based registers used for specific purpose.
why are the registers used in FDE cycle special purpose registers
- as each one of them has specific role to play in each phase of FDE cycle.
What is the function of the program counter?
- Holds address of next instruction to be fetched/executed by cpu.