14
Rabbit
2000
Microprocessor
cannot
execute from flash. In some cases the RAM may require fewer wait states so code
executes
faster if copied to RAM.
4.1.3
The Stack Segment
The
stack segment normally is from 52K to 56K. It is mapped to RAM and holds the sys-
tem
stack. If there are multiple stacks then multiple mappings with multiple stacks in each
mapping
can be used. For example if 16 stacks of 1k length are needed then 4 stacks can
be
placed in each 4k mapping and 4 different mappings for the window can be used.
4.1.4
The Extended Memory Segment
This
8K segment from 56K to 64K is used to execute extended code and it is also used by
routines
that manipulate data located in extended memory. While executing code the map-
ping
is shifted by 4K each time the code passes the 60K point. Large code can be effi-
ciently
executed while using up only 8K of 16-bit addressing space.
4.2
How The Compiler Compiles to Memory
The
compiler actually generates code for root code, constants, extended code and
extended
constants. It allocates space for data variables, but, except for constants, does not
generate
data to be stored in memory. Any initialization of variables must be accom-
plished
by code since the compiler is not present when the program starts in the field.
In
any but the smallest programs, most of the code is compiled to extended memory. This
code
executes in the 8K window from E000 to FFFF. This 8K window uses paged access.
Instructions
that use 16-bit addressing can jump within the page and also outside of the
page
to the remainder of the 64K logical space. Special instructions, particularly
lcall,
ljp
,
and
lret
,
are used to access code outside of the 8K window. When one of these
transfer-of-control
instructions is executed, both the address and the view through the 8K
window
change, allowing transfer to any instruction in the 1M physical memory space.
The
8-bit XPC register controls which of two consecutive 4K pages the 8K window aligns
with
(there are 256 pages.) The 16-bit PC controls the address of the instruction, usually
in
the region E000 to FFFF. The advantage of paged access is that most instructions con-
tinue
to use 16-bit addressing. Only when a page change is needed does a 20-bit transfer
of
control need to be made.
As
the compiler compiles code in the extended code window, it checks at opportune times
to
see if the code has passed the midpoint of the window or F000. When the code passes
F000,
the compiler slides the window down by 4K so that the code at F000+x becomes
resident
at E000+x. This automatic paging results in the code being divided into segments
that
are typically 4K long, but which can be very short or as long as 8K. Transfer of con-
trol
within each segment can be accomplished by 16-bit addressing. Between segments,
20-bit
addressing is required.
Summary of Contents for 2000
Page 1: ...Rabbit 2000 Microprocessor Designers Handbook Revision C...
Page 4: ...Rabbit 2000 Microprocessor...
Page 6: ...2 Rabbit 2000 Microprocesssor...
Page 12: ...8 Rabbit 2000 Microprocessor...
Page 34: ...344 Dynamic C User s Manual...
Page 36: ...34 Rabbit 2000 Microprocessor...
Page 44: ...42 Rabbit 2000 Microprocessor...