a microprocessor trainer simulator - fie)...

4

Click here to load reader

Upload: dophuc

Post on 27-Jul-2018

216 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: A Microprocessor Trainer Simulator - FIE) Conferencearchive.fie-conference.org/fie96/papers/212.pdf · A Microprocessor Trainer Simulator ... microprocessor software and interfacing

A Microprocessor Trainer Simulator

William P. LovegroveBob Jones UniversityGreenville, SC 29614

Abstract

Historically, a two semester sequence of courses inmicroprocessor software and interfacing was taught using aprocessor such as the Motorola 6800. However, advances inthe field have necessitated teaching more advancedmicroprocessors (such as the Intel 80x86 family) in thesoftware course.

For several reasons we continue to teach theinterfacing course using the Motorola 6800. Reasonsinclude legacy laboratory hardware, tractability of the 8 bithardware bus, and the popularity of the 6800 familyderivatives as embedded controllers. Students are nowrequired to master the 6800 architecture and assemblylanguage in a short time at the beginning of this course.

To ease this learning process, we have developed asoftware simulation of the popular Heathkit Model ET-3400A microprocessor trainer. All hardware experimentsare carried out on the physical trainers, but students can dosoftware development at home without physically possessinga trainer. Anecdotal evidence to date suggests that thesimulator is of significant benefit to the students in quicklymastering the 6800 architecture.

The Old Curriculum

In the 1970's and 1980's, when microprocessorswere in their infancy, many universities taught a two orthree semester sequence of classes centered on one of thepopular eight bit processors, typically the Motorola 6800 orthe Intel 8085. Typically one semester was devoted tolearning the processor architecture and instruction set. Asecond semester was given to hardware interfacing.

As technology progressed and microprocessorsadvanced, these early eight bit processors quickly becameobsolete. Their use in university curriculums continued, forseveral reasons. First, the investment in equipment andcurriculum development required to change processors wassubstantial. Second, their simple architectures made themtractable within the constraints of a single semester. Finally,they continued to see wide use as processors in embeddedsystems, a factor that continues to this day.

The Move to 80x86 Software

Several recent developments have led to a re-examination of this philosophy. Not too long ago, the

majority of embedded system programming was done inassembly language. Now it is nearly all done in C or someother higher level programming language. Only the smallestand simplest systems are generally programmed entirely inassembly language. Of course, system software willcontinue to be written in assembly language. That, however,is not the application in mind in most engineeringdepartments.

In addition, most modern processors contain agrowing list of architectural features that are not easilyaddressed within the bounds of the older 8-bit processors.Capabilities such as floating point arithmetic, cachememory, pipelining, and high level language supportincreasingly need to be addressed.

Furthermore, the wealth of high quality inexpensivesoftware and hardware tools available on the IBM-PCcompatible platform have made the 80x86 architecture farmore tractable within a semester.

Finally, and most persuasively for us, the 80x86 isbeginning to see widespread use in embedded systems. TheIBM-PC compatible architecture is now so ubiquitous thannumerous single-board or even single-chip implementationsare available as a drop-in single component.

For all of these reasons, Bob Jones University andmany other engineering schools have abandoned the older8-bit architectures in favor of the 80x86 architecture. Ourfirst microprocessor course is now an 80x86 architectureand programming course.

By 80x86, we refer to the entire family ofsubsequent processors that have come from the originalIntel 8086. We concentrate on the core 8086 instruction set,and give brief coverage to the added features particularly inthe 80386 and 80486 processors. 6800 Hardware

Many schools have also migrated to the IBM-PC asa platform on which to study microprocessor hardware andinterfacing. We have chosen not to do so, for severalreasons. First is the availability of existing 6800 hardware.This includes not only the 6800 trainers that are the focus ofthis paper, but also in-circuit emulators and logic analyzerprobes.

Second, the 6800 and its family derivatives continueto see widespread use as embedded processors. The 68HC11in particular is a popular processor. Our embedded systemscourse is based on the 68HC11 architecture.

Page 2: A Microprocessor Trainer Simulator - FIE) Conferencearchive.fie-conference.org/fie96/papers/212.pdf · A Microprocessor Trainer Simulator ... microprocessor software and interfacing

Third, switching to a second architecture, even asimpler one, gives the students a breadth of experience thatprepares them to quickly move to any number of additionalprocessors throughout their career. We have also noticedthat the severe constraints of an 8-bit processor require moreprogramming skill from the students, sharpening their skills.

