EDA Tutorial:System Design
This tutorial will demonstrate in an easily under- stood example what is known as top down design. The example selected, a ‘rolling dice’, was taken from student education in the university of the author. It has been used for many years in the VHDL basics course [26.3] and for first prototype runs in new CMOS technologies and for this reason it exists in several different implementations. It may be traced back to a first implementation [26.1], awarded as the second best student design on the international EUROPRACTICE conference in 1994 in Dresden [26.6]. It contains several different techniques for realizing a Finite State Machine, tightly coupled and locking with each other, and is far from trivial. The design with about 230 gates may be regarded as small today, but a complete reprint of the schematics generated from the code or the VHDL code itself is not possible in the context of this book, see [26.4] for more details. The design is demonstrated here in all its steps until it reaches the stage of being a product which is used by the author, e.g., as advertising tag for the university, as a visiting card, or similar purposes.
With this design we want to demonstrate modern integrated EDA tools as well as the variability of the results. The example is suitable for being transferred to other kinds of programs or other designs, and it may be taken as a basic guideline for digital designs in general.
System Design
The specification of the ‘rolling dice’ may be taken from the following, verbal formulation [26.3]:
• The display of the dice result, which may be one of 1, 2, ..., 6, shall be in the familiar form of a physical working dice but using LEDs.
• One button only will activate and operate the circuit.
• If the button is pressed the dice will be seen as ‘rolling’, this means that all display positions may be shown one after the other in a fast sequence. This sequence must be so fast that a definite stop for a certain result is impossible and the results seems to be random.
• When the button is released, the dice will roll down with continuously decreasing frequency, until it stops on a random number.
• The time it takes to roll down will depend on the time for which the button is pressed. The longer the button is pressed the longer the roll down shall last up to a certain maximum.
• Each change in the display will be marked acoustically by a ‘click’ sound, which is emitted by a piezo speaker. The ‘click’ sound should be about 4 kHz in frequency and last about 10 msec (a few oscillations only).
• After roll down ends, a melody of a few notes will be generated, depending on the resulting number, with the ‘six’ specially accented.
• For the basic clock frequency a clock crystal of 32 kHz shall be used, no other external components are allowed.
• The design must be fully synchronous.
A block diagram of the circuit, already partioned into the most important blocks, is shown in fig. 26.1.
The abovementioned functions may be realized in a few blocks, communicating with each other.
The rolling of the dice is carried out by a FSM 1) which represents a counter from 1 to 6 with related coding. Figure 26.2 shows the (simplified) state diagram of this FSM.
This state machine is controlled by the enable signal which is generated by a NCO (a numerical controlled oscillator). A NCO is a circuit where a parallel input word defines the frequency which is generated at the output. From its principle concept
this is an accumulator, which adds up the input word with each clock pulse. If the accumulator overflows it starts from the beginning again. The most significant bit (MSB) of the accumulator may be interpreted as a phase bit. The frequency of the phase bit’s changing depends linearly on the input word. The enable signal, derived from the phase bit and resulting in an one step counting, controls the roll down or roll up of the dice’s counter.
In this way the input of the NCO defines the rolling frequency of the dice. To create the rolling up and rolling down behaviour a second accumulator is used which is combined with a loop back to a first order system, seen from the point of view of control theory, the output of which is the input for the NCO. A button press now results in an exponential increase with an 1 − e−t/T behaviour
of the counting frequency, releasing the button in a e−t/T behaviour until zero is reached and the dice stops. The time constant T is chosen fixed by ergonomic points of view and depends on the feedback configuration.
During counting, with each enable of the counter a ‘click’, a fix frequency sound, must be generated, which is done by a second NCO. This NCO generates the sounds for the melody at the rolling stop too.
The sequence of functions is controlled by a central control FSM, the simplified state diagram is shown in fig. 26.3. On pressing the button the first time the FSM goes into ‘rolling’ state, the system is fully activated, the display enabled, and the rolling up behaviour initiated by continuous summing in the accumulator. If the button is now released, the system goes into the ‘rolling down’ state, the NCO is driven down, and the ‘click’ is generated. On stopping (NCO = 0) the melody generation starts with a few notes, which needs several states. At the same time the timer_16s starts, which resets the system after 16 seconds to the state ‘off ’ and shuts all circuitry completely off.
In state ‘off ’ all circuitry except the button super- vising functions is inactive, so power consumption in this state is reduced to less than 1 μA. In this way an additional on/off power switch may be avoided. The electronic dice will be powered by a 3 V lithium battery for more than a year of intermittent operating time.
Comments
Post a Comment