You are on page 1of 18

WRES3315 Embedded Programming

Assignment 1 Comparison between FREESCALE MC9S08AW60 and RENESAS R8C MCU

Name: Matrik No:

Lim Jee Sing WEK 090031

Contents
WRES3315 Embedded Programming .............................................................................................. 1 MCU Block Diagram and Its Embedded Module ............................................................................. 3 FREESCALE 68HCS08 MCU ........................................................................................................... 3 Block Diagram .......................................................................................................................... 3 List of Embedded Modules ...................................................................................................... 4 RENESAS R8C ............................................................................................................................... 5 Block Diagram .......................................................................................................................... 5 List of Embedded Modules ...................................................................................................... 6 MCU Architecture Comparison ....................................................................................................... 7 FREESCALE MC9S08AW60 CPU Register ..................................................................................... 7 RENESAS R8C CPU Register ......................................................................................................... 9 MCU Memory Map ........................................................................................................................ 11 FREESCALE MC9S08AW60 ......................................................................................................... 11 RENESAS R8C ............................................................................................................................. 12 Addressing Mode........................................................................................................................... 13 FREESCALE MC9S08AW60 ......................................................................................................... 13 RENESAS R8C ............................................................................................................................. 13 MCU Instruction Set ...................................................................................................................... 15 FREESCALE MC9S08AW60 ......................................................................................................... 15 RENESAS R8C ............................................................................................................................. 17 Reference: ..................................................................................................................................... 18

MCU Block Diagram and Its Embedded Module


FREESCALE 68HCS08 MCU
Block Diagram

MC9S08AW60 Series Block Diagram

List of Embedded Modules

1. Analog-to-Digital Converter 16 channel, 10 bit 2. Internal Clock Generator 3. Inter-Integrated Circuit 4. Keyboard Interrupt 8 channel 5. Serial Communications Interface 6. Serial Peripheral Interface 7. Two 16-bit Timer Pulse-Width Modulator 1 with 6-channel 1 with 2-channel 8. Central Processing Unit 9. Debug Module 10. Voltage Regulator 11. User RAM 12. User Flash

RENESAS R8C
Block Diagram

R8C BLOCK DIAGRAM

List of Embedded Modules 1. Analog-to-Digital Converter 10 bits x 12 channels 2. System Clock Generator 3. Timer 3 x 8 bit 1 x 16 bit 4. Watchdog Timer 15 bits 5. Clock Synchronous Serial I/O 8 bits x 1 channel 6. UART (Universal Asynchronous Receiver/Transmitter) 8 bits x 1 channel 7. Central Processing Unit 8. User ROM/RAM

MCU Architecture Comparison


CPU Architecture CPU Speed Operating Voltage Address Space FREESCALE 68HSC08 8-bit 48 Mhz 2.7-5.5V 20-bit(1Mbyte) RENESAS R8C 16-bit 20Mhz 3-5.5V 16-bit (64Kbyte)

FREESCALE MC9S08AW60 CPU Register

MC9S08AW60 CPU Register

There are total of 5 register in MCU: i) Accumulator (A) - A general purpose 8-bit register. - Generally, the operand and result of arithmetic and logical operations are stored here. - The content of accumulator can be loaded/stored to memory using various addressing mode. - RESET has no effect on the contents of accumulator. Index Register (H:X) - A 16-bit register which actually made of two separate 8-bit register (H:X). - Act as address pointer, where H holds the upper byte of an address, and X holds the lower byte of an address. - All indexed addressing mode use the value of Index Register as an index reference pointer. - X also can be used as a general purpose 8-bit register to store data. - RESET will force H 0x00, but has no effect on the content of X. Stack Pointer (SP) - A 16-bit address pointer registers that point at the next available location on the stack. - Stack is located at the address space where RAM reside, and take up the size of amount available on RAM. - Stack is used to save the return address of subroutine call, the return address and CPU register during interrupt and local variables. - RESET force the SP to 0x00FF.

ii)

iii)

iv)

Program Counter (PC) - A 16-bit register that contain the address of next instruction or operand to be fetch. - During normal execution, the value of PC automatically increments to the next sequential address after an instruction or operand is fetched. - Change-of-flow can occur when instruction such as jump, branch, interrupt and return , load the program counter with an address other than that of next sequential address. - RESET force the PC to 0xFFFF,0xFFFE, the address which contain the first instruction to be executed after reset.

