1<HTML> 2<HEAD> 3<TITLE>appa.htm</TITLE> 4<LINK REL="ToC" HREF="httoc.htm"> 5<LINK REL="Next" HREF="appb.htm"> 6<LINK REL="Previous" HREF="chap3.htm"></HEAD> 7<BODY BGCOLOR="#FFFFFF" TEXT="#000000"> 8<HR WIDTH=100% SIZE=6 ALIGN=CENTER> 9<H1 ALIGN="CENTER"> 10<CENTER><A ID="I1" NAME="I1">Appendix A Framework Overview 11<BR></A></CENTER></H1> 12<HR WIDTH=100% SIZE=6 ALIGN=CENTER> 13<P>BSVC provides a framework for writing microprocessor simulators with a set of C++ classes. This chapter gives an overview of the framework describing the class layout along with the user interface communication protocol.</P><A ID="I2" NAME="I2"> 14<BR> 15<FONT SIZE=+2><B>Overview</B></FONT></A> 16<HR SIZE=2 NOSHADE ALIGN=LEFT> 17<P>The framework is as generic as possible to allow simulation of any processor or device. It handles all interaction with the user interface process, provides base classes for common objects, furnishes timed events to simulate interrupts, and manages breakpoints. Figure A-1 shows the framework's layout. All the classes whose names start with 'Basic' are abstract base classes. These base classes are "molds" for the actual classes used in the simulator. For example in the Motorola 68000 simulator the BasicCPU class is the base class for the m68000<B> </B>class. </P> 18<P> 19<CENTER><IMG SRC="mg29.gif" WIDTH = 633 HEIGHT = 569 ALT="Undisplayed Graphic"></CENTER></P> 20<P ALIGN="CENTER"> 21<CENTER><B>FIGURE A-1</B> Framework Layout</CENTER></P><A ID="I3" NAME="I3"> 22<BR> 23<FONT SIZE=+2><B>Class Descriptions</B></FONT></A> 24<HR SIZE=2 NOSHADE ALIGN=LEFT> 25<P>This section provides a brief summary describing the purpose of each of the C++ classes in the framework.</P> 26<FONT SIZE=+1><B>AddressSpace</B></FONT> 27<P>This class maintains a collection of attached devices and provides methods to peek and poke into them. It's not an abstract base class and in most cases used as is. However using it as a super class you could derive a "VirtualAddressSpace" or "CachedAddressSpace" class supporting virtual or cached memory.</P> 28<FONT SIZE=+1><B>BasicCPU</B></FONT> 29<P>This class is the heart of the simulator its main purpose is to execute instructions and handle interrupts. Most of the work writing a simulator goes into the "CPU" class derived from this abstract base class.</P> 30<FONT SIZE=+1><B>BasicDevice</B></FONT> 31<P>This abstract base class is the foundation for all devices in the simulator. Its main job is to simulate the device at the register level and provided methods for the AddressSpace to read from and write to the device.</P> 32<FONT SIZE=+1><B>BasicDeviceRegistry</B></FONT> 33<P>This abstract base class is used to derive a class that maintains a list of all the devices in the simulator and allows them to be created.</P> 34<FONT SIZE=+1><B>BasicLoader</B></FONT> 35<P>This abstract base class provides methods to load object files into the simulator. A derived class should load all the object file formats supported by the simulator. The Interface<B> </B>object uses this derived object to load files into the simulator.</P> 36<FONT SIZE=+1><B>BreakpointList</B></FONT> 37<P>The Interface<B> </B>class uses this class to manage a list of breakpoints. This should not have to be modified.</P> 38<FONT SIZE=+1><B>Event</B></FONT> 39<P>This is a nested class in the EventHandler<B> </B>class. Whenever an EventBase derived object (i.e., a device) requests an event an Event<B> </B>object gets added to the EventHandler's<B> </B>delta queue.</P> 40<FONT SIZE=+1><B>EventHandler</B></FONT> 41<P>This class maintains a queue of events requested by EventBase<B> </B>derived objects. Whenever an event times-out the EventBase<B> </B>object's Callback method is executed. Events are useful for simulating regular time interval interrupts. You should not have to modify this class.</P> 42<FONT SIZE=+1><B>Interface</B></FONT> 43<P>This class communicates with the user interface. It provides a standard set of commands allowing the user interface to "wrap" around any simulator written with the BSVC framework. This class should not have to be modified.</P><A ID="I4" NAME="I4"> 44<BR> 45<FONT SIZE=+2><B>Communication with the User Interface</B></FONT></A> 46<HR SIZE=2 NOSHADE ALIGN=LEFT> 47<P>The simulator and user interface are two separate processes. The simulator process is a slave process that waits for commands from the user interface process. Whenever the user interacts with the user interface, commands are sent to the simulator to perform the necessary tasks. For example when the "Single Step" button is pressed the user interface sends "Step 1" to the simulator. In response to this command the simulator executes the next instruction. Listed below in Table A-1 are all the simulator commands.</P> 48<P><B>TABLE A- </B> Simulator Commands</P> 49<TABLE BORDER> 50<TR> 51<TD> 52<NOTE ALIGN="CENTER"> 53<CENTER><B>Command</B></CENTER></NOTE> 54<TD> 55<NOTE ALIGN="CENTER"> 56<CENTER><B>Arguments</B></CENTER></NOTE> 57<TD> 58<NOTE ALIGN="CENTER"> 59<CENTER><B>Description</B></CENTER></NOTE> 60<TR> 61<TD>AddBreakpoint 62<TD><addr> 63<TD>Sets a breakpoint at the address 64<TR> 65<TD>AttachDevice 66<TD><addrspace> <name> <args> 67<TD>Attaches the named device 68<TR> 69<TD>ClearStatistics 70<TD> 71<NOTE ALIGN="CENTER"> 72<CENTER><I>n/a</I></CENTER></NOTE> 73<TD>Clears any statistics the simulator keeps 74<TR> 75<TD>DetachDevice 76<TD><addrspace> <device index> 77<TD>Detaches the indexed device 78<TR> 79<TD>DeleteBreakpoint 80<TD><addr> 81<TD>Clear the breakpoint at address 82<TR> 83<TD>FillMemoryBlock 84<TD><addrspace> <addr> <len> <val> 85<TD>Fills the block of memory with the value 86<TR> 87<TD>ListAttachedDevices 88<TD><addrspace> 89<TD>Lists devices attached to the address space 90<TR> 91<TD>ListBreakpoints 92<TD> 93<NOTE ALIGN="CENTER"> 94<CENTER><I>n/a</I></CENTER></NOTE> 95<TD>Lists all the breakpoints that are set 96<TR> 97<TD>ListDevices 98<TD> 99<NOTE ALIGN="CENTER"> 100<CENTER><I>n/a</I></CENTER></NOTE> 101<TD>Lists available devices 102<TR> 103<TD>ListDeviceScript 104<TD><name> 105<TD>Lists the Tcl script for the named device 106<TR> 107<TD>ListExecutionTraceRecord 108<TD> 109<NOTE ALIGN="CENTER"> 110<CENTER><I>n/a</I></CENTER></NOTE> 111<TD>Lists the symbolic names in trace records 112<TR> 113<TD>ListDefaultExecutionTraceEntries 114<TD> 115<NOTE ALIGN="CENTER"> 116<CENTER><I>n/a</I></CENTER></NOTE> 117<TD>Lists the default trace records to display 118<TR> 119<TD>ListGranularity 120<TD> 121<NOTE ALIGN="CENTER"> 122<CENTER><I>n/a</I></CENTER></NOTE> 123<TD>Granularity in bytes 124<TR> 125<TD>ListMaximumAddress 126<TD><addrspace> 127<TD>Maximum address of the address space 128<TR> 129<TD>ListMemory 130<TD><addrspace> <addr> <len> 131<TD>Lists memory contents 132<TR> 133<TD>ListNumberOfAddressSpaces 134<TD> 135<NOTE ALIGN="CENTER"> 136<CENTER><I>n/a</I></CENTER></NOTE> 137<TD>Number of address spaces 138<TR> 139<TD>ListRegisters 140<TD> 141<NOTE ALIGN="CENTER"> 142<CENTER><I>n/a</I></CENTER></NOTE> 143<TD>List registers and values 144<TR> 145<TD>ListRegisterValue 146<TD><register name> 147<TD>Lists value of the named register 148<TR> 149<TD>ListRegisterDescription 150<TD><register name> 151<TD>Lists a description of the named register 152<TR> 153<TD>ListStatistics 154<TD> 155<NOTE ALIGN="CENTER"> 156<CENTER>n/a</CENTER></NOTE> 157<TD>Lists any statistics kept by the simulator 158<TR> 159<TD>LoadProgram 160<TD><addrspace> <filename> 161<TD>Load the named program 162<TR> 163<TD>ProgramCounterValue 164<TD> 165<NOTE ALIGN="CENTER"> 166<CENTER><I>n/a</I></CENTER></NOTE> 167<TD>Lists the value of the program counter 168<TR> 169<TD>Reset 170<TD> 171<NOTE ALIGN="CENTER"> 172<CENTER><I>n/a</I></CENTER></NOTE> 173<TD>System reset 174<TR> 175<TD>Run 176<TD> 177<NOTE ALIGN="CENTER"> 178<CENTER><I>n/a</I></CENTER></NOTE> 179<TD>Full speed execution 180<TR> 181<TD>SetMemory 182<TD><addrspace> <addr> <value> 183<TD>Sets the given memory location 184<TR> 185<TD>SetRegister 186<TD><register name> <value> 187<TD>Sets the named register to the value 188<TR> 189<TD>Step 190<TD><number> 191<TD>Execute instructions</TABLE> 192<P>This document was produced using an evaluation version of <A HREF="http://www.infoaccess.com/products/transit/httoc.htm">HTML Transit</A></P> 193</BODY></HTML> 194