William Stallings Computer Organization and Architecture: Instruction Sets: Characteristics and Functions
William Stallings Computer Organization and Architecture: Instruction Sets: Characteristics and Functions
William Stallings Computer Organization and Architecture: Instruction Sets: Characteristics and Functions
Elements of an Instruction
Operation code (Op code)
Do this
Instruction Representation
In machine code each instruction has a unique bit pattern For human consumption (well, programmers anyway) a symbolic representation is used
e.g. ADD, SUB, LOAD
Instruction Types
Data processing Data storage (main memory) Data movement (I/O) Program flow control
Fewer addresses
Less complex (powerful?) instructions More instructions per program Faster fetch/execution of instructions
Types of Operand
Addresses Numbers
Integer/floating point
Characters
ASCII etc.
Logical Data
Bits or flags
(Aside: Is there any difference between numbers and characters? Ask a C programmer!)
Types of Operation
Data Transfer Arithmetic Logical Conversion I/O System Control Transfer of Control
Data Transfer
Specify
Source Destination Amount of data
Arithmetic
Add, Subtract, Multiply, Divide Signed Integer Floating point ? May include
Increment (a++) Decrement (a--) Negate (-a)
Logical
Bitwise operations AND, OR, NOT
Conversion
E.g. Binary to Decimal
Input/Output
May be specific instructions May be done using data movement instructions (memory mapped) May be done by a separate controller (DMA)
Systems Control
Privileged instructions CPU needs to be in specific state
Ring 0 on 80386+ Kernel mode
Transfer of Control
Branch
e.g. branch to x if result is zero
Skip
e.g. increment and skip if zero ISZ Register1 Branch xxxx ADD A
Subroutine call
c.f. interrupt call
Foreground Reading
Pentium and PowerPC operation types Stallings p338 et. Seq.
StandardWhat Standard?
Pentium (80x86), VAX are little-endian IBM 370, Moterola 680x0 (Mac), and most RISC are big-endian Internet is big-endian
Makes writing Internet programs on PC more awkward! WinSock provides htoi and itoh (Host to Internet & Internet to Host) functions to convert