Search the web
Sign In
New User? Sign Up
leon_sparc · LEON SPARC
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want your group to be featured on the Yahoo! Groups website? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Running test program on leon in modelsim   Message List  
Reply | Forward Message #12106 of 16617 |
Re: [leon_sparc] Running test program on leon in modelsim


You do not want to simulate a mkprom image in VHDL, trust me.
Even the smallest image will execute ~ 1,000,000 instructions
before entering main() in RAM. This is only ~ 30 ms on real
hardware at 50 MHz, but ~ 10 hours in VHDL (on a fast host).

You can easily see in TSIM how many instructions you will need:

sparc-elf-gcc -msoft-float hello.c -o hello.exe -lsmall
sparc-elf-mkprom hello.exe -nocomp -nomsg

tsim-leon3 prom.out
.
.
section: .text, addr: 0x0, size 34304 bytes
read 103 symbols
tsim> bre 0x40000000
breakpoint 1 at 0x40000000: .bdata
tsim> run
breakpoint 1 .bdata
tsim> per

Cycles : 1399497
Instructions : 906783
Overall CPI : 1.54

CPU performance (50.0 MHz) : 32.40 MOPS (32.40 MIPS, 0.00 MFLOPS)
Cache hit rate : 98.7 % (100.0 / 80.0)
AHB bandwidth utilisation : 33.7 % ( 0.4 / 33.3)
Simulated time : 27.99 ms
Processor utilisation : 100.00 %
Real-time performance : 11.86 %
Simulator performance : 3843.69 KIPS
Used time (sys + user) : 0.24 s


So even if we created the smallest possible binary using -lsmall
and fastest mkprom loading with -nomsg and -nocomp, you will need
to execute 906,783 instructions to get to RAM, and then maybe an
other 10,000 to get to main(). This is why the test bench in leon3
designs does NOT use mkprom, but a simple assembly reset sequence
and a pre-loaded RAM image...

Jiri.


sacliv wrote:
> Hey guys, I'm trying to load a test c program i wrote on the leon3 in
> the vhdl leon3 code and run it in modelsim to view the waveforms.
>
> I followed the bcc manual and did mkprom on my executable, and then i
> copied the .srec file to the testbench directory, and in the
> testbench.vhd, i changed the filename of the prom.srec to test.srec,
> which is my srec file.
>
> The test program is very simple and just prints out hello world, but
> in the modelsim simulation of the leon3, i'm watching the pc and
> instructions of the leon3 core, but i can't seem to get to my test
> program.
>
> Does anyone know either how long i have to simulate it until before i
> get to main() in my test program? Or if i'm doing it wrong, what's the
> correct procedure? Thanks!
>
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>



Wed Oct 17, 2007 10:47 pm

jiri_gaisler
Offline Offline
Send Email Send Email

Forward
Message #12106 of 16617 |
Expand Messages Author Sort by Date

Hey guys, I'm trying to load a test c program i wrote on the leon3 in the vhdl leon3 code and run it in modelsim to view the waveforms. I followed the bcc...
sacliv
Offline Send Email
Oct 17, 2007
10:24 pm

You do not want to simulate a mkprom image in VHDL, trust me. Even the smallest image will execute ~ 1,000,000 instructions before entering main() in RAM. This...
Jiri Gaisler
jiri_gaisler
Offline Send Email
Oct 17, 2007
10:46 pm

Wow that's good to know. So is there a way to easily simulate my test code using the leon3 VHDL code?...
sacliv
Offline Send Email
Oct 17, 2007
10:51 pm

See how the test bench is compiled by doing 'make soft' in the template design directory. The final command will be: sparc-elf-gcc -I../../software/leon3 -O2...
Jiri Gaisler
jiri_gaisler
Offline Send Email
Oct 17, 2007
10:57 pm

Wow thanks a lot! I will try this!! ... -L./ lib3tests.a -o systest.exe ... leon3 in ... then i ... before i ... what's the...
sacliv
Offline Send Email
Oct 17, 2007
10:58 pm

