2009/9/20 P Zoltan <zoltan.padrah@...>
> On Wed, 16 Sep 2009 18:28:26 +0200, santiago gonzalez
> <santigoro@...> wrote:
> > Ok... i think now pic simulation work quite better, the simulation run in
> > two diferent ways:
> > -When runed from the circuit button (play), simulation goes at real time
> > for
> > a 20 MHz compiled pic code, registers are not updated, breakpoints
> > doesn't
> > have effect, it's just like powering the pic.
> > -When running from the code (execute), it run slower and updates
> > registers
> > view every 25 ms and every cycle when step-by-step, breakpoints and any
> > other debug feature works here.
> From the point of usability I don't know if this is the best approach.
I don't know.. this is is just a first aproach and should be discussed.
> Maybe adding a "debug code" property to the PIC and setting it depending
> on the code launch method would be better. Your assuptions on the usage
> are good, but you can't know for sure what the user actually want. Maybe
> he wants to load the program on a pic, run it for a while, and only after
> that start it debugging (in the middle of the simulating process).
Yes... no problem to do this, you can realtime-run the simulation from the
"play" button in the circuit document, then pause the simulation and run it
from the "execute" or "step" in the tool-bar that appears only when you are
in the code document, if you execute from the document view you also can
switch to the circuit view and see the circuit running, and at the same time
the registers updating, then you can pause and realtime-run again.
> Also some "mystic" slowdowns or speedups would really annoy me (if I
> don't have control over it).
You control it: if you run from the play button in the circuit then
realtime.. if you run from the code view then not-realtime.
> > Now i need two things:
> > -Create the "clock Mhz" property or any other way that the user can
> > choose
> > the clock speed. Someone can give a hand wit this?
> I don't know how the PICs works? Do they have clock/quartz input, and/or
> set up their operating frequency by them? We should do it in a way that
> resembles more the real hardware.
Therea are several ways.. you can use external clock, external R-C, internal
clock; from the point of view of the simulation this is no matter, the only
important thing is that each step must be executed at the same speed that
the pic program was code for; i think that having the chance to select the
clock speed is enought (by now).
I already added a Clock MHz porperty to the pic component and a loop in
simulator.cpp; depending on the clock speed selected, some steps of the loop
are skiped... also another first aproach, but works reasonably well
comparing with running at fixed speed.
But this needs a good timing in ktl, now there are some random behaivors. I
hope that the actual work you are doing will improbe this.
For simulating all the supported pics, simulator should can update the pic
at 10 MHz, but for the most used p16f with 5 MHz is enought.