EmbeddedRelated.com
Forums

about creating an universal 8-bit microcontroller simulator

Started by seemanta dutta March 11, 2004
Hi,
I have thought of a free software project in my mind. I need your
opinion on it because currently I am familiar only with the 8051
microcontroller.

As you would have alreay guessed by now, I am planning to create a
Universal 8-bit Microcontroller simulator for the linux platform. Yes,
there are such software already in the  market, but AFIK they are all
proprietary products and are not GPL'ed software. Besides as far as my
information goes, there has never been any Universal simulator that
can run on the Linux environment - proprietary or free.
I am doing this for my undying love for both microcontrollers as well
as the Linux platform.

What I plan to create is a 'Simulator Engine', that based on a ascii
text configuration file, will churn out the *code* for the
simulator.The user then has to compile this customised code. That way
I don't have to worry about incorporating code for each and every
microprocessor core into my main code. That will also give users a
higher degree of freedom. Everything including register information,
instruction format and instruction operation has to be documented in
this file. I am hopeful that given proper documentation, users will
not feel bugged to create their own configuration files ;-)

Now my question is: Do the 8-bit microprocessors share that much
degree of similarity that a generic 'Engine' can be created? In case
they do then it will truly be wonderful.If not, the whole idea has to
dropped on the basis that all microprocessor cores are too dissimilar
to enable a generic 'Simulator Engine'.
I have very little idea about other microcontrollers hence I am
counting on you folks for feedback.
In case you give me the go-ahead, I shall start researching about
other microcontrollers and after listing out their similarities, start
working on the Engine.


Thanks and regards,( especially for enduring such a long post...)
Seemanta Dutta
On 11 Mar 2004 06:01:33 -0800, the renowned seemanta_18@yahoo.com
(seemanta dutta) wrote:

>Hi, >I have thought of a free software project in my mind. I need your >opinion on it because currently I am familiar only with the 8051 >microcontroller. > >As you would have alreay guessed by now, I am planning to create a >Universal 8-bit Microcontroller simulator for the linux platform. Yes, >there are such software already in the market, but AFIK they are all >proprietary products and are not GPL'ed software. Besides as far as my >information goes, there has never been any Universal simulator that >can run on the Linux environment - proprietary or free. >I am doing this for my undying love for both microcontrollers as well >as the Linux platform. > >What I plan to create is a 'Simulator Engine', that based on a ascii >text configuration file, will churn out the *code* for the >simulator.The user then has to compile this customised code. That way >I don't have to worry about incorporating code for each and every >microprocessor core into my main code. That will also give users a >higher degree of freedom. Everything including register information, >instruction format and instruction operation has to be documented in >this file. I am hopeful that given proper documentation, users will >not feel bugged to create their own configuration files ;-) > >Now my question is: Do the 8-bit microprocessors share that much >degree of similarity that a generic 'Engine' can be created? In case >they do then it will truly be wonderful.If not, the whole idea has to >dropped on the basis that all microprocessor cores are too dissimilar >to enable a generic 'Simulator Engine'. >I have very little idea about other microcontrollers hence I am >counting on you folks for feedback. >In case you give me the go-ahead, I shall start researching about >other microcontrollers and after listing out their similarities, start >working on the Engine. > > >Thanks and regards,( especially for enduring such a long post...) >Seemanta Dutta
Parsing the data in code memory to get down to a managable number of instructions plus addresses and flags etc. will be one challenge. Suggest you study the instruction set of a few micros such as the 68HC08, 8051, PIC18F, and DSPic to start with. Best regards, Spehro Pefhany -- "it's the network..." "The Journey is the reward" speff@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com
In article <fd383985.0403110601.248d276e@posting.google.com>, seemanta_
18@yahoo.com says...
> Hi, > I have thought of a free software project in my mind. I need your > opinion on it because currently I am familiar only with the 8051 > microcontroller. > > As you would have alreay guessed by now, I am planning to create a > Universal 8-bit Microcontroller simulator for the linux platform. Yes, > there are such software already in the market, but AFIK they are all > proprietary products and are not GPL'ed software. Besides as far as my > information goes, there has never been any Universal simulator that > can run on the Linux environment - proprietary or free. > I am doing this for my undying love for both microcontrollers as well > as the Linux platform. > > What I plan to create is a 'Simulator Engine', that based on a ascii > text configuration file, will churn out the *code* for the > simulator.The user then has to compile this customised code. That way > I don't have to worry about incorporating code for each and every > microprocessor core into my main code. That will also give users a > higher degree of freedom. Everything including register information, > instruction format and instruction operation has to be documented in > this file. I am hopeful that given proper documentation, users will > not feel bugged to create their own configuration files ;-) > > Now my question is: Do the 8-bit microprocessors share that much > degree of similarity that a generic 'Engine' can be created? In case > they do then it will truly be wonderful.If not, the whole idea has to > dropped on the basis that all microprocessor cores are too dissimilar > to enable a generic 'Simulator Engine'. > I have very little idea about other microcontrollers hence I am > counting on you folks for feedback. > In case you give me the go-ahead, I shall start researching about > other microcontrollers and after listing out their similarities, start > working on the Engine. > > > Thanks and regards,( especially for enduring such a long post...) > Seemanta Dutta >
For most on this newsgroup, I would think that a microcomputer simulator that did not include the full range of peripheral devices would not be very useful. At that point, I think you will find that simulating three timers with 5 PWM outputs and 8 capture/compare inputs plus a couple of UARTS gets to be more work than simulating just the core itself. But for an embedded engineer, one of the reasons for running a simulation is to find out what happens when timer 3 receives capture events on two channels at the same time a byte arrives at the serial port. Not much use having a simulator if it doesn't handle the peripherals properly and if it can't help you set up triggering external events. Mark Borgerson
Mark Borgerson wrote:

