Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
20782 Discussions

how do i 'embed' a legacy cpu inside Altera chips???

Altera_Forum
Honored Contributor II
1,259 Views

Hi All, 

I did some searching and couldnt find anything related, So.... 

 

I'd like to know how i go about embedding and old 6809 cpu inside an Altera chip, i *think* the cyclone range supports this? 

 

( I've only previously dealt with the Max7000 series chips myself as i have a box load of 71xx on hand to tinker with, but in reading various bits & pieces over the years i believe Cyclone (or something else) easily accepts the use of "pseudo cpu's" to be placed inside them just as easily as adding regular ttl/cmos chip etc ). 

 

 

I've recently been asked to re-develop a legacy (6809) cpu board to keep some industrial machinery operating. 

It's to costly to replace the machinery, and they've run out of spare cpu boards and no more are available from original supplier, so i was asked to provide an alternate solution. 

 

The 6809 controller board in question also has a few 6821 (PIA) interface chips on them, which in turn control about 40 mosfets that activate various relays/solenoids within the machinery, a reasonably simple board overall. 

 

I figure NOW is the time for me to bite the bullet and take a step into implementing a 6809 and possibly also the 6821 chips inside an Altera device, then create a new board with better mosfet drivers & protection circuitry etc etc. 

 

 

I appreciate being pointed in the right direction, whether it's an info paper within the Altera site, or external site of someone already doing this kind of thing? 

 

Thanx in advance, 

Marty.
0 Kudos
10 Replies
Altera_Forum
Honored Contributor II
456 Views

First what is an 6809 .... 

 

http://en.wikipedia.org/wiki/motorola_6809 

 

its an ancient piece of technology that is hardly worth saving. 

 

As I see it, your "high-level" task is to replace the CPU board with something that is functionally equivalent at the I/O level. 

 

If you had a bunch of spare boards with dead CPUs, then sure, you'd look at replacing the CPUs with a FPGA on an adapter board. However, it sounds like your task is to design a replacement CPU board. 

 

Given that requirement, I'm pretty sure a microcontroller would be up to the task, or perhaps an FPGA containing a soft-core processor, eg., NIOS II., and then sure, if you really want to make the new CPU boards code compatible with the old, then you need to have a *cycle accurate* HDL core for the 6809. Why cycle accurate? Well, unless you look at the code, you have no idea if the code has timing delays implemented based on an assumed instruction timing. 

 

Where should you start ... Google "6809 fpga" and start browsing ... eg., here's an OpenCore version of the CPU ... 

 

http://opencores.org/project,system09 

 

Note that "6809 instruction compatible" does not mean cycle-accurate with respect to the original CPU core. 

 

Cheers, 

Dave
0 Kudos
Altera_Forum
Honored Contributor II
456 Views

Flaming responses aren't necessary.......Yes, we're all over the "why bother with 6809", but they have their place in certain scenarios that can't be bypassed. 

 

The picture is a lot bigger than perhaps i explained (trying to keep things simple). 

Each board has a license code in its rom, and the controller software always checks the board during polling etc. 

 

I would have initially built something with a pic to do the driving etc, but then the whole software/license is another can of worms worth avoiding. 

 

Besides the above requirement, i would like to emulate 6809 or even Z80's in numerous legacy projects, believe it or not some people still use and enjoy that stuff, dont bag it !!!! 

 

Thanx for the opencores link, it's something in the right direction.
0 Kudos
Altera_Forum
Honored Contributor II
456 Views

For what it's worth, 68HC11 in FPGA seems to be a "hotter" technology than 6809 (or at least you can purchase commercial license/support). Not sure if that migration path would be appropriate for your project or not. 

http://www.altera.com/products/ip/processors/8_4bit/m-dcd_df6811cpu.html 

http://www.hitechglobal.com/ipcores/68hc11.htm 

 

Where to start? After you pick which soft core you want to start with, I would suggest getting a sanity check in ModelSim with it executing your existing software and adding enough to the testbench to exercise the critical functions like the licensing you mentioned above. When you're happy enough with the results it ought to be simple enough to wire from the headers on a board like the BeMicro CV to the 6809 socket on your existing board and see how much trouble you're in. 

 

Good luck.
0 Kudos
Altera_Forum
Honored Contributor II
456 Views

 

--- Quote Start ---  

Flaming responses aren't necessary.......Yes, we're all over the "why bother with 6809", but they have their place in certain scenarios that can't be bypassed. 

 

--- Quote End ---  

 

The response was not intended to be a flame. It was merely to check/confirm that you understood that sometimes you need to take a step further back and look at the big picture. 

 

 

--- Quote Start ---  

 

The picture is a lot bigger than perhaps i explained (trying to keep things simple). 

Each board has a license code in its rom, and the controller software always checks the board during polling etc. 

 

I would have initially built something with a pic to do the driving etc, but then the whole software/license is another can of worms worth avoiding. 

 

--- Quote End ---  

 

Can you clarify this a bit more ... Do you control the software, i.e., is it possible to modify the code? I suspect not, which is why its a can of worms :) 

 

You still have the problem of matching the original code timing, so having the source code is critical, just so that you can see if there is a cycle-accuracy requirement. 

 

 

--- Quote Start ---  

 

Besides the above requirement, i would like to emulate 6809 or even Z80's in numerous legacy projects, believe it or not some people still use and enjoy that stuff, dont bag it !!!! 

 

--- Quote End ---  

 

I'm Ok with hobbies keeping ancient technology alive. However, your task involves heavy machinery, so does involve a level of risk, and hence a certain level of caution is required, i.e., you will need to prove that the new CPU board is functionally equivalent. 

 

 

--- Quote Start ---  

 