v)

Condition Code Register - A 8-bit register that contain the interrupt mask, and five flags that indicate the result of the instruction just executed. - Bit 5 and 6 are permanently set to 1.

RENESAS R8C CPU Register

RENESAS R8C CPU Register

There are 8 kind of register in this MCU: i) Data Register (R0, R1, R2 and R3) - R0 to R3 are 16-bit registers used for transfer, arithmetic and logic operations. - R0 and R1 can be split into high order bit and low order bit to be used separately as 8-bit data registers. - R2 can be combined with R0 to be used as 32-bit data register (R2R0), and this same goes to R3R1.

ii)

Address Register (A0 and A1) - Both are 16-bit register used for indirect addressing and relative addressing. - Can also be used as data register for transfer, arithmetic and logic operation. - A0 can be combined with A1 to be used as 32-bit address register.

iii)

Frame Base Register (FB) - A 16-bit register used for frame base relative addressing.

iv)

Interrupt Table Register (INTB) - A 20-bit register indicates the start address of an interrupt vector table.

v)

Program Counter (PC) - A 20-bit register indicate the address of next instruction or operand to be fetched.

vi)

User Stack Pointer (USP) and Interrupt Stack Pointer (ISP) - Both are 16-bit stack pointer.

vii)

Static Base Register (SB) - A 16-bit register for static base relative addressing.

viii)

Flag Register (FLG) - 11-bit register indicating the CPU state.

MCU Memory Map


FREESCALE MC9S08AW60

MC9S08AW60 Memory Map

The figure shows the memory map of MC9S08AW60. There is RAM, non-volatile FLASH memory, I/O, and control/status registers mapped to the address space. The registers are divided into 3 groups: 1) Direct page register ($0000 - $006F) 2) High page register ($1800 - $185F) 3) Non-volatile page register ($FFB0 - $FFBF)

RENESAS R8C

RENESAS R8C Memory Map The MCU provide 1-Mbyte of address space, $00000 SFFFFF, 20-bit of addressing. The internal ROM is used to store program ROM. The $0FFDC - $0FFFF is allocated for fixed interrupt vector table. The internal ROM for data flash is allocated at $02000 - $02FFF. The internal RAM is allocated starting from $00400, depending on the size of RAM. RAM is used to store data, calling subroutines and stack when interrupt is issued. Special Function Registers (SFR) are allocated to $00000 $002FF, which include the peripheral function control registers.

All the space which have nothing allocated to it, are reserved area and cannot be accessed by users.

Addressing Mode
Addressing mode define the way CPU accesses operands and data. Comparing the 2 MCU, FREESCALE MC9S08AW60 and RENESAS R8C, it shows that RENESAS R8C having a bigger addressing space, and has more designed register to support more kind of addressing mode, e.g. the Frame Base addressing mode.

FREESCALE MC9S08AW60
In all HCS08, all memory, status and control registers, and input/output ports share a single 64Kbyte linear address space; hence a 16-bit binary address is sufficient to uniquely identify any memory location. This is convenient to developer because the same instruction used to access RAM can also be used to access other I/O ports, control and status register.

RENESAS R8C
There are varieties of addressing set in RENESAS R8C: 1) General Instruction Addressing - This addressing type is used to access the memory area within $00000 - $0FFFF. 2) Special Instruction Addressing - This addressing type is used to access the memory area within $00000 - $FFFFF. 3) Bit Instruction Addressing - This addressing type is used to access the memory area within $00000 - $0FFFF. - This is used to retrieve the value of a particular bit of a memory area

The following table summarizes the available addressing mode on both MCU: FREESCALE MC9S08AW60 1) Inherent Addressing Mode (INH) 2) Relative Addressing Mode (REL) 3) Immediate Addressing Mode (IMM) 4) Direct Addressing Mode (DIR) 5) Extended Addressing Mode (EXT) 6) Indexed Addressing Mode RENESAS R8C General Instruction Addressing 1) Immediate 2) Register direct 3) Absolute 4) Address register indirect 5) Address register relative 6) SB relative 7) FB relative 8) Stack pointer relative Special Instruction Addressing 1) 20-bit absolute 2) Address register relative with 20-bit displacement 3) 32-bit address register indirect 4) 32-bit register direct 5) Control register direct 6) Program counter relative Bit Instruction Addressing 1) Register direct 2) Absolute 3) Address register indirect 4) Address register relative 5) SB relative 6) FB relative 7) FLG direct

