Instruction Sets Flashcards
Week 5 -10 (26 cards)
what is instruction set architecture
the structure of a computer that a machine language programmer (or a compiler) must understand to write a correct (timing independent) program for that machine
what does the ISA define
- operations that the CPU can execute
- data transfer mechanism + how to access data
- control mechansim (branch, jump, etc.)
- ‘contract’ between programmer/compiler & hardware
what are the elements of an instruction
- opcode - do this
- source operand reference - from this
- result operand reference - put the answer here
- next instruction reference - when you have done that, do this
C= A + B under stack ISA
push A
push B
add pop C
pros of stack ISA
- compact code
- low hardware requirements
- easy to write a simpler compiler
C = A + B under accumulator ISA
load A
add B
store C
C = A + B under register (register-memory) ISA
load R1, A
add R2, B
store C, R1
C = A + B under register (load-store) ISA
load R1, A
load R2, B
add R3, R1, R2
store C, R3
pros of register ISA
- GPR faster than main memory - values available immediately
- convenient for program variables
- compiler assigns variables to registers
- more compact code as small fields specify registers
cons of register ISA
- need to save & restore during function calls
- field size
- compiler must manage
- limited number
name the 6 memory addressing modes
- direct
- register indirect
- memory indirect
- displaced or based
- indexed
- auto inc/decrement
what is register indirect addressing
use the content stored at R1 as the address
what is memory indirect addressing
use the value at mem[1001] as address
what is displaced or based addressing
- use 20 + (R1) as address
what is auto inc/decrement addressing
use (R1) as address, add inc. or dec. to R1
what makes a good ISA
- ease of implementation
- ease of programming
- future compatability
what are expanding opcodes
- a compromise between a bigger set of opcodes and the desire to make opcodes short
- short opcodce= ^ operand
- v operand = ^ opcode space
how many bits does 15 instructions with 3 addresses account for
15 x 2^4 x 2^4 x 2^4 = 15 x 2^12 bits
how many bits does 14 instructions with 2 addresses account for
14 x 2^4 x 2^4 = 14 x 2^8 bits
how many bits does 3 instructions with 2 3-bit operands account for
3 x 2^3 x 2^3 = 3 x 2^6 bits
how many bits does 2 instructions with 1 4-bit operand account for
2 x 2^4 bits
define RISC
Reduced Instruction Set Computer
- simple operations
- simple data movements - 1 address mode
- simple instruction encoding - all instructions encoded in the same number of bits
- less complex (powerful) instructions
- shorter instructions
- ^ instructions per program
- faster fetch/execution of instructions
- compilers do the hardwork
define CISC
Complex Instruction Set Computer
- more complex (powerful) instructions
- more registers - inter-register operations are quicker
- fewer instructions per program
- variable length ISA
- ALU operations can be register-register & register-memory
- multiple memory accessing modes
- simple compilers
- code compactness
types of interrupts
- program, - overlow, division by zero, etc
- timer - mark the passage of time, etc
- I/O - peripherals & other devices that need attention
- hardware failure - power failure or memory parity error