[Ktechlab-devel] logic refactoring.

Alan Grimes agrimes at speakeasy.net
Sun Sep 20 17:40:29 UTC 2009


P Zoltan wrote:
> On Fri, 18 Sep 2009 04:05:07 +0200, Alan Grimes <agrimes at speakeasy.net>  
> wrote:

>> I could really use some help with logicin/out. =\

>> Basically what you have is four classes doing the work of a fifth,
>> creating a nice big mess in the process.
>>
>> The other two classes are Simulator (which we REALLY want to keep
>> simple), and circuitDocument.

>> Here's what's going on.

>> You have a "slow" simulator in ElementSet which simulates the analog
>> part of the circuit. You also have a fast (and grossly inaccurate),
>> simulator that is a thousand times faster (runs a thousand times more
>> often) that processes logic circuits.

>   Why inaccurate? Logic should be easily simulated. There could be problems  
> with broken circuits (like loops in logic). I think the main issue is  
> connecting analog and digital together.

Its inaccurate because it ignores most of the real properties of the
actual chips. The low votage is not implemented right, few (if any)
chips can actually output a 0 voltage low signal, most chips are rated
at something like 200mV for low. Issues of input capacitance and
resistance are ignored too so that a real chip might only be able to
actually drive five or six inputs (hence the need for buffers). In
Ktechlab it is unlimited... basically many problems of that nature.

>> There are two parts to this fast simulator. First there's the part which
>> distributes voltage states to all connected parts. Second, since there
>> are no cnodes involved, there's a set of pins which must be updated for
>> the UI to work. (these are stored in logicOut even though logicOut has
>> no code which uses them).

>   We should separate the GUI update from the simulator voltage/current  
> update. Maybe run it in 2 different threads. Also ideally there shoud be a  
> well defined interface between the simulator and GUI.

Yeah, the problem is "what should the new design look like?"...

>> My last few days worth of commits mainly dealt with removing as much
>> functionality as I could from logicin/out. Now the main task is
>> refactoring. After that it might pay to refactor logicin/out so they
>> aren't stacked on each other, but in the mean time we need to get
>> logicSet working.

>   What should logicSet do? Represent a part of the circuit which contains  
> only logic components?

Yeah, but then after yesterday, I found a fairly decent solution where
each logic-out is tagged with a flag that indicates whether it has
changed instead of manipulating dual linked-lists(!!). This is
infinitely less buggy than the previous solution.


-- 
New president: Here we go again...
Chemistry.com: A total rip-off.
Powers are not rights.





More information about the Ktechlab-devel mailing list