> For most on this newsgroup, I would think that a microcomputer > simulator that did not include the full range of peripheral devices > would not be very useful. At that point, I think you will find > that simulating three timers with 5 PWM outputs and 8 capture/compare > inputs plus a couple of UARTS gets to be more work than simulating > just the core itself. But for an embedded engineer, one of the > reasons for running a simulation is to find out what happens when > timer 3 receives capture events on two channels at the same > time a byte arrives at the serial port. Not much use having a > simulator if it doesn't handle the peripherals properly and > if it can't help you set up triggering external events.
Well put. I once used a DIGITAL simulator of a microprocessor and set the interrupt rate to match the instruction execution rate: thus an interrupt occurred after every instruction, verifying the bug I thought existed :-) ( my own of course ). - RM
seemanta dutta wrote:

> Hi, > I have thought of a free software project in my mind. I need your > opinion on it because currently I am familiar only with the 8051 > microcontroller. > > As you would have alreay guessed by now, I am planning to create a > Universal 8-bit Microcontroller simulator for the linux platform. Yes, > there are such software already in the market, but AFIK they are all > proprietary products and are not GPL'ed software. Besides as far as my > information goes, there has never been any Universal simulator that > can run on the Linux environment - proprietary or free. > I am doing this for my undying love for both microcontrollers as well > as the Linux platform.
There are quite a few GPL simulators around but they all have their limitations. I have a particular interest in the 8051 family and IIRC I found at least six simulators for this micro.
> > What I plan to create is a 'Simulator Engine', that based on a ascii > text configuration file, will churn out the *code* for the > simulator.The user then has to compile this customised code. That way > I don't have to worry about incorporating code for each and every > microprocessor core into my main code. That will also give users a > higher degree of freedom. Everything including register information, > instruction format and instruction operation has to be documented in > this file. I am hopeful that given proper documentation, users will > not feel bugged to create their own configuration files ;-) > > Now my question is: Do the 8-bit microprocessors share that much > degree of similarity that a generic 'Engine' can be created? In case > they do then it will truly be wonderful.If not, the whole idea has to > dropped on the basis that all microprocessor cores are too dissimilar > to enable a generic 'Simulator Engine'. >
Microcontroller architectures vary considerably so creating a generic engine will not be at all easy. Apart from fundamental differences like Harvard or Princeton architectures and big endian or little endian addresses, implementation details vary considerably. Then there is the need to take into account all the various peripheral options both current and future. Lastly, any decent simulator will be able to include hardware external to the micro. I wish you well but I think you have a very ambitious project. Your admitted lack of understanding of 'other micros' could be a serious handicap. Ian
Hi, great project idea, it's going to be difficult as most micros are
different, some are very different.
On Thu, 11 Mar 2004 15:57:10 +0000, Ian Bell wrote:

