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: brantley@m...
    Date: Sun, 20 Apr 2003 06:44:32 -0100
    Subject: Re: [openrisc] Problem with jump behavior
    Top

    As often seems to happen, when I post a message I figure out what the
    problem was. The problem had nothing to do with gcc or the simulation.
    I did not have the memory clock set correctly. Once I changed that and
    the jumps behaved properly.
    
    Sorry about that,
    Damon
    
    ----- Original Message ----- 
    From: "Damon Brantley" <brantley@m... > 
    To: openrisc@o...  
    Date: Sat, 19 Apr 2003 23:18:36 -0500 
    Subject: [openrisc] Problem with jump behavior 
    
    > 
    > 
    > I am getting started with experimenting with openrisc. I pulled 
    > down and 
    > built the 
    > binutils and gcc for use with cygwin. I am using the ModelSim 
    > simulator 
    > that comes 
    > with the Xilinx WebPack. 
    > 
    > While experimenting with some very simple  c programs, it looks 
    > like my 
    > jumps are off 
    > by one instruction. 
    > 
    > A test program I have been working with is: 
    > void main(){ 
    > 	int i=0; 
    > 	while(1){ 
    > 		i=i+1; 
    > 	} 
    > } 
    > 
    > The disassembly is 
    > 
    > 00010000 <_start>: 
    >    10000:       18 20 00 00     l.movhi r1,0x0 
    >    10004:       a8 21 00 10     l.ori r1,r1,0x10 
    >    10008:       00 00 00 04     l.j 10018 <_main> 
    >    1000c:       15 00 00 00     l.nop 0x0 
    >    10010:       15 00 00 00     l.nop 0x0 
    >    10014:       03 ff ff fb     l.j 10000 <_start> 
    > 
    > 00010018 <_main>: 
    >    10018:       9c 21 ff f8     l.addi r1,r1,0xfffffff8 
    >    1001c:       d4 01 10 00     l.sw 0x0(r1),r2 
    >    10020:       9c 41 00 08     l.addi r2,r1,0x8 
    >    10024:       9c 60 00 00     l.addi r3,r0,0x0 
    >    10028:       d7 e2 1f fc     l.sw 0xfffffffc(r2),r3 
    >    1002c:       84 62 ff fc     l.lwz r3,0xfffffffc(r2) 
    >    10030:       9c 63 00 01     l.addi r3,r3,0x1 
    >    10034:       d7 e2 1f fc     l.sw 0xfffffffc(r2),r3 
    >    10038:       03 ff ff fd     l.j 1002c <_main+0x14> 
    >    1003c:       15 00 00 00     l.nop 0x0 
    >    10040:       84 41 00 00     l.lwz r2,0x0(r1) 
    >    10044:       44 00 48 00     l.jr r9 
    >    10048:       9c 21 00 08     l.addi r1,r1,0x8 
    > 
    > 
    > What I am seeing in the simulator is when a the jump at 10008 is 
    > executed, 
    > instead of seeing iwb_adr_o going to 
    > 10018, I am seeing it go to 1001c. 
    > 
    > In this case the program simulates as expected, but when I add 
    > function 
    > calls the test programs fail because 
    > the first instruction is missed, which is usually setting up a 
    > stack frame. 
    > 
    > This is what I am using for building my test program: 
    > 
    > /opt/or32-uclinux/bin/or32-uclinux-gcc  -g -Wa,-a=crt0.asm  -c -o 
    > crt0.or32 
    > crt0.S 
    > /opt/or32-uclinux/bin/or32-uclinux-gcc  -g -Wa,-a=test1.asm  -c -o 
    > test1.or32 test1.c 
    > /opt/or32-uclinux/bin/or32-uclinux-ld  -Ttext 10000 -Tdata 20 -o 
    > test1.bin 
    > crt0.or32 test1.or32 
    > 
    > Am I missing a compile or link flag or is model sim possibly doing 
    > the 
    > simulation wrong. 
    > 
    > Thanks, 
    > Damon 
    > 
    
    
    
     
    Copyright (c) 1999 OPENCORES.ORG. All rights reserved.