Lecture 3 Addressing Modes, Instruction Samples, Machine Code, Instruction Execution Cycle
|
|
- Rosalyn Fisher
- 8 years ago
- Views:
Transcription
1 Lecture 3 Addressing Modes, Instruction Samples, Machine Code, Instruction Execution Cycle Contents 3.1. Register Transfer Notation HCS12 Addressing Modes Inherent Mode (INH) Immediate Mode (IMM) Direct mode (DIR) Extended mode (EXT) Relative mode (REL) Indexed Mode (INDEX)... 4 a. Indexed addressing Modes with Constants Offsets... 4 b. Indexed Addressing Modes with Offset in an Accumulator... 4 c. Auto Pre/Post increment/decrement Indexed Addressing Modes... 5 d. 16-Bit Offset Indexed Indirect Mode... 5 e. Accumulator D Indirect Indexed Addressing A Sample of HCS12 Instructions The LOAD instructions Load Effective Address Instruction The STORE instruction Register to Register Transfer Instructions Exchange Instructions Sign Extension Instructions Memory to Memory Move Instructions The ADD instruction The SUB instruction Shift instructions Programming Examples HCS12 Instructions The HCS12 Machine Code Decoding Machine Language Instructions Instruction Execution Cycle Lecture 3 Addressing Modes Page 1 of 18
2 3.1. Register Transfer Notation () A B X IX M + v ^ Here are examples: A 15 A $15 A ($2015) A A + ($2F) The content of the address specified inside the parenthesis. Transferred to Accumulator A Accumulator B Accumulator A or accumulator B Index register X Memory location Add OR Subtract And The decimal value of 15 is loaded into A. The hexadecimal value of 1516 (2110) is loaded into A. The contents of memory location $2015 is loaded into A. The contents of memory location $2F is added to the contents of A 3.2. HCS12 Addressing Modes An HCS12 instruction consists of 1 or 2 bytes of opcode and 0 to 5 bytes of operand addressing information: The opcode specifies the operation to be performed and the addressing mode used to access the operand. The operand contains the information needed for the operation The addressing mode determines how the CPU accesses registers or memory locations for an instruction to be executed. The HCS12 supports several addressing mode: inherent, immediate, direct, extended, relative, indexed addressing with constants offsets, indexed addressing with Offset in an accumulator, auto pre/post increment/decrement indexed addressing, 16-bit offset indexed indirect mod, and accumulator D indirect indexed addressing. Address and data values are represented in binary format. A large binary number is not practical for human beings to deal with, and therefore, decimal and hexadecimal formats are often used. 1. Inherent Mode (INH) Instructions do not have operands. CLRA Clear the content of the accumulator A Add the content of the accumulator A to the accumulator A ABA and leave the result in the accumulator A Lecture 3 Addressing Modes Page 2 of 18
3 INCA Increment the content of the accumulator A by 1 DECB Decrement the content of the accumulator A by 1 2. Immediate Mode (IMM) The value of the operand is included in the instruction. The immediate value (8-bit or 16- bit) is preceded by # LDAA #22 Load the decimal value of 22 into the accumulator A. ADDA #@32 Add the octal value of 32 to the accumulator A. LDD #$1000 Load the hexadecimal value of 1000 into the accumulator D. Note: # is a prefix that indicates that the operand is actually the data (not address) 3. Direct mode (DIR) This addressing mode is sometimes called zero-page addressing because it is used to access the operands in the address range of $0000 to $00FF. Since the address begin with $0000, only the low byte of the address of the operand need to be included in the instruction. Address of operand operand (low byte) + $0000 (base address of data section) ADDA $10 SUBA $20 LDD $30 Add the value stored at the memory location $0010 to the accumulator A. Subtract from the accumulator A the value stored at the memory location $0020. Load the contents of the memory locations at $0030 and $0031 into double accumulator D. 4. Extended mode (EXT) In the addressing mode, the full 16-bit address (2-byte address) of memory location is included in the instruction Address of operand operand (2-byte) ADDA $1003 LDX $1000 ADDD $1030 Add the value stored at the memory location with the effective address of $1103 to the accumulator A. Load the 16-bit value stored at the memory location with the effective address of $1000 into the index register X. The byte at $1000 will be loaded into the upper byte of X and the byte at $1001 will be loaded into the lower byte of X. Add the 16-bit value stored at the memory location with the effective addresses of $1030 and $1031 to double accumulator D. 5. Relative mode (REL) The relative addressing mode is used only for branch instructions that can change the direction of the program flow. The distance of the branch (or jump) is referred as branch offset. There are short and long conditional branch instructions. Short branch instructions consists of an 8-bit opcode and a signed 8-bit offset ranged from $80 ( 128) to $7F (+127). Lecture 3 Addressing Modes Page 3 of 18
4 Long branch instructions consists of an 8-bit prebyte, an 8-bit opcode, and a signed 16-bit offset contained in 2 bytes following the opcode. The range for long branch instructions is from $8000 ( 32768) to $7FFF (+32676). In the following example, BEQ is a short branch instruction that branches to the label There the condition is met.... BEQ There ADDA #10... There: DECB 6. Indexed Mode (INDEX) In the indexed mode, the effective address of an operand is calculated by adding the base address, which is stored in a base register such as IX, IY, SP, or PC, to the offset. a. Indexed Addressing Modes with Constants Offsets The syntax of the operand of this indexed mode is: n, r where n is a 5-bit, 9-bit, or 16-bit constant r is the base register (IX, IY, SP, or PC) Address of operand constant + [IX, IY, SP, or PC] ADDA LDAA SUBA 10, X 3, Y 0, X Add the value stored at the memory location pointed by the sum of 10 and the contents of the index register X to accumulator A. A [10 + IX] + A Load the contents of the memory location pointed by the sum of 3 and the contents of the index register Y into the accumulator A. A [3 + IY] Subtract the value stored at the memory location pointed by the sum of 0 and the contents of the index register X from the accumulator A. A A [0 + IX] b. Indexed Addressing Modes with Offset in an Accumulator The syntax of the operand of this indexed mode is: acc, r where acc can be A, B, or D r is the base register (IX, IY, SP, or PC) STAA Address of operand [A, B, or D] + [IX, IY, SP, or PC] Store the value in the accumulator A into the memory B, X location pointed by the sum of the accumulator B and the contents of the index register X. Lecture 3 Addressing Modes Page 4 of 18
5 LDAB LDX A, Y D, SP [B + IX] A Load the contents of the memory location pointed by the sum of A and the contents of the index register Y into the accumulator A. A [B + IY] Load two bytes from the memory locations into IX The high byte (MB) from the location [D + SP] The low byte (LB) from the location [1+ D + SP] IX (high byte) [D + SP] IX (low byte) [1 +D + SP] c. Auto Pre/Post increment/decrement Indexed Addressing Modes The syntax of the operand of this indexed mode is: Syntax Effective New Value of Address Base Register r Pre-decrement n, r r n r r n Pre-increment n, +r r + n r r + n Post-decrement n, r r r r n Post-increment n, r+ r r r + n Here are examples. STAA 2, X ADDA 3, +Y LDAB 4, X STAB 8, Y+ IX IX 2 [IX] A IY IY + 3 A A + [IY] B [IX] IX IX 4 [IY] B IY IY + 8 d. 16-Bit Offset Indexed Indirect Mode The syntax of the operand of this indexed mode is: [n, r] where n is 16-bit offset r is the base register (IX, IY, SP, or PC) Here are examples. STAA [2, X] [ [2 + IX] ] A ADDA [3, Y] A A + [ [IY + 3] ] e. Accumulator D Indirect Indexed Addressing The syntax of the operand of this indexed mode is: [D, r] where r is the base register (IX, IY, SP, or PC) Lecture 3 Addressing Modes Page 5 of 18
6 Here are examples. JMP [D, X] Jump to the address [ [D + IX] ] This addressing mode is often used for interrupt vector table A Sample of HCS12 Instructions HCS12 instructions are case-insensitive. Upper case letters or lower case letters are acceptable to the compiler. As a rule of thumb, there is a preferable style which is commonly used: HCS12 Instructions Operands or variables Constant Use upper case letter Use upper case for the first letter, and lower case for the rest of the letters. Use upper case letter 1. The LOAD instructions A group of instructions that place a value or copy the contents of a memory location (or locations) into a register (A, B, D, IX, IY, SP) Mnemonic LDAA <opr> LDAB <opr> LDD <opr> LDS <opr> LDX <opr> LDY <opr> Function Load A Load B Load D Load SP Load index register X Load index register Y Operation A [opr] B [opr] A:B [opr]:[opr+1] SP [opr]:[opr+1] X [opr]:[opr+1] Y [opr]:[opr+1] <opr> can be immediate, direct, extended, or index mode Examples: LDAA $10 LDX #$ Load Effective Address Instruction Mnemonic LEAS <opr> LEAX <opr> LEAY <opr> Function Load effective address into SP Load effective address into X Load efective address into Y Operation SP effective address X effective address Y effective address Load the effective address (n + r), not the content of memory location, into registers (IX, IY, SP) Examples: LEAX B, Y ; IX B + IY LEAY A, Y ; IY A + IY LEAS 4, X ; SP 4 + IX Lecture 3 Addressing Modes Page 6 of 18
7 3. The STORE instruction A group of instructions that store the contents of a register (A, B, D, IX, IY, and SP) into a memory location or memory locations Mnemonic Function Operation STAA <opr> STAB <opr> STD <opr> STS <opr> STX <opr> STY <opr> Store A in a memory location Store B in a memory location Store D in a memory location Store SP in a memory location Store X in a memory location Store Y in a memory location m[opr] [A] m[opr] [B] m[opr]:m[opr+1] [A]:[B] m[opr]:m[opr+1] [SP] m[opr]:m[opr+1] [X] m[opr]:m[opr+1] [Y] <addr> can be direct, extended, or index mode Examples: STAA $20 STAA 10, X STD $10 STD $1000 STD 0, X 4. Register to Register Transfer Instructions TAB Transfer the content of A to B B A TAP Transfer the content of A to CCR CCR A TBA Transfer the content of B to A A B TFR reg1, reg2 Transfer the content of reg1 to reg2 reg2 reg1 TPA Transfer the content of CCR to A A CCR TSX Transfer the content of SP to IX IX SP TSY Transfer the content of SP to IY IY SP TXS Transfer the content of IX to SP SP IX TYS Transfer the content of IY to SP SP IY Examples: TFR A, X ; A is signed-extended to 16 bits and assigned to IX TFR Y, B ; B IY[7:0], B receives lower byte of IY (bits 7:0) 5. Exchange Instructions EXG reg1, reg2 reg1 reg2, exchange the contents of reg1 and reg2 XGDX D IX, exchange the contents of D and IX XGDY D IY, exchange the contents of D and IX Examples: EXG D, X EXG X, A ; D IX ; IX $ A, A X[7:0] Lecture 3 Addressing Modes Page 7 of 18
8 6. Sign Extension Instructions SEX reg1, reg2 reg1 is signed-extended to 16 bits and assigned to reg2 Examples: SEX A, X ; A is signed-extended to 16 bits and assigned to IX SEX CCR, Y ; CCR is signed-extended to 16 bits and assigned to IY 7. Memory to Memory Move Instructions MOVB <src>, <dest> Move a byte (8-bit) from [src] to dest; dest [src] MOVW <src>, <dest> Move a word (16-bit) from [src] to dest; dest [src] Examples: MOVB #$30, $1800 ; [$1800] $30 MOVW Var1, Var2 ; Var2 Var1 MOVW 1, X, 1, Y ; [1 +IY] [1 + IX] 8. The ADD instruction A group of instructions perform addition operation Mnemonic ABA ABX ABY ADCA <opr> ADCB <opr> ADDA <opr> ADDB <opr> ADDD <opr> Function Add B to A Add B to X Add B to Y Add with carry to A Add with carry to B Add without carry to A Add without carry to B Add without carry to D Operation A [A] + [B] X [X] + [B] Y [Y] + [B] A [A] + [opr] + C B [B] + [opr] + C A [A] + [opr] B [B] + [opr] D [D] + [opr] <opr> can be immediate, direct, extended, or index mode Examples: ADDA #10 ; A A + 10 ADDA $20 ; A A + [$ $20] ADDD $FB46 ; D D + [$FB46] 9. The SUB instruction A group of instructions perform subtract operation Mnemonic Function Operation SBA SBCA <opr> SBCB <opr> SUBA <opr> SUBB <opr> SUBD <opr> Subtract B from A Subtract with borrow from A Subtract with borrow from B Subtract memory from A Subtract memory from B Subtract memory from D A [A] - [B] A [A] -[opr] -C B [B] - [opr] - C A [A] - [opr] B [B] - [opr] D [D] - [opr] Lecture 3 Addressing Modes Page 8 of 18
9 <opr> can be immediate, direct, extended, or index mode Examples: SUBA #10 SUBA $10 SUBA 0, X SUBD 10, X 10. Shift Instructions Shift instructions are useful for bit field manipulation. They can be used to speed up the integer multiply and divide operations if one of the operands is a power of 2. The HCS12 has shift instructions that can operate on accumulators A, B, and D or a memory location. A memory operand must be specified using the extended or indexed (direct or indirect) addressing modes. Logical Shift Left LSL <opr> LSLA LSLB memory location <opr> is shifted left one place accumulator A is shifted left one place accumulator B is shifted left one place The operation is LSLD accumulator D is shifted left one place The operation is Logical Shift Right LSR <opr> LSRA LSRB memory location <opr> is shifted right one place accumulator A is shifted right one place accumulator B is shifted right one place The operation is LSRD accumulator D is shifted right one place The operation is Lecture 3 Addressing Modes Page 9 of 18
10 11. Programming Examples Example Compute Y = 7 * X Write an assembly code to compute Y = 7 * X Solution: Register Transfer Notation Arithmetic Assembly Code A X A = X LDAA X B A B = X TAB A 2 * A A = 2 * X LSLA A 2 * A A = 4 * X LSLA A 2 * A A = 8 * X LSLA A A B A = 8 * X X SBA Y A Y = 7 * X STAA Y Alternative solution: Register Transfer Notation Arithmetic Assembly Code A X A = X LDAA X B A B = X TAB B 2 * B B = 2 * X LSLB A A + B A = X + 2 * X = 3 * X ABA B 2 * B B = 4 * X LSLB A A + B A = 3 * X + 4 * X ABA Y A Y = A STAA Y Example Arithmetic Program Design a program that will perform the following computation voltage = 9 * current 25. Solution: ORG $0 ; location of variables current DS.B 1 ; the value of current voltage DS.B 1 ; the value of voltage ; ORG $C000 ; the starting address of the program LDAA current ; A = current TAB ; B = A = current LSLA ; A = 2 * current LSLA ; A = 4 * current LSLA ; A = 8 * current ABA ; A = A + B = 8 * current + current = 9 * current SUBA #25 ; A = 9 * current 25 STAA voltage ; voltage = A = 9 * current 25 SWI END Lecture 3 Addressing Modes Page 10 of 18
11 Example Determine range of Variables In the previous example, given that the voltage and current shall be defined as 1 byte unsigned variables, determine the range of current for which a solution can be computed. (From Dr. Tavora s notes) Constraints: 0 current, voltage all computations 255 Valid range 9* current current current 28 voltage 9* current current current 3 Therefore, 3 current 28 Example Determine range of Variables In the previous example, given that the voltage and current shall be defined as 1 byte signed variables, determine the range of current for which a solution can be computed. (From Dr. Tavora s notes) Constraints: 128 current, voltage all computations 127 Valid range 128 9* current current current voltage 9* current current current 16 Therefore, 11 current HCS12 Instructions Appendix A (pp ) Instruction listing by alphabetical order Lecture 3 Addressing Modes Page 11 of 18
12 Note: Lecture 3 Addressing Modes Page 12 of 18
13 Lecture 3 Addressing Modes Page 13 of 18
14 3.5 The HCS12 Machine Code Each HCS12 instruction consists of 1 to 2 bytes of opcode and 0 to 5 bytes of operand information. These bytes are presented in hexadecimal numbers: Instruction = opcode + operand Opcode specifies the operation to be performed. Operand specifies a value or the address where the value can be found to be used in the operation. Assembly instruction Machine instructions (in hex format) LDAA # D STAA $00 5A 00 ADDA $02 9B 02 STAA $01 5A 01 MOVB $1000, $ C INY Decoding Machine Language Instructions 1. Procedure Compare the first one or two bytes with the opcode table to identify the corresponding assembly mnemonic and format. Identify the operand bytes after the opcode field. Write down the corresponding assembly instruction. Repeat step 1 to 3 until the machine code file is exhausted. Example Decoding Machine Code Decode the following machine code to its corresponding assembly instructions: B 07 5A Solution: The decoding process starts from the leftmost byte. We next look up the machine code table to see which instruction it corresponds to. Instruction 1: The first byte 96 corresponds to the instruction: LDAA DIR. The second byte, 30, is the direct address. Therefore, the first instruction is LDAA $30. Lecture 3 Addressing Modes Page 14 of 18
15 Instruction 2: The third byte (8B) corresponds to the instruction: ADDA IMM. The immediate value is 07. Therefore, the second instruction is ADDA #$07. Instruction 3: The fifth byte (5A) corresponds to the instruction STAA DIR. The DIR address is the next byte 30. Therefore, the third instruction is STAA $30. Instruction 4: The seventh byte (96) corresponds to the instruction LDAA DIR. The DIR value is the next byte 31. Therefore, the four instruction is LDAA $31. Therefore, the equivalent assembly code for the machine code B 07 5A is LDAA $30 ADDA #$07 STAA $30 LDAA $31 Example Decoding Machine Code Decode the following machine code to its corresponding assembly instructions: B 15 C6 12 7C C8 AF Solution: 96 LDAA DIR LDAA $10 5B STAB DIR D7 15 STAB $15 C6 LDAB IMM C6 12 LDAB #$12 7C STD EXT FD C8 AF STD $C8AF Example Decoding Machine Code Decode the following machine code to its corresponding assembly instructions: D A D B C Solution: 86 LDAA IMM LDAA #$12 D6 LDAB DIR D6 10 LDAB $10 54 LSRB ABA 5A STAB DIR STA $12 42 INCA Lecture 3 Addressing Modes Page 15 of 18
16 Example Decoding Machine Code Decode the following machine code to its corresponding assembly instructions: B D C C Solution: B6 LDAA EXT B LDAA $2000 D6 LDAB DIR D6 15 LDAB $ ABA 7C STD EXT FD STD $ INCA INH INCA 48 LSLA INH LSLA 7C STD EXT FD STD $ Instruction Execution Cycle In order to execute a program, the microprocessor or microcontroller must access memory to fetch instructions or operands. The process of accessing a memory location is called a read cycle. The process of storing a value into a memory location is called a write cycle. The process of executing an instruction is called an instruction execution cycle. When executing an instruction, the HCS12 performs a combination of the following operations: One of multiple read cycles to fetch instruction opcode byte(s) and addressing information. One or two read cycles to required to fetch the memory operand(s) The operation specified by the opcode One or two write cycles to write back the result to either a register or a memory location 1. Example Executing Instruction Cycle (assume 8-bit data bus) Consider the following instruction sequence: ORG $C000 LDAA $2000 ADDA $3000 STAA $2000 Assembly Instruction Memory location Opcode LDAA $2000 $C000 B ADDA $3000 $C003 BB STAA $2000 $C006 7A Instruction: LDAA $2000 Step 1. Place the value in PC on the address bus with a request to read the contents of that location. Step 2. The opcode byte $B6 at $C000 is returned to the CPU and PC is incremented by 1. Lecture 3 Addressing Modes Page 16 of 18
17 Step 3. CPU performs two read cycles to obtain the extended address $2000 from locations $C001 and $C002. At the end the value of PC is incremented to $C003. Lecture 3 Addressing Modes Page 17 of 18
18 Step 4. The CPU performs another read to get the contents of the memory location at $2000, which is $19. The value $19 will be loaded into accumulator A. Lecture 3 Addressing Modes Page 18 of 18
Microcontroller Basics A microcontroller is a small, low-cost computer-on-a-chip which usually includes:
Microcontroller Basics A microcontroller is a small, low-cost computer-on-a-chip which usually includes: An 8 or 16 bit microprocessor (CPU). A small amount of RAM. Programmable ROM and/or flash memory.
More informationM6800. Assembly Language Programming
M6800 Assembly Language Programming 1 3. MC6802 MICROPROCESSOR MC6802 microprocessor runs in 1MHz clock cycle. It has 64 Kbyte memory address capacity using 16-bit addressing path (A0-A15). The 8-bit data
More informationHC12 Assembly Language Programming
HC12 Assembly Language Programming Programming Model Addressing Modes Assembler Directives HC12 Instructions Flow Charts 1 Assembler Directives In order to write an assembly language program it is necessary
More informationProgrammer s Model = model of µc useful to view hardware during execution of software instructions
HC12/S12 Programmer s Model Programmer s Model = model of µc useful to view hardware during execution of software instructions Recall: General Microcontroller/Computer Architecture note: Control Unit &
More informationHow To Understand All Instructions In The Power12 Program
Module Introduction PURPOSE: The intent of this module is to present all CPU12 instructions to better prepare you to write short routines in assembly language. OBJECTIVES: - Discuss all CPU12 instruction
More informationMicroprocessor/Microcontroller. Introduction
Microprocessor/Microcontroller Introduction Microprocessor/Microcontroller microprocessor - also known as a CU or central processing unit - is a complete computation engine that is fabricated on a single
More informationProgramming the Motorola MC68HC11 Microcontroller
Programming the Motorola MC68HC11 Microcontroller CONTENTS: COMMON PROGRAM INSTRUCTIONS WITH EXAMPLES MEMORY LOCATIONS PORTS SUBROUTINE LIBRARIES PARALLEL I/O CONTROL REGISTER (PIOC) COMMON PROGRAM INSTRUCTIONS
More information1 Classical Universal Computer 3
Chapter 6: Machine Language and Assembler Christian Jacob 1 Classical Universal Computer 3 1.1 Von Neumann Architecture 3 1.2 CPU and RAM 5 1.3 Arithmetic Logical Unit (ALU) 6 1.4 Arithmetic Logical Unit
More informationIntroduction to Microcontrollers
Introduction to Microcontrollers Motorola M68HC11 Specs Assembly Programming Language BUFFALO Topics of Discussion Microcontrollers M68HC11 Package & Pinouts Accumulators Index Registers Special Registers
More informationASSEMBLY LANGUAGE PROGRAMMING (6800) (R. Horvath, Introduction to Microprocessors, Chapter 6)
ASSEMBLY LANGUAGE PROGRAMMING (6800) (R. Horvath, Introduction to Microprocessors, Chapter 6) 1 COMPUTER LANGUAGES In order for a computer to be able to execute a program, the program must first be present
More information6800 Basics. By Ruben Gonzalez
6800 Basics By Ruben Gonzalez 6800 Processor Uses 8 bit words Has addressable main memory of 64k Has Memory Mapped I/O and interrupts The 6800 has the following main registers: 8- bit Accumulator A (AccA)
More informationMICROPROCESSOR AND MICROCOMPUTER BASICS
Introduction MICROPROCESSOR AND MICROCOMPUTER BASICS At present there are many types and sizes of computers available. These computers are designed and constructed based on digital and Integrated Circuit
More informationNotes on Assembly Language
Notes on Assembly Language Brief introduction to assembly programming The main components of a computer that take part in the execution of a program written in assembly code are the following: A set of
More informationHow It All Works. Other M68000 Updates. Basic Control Signals. Basic Control Signals
CPU Architectures Motorola 68000 Several CPU architectures exist currently: Motorola Intel AMD (Advanced Micro Devices) PowerPC Pick one to study; others will be variations on this. Arbitrary pick: Motorola
More informationZ80 Instruction Set. Z80 Assembly Language
75 Z80 Assembly Language The assembly language allows the user to write a program without concern for memory addresses or machine instruction formats. It uses symbolic addresses to identify memory locations
More informationPROBLEMS (Cap. 4 - Istruzioni macchina)
98 CHAPTER 2 MACHINE INSTRUCTIONS AND PROGRAMS PROBLEMS (Cap. 4 - Istruzioni macchina) 2.1 Represent the decimal values 5, 2, 14, 10, 26, 19, 51, and 43, as signed, 7-bit numbers in the following binary
More informationChapter 2: Elements of Java
Chapter 2: Elements of Java Basic components of a Java program Primitive data types Arithmetic expressions Type casting. The String type (introduction) Basic I/O statements Importing packages. 1 Introduction
More informationCPU Organization and Assembly Language
COS 140 Foundations of Computer Science School of Computing and Information Science University of Maine October 2, 2015 Outline 1 2 3 4 5 6 7 8 Homework and announcements Reading: Chapter 12 Homework:
More informationMACHINE ARCHITECTURE & LANGUAGE
in the name of God the compassionate, the merciful notes on MACHINE ARCHITECTURE & LANGUAGE compiled by Jumong Chap. 9 Microprocessor Fundamentals A system designer should consider a microprocessor-based
More informationComputer Organization and Architecture
Computer Organization and Architecture Chapter 11 Instruction Sets: Addressing Modes and Formats Instruction Set Design One goal of instruction set design is to minimize instruction length Another goal
More informationHow To Write A Microsoft Microsoft 8D (Droid) (Program) (Powerbook) (I386) (Microsoft) (Donga) (Opera) And (Dungeo) (Dugeo
CPU08 Central Processor Unit Reference Manual M68HC08 Microcontrollers CPU08RM Rev. 02/2006 freescale.com CPU08 Central Processor Unit Reference Manual To provide the most up-to-date information, the
More informationInstruction Set Architecture (ISA)
Instruction Set Architecture (ISA) * Instruction set architecture of a machine fills the semantic gap between the user and the machine. * ISA serves as the starting point for the design of a new machine
More informationCentral Processing Unit (CPU)
Central Processing Unit (CPU) CPU is the heart and brain It interprets and executes machine level instructions Controls data transfer from/to Main Memory (MM) and CPU Detects any errors In the following
More informationInstruction Set Architecture. or How to talk to computers if you aren t in Star Trek
Instruction Set Architecture or How to talk to computers if you aren t in Star Trek The Instruction Set Architecture Application Compiler Instr. Set Proc. Operating System I/O system Instruction Set Architecture
More informationMICROPROCESSOR. Exclusive for IACE Students www.iace.co.in iacehyd.blogspot.in Ph: 9700077455/422 Page 1
MICROPROCESSOR A microprocessor incorporates the functions of a computer s central processing unit (CPU) on a single Integrated (IC), or at most a few integrated circuit. It is a multipurpose, programmable
More informationChapter 7D The Java Virtual Machine
This sub chapter discusses another architecture, that of the JVM (Java Virtual Machine). In general, a VM (Virtual Machine) is a hypothetical machine (implemented in either hardware or software) that directly
More informationEC 362 Problem Set #2
EC 362 Problem Set #2 1) Using Single Precision IEEE 754, what is FF28 0000? 2) Suppose the fraction enhanced of a processor is 40% and the speedup of the enhancement was tenfold. What is the overall speedup?
More informationCPU Organisation and Operation
CPU Organisation and Operation The Fetch-Execute Cycle The operation of the CPU 1 is usually described in terms of the Fetch-Execute cycle. 2 Fetch-Execute Cycle Fetch the Instruction Increment the Program
More information68HC11 Programmer s Reference Manual
8HC11 Programmer s Reference Manual Phillip Musumeci p.musumeci@ieee.org November 1999 Version 1. Credits Engineer proofreading: Dr. Barbara La Scala; Cross Assembler for 8HC11: Motorola; University of
More informationComputer Science 281 Binary and Hexadecimal Review
Computer Science 281 Binary and Hexadecimal Review 1 The Binary Number System Computers store everything, both instructions and data, by using many, many transistors, each of which can be in one of two
More informationBinary Numbers. Binary Octal Hexadecimal
Binary Numbers Binary Octal Hexadecimal Binary Numbers COUNTING SYSTEMS UNLIMITED... Since you have been using the 10 different digits 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 all your life, you may wonder how
More informationThe stack and the stack pointer
The stack and the stack pointer If you google the word stack, one of the definitions you will get is: A reserved area of memory used to keep track of a program's internal operations, including functions,
More informationCall Subroutine (PC<15:0>) TOS, (W15)+2 W15 (PC<23:16>) TOS, Process data. Write to PC NOP NOP NOP NOP
Section 3. Descriptions CALL Call Subroutine Syntax: {label:} CALL lit23 CALL.S Operands: lit23 [0... 8388606] (PC)+4 PC, (PC) TOS, (W15)+2 W15 (PC) TOS, (W15)+2 W15 lit23 PC, NOP Register.
More informationChapter 5 Instructor's Manual
The Essentials of Computer Organization and Architecture Linda Null and Julia Lobur Jones and Bartlett Publishers, 2003 Chapter 5 Instructor's Manual Chapter Objectives Chapter 5, A Closer Look at Instruction
More informationComputer Architecture Lecture 2: Instruction Set Principles (Appendix A) Chih Wei Liu 劉 志 尉 National Chiao Tung University cwliu@twins.ee.nctu.edu.
Computer Architecture Lecture 2: Instruction Set Principles (Appendix A) Chih Wei Liu 劉 志 尉 National Chiao Tung University cwliu@twins.ee.nctu.edu.tw Review Computers in mid 50 s Hardware was expensive
More informationThe AVR Microcontroller and C Compiler Co-Design Dr. Gaute Myklebust ATMEL Corporation ATMEL Development Center, Trondheim, Norway
The AVR Microcontroller and C Compiler Co-Design Dr. Gaute Myklebust ATMEL Corporation ATMEL Development Center, Trondheim, Norway Abstract High Level Languages (HLLs) are rapidly becoming the standard
More information(Refer Slide Time: 00:01:16 min)
Digital Computer Organization Prof. P. K. Biswas Department of Electronic & Electrical Communication Engineering Indian Institute of Technology, Kharagpur Lecture No. # 04 CPU Design: Tirning & Control
More informationAdvanced Computer Architecture-CS501. Computer Systems Design and Architecture 2.1, 2.2, 3.2
Lecture Handout Computer Architecture Lecture No. 2 Reading Material Vincent P. Heuring&Harry F. Jordan Chapter 2,Chapter3 Computer Systems Design and Architecture 2.1, 2.2, 3.2 Summary 1) A taxonomy of
More informationTHUMB Instruction Set
5 THUMB Instruction Set This chapter describes the THUMB instruction set. Format Summary 5-2 Opcode Summary 5-3 5. Format : move shifted register 5-5 5.2 Format 2: add/subtract 5-7 5.3 Format 3: move/compare/add/subtract
More informationEmbedded system programming: HCS12
Embedded system programming: HCS12 Cross developments environments and tools XCC12 cross C compiler in particular Low level programming in C Embedded system programming: HCS12 1 Low level programming in
More informationInstruction Set Design
Instruction Set Design Instruction Set Architecture: to what purpose? ISA provides the level of abstraction between the software and the hardware One of the most important abstraction in CS It s narrow,
More information8085 INSTRUCTION SET
DATA TRANSFER INSTRUCTIONS Opcode Operand Description 8085 INSTRUCTION SET INSTRUCTION DETAILS Copy from source to destination OV Rd, Rs This instruction copies the contents of the source, Rs register
More informationChapter 2 Topics. 2.1 Classification of Computers & Instructions 2.2 Classes of Instruction Sets 2.3 Informal Description of Simple RISC Computer, SRC
Chapter 2 Topics 2.1 Classification of Computers & Instructions 2.2 Classes of Instruction Sets 2.3 Informal Description of Simple RISC Computer, SRC See Appendix C for Assembly language information. 2.4
More informationAn Introduction to the ARM 7 Architecture
An Introduction to the ARM 7 Architecture Trevor Martin CEng, MIEE Technical Director This article gives an overview of the ARM 7 architecture and a description of its major features for a developer new
More informationInstruction Set Architecture
Instruction Set Architecture Consider x := y+z. (x, y, z are memory variables) 1-address instructions 2-address instructions LOAD y (r :=y) ADD y,z (y := y+z) ADD z (r:=r+z) MOVE x,y (x := y) STORE x (x:=r)
More informationOct: 50 8 = 6 (r = 2) 6 8 = 0 (r = 6) Writing the remainders in reverse order we get: (50) 10 = (62) 8
ECE Department Summer LECTURE #5: Number Systems EEL : Digital Logic and Computer Systems Based on lecture notes by Dr. Eric M. Schwartz Decimal Number System: -Our standard number system is base, also
More informationUNIVERSITY OF CALIFORNIA, DAVIS Department of Electrical and Computer Engineering. EEC180B Lab 7: MISP Processor Design Spring 1995
UNIVERSITY OF CALIFORNIA, DAVIS Department of Electrical and Computer Engineering EEC180B Lab 7: MISP Processor Design Spring 1995 Objective: In this lab, you will complete the design of the MISP processor,
More informationMACHINE INSTRUCTIONS AND PROGRAMS
CHAPTER 2 MACHINE INSTRUCTIONS AND PROGRAMS CHAPTER OBJECTIVES In this chapter you will learn about: Machine instructions and program execution, including branching and subroutine call and return operations
More informationDigital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur
Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture - 04 Digital Logic II May, I before starting the today s lecture
More informationComp 255Q - 1M: Computer Organization Lab #3 - Machine Language Programs for the PDP-8
Comp 255Q - 1M: Computer Organization Lab #3 - Machine Language Programs for the PDP-8 January 22, 2013 Name: Grade /10 Introduction: In this lab you will write, test, and execute a number of simple PDP-8
More information1 The Java Virtual Machine
1 The Java Virtual Machine About the Spec Format This document describes the Java virtual machine and the instruction set. In this introduction, each component of the machine is briefly described. This
More informationCOMPUTERS ORGANIZATION 2ND YEAR COMPUTE SCIENCE MANAGEMENT ENGINEERING JOSÉ GARCÍA RODRÍGUEZ JOSÉ ANTONIO SERRA PÉREZ
COMPUTERS ORGANIZATION 2ND YEAR COMPUTE SCIENCE MANAGEMENT ENGINEERING UNIT 1 - INTRODUCTION JOSÉ GARCÍA RODRÍGUEZ JOSÉ ANTONIO SERRA PÉREZ Unit 1.MaNoTaS 1 Definitions (I) Description A computer is: A
More informationLecture 7: Machine-Level Programming I: Basics Mohamed Zahran (aka Z) mzahran@cs.nyu.edu http://www.mzahran.com
CSCI-UA.0201-003 Computer Systems Organization Lecture 7: Machine-Level Programming I: Basics Mohamed Zahran (aka Z) mzahran@cs.nyu.edu http://www.mzahran.com Some slides adapted (and slightly modified)
More informationX86-64 Architecture Guide
X86-64 Architecture Guide For the code-generation project, we shall expose you to a simplified version of the x86-64 platform. Example Consider the following Decaf program: class Program { int foo(int
More informationFreescale Semiconductor, I
nc. Reference Guide CU12RG/D Rev. 2, 11/2001 CU12 Reference Guide (for HCS12 and original M68HC12) 7 15 15 15 15 15 A 0 D X Y S C 7 B S X H I N Z V C 0 0 0 0 0 0 8-BIT ACCUMULATRS A AND B R 16-BIT DUBLE
More informationLecture 11: Number Systems
Lecture 11: Number Systems Numeric Data Fixed point Integers (12, 345, 20567 etc) Real fractions (23.45, 23., 0.145 etc.) Floating point such as 23. 45 e 12 Basically an exponent representation Any number
More informationCS101 Lecture 11: Number Systems and Binary Numbers. Aaron Stevens 14 February 2011
CS101 Lecture 11: Number Systems and Binary Numbers Aaron Stevens 14 February 2011 1 2 1 3!!! MATH WARNING!!! TODAY S LECTURE CONTAINS TRACE AMOUNTS OF ARITHMETIC AND ALGEBRA PLEASE BE ADVISED THAT CALCULTORS
More informationEmbedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C
Embedded Systems A Review of ANSI C and Considerations for Embedded C Programming Dr. Jeff Jackson Lecture 2-1 Review of ANSI C Topics Basic features of C C fundamentals Basic data types Expressions Selection
More informationChapter 2. Binary Values and Number Systems
Chapter 2 Binary Values and Number Systems Numbers Natural numbers, a.k.a. positive integers Zero and any number obtained by repeatedly adding one to it. Examples: 100, 0, 45645, 32 Negative numbers A
More informationLC-3 Assembly Language
LC-3 Assembly Language Programming and tips Textbook Chapter 7 CMPE12 Summer 2008 Assembly and Assembler Machine language - binary Assembly language - symbolic 0001110010000110 An assembler is a program
More information150127-Microprocessor & Assembly Language
Chapter 3 Z80 Microprocessor Architecture The Z 80 is one of the most talented 8 bit microprocessors, and many microprocessor-based systems are designed around the Z80. The Z80 microprocessor needs an
More informationCS101 Lecture 26: Low Level Programming. John Magee 30 July 2013 Some material copyright Jones and Bartlett. Overview/Questions
CS101 Lecture 26: Low Level Programming John Magee 30 July 2013 Some material copyright Jones and Bartlett 1 Overview/Questions What did we do last time? How can we control the computer s circuits? How
More informationChapter 2 Assemblers http://www.intel.com/multi-core/demos.htm
Chapter 2 Assemblers http://www.intel.com/multi-core/demos.htm Source Program Assembler Object Code Linker Executable Code Loader 1 Outline 2.1 Basic Assembler Functions A simple SIC assembler Assembler
More informationLecture N -1- PHYS 3330. Microcontrollers
Lecture N -1- PHYS 3330 Microcontrollers If you need more than a handful of logic gates to accomplish the task at hand, you likely should use a microcontroller instead of discrete logic gates 1. Microcontrollers
More informationCSI 333 Lecture 1 Number Systems
CSI 333 Lecture 1 Number Systems 1 1 / 23 Basics of Number Systems Ref: Appendix C of Deitel & Deitel. Weighted Positional Notation: 192 = 2 10 0 + 9 10 1 + 1 10 2 General: Digit sequence : d n 1 d n 2...
More information2011, The McGraw-Hill Companies, Inc. Chapter 3
Chapter 3 3.1 Decimal System The radix or base of a number system determines the total number of different symbols or digits used by that system. The decimal system has a base of 10 with the digits 0 through
More informationMemory is implemented as an array of electronic switches
Memory Structure Memory is implemented as an array of electronic switches Each switch can be in one of two states 0 or 1, on or off, true or false, purple or gold, sitting or standing BInary digits (bits)
More informationInformatica e Sistemi in Tempo Reale
Informatica e Sistemi in Tempo Reale Introduction to C programming Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 25, 2010 G. Lipari (Scuola Superiore Sant Anna)
More informationToday. Binary addition Representing negative numbers. Andrew H. Fagg: Embedded Real- Time Systems: Binary Arithmetic
Today Binary addition Representing negative numbers 2 Binary Addition Consider the following binary numbers: 0 0 1 0 0 1 1 0 0 0 1 0 1 0 1 1 How do we add these numbers? 3 Binary Addition 0 0 1 0 0 1 1
More information1 Computer hardware. Peripheral Bus device "B" Peripheral device. controller. Memory. Central Processing Unit (CPU)
1 1 Computer hardware Most computers are organized as shown in Figure 1.1. A computer contains several major subsystems --- such as the Central Processing Unit (CPU), memory, and peripheral device controllers.
More information================================================================
==== ==== ================================================================ DR 6502 AER 201S Engineering Design 6502 Execution Simulator ================================================================
More informationSection 44. CPU with Extended Data Space (EDS)
Section 44. CPU with Extended Data Space (EDS) HIGHLIGHTS This section of the manual contains the following topics: 44.1 Introduction... 44-2 44.2 Programmer s Model... 44-5 44.3 Software Stack Pointer...
More informationA single register, called the accumulator, stores the. operand before the operation, and stores the result. Add y # add y from memory to the acc
Other architectures Example. Accumulator-based machines A single register, called the accumulator, stores the operand before the operation, and stores the result after the operation. Load x # into acc
More informationDecimal to Binary Conversion
Decimal to Binary Conversion A tool that makes the conversion of decimal values to binary values simple is the following table. The first row is created by counting right to left from one to eight, for
More informationa storage location directly on the CPU, used for temporary storage of small amounts of data during processing.
CS143 Handout 18 Summer 2008 30 July, 2008 Processor Architectures Handout written by Maggie Johnson and revised by Julie Zelenski. Architecture Vocabulary Let s review a few relevant hardware definitions:
More informationZ80 Microprocessors Z80 CPU. User Manual UM008006-0714. Copyright 2014 Zilog, Inc. All rights reserved. www.zilog.com
Z80 Microprocessors Z80 CPU UM008006-0714 Copyright 2014 Zilog, Inc. All rights reserved. www.zilog.com ii Warning: DO NOT USE THIS PRODUCT IN LIFE SUPPORT SYSTEMS. LIFE SUPPORT POLICY ZILOG S PRODUCTS
More informationSummary of the MARIE Assembly Language
Supplement for Assignment # (sections.8 -. of the textbook) Summary of the MARIE Assembly Language Type of Instructions Arithmetic Data Transfer I/O Branch Subroutine call and return Mnemonic ADD X SUBT
More informationl C-Programming l A real computer language l Data Representation l Everything goes down to bits and bytes l Machine representation Language
198:211 Computer Architecture Topics: Processor Design Where are we now? C-Programming A real computer language Data Representation Everything goes down to bits and bytes Machine representation Language
More informationSystems I: Computer Organization and Architecture
Systems I: Computer Organization and Architecture Lecture : Microprogrammed Control Microprogramming The control unit is responsible for initiating the sequence of microoperations that comprise instructions.
More informationStack machines The MIPS assembly language A simple source language Stack-machine implementation of the simple language Readings: 9.1-9.
Code Generation I Stack machines The MIPS assembly language A simple source language Stack-machine implementation of the simple language Readings: 9.1-9.7 Stack Machines A simple evaluation model No variables
More informationOverview. CISC Developments. RISC Designs. CISC Designs. VAX: Addressing Modes. Digital VAX
Overview CISC Developments Over Twenty Years Classic CISC design: Digital VAX VAXÕs RISC successor: PRISM/Alpha IntelÕs ubiquitous 80x86 architecture Ð 8086 through the Pentium Pro (P6) RJS 2/3/97 Philosophy
More informationReview: MIPS Addressing Modes/Instruction Formats
Review: Addressing Modes Addressing mode Example Meaning Register Add R4,R3 R4 R4+R3 Immediate Add R4,#3 R4 R4+3 Displacement Add R4,1(R1) R4 R4+Mem[1+R1] Register indirect Add R4,(R1) R4 R4+Mem[R1] Indexed
More informationThis 3-digit ASCII string could also be calculated as n = (Data[2]-0x30) +10*((Data[1]-0x30)+10*(Data[0]-0x30));
Introduction to Embedded Microcomputer Systems Lecture 5.1 2.9. Conversions ASCII to binary n = 100*(Data[0]-0x30) + 10*(Data[1]-0x30) + (Data[2]-0x30); This 3-digit ASCII string could also be calculated
More informationInterrupts and the Timer Overflow Interrupts Huang Sections 6.1-6.4. What Happens When You Reset the HCS12?
Interrupts and the Timer Overflow Interrupts Huang Sections 6.1-6.4 o Using the Timer Overflow Flag to interrupt a delay o Introduction to Interrupts o How to generate an interrupt when the timer overflows
More informationAdministrative Issues
CSC 3210 Computer Organization and Programming Introduction and Overview Dr. Anu Bourgeois (modified by Yuan Long) Administrative Issues Required Prerequisites CSc 2010 Intro to CSc CSc 2310 Java Programming
More informationModbus RTU Communications RX/WX and MRX/MWX
15 Modbus RTU Communications RX/WX and MRX/MWX In This Chapter.... Network Slave Operation Network Master Operation: RX / WX Network Master Operation: DL06 MRX / MWX 5 2 D0 Modbus Network Slave Operation
More informationComputer organization
Computer organization Computer design an application of digital logic design procedures Computer = processing unit + memory system Processing unit = control + datapath Control = finite state machine inputs
More informationCHAPTER 7: The CPU and Memory
CHAPTER 7: The CPU and Memory The Architecture of Computer Hardware, Systems Software & Networking: An Information Technology Approach 4th Edition, Irv Englander John Wiley and Sons 2010 PowerPoint slides
More informationChapter 1: Digital Systems and Binary Numbers
Chapter 1: Digital Systems and Binary Numbers Digital age and information age Digital computers general purposes many scientific, industrial and commercial applications Digital systems telephone switching
More informationPART B QUESTIONS AND ANSWERS UNIT I
PART B QUESTIONS AND ANSWERS UNIT I 1. Explain the architecture of 8085 microprocessor? Logic pin out of 8085 microprocessor Address bus: unidirectional bus, used as high order bus Data bus: bi-directional
More informationMachine Programming II: Instruc8ons
Machine Programming II: Instrucons Move instrucons, registers, and operands Complete addressing mode, address computaon (leal) Arithmec operaons (including some x6 6 instrucons) Condion codes Control,
More informationBase Conversion written by Cathy Saxton
Base Conversion written by Cathy Saxton 1. Base 10 In base 10, the digits, from right to left, specify the 1 s, 10 s, 100 s, 1000 s, etc. These are powers of 10 (10 x ): 10 0 = 1, 10 1 = 10, 10 2 = 100,
More informationEECS 427 RISC PROCESSOR
RISC PROCESSOR ISA FOR EECS 427 PROCESSOR ImmHi/ ImmLo/ OP Code Rdest OP Code Ext Rsrc Mnemonic Operands 15-12 11-8 7-4 3-0 Notes (* is Baseline) ADD Rsrc, Rdest 0000 Rdest 0101 Rsrc * ADDI Imm, Rdest
More informationChapter 5, The Instruction Set Architecture Level
Chapter 5, The Instruction Set Architecture Level 5.1 Overview Of The ISA Level 5.2 Data Types 5.3 Instruction Formats 5.4 Addressing 5.5 Instruction Types 5.6 Flow Of Control 5.7 A Detailed Example: The
More informationwhat operations can it perform? how does it perform them? on what kind of data? where are instructions and data stored?
Inside the CPU how does the CPU work? what operations can it perform? how does it perform them? on what kind of data? where are instructions and data stored? some short, boring programs to illustrate the
More informationLABORATORY MANUAL EE0310 MICROPROCESSOR & MICROCONTROLLER LAB
LABORATORY MANUAL EE0310 MICROPROCESSOR & MICROCONTROLLER LAB DEPARTMENT OF ELECTRICAL & ELECTRONICS ENGINEERING FACULTY OF ENGINEERING & TECHNOLOGY SRM UNIVERSITY, Kattankulathur 603 203 1 LIST OF EXEPRIMENTS
More informationAn Overview of Stack Architecture and the PSC 1000 Microprocessor
An Overview of Stack Architecture and the PSC 1000 Microprocessor Introduction A stack is an important data handling structure used in computing. Specifically, a stack is a dynamic set of elements in which
More informationUseful Number Systems
Useful Number Systems Decimal Base = 10 Digit Set = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} Binary Base = 2 Digit Set = {0, 1} Octal Base = 8 = 2 3 Digit Set = {0, 1, 2, 3, 4, 5, 6, 7} Hexadecimal Base = 16 = 2
More informationNumbering Systems. InThisAppendix...
G InThisAppendix... Introduction Binary Numbering System Hexadecimal Numbering System Octal Numbering System Binary Coded Decimal (BCD) Numbering System Real (Floating Point) Numbering System BCD/Binary/Decimal/Hex/Octal
More informationReduced Instruction Set Computer (RISC)
Reduced Instruction Set Computer (RISC) Focuses on reducing the number and complexity of instructions of the ISA. RISC Goals RISC: Simplify ISA Simplify CPU Design Better CPU Performance Motivated by simplifying
More information