3 using the stack segment for data storage – Jameco Electronics Rabbit 3000 User Manual

Page 38

Advertising
background image

User’s Manual

29

not have split I and D space and memory accesses to these segments do not distinguish
between I and D space.

The advantage of having more root code space is that root code executes faster because
short calls using a 16 bit address are used to call it. This compares to long calls that have a
20 bit address for extended code. Data located in the root can be more conveniently
accessed due to the comparatively limited instructions available for accessing data in the
full 20 bit space and the greater overhead involve in manipulating 20 bit addresses in a
processor that has 8 and 16 bit registers.

3.2.3 Using the Stack Segment for Data Storage

Another approach to extending data memory is to use the stack segment to access data,
placing the stack in the data segment so as to free up the stack segment. This approach
works well for a software system that uses data groupings that are self-contained and are
accessed one at a time rather than randomly between all the groupings. An example would
be the software structures associated with a TCP/IP communication protocol connection
where the same code accesses the data structures associated with each connection in a pat-
tern determined by the traffic on each connection.

The advantage of this approach is that normal C data access techniques, such as 16-bit
pointers, may be used. The stack segment register has to be modified to bring the data
structure into view in the stack segment before operations are performed on a particular
data structure. Since the stack has to be moved into the data area, it is important that the
number of stacks required be kept to a minimum when using the stack segment to view
data. Of course, tasks that don’t need to see the data structures can have their stack located
in the stack segment. Another possibility is to have a data structure and a stack located
together in the stack segment, and to use a different stack segment for different tasks, each
task having its own data area and stack bound to it.

These approaches are shown in Figure 3-7 below.

Advertising
This manual is related to the following products: