The protocol for the previous example was very trivial -- the Tcl script supplied two integers to the pipe, the C++ program read the two numbers and returned the sum back to the Tcl program via the pipe. This section will explain the more sophisticated protocols required by the GUI and the simulator engine to interact with one another. A specific example will be presented in the next section to help clarify the details regarding the protocols.
Because Tcl cannot yet handle binary data, the stream of information transferred between the GUI and the simulator is pure ASCII text. The information transferred through the pipe is broken down into individual stanzas. The structure of each stanza is composed of a stanza header and a stanza body. The stanza header can be thought of as representing a single entity, such as a component or a signal and consists of a single word followed by a colon. The stanza body contains attribute/value pairs which serve to qualify the entity. Such attributes include the type of the component or the list of values and times for a signal. Within each line of a stanza body, a colon must be placed after the attribute, thereby separating it from its value and each line of the stanza body must be indented by a tab character so that it can be distinguished from a stanza header line. There are no restrictions placed upon the order of the lines in the stanza body, but all attributes must be specified. An example of the generic format of each stanza is as follows:
This textual protocol format is very easy to parse using Tcl and C++. This format is also quite simple to extend -- if an entity requires another attribute, then another line is simply added to the stanza body and the module parsing the stream is modified accordingly to parse the new attribute line. A textual data stream, as opposed to a binary stream, also aids tremendously in the debugging process.
The interaction between the GUI and the simulator engine is comprised of two major protocols; namely, a component protocol which transfers the functional units from the GUI to the simulator engine and a netlist protocol which transfers the connectivity information from the GUI to the simulator. The netlist protocol is also responsible for transferring input and output signal values back and forth between the GUI and simulator engine. These two protocols form the basis of discussion for the next two subsections.