Computer Engineering 465 / Electrical Engineering 543

DIGITAL VLSI SYSTEMS

Writing Testbenches



This page introduces the concept of writing testbenches to verify the work of a modeled digital system. The elements and programming techniques used for this purpose are explained in detail. For each of the VHDL labs/projects, you will be asked to write a testbench for the lab/project that you are designing.

Introduction

After writing the VHDL code for a certain system and before processing the design, however, we should take the time to verify that the code actually does what it is intended to do, by running a simulation. VHDL is powerful as a test stimulus language.

One of the most important applications of VHDL is to capture the performance specification for a system, in the form of what is commonly referred to as a testbench. Testbenches are VHDL descriptions of circuit stimuli and corresponding expected outputs that verify the behavior of a circuit over time. They should be an integral part of any VHDL project and should be created together with other description of the system.

The easiest way to understand the concept of a testbench is to think of it as a virtual circuit tester. This tester, which you will describe in VHDL, applies stimulus to your design description and (optionally) verifies that the simulated circuit does what is intended to do.

After creating one or more testbenches as part of your design specification, you will need to use a simulator to apply the testbench to your design as it was originally written. This simulation will ensure that the design operates as expected. This type of simulation is called functional simulation, which will uncover most logical errors in the design.


Testbench Structure

When writing testbenches, you will most likely use a broader range of language features. The simplest testbenches are those that apply some sequence of inputs to the circuit under test (CUT) so that its operation can be observed in simulation. Such a testbench must consist of a declaration for a test component. In what follows, we will discuss the main structure and features of this test component:
 
Home Return back to the course home page.