11
\$\begingroup\$

I have been tasked with building a simple alarm device. It just needs to measure a few inputs and the outputs will respond accordingly (to put it very simply!). To me, it seemed that using a few discrete logic gates would get the job done, but a colleague (who was working on it with me) decided that we should use programmable logic instead. His case won, because firstly, he is more senior than me, and secondly, his main argument was that programmable devices are the future and we want to make future proof products.

My question is if you have a design which could be easily implemented by a few discrete logic gates, is it worth designing with discrete logic any more? IS there any advantage to using them over programmable? Or is it slowly going to be phased out completely by programmable logic? To be clear, I don't want answers of 'I believe this is the case' or 'personally I think this but...' I'd like to know if there are any actual advantages to designing with discrete over programmable and is it worth designing with them these days in consumer electronics products?

\$\endgroup\$
  • 16
    \$\begingroup\$ This sounds like a question from the 90s... µC have won, its just so much easier to whack one in and be done than to think about how to connect half a dozen ICs together, let alone the space consumption. \$\endgroup\$ – PlasmaHH Apr 6 '18 at 8:01
  • 9
    \$\begingroup\$ Discrete gates have one big advantage. No toolchain. \$\endgroup\$ – jonk Apr 6 '18 at 8:03
  • \$\begingroup\$ No toolchain? What do you mean @jonk \$\endgroup\$ – Curious Apr 6 '18 at 8:27
  • \$\begingroup\$ @PlasmaHH so basically you're saying there is no advantage to designing discrete in the future? \$\endgroup\$ – Curious Apr 6 '18 at 8:28
  • 11
    \$\begingroup\$ What @jonk means is, when a microcontroller is used, you need software to create the program for the microcontroller, like an IDE (graphical or textual user interface) and compiler/linker/other tools combination dedicated for the microcontroller you use, called a tool chain. \$\endgroup\$ – Michel Keijzers Apr 6 '18 at 8:35
15
\$\begingroup\$

Discrete logic design won't be fully phased out. There will always be applications where using a discrete logic IC is preferable. As has been pointed out, speed is a big advantage, although in a lot of applications, the speed difference is just not that important.

When it comes to the design phase, if you design a circuit that only needs to perform 2 or 3 simple logic functions at different points in the circuit, it will be better to use discrete gates, just to save design time on having to also write the program too.

For systems that need to do more complex logic functions, it would be silly to spend all the time working out a truth table, then figuring out which logic gates go where etc when you could just write a small program. Usually, the more inputs mean the more gates required and the longer it takes to design in discrete.

The place where discrete logic really has the advantage though is in learning. When you are first learning about logic design and how gates work etc, that is where getting hands on with actual logic gates and designing different functions with discrete parts is great. Always a good idea to get an understanding of fundamentals. So, because of that, discrete logic is always going to have a place in this world. As for consumer electronics? The future is definitely programmable.

\$\endgroup\$
  • \$\begingroup\$ Simple answer, good points and answers all the questions asked! Thanks! \$\endgroup\$ – Curious Apr 6 '18 at 11:57
  • \$\begingroup\$ As programmer with an electronics background I would like to state that if you do not work out your truth table, you will spend as much time debugging your program as you will need time to set up your truth table. Your truth table will be nice documentation for your program. \$\endgroup\$ – chthon Apr 6 '18 at 14:28
  • \$\begingroup\$ Yeah, I do agree, truth tables are always useful to have, I'll edit the answer to make it a bit more relevant to this scenario \$\endgroup\$ – MCG Apr 6 '18 at 14:30
  • 1
    \$\begingroup\$ The last design I implemented using discrete logic had a timing requirement of "as low as possible" using 5V logic and a comparatively simple program requirement. I could spend a ton of money on a nice shiny FPGAs or just do it the "old school" way. Military spec chips undergo the full voltage swing in picoseconds, will survive the nuclear apocalypse along with the cockroaches, and also happen to cost almost nothing. There will always be a place for discrete logic. \$\endgroup\$ – Landak Apr 7 '18 at 14:37
14
\$\begingroup\$

I'm not a professional electronics engineer at all (actually just a beginner), but my few cents are that dedicated discrete logic ICs should only be used if timing is important or if it is a requirement not to use programmable logic.

With a microcontroller you can implement much more complicated logic and it is more flexible. Also it can be reprogrammed without having to change the hardware.

Also when very fast timings are needed that software cannot keep up with, dedicated logic ICs could be used. But for an alarm system this seems unneeded (it does not need a response time of nanoseconds).

Below is my interpretation of the advantages/disadvantages:

                          Discrete logic (ICs)      Programmable logic/
                                                    (Microcontrollers)
 Nanosecond speed                  x                         -
 Just a few 'operators' needed     x                         -
 No tool chain needed              x                         -
 Cost Efficiency *                 -                         x
 PCB / proto size                  -                         x
 Flexibility for changing          -                         x
 Production cost                   -                         x
 Possibility to extend features    -                         x

* Assuming more than a few (different) logic functions needed
\$\endgroup\$
  • 1
    \$\begingroup\$ So speed is the main advantage in your opinion? +1 for the answer, I especially like your table! \$\endgroup\$ – Curious Apr 6 '18 at 8:29
  • 1
    \$\begingroup\$ Yes, hardware is faster than software, so if you REALLY need the speed, you need hardware ICs, otherwise I would go for 'software' (microcontroller) solutions. Btw, nowadays for more complicated speed sensitive solutions FPGAs are used. \$\endgroup\$ – Michel Keijzers Apr 6 '18 at 8:32
  • 1
    \$\begingroup\$ I wasn't planning on using an FPGA, the head engineer has already decided the hardware now! I was just asking the question out of curiosity to see where any advantage lies. By the way, I will be accepting your answer in time if no other answers come up. Just want to give others a chance to answer before accepting prematurely! \$\endgroup\$ – Curious Apr 6 '18 at 8:53
  • 5
    \$\begingroup\$ I think your head engineer made the right decisions. An alarm system is typically something that will be extended (getting more inputs from mutliple sources and act on it), even making combinations of them, and later add functionality like sending an automatic SMS, signalling a beeper/alarm signal, maybe some logging of sensors etc. \$\endgroup\$ – Michel Keijzers Apr 6 '18 at 8:55
  • 2
    \$\begingroup\$ @MichelKeijzers modern FPGAs are significantly faster than anything that you could accomplish with traditional discrete logic ICs. \$\endgroup\$ – Tustique Apr 7 '18 at 0:39
