3.9.3
Programming example
The conditions listed in this table apply the following programming examples.
No.
Used as
(a)
Main
Routine
(b)
Character-
ROM
(c)
Subroutine
(d)
Stack-
RAM
(a) Main Routine (COMMON-Z)
Logical
Physical
Address
Address
C00000H
<-(Same)
C000xxH
<-
C000yyH
<-
•
The instructions No.2 through No.8 configure external pins and the Memory Controller.
•
The instruction No.9 specifies the stack pointer value. The stack pointer is herein
specified to point to the memory location in on-chip RAM.
•
The instruction No.10 configures the setting used for a subroutine call instruction of
No.12.
•
The instruction No.12 calls a subroutine. When the CPU generates the address 400000H,
the MMU translates it to the physical address 000000H, which is then placed onto the
external address bus: A23 to A0. Since the logical address is within the address range of
the CS1 space,
the program execution of the CPU can be branched to the subroutine.
Note: This example assumes that the subroutine program is already written into SRAM.
Memory
Setting
NOR-Flash
CSZA ,
(16 MB, 1 pcs)
32 bit,
1 wait state
CS ,
SRAM
16 bit,
(16 MB, 1 pcs)
0 wait state
−
On-chip-RAM
(144KB)
(32 bit, 2-1-1-1clk)
Instruction
Instruction
No.
1
org
C00000H
2
ldw
(mamr2),80FFH
3
ldw
(b2csl), C222H
4
ldw
(mamr1),40FFH
5
ldw
(b1csl), 8111H
5.1
ldw
(localpz),8000H
5.2
ldw
(localrz),8000H
6
ld
(p8fc), 02H
7
ld
(p8fc2), 04H
9
ld
xsp,48000H
10
ldw
(localpy),8000H
11
:
12
call
400000H
13
:
14
:
15
:
for SRAM is asserted at the same time. By using these instructions,
CS
1
92CF30-187
MMU area
COMMON-Z
Bank 0 in
LOCAL-Z
Bank 0 in
1
LOCAL-Y
Bank 2 in
LOCAL-Y
;
; CS2 800000-FFFFFF/8MB
; CS2 32-bit ROM, 1 wait state
; CS1 400000-7FFFFF/4MB
; CS1 16-bit RAM, 0 wait state
; Enable LOCAL-Z bank for program
; Enable LOCAL-Z bank for read-data
; P81:
; P82:
; Stack Pointer = 48000H
; Bank 0 in LOCAL-Y is configured as the
program bank for subroutines
;
; Call a subroutine
;
;
;
TMP92CF30
Logical
Physical
address
address
C00000H to
FFFFFFH
800000H to
000000H to
BFFFFFH
3FFFFFH
400000H to
000000H to
5FFFFFH
1FFFFFH
002000H to
049FFFH
Comment
CS
1
2009-06-12