J
Jonathan Bromley
Guest
On Mon, 1 Feb 2010 10:00:24 -0800 (PST), rekz wrote:
that I for one am rather weary of the way you post a
problem, get a variety of useful and/or thought-provoking
answers, and then come right back with another little
bit of your problem drip-fed to us. It would have
been more congenial had you laid out the overall scope
of what you're trying to do, and given us an idea
of which parts you'd completed and which parts you
were finding troublesome.
Writing testbenches is, near enough, what I do for a
living these days. I've been doing it for quite a
while and I've spent most of that time learning stuff,
for there is much to learn. You can do some simple
things rather easily, but any testbench worthy of the
name will cost you serious thought, planning and
coding effort.
In a nutshell:
1. Write a module to represent the testbench.
2. In that module, create an instance of your
design-under-test (DUT) and all the signals
needed to connect to its ports.
3. Use one or more "initial" blocks to stimulate
the DUT's inputs with interesting, realistic
activity that will exercise the functionality
you wish to test.
4. Write one or more further "initial" blocks to
observe the relationship between the DUT's
inputs and outputs, continually checking that
those relationships are appropriate and
raising an error indication if not.
5. Write further code to keep account of what
tests your code has performed, so that - when
you are lucky enough to get a test that runs
without errors - you can measure confidently
what features of the DUT you have tested.
Of those five tasks, (1) and (2) are rather easy,
although they can be tedious if the DUT has many
ports; (3) is straightforward if your ambitions
are sufficiently modest, but can be difficult if
you wish to model complex and realistic scenarios;
(4) and (5) generally are rather challenging
to do well.
For more detail, try any half-decent textbook with
"Testbench" in its name.
--
Jonathan Bromley
well, I can't speak for anyone else but I have to admitWith that taken care of, how could I design the
test bench for this module?
anyone care to help me out?
that I for one am rather weary of the way you post a
problem, get a variety of useful and/or thought-provoking
answers, and then come right back with another little
bit of your problem drip-fed to us. It would have
been more congenial had you laid out the overall scope
of what you're trying to do, and given us an idea
of which parts you'd completed and which parts you
were finding troublesome.
Writing testbenches is, near enough, what I do for a
living these days. I've been doing it for quite a
while and I've spent most of that time learning stuff,
for there is much to learn. You can do some simple
things rather easily, but any testbench worthy of the
name will cost you serious thought, planning and
coding effort.
In a nutshell:
1. Write a module to represent the testbench.
2. In that module, create an instance of your
design-under-test (DUT) and all the signals
needed to connect to its ports.
3. Use one or more "initial" blocks to stimulate
the DUT's inputs with interesting, realistic
activity that will exercise the functionality
you wish to test.
4. Write one or more further "initial" blocks to
observe the relationship between the DUT's
inputs and outputs, continually checking that
those relationships are appropriate and
raising an error indication if not.
5. Write further code to keep account of what
tests your code has performed, so that - when
you are lucky enough to get a test that runs
without errors - you can measure confidently
what features of the DUT you have tested.
Of those five tasks, (1) and (2) are rather easy,
although they can be tedious if the DUT has many
ports; (3) is straightforward if your ambitions
are sufficiently modest, but can be difficult if
you wish to model complex and realistic scenarios;
(4) and (5) generally are rather challenging
to do well.
For more detail, try any half-decent textbook with
"Testbench" in its name.
--
Jonathan Bromley