gnupic: New processor in gpsim


Previous by date: 24 Feb 2000 22:12:10 -0000 New processor in gpsim, Thomas Lundin
Next by date: 24 Feb 2000 22:12:10 -0000 Re: New processor in gpsim, Snail Instruments
Previous in thread: 24 Feb 2000 22:12:10 -0000 New processor in gpsim, Thomas Lundin
Next in thread: 24 Feb 2000 22:12:10 -0000 Re: New processor in gpsim, Snail Instruments

Subject: Re: New processor in gpsim
From: Scott Dattalo ####@####.####
Date: 24 Feb 2000 22:12:10 -0000
Message-Id: <Pine.LNX.4.05.10002241443560.12332-100000@tempest.blackhat.net>


On Thu, 24 Feb 2000, Thomas Lundin wrote:

> I would like to add the pic14000 to gpsim. Not very common, it's a 14
> bit core with extra candy like 16 bit AD (theoretically), internal temp
> sensor, I2C and so on.
> Is it basically "just" to make an p14000.cc and p14000.h to be able to
> simulate the non chip specific parts? Or is it more to it?
> 
> Anyone who has worked with the 14000? I haven't used the analog parts of
> it yet, and I've been told after I decided to use this cpu that the
> analog parts aren't that good. So I don't know if I should change cpu
> before I get too involved with it.
> 
> Thomas

Hi Thomas,

Adding a new processor similar to one already existing is fairly straight
forward. In fact, I'm adding the 16C877 as a derivative of the 16C65.
Adding a new processor that's not similar to one supported is as you might
expect much more difficult. I'm not familiar with pic14000 hardly at all,
other than I know it's a different beast.

The way I've been implementing the processors so far is by combining
pieces together. Take a 16f84 for example. I've broken into two portions:
the package and the core. The package defines all of the pins and how they
map to the I/O ports. The core contains the cpu and all of the
peripherals. 


Here's a cut-n-paste from p16x8x.h (the include file for the p16f84 and
other similar devices:

/**********************************************************************
 *
 * Include file for:  P16C84, P16F84, P16F83, P16CR83, P16CR84
 *
 * The x84 processors have a 14-bit core, eeprom, and are in an 18-pin
 * package. The class taxonomy is:
 *
 *   pic_processor                  Package
 *      |-> 14bit_processor           |-> _18_pins
 *             |                            |-> _14bit_18pins
 *             |----------\ /-----------------------|
 *                         |
 *                         |- P16C8x
 *                              |->P16C84
 *                              |->P16F84
 *                              |->P16C83
 *                              |->P16CR83
 *                              |->P16CR84
 *
 ********************************************************************/



If you look at packages.cc,.h you'll see the definitions for the 18,28 and
40 pin packages.

The f84 core is built up from a hierarchy of cores. At the highest level
(or lowest, depending on your perspective) is the abstract class
pic_processor. This has grown somewhat out of hand, but it serves as the
basis of all pic processors. It defines common registers (like W and PCL)
and contains a boat load of virtual functions that provide all kinds of
ways accessing the pic (without having to know the type of pic). The
'14-bit' cores derived from the pic_processor class extends the
functionality for the 14bit cores. 

You could certainly use the 16x8x code as a template for the 14000. From
that it would be straight forward to obtain the basic functionality.

I'm intentionally skipping over details. If you have specific questions
please feel free to ask. I'm going to have some time this weekend to do a
little coding - so I could create the 14000 template. But that's not a
promise, because right now I've got two really nasty bugs (one is major
design flaw...) that I'm busy squashing. (In case your interested, some
where's along the way I seriously broke the scripting capabilities of
gpsim. The other one is that there's a design error in the way derived
classes get initialized.)

Scott


Previous by date: 24 Feb 2000 22:12:10 -0000 New processor in gpsim, Thomas Lundin
Next by date: 24 Feb 2000 22:12:10 -0000 Re: New processor in gpsim, Snail Instruments
Previous in thread: 24 Feb 2000 22:12:10 -0000 New processor in gpsim, Thomas Lundin
Next in thread: 24 Feb 2000 22:12:10 -0000 Re: New processor in gpsim, Snail Instruments


Powered by ezmlm-browse 0.20.