Author Topic: Circuit Simulation: Where is it going?  (Read 985 times)

0 Members and 1 Guest are viewing this topic.

Offline louarnold

  • Contributor
  • Posts: 11
  • Country: 00
Circuit Simulation: Where is it going?
« on: May 18, 2021, 07:04:29 pm »
Re: Digital Circuit Simulator software for different design paradigms. Comments please, and recommendations for suitable software.

I'm looking for a digital circuit simulator that will help me find and fix race conditions. The digital circuits are discrete (eg 7400 series, etc) and may have complex components such as micro-controllers that react to events. The software has to be good, with specific operating parameters for the devices (voltage and timing). Timing parameters must have low and high values and the simulation software must run through those ranges. There must of course be the standard conveniences for the user - save, resume, etc.

On the other hand, I may opt to replace much of the digital circuits with micro-controllers that simply communicate with each other and thereby eliminate the timing problems that come with upgrading digital components. Are simulators good enough to handle this type of design?
Regards,
Lou
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 7982
  • Country: us
    • Personal site
Re: Circuit Simulation: Where is it going?
« Reply #1 on: May 18, 2021, 08:02:20 pm »
Impossible. Even if you find some simulation software, you will never find exact timing models for your specific ICs. And MCUs especially.

The best simulation software for this kind of analysis exists for FPGAs, but FPGAs blocks and fabric are extensively characterized.

The behaviour of the same exact circuit from the same exact components, but assembled on a breadboard instead of a PCB, may be radically different. 
Alex
 

Offline rdtsc

  • Newbie
  • Posts: 3
  • Country: us
Re: Circuit Simulation: Where is it going?
« Reply #2 on: May 19, 2021, 12:59:40 am »
You could try to simulate the non-mcu components separately, using software like Logisim-Evolution: https://www.eevblog.com/forum/eda/logisim-evolution/  Note I have not tried this software.  Unsure if it can do timing analysis pass/fail (and that's dependent on PCB routing anyways.)

Speaking of PCB routing, the newer versions of KiCAD have a "tune length" feature, where the length (delay) of one or more physical traces can be seen and matched to others.  I'm assuming the big commercial packages all have similar or better.

Finally, a good logic analyzer can be a lifesaver.

So where is it going? I think, ever-more-specialized... not ever-more-integrated.  And it has to, because there is too much data to integrate even some things.  There have been attempts, such as Labcenter Proteus (PIC/Atmel/AVR etc and Spice simulation) but what if you had to use a dsPIC33CK64MC105? (Unsupported.)
 

Offline louarnold

  • Contributor
  • Posts: 11
  • Country: 00
Re: Circuit Simulation: Where is it going?
« Reply #3 on: May 19, 2021, 09:32:21 am »
OK. Thanks for your input. I have to think about this some more; the choice between multiple MCUs vs cascading digital circuits.

Re: The timing constraints for ICs: The situation has arisen that some older digital ICs have become obsolete or hard to get. Replacement ICs have different timing constraints - clock vs data, etc. Typically, newer ICs have favorable timing changes; i.e. less chance for timing errors. Rather than using "select on test' for ICs on production boards, I want to make sure how far those constraints can range before timing errors arise. Having simulators that can scan through a range of timing constraints would be very useful. In essence, one uses a variable timing model. As these timings change asynchronously over the circuit, different interactions can be exposed. After all, ICs have variations from chip to chip.

For simulators to trap the timing errors, they would have to be told what signals to sense that are in error and grab the conditions that create them. I assume that no simulator currently has this capability, am I correct?

Re. Using multiple MCUs vs one MPU: I assume I can eliminate much of the digital circuitry that may be required around a single MPU by using several MCUs that are, in a sense, "closer" to the component that connects to the outside world - ex: a register that sets the direction of a radio beam.

Re. Separate non-mcu simulation: Yes, of course, but circuits driven by MCUs are very convenient, so that one need not generate sequences of input and their variations. After all, the code in the MCU that drives the outputs already exists in production boards.

Keep in mind that these designs must perform without error in real-time, such as landing an airplane.

Again, comments are welcome.
Thanks.
Lou.

LOL. Wow, for those designing simulators, that's a list of requirements.   ;D
Regards,
Lou
 

Offline louarnold

  • Contributor
  • Posts: 11
  • Country: 00
Re: Circuit Simulation: Where is it going?
« Reply #4 on: May 19, 2021, 09:38:28 am »
I saw the Logisim-Evolution software. Looks like fun, but needs a bit more "oumpf". :D

And, yes, a logic analyzer would help, but there is no more hardware to attach it too. Hard tools are too expensive and components to small to "grab". Those times are over. The lab is your desktop. Money goes to multi-desk software tools. We need to catch problems before we "go to press", so to speak. Consider the technical schools that can't afford these. Are you experiencing a shortage of qualified technicians?

