Download Computer Architecture - Introduction to The SIM Software Package | CSE 420 and more Study Guides, Projects, Research Computer Architecture and Organization in PDF only on Docsity! INTRODUCTION TO THE SIM SOFTWARE PACKAGE Simulation systems are frequently used to design and evaluate digital circuits. In this course, you will use a software package named "sim" to study combinational and sequential circuits. Input to the simulator is a C++ program which describes each component of the circuit being simulated and the connections betweens the components. Each component is given as: component_type ( row_col_position, inputs, outputs, miscellaneous ); All component names begin with a capital letter. Multiple inputs are grouped as a list inside matching parentheses; not all components use all fields. The position of a component is based on a coordinate system where the rows are often specified using numbers (beginning with 1) and the columns are often specified using letters (beginning with a). Thus, the position in the upper left corner is "1a". Several components may be placed in the same position. Some of the commonly used components are: Not gate -- has a single input and output And gate -- has a variable number of inputs with a single output Or gate -- has a variable number of inputs with a single output Switch -- has no inputs but has a single output and an associated key Probe -- has only a single input but has no outputs Switches are used to generate input values in order to test a function. Each switch is controlled from the keyboard by a specified key. The value produced by a switch (a "0" or a "1") can be toggled by touching the appropriate key. The mouse arrow must be located inside the simulator window for the keys to control the simulator. A switch displays its current value. Probes are used to check the output values produced by a function. The value displayed by each probe is based on the input values supplied by the switches and the circuit to which the probe is connected. Data objects are declared to be type "Signal". The "sim" package uses the X11 graphical user interface and it must be executed on a server running SunOS, such as "arctic" or "pacific". In order for the shell to locate the executable version of "sim", you must add the following line to your ".personal" file: setenv PATH {$PATH}:/user/csearch/bin If your ".personal" file contains other "setenv PATH" statements, insert this new statement following the existing ones. To use "sim" during your current interactive session, execute the following command: <prompt> source .personal It will not be necessary to repeat these steps during subsequent sessions. Consider the following example: <prompt> cat sim.example.c /**************************************************************************** Implement the Boolean function F = AB’ + BC’D’ ****************************************************************************/ #include <Sim.h> // Interface to the "sim" package void simnet() // Function must be named "simnet" { Signal a, b, c, d, F; // Switch and output objects Signal notb, notc, notd; Signal and1, and2; // Intermediate objects // Components and interconnections Switch ( "1a", a, ’a’ ); // Switch a controlled by ’a’ key Switch ( "2a", b, ’b’ ); // Switch b controlled by ’b’ key Switch ( "3a", c, ’c’ ); // Switch c controlled by ’c’ key Switch ( "4a", d, ’d’ ); // Switch d controlled by ’d’ key Not ( "2b", b, notb ); // NOT gates Not ( "3b", c, notc ); Not ( "4b", d, notd ); And ( "2c", (a, notb), and1 ); // AND gates And ( "3c", (b, notc, notd), and2 ); Or ( "2d", (and1, and2), F ); // OR gate Probe ( "2e", F ); // Probe } The following command could be used to execute "sim": <prompt> sim sim.example.c While the simulator is running, window overlays sometimes erase part of the "sim" display. This can be redrawn by touching the "5" key on the numeric keypad. The simulation can be restarted with initial input values by touching the "F1" function key. You may exit the simulator by touching the "F10" function key while the mouse is positioned inside the simulator window. You may also exit by "quitting" on the window. Note that the simulator creates a file named "simex" which is equivalent to "a.out". You may rerun or remove it as you wish. Information about a specific component may be obtained with the command: <prompt> simhelp component_name The command "simhelp" without any arguments will give a list of available components.