goto

Position program counter to specified location in project code

Syntax

goto(cc,'functionname')
goto(ff)
goto(ff,'input1',value1,...,'inputn',valuen)

Description

goto(cc,'functionname') opens the source file in CCS that contains functionname and positions the cursor at the beginning of functionname. Using goto can help you locate and work with a file that contains a specific function without searching through all the files.

goto(ff) positions the program counter to the beginning of the function accessed by ff. Using goto in this syntax prepares the function to be executed but does not place any information in the registers associated with the function. Before you use this form of goto, you can pass the necessary values for the function input arguments into the appropriate registers and stack locations. You can do this whether the function has input parameters or not.

In the following sections, you see the registers and memory locations on each processor that are affected by preparing to run the function.

C28x™ Family Input Argument Storage Allocation

C28x™ processors interpret and store input argument data in a way quite different from the other TI processors.

The processor first checks the sizes of the function input arguments. After determining which inputs are 32-bit, pointers, and 16-bit arguments, the processors starts to allocate storage for the data.

Having sorted the input arguments by data size and type, the processor starts to allocate storage by handling the 32-bit arguments. The processor places the first 32-bit input argument (either long or float data types) into the accumulator, registers AH and AL. Other 32-bit input arguments, if any, get stored on the stack.

Next come the pointer input arguments. The first and second pointer input arguments go to registers XAR4 and XAR5. If the function prototype uses more than two pointers as input arguments, the remaining pointers go on the stack.

Finally, the processor treats the 16-bit input arguments. Where 16-bit arguments (ints) go depends on the number and kind of other input arguments to the function. The first four 16-bit inputs go into AH, AL, XAR4, and XAR5, in that order, if the registers are available.

But recall that 32-bit inputs go into AL and AH, and pointers go into XAR4 and XAR5. So, 16-bit input arguments go into any empty location among AL, AH, XAR4, and XAR5. Remaining 16-bit arguments go on the stack.

To make this a bit more clear, this short example uses five input arguments to function function. Input arguments a and c are 32-bit arguments, b is a pointer, and d and e are 16-bit arguments. For a function like this one

void function(a,b,c,d,e)

the compiler allocates the input arguments in the order shown in the following list:

  1. a goes into register AH. It is the first 32-bit input argument.

  2. c goes into register AL. It is the second 32-bit input argument.

  3. b, the first pointer, goes into XAR4

  4. d, the first 16-bit argument, goes into XAR5

  5. e, the second 16-bit argument, goes on the stack, because AH, AL, XAR4, and XAR5 are full.

For this example, additional input arguments, if there were any, would go on the stack.

C54x™ Family Input Argument Storage Allocation

ArgumentRegisterFor Long ArgumentsDescription

value1

A

A

First input value to function

value2 and higher

Stack

Stack

All input arguments after the tenth argument get placed on the stack

Returned Argument

A

A

Returned argument

C6000™ Family Input Argument Storage Allocation

ArgumentRegisterFor Long ArgumentsDescription

value1

A4

A5:A4

First input value to function

value2

B4

B5:B4

Second input value to function

value3

A6

A7:A6

Third input value to function

value4

B6

B7:B6

Fourth input value to function

value5

A8

A9:A8

Fifth input value to function

value6

B8

B9:B8

Sixth input value to function

value7

A10

A11:A10

Seventh input value to function

value8

B10

B11:B10

Eighth input value to function

value9

A12

A13:A12

Ninth input value to function

value10

B12

B13:B12

Tenth input value to function

value11 and higher

Stack

Stack

All input arguments after the tenth argument get placed on the stack.

Pointer to returned structure

A3

N/A

Pointer

Return address register

B3

N/A

Address of register

Returned argument

A4

A5:A4

Returned argument

Data page pointer (DP)

B14

N/A

Specifies the data page. Always 1 for the C6000™ processor family.

Frame Pointer (FP)

A15

N/A

Specifies the frame pointer location

Stack Pointer (SP)

B15

N/A

Specifies the stack pointer location

goto(ff,'input1',value1,...,'inputn',valuen) positions the PC to the beginning of the function accessed by ff, and sets the function input arguments input1 through inputn to the values value1 through valuen, as provided in the goto syntax. The order of the input names and values is not important; it does not need to match the order of the input arguments in the function prototype or declaration. input1 through inputn can be either the names of the input arguments, or the number of the input argument in the argument list, such as 1 for the first argument, 2 for the second, up to n for the nth argument on the list.

See Also

delete, execute, insert, run

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS
 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS