Lab 1

Introduction to Workview

Lab 1

Objectives

The question ``Is what I asked for what I wanted?'' is ubiquitous in design; this lab introduces the tools we use to ``ask for'' designs, and the tools we use to try to answer this question. We use a ``schematic capture'' system (really just a schematic-specific drawing program) to specify designs, and a circuit simulator to estimate how those designs will behave when we build them.

We use Workview Office, an extensive electronic CAD (Computer-Aided Design) system that allows you to enter digital circuit schematics and simulate them. The six parts you will use in this lab are

Workview Office, like most Windows programs, uses small, unclear icons for different features. However, if you hold you mouse over one of the icons for a few seconds, a little flag will pop up naming that button. The Workview Office programs can be launched from the program manager, or from the button bar. Sometimes the button bar will be full of applications, and other times it will be empty, so when in doubt, use the Program Manager.

Prelab

Things to do before coming to lab:

Get Started

A word of warning: Really big systems like Windows and Workview are never entirely bug-free or perfectly set up, so don't be surprised when something unexpected like an incomprehensible error message comes up. The best thing to do is to click OK and hope that that it is. Especially ignore things concerning license keys.

You will first need to get an account created for you by the TAs. Your login should be the same as your cory account. Once this is done, it should take about 5 minutes for the information to propagate, before you can log in.

Power on the computer if necessary. It should happily boot into Windows NT. Log in.

Creating your home directory

Unfortunately, the account creation does not automatically create a home directory, but it is easy enough to do yourself. This directory is a private work area on the file server, which can be used to store all your information. Your directory will be U:username, and you should use this to store all your work.

  1. Double-click File Manager.

  2. Ensure Drive U: is selected, and that you are at the top of the U drive hierarchy.

  3. Choose the File Create Directory menu item. Type in your account name.

Initializing Workview office

One other minor problem is that you need to initialize Workview Office each time you use a machine for the first time. The Workview Office icon bar starts up automatically, so you will know if you need to run the installer. The instructions for installing Workview are available from http://www-esg.eecs.berkeley.edu/labs/. You can run netscape to read these instructions while in the lab. Read and follow these instructions.

Once the installation is complete, log out and log back in. (To log out, either close the program manager or use control-alt-delete.)

Start Workview

To enter a schematic, you need to start Workview and create a ``project.'' Workview should place a menu bar in the upper left-hand corner of your screen when you log in. You can add programs to this menu for easy access, but for now, open ViewDraw from the Program Manager, in the Workview section.

Start Project Manager

Double-click the Project Manager icon (it looks like a file drawer) to start the Workview environment. The Program Manager program manages projects (collections of schematics).

Create a New Project

First, you need to select a directory for your project. In the place where in says primary directory, choose browse and type U:usernamelab1. You also need to add the necessary libraries. From the Project Import Existing menu item, select U:WVLIBVIEWDRAW.INI, and click OK. This adds all the needed libraries. Once this is done, choose Save from the File menu.

Start ViewDraw

From the Program Manager, start ViewDraw to create a schematic. From the file menu, select New. When it asks for type, select schematic, and name it MYXOR.

The ViewDraw window has a line of menus across the top, a drawing area in the center, and rows of buttons across the left and the right. The buttons on the left are for selecting and drawing, and the ones on the right control the view.

The buttons on the left control the function of the left mouse button. From the top down, they are:

  1. Select
  2. Add Component
  3. Add Fub
  4. Add Net
  5. Add Bus
  6. Add Pin
  7. Add Array
  8. Draw Arc
  9. Draw Box
  10. Draw Cirile
  11. Draw Line
  12. Insert Text

For the select button, clicking on an item selects it, or you can drag to select a group. Double clicking on an item brings up a properties dialog, and dragging on a selected object moves it around. Holding down control while dragging copies objects. Hitting delete will remove all selected objects.

The Add Component button brings up a dialog box, which will allow you select a component from a library. Click on the image of the component and then clicking in the work area will put down a component, and then it will retun to select mode. other options just allow you to click and drag to add an item.