>Microcontroller architectures vary considerably so creating a generic engine >will not be at all easy. Apart from fundamental differences like Harvard >or Princeton architectures
What's a "Princeton architecture"? Do you mean a von Neumann architecture, where the same bus is used for data and instruction fetches? I'm aware that John von Neumann was a Prof. at Princeton, but the work was essentially his alone, as opposed to the team that worked at Harvard. "von Neumann architecture" is the conventional term, anyhow (though the original ideas were mostly Turing's). -- Max
seemanta dutta <seemanta_18@yahoo.com> wrote:
> Hi, > I have thought of a free software project in my mind. I need your > opinion on it because currently I am familiar only with the 8051 > microcontroller.
So let's stick with that family for the moment. As per the latest counting, there are reported to be about four or five *hundred* different variants of 8051s out there (not counting temperature or packaging differences, mind you). That's really your major problem, then: not the machine language of the processor as such, but the timing and behaviour of all those freakin' many different built-in peripherals that come attached to it.
> As you would have alreay guessed by now, I am planning to create a > Universal 8-bit Microcontroller simulator for the linux platform.
You may want to have a look at GNU's GDB sources first. It already comes with a somewhat general CPU simulator construction kit to be used for debugging programs by simulation. And please don't make the same mistake the proprietary simulators already committed to by tying your simulator to the Linux platform. Make it *portable*, as best you can.
> Now my question is: Do the 8-bit microprocessors share that much > degree of similarity that a generic 'Engine' can be created?
Depends on how skillfully that "engine" is made, and how much effort you're willing to put into configuring it. Everything can theoretically be simulated by your PC, of course --- the only real questions are how flexible and how efficient your code generator and the final simulator will be. -- Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de) Even if all the snow were burnt, ashes would remain.
Max wrote:

> On Thu, 11 Mar 2004 15:57:10 +0000, Ian Bell wrote: > >>Microcontroller architectures vary considerably so creating a generic >>engine >>will not be at all easy. Apart from fundamental differences like Harvard >>or Princeton architectures > > What's a "Princeton architecture"? Do you mean a von Neumann > architecture, where the same bus is used for data and instruction > fetches? > > I'm aware that John von Neumann was a Prof. at Princeton, but the work > was essentially his alone, as opposed to the team that worked at > Harvard. "von Neumann architecture" is the conventional term, anyhow > (though the original ideas were mostly Turing's). >
Many years ago, the US Gov't asked Harvard and Princeton universities to come up with a computer architecture suitable for computing tables of naval artillery shell trajectories. The Princeton architecture, with its common address space for program and data, is also commonly known by its chief scientist's name, Von Neumann. Ian (with apologies to Myke Predko)
seemanta dutta wrote:
> Hi, > I have thought of a free software project in my mind. I need your > opinion on it because currently I am familiar only with the 8051 > microcontroller. > > As you would have alreay guessed by now, I am planning to create a > Universal 8-bit Microcontroller simulator for the linux platform. Yes, > there are such software already in the market, but AFIK they are all > proprietary products and are not GPL'ed software. Besides as far as my > information goes, there has never been any Universal simulator that > can run on the Linux environment - proprietary or free. > I am doing this for my undying love for both microcontrollers as well > as the Linux platform. > > What I plan to create is a 'Simulator Engine',
snipped.. Before you go too far, you might want to look at the simh project. The original purpose of the project was to simulate legacy machines rather than current microprocessors. Nonetheless, their work seems to be fairly robust and is open-source. http://simh.trailing-edge.com/