Laboratory 2 -- Controlling the COFFEEPOT virtual device |
In this laboratory, we are going to explore how to control devices attached to the address and data buses of a microprocessor. It would be difficult to attach a "real" device to the simulated 68K processor buses. Instead we will make use of a "virtual device".
In industry, it is expensive to custom design hardware, especially when you are not exactly sure of its final functionality. You often will have to code on rough device specifications with the final hardware design only crystallizing by the time you get to the code testing phase.
However, in real life, when you are ready to do the testing, you will probably find that the technician allocated to your project now has a rush job else where. The device will not ready for you to test for "a week next Wednesday fortnight"! When this happens engineers can develop and use the software equivalent of the device for testing and keep ahead of any possible problems, even without the hardware being available.
This software equivalent could be developed by placing subroutine calls in your code. The subroutines then mimic the action of the device. For example you might have to make a call such as
ControlDevice(MOVE_OPERATION, register, address, offset, read_write)
However, this approach is likely to introduce bugs when you modify the subroutine calls into the "actual" instructions needed to control the hardware device
MOVE.L D0, 4(A0) ; 68K syntax STW R3, 4(R4) ; PowerPC syntax
What you need is a software device that allows you to code in the proper fashion, rather than the artificial subroutine approach.
The "virtual devices" used in the "Companion" act like real hardware where you can actually MOVE data into and out of the device. There are no artificial subroutine calls required to make the device work. These virtual devices act in response to your code in exactly the same way as a real device would. They work this way whether you write in "C" or assembly code!
The COFFEEPOT virtual device is very straight forward to use, giving you a chance to get familiar with device operation. However the TRAIN and JUMBO-TRON virtual devices have the ability to demonstrate full animation, the ability to burn up when programmed incorrectly and other "real-life" responses. All this, but yet the virtual devices run in the controlled software environment of the SDS simulators.
I first developed these "virtual devices" to run in conjunction with "real" processors on the Motorola MC68332EVK (CISC) and Advanced Micro Devices SA29200 (RISC) evaluation boards. These "real-virtual" devices were the subject of an article in the November 1995 edition of the Computer Applications Journal.
Laboratory 2 involves activating the COFFEEPOT device registers to perform a certain series of operations to bring the water to a boil and then perk the coffee to your own taste.
![]() |
Last modified: July 16, 1996 11:42 PM by M. Smith.
Copyright -- M. R. Smith