Fourth, the IBM-PC is a relatively complicatedhardware environment. DRAM refresh, DMA support,timers, multiple interrupt sources, video, disk, and keyboardcontrollers, a large BIOS, DOS -- all of these intrude on adiscussion of the most basic interfacing concepts. We havefound the 6800 trainer to be far more tractable at this level.

Finally, the system bus is generally not available forexperimentation in an IBM-PC compatible computer.Numerous experiments have been designed around the ISA-bus expansion slots. We feel, however, that it is importantfor students to experiment with the system bus itself.

The Need for a Simulator

The disadvantage of switching processors is thatpart of the second course must now be consumed withlearning the new architecture and assembly language.

The students have the programming skillsnecessary, and there are no major conceptual hurdles in thenew architecture. Nevertheless, practice is necessary tobecome skilled in the new assembly language. Someprogramming is required to test the hardware in the varioushardware experiments. A weakness in programming is ahindrance to performing the hardware experiments withinthe time constraints of the class.

Figure 1. The Heathkit Model 3400A MicroprocessorTrainer

Practice, however, is a problem because of the lackof availability of 6800 computers on which to program.80x86 machines have become ubiquitous, available incampus computer labs and in most dorm rooms. No 6800machines are available to the students outside the classroom.

6800 software simulators are available. However,they do not duplicate the environment of the Heathkit trainerused in our laboratories. Duplicating this environment isimportant. It is proficiency in this environment that isrequired to perform hardware experiments in a reasonabletime.

For these reasons, we have developed a MicrosoftWindows based software simulation of the Heathkit Model3400A microprocessor trainer (Figures 1 and 2). Simulation Design

This software was written in Delphi, Borland'svisual object-oriented Pascal compiler. The visualenvironment allowed for rapid prototyping and developmentof the program for a Windows environment. The compiled nature of Delphi provides for adequate performance of thesimulation, compared to some other interpreted visuallanguages.

This software is a full simulation of the complete6800 instruction set. It is more than merely a 6800simulator, however. The trainer keyboard and displayhardware are simulated as well, at the microprocessorinstruction level. Students can edit, execute, and testprograms exactly as they would on the real trainer.

However, an accurate simulation of the full trainerbehavior requires duplication of the Heathkit programscontained in the trainer ROM (much as an IBM-PCcompatible computer requires an IBM-PC compatible BIOSROM).

The Heathkit ROM programs do not contain acopyright notice. Nevertheless, Heathkit has been contactedregarding permission to copy this program. An answer wasstill pending at the time this paper was written.

The simulated 6800 instructions run at reasonablyfast speeds, due to the significantly higher clock speeds ofmodern PC's compared to the trainer's 1 MHz.

The simulated speed depends on the instructionsbeing executed. A typical test program that runs in 2seconds on a real 1MHz trainer requires 60 seconds on my66 MHz 486. This is an effective simulated clock speed of30 kHz. This has proven to be adequate for student use, andwe have not attempted to optimize the code to improve thisperformance.

We expected that accessing the simulated display,however, would significantly slow operation. When theappropriate store instruction is sensed, the real hardwareturns on or off a display segment with no additionalsoftware delay.

In the simulator, the display segment must be re-drawn on the screen in its new display state. This requireswrites to numerous on-screen pixels, and consumes manyprocessor cycles.

A simple timing loop that counts rapidly on thedisplay demonstrates otherwise. An effective clock rate of20KHz was measured. This video performance is of course

Page 3: A Microprocessor Trainer Simulator - FIE) Conferencearchive.fie-conference.org/fie96/papers/212.pdf · A Microprocessor Trainer Simulator ... microprocessor software and interfacing

dependent not only on the processor speed but also on thevideo adapter in use.

Integration in the Curriculum

This simulation is used in Ele 404 MicroprocessorInterfacing. The emphasis of this course is on computerhardware. Our chosen platform, for reasons explainedpreviously, is the Motorola 6800. Proficiency in 6800assembly language is necessary to complete the varioushardware assignments and exercises.

The students upon entering this class havecompleted a semester of 8086 assembly languageprogramming, but have no experience with the 6800.

The 6800 architecture, in comparison to the 8086, isrelatively simple with no new abstract concepts involved.The students are expected to master the basic instruction setin the first two weeks of the semester.

Classroom lectures highlight differences betweenthe two architectures. Homework assignments give studentspractice in writing 6800 assembly language. Two one-hourlaboratory exercises introduce them to the trainer, itsmemory map, and its I/O capabilities.

