






























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!































Day 4
The complete collection of instructions thatare understood by a CPU Machine Code Binary Usually represented by assembly codes
In machine code each instruction has aunique bit pattern For human consumption (well, programmersanyway) a symbolic representation is used โ e.g. ADD, SUB, LOAD Operands can also be represented in thisway โ ADD A,B
3 addresses โ Operand 1, Operand 2, Result โ a = b + c; โ May be a forth - next instruction (usually implicit) โ Not common โ Needs very long words to hold everything
Format operation op1,op2,op (op1,op2, op3 may be register or memory) Example โ ADD R1, R2, R (R1 = R2 +R3) โ ADD A, B, C (variable A= mem. B +C) (The contents of R1 and A are lost whereas contents of R2, R3, B and C are still there)
Format operation op1,op2 (op1,op2 may be register or memory) Example โ ADD R1, R (R1 = R1 +R2) โ ADD A, B (variable A= A+ mem. B) (The contents of R1 and A are lost whereas contents of R2 and B are still there)
1 address โ Implicit second address โ Usually a register (accumulator) โ Common on early machines
Format operation op1, op2 (op1 is memory and op2 must be register) Example โ ADD G,R (R1 = mem. G + R1) This is because register addressing needs a smaller number of bitsthan those needed by memory bits
It uses stack for operation Operand is (implicitly) on top of stack Format operation Example โ PUSH โ POP โ ADD Question:Explain Stack operationusing different examples?
More addresses โ More complex (powerful?) instructions โ More registers
Operation repertoire โ How many ops? โ What can they do? โ How complex are they? Data types Instruction formats โ Length of op code field โ Number of addresses
Addresses Numbers โ Integer/floating point Characters โ ASCII etc. Logical Data โ Bits or flags (Aside: Is there any difference between numbers andcharacters? Ask a C programmer!)
8 bit Byte 16 bit word 32 bit double word 64 bit quad word 128 bit double quad word Addressing is by 8 bit unit Words do not need to align at even-numbered address Data accessed across 32 bit bus in units ofdouble word read at addresses divisible by 4 Little endian