6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Nov 22, 2024 3:09 am

All times are UTC




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Sun Jan 24, 2021 1:09 pm 
Offline

Joined: Sat Jul 09, 2016 6:01 pm
Posts: 180
I've just published my port of Xlife-8 for the Amiga. Xlife-8 is a cellular automaton laboratory aka Game of Life. Ports for the Commodore +4, Amstrad CPC6128, Electronika BK0011M, IBM PC CGA, and Amiga exist. All these programs share the same algorithms which use a lot of table and bit processing, they also use some BCD calculations. The results are here - so the 6502 shows performance on the 68020 level!

_________________
my blog about processors


Top
 Profile  
Reply with quote  
PostPosted: Sun Jan 24, 2021 4:12 pm 
Offline

Joined: Fri Dec 21, 2018 1:05 am
Posts: 1117
Location: Albuquerque NM USA
I have a Life program running on 128x64 OLED display of my recently designed 6502 SBC. It is a simple program without complicated tables or compression; it also operates at the same speed whether the screen is blank or full of life. I'm curious about the speedup of XLife algorithm which I'm not familiar before reading your post. On a 14.7MHz 6502, my simple Life algorithm takes 158mS per generation, or 6.3 generations per second. Part of the overhead is the bit-bang I2C interface which paints the entire 128x64 screen each generation. It takes 42mS to bit bang a screen, so with better screen update hardware, the simple Life algorithm may be as fast as 116mS/generation. However, since the 128x64 screen is smaller than your example of 126x108, to scale up the problem proportionally would mean the simple algorithm may take 194mS/generation or 5.1 generations/second. Looking at your table for 6502 at 1.11MHz and scale it up to 14.7MHz gives 37.7 generations/sec. So my simple algorithm has great deal of room for improvement, like 7 times!

As for comparing Z80 to 6502, the simple Life program is also running on Z80 and I found 6502 is faster than Z80 clock-for-clock, around 1.8 times faster. This is may be a reflection of my Z80 programming skill (18 months of experience) to my 6502 skill (newbie at 2 weeks of experience).


Top
 Profile  
Reply with quote  
PostPosted: Sun Jan 24, 2021 6:45 pm 
Offline

Joined: Sat Jul 09, 2016 6:01 pm
Posts: 180
plasmo wrote:
I have a Life program running on 128x64 OLED display of my recently designed 6502 SBC. It is a simple program without complicated tables or compression; it also operates at the same speed whether the screen is blank or full of life. I'm curious about the speedup of XLife algorithm which I'm not familiar before reading your post. On a 14.7MHz 6502, my simple Life algorithm takes 158mS per generation, or 6.3 generations per second. Part of the overhead is the bit-bang I2C interface which paints the entire 128x64 screen each generation. It takes 42mS to bit bang a screen, so with better screen update hardware, the simple Life algorithm may be as fast as 116mS/generation. However, since the 128x64 screen is smaller than your example of 126x108, to scale up the problem proportionally would mean the simple algorithm may take 194mS/generation or 5.1 generations/second. Looking at your table for 6502 at 1.11MHz and scale it up to 14.7MHz gives 37.7 generations/sec. So my simple algorithm has great deal of room for improvement, like 7 times!

As for comparing Z80 to 6502, the simple Life program is also running on Z80 and I found 6502 is faster than Z80 clock-for-clock, around 1.8 times faster. This is may be a reflection of my Z80 programming skill (18 months of experience) to my 6502 skill (newbie at 2 weeks of experience).

Thank you for your report. Your skills for the Z80 are definitely better than for the 6502. :) Usually for the 6502:z80 speed ratio we have about 2.5 for high optimized code. The Xlife algorithm is not the best but it is still among the best. Its main advantage is its ability to work with unlimited grid. Its good performance is based on intensive usage of lookup tables. They are tens of kilobytes in original Xlife and they can be gigabytes in the newest Xlife, but Xlife-8 is optimized for 8 bit computers and uses rather smal tables several KB in size. The best GoL algorithm known to me which calculates all grid every pass is one realized in Tomas Rokicki's Life program. It is freely available and inspired some ppl to make their own Life implementations on its base. IRC this algorithm can be about 3 times faster than the Xlife algo for completely filled grids. So it is about 21 times faster than your current implementation. However if you use large patterns they usually do not fill all grid space and Xlife can be faster in those cases. A single glider movement should be also faster in Xlife, than in Tomas Rokicki's Life. For example, Xlife-8 for the Commodore+4 in screen blank mode (the 6502 works at 1.7 Mhz in this case) makes about 290 generations a second for such a single glider.

