# 3 February Lab for CSCI 274

## Project goal

Implement the circuit for the top segment of a 7-segment display in the same way that we have solved problem 1-12 of the textbook below. Use diglog to create the sum-of-product gates circuit and simulate the circuit to show that it works as required.

## Starting off

Just like last time, create a protected directory for this lab by executing the following commands:

• mkdir csci/274/lab02
• chmod go-rx csci/274/lab02
• cd csci/274/lab02

If any of these steps fail, get in touch with the instructor!

## Our solution to problem 1-12

### Creating espresso input

Use an editor to put together a file Prob1_12.in that has the form shown below. This will serve as input to the espresso program. Espresso is a PLA (Programmed Logic Array) program written by graduate students at UC-Berkeley more than a decade ago. Espresso creates an output that shows a minimal sum-of-products logic equation that satisfies the input-output requirements. In this problem, the number of input variables is four, the number of output variables is one, and the number of product terms is sixteen. Note how we have arranged the inputs, A, B, C, and D in binary number order. Examine the file format to be certain you understand that the outputs are 1 for the inputs numbered 2, 3, 4, 5, 6, 7, 11, 14, and 15.

Here is the file contents of Prob1_12.in:

```.i 4
.p 16        #
0000 0       #   \ CD     00      01      11      10
0001 0       #  AB\     ------------------------------
0010 1       #  00 |     0(0)    1(0)    3(1)    2(1)
0011 1       #  01 |     4(1)    5(1)    7(1)    6(1)
0100 1       #  11 |    12(0)   13(0)   15(1)   14(1)
0101 1       #  10 |     8(0)    9(0)   11(1)   10(0)
0110 1
0111 1
1000 0
1001 0
1010 0
1011 1
1100 0
1101 0
1110 1
1111 1
.e
```

### Running espresso

Execute the espresso program on the above file by typing

• espresso Prob1_12.in > Prob1_12.out

This produces the following Prob1_12.out file:

```.i 4
.o 1
.p 4
01-- 1
--11 1
0-1- 1
-11- 1
.e
```

With a bit of decoding, the minimized sum-of-products equation can be read directly from the above file as

• F = A' B + C D + A'C + B C

Hint: The dashes (-) in the output mean don't care.

### Building the circuit with diglog

We then used diglog to create a sum-of-products implementation of the minimized equation.

## Testing out our work

### Getting started

To get started, copy our implementation of problem 1-12 into your space.

• cp /usr/local/csci/274/lab02/Prob1_12.in .
• cp /usr/local/csci/274/lab02/Prob1_12.lgf .

Note that both of these commands end with a space followed by a period.

### Trying out espresso

To verify that you can run espresso properly, run espresso on the Prob1_12.in file to produce Prob1_12.out. The output file should look like the one shown above.

### Trying out diglog

To strengthen your diglog skills, run diglog on the Prob1_12.lgf file.

• diglog Prob1_12

Because .lgf is the default extension for diglog you do not need to type the .lgd when starting diglog.

Once in diglog, move the text window down to the lower left corner. Then make the graphic screen larger by using the mouse on it's lower right corner. Use arrow keys to get the figure in the center of the screen. Enter "glow" mode by pressing the mouse on cursor and dragging over to glow. The red glow on the wires A, B, C, D will count up slowly as binary numbers from 0000 to 1111 Red is binary 1, and black is binary 0.

Note the color of output F for each of the sixteen input combination. The value of F should agree with the output value in the file Prob1_12.in.

Exit diglog by pressing misc and tdragging to save page. Hit the enter key. This will save your work. Quit by pressing misc and dragging to exit.

## Doing it yourself

Now that you have some expertise with diglog and espresso proceed with designing the circuit for the top segment of a 7-segment display. Now the top segment of the display is defined as follows:

• F(A, B, C, D) = Sigma(0, 2, 3, 5, 6, 7, 8, 9)
• F(A, B, C, D) = d(10, 11, 12, 13, 14, 15)

We suggest following these steps:

• Copy Prob1_12.in to lab02.in.
• Edit lab02.in to agree with the requirements of top segment problem given in the preceding paragraph.
• Run espresso to find the minimum sum-of-products implement.
• Copy Prob1_12.lgf to lab02.lgf.
• Start diglog on lab02 and change the circuit the solve the top segment problem.
• Turn on "glow" mode and verify that your implementation is correct.
• Save your work before exiting diglog

If you are willing to do a little testing, you can do the first few steps of the problem with Dean Brock's combinatorial circuit specification CGI script.

This lab based on Wayne Lang's Project 1 from last semester.