Best wishes.
Lou.
« Last Edit: May 19, 2021, 09:50:40 am by louarnold »
Regards,
Lou
 

Online evb149

  • Super Contributor
  • ***
  • Posts: 1900
  • Country: us
Re: Circuit Simulation: Where is it going?
« Reply #5 on: May 19, 2021, 10:04:05 am »
It isn't necessarily easy to prove something is robust if important aspects of the design are asynchronous, combinatorial, prone to data races, and have variables of timing due to process, temperature, voltage, and even software / MCU timing jitter.

It might be easier just to redesign it so it is synchronous in some respect so that if there needs to be settling time or setup / hold time you can explicitly look at those relative to some kinds of clocks that are slow enough that they give you tolerance for these things before the next edge.

Microcontrollers *should* be easy to model as deterministic systems but alas almost no microcontrollers have available behavioral or RTL simulation models available so that one can meaningfully test timing and software performance.

If you want to use microcontrollers + the equivalent of logic circuits then I suggest considering some alternatives that are easier to design reliably with from easiest to most flexible / intricate:

* Cypress PSOC ICs many of which contain programmable logic blocks (you can treat it like a tiny synchronous PLD/FPGA and program it in verilog/vhdl) plus a microcontroller and you can generally synchronize the programmable logic with microcontroller and microcontroller peripheral signals using their IDE.

* XMOS microcontrollers.  Their precise signal timing and software action timings  are able to be simulated with their provided IDE development tools.  You can precisely implement the equivalent of logic circuits (and interfaces like SPI, UART, GPIO, ...) based on programmable software operations that are precisely timed with guaranted min/max timing.  You can also write usual microcontroller software but again its timing is fully able to be analyzed.  You effectively can do a lot of parallel processing which is again precisely timed and interfaced to make the operations predictable.

* FPGAs.  There are lots of simple microcontroller soft-cores out there like xilinx picoblaze or microblaze-mcs, lattice mico8/mico32, intel niosii/e, open riscv, et. al.  These are implemented as HDL logic inside the FPGA programmable logic.  So you can simulate the min/max/typical timings of the MCU operations (if you must)  as well as the other programmable logic peripherals you put into the same FPGA design based upon the parameters of the interface pins and the clocks and the FPGA design.  Then you get your simulations of logic + microcontroller + MCU peripherals using a xilinx/lattice/intel/whoever supported simulator IDE all in one.   Obviously you still have to design things synchronously and with suitable timing constraints for the logic analysis / synthesis to be able to generate a design implementation that is guaranteed to meet the given frequency and timing constraints but at least it is all possible to analyze / simulate and constrain using an integrated tool set that is correct for the design and devices in total.

But if you don't understand timing constraints and use synchronous design principles no simulator or device is going to save you from intentionally implementing a design that isn't architected to be deterministic and free of use of undefined asynchronously variable logic values, metastable values, et. al.

There are simulators like verilator et. al. that can simulate HDL behavioral / gate models that correspond to actual discrete logic devices but they don't really help with microcontroller interfaces except to the extent that you can create / find bus / interface functional models which essentially model whatever the interface is to the logic e.g. SPI port, UART, data bus, etc. and then you can apply various timing / frequency / data pattern constraints and test vectors to those simulated interfaces to see what the HDL system overall would do with different timing models applied.  But it won't simulate the MCU software and black box peripherals themselves unless you have a MCU + peripheral behavioral simulation model which exists for relatively few MCUs.

There are things like this:
https://en.wikipedia.org/wiki/OVPsim

...that can simulate the workings of various MCUs fully though that's usually more relevant for software/firmware verification than logic verification.

If you just need to know a HDL peripheral works in conjunction with particular external interfaces, model the HDL peripheral and its interfaces relative to test vector stimuli and timing variations and guarantee that the behavior is deterministic.

