To define the function of the input signals, you must add stimulus to your simulation. There are many ways to define stimulus with the Foundation Simulator. Some of these methods are listed below and are discussed in more detail in the sections to follow.
In this tutorial, you use the keyboard stimulus, custom formulae, internal binary counter, and script file. The script file method is used later in the tutorial when you are performing a timing simulation. All of these stimulator methods may be used in both functional and timing simulations.
Open the Stimulator Selection Window by clicking the Stimulator icon in the toolbar or by selecting Signal Add Stimulators...
The various components of this window are discussed in the following sections.
Figure 6.4 Stimulator Selector |
The Foundation Simulator includes an internal free-running 16-bit binary counter. You can use each of the 16 output bits of the counter as stimulators. These signals provide 50% duty cycle signals, each bit having half the frequency of the next least significant bit. These are useful when defining clock stimulus. You may define the frequency of the LSB of the counter (B0) and can therefore derive the frequencies of the other counter outputs.
These counter outputs are represented by the round yellow LEDs in the Stimulator Selection window. The row of red round LEDs below it represents the complement of the counter outputs. The B0 output (LSB) of the counter is the farthest LED to the right, and B15 (MSB) is all the way to the left.
In the Watch design, the system clock is generated by the internal oscillator in the XC4000E device. This is represented by the OSC4 component on the schematic. The OSC4 does not have a simulation model, and, thus, cannot be simulated. To simulate the system clock, you assign stimulus to the CLK signal in the simulator. You use the B0 stimulator signal to stimulate the CLK signal in the Watch design.
Figure 6.5 Simulator Preferences |
You assign keyboard keys as stimulus for signals in your design with the keyboard in the Stimulator Selection window. After you assign this stimulus, the signal's value toggles between 1 and 0 whenever you press the corresponding key on your PC's keyboard. Additionally, you can assign a constant 1 or 0 to a signal using the 1 and 0 keys on the Stimulator Selector's keyboard.
Now assign the R keyboard stimulus to the RESET signal in the Watch design.
The 16 square LEDs in the Stimulator Selector represent Custom Formulae. You have the option to define each of these 16 formulae to any custom stimulus pattern you want.
Now create a custom formula and then assign that formula to the STRTSTOP signal in the Watch design.
There are two sections of the Set Formulas window: Clocks and Formulas. Any pattern that you specify for a Clock repeats forever. Any pattern that you specify for a Formula executes just once, and then holds the last specified value for the rest of the simulation.
Figure 6.6 Creating Formulas |
There are a few more sections of the Stimulator Selector that are not used in this tutorial, but are discussed briefly here. For complete documentation on these topics, refer to the Foundation Logic Simulator online help.
The Clocks section contains four custom clock signals. These custom clocks are defined in the Set Formulas window as mentioned above in the Custom Formula section. These custom clocks are useful for clocks with duty cycles other than 50%. You could not use the internal binary counter outputs for those types of clocks or for other repeating functions.
The EN, DS, CC, OV, and CS buttons pertain to the mode of the signal and stimulus. These modes control options, such as whether the stimulus is overridden by internally driven signals and whether the stimulus is enabled or disabled at a given time.
Finally, the Delete button deletes the stimulus from a selected signal. This function does not delete the signal from the waveform viewer. It merely deletes the stimulus associated with that signal.
Close the Stimulator Selection window by clicking Close.