gnupic: SDCC
Subject:
SDCC
From:
Ralf Forsberg ####@####.####
Date:
13 Nov 2001 11:28:00 -0000
Message-Id: <20011113122622.A488@home.se>
I've been writing a few tests for sdcc, and then bothering Scott
about those that don't work. As I did that I got curious about
how the generated code compared to other compilers.
I tried my "alfa.c" on the pic compilers I could find, and then
measured execution time using gpsim. All compilers are demo versions
downloaded from the web. It may be that the regular versions are better,
but that seems strange.
It may not say much, alfa.c perhaps is not the most 'average' program.
accumulated cycles:
sdcc picc picc -O -Zg9 CCSC sdcc uchar mpc
init 2 0x145 0x143 ? 9
t1 0xc7 0x24a 0x214 0x76 0x5e ?
t2 0x708 0xbae 0x96b 0x46c 0x36c 0x9b3
t3 0x26303 0x3d381 0x2e3cd 0x1f7f6 0x14585 0x3fbbe
init is the number of cycles before the call to test1().
t1 is the number of cycles used from start to after test1 is finished.
t2 is the numb......from start to after test2 is finished.
t3 is the........to after test3 is finished.
cycles used per test:
sdcc picc picc -O -Gz CCSC sdcc uchar mpc
t1 0xc5 0x105 0xd1 0x76- 0x5e- ?
t2 0x641 0x964 0x757 0x3f6 0x30e 0x9aa
t3 0x25bfb 0x3c7d3 0x2da62 0x1fe8a 0x14219 0x3f20b
sdcc does really well. The numbers for CCSC come from the fact that it
defines 'int' as an 8-bit number. So I tried alfa.c using 8-bit vars
and sdcc, and it's smoked. I don't know about the mpc demo, perhaps it's
an old version.
And as for program size:
initialization program total
sdcc 252
picc 58 285 343
ccsc 161
sdccchar 139
mpc 239
mpc beats sdcc here, it seems it's optimized for space. I wonder
how it did so badly in execution time.
It's not yet a fair comparasion since there is a lot of functionality
missing in sdcc, but it shows promise.
I wanted to measure register usage too, but I found that hard to do.
(gpsim could use a coverage feature. )
I wonder if I missed some compiler flags for some program, I really
looked but I could have missed some. If so, or if you know of a better
compiler, then let me know.
alfa.c and the .hex files can be found at http://rfg.myip.org/sdcc/test/
/ Ralf