The right hand buttons control the view. They are (from top to bottom)

  1. Full Page (views entire page)
  2. Zoom in
  3. Zoom out
  4. Zoom in an area
  5. Zoom in on selected items
  6. Save current zoom
  7. Restore zoom
  8. Up a level of complexity
  9. Down a hierarchy level (If you select a symbol and hit this button, you will open the schematic for this symbol)
  10. Go to the next page of the same schematic.

In addition, ViewDraw has compiled a list of all the functions most commonly used and placed it into 1 menu that can be accessed by simply holding down the mouse's right button while the mouse is within the span of the Workspace (see the next section). Move the mouse, while the right button is still depressed, up or down to access the different functions or submenus of still more functions.

Workspace

The ViewDraw window displays a reduced view of the 11 by 17 inch (B-sized) schematic drawing area, so a normal-sized gate will appear very small to begin with. Increase the zoom four times to increase the view until a grid appears. Later, when you have added some components, you may want to try the zoom and pan features.

Enter an XOR Gate Schematic

Use ViewDraw to create a schematic for an XOR gate using Figure 1 as a guide.

  
Figure 1: Schematic for an xor

Add Components

We need four NAND2 gates to build an XOR. Place them as follows:

  1. Select the add component button.

  2. Select the (xc4000) library.

  3. Scroll the list of buttons in the top of the dialog and click the NAND2.1 item in the list.

  4. Click on the symbol of the NAND2.

  5. Drag the component dialog out of the way and move the outline of the NAND gate to where you want it placed.

  6. Press the left mouse button to place the component.

  7. To place another component of the same type, repeat the process. Or, you may want to try the Edit Copy function.

Add and Delete Wires

Erudite electrical engineers call wires ``nets.'' We will, too.

Add Labels

Label every dangling net in your schematic so the outside world (in this case, the simulator SpeedWave - see the section below) has a way to refer to the inputs and outputs of your design. Move into select mode.

  1. Double-click one of the dangling nets (with a red square at the end), which brings up a dialog box.

  2. Ensure that Visible and Local are selected, and Inverted is not selected.

  3. Enter the name you want for the selected net. E.g., X, Y, and F. Click OK.

  4. You can then select the label and drag it around, to a position which suits your taste.

It is unnecessary to draw wires between everything you want connected: nets with the same label in the same componentgif are connected implicitly. When this facility makes your schematic clearer, use it. In addition, a schematic may consist of multiple pages, each ending in .1, .2 etc. Such nets are connected across multiple sheets of the same schematic. Although this is often a useful feature, it may confuse a schematic, making it harder to debug.

Save the Schematic

Select File Save and Check to save your work. Saving a design performs some simple checks on it, such as verifying that no net is given two different labels. Keep correcting errors and saving until no errors appear.

Remember to save often!

Print the Schematic

There are too few trees in the world as it is, and 180 students each printing fifteen copies of some silly little XOR schematic doesn't help the problem. So please print only if you find it absolutely necessary. We do not require a printout for the lab-just show it to the TA.

Run SpeedWave

Create the Wirelist

Much of CAD is converting information from one form to another, often just to make it more palatable for the next converter. For example, ViewDraw has a particular way of looking at a design (gates with drawn nets, labels, etc.), but the simulator ViewSim doesn't care about where the nets are drawn, only what they connect. Thus, the program ViewVsm is used to convert from what ViewDraw likes to what ViewSim likes.

Select the ViewVSM application, and have it run on the design name MYXOR. If all goes well, you will see 0 error(s) and 0 warning(s) in file myxor.vsm. If not, return to ViewDraw and correct any errors. Re-run ViewVSM until you get no errors.

Start SpeedWave

  1. Click SpeedWave in the Workview menu bar, or open it from the Program Manager.

  2. Open the netlist by choosing File Load Viewsim Netlist.SpeedWave will report any errors it finds in the schematic and leave you with a window.

Although there is an interface which is graphical, it is still primarily a command prompt based program. You enter commands in the little box in the lower, left hand corner of the screen.

Simulate Your XOR

Type the following commands into the command box:

w x y f
l x y
sim
h y
sim
h x
l y
sim
h y
sim

The w command tells SpeedWave to ``watch'' the specified nets, that is, to print their logic values after each simulation step. The results print out in to the middle of the window. The h command sets a net to a logic 1, and the l command sets a net to a logic 0. The sim command makes the simulator perform a simulation step, propagating input values to compute new outputs in the logic network. By default, SpeedWave used a simulation stepsize of 100 ns. You can change this with a command such as stepsize 500ns.