10
\$\begingroup\$

If you're going to create a commercial product, you really shouldn't choose a design because "it's programmable" or because a more senior colleague proposed it. Instead you should estimate risks and costs associated with each design, and pick the one with the lowest cost and acceptable risk level. For a start:

  • price of individual components adds to the cost
  • required PCB size and complexity adds to the cost
  • required design effort and tools adds to the cost
  • required testing and certification adds to the cost

  • lack of flexibility (e.g. changes in discrete logic requiring a new PCB) is a risk
  • lack of experience with a particular technology in your team is a risk
  • inability to meet project requirements (e.g. target power consumption) is a risk

If sourcing discrete logic ICs for your particular project is cheaper, your team has experience with such design and you consider the lack of flexibility is not critical, there is no reason not to use discrete logic.

\$\endgroup\$
  • \$\begingroup\$ Very true. So you think there is a future for discrete logic then? \$\endgroup\$ – Curious Apr 6 '18 at 11:57
  • 4
    \$\begingroup\$ @Curious I still see individual BJTs and MOSFETs being used to implement basic logic functions here and there. Discrete logic is a useful abstraction for some simple tasks, so I'm convinced it will not disappear completely. \$\endgroup\$ – Dmitry Grigoryev Apr 6 '18 at 12:07
7
\$\begingroup\$

One aspect the other answers are forgetting is safety. Discrete logic circuits are way more reliable than much more complex microcontroller designs. I helped building a hydrogen prototype car, all the safety-circuits were designed using discrete logic. Safety and reliability is an aspect you'd might want to consider designing an alarmsystem.

\$\endgroup\$
  • 3
    \$\begingroup\$ This is not generally true. One could build a horrendously unsafe discrete system and an incredibly safe and robust system on a processor. Your team didn't have the skills to use a processor, but this does not make it inherently unsafe. You can have massive duplication in a processor, which would be impractical in a discrete system. \$\endgroup\$ – awjlogan Apr 6 '18 at 11:26
  • 1
    \$\begingroup\$ @awjlogan You can do both of those things, but your discrete logic emergency stop is never going to fail to activate because an unexpected condition sent another part of it into an infinite loop. Safety-critical systems must be as simple as possible. \$\endgroup\$ – immibis Apr 6 '18 at 11:27
  • 1
    \$\begingroup\$ @immibis That's bad design and spec, not inherent to a processor. There is always a possibility of failure in a system, discrete, FPGA, or whatever. Agreed that fail safes should be as simple as possible, that doesn't mean they need to be discrete. \$\endgroup\$ – awjlogan Apr 6 '18 at 11:30
  • 5
    \$\begingroup\$ @immibis Discrete logic becomes less reliable than MCUs past a certain design size due to soldering defects alone. And if discrete logic includes triggers, you end up having exactly the same problem with forbidden system states as you do in software. \$\endgroup\$ – Dmitry Grigoryev Apr 6 '18 at 11:51
  • 4
    \$\begingroup\$ Discrete parts might act more predictable IN case of a fault... \$\endgroup\$ – rackandboneman Apr 6 '18 at 12:28
4
\$\begingroup\$

I have to admit, whenever I have to do some complex combinatorial logic plus some timers, I don't bother with discrete logic at all but always code a minimal assembler program for an ATtiny (use a PIC if you like those better).

The combinatorial logic is at maximum 20 lines of assembler (several lookup tables). Each software timer adds another 10 lines. Hardware timers even less. You even gain advantage of having an A/D converter, Comparator, PWM generation on board, should you need those.

The only disadvantage is you had to flash this part. Sometimes that's a show-stopper, but it's seldom the case. The big advantage is you need much less space on the board, routing is much simpler, and you can easily change the logic functions if required.


The remaining use-case for separate logic ICs is when things have to work quicker than 1µs.

\$\endgroup\$
  • \$\begingroup\$ A little off topic, but the ATTiny x17/x16 parts have two built in 3-input LUTs. Very handy indeed! \$\endgroup\$ – awjlogan Apr 6 '18 at 12:18
4
\$\begingroup\$

In the end product - probably not many advantages to discrete logic if we are talking a consumer device. Exceptions would be something that needs to be very rugged against adverse conditions, or very easy to completely characterize (the actual complexity and potential for hidden bugs is much higher with something firmware based), or that you want to be able to build again from very similar parts for decades to come (74xx footprints change very very slowly even if the technology letters change :) ).

Something that you can actually do better with discretes is self-timing, asynchronous logic (completion of one thing immediately triggers another thing). The legitimacy of such designs is a holy war topic. Do not worry, the synchronous people will want to beat you but you just have to take their clock away, they will be nonsensically waiting forever for it.

When it comes to design methodology, I'd say it depends on the preferred style of the designer - a CPLD device that you could literally rewire live ("let's touch that wire to pins until something clicks in"), in a ratsnest view, and under power from a host PC (with simulated sparks when you touch a wire to a pin, preferrably, just for ambience) would certainly be well liked by people preferring discrete logic :)

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.