The Trainer Simulator allows the students anarbitrary amount of practice time with the new language onpersonal computers on their own time. Hardware vs. Simulation

All of the hardware laboratory exercises throughoutthe semester are performed on the real 6800 hardware. Wehave no desire to implement a full software simulation ofthe hardware. In our experience, it is important that studentsbe allowed to make the types of mistakes that are possibleonly with real hardware. As an extreme example, a reverse-polarized capacitor that explodes or bursts into flame is a farmore effective teacher than a computer dialog box thatinforms the student, in cold factual terms, that a componenthas been inserted backwards.

Nevertheless, in this class lack of familiarity withthe microprocessor and the associated operating system(ROM) is an impediment to gaining experience with thehardware. The simulator we have designed allows thestudents to quickly master the software in an environmentvery similar to the real hardware.

Enhanced Simulation

A further benefit of the simulation is that we canprovide enhanced capabilities to the trainer at minimal cost.For example, the simulator optionally provides a dis-assembler, which the real trainer cannot do at reasonablecost.

As shown in Figure 2, the mnemonic for the opcodebeing examined is displayed to the right of the keypad.

Figure 2. The Simulator

On-Line Documentation

In addition to operating instructions, the simulatorprovides on-line help containing some of the mostcommonly used reference material contained in the trainerreference manual and the programmer's reference card. Anopcode listing, memory map, and ROM subroutinereference put needed information at the student's fingertips.

Loading of Executable Files

One of the most time consuming aspects of testingprograms on the real trainer is the time required to enter theprogram in hex by hand. Although an assembler may beused to translate the program into opcodes, these opcodesmust still be entered one by one. If a program overwritesitself in memory due to a logic error or a typing mistake, theentire program may need to be re-entered repeatedly. Alarge amount of time is consumed entering, checking, andre-entering programs.

The simulator significantly improves this situationby adding the capability to load programs directly into thesimulator memory. Most 6800 assemblers (including thefreeware assembler available from Motorola) can produceoutput in the Motorola standard S19 format. The simulatorloads these S19 files directly into memory.

We do require students to perform some handassembly of programs. In their first exposure to the trainersthey do enter the programs by hand, in order to becomefamiliar with the interface. After that, they quickly beginusing an assembler.

Note that this feature is not currently available onour trainers. When the students perform the hardwareexperiments, they must still enter the programs by hand.

Page 4: A Microprocessor Trainer Simulator - FIE) Conferencearchive.fie-conference.org/fie96/papers/212.pdf · A Microprocessor Trainer Simulator ... microprocessor software and interfacing

Future Work

We have two plans for future improvements in thesimulator.

Verifying correctness

The instruction set is not yet fully tested. It isdifficult to construct a test suite that exercises everyinstruction in every addressing mode and checks everypossible condition code outcome for every possible operand.

A significant disadvantage of using simulators ingeneral is that the simulation may not be exact. If thesimulator contains errors or differences from the realprocessor, learning is hindered rather than helped. We haveexperienced this problem with one of the freeware 68000simulators that is available.

Our simulator does run all of the BIOS functionscorrectly. The BIOS exercises a large portion of theinstruction set, and is a reasonable indication that the bulk ofthe instruction set is implemented correctly.

We have two plans for further testing: 1) design testprograms that systematically test portions of the instructionset. The results of these programs (for example, a checksumof all the calculations) can be compared on the simulatorand on a real 6800. 2) Conduct group reviews of thesimulation code, verifying the logic and looking for errors.

Simulating interface hardware

The software interfaces to programmable interfacechips (such as the 6821 parallel I/O interface or the 6840programmable timer) can be challenging for students. Forreasons discussed previously we have no intention ofreplacing the hardware experience with these chips.Nevertheless, we are considering implementing a softwaresimulation for the purpose of programming practice.

In our experience the first programmable interfaceencountered is the most difficult. Once the concept of aprogrammable interface chip is mastered, the studentsquickly master details of future chips. We may implement asingle interface simulation, such as the 6821, to get themover that initial learning experience as quickly as possible.

Conclusions

This software was used for the first time in thespring semester 1996 at Bob Jones University. Nosystematic measurements of its effect on studentperformance have been attempted. Our personalobservations and student feedback suggest, however, that itis going to be an effective tool for learning 6800 assemblerand the trainer environment.

Links:

• ET3400 microprocessor trainer simulator• About the simulator