If you need to control the precise timing of a MCU firmware and device activating particular interface operations (e.g. when exactly in relative absolute time  does the MCU write byte #1 to the SPI port #1 vs when it sets GPIO PORTA1 high)  then you have to treat the MCU firmware and core operations timing and timing jitter as a modeled thing which may be both impractical and unnecessary.  But if you do need that kind of guarantee, start with XMOS and move to full FPGA if needed.


 
The following users thanked this post: louarnold

Online evb149

  • Super Contributor
  • ***
  • Posts: 1900
  • Country: us
Re: Circuit Simulation: Where is it going?
« Reply #6 on: May 19, 2021, 10:27:48 am »
PS some of the primary reasons the following exist and are marketed as they are may be relevant to consider:

* PSOC ("Programmable System On Chip") : e.g PSOC3/4/5 et. al.:
>> Allow a "system on a chip" solution for problems that may require:
>> 1: Multiple programmable digital logic CPLD blocks capable of simulating multiple 74xx chips or SPI/UART/whatever peripherals in logic.
>> 2: Multiple optional programmable analog blocks able to integrate multiple ICs of analog & mixed signal functionality into the MCU -- ADC, DAC, analog filters, op-amps, etc.
>>> 3: A powerful MCU with integrated digital / communications peripherals plus the attached programmable analog/digital peripherals.

* XMOS:
>> 1: Provide a large number of fast MCU cores e.g. 16, 32, etc. with high clock speeds (xxx MHz)  and predictable timing / inter-processor communications down to the cycle level.  So you can do parallel processing of different tasks with different cores so you don't need to manually "time slice" one MCU core to do many things.  Each MCU core can be dedicated to do only one thing (if desired) and then the combination of the independent MCU cores acting in parallel can communicate as needed to coordinate their actions.  So one MCU core plus its directly attached GPU signals can be programmed to act like say a 74XX chip or a SPI port or a UART or ethernet interface or USB interface or whatever.  Then another MCU core can exchange data with thes other MCU cores as needed.  But the peripheral "logic" can be whatever you can program so it goes beyond what standard MCUs constrain you to with an inflexible set of internal peripherals.


* FPGAS:  Even a sub-4000 / 6000 / 8000 logic element size few dollars FPGA can hold an small MCU and all the 7400 / CPLD equivalent logic you likely need.  Possibly even multiple independent microcontrollers equivalent.  And a bunch of UART/GPIO/SPI/JTAG interfaces if needed.
Here's an example e.g. the NIOS II/e soft 32-bit CPU can take less than 800 logic elements and run at upwards of 150 MHz clock rage and use (small) on-chip RAM / FLASH to hold its data/program or can expand to use off-chip RAM/FLASH if really necessary.  Then you add in whatever GPIO, periplerals, PLD / 74xx equivalent ICs you want to the design in the remaining space.  Free simulator available usually.
https://www.intel.com/content/www/us/en/programmable/documentation/iga1408573581143.html
Similar for microblaze-mcs, riscv cores, etc.


 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 21474
  • Country: nl
    • NCT Developments
Re: Circuit Simulation: Where is it going?
« Reply #7 on: May 19, 2021, 11:34:30 am »
In my experience it greatly depends on how wel a circuit has been designed. A long time ago an 8051 based board was acting up. Turned out the designer didn't include the logic (which is there in all examples  :palm: ) to disable the memory during a state in which was undefined on the 8051's external bus. The old memory wasn't fast enough to react on it but new (replacement) memory did. I strongly doubt these sort of situations can be caught using a simulation because they are so device specific. All in all I'd start with a thourough design review to see if the design is truly synchronous (as in setup & hold times are met by design) or not.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline louarnold

  • Contributor
  • Posts: 11
  • Country: 00
Re: Circuit Simulation: Where is it going?
« Reply #8 on: May 20, 2021, 10:29:52 pm »
@nctnico
Good point! But finding good designers is rather hard, now moreso than 20 years ago when these systems were first prototyped. I saw the Z80 assembly software that ran the system. Alot of NOPs for timing. I shuddered when they asked me to find newer ICs. I am a software engineer, after all. I'll push for a redesign with several an MPU and several MCU's. That sounds like its the most flexible.
Regards,
Lou
 

Offline louarnold

  • Contributor
  • Posts: 11
  • Country: 00
Re: Circuit Simulation: Where is it going?
« Reply #9 on: May 20, 2021, 10:34:16 pm »
OK, folks. You've been very helpful I have alot to think about. Being a software engineer, I like the MPU + MCU solution when its time to redesign. The hardware people will likely override me.  :(

Stay safe! But above all, stay happy.
Lou
Regards,
Lou
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 7982
  • Country: us
    • Personal site
Re: Circuit Simulation: Where is it going?
« Reply #10 on: May 20, 2021, 10:48:22 pm »
Going from 8051/Z80 to MPU + MCU without any other information does sound like an overkill. I would override too until further evidence is provided that it is really necessary.
Alex
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 21474
  • Country: nl
    • NCT Developments
Re: Circuit Simulation: Where is it going?
« Reply #11 on: May 20, 2021, 11:24:59 pm »
OK, folks. You've been very helpful I have alot to think about. Being a software engineer, I like the MPU + MCU solution when its time to redesign. The hardware people will likely override me.  :(
It is likely that a single microcontroller may be able to replace the entire board resulting in a lower production cost and lower chances of failure due to less parts. At some point getting near obsolete devices is going to be expensive as well as software maintenance.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf