Page 1 of 2
Parallel Processing with 6502s
Posted: Tue Feb 03, 2004 10:36 pm
by asm_2750
Is it possible to do parallel processing with 6502s?
Posted: Wed Feb 04, 2004 4:42 am
by GARTHWILSON
Alright, since nobody else has jumped in--
Is it possible to do parallel processing with 6502s?
Sure. It seems like we've talked about that on the forum, but I can't find it now.
One way to do it would be to use dual-port memory for two processors. I've never heard of memory with more than two ports though if you wanted to have three or more processors using it.
There has been some talk of having two processors running on oposite phases of the system clock so they can each access things on the bus in turn, similar to how the Apple II did the video. (The processor accessed memory during the usual phase-2-high time and the video could access the same memory during the phase-2-low time, so both could access the same memory seemingly at the same time without slowing down and without using dual-port memory.) Actually you could have multiple non-overlapping clocks, each with the duty cycle being a little less than the inverse of the number of processors you wanted to have sharing the same memory. Obviously there's a speed penalty though.
Of course one thing you can do is to offload some I/O jobs from the main processor onto microcontrollers that are fine for tiny jobs but can't handle the overall job. For example, if you had to do a ton of bit-banging to keep an SMBus serial interface busy with a 6502, it might be better to just interface to a PIC microcontroller and let the PIC babysit the SMBus interface while the 6502 does something else productive.
But if you really want several 6502's working in parallel, I think you'd be better off making separate computers, even if they're on the same board, and making some kind of miniature network to tie them together.
The one thing I don't know how to deal with is how to split up jobs between the various processors such that the "administrative" overhead and all the communicating between computers doesn't take up so much of the time that you lose the performance advantage you had hoped to gain in having parallel processors. I suppose it depends on what kind of work you want to do with the system. Maybe the administrative overhead would eat up a pretty small percentage of the gains if you want to do something like Fourier transforms on large arrays. Then each separate computer could take its job and go off in its corner and not bother the master computer for a long time. This is one subject I'd like to hear more of from someone experienced with multiprocessor programming. (Edit: Andre Fachat answered this in post #17 of this topic.)
Posted: Wed Feb 04, 2004 10:21 pm
by dlowry
I have a Rockwell databook from 1984 or so that has advance information on a part (6529?) with two '02 cores operating out of phase. That would have been a fun part. Anybody know if these saw the light of day?
-Dave
Posted: Thu Feb 05, 2004 6:03 am
by Memblers
I wrote some multi-processor code.. sort-of.
On an SNES program, I had 2 CPUs doing distinct parts of the same task. In this case, it was necessary. The main CPU (a 65816) was running music playing code that results in about 16 bytes of data (control data for a synth).
Then it would sync with the co-CPU that controls the sound in that system (it's very similar to a 6502, but with MOV instead LDx), transfer those bytes, and I had the co-CPU decode that data and translate it to the right format for the soundchip.
This way of doing I guess would be good if you're doing something that can be broken cleanly into distinct tasks like that. It's more like writing 2 seperate programs.. maybe not what you have in mind.
BTW, about simulating dual-port RAM, there've been some interesting posts about that on the nesdev forum:
http://nesdev.parodius.com/cgi-bin/wwwt ... b=#Post802
Posted: Sat Feb 07, 2004 9:01 pm
by Nightmaretony
Common memory shared with multipel processors sort of urinates me off as I have to deal with this arcade game called Galaga whihc uses 3 seperate Z80s tied into a single 2K RAM memory which is a common memory for both.
The system is amazingly touchy and likes to use capacitor delays for critical RAM timing. I designed an adapter to help out with the one issue, but overall, I think of it as a fairly lousy design.
If one were to do multiple CPUs, I WOULD like to esee each cPU have its own RAM and RO:M system for their tasks, and the coomon RAM to be used to commands and data rather than critical zero page and internal variables for the CPUs. This way also, if any of the processors drop out, it doesnt drive the entire system crazy. You can put in code to handle such events.
Posted: Mon Feb 09, 2004 10:19 pm
by asm_2750
So kinda sorta like a beowulf cluster (i.e mutiple computers hooked up to make one big one). Thats an easier way to do parallel processing in my opinion, since each processor has its own ram and rom. Although the idea of a shared common ram is sorta beyond me at the moment.
Posted: Sat Feb 14, 2004 4:40 am
by Lyos Gemini Norezel
Hey ya'll... I had a thought on this... could the 6522's be used as the interface for multiple cpu's? Like just jerryrigging a connection between a two or more 6522's and it would almost be like connecting two computer via a serial port or the like right?
Lyos Gemini Norezel
Posted: Sat Feb 14, 2004 8:20 am
by GARTHWILSON
Right, but it's not necessarily jerryrigging at all.
Posted: Sun Feb 15, 2004 8:21 pm
by Lyos Gemini Norezel
Ye... I know... but for me the term "jerryrigging" is used for anything built by amatures and not by factories or the like.
Lyos Gemini Norezel
Posted: Sun Feb 29, 2004 6:47 pm
by kc5tja
Hey ya'll... I had a thought on this... could the 6522's be used as the interface for multiple cpu's? Like just jerryrigging a connection between a two or more 6522's and it would almost be like connecting two computer via a serial port or the like right?
Lyos Gemini Norezel
This is, in fact, the reason the original 6821 PIA chip had the serial port to begin with, which the 6522 and 6526 chips inherited.
--
Samuel A. Falvo II
Posted: Fri May 07, 2004 5:32 am
by Ruud
Hallo Dave,
> Anybody know if these saw the light of day?
The old IEEE Commodore drives used either one 6502 and one 6504 or two 6502's, running in the way you described.
Posted: Thu Dec 28, 2006 1:11 am
by smilingphoenix
Many years back, I added a second processor to an Acorn Atom, running on the oposite phase of the clock. It can work, but the timing becomes much more critical, even at 2MHz! The two processors shared the ROMs and an 8k block of RAM used for inter-processor communications, while each having their own 32k of RAM for running programs. I managed to get both processors runing seperate BASIC programs using the same BASIC ROM.
I never really got into splitting a single task between the two processors, though. I mainly used the second CPU for calculating mandelbrot images in the background while I used the computer for something else (mainly space invaders

)
I wouldn't like to add more processors in this way, though. I suspect it would be better to add some sort of network if you want to use multiple processors.
Posted: Thu Dec 28, 2006 4:37 am
by kc5tja
Yeah, Commodore's PET-series disk drive units relied on twin processors. I'm not sure if the Commodore VIC-series (e.g., the 1540 through 1581) did or not though.
That being said, "SMP" (since it's basically what it is) is actually the simplest possible method of multiprocessing, since you don't need to invent a network system either. Realistically speaking, 4 CPUs is about as far as you can push a typical bus (at least with Intel and PowerPC processors); beyond that, performance starts to dwindle fast. I suspect 2 CPUs is the limit for the 6502/65816 because of its lack of cache memory and very high bus bandwidth requirements.
That being said, one can combine the benefits of SMP and networked designs by building networked clusters of twin-processor nodes, if required.
Posted: Thu Dec 28, 2006 5:37 am
by Nightmaretony
For me, if I were to go multiple cpus, I would go with the common ram and each cpu while it has its own rom/ram would access the common ram in a round robin fashion. Each one can simply have data or programs passed back and forth with a token id for memory, or the ram can segment for each cpu.
Posted: Fri Dec 29, 2006 3:08 am
by kc5tja
That's a form of networking.