Pentium and PowerPC Data Types

Report
Chapter 10
Instruction Sets:
Characteristics and Functions
What is an Instruction Set?
• The complete collection of
instructions that are understood by a
CPU
• Machine Code
• Binary
• Usually represented by assembly
codes
Elements of an Instruction
• Operation code (Op code)
– Do this
• Source Operand reference
– To this
• Result Operand reference
– Put the answer here
• Next Instruction Reference
– When you have done that, do this...
Where have all the
Operands Gone?
• Long time passing….
• (If you don’t understand, you’re too
young!)
• Main memory (or virtual memory or
cache)
• CPU register
• I/O device
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
• Operands can also be represented in
this way
– ADD A,B
Simple Instruction Format
Instruction Types
• Data processing
– Arithmetic & Logic Instructions
• Data storage (main memory)
– Memory Instructions
• Data movement (I/O)
– I/O Instructions
• Program flow control
– Test & Branch Instructions
Number of Addresses (a)
• 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
Number of Addresses (b)
• 2 addresses
– One address doubles as operand and
result
–a=a+b
– Reduces length of instruction
– Requires some extra work
• Temporary storage to hold some results
Number of Addresses (c)
• 1 address
– Implicit second address
– Usually a register (accumulator)
– Common on early machines
Number of Addresses (d)
• 0 (zero) addresses
– All addresses implicit
– Uses a stack
– e.g. push a
–
push b
–
add
–
pop c
–c=a+b
How Many Addresses
• More addresses
– More complex (powerful?) instructions
– More registers
• Inter-register operations are quicker
– Fewer instructions per program
• Fewer addresses
– Less complex (powerful?) instructions
– More instructions per program
– Faster fetch/execution of instructions
Design Decisions (1)
• 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
Design Decisions (2)
• Registers
– Number of CPU registers available
– Which operations can be performed on
which registers?
• Addressing modes (later…)
• RISC v CISC
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!)
Addresses
• Addresses are a form of data.
• Sometimes, calculations must be performed on the
operand reference in an instruction to determine
the memory address.
• The various addressing modes that are defined in
a given instruction set architecture define how
machine language instructions in that architecture
identify the operand (or operands) of each
instruction.
• Addresses can be considered as unsigned
integers.
Addressing Modes
• Different computer architectures vary greatly as to
the number of addressing modes they provide.
• When there are only a few addressing modes, the
particular addressing mode required is usually
encoded within the instruction code.
• Examples of common addressing modes:






Immediate
Indexed
Memory deferred
Auto-increment
Scaled
Displacement
68HC11 Addressing Modes
68C11 Addressing Modes:
Immediate
Indexed
Inherent
Relative
Direct
Extended
6502 Addressing Modes
The 6502 processor provides several ways in which memory
locations can be addressed. Some instructions support several
different modes while others may only support one. In addition
the two index registers can not always be used interchangeably.
This makes the 6502 trickier to program well.
Numbers
• All machine languages include numeric data
types.
• There is a limited latter between ordinary math
numbers and stored computer numbers.
• There is a limit on the number of numbers
represented on a machine and a limit on the
precision of floating-point numbers.
• The programmer faces the consequences of
rounding, overflow, and underflow.
Numerical Data
 Three types of numerical data:
 Integer or fixed point
 Floating point
 Decimal
 There is a necessity to convert from decimal to binary on
input and vice versa on output.
 Packed decimal is often referred as BCD code. Each decimal
is represented by a 4-bit code.
 Ex:
 0=0000
 1=0001
 5=0101
 8=1000
Inefficiency
• This coding is sometimes rather inefficient
because only 10 of 16 possible 4-bit values
are used. To form numbers, 4-bit codes are
put together usually in multiples of 8 bits.
• Ex: 246 = 0000 0010 0100 0110
• Negative numbers can be represented by
including a 4-bit sign digit at either the left
or right end of a string of packed decimal
digits.
Characters
 A common form of data is text or character strings.
 Many codes have been devised by which characters are
represented by a sequence of bits.
 The most common character code used today is the
American Standard Code for Information Interchange
known as ASCII also referred to as the International
Reference Alphabet (IRA).
 Each character in this code is represented by a unique 7-bit
pattern which creates 128 different characters.
 Some characters are called “control” characters which
control the printing of the characters on a page. Others are
used for communication procedures.
 IRA codes are almost always stored and transmitted using 8