Thanx for the opencores link, it's something in the right direction. 

--- Quote End ---  

 

 

A few of the other 6809 links seemed to indicate this was the main source people were using. I am sure there is a forum with 6809 "archeologists" that could help :) 

 

Cheers, 

Dave
0 Kudos
Altera_Forum
Honored Contributor II
456 Views

 

--- Quote Start ---  

The response was not intended to be a flame. It was merely to check/confirm that you understood that sometimes you need to take a step further back and look at the big picture. 

 

--- Quote End ---  

 

yep, understood. 

I tend to always look at the biggest picture possible with these types of challenges. 

As i said earlier i would have just replaced the whole thing with a pic controller if it wasn't for the licensing system being a pain. 

 

 

 

--- Quote Start ---  

 

Do you control the software, i.e., is it possible to modify the code? I suspect not, which is why its a can of worms :) 

 

--- Quote End ---  

 

Definately a big can'o'worms, as the software/panel also controls several other devices besides the main machinery. 

It starts becoming a replacement of a whole system which is then way outside the budget available. 

I'm told there's still a maintenance agreement for the mechanical machinery, but replacing their system software is considered a breach of their agreement and they'd lose the mechanical service too. 

Seems funny that the electronics agreement had expired, but there's a deeper story with the old company going bust and being bought out by newcomers, who have quickly written off support for the 'ancient' technology...the plot thickens. 

 

 

--- Quote Start ---  

 

You still have the problem of matching the original code timing, so having the source code is critical, just so that you can see if there is a cycle-accuracy requirement. 

 

--- Quote End ---  

 

Perhaps, although the code overall seems pretty lazy (not timing accurate), just a bunch of on/off commands to relays etc. 

Whether the timing inside the fpga alter the soft-6809's program loops/timing is yet to be seen. 

 

 

 

--- Quote Start ---  

 

I'm Ok with hobbies keeping ancient technology alive. However, your task involves heavy machinery, so does involve a level of risk, and hence a certain level of caution is required, i.e., you will need to prove that the new CPU board is functionally equivalent. 

 

--- Quote End ---  

 

This will be ok, as the machinery has an isolation panel to detach the machine from the control panel, thus leaving a panel full of relays/lamps to be monitored during the test phase(s) to ensure everything is switching correctly. 

The relays are activated few'n'far between, so it's easy to visually see the 'cycles' being switched etc. 

 

 

At the end of the day, whether the industrial project goes ahead or not, i'm still interested in doing some soft-core (nostalgic) projects for myself, and thought this would be the initial push to get me to jump into it ;-)
0 Kudos
Altera_Forum
Honored Contributor II
456 Views

From what I remember of the 6809, getting cycle accuracy shouldn't be a problem. 

Largely it did a memory cycle every clock - but there might be an idle cycle after the instruction fetch. 

Given that the 6809's clock was probably ~1Mhz you could probably get a 100Mhz nios to emulate it! 

Although writing a 6809 cpu might be an interesting hobby exercise.
0 Kudos
Altera_Forum
Honored Contributor II
456 Views

 

--- Quote Start ---  

 

Definitely a big can'o'worms, as the software/panel also controls several other devices besides the main machinery ...  

I'm told there's still a maintenance agreement for the mechanical machinery, but replacing their system software is considered a breach of their agreement and they'd lose the mechanical service too. 

Seems funny that the electronics agreement had expired, but there's a deeper story with the old company going bust and being bought out by newcomers, who have quickly written off support for the 'ancient' technology...the plot thickens. 

 

--- Quote End ---  

 

The whole concept sounds fraught with peril ... I'd recommend finding a good lawyer to create a contract with a strong disclaimer :) 

 

 

--- Quote Start ---  

 

Perhaps, although the code overall seems pretty lazy (not timing accurate), just a bunch of on/off commands to relays etc. 

Whether the timing inside the fpga alter the soft-6809's program loops/timing is yet to be seen. 

 

--- Quote End ---  

 

I'd recommend testing the OpenCores CPU (in Modelsim) to see if it works, eg., 6809 "Hello world", and then try executing your machinery code. You should be able to create a Modelsim testbench which includes the machinery I/O. Once you convince yourself that works, if the 6809 does not use too many pins, it should be possible to re-work an existing CPU board to replace the CPU with an adapter socket. You could then connect that to an FPGA development kit. If that succeeds, then you can proceed with a custom PCB design. 

 

 

--- Quote Start ---  

 

At the end of the day, whether the industrial project goes ahead or not, i'm still interested in doing some soft-core (nostalgic) projects for myself, and thought this would be the initial push to get me to jump into it ;-) 

--- Quote End ---  

 

Then starting with a Modelsim simulation of the OpenCore CPU sounds like a good option. 

 

Cheers, 

Dave
0 Kudos
Altera_Forum
Honored Contributor II
456 Views

Are 6809 cpus that unobtainable/expensive? 

I've one here sat in a DIL socket (in a PCB) that worked last time it was powered up. 

Must be loads of them lurking in peoples attics.
0 Kudos
Altera_Forum
Honored Contributor II
456 Views

 

--- Quote Start ---  

Are 6809 cpus that unobtainable/expensive? 

I've one here sat in a DIL socket (in a PCB) that worked last time it was powered up. 

Must be loads of them lurking in peoples attics. 

--- Quote End ---  

 

 

Good thinking! I just found out we have 37 pcs. "EF68B09P" sitting idle in our stock, although not in the attic :) I also must have an 6809 somewhere in the cellar :)
0 Kudos
Altera_Forum
Honored Contributor II
456 Views

MC6809EP EN68221 sat in my Dragon 32.

0 Kudos
Reply