LOGIN   :::   RECOVER PASS   :::   GET ACCOUNT    
Browse
  • Projects
  • Code (CVS)
  • Forums
  • News
  • Articles
  • Polls
  •  
    OpenCores
  • FAQ
  • CVS HowTo
  • Mission
  • Media
  • Tools
  • Advertise
  • Mirrors
  • Logos
  • Contact us
  • Find Resources
  • Job Opportunity
  •  
    Tools
  • Search
      
  • Download Cores (CVSGet)
  •  
    More
  • Wishbone
  • Perlilog
  • EDA tools
  • OpenTech CD
  •  
    Navigation: All forums > Openrisc > Message List > Message Post

    Message

    Reply | Reply all
    Date Prev | Date Next | Thread Prev | Thread Next Date Index | Thread Index

    From: Robert Cragie<rcc@j...>
    Date: Mon Jun 14 11:06:19 CEST 2004
    Subject: [openrisc] Compiling the source code with large static array size
    Top
    int main()
    {
    int aii[100000];
    ^^^^^^
    This is not a static array; it will be created on the stack, hence the use
    of r1. So it is quite possible you don't have enough stack which is why you
    got the error. Did you mean to do the following?:

    int main()
    {
    static int aii[100000];

    Robert Cragie, Design Engineer
    _______________________________________________________________
    Jennic Ltd, Furnival Street, Sheffield, S1 4QT, UK
    http://www.jennic.com Tel: +44 (0) 114 281 2655
    _______________________________________________________________

    > -----Original Message-----
    > From: openrisc-bounces@o...
    > [mailto:openrisc-bounces@o...]On Behalf Of
    > y_chi_wai2003@y...
    > Sent: 14 June 2004 08:48
    > To: openrisc@o...
    > Subject: [openrisc] Compiling the source code with large static array
    > size
    >
    >
    > Dear all,
    > I encounterred a problem when compiling the source code using or32-
    > gcc and simulating in or32 simulator.
    >
    > When I created a large static array , e.g :
    >
    > int main()
    > {
    > int aii[100000];
    > int i;
    >
    > for (i=0 ; i<100000; i ++)
    > {
    > aii[i+1]
    > }
    > ........
    > return 0;
    > }
    >
    > After compiled the source code and got the Assembley code :
    >
    > 00002000 <_main>:
    > 2000: 19 60 00 01 l.movhi r11,0x1
    > 2004: a9 6b 3a 30 l.ori r11,r11,0x3a30
    > 2008: e0 21 58 02 l.sub r1,r1,r11
    > 200c: d4 01 48 00 l.sw 0x0(r1),r9
    > 2010: d4 01 50 04 l.sw 0x4(r1),r10
    > 2014: d4 01 60 08 l.sw 0x8(r1),r12
    > 2018: d4 01 70 0c l.sw 0xc(r1),r14
    > 201c: d4 01 80 10 l.sw 0x10(r1),r16
    > 2020: d4 01 90 14 l.sw 0x14(r1),r18
    > 2024: d4 01 a0 18 l.sw 0x18(r1),r20
    > 2028: d4 01 b0 1c l.sw 0x1c(r1),r22
    >
    > .....................
    >
    > The series of l.sw instructions were not belong to my "for loop".
    > While did simulation until the instruction "l.sw 0x0(r1),r9",
    > the value of
    > register "r1" became very large (== fffff2e8). The simulation gave error
    > message "EXCEPTION: write out of memory (32-bit access to fffff2ec)"
    >
    > Do anyone know the use of these l.sw instructions ? And how to limit
    > the register "r1" 's value not become too large during compilation ?
    >
    > Thank you very much !
    >
    > Regards,
    > Yu Chi Wai
    > _______________________________________________
    > http://www.opencores.org/mailman/listinfo/openrisc
    >

     
    Copyright (c) 1999 OPENCORES.ORG. All rights reserved.