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: Matjaz Breskvar<phoenix@o...>
    Date: Mon Jun 14 10:24:52 CEST 2004
    Subject: [openrisc] Compiling the source code with large static array size
    Top
    * y_chi_wai2003@y... (y_chi_wai2003@y...) wrote:
    > 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 !

    you busted the stack. aii[100000] was allocated on stack, but there wasn't
    that much space. (stack grows down)... try enlarging the stack
    or use dynamic allocation...

    regards,
    p.

    ReferenceAuthor
    [openrisc] Compiling the source code with large static array sizeY_chi_wai2003

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