EUROMICRO JOURNAL 4 (1978) 76-81 © EU ROMICRO and North-Holland Publishing Company
A keyboard-oriented microprogram emulator and tester E. L. Dagless, B. G. Davies, M. D. Edwards Department of Electrical and Electronic Engineering, University College, Swansea, United Kingdom
aBsrRA~ objectives. The system is presently operating with the Intel 3000 series integrated circuit elements [8].
The development of microprogrammable processor equipment is becoming more widespread with the recent appearance of L S I microprocessor sets. The testing and debugging of the microprogram and the hardware it controls requires considerable skill. This paper describes a system under development at Swansea which is aimed at easing the problem~ a keyboard orientated microprogram emulation and test (K O M E T) equipment.
2.
The classical solutions to the problem of testing and debugging microprograms is to use either a software simulator or a hardware emulator. In a software simulator, the microprograms are loaded into another computer, and this computer simulates the operations performed by the microprogram. The advantages of software simulation are that microprogram debugging f a c i l i t i e s may be built into the simulator program, e.g. single step, breakpoints, and program trace f a c i l i t i e s . However, simulation is d i f f i c u l t to achieve in real time, and requires a great deal of special purpose software.
Th~ system is a general-purpose development aid that can be readily adapted to suit any microprocessor requirement. The hardware is comprised of standard, low cost, laboratory equipment, and uses a previously developed keystroke interpreter, The user controls the loading and running of the test microprogram, through a conventional keyboard and digital display, using simple keystroke commands. The range of facilities and the unique features of the system are described. The s~stem is aimed at providing an alternative to the engineers' console of conventional minicomputers, but support peripherals can be connected for program storage.
I.
SIMULATION/EMULATIONSCHEMES
The hardware emulator can be considered to be a black box that functions in a manner identical to that of the actual system to be implemented. The major advantage of emulation is that the mlcroprogram is tested in its operating environment.
INTRODUCTION
A hardware emulation approach is adopted for the testing and debuggingof microprogrammable processors. The emulator is constructed from available hardware modules. Thesemodules are controlled by a separate microprocessor which communicates with the user of the emulator system. Many of the debugging techniques used in software simulators are provided in the KOMET system.
With the introduction of programmable logic (PLA's, microprocessors, and micro-programmable processors) designers have to face the problem of integrating software and hardware design [6]. In a digital processing system, the hardware and software are usually debugged at separate stages of the prototype development. In many situations, the hardware and software should be debugged simulataneously. The problem may be partially solved by the emulation or simulation of certain hardware sections of the prototype. In a microprogrammable processor, the microprogram is an integral part of the system, and only a fraction of the hardware can be debugged without any microprogram. Only a combined debugging procedure can be adopted. Hardware emulation is particularly relevant when applied to the development of a microprogrammable processor.
3.
MICROPROGRAMMING
The concept of microprogramming was proposed by Wilkes in 1951 as a systematic means of designing the control units for digital computers. The microprogram, stored in ROM, provides the control sequences necessary for operation of the digital computer. Microprogramming has evolved into a recognised logic design process and is used in many logic design applications I l l , including the design of programmable logic systems. A block diagram of a typical microprogrammed processor is shown in Figure I.
This paper describes a microprogram development system called KOME T (Keyboard Orientated Microprogram Emulator and Tester), which is used for the testing and debugging of microprograms in a real time processing environment.
The control unit consists of a control memory, micro-instructionregister, and a microprogram sequencer.
K OMET may be easily adapted to suit any hardware system; this being one of the major design 76
A KEYBOARD-ORIENTED MICROPROGRAM EMULATOR AND TESTER
Address
CONTROL MEMORY
Register
Microinstruction Field N (
II l''°'leO01
IMicroprogrom Sequencer I
Nex'( Address Function
Control Function
IL
PROCESSOR
UNIT
J
Fig.1 Block Diagram of a Microprogrammable
The control memory, usually ROM, contains the microprogram to be obeyed, and is addressed by the microprogram sequencer. The micro-instruction register contains the current micro-instruction. The micro-instruction consists of a number of fields, each containing one or more bits, and each field controls the operation of a certain section of the processor unit. The micropregram sequencer interprets control instructions issued by the processor unit and the control memory, to calculate the address of the next micro-instruction to be executed. The next micro-instruction address may also depend upon the present microinstruction address. A more detailed account of microprogrammed processors is given by Boulay[ 2]. A similar approach to the design of programmable logic systems has been expounded by Clare [3]. In this method, the control sequences are performed by ROM- based algorithmic state machines.
4.
77
SYSTEMSPECIFICATION
The KOME T system is, in essence, a microprogram store emulator which is used to aid the user in the testing and debugging of microprograms. A block diagram of the system hardware is given in Figure 2. The basic system comprises of a keyboard, microprocessor system, display, read/write memory array, and a microprogram sequencer. The keyboard is used to issue commands to the microprocessor system, using a special purpose keystroke language [4],[7]. Examplesof typical
Processor
keystroke commands are 'Set Microprogram Address'~ 'Load Micro-instruction', 'Start', and 'Stop'. The microprocessor system (C YBA- O)[5], is based on the Intel 8008 microprocessor [9]. CYBA- 0 provides a user console to allow the loading and debugging of 8008 programs. CYB A- 0 is used to interpret the keystroke commands and execute them. I t communicates with the rest of the KOMET system through a number of 8-bit input/output ports. The display consists of eight 7-segment displays and eight status lamps. The 7-segment displays are used in conjunction with the keyboard for the reading of microprogram addresses and microinstructions for debugging purposes. The status lamps are used to flag the current status of the KOM ET system. The microprogram memory consists of up to four individually addressable blocks of IK x l 6 - b i t read/write memory. Thus, a microprogram of up to IK micro-instructions, each 64 bits wide, can be constructed. In the present system, the read/ write memory has an access time of one microsecond, which is suitable for many applications. However, the present memory can be replaced by faster memory (70 nanosecond access time) i f necessary. During the running of the microprogram, the memory acts as read-only memory. Micro-instructions may only be written into the memory when loading or editing microprograms. The microprogram sequencer is responsible for generating the next micro-instruction address in the microprogram at run time. Any commercially
78
E.L.
DAGLESS
et al.
Hicroinstruction Bus
I m
xl
o7~ g
I II
II
~.L~J.L,Next Address Function
'Microprogram Sequencer
J
J [
~ From jw---~ External Logic
Next Microinslruction Address
Fig.2
I I
Data Bus
h CYBA-O
l
Address Bus Control Bus
/'F
Block Diagram of the KOMET System
available microprogram sequencer or a special purpose sequencer designed for a dedicated application may be used.
keys are the d i g i t s , and the command keys are +, -, x, e , =. A string of keystrokes perform some arithmetic calculation.
In addition to the above hardware components, extra devices may be added to assist the user :
With KOMET, a string of keystrokes are used to i n i t i a t e an operation on the microprogram memory or the microprogram sequencer. However, before any operation can be performed, the v a l i d i t y of the Keystroke command sequence and i t s parameters must be checked. These operations are performed by an interpreter program resident in the CY BA-O microprocessor. The exact sequence of events is shown in the flow diagram of Figure 3.
a) A teletype is used for l i s t i n g the contents of the microprogram memory. b) A paper tape punch allows CY BA- 0 to dump the microprogram memory onto paper tape. c) A paper tape reader for reloading of the memory. The paper tape reader may also be used to load microprograms into the memory which have been assembled using a micro-assembler resident in another computer. 5.
KEYSTROKESTRUCTURE
In many electronic machines, the man/machine interface is achieved by using a dedicated keyboard. The commands and data for the machine are a series of keys pressed (keystrokes) on the keyboard. An example of a machine of this type is a four-function calculator, where the data
Errors created while inputting a command sequence are flagged immediately, and the interpreter returns to the home state. The complete command sequence must be re-entered by the use~after the erroneous keystroke has been identified. Since the command strings are not displayed, they must be short, otherwise reloading would become tedious. (The maximum length of a command string is 18 keystrokes; the average is 4). Every attempt has been made to reduce the number of keystrokes required during normal use of KO ME T (e.g. common parameters are stored and only entered when new values are required).
A KEYBOARD-ORIENTED
MICROPROGRAM
EMULATOR
AND
TESTER
79
microprogram memory. The f a c i l i t i e s available in the KOMET system f a l l into three main groups : definition of the microprogram instruction; reading and reloading of the microprogram memory; running of the program.
I Input
6.1. Definition of the Micro~ro~ram ~nstructions IFree Fiel~ Format)
Keystroke
The number of bits in a micro-instruction is dependent upon the microprogram application. The K OMET memory hardware is organised as four blocks of 16-bit wide words; thus, a 64-bit wide micro-instruction is possible. An instruction word w i l l be grouped into many binary fields of l b i t or more; a f i e l d controlling a single functional unit. Use of KOMET is greatly simplified i f the user is able to communicate with the microprogram memory using a formatted binary f i e l d ; the width of each f i e l d w i l l depend upon the application. The KOMET system incorporates the unique facil i t y of a free-field format; the grouping of bits (fields) is defined by the user for each 16-bit block of the instruction word. The user can define the f i e l d format at any time during the running of KOMET; default, i f undefined, is one 16-bit binary f i e l d . All subsequent manipulations of micro-instructions must comply with the format specified, otherwise errors occur. Furthermore, K OMET allows the user to manipulate any individual f i e l d without affecting the rest of the micro-instruction.
I Indicate an I ERROR
I
Execute COMMAND
The command sequence to define in Block 1 of the microprogram memory a 16-bit micro-instruction in fields of 6, 4, 3, 3, bits would be :
Block Number
[B L N ] l
Fig. 3 Flow Diagram of the Keystroke Interpreter The error conditions are indicated on the 8-digit display by displaying an 'Error' message, followed by two decimal d i g i t s , which define the type of error. The user is informed of parameters that are out of bounds and of i l l e g a l keystroke sequence. 6.
KEYSTROKECOMMANDS
The keystroke commands are designed to help the user debug the microprograms resident in the
Field Numbers l
2
3
6
4 • 3
4 • 3 [D E F]
where each d i g i t and decimal point is a Keystroke and the commands in brackets indicate a single keystroke command. B LN
is a command which identifies the block number used in this sequence. DE F is the command to define the f i e l d format of the selected block. Error messages are flagged i f the f i e l d d e f i n i tion requires more than 16 bits or more than 8 octal digits. Eight fields may be defined within a single block. These l i m i t s are set by the hardware configuration. 6.2. The ReadinB and Loading of the Micropro~ram Memory Any location in the microprogram memory can be
80
E.L.
D A G L E S S et al.
accessed using a user-defined address; the location selected can be loaded or read. The current memory address can be recalled and displayed at any time, and this address is automatically incremented when repeated Read or Write memory operations are performed. The microprogram memory of the 3000 series is organised conceptually as a 16x32 array; addressed using a 5-bit row count and 4-bit column count. Two read modes are provided, one of which increments the row address, the other increments the column address. This feature can simplify the examining of a microprogram. The memory location can also be addressed using the current address in the microprogram sequencer. Only one block may be accessed at a time, due to the limitations of the hardware organisation. The microprogram memory can be dumped onto paper tape or loaded from paper tape, one block at a time. Any section of a memory can be listed on the teletype. The current memory address defines the f i r s t location and the breakpoint address (see Section 6.3.2), the final location. All the memory locations are listed either in the f u l l f i e l d format, or for only one f i e l d . An example of a memoryaccess using the f i e l d format f a c i l i t y would be to load the 16-bit binary number : 10101
lO001010110
Assuming the f i e l d to have been previously defined to contain 6, 4, 3, 3, bits, the Keystrokesequence for this memory access is :
Block Number
Numberto be loaded as defined in fields
[BLN] l
53 . Ol . 2 . 6
Load MemoryBlock [LOAD]
The octal digits and decimal points each require a Keystroke and the commands B LN (Define B lock Number) and LOAD (local memory block) require a single Keystroke each. On completion of the above keystroke sequence, the interpreter checks the v a l i d i t y of the value in each f i e l d against i t s maximum allowed value. Any errors found are flagged, and the memory access abandoned. A single f i e l d can be loaded or read from memory independent of the rest of the micro-instruction. An example of this is to load f i e l d 3 of the previous example. The Keystroke sequence for the memory write is : Field Identifier
[B L N] 1
IF L] 3
Number to be loaded
2[L 0 A D]
Again, the value to be loaded is validated before being loaded. The free-field format can greatly improve the ease with which micro-instructions are handled. However, the f i e l d formats are not mandatory, and numbers can be loaded in 16-bit units by specifying the number as 6 octal digits. An example of this is to load l 0 l 0 l l 0 0 0 l 0 l 0 l l 0 with the Keystroke sequence :
Octal No. [B L N ] 1
1 26 12 6
[L 0 A D]
In the three memory access examples i t has been assumed that a memory address had been previously defined. I f no address had been defined, then an error would have occurred.
6.3. Program Run Modes When the microprogram is to be executed, a number of options are available to the user. The program can be started from either location zero (row O, col.O), or from the current address of the microprogram sequencer. There are three basic run modes in which KO ME T operates : Run, Runto, and Single Step; both Runto and Single Step have a trace option. 6.3.1. Run : The Run command allows the microprogram sequencer to execute microprograms at system clock speed. A Halt Keystroke w i l l stop the program when in this mode. 6.3.2. Runto : The run to breakpoint (RUNTO) commandc~es the microprogram sequencer to step under the control of the interpreter software. A Runto sequence is slow, because each clock cycle is controlled by a slow processor (C YBA-O) A full-speed breakpoint f a c i l i t y could be provided i f a hardware comparator is used. A Breakpoint address must be defined by the user prior to executing Runto. During Runto, the interpreter continuously stores the microprogram sequencer address in a push-down stack of 16 locations. These can be listed on the teletype after Runto has stopped. 6.3.3. Single Step : The single step mode allows the execution of one micro-instruction; the next micro-instruction address is automatically displayed. 6.3.4. Trace : The Runto and Single Step modes have a n ~ o n a l Trace f a c i l i t y . WhenTrace is selected, K OMET w i l l print on the teletype the address of each mlcro-instruction in an execution sequence.
A KEYBOARD-ORIENTED
7.
MICROPROGRAM
CONCLUSIONS
A microprogram development system has been described which is now operational, and is presently being used to debug the microprogram for a disc controller. After extensive t r i a l s , the system will be replicated to provide an undergraduate teaching system. As the hardware consists of standard laboratory components, students will be able to assemble a microprocessor and its development aid, to suit the application. The system can be extended to operate with other commercial micro-controllers, and the addition of hardware units to allow more real time debugging. REFERENCES I. AGRAWALAA.K. and RAUSCHERT.G. "Microprog : Perspective & Status" I EEE Trans.Elect.Comp., Vol.C-23, No.B, Aug./4. 2. BOULAYEG.G. "Microprogramming" (MacMillan Press, 1975). 3. CLAREC.R. "Designing Logic Systems Using State Machines". (McGraw-Hill, 1973). 4. DACKD.
"The Human Interface, KB's & P's". IEE Vac.School on Comp.Syst.for Engrs., Swansea, 74.
5. DAGLESSE.L. "User Manual for CYBA-O", Univ.Coll.of Swansea, Intnl.Publ.,1973. 6. DAVIDSONoW. "The Coming Merger of Hardware and Software Design". Electronics, May 29, 1975, pp.91-94. 7. DAVIES B.G. "The Keystroke Control of Electronic Instruments". M.Sc.Thesis, University of Wales, 1976. 8. INTEL CORPORATION. "Intel Series 3000" Reference Manual, 1975. 9. INTEL 8008 Users Manual, 1972.
EMULATOR
AND TESTER
81