.TL Circuit Design Aids (CDA) on Plan 9 .AU A. G. Hume .AU M. Kahrs .AU T. J. Killian .AB .SM CDA is a system for the design and prototyping of digital systems. At the front end it provides hierarchical schematic entry, programmable logic device design and board layout; at the back end it produces data for various manufacturing technologies, in particular wire-wrap and multiwire. .AE .NH Introduction. .LP .SM CDA is a design system, i.e., a collection of programs and data formats dating back almost 15 years. It has progressed with the accompanying changes in display, computing and device technology. To the .SM CDA user, A hardware design has a logical part and a physical part. The logical part consists of circuit schematics, generally supplemented by boolean equations together with finite state machines and programs in ROMs. The physical part includes board layout and wire routing. .LP .SM CDA has its own terminology; a circuit contains .I chips each identified by a .I name (which is arbitrary, and of mnemonic value to the designer) and a .I type (which is generic, e.g., .CW 74LS74 ")." Schematics can be hierarchical; what appears syntactically as a chip can, in fact, be an instance of a parameterless .I macro , (i.e., another drawing) if the file .I "type\c" .CW ".w" .R exists. Real chips have .I pins , each identified by a .I "pin name" and .I "pin number" "," and a .I "package type" "." Pin names and their mapping onto pin numbers are a property of the chip type; the mapping from pin numbers to physical coordinates is a property of the package type. .LP Pins are connected by .I nets "," which have unique .I "net names" (assigned by the drawing to net conversion program if omitted by the user). It is an error for a pin to be connected to more than one net. Nets such as .CW VCC and .CW GND generally need different routing algorithms from ordinary nets; these are called .I "special-signal nets" in cases where the distinction is important. .LP A .I board is a physical mounting for packages. It is mostly characterized by its .I "pin holes" (available for package insertion) and .I "special-signal pins" (connected to special-signal nets). An .I .SM I/O .R .I connector "," where signals enter or leave the board, is simply a special case of a chip. .LP The manual pages for the .SM CDA commands and file formats are in section 10 of the manual. Coventionally, the commands are kept in .CW /bin/cda , and so, for example, to run the .I gnet program, you would actually type something like .P1 cda/gnet < timing.g > timing.w .P2 .NH Methodology. .LP These are the conventional steps in a design. Many are necessary simply to maintain consistency between ``source'' and ``object'' files. We will collect all of this into a .CW mkfile in a later section. .nr P 0 1 .IP (\n+P) The interactive program .I graw is used to construct schematics (kept in files whose names end with .CW ".g" ".)" The net list of a circuit diagram (its .CW ".w" file) are derived from the .CW ".g" file by running .I "gnet" "." .IP (\n+P) Any editor may be used to create files in .CW lde format for logic that is to be implemented with Programmable Array Logic .SM "(PAL)" "'s." These filenames end with .CW ".lde" "." Pin information resides in a corresponding .CW ".p" file, generated by .I "part" which is a member of the .I part family of programs. .IP (\n+P) A .CW ".pins" file, that matches pin names with numbers for each chip type, must be constructed. Most pin information comes from standard libraries, but the user must generally supply some of it, usually for .SM I/O connectors (\c .CW io.pins ")" or non-standard chips (\c .CW my.pins ")." .I Mkpins reads .CW ".w" files, .CW ".p" files, and pin libraries to produce the .CW ".pins" file. The principal advantage of using .I mkpins is to reduce the size of the pins file and thereby speeding up the time spent in .I cdmglob. .IP (\n+P) .I "Cdmglob -f -v" reads the .CW ".w" and .CW ".pins" files to produce a .CW ".wx" file, in which all macros are expanded, and nets are described in terms of pin numbers. The .CW -v flag tells .I cdmglob to include the name of the expanded pins in the output. This will be used in the final stages by .I annotate to create a .CW ".a" file containing just the pin numbers (in .I graw format). This file, when "catted" with a .CW ".g" file will label all the pins with pin numbers. .IP (\n+P) At this point one may do static circuit checks with .I smoke "." The errors will be rather voluminous until all pins are declared correctly on the .CW ".tt" lines. Some errors are impossible to eradicate, particularly those with a mix of analog and digital components. .IP (\n+P) Most files discussed so far have to do with the logical part of the design, and, except for .CW ".lde" files, are in .SM CDL (Circuit Design Language). The remainder of the physical design files are in .SM FIZZ format. So, at this point, one uses .I "fizz cvt" to turn the .CW ".wx" file from .I cdmglob into a .SM FIZZ .CW ".fx" file. .IP (\n+P) As with the .CW ".pins" file, one creates a .CW ".pkg" file with geometric descriptions of each package type. .IP (\n+P) A geometric description of the board (\c .CW ".brd" or .CW ".board" file) in .SM FIZZ format is made (or stolen from .CW /sys/lib/cda/boards ")." .IP (\n+P) Chip positioning information (\c .CW ".pos" file) is generated. This is usually done interactively with .I "place" "." .IP (\n+P) At this point, the design should be checked with .I "check" "." This will find any errors that might result from unplaced chips or overlapping packages and so forth. .IP (\n+P) The wrap list (\c .CW ".wr" file) is now made, and one can physically wrap the board, typically by using a semiautomatic machine. .IP (\n+P) To make changes, one generates a new .CW ".wr" file; .I rework then compares the new and old wrap files and generates separate lists for unwrapping and rewrapping. .NH Graphics input .LP The graphics editor .I graw is used to create and modify drawings, a.k.a. schematics. A drawing consists of .I "chips, macros," and .I signals connected by .I pins. Each chip has a .I name and a .I type. Pins can have either a .I name or a .I number. .NH 2 Using graw .LP The editor, .I graw can be given a list of files ending in .I ".g." or an empty list. When .I cda starts, the cursor changes to a \(mu. Button 1 performs two tasks: a single click locates the cursor; when dragged with the button held down, the mouse leaves behind a line. Button 2 presents a list of useful options: .CW onesies\(-> can be used to select either .CW box which then can be used to sweep out the rectangle of a box using button 1, or .CW macros which can also sweep out a box using button 1. .LP .CW inst\(-> selects a master to be instantiated and attached to the cursor until any button is pressed. .I graw doesn't have any masters when loaded initially. The standard library of gates can be read by using the .CW read command. .CW sweep uses a rectangle input with button 1 to grab a set of objects and drag them until any button is pressed. .LP .CW slash differs from .CW sweep only in that rectilinear lines are first cut by the input rectangle. .LP .CW cut undraws and moves the object(s) last drawn or moved to the cut/paste buffer. .CW paste attaches a copy of the cut/paste buffer to the cursor until any button is pressed. .LP .CW snarf is a .CW cut without the undraw. .LP .CW scroll attaches the entire drawing to the cursor until any button is pressed. .LP The button 3 menu entries are .CW "edit, read, write, exit," and .CW new, followed by the list of filenames currently being edited. .LP .CW edit prompts for a file name and reads in the file for editing. Backspace and control-W may be used to edit the name; a null file name aborts the operation. .CW read prompts for the name of a master file, reads it in, and plants a reference to it in the current file. The names of the masters in the file are added to those in the .CW inst\(-> menu for the current file, overwriting older definitions if necessary. .CW write prompts for a file name (starting with the current file name). The non-null result becomes the new file name and the file is written. .CW exit terminates the program. You must type a `y' to really exit. .CW new creates a new, unnamed drawing for editing. .PP Selecting a file name selects the current file. .NH Signal Bundles and Macros. .LP Consider this buffer between two 8-bit busses: .PS " expands into the ordered list .CW x0 , .CW x1 ,... .CW x7 . The .I pattern .CW "D?\&" matches two-character pin names that begin with .CW D . (The space of possible names comes from the .CW .pins file entry for the chip type.) The names that match the pattern are .I "sorted alphabetically" and put into correspondence with the nets. .LP If connected sets of nets and pins do not have the same cardinality, the smaller set is reused until the larger is exhausted. Thus in the example, the .CW drive- net gets connected to both .CW OE0- and .CW OE1- , as desired. .LP Another example of the same buffer is shown below: .PS < fig3.pic Note that since the buffer symbol is too small to hold the name of the chip, the name and type are "connected" to the instance via a wire. The wire is \fInot\fP considered a net by \fIgnet\fP. Also notice that the range <0:7> after the name of the chip is appended to the pin names. In fact, this buffer has invisible pin names of .CW D and .CW Y . (input and output respectively). Thus, after appending the range, \fIgnet\fP will generate .CW D<0:7> and .CW Y<0:7> . Since the output enable can't fit, the output enables are put in another, smaller box. .LP Frequently one has a group of chips that will be used or replicated as a unit. In such a case it makes sense to define a .I macro that may be instantiated as required. A macro lives in its own file. Here is an example, .CW opm.j : .PS //VCC'' and ``//GND'' respectively. A .I sed script can be used to rid the net list of the file name prefixes: .P1 /\\/\\//s/ .*\\/\\// / s/ \\// / .P2 .LP Now we use generators to make several instances of .CW opm.j : .PS " , with the effect that all the .CW D0 "'s" are connected to .CW "bd0" , all the .CW D1 "'s" are connected to .CW "bd1" , etc; similarly, all the .CW A0 "'s" are connected to .CW ba0 . On the other hand, all the .CW "CS-" "'s" are separate: .CW "opm00/CS-" (the instance of .CW CS- in .CW opm00 ) is connected to .CW "ops00-" , .CW "opm01/CS-" is connected to .CW "ops01-" , etc. The manual entry for .I cdmglob should be consulted for all the details. .NH A Toy Example. .LP In this section we present a complete example. The design consists of two .SM I/O connectors that route signals from a ribbon cable to a backplane. Here is the schematic, followed by the .CW ".w" file: .PS