OpenCores
URL https://opencores.org/ocsvn/an-fpga-implementation-of-low-latency-noc-based-mpsoc/an-fpga-implementation-of-low-latency-noc-based-mpsoc/trunk

Subversion Repositories an-fpga-implementation-of-low-latency-noc-based-mpsoc

[/] [an-fpga-implementation-of-low-latency-noc-based-mpsoc/] [trunk/] [mpsoc/] [src_processor/] [aeMB/] [sw/] [aemb/] [stack.hh] - Diff between revs 17 and 48

Show entire file | Details | Blame | View Log

Rev 17 Rev 48
Line 34... Line 34...
  /**
  /**
  Reads the size of the memory space allocated for the stack in bytes.
  Reads the size of the memory space allocated for the stack in bytes.
  @return size of stack
  @return size of stack
  */
  */
 
 
  inline int aembGetStackSize()
  static inline int aembGetStackSize()
  {
  {
    int tmp;
    int tmp;
    asm ("la %0, r0, _STACK_SIZE":"=r"(tmp));
    asm ("la %0, r0, _STACK_SIZE":"=r"(tmp));
    return tmp;
    return tmp;
  }
  }
Line 47... Line 47...
  Reads the end of the memory space allocated for the stack. This is
  Reads the end of the memory space allocated for the stack. This is
  where the stack ends.
  where the stack ends.
  @return end of stack
  @return end of stack
  */
  */
 
 
  inline int aembGetStackEnd()
  static inline int aembGetStackEnd()
  {
  {
    int tmp;
    int tmp;
    asm ("la %0, r0, _stack_end":"=r"(tmp));
    asm ("la %0, r0, _stack_end":"=r"(tmp));
    return tmp;
    return tmp;
  }
  }
Line 60... Line 60...
  Reads the top of the memory space allocated for the stack. This is
  Reads the top of the memory space allocated for the stack. This is
  where the stack starts.
  where the stack starts.
  @return top of stack
  @return top of stack
  */
  */
 
 
  inline int aembGetStackTop()
  static inline int aembGetStackTop()
  {
  {
    int tmp;
    int tmp;
    asm ("la %0, r0, _stack":"=r"(tmp));
    asm ("la %0, r0, _stack":"=r"(tmp));
    return tmp;
    return tmp;
  }
  }
Line 72... Line 72...
  /**
  /**
  Reads register R1 which is the designated stack pointer.
  Reads register R1 which is the designated stack pointer.
  @return stack pointer
  @return stack pointer
  */
  */
 
 
  inline int aembGetStack()
  static inline int aembGetStack()
  {
  {
    int tmp;
    int tmp;
    asm ("addk %0, r0, r1":"=r"(tmp));
    asm ("addk %0, r0, r1":"=r"(tmp));
    return tmp;
    return tmp;
  }
  }
Line 85... Line 85...
  Sets register R1 to the new stack pointer.
  Sets register R1 to the new stack pointer.
  @param stk new stack pointer
  @param stk new stack pointer
  @return new stack pointer
  @return new stack pointer
  */
  */
 
 
  inline int aembSetStack(int stk)
  static inline int aembSetStack(int stk)
  {
  {
    asm ("addk r1, r0, %0"::"r"(stk));
    asm ("addk r1, r0, %0"::"r"(stk));
    return stk;
    return stk;
  }
  }
 
 
Line 98... Line 98...
     @param newp new stack pointer
     @param newp new stack pointer
     @param oldp old stack pointer
     @param oldp old stack pointer
     @param endp end of the stack
     @param endp end of the stack
  */
  */
 
 
  inline void aembDupStack(unsigned int *newp, unsigned int *oldp, unsigned int *endp)
  static inline void aembDupStack(unsigned int *newp, unsigned int *oldp, unsigned int *endp)
  {
  {
    while (oldp < endp)
    while (oldp < endp)
      {
      {
        // copy the stack content
        // copy the stack content
        *newp = *oldp;
        *newp = *oldp;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.