So I loaded my sram.srec into the VHDL, but it seems like it still takes a while. The compiled code itself contains a lot of setup code. I used objdump to see...
sacliv
Offline Send Email
Oct 18, 2007
6:51 am

You can run your code from PROM for fastest run-time. Copy prom.S from software/leon3 to you local template design, and do 'make soft'. Then, add your...
Jiri Gaisler
jiri_gaisler
Offline Send Email
Oct 18, 2007
6:58 am

In the VHDL simulation, it starts GRLIB system test starting, and then it seems to test a lot of things, if i disable the multiplier, divider and some other...
sacliv
Offline Send Email
Oct 18, 2007
7:17 am

Hi, Jiri mentioned 1000,000 instructions in the booting process before it reaches the use's program, is this correct ? One million ? ... BR, S Eldin ... code. ...
Sherif Eldin
s_eldin00
Offline Send Email
Feb 12, 2008
4:44 pm

Yes. You can run you prom image in tsim and then see how many instructions were executed ... Jiri....
Jiri Gaisler
jiri_gaisler
Offline Send Email
Feb 12, 2008
9:55 pm

I tried that. The weird thing was that the instruction i inserted was not ran when i simulated in modelsim. I can see it in prom.srec, i can see it if i do a...
sacliv
Offline Send Email
Oct 18, 2007
9:01 am

Post the disassembly output from modelsim so we can see which instructions are executed. Jiri....
Jiri Gaisler
jiri_gaisler
Offline Send Email
Oct 18, 2007
9:07 am

# ** Warning: (vsim-WLF-5000) Log file vsim.wlf currently in use. # File in use by: Administrator Hostname: ISAACLIU-C7CF6F ProcessID: 1956 #...
sacliv
Offline Send Email
Oct 18, 2007
9:18 am

... The prom.srec you are using for simulation does obviously not contain your new instructions, you can see that from the addresses in the log. Check the...
Jiri Gaisler
jiri_gaisler
Offline Send Email
Oct 18, 2007
9:25 am

How do i check that? because when i am in simulation, and i look in the memory debugger in modelsim, when i look into the prom0 of the program, i do see those...
sacliv
Offline Send Email
Oct 18, 2007
9:29 am

Trace the external memory bus and check that you are not executing from internal AHB ROM. In the later case, you will need to update the AHB ROM image and...
Jiri Gaisler
jiri_gaisler
Offline Send Email
Oct 18, 2007
9:35 am

In order to run from the external prom.srec, all i need to do is to disable the ahbrom in the config? I think that might be it, it was probably running from...
sacliv
Offline Send Email
Oct 18, 2007
9:55 am

The XUP board does not have flash memory, so the test bench does not implement it. Choose a different template design, such as leon3mp or leon3-gr-xc3s-1500. ...
Jiri Gaisler
jiri_gaisler
Offline Send Email
Oct 18, 2007
10:22 am

ahhh, thanks a lot. I will need that eventually to load programs. For temporary debugging just the instruction, i have added it to the ahbrom.vhd. And i was...
sacliv
Offline Send Email
Oct 18, 2007
10:26 am

Here you can find more details: http://www.buttelmann.de/leon/leon3_simulation_guide_0_2.pdf <http://www.buttelmann.de/Leon/leon3_simulation_guide_0_2.pdf> ......
but5693
Offline Send Email
Oct 18, 2007
8:33 am

Thanks. The document looks good. However, i did that and it seems like it took a really long time to run, not just 9 minutes and 2 minutes....
sacliv
Offline Send Email
Oct 18, 2007
8:55 am

How big is your SW? A simple hello world programm compiled with mkprom should be about 23KB. You disable compression? sparc-elf-mkprom.exe -rmw -nocomp...
but5693
Offline Send Email
Oct 18, 2007
9:08 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help