Subject: Re: Logic simulation
Organization: The Armory
X-Newsreader: trn 4.0-test69 (20 September 1998)
From: email@example.com (Richard Steven Walz)
Date: 02 Sep 2002 08:48:25 GMT
In article ,
Ron Watkins wrote:
>Yes, I know, im not the greatest programmer in the world. I have tried
>to come up with somthing using C++, but have hit multiple snags which
>im not sure how to work around.
>First off, I built a dynamic array, which contains objects of "state",
>which hold the state value and the number of 'ns' since an arbitrary
>origin. The code had to be dynamic due to the large number of state
>changes in somthing like a "clock" at 1Mhz vs a slowly changing
>signal, so I built it as a dynamic array with increments of 1024
>states per allocation node. I also had to add logic to ensure that if
>the state was "evaluated" and did not change, it would not make an
>entry in the state temporal array.
You know, I have found over a long period of time that C and its
descendants have waay more power than most people need for most things.
When I have written a few of these I did it in BASIC, and using an
interpreter!! If you spell out what you're doing in BASIC and use GOSUBS
and RETURNs properly in separate routines, you can do most anything.
>Then, I had to figure out how to simulate the outputs which have
>"fanout" which is different for each output signal, typically 10.
>Also, each signal had to have the state history and an evaluation
>function which it evaluated it's inputs. Then, each "module" had to
>evaluate it's current state, and if it changed, then it would examine
>all the modules which are connected to it's outputs and push them onto
>a priority queue using the delay stored in each "module output". Some
>of the places where I got stuck are:
>1) How to tie the output signals to the input signals so the "eval"
>function could do the work of determining the new state value. I was
>looking for somthing like this: tie(u1.p1, u2.p2), where u1,u2 are
>modules and p1 is an output signal and p2 is an input.
Use global variables and simply declare these states of the circuit.
I don't get your problem, if you need a raft of other shadow variables
to please your sense of order then do that!
>2) The complexity of "evaluation" of the current modules state from
>it's inputs and recording the possible state change, then trying to
>figure out exactly which other modules need to be evaluated and
>placing them on the priority queue at the correct time so they are
>evaluated at the proper point in the future.
You simply do them in connection order. What is so difficult?
>The logistics of keeping track of all this is proving difficult and I
>thought there might be a better solution. Im getting lost in the
First, and you never told us this, WHAT in the WORLD are you simulating
in the way of the "few sequential circuits" you first mentioned????
-Steve Walz firstname.lastname@example.org ftp://ftp.armory.com/pub/user/rstevew
Electronics Site!! 1000's of Files and Dirs!! With Schematics Galore!!
http://www.armory.com/~rstevew or http://www.armory.com/~rstevew/Public
>email@example.com (Richard Steven Walz) wrote in message
>> Sure, but maybe he doesn't realize that before the packages people simply
>> wrote their own "gates" in FORTRAN or BASIC as propositions with time
>> delays added, and that if he just wants to see if something works that
>> all you have to do is write program language expressions for it with
>> time down through the program following the signal flow, and that this
>> actually works quite well! I've simulated all the flip-flops and multiple
>> F/F circuits in plain old BASIC, it's quite simple, and you can even
>> simulate race condition timing if you insert nominal time delays in the
>> So the answer to your question may simply be: "Yeah, it's called a
>> programming language, kid, which one do you know?"
>> Try it, it works! All the program packages just add a couple layers
>> onto the process: Make it visual if it's Windows, make data entry
>> idiot simple so you don't have to actually program, keep you from doing
>> the couple obvious dumb things, and hold your hand and earn money!!
>> >"Ron Watkins" wrote in message
>> >> Im a amateur, looking for a way to simulate the state transitions in
>> >> sequential circuits without having to physically build them. Is there
>> >> some freeware application for Linux (preferably), or Windows which
>> >> will allow me to somehow specify a digital circuit and then simulate
>> >> the circuit to get signal traces over time?
>> >> Ron