In HDL Designer, you can use the Design Manager to automatically generate a skeleton for your test-bench. This will create a new Block Diagram with an instance of the design unit to be tested and a sub-block with ports defined to drive and examine the design units inputs and outputs.
· To create our ALU Test Bench, first open the Design Manager window and select the ALU component from the ALU library. When you have highlighted this component, go to the File/New menu and select Test Bench.
The Create Test Bench window will appear:
After clicking OK, the Design Browser window will contain a new component called ALU_tb with a Block Diagram view alread created. Open ALU_tb to see a design similar to Figure 2.
Resize and rearrange the two blocks so that it is more readable, as in Figure 3.
Notice that the signals that are output from your design component (in green) have the same name as those which are input into the sub-block called ALU_tester and vice-versa. We have not seen this before, but another feature of the Block Diagram Editor is that signals of the same name are the same signal, even if they are not visually connected together.
Now, let’s being to design the ALU_tester block, descend into this block by clicking on it and selecting a block diagram view from the create new view panel.