next up previous contents
Next: 4.1.1 Detection of Valid Memory References Up: 4 Hardware Design Previous: 4 Hardware Design

4.1 Experimental Address Counter Card

As an exercise in PC interface card design, an address counter device was built. The card's function is to detect from bus signals exactly when memory reads and writes are performed (see Section 4.1.1), and increment a counter each time. A 20 bit counter is implemented using five 74LS169 four-bit counters. The count is read and reset by a timer-tick interrupt routine (see Section 4.1.2). The routine makes three byte reads from I/O ports 0x300, 0x301, and 0x302, which are decoded by a GAL on the card into enable signals for three 8-bit 74LS244 tri-state bus drivers. A long integer value is built from these 3 bytes and stored in a pre-allocated array. The routine then writes a byte to port 0x300 to reset the counter chips to zero. Note that several address references between the port reads and the port write are thrown away. This is a constant error, and can be manually corrected since the same instructions are run each time.

A frame program called busmon was written to allocate array space, install the timer-tick routine, and later remove the routine and process the data that has been collected. The size of the array space directly determines the length of time that address references can be counted. For example, an array of 11000 longs will fill up in about 10 minutes. While the counter routine is installed, busmon launches another program such as an application. The program name is specified on the command line to busmon; if not specified, a new command shell is spawned from which the user can run multiple programs. Upon termination of the specified program (or when the user types exit if the program is the command shell), the counts collected can be saved, averaged, or viewed graphically. See Appendix D.1 for a listing of busmon.c.

The card was built using an 8-bit breadboard and chips which were readily available in the lab. Correct operation was observed except that occasional counts were about twice the expected value. This was attributed to a failure of the port write to reset the count to zero. A kludge was implemented by using a loop to repeatedly write to the port if necessary until the counters reset to zero. A limit of 10 was placed on the loop to prevent an infinite loop in machines which do not have the hardware installed.





next up previous contents
Next: 4.1.1 Detection of Valid Memory References Up: 4 Hardware Design Previous: 4 Hardware Design



Scott E. Harrington
Sat Apr 29 18:56:25 EDT 1995