# diglog and espresso

You can do this lab in teams of two or three if you wish.

First you must install diglog and espresso on your PC. If you are using a PC on the UNCA campus and diglog is not available, download our copy of the PC installation file to your PC. Create a directory called

and store log304.exe there. Execute log304.exe to create log.exe, the actual executable. Now download our copy of espresso and also store it in C:\DOWNLOAD\CSCI255.

Surely, you remember the seven-segment display. Let's start with a seven-segment display with four inputs, but which only "cares" about the binary numbers from 0 (0000) to 9 (1001). We'll call this the 0-to-9 7-segment problem. When specified for espresso the seven segment display can be considered to have seven outputs. Conventionally, these seven outputs are called 'A' to 'G' and ordered by starting with the top-most segment, going clockwise around the six exterior segments, and adding the middle segment last.

Study the espresso input specification of the circuit below and make sure you understand how the output segments are specified:

```.i 4           # 4 inputs
.o 7           # 7 outputs
.p 16
0000 1111110   # 0
0001 0110000   # 1
0010 1101101   # 2
0011 1111001   # 3
0100 0110011   # 4
0101 1011011   # 5
0110 1011111   # 6
0111 1110000   # 7
1000 1111111   # 8
1001 1111011   # 9
1010 -------
1011 -------
1100 -------
1101 -------
1110 -------
1111 -------
.e
```

Your first task is to store this espresso input specification into the file lab5.in and espresso it with the following command:

• espresso < lab5.in > lab5.out

This should give you the following output file:

```.i 4
.o 7
.p 9
-0-0 1001100
-0-1 0110000
--10 1001100
-01- 0101001
-1-0 0010011
--11 1110000
--00 0110010
-101 1011011
1--- 1001011
.e
```

Now each person of your term should write out equations that correspond to two boolean functions discovered by espresso. Show these functions and your espresso output to the lab instructor.

Download a buggy diglog circuit for the 0-to-9 7-segment problem. Store this file as lab5.lgf and simulate it with diglog. Notice that the circuit uses a clock and counter to step through all 16 input combinations for four boolean values.

This circuit was constructed from the espresso output you studied above. The left column of eight AND gates in the circuit correspond to the first eight product terms suggested by espresso. Note that espresso's last "product term" has only one variable, so no AND is needed there.

Alas, the circuit has been sabotaged and not contains at least three bugs. Your job is to fix the bugs. First, "run" the circuit and determine when the bugs occur. You may find this easier to do if you temporarily replace the clock with an input pad. Remember, we only "care" about the values from 0 to 9. Ignore all other values. Stop the circuit at a bad output value, turn on glow mode, and then determine which gates are incorrectly wired by comparing the values of the wires.

When you have fixed the bugs, ask for another instructor check-off.

Presently, the circuit uses NOT, AND, and OR gates. Replace the AND and OR gates with NAND gates. Be sure you still are computing the right function. By the way, you'll have to do something special with the last product term, the one with only one variable, and with the ground that is routed to all unused inputs to the big eight-input OR gates. If you do this right, you'll end up with

• 4 inverters
• 8 2-input NAND gates
• 1 3-input NAND gates
• 3 4-input NAND gates
• 2 8-input NAND gates

Now suppose you needed to implement this circuit with 7400 SSI chips. These chips are packaged as follows:

7404
6 inverters
7400
4 2-input NAND gates
7410
3 2-input NAND gates
7420
2 4-input NAND gates
7430
1 8-input NAND gate

Modify your solution so that it uses the smallest number of these chips. Also, use diglog's label command to add the names of all your team members to the circuit. Show your result to the lab instructor.

First, log into your UNCA CSCI account and create a protected directory called csci/255. There are special programs on the UNCA CSCI computers that allow faculty to examine files stored within your csci directory. Log into the computer marshall.cs.unca.edu and execute the following commands to create the directory.

• mkdir -p ~/csci/255
• chmod go-rx ~/csci/255

Now use FTP to transfer your diglog file, log5.lgf, into this directory. You can use the same FTP program you used in either 107 or 201 for this task.