you are making claims without
supporting them. Can you tell me why you believe your position? So
far you have simply stated it.
OK, let's keep separate things separate.
The bit that got my dander up was your implied, but
clear, statement that fewer lines of code makes for
fewer bugs. Others have stated this much more
starkly than you did. I rather strongly disagree
with it. Whilst it is evidently true that adding
more code to any project will of course increase
the number of bugs, since code is rarely bug-free,
that in itself provides not a shred of evidence
that the implementation of a given set of
functionality will have fewer bugs if implemented
using coding techniques that result in fewer
lines of code. My own experience suggests that
very compact, dense coding styles increase the
risk of subtle hidden bugs and oversights that
are very hard to track down. A more literate
coding style generally leads to more easily
debugged code. Clearly you can go too far
the other way - verbosity for its own
sake is unlikely to help, and in particular
it is never a good idea to have redundancy
in code. But the basic argument that leads
to the mantra "code it in fewer characters
and you'll get fewer bugs" is groundless, and
I'm convinced it has led to misguided choices
in the design and application of HDLs.
More directly related to what you posted
is the question of the most desirable
granularity to which you should decompose
a problem. I think I was clear enough in
my discomfort there. You can always make
each piece of a design trivially easy to
understand, simply by decomposing it into
pieces that are small enough. Is a shift
register small enough for you? A flop?
A mux? A transistor? The snag is, this
simplification comes at an unacceptable
price: it hides the real functionality
of the design or design fragment. As
others have indicated, it's probably
unhelpful to lay down rigid guidelines
here. I can suggest some touchstones:
is the piece of code amenable to testing
that will show whether it does what you
need it to do, without wasting effort by
testing some function such as a mux that's
already well-known to work? Can I write
a few lines of comment in the code that
describe succinctly what it does, and
why it's there? Can I relate this fragment
to any kind of specification or requirement?
The reality, though, is that the optimum
choices depend on the people doing the
work, the nature of the problem, the
customer's demands and a whole pile of
other things.
Despite all this fence-sitting, there is
something that seems obvious to me.
Breaking a design into excessively small
pieces (transistors!!) clearly obscures
its functionality. Leaving a design in
huge monolithic chunks (an entire FPGA
in one VHDL process!!) is clearly hopeless
too; no-one could possibly understand it.
Somewhere in the middle there is an
optimum - not ideal, but certainly better
than either end of that spectrum. Merely
saying "simpler is better" is inadequate.
For me, pieces of design small enough to
write as a single concurrent statement are
almost never big enough to give me useful
clues about how they contribute to the
overall functionality (unless you put a
function call in the expression).
Sorry about the lengthy ramblings. You
did ask for a justification
