|
2
Using BDE
Introduction
The SPW Block Diagram Editor (BDE) is the design capture environment of the Signal Processing Worksystem. Using BDE, you design a signal processing system by wiring together a network of blocks. The connections between blocks represent the flow of signals from one block to another. You can simulate and debug the system design using the SPW simulator.
BDE Design Window
A window in which you view and edit a block diagram is called a BDE design window.
Figure 2-1 shows a BDE design window with the major features labeled. These features are described later in the tutorial.
Figure 2-1 BDE Design Window
Command Entry Methods
There are often different ways to execute the same BDE command:
- Use the menu bar at the top of the design window (for example, View-Zoom Region). The menus displayed from the menu bar are called "pull-down" menus.
- Type the equivalent keyboard mnemonic sequence (F10 V Z for View-Zoom Region).
- Type the equivalent keyboard accelerator combination, if available (Control-z for View-Zoom Region).
- Click on the equivalent command icon on the left side of the design window, if available (the icon with a magnifying glass for View-Zoom Region).
- With the mouse pointer inside the working area of the design window, press and hold the right mouse button and select the equivalent command (if available) from the menu. This is called the "pop-up" menu.
- Double-click the left mouse button or press the middle mouse button to perform a designated operation. Some examples of this method are explained later in this chapter.
The tutorial instructions suggest only one command entry method for each procedure, but you can use an alternative method at any time.
Use the left mouse button for all mouse actions unless indicated otherwise. Thus, when the instructions say "click on the block," it means point to the block and press the left mouse button once. "Double-click" means to click the left mouse button twice without pausing between clicks.
Changing the View
You can zoom in on the block diagram to examine small details or zoom out to see more the block diagram. The scroll bars let you move the view vertically and horizontally without changing the viewing scale.
- Click on the View-Zoom Region icon (the button with a magnifying glass).
The BDE enters the View Zoom mode. The icon remains in the pressed position and the mouse pointer changes into a magnifying glass. The status line says VIEW ZOOM and instructions for using the command appear at the end of the status line.
- Place the magnifying-glass cursor above and to the left of the LMS block at the center of the block diagram. Press and hold the left mouse button, drag the mouse to make a rectangle around the LMS block, and then release the mouse button.
The area enclosed by the rectangle is enlarged to fill the working area.
- Try using the scroll bars along the right and bottom sides of the working area. Click on the small triangular stepper arrows to scroll the view by a small amount or in the darker grey area to scroll by a larger amount.
- Execute the command:
- With the mouse pointer inside the working area of the design window, type Control-f. (This is the keyboard accelerator for the View-Zoom to Fit command.)
BDE displays the whole block diagram as large as possible in the working area of the design window.
Adding Blocks
A common activity in BDE is choosing blocks from the SPW block libraries and adding instances of those blocks to the block diagram. Each block represents a signal processing function.
- In the File Manager window, click on the BDE icon. After a brief delay, the File Manager display a new design window.
- In the new design window, click on the Add-Blocks icon (the button with a square block inside). This displays the Add Block dialog box.
- Verify that the Logical Grouping button is selected at the top of the dialog box, as shown in the following figure.
Figure 2-2 Add Block Dialog Box
- Using the scroll bar, scroll down the list until you find the entry >Blocks>Math and double-click on that entry.
BDE changes the list box to show the block categories under >Blocks>Math>. It also changes the Search field to show the hierarchical path to the current list, >Blocks>Math>*.
- Find the entry Basic> and double-click on that entry.
BDE again changes the list box and changes the Search field to show the new path to the current list, >Blocks>Math>Basic>*.
- Find the entry Add 3-Input and double-click on that entry.
BDE is now set up to add an instance of the selected block, >Blocks>Math>Basic>Add 3-Input.
- Point to the working area of the design window. The cursor changes to an image of the Add 3-Input adder block.
- Move the adder block to the upper-left corner of the design window as shown in Figure 2-3, and then click the mouse button to place the block there.
Figure 2-3 One Instance of Add 3-Input Adder Block
This block adds the matching elements of the two input objects to produce the output object. The output object size is the union of the two input sizes. A small X-shaped cross marks each port (connection point) of the block.
- Using the same command sequence, add three more instances of the Add 3-Input adder block, as shown in Figure 2-4.
Figure 2-4 Four Instances of Add 3-Input Adder Block
Selecting Objects
To perform an editing operation such as moving, copying, or deleting, you need to select the object (or a set of multiple objects) to be affected by the editing command.
- Point to one of the blocks and click.
The block is selected and highlighted with a light background color. The status line displays the message "One Instance Selected."
- Press the right mouse button and select the Cut command in the pop-up menu. (This is the equivalent of the Edit-Cut command.)
The selected block is removed from the working area.
- Press the right mouse button and select the Undo command in the pop-up menu. (This is the equivalent of the Edit-Undo command.)
The block is restored to the working area in its former position.
- Click on a port (a connection point) of a block.
Only the port of the block is selected and highlighted. The status line displays the message "One Instance-Port Selected."
Note: The list of commands in the pop-up menu varies according to what is selected in the design window. For example, when there is nothing selected or just a block port selected, there is no Cut command.
Context Window
If you double-click on a block, it selects the block and also displays a "context window" for the block instance. A context window often contains block parameters that you can set on an instance-by-instance basis.
- Double-click on one of the blocks.
BDE displays the context window for the block. Context windows are similar to design windows in appearance. However, they have a different set of commands and a different background color. You will use context windows later in the tutorial.
- To close the context window, click on its up-arrow command icon.
Selecting Multiple Objects
You can select multiple objects by holding down the Control key while you select.
- In the design window containing the four Add 3-Input blocks, select the upper-left block.
- Hold down the Control key while you select the other three blocks, one at a time.
- Hold down the Control key while you click on a block a few times (slowly). Each time you click, the block is alternately selected or deselected.
- Point to a block and select it without using the Control key. This selects the block and cancels the previous selection.
- Point to an empty spot in the working area and click once. This selects nothing and cancels the previous selection.
Selecting a Region
You can select all objects that occupy a specified rectangular region.
- Point to the upper left corner of the working area.
- Hold down the mouse button, drag the mouse to form a rectangle around the two blocks on the left side, and release the mouse button. Both blocks are selected.
Note: A block must be entirely enclosed by the selection rectangle in order to be selected.
- For additional practice, try selecting single and multiple blocks by clicking and by selecting regions, with and without holding down the Control key.
More Selection Practice
Go to the design window containing the LMS Example block diagram and try the following types of object selection.
Note: The parameter and the input/output ports are part of the block instance but can be selected separately from the block as a whole.
Moving Objects
To move an object, you can select it and use the Edit-Move command. However, it is faster to use the middle mouse button, which is reserved for Move operations.
Moving a Single Object
- In the design window containing the four adder blocks, select one block.
- With the mouse pointer on the selected block, press and hold the middle mouse button.
- Drag the block to a new location and release the middle mouse button.
- Point to an empty spot in the working area and click to cancel the selection.
Moving Multiple Objects Together
Using the Cut, Copy, and Paste Commands
The Edit-Cut, Edit-Copy, and Edit-Paste commands can be used to move or copy objects from one place to another. These commands are available in the pop-up menu displayed when you press and hold the right mouse button.
Cut and Paste One Block
- In the design window containing the four adder blocks, select one block.
- Press and hold the right mouse button. In the pop-up menu, execute the Cut command. This removes the selected block and stores it on the "clipboard" (which cannot be seen).
- Using the pop-up menu, execute the Paste command.
- Press and hold the left mouse button, and the cursor changes to an image of the block that was cut.
- Drag the block to its original location and release the mouse button to place it there.
- Point to an empty spot in the working area and click to cancel the selection.
Cut and Paste Multiple Blocks
- Select two blocks.
- Using the pop-up menu, execute the Copy command. This copies the selected blocks and stores them on the clipboard.
- Using the pop-up menu, execute the Paste command.
- Press and hold the left mouse button to view the copied blocks.
- Drag the blocks to a new location and release the mouse button.
- Using the pop-up menu, execute the Cut command. This removes the selected blocks (the two new blocks).
Grid and Snap
You can display a grid of dots in the working area to mark the units of the coordinate system. By default, objects added to the design window "snap" to grid points. In other words, objects such as wire endpoints and block pins are forced to fall on the grid points, even when the grid is not displayed. This ensures precise alignment of objects to each other.
- In the design window containing the four adder blocks, execute the Options-Customize-Design Window command. This displays the dialog box shown in Figure 2-5.
Figure 2-5 Design Window Properties Dialog Box
- Move the dialog box aside so that you can see the design window.
- Toggle on the Grid button.
- Click on the Apply button.
The grid is displayed in the design window. By default, grid dots are drawn at intervals of 0.25 coordinate units, corresponding to a grid spacing of 0.25.
- Move one of the adder blocks.
The block pins (input and output connection points) always fall precisely on grid dots. When you release the mouse button after moving the block, the block "snaps" to grid points.
- In the dialog box, set the Snap "spacing (in inches)" field to 0.125 and the Grid "display every nth tick" field to 2.
- Click on the Apply button.
Now the snap spacing is 0.125 and the grid spacing is the same as before, 0.25 (2 X 0.125). However, now objects can snap to locations halfway between grid points.
- Try moving a block several times to observe the effects of these changes.
- Set the Snap "spacing (in inches)" field back to 0.25 and the Grid "display every nth tick" field back to 1.
- Click on the OK button.
Using Wire
When you connect the output of one block to the input of another block with wire, the two block pins are considered connected. When you run a simulation, data samples flow from the block output to the block input.
Remove Blocks
Block Name Search
- Click on the Add-Blocks icon.
- In the Search field of the Add Block dialog box, enter the text "Unit Delay" and press the Return key.
The dialog box lists all blocks (and other BDE models as well) containing the string "Unit Delay" in the logical grouping name, as shown in Figure 2-6. This feature is useful when you know the name of a block but not the logical grouping path to that name.
Figure 2-6 Add Block Dialog Box Search for "Unit Delay"
- Double-click on the following block name:
>Blocks>Memory/Delay>Unit Delay
- Add the Unit Delay block to the design window. The location is not important because you will move the blocks later.
- Click on the Add-Blocks icon again.
- In the dialog box, click on the Top button.
BDE displays the top-level logical grouping names.
- Double-click on the entry "Blocks>" in the list box.
The list box returns to the original top-level block list.
- Click on the Cancel button to remove the dialog box.
Move and Connect the Blocks
- In the design window, move the blocks to the approximate positions shown in Figure 2-7.
Figure 2-7 Three Blocks
- Click on the Add-Wire icon, which is the button with a picture of two triangular blocks connected by a wire.
- Point to the "out" output pin of the first adder block (the block on the left).
- Press and hold the left mouse button, drag to the input pin of the Unit Delay block, and release the mouse button. A wire is added between the press and release points.
Add a Two-Segment Connection
- Click on the Add-Wire icon again.
- Point to the output pin of the Unit Delay block.
- Press, drag to the "in2" input of the adder block on the right, and release.
BDE adds a diagonal connection.
- Execute the following command:
- Add the same connection again, but this time hold down the Shift key when you press, drag, and release to add the wire.
BDE adds a two-segment, L-shaped connection.
- Execute the following command:
Command Repetition Mode
- Double-click on the Add-Wire icon.
Double-clicking on a command icon places BDE in a command repetition mode. The Add-Wire icon stays in the "pressed" position so you can add as many wires as you want.
- Manually add a three-wire connection as indicated in Figure 2-8, one segment at a time.
Figure 2-8 Adding Wire Segments
Selecting Overlapping Objects
When multiple objects overlap the selection point, only the object with the highest selection priority is selected. The following exercise shows you how to select a particular object in these cases.
- Click on the Add-Wire icon.
- Point to the "out" port of the adder block on the right.
- Press and hold the mouse button, drag up five grid units, and release the mouse button.
A wire is added between the press and release points, as shown in Figure 2-9.
Figure 2-9 Block and Wire
- Click on the center of the adder block.
The whole block instance is selected.
- Click on the "in1" input port (at the top).
Just the port of the block instance is selected. A port or parameter that belongs to a block instance has higher selection priority than that of the whole block instance.
- Click on the "out" output port (on the right).
Just the port of the block instance is selected. The wire is not selected because it has a lower selection priority.
- Click on the top endpoint of the wire.
The whole block instance is selected. The selection area of a block is anywhere inside the "bounding box" that just encloses the whole block instance. The block instance has a higher selection priority than the wire.
- Click on the center of the wire.
The block instance is still selected because you are clicking on the bounding box of the block instance.
- Select a region that just encloses the wire, as shown in Figure 2-10: press, drag, and release to select the region.
The wire and the port are both selected.
Figure 2-10 Selecting a Region
Affinity Option Button
- Change the Affinity option button (just below the working area of the design window) from Instance to Wire.
- Click on various points along the length of the wire.
Now the wire is always selected, even when you click on the bottom endpoint, because "wire" has the highest selection priority.
- Set the Affinity option button back to Instance.
Edit-Stretch Command
The Edit-Stretch command lets you move a block while maintaining the wire connections to the block.
- Select the Unit Delay block.
- Execute the Edit-Stretch-Both command.
The cursor changes to a cross-hair shape.
- Point to the Unit Delay block.
- Press and hold the left mouse button, and then drag the block. The wires stretch to maintain the connections to the block.
- Release the mouse button. The block stays in its new position.
- Use the middle mouse button to move the block. This time the wires remain fixed and the block is no longer connected to the other blocks.
Ending the BDE Session
- In the design window containing the three blocks, execute the File-Close command. A dialog box asks you to confirm that you want to discard your edited design.
- Click on the OK button. The design window is closed and removed from the screen.
- In the remaining design window, execute the File-New command. If you made any editing changes to this block diagram (such as moving an object), a dialog box asks to confirm that you want to discard your edited design. In that case, click on the OK button.
The design window is cleared.
|
CoWare CoWare's Web Site Phone: 1-888-269-2738 CoWare Customer Support |