This applet demonstrates an Input Waveform Generator,
which could be used as an graphical input data generator or
as an Analog to Digital Converter Emulator.
The data can be a Function or a Draw.
In mathematics, a function is a relation, such that each element
of a set (the domain) is associated with a unique element of another
(possibly the same) set (the codomain or image).
For a Draw, one element domain can have one or more image point.
This feature is only to easily the graphical input assign.
When a domain point has more than one image point,
only the highest value will taken into account during the scanning.
Use the popupmenu ('edit') on the waveform component
to open the window with the graphical visualization.
Set the Draw Area Scale. Type the Minimum X value X0,
Maximum X Value X, Grid X Value GridX,
Minimum Y value Y0, Maximum Y Value Y,
Grid Y Value GridY, then press Set Scale.
The input waveform generator supports four operation modes:
 a) Lines: Select the Line Graphic type.
Then, draw one or more lines by clicking the mouse to create
the first point and drag to create the last point.
The adjacent lines can be connected by pressing connect line button.
 b) Point: Select the Point Graphic type.
Click the mouse to create one or more points.
The adjacent points can be connected by pressing
the connect points button.
 c) Hand Draw: Select the Free Draw Graphic type.
Position the mouse cursor at the first location and press
the left mouse button and draw :).
It is better to select the Draw mode instead of the Y(x)
option to handle "no function draws".
 d) Mathematical Function: Select the Formula Graphic type.
At the "Write one Formula" prompt, type a mathematical expression
or formula and press enter to calculate the result.
For instance, Type "100*sin(50*x)+10*cos(2*x)".
Most mathematical functions are available: sin, cos, tan, asin, acos,
atan, asinh, acosh, atanh, ln, log, abs, sqrt, sum, ^, +, , *, /, %.
Before you type the expression, select the 'best fit' X and Y range.
For instance, let us consider the "2^x" function.
This function grows up very fast. Select X ranges from 0 to 12,
Y ranges from 0 to 3000, set GridX to 1 and GridY to 500.
Then, press Set Scale and type the expression or
just type enter in expression dialog box.
Please, save the Graphical Input by using the 'File and Save' menu option.
If the graphical window is closed without saving, the current graphic
will be lost.
Click the Normalized button to convert the (x,y) value
to Binary Code from 0 to Nbit (where N is the Y resolution). T
The normalized value will be send to Y output.
The X (sampling) and Y bitwidth must be set and click on Add to Hades
to configure the output signal bitwidth.
Note that the bitwidth cannot be changed,
if the waveform component is already connected to other component
on the current Hades design.
If necessary, disconnect the waveform generator component, change
the parameters via the GUI, and then reconnect the waveform generator.
The graphic value will be send as digital values.
Set bit resolution (Y) and the rate sample resolution (X).
The Waveform component has three inputs:

Reset: Reset ON  disable and reset the component
to graphic function start point.
Reset OFF  enable the component.
Note that the reset input is activehigh.

Clock For each clock pulse a new sample (X,Y) value
is generated at the X and Y outputs. The X,Y value depends
on your waveform specification and bit resolution (Y) and bit sample (X).

Loop If Loop is ON, when the last sample is achieved,
the graphical scanner restarts. If Loop is OFF, the input waveform
generator stops, and the simulation is paused after stepping
through all samples.
The Waveform component has three outputs:

X vaule: X digital value. For instance, let us consider the
vector X with NBit. For the Minimum X value (X0),
the digital 0 value will be assigned. For the maximum X value,
the maximum NBit value will be assigned, and the intermediate values
will be computed and digitized corresondingly.
Note that for many applications, the X values are just an index into
the sample, so that the X output is not used at all.

Y value: Y digital value.
For instance, let us consider the vector Y with NBit.
For the Minimum Y value (X0), the digital 0 value will be assigned.
For the maximum Y value, the maximum NBit value will be assigned,
and the other value will be computed and digitalized.
The Y output is the signal generated by the input waveform
component.

Pulse: Clock INPUT echo when the component is enable.
For each new sample, an output pulse will be generated.
Component written by Wellerson Freitas and
Ricardo Ferreira, DPI, Universidade Federal Vicosa, Brazil, cacau@dpi.ufv.br