MCU Instruction Set


An instruction set is a set of command that understood by the processor to perform out certain task. Different manufacturer may implement different kind of instruction set on their MCU.

FREESCALE MC9S08AW60
Generally, the instruction set of MC9S08AW60 follow this format: OPCODE $Destination$ $Source$

Instruction Form ADC #opr8i ADC opr8a ADC opr16a ADC oprx16,X ADC oprx8,X ADC ,X ADC oprx16,SP ADC oprx8,SP AND #opr8i AND opr8a AND opr16a AND oprx16,X AND oprx8,X AND ,X AND oprx16,SP AND oprx8,S ASL opr8a ASLA ASLX ASL oprx8,X ASL ,X ASL oprx8,SP CLR opr8a CLRA CLRX CLRH CLR oprx8,X CLR ,X CLR oprx8,SP

Description Add with Carry

Operation A (A) + (M) + (C)

Logical AND

A (A) & (M)

Arithmetic Shift Left (Same as LSL)

Clear

M 0x00 A 0x00 X 0x00 H 0x00 M 0x00 M 0x00 M 0x00

DEC opr8a DECA DECX DEC oprx8,X DEC ,X DEC oprx8,SP DIV

Decrement

Divide

M (M) 0x01 A (A) 0x01 X (X) 0x01 M (M) 0x01 M (M) 0x01 M (M) 0x01 A (H:A)(X) H Remainder M (M) + 0x01 A (A) + 0x01 X (X) + 0x01 M (M) + 0x01 M (M) + 0x01 M (M) + 0x01 PC Jump Address

INC opr8a INCA INCX INC oprx8,X INC ,X INC oprx8,SP 8 JMP opr8a JMP opr16a JMP oprx16,X JMP oprx8,X JMP ,X 9 LDA #opr8i LDA opr8a LDA opr16a LDA oprx16,X LDA oprx8,X LDA ,X LDA oprx16,SP LDA oprx8,SP 10 MOV opr8a,opr8a MOV opr8a,X+ MOV #opr8i,opr8a MOV ,X+,opr8a

Increment

Jump

Load Accumulator from Memory

A (M)

Move

(M)destination (M)source H:X (H:X) + 0x0001 in IX+/DIR and DIR/IX+ Modes

RENESAS R8C
The instruction set of RENESAS R8C MCU is completely different from FREESCALE MCU. Generally it follows the following format: OPCODE.size (:format) source, destination Where, Size - Define the data sizes in which data is handled The following data sizes may be specified: .B Byte (8 bits) .W Word (16 bits) .L Long word (32 bits) Some instructions do not have a size specifier.

Format - Shows the instruction format. If (: format) is omitted, the assembler chooses the optimum specifier. If (: format) is entered, its content is given priority. The following instruction formats may be specified: :G Generic format :Q Quick format :S Short format :Z Zero format Some instructions do not have an instruction format specifier.

1 2 3 4 5 6 7 8 9 10

Instruction Form ADC.size src,dest AND.size (:format) src,dest BCLR (:format) dest DEC.size dest DSUB.size src,dest FSET dest JMP(.length) label LDC src,dest MOV.size (:format) src,dest MUL.size src,dest

Description Addition with carry Logical AND Bit Clear Decrement Decimal Subtract Flag Register Set Jump Load Move Multiply

Operation dest src + dest + C dest src & dest dest 0 dest dest 1 dest dest src dest 1 PC label dest src dest src dest dest x src

Reference:
1. MC9S08AW60 Data Sheet http://www.freescale.com/files/microcontrollers/doc/data_sheet/MC9S08AW60.pdf

2. Renesas R8C Data Sheet http://documentation.renesas.com/doc/products/mpumcu/rej09b0001_r8csm.pdf

You might also like