bits per character. The 8th can be a parity bit (odd or even)
used for error detection.
ASCII Table
• This code conversions between 7-bit IRA and 4-bit packed
decimal representation is the same as code as BCD code which
facilitates conversions.
EBCDIC Table
•This code is used on IBM mainframes.
•It is an 8-bit code compatible with packed decimal.
•The codes 11110000 through 11111001 represent the
digits 0 through 9.
Logical Data
• Logical Data can be seen as a word or address
unit that can be considered to be an n-bit unit
consisting of n 1-bit items of data having the value
of 1 or 0.
• With this type of data, memory can be used most
efficiently for storing an array of Boolean or binary
data items.
• The “type” of a unit of data is determined by the
operation being performed on it.
Boolean Logic
Pentium and PowerPC
Data Types
Pentium Data Types
• Pentium refers to Intel's single-core x86 microprocessor
based on the P5 fifth-generation micro architecture. The
name Pentium was derived from the Greek “pente” which
means 'five‘.
• The Pentium can deal with data types of 8
(byte),16(word),32(double-word), and 64(quad-word) bits in
length.
• The least significant byte is stored in the lowest address.
• The Pentium supports an impressive array of specific data
types that are recognized and operated on by particular
instructions.
• Addressing is by 8 bit unit.
• A 32 bit double word is read at addresses divisible by 4.
Specific Data Types:
•
•
•
•
•
•
•
•
•
General - arbitrary binary contents
Integer - single binary value
Ordinal - unsigned integer
Unpacked BCD - One digit per byte
Packed BCD - 2 BCD digits per byte
Near Pointer - 32 bit offset within segment
Bit field
Byte String
Floating Point
Power PC Data Types
• PowerPC is a RISC instruction set architecture created by
the 1991 Apple–IBM–Motorola alliance, known as AIM.
Originally intended for personal computers, PowerPC CPUs
have since become popular embedded and highperformance processors.
• The PowerPC can deal with data types of 8 (byte), 16 (halfword), 32(word), and 64 (double-word) bits in length.
• The significant difference in the two processors are the fact
that PowerPC can operate on big and little-endian, while the
Pentium can only perform on little-endian. This means that
the least significant byte is stored in the lowest or highest
address.
Fixed-Point Processor Data Types
• Unsigned byte: Can be used for logical or integer arithmetic
operations.
• Unsigned half-word: As for unsigned byte, but for 16-bit
quantities.
• Signed half-word: Used for arithmetic operations.
• Unsigned word: Used for logical operations and as address
pointer.
• Signed word: Used for arithmetic operations.
• Unsigned double-word: Used as an address pointer.
• Byte String: From 0 to 128 bytes in length.
Pentium Numeric Data Formats
•
RISC: or Reduced Instruction Set Computer. is a type of
microprocessor architecture that utilizes a small, highly-optimized
set of instructions, rather than a more specialized set of instructions
often found in other types of architectures.
•
There were two stages in history for the microprocessor. One using
CISC or complex instruction set computer and the other is RISC.
•
The latter architecture uses a smaller set of instructions. A simpler
instruction set may offer the potential for higher speeds, reduced
processor size, and reduced power consumption; a more complex
one may optimize common operations, improve memory/cache
efficiency.
Endian Type
•
Endian: is the convention that two parties that wish to exchange
information will use to send and receive this information when they
need to cut the information down to pieces. In simple terms is the
byte ordering to represent some of data.
•
The most significant byte (MSB) value, which is 0x0A in our
example, is stored at the memory location with the lowest address,
the next byte value in significance, 0x0B, is stored at the following
memory location and so on. This is akin to Left-to-Right reading
order in hexadecimal.
The Data Types
• In computing, "word" is a term for the natural unit of data
used by a particular computer design. A word is simply a
fixed-sized group of bits that are handled together by the
machine. The number of bits in a word (the word size or
word length) is an important characteristic of a computer
architecture.
• The size of a word is reflected in many aspects of a
computer's structure and operation.
Types of Operation
•
•
•
•
•
•
•
Data Transfer
Arithmetic
Logical
Conversion
I/O
System Control
Transfer of Control
Data Transfer
• Specify
– Source
– Destination
– Amount of data
• May be different instructions for
different movements
– e.g. IBM 370
• Or one instruction and different
addresses
Arithmetic
•
•
•
•
Add, Subtract, Multiply, Divide
Signed Integer
Floating point ?
May include
– Increment (a++)
– Decrement (a--)
– Negate (-a)
Shift and Rotate Operations
•
•
•
•
1. Load the word into a register.
2. AND with the value 1111111100000000. This masks out the
character on the right.
3. Shift to the right eight times. This shifts the remaining character to
the right half of the register.
4. Perform I/O. The I/O module reads the lower-order 8 bits from the
data bus.
Input
Operation
Result
10100110
Logical right shift
(3 bits)
Logical left shift (3
bits)
Arithmetic right
shift (3 bits)
Arithmetic left
shift (3 bits)
0Right rotate (3
bits)
Left rotate (3 bits)
00010100
10100110
10100110
10100110
10100110
10100110
00110000
11110100
10110000
11010100
00110101
Logical
•
•
•
•
•
Bitwise operations
AND, OR, NOT
Bitwise operators
NOT for example
The bitwise NOT, or complement, is a unary operation
which performs logical negation on each bit, forming the
ones' complement of the given binary value. Digits which
were 0 become 1, and vice versa. For example:
• NOT 0111 = 1000
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
• For operating systems use
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
Questions?
•
o
•
o
•
o
•
o
•
o
•
o
What is an Address?
Any form of data.
Is Indexed an addressing mode?
Yes.
Do all microprocessors have the same addressing modes?
No.
What is the inefficiency of BCD coding?
Only 10 of 16 possible 4-bit values are used
Where is EBCDIC coding used?
It is used on IBM mainframes.
What is Endianness?
Byte ordering that represent some kind of data.
•
o
•
o
•
o
•
o
•
o
Which three manufactures united to create the PowerPC
processor?
Apple, IBM, and Motorola.
What does the acronym is RISC stand for?
Reduced Instruction Set Computers
What year did the AIM alliance occur?
1991
What is a bitwise operation?
The operation of one or two bit patterns at the level of their
individual bits
Aside of the common arithmetic operations ( Add, Sub, Multiply,
Div) what are four other possibilities?
Absolute, Negate, Increment, Decrement
• What is the common practice name for the representation of
machine instructions?
• Symbolic Representation
• The source and result operands can be in the areas of
main/virtual memory, I/O device and what other area?
• CPU Register
• In one-address instructions, a second address is implicit
which is a process register. What is the name of this
register?
• Accumulator
References
• Wikipedia
• Wiki-Answers
• Computer Organization and Architecture: Designing for
Performance, 7/E
William Stallings
This has been a production of < Dr. Herman Watson > class
from <FIU>.
Ken Berry
Jean Paul Larach
Hugo Blanco

similar documents