_________________
my blog about processors


Top
 Profile  
Reply with quote  
PostPosted: Sun Jan 24, 2021 8:11 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10985
Location: England
(Do you have a link to that program of Rokicki's? I see only hlife, which is presumably later than the one you mean.)

BTW this previous thread on 6502 Life implementations might be of interest.


Top
 Profile  
Reply with quote  
PostPosted: Sun Jan 24, 2021 10:06 pm 
Offline

Joined: Fri Dec 21, 2018 1:05 am
Posts: 1117
Location: Albuquerque NM USA
litwr wrote:
Thank you for your report. Your skills for the Z80 are definitely better than for the 6502. :)


Plenty of room for improvement both in my 6502 skill and GoL algorithm. The existing hardware is bounded by the time spent bit-banging the I2C to about 20 generations/sec maximum. Still, it may worth some effort to tweak the 6502 assembly and algorithm to double the generations/sec to 12-15. Thanks for the motivation!
Bill


Top
 Profile  
Reply with quote  
PostPosted: Mon Jan 25, 2021 1:46 pm 
Offline

Joined: Fri Apr 06, 2018 4:20 pm
Posts: 94
litwr wrote:
I've just published my port of Xlife-8 for the Amiga. Xlife-8 is a cellular automaton laboratory aka Game of Life. Ports for the Commodore +4, Amstrad CPC6128, Electronika BK0011M, IBM PC CGA, and Amiga exist. All these programs share the same algorithms which use a lot of table and bit processing, they also use some BCD calculations. The results are here - so the 6502 shows performance on the 68020 level!


I am not surprised as the 68020 can be a bit of a dog - the speed improvement per clock came mostly from the width of the bus and the tiny internal cache. Where a 68000 executed about 1 instruction every 8 ticks, the 68020 improved this to 1 every 6 ticks or so. The fatter bus and higher clock speeds made the speed improvements worth while back in the day, but in retrospect the 68020 really was not a well-optimized chip. Like the 68000 before it the designers focused on features and the speed came as sort of a bonus.

Well I should mention it was much faster for 32-bit operations with a full 32-bit ALU as well, which was important for number crunchers and multimedia.


Top
 Profile  
Reply with quote  
PostPosted: Mon Jan 25, 2021 7:24 pm 
Offline

Joined: Sat Jul 09, 2016 6:01 pm
Posts: 180
BigEd wrote:
(Do you have a link to that program of Rokicki's? I see only hlife, which is presumably later than the one you mean.)

It is here. I have just run it, I set the size of universe to 114x130 and got more than 19 gen/sec for the pattern. It is 2.7 times faster than Xlife-8. This result is when visualization is on. If it is off Rokicki's Life is again 2.7 times faster. :)

rpiguy2 wrote:
I am not surprised as the 68020 can be a bit of a dog - the speed improvement per clock came mostly from the width of the bus and the tiny internal cache. Where a 68000 executed about 1 instruction every 8 ticks, the 68020 improved this to 1 every 6 ticks or so. The fatter bus and higher clock speeds made the speed improvements worth while back in the day, but in retrospect the 68020 really was not a well-optimized chip. Like the 68000 before it the designers focused on features and the speed came as sort of a bonus.

Well I should mention it was much faster for 32-bit operations with a full 32-bit ALU as well, which was important for number crunchers and multimedia.

Based on my experience I can say that the 68020 is about two times faster than the 68000 on the same program. The 68020 can sometimes execute several instructions at once! So the result when the 6502 can almost beat that mighty processor is really fascinating for me. Some people wrote that the Amiga could have been much better with the next generation of the 6502 - http://www.commodore.ca/commodore-histo ... -the-6502/ - it contains a fantastic guess that Commodore could ask Bill Mensch to make a better 6502.

_________________
my blog about processors


Last edited by litwr on Tue Jan 26, 2021 2:59 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Mon Jan 25, 2021 9:34 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10985
Location: England
litwr wrote:
BigEd wrote:
(Do you have a link to that program of Rokicki's? I see only hlife, which is presumably later than the one you mean.)

It is here. I have just run it, I set the size of universe to 114x130 and got more than 19 gen/sec for the pattern. It is 2.7 times faster than Xlife-8. This result is when visualization is on. If it is off Rokicki's Life is again 2.7 times faster. :)

Excellent - thanks. For convenience, I've unpacked the archive and attached as a zip. Looks like a combination of damage flags and keeping three lines of horizontal totals - but that's a bit of a guess.


Attachments:
Rokicki-Life-FF837.zip [81.27 KiB]
Downloaded 58 times
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 17 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: