How to know that your solution is the best ?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to know that your solution is the best ?

Albert G
Like the book says, there are many ways to implement all of the gates, especially so for the more complex ones.  Some of the solutions are more efficient than others: maybe they use less wires ? Or they use a smaller number of parts ? Or the smallest number of internal pins ?

So how can I know that my solution is "the best" or one of the "bests".?

I think it would be useful for the hardware simulator to show that kind of information. I imagine it would not be too difficult to extend it so that it computes and shows a measure of the effectiveness of a design - maybe show a count of parts, pins, wires for the gate being designed, as well as totals for the internal gates it uses, and show that alongside the values for the "optimal" design.

It would keep students thinking about those cases where a design works, but is not optimal.

Just a thought.

Albert
Reply | Threaded
Open this post in threaded view
|

Re: How to know that your solution is the best ?

cadet1620
Administrator
This post was updated on .
Albert G wrote
Like the book says, there are many ways to implement all of the gates, especially so for the more complex ones.  Some of the solutions are more efficient than others: maybe they use less wires ? Or they use a smaller number of parts ? Or the smallest number of internal pins ?
"Optimization" is tough to define; it's a many-faceted problem. What parameters do you optimize for: speed, number of components, power used, cost, reliability, ...? For TECS, there are three obvious metrics that could be optimized: Nand gate count, number of HDL hdl part lines, worst case Nand gate delay count.

What's the best gate to count? That depends on the type of logic family (IC process) being used. For some it's Nand, for others its Nor.  For CMOS, both have equal speed but Nors are physically larger. For some families, extra inputs on the basic gate cost almost nothing so you would count a 1-input Nand (Not) the same as an 8-input Nand.

Since one of the major goals for this course is to teach abstraction, minimizing HDL code might be a good metric to optimize, but it leads to some rather convoluted circuits. Consider this Mux:

    Xor(a=a, b=b, out=x);      // (If you turn this in for your Mux,
    And(a=x, b=sel, out=y);    // your teacher will ask you how it
    Xor(a=a, b=y, out=out);    // works!)

It's cute; I don't think it can be done in fewer lines of HDL. But as a real-world solution its gate count is high, it's slow, and it's full of hazard glitches.

This is too complex an issue to try to address in an entry level course. Do some Google image searches, for instance "4-input multiplexer circuit", and you'll see examples of real world implementations.

--Mark