This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

problem using idata in calculations

Hi,

Is there a problem using idata for variables used in "heavy"calculations ?

( heavy = 3 products 2 sums in a same instruction)

I use microvision 1.30 dll 1.30 C compiler v5.20

In my program some calculations produce good results when used with data and wrong and changeant results when used with idata.



Thanks.
Gregory.

Parents
  • Really? It srikes me as a bit strange that the compiler doesn't use the stack for parameter passing or local variables 'due to limitations of the 8051 architecture', however it appears that it arbitrarily and silently pushes whatever quantity of stuff it likes on the stack during evaluation of a complex expression.

    If the compiler used the stack for local variables and function arguments, it would need a way to reference those objects on the stack. It would need a base pointer. R0 or R1 would be required for that.

    That would leave only 7 registers to be used in the function. Operations with floats or with longs could no longer be performed entirely in registers (like they are now).

    ALL local variables and function arguments would take longer to access (because indirect accesses are slower on the 8051 then direct accesses). This would slow down ALL programs and would ultimately require more stack space than is used by the current scheme.

    As it is, you are only penalized (more stack space required) for complex expressions.

    Jon

Reply
  • Really? It srikes me as a bit strange that the compiler doesn't use the stack for parameter passing or local variables 'due to limitations of the 8051 architecture', however it appears that it arbitrarily and silently pushes whatever quantity of stuff it likes on the stack during evaluation of a complex expression.

    If the compiler used the stack for local variables and function arguments, it would need a way to reference those objects on the stack. It would need a base pointer. R0 or R1 would be required for that.

    That would leave only 7 registers to be used in the function. Operations with floats or with longs could no longer be performed entirely in registers (like they are now).

    ALL local variables and function arguments would take longer to access (because indirect accesses are slower on the 8051 then direct accesses). This would slow down ALL programs and would ultimately require more stack space than is used by the current scheme.

    As it is, you are only penalized (more stack space required) for complex expressions.

    Jon

Children
No data