Such a sequence of commands can also be executed by placing them into a file with the extension .CMD and typing that name in the command box.

ViewDraw can be used to observe the state of the simulation. Bring up a ViewDraw window with the schematic as it is being simulated. Inputs, outputs, and pins on gates will have ones, zeros, and (more likely when you begin) X's indicating their current state. An X means the value is uncertain or undefined. If you change the schematic while simulating, you must re-run vsm and restart SpeedWave before those changes will affect the simulation.

For more information, try the help command in SpeedWave.

Use ViewTrace

ViewTrace can display the results of simulation as graphical waveforms instead of ones and zeros. Enter wave MYXOR.wfm f x y in SpeedWave to start up ViewTrace and specify which signals to display. Then enter restart and re-enter the commands from the previous section to exercise the circuit. Zoom in on a particular time interval to view gate delays, using the Zoom menu.gif

Close both ViewTrace and SpeedWave when you are done.

Create a Symbol

To use your XOR gate in other schematics, you need to create a symbol for it. Like the NAND gates you used, the symbol for the XOR gate will consist of a shape with some pins where nets can connect. With this symbol, your XOR gate can be used just like you used the NAND gates.

  
Figure 2: Symbol for an xor

Start ViewDraw if necessary. Choose File New, and make a new symbol, named MYXOR.

Draw the Symbol

Draw a box one tick mark in from the boundary.

  1. Click on the box tool.

  2. Click in one corner and drag your mouse across to the desired opposite corner. Release the mouse button to complete the box.

Add Pins

You need to define the interface between your XOR schematic and the outside world. ViewDraw uses ``pins'' to define which signals enter and leave a schematic. We need to add pins named X, Y, and F, which connect to the three dangling nets in the XOR schematic, or, if you came up with new names in your own schematic, make sure that you use those same names then in your own symbol. Use the following procedure to add three pins to your symbol.

  1. Select the pin tool.

  2. Left-click on the edge of the box you drew to start a pin, and drag to the outer box to complete it.

Label Pins

The pins need to be labeled with names corresponding to nets in the schematic. Use the following procedure to label the three pins X, Y, and F. Go into select mode and double click on a pin. In the dialog box, enter the label name, either X, Y, or F. You also need to set the attributes. Make the PINTYPE attribute be IN for X and Y, and OUT for pin F, and make the attribute invisible so that you do not see it.

Note: Pins may be both inputs and outputs by setting PINTYPE = BI. None of the pins in the XOR symbol should be given this type.

Add Text

To distinguish our XOR gate from every other box-shaped symbol, we will write ``MYXOR'' on it as follows.

  1. Choose the text tool.

  2. Click where you want the text to appear.

  3. Go into select mode, and double click on the text to change it to ``MYXOR''.

Save It

Save the symbol by selecting File Save. The symbol can now be used in other schematics.

  
Figure 3: (a) full-adder and (b) 4-bit adder

4-Bit Ripple Adder

In this section, you will use Workview to draw and simulate a full-adder, then you will extend this basic block to a 4-bit ripple adder.

The truth table in Figure 3a defines a full-adder. The full-adder has three inputs, A, B (two addends), and CI (carry in), and two outputs, S (sum) and CO (carry out).

A multi-bit ripple adder can be built from smaller multi-bit ripple adders or single bit adders (a full adder). Figure 3b shows a 4-bit ripple adder built from four full-adders. A 4-bit adder adds two 4-bit numbers to produce a 4-bit result and a carry out bit.

Checkoffs

To save yourself (and the TA) time, complete all the sections below, then have the TA examine your work.

Create and Simulate a Full Adder Cell

Figure 3a shows a typical full-adder. Enter it into Workview and build a symbol for it. Bring up SpeedWave and ViewTrace, and simulate the full adder to obtain a waveform representation of the truth table.

Show your TA a working full adder

40

Create 4-Bit Adder

Using Figure 3b as a guide, build a 4-bit adder

20

Simulate the 4-Bit Adder

Simulate the 4-bit adder for the following inputs and determine the delay through the adder for each.

30

Turned In During Lab

10



nweaver@cs.berkeley.edu