1. Introduction
A chaotic map [
1,
2] is a discrete system which generally has a very simple mathematical description. A chaotic oscillator [
3] is a continuous time system which is described by three or more differential equations. Those two systems must have a large positive Lyapunov exponent and high entropy to produce chaos [
2].
The fixed and floating point arithmetics can be performed in current microprocessors and microcontrollers. It will be shown that the multiplication in both arithmetic systems does not follow the associative property, this is for different numbers a, b, and c. These details must be known for any person that studies Computer Science, and in general these details are given as understood in any application. This characteristic that multiplication does not follow the associative property will be used to build different random number generators from a same chaotic map, and also to build different chaotic oscillators.
In [
4,
5] were already observed that in the implementation of chaotic maps, the order of the multiplications must be specified if one requires to reproduce the results shown in the literature. Authors in [
6] take advantage of these roundoff errors to propose a simple method to determine a lower bound error and the critical time for the pseudo-orbits in chaotic oscillators, and also its connection to the value of the maximum Lyapunov exponent. In [
7] the degradation produced by the fixed point implementation of chaotic maps is studied and compared with their floating point implementation.
The motivation of this work was to observe that the implementation in hardware of a chaotic entity must follow carefully the simulation in software, or vice versa, if one requires to obtain the same results. But also we observe that a modified implementation follows the same dynamical behavior. Then, we try in this work to analyze how new entities, of chaotic oscillators or chaotic maps, new in the way that produce different results, can be constructed by modifying the order of the multiplications in their fixed point implementations.
2. Multiplication Inside a Computer Is Not Associative
In algebra, three numbers as can be multiplied as or or given all the same result, where the three numbers a, b, and c can be integers of real numbers. This is the associative property which is fulfilled for these numbers. Because of the associativity, grouping parenthesis can be omitted without ambiguity. Inside a computer . We are going to explain why the multiplication does not follow the associative property, both in floating point arithmetic or even in fixed point arithmetic.
A floating point (FP) number is composed as
, where
s is the significand and
e is the exponent. Both
s and
e are integers numbers. If
p bits are used for the significand, it could take values from 0 to
. A FP number is normalized if it has one single number different than zero in the integer part, for example, the number 1234 in decimal is normalized as
, and here four decimal numbers are used in the significand. The multiplication of two FP numbers
, and
is performed multiplying the significands as
and the exponents are summed (
), and also both results are rounded and the final result is normalized. Much more details are involved in FP arithmetic [
8]. The multiplication of the two significands is the source than numbers calculated inside the computer are not associative. The multiplication result must be maintained in the same size as the significands, thus that result must be truncated or rounded to the nearest number. We will show this effect with one example. Given these three FP numbers:
,
, and
, multiplying the significands of the first two numbers gives:
(1.0789 ) × (1.9999 ) = 2.15769211 , and multiplying this result by the third number results.
(2.1577 ) × (5.1110 ) = 11.02800470 . And now, multiplying the second and the third number results.
(1.9999 ) × (5.1110 ) = 10.22148890 , and multiplying this last result by the first number gives:
(1.0221 ) × (1.0789 ) = 1.10274369 .
Both results and differ in 0.001. This small difference will always occur, regardless of whether the multiplication result is truncated or rounded to the nearest number.
Now we are going to analyze the fixed point arithmetic. The notation will be used here to represent a set of numbers that uses a bits in the integer part, and b bits in the fractional part. Each number is of size bits (plus the sign bit) and indeed this number is stored as a signed integer of size bits.
For a number
, if the negative numbers of size
are represented in complement 2 notation [
9], the range of numbers that can be represented is
Summing up two numbers
results in a number
[
9]. The multiplication of two numbers
results in a number
[
9]. It is possible to verify these results by applying the respective operation to the two extreme numbers in Equation (
1).
A microprocessor offers the sum and multiplication of two integer numbers and the result is stored in a number of the same size that the operands. In a hardware design for a given application, one must use a big enough number to store the sum of two numbers, and the result to multiply two numbers must be returned to a number. The easiest way to perform this is by truncating the result: the resulted number is shifted b bits to the right, and again the number of bits a must be big enough to store the resulted number.
The binary point in the representation is virtual. With three bits for it is possible to represent numbers , or , which need an adder of 4 bits and a multiplier of two numbers of 4 bits.
The small differences among the multiplications of three terms can be exploited by chaotic systems to generate different behaviors. The chaotic systems of a map and an oscillator will be explained in the next section.
3. Two Chaotic Systems: Maps and Oscillators
The 2D map was proposed by Sprott in 1993 [
10] and is defined by
It is possible to observe in Equation (
2) that this simple 2D chaotic map uses only sums and multiplications. In [
10] the values of the coefficients
, for
in Equation (
2) that produce chaos were searched by a computer program. Twelve different sets of values for these coefficients are given in [
10]. In this work we use the values
,
,
,
,
,
,
,
,
,
,
,
.
There are six quadratic terms in Equation (
2), three terms in the expression for
:
,
, and
; and another three quadratics terms for
:
,
, and
. The terms with
and
can be calculated in two forms, i.e.,
and
. The other terms can be arranged in three forms, i.e.,
can be calculated as
, or
, or
. In this manner there exist
different forms to associate the terms to calculate the products for
, and the same number of forms to calculate
. Therefore, there exist
different forms to calculate the 2D map. The small differences in the multiplications results are amplified by the chaos, indeed this is a definition for chaos [
1,
3,
11]. 144 different pseudo random number generators as in [
11] can be implemented using this 2D map. This result will be shown in
Section 4.
The Lü oscillator Chapters 4 and 6 in [
9] is defined as
where
a,
b,
c,
d are fixed coefficient values, and
f function will be defined later. If Equation (
3) is integrated using the Euler method, it results in
where
h is the integration step value. Expanding the parameter
h in Equation (
4), four terms with two multiplication each one (and different associations on them) can be obtained. An initial state
must be given to apply Equation (
4).
Observe in Equation (
4) that for the calculation of
there are four terms with two multiplications each, thus
different oscillators can be built by changing the association in which these multiplications are calculated.
Function
f in Equations (
3) and (
4) is a piece-wise linear function. For an oscillator with
p even number of scrolls,
, the form of
f has
p plateaus, and
transitions between each pair of plateaus. If the width between each pair of transitions is
w, the transition has a slope
m, and the length of each transition is
, function
f has the form in Equation (
5).
where
s is calculated as
and
if
. In Equation (
5),
k is a scale factor for
f in each plateau. Function
f is even, thus when
x is negative, it is calculated as
.
It is interesting to say here that different oscillators can be also obtained in double precision and single precision floating point numbers. But, because these floating point numbers have a much more higher resolution than the used
numbers for the fixed point arithmetic, the difference in the oscillations are obtained at much more simulation time than with fixed point.
Figure 1 shows the graphs of two oscillators implemented with double precision FP, single precision FP, and fixed point arithmetic with
numbers, when these two oscillators start to diverge; oscillator 1 is obtained with the term
(see Equation (
4)) calculated as
, and the oscillator 2 is obtained with
. The other terms are multiplied following the usual left-to-right precedence for the multiplication.
The four bits size for the integer part in the numbers were obtained from the simulation with real numbers. The value of 20 for the number of bits for the fractional part was fixed arbitrarily when the oscillator started to work. Perhaps in a given application, this number of bits in the fractional part could be justified or optimized according to the needs of such application.
To measure where the oscillators implemented with fixed point arithmetic start to diverge, the following experiment was performed. Thirty oscillators calculated with code 0000 and other thirty with the code 1000;
is fixed equal to 0.1,
is randomly obtained within the interval
.
Figure 2 shows the mean and ± the standard deviation of the correlation calculated using a window of size 21 samples between the signals calculated for each pair of oscillators. Observing this figure, the signal is uncorrelated from sample 575.
4. Pseudo Random Number Generator
The 2D map described in
Section 3 is used in [
11] to build a Pseudo Random Number Generator (PRNG) as follows. Fixed point arithmetic with numbers
is used. All coefficient in Equation (
2) are lesser than 1, and there are six sumatory terms in Equation (
2), thus at most the results could be equal to 6, and three bits are used for the integer part. The number of bits in the fractional part is more arbitrary, with 60 bits can be used numbers of 64 bits in total (A
long in C with a 64 bits architecture).
A sequence of 16 bits at each time
can be generated as
where the initial values
and
must be given within the interval
. With this interval and 60 bits in the fractional part
different initial values could be given for
or
, thus a
key of 120 bits can be used for this PRNG configuration. The size of this key can be increased by increasing the number of bits in the fractional part.
We write a C program to implement the PRNG. The associativity of the terms in the 2D map is coded with the string
where
and
. This code is passed as a argument to the C program (it is publicly available at
https://cs.cinvestav.mx/~fraga/Instances.tar.gz (accessed on 7 November 2022)). The letter
a code the terms in Equation (
2) which have two forms to realize the multiplications, i.e. the terms with
and
. The term
be realized as
or
. The letter
b code the multiplications of terms
which can be performed as
,
, or
. The first three letters in the code are to express the associativities to obtain the result of
, and the second three letters are used to express the forms to multiply and to obtain the term
. Code equal to 0 express the usual left-associativity used in multiplications in the C language.
The first 32 bits generated with four examples of the PRNG are shown in
Table 1. The initial condition used is
and
. As we can see in this
Table 1, the first 4 bytes (
73910fd0) are all equal, after theses 4 bytes the generated bytes start to be different.
The National Institute of Standards and Technology (NIST) of the United States of America created a free software for testing pseudo and random number generators [(P)RNGs]. Specifically, NIST said that the test is for (P)RNGs for cryptographic applications, where randomness is a crucial characteristic [
12]. Thus, we test if four generated sequences with the conditions in
Table 1 are random by applying the NIST suite of tests [
12] to 100 sequences of
bits. Note that these sequences only vary in the order of the multiplications because the four sequences are generated with the same initial conditions. The four sequences pass all the NIST tests as it it shown in
Table 2 (the
p-value must be greater than 0.01, and the proportion value must be greater than 0.96).
To measure where the generated sequences start to be uncorrelated another experiment was performed. With the set of five values
, 10 combinations of two values
can be calculated; 20 more pairs of values are generated as
and
with
. The mean and standard deviation of the 30 correlations between sequences generated by the PRNG with code 000000 and 100000 using the 30 explained initial conditions are shown in
Figure 3. A window of size 19 bits was used to calculate the correlations. From this figure, one can observe that sequences are uncorrelated after bit 250, or around 32 bytes. Therefore, the first generated 32 bytes by the PRNG can be discharged to ensure uncorrelated sequences.
5. Hardware Designs
The FPGA implementations of the Lü oscillator and 2D map were carried out from Equations (
2) and (
4). We can observe that there are three types of multiplications,
,
, and
.
Figure 4 and
Figure 5 present the design for two composite multipliers,
and
, respectively; note that both multipliers are made up of two
simple multipliers, represented by a black-filled multiplication symbol. Furthermore, to shorten the critical path, a register was placed at the output of each simple multiplier, this means, the multiplier result will be valid after two clock cycles. The
multiplier has three multiplexers that allow selecting some of the input combinations
, or
, or
, the control signal for these muxes is two bits. The multiplier
, has two muxes that are controlled by a one-bit signal and allows to select between the combinations
or
.
In
Figure 6, we can observe the block diagram of the 2D map described from Equation (
2). The circuit has five 64-bits multipliers: two simple, two
, and one
. The point-fixed setting is the sign bit, three bits for the integer part, and 60 bits for the fractional part. The code is selected by means of a three-bit signal, where the most significand bit corresponds to
a, the control signal for the
multiplier; the two least significand bits correspond to
b, the control signal for the
multiplier.
The design of the Lü chaotic oscillator is presented in
Figure 7 and
Figure 8. The design shown in
Figure 8 uses 11 multipliers, from them 7 are simple multipliers and 4 are
multipliers. The configuration of the simple multiplier is 24 bits, where one bit is used for the sign, three for the integer part and 20 bits in the fractional part.
Figure 7 presents the block diagram of the function
f in Equation (
5), this function is implemented only with simple multipliers. Due to the data dependence, it is necessary to wait for two clock cycles to obtain a result.
Particularly, for
Figure 8,
and
are computed with simple multipliers, while
uses four
-type multipliers and other simple arithmetic operations. Each
multiplier is connected to an independent 2-bit signal to be able to select among the 81 different oscillators. The circuit delivers new output values every five clock cycles.
The 2D map and the Lü oscillator were implemented on the Zybo Z7-20 development board with Zynq-7000 ARM/FPGA SoC.
Table 3 shows the area resources utilization for the implementations of two versions, with (OscLU* and 2DMap*) and without the logic for selecting the combination of multipliers (OscLU and 2DMap). There is an increment of LUTs, and this is related to the deployment of the multiplexers needed. The OscLU* area increases about 1.52 times the design OscLu; meanwhile, the 2DMap area increases about 3.53 times the design OscLu. However, if it is considered that now it is possible to obtain 144 different 2D map instances and 81 different Lü oscillators can be created, the use of additions LUTs is justified. The development board and the oscillator signal on the oscilloscope are shown in
Figure 9.
Two custom Vivado’s Intellectual Properties (IPs) were created with AXI bus interface, the controller registers functioned to send and receive data to the IP. The mux select signals were declared as external outputs and were directly mapped to the board switches. The write functions send the initial conditions, while the read functions retrieve the results from the IP. The results were sent over the serial port, and it was verified that the software simulation obtains the same results as the multipliers implemented in hardware directly. Finally, for OscLU*, the values of
x and
y were passed through a DAC in order to observe the real operation of the oscillator as it can be seen in
Figure 9. During the experiment, the board switches changed the association of the multiplications and the change of the phase diagram on the oscilloscope can be visualized.
6. Discussion
In the implementation of a chaotic entity with
m equations,
number of terms with
i variables,
, in the
m equation, and
p total number of terms starting with
k number of variables,
, the upper bond in the number of different instances that can be obtained is equal to
where
is the number of different associations in the multiplications that can be obtained with one term with
i variables.
can be obtained recursively as
where
is the number of combinations in a set of
k elements taken 2 elements at a time without repetition.
For example, for the Lü oscillator in Equation (
4) there is one equation with 4 terms (
) with 3 variables each one, thus we have
different implementations of this oscillator.
It could be very interesting to design chaotic entities with terms with more than three variables because the number of instances grows exponentially with the number of such terms. A chaotic entity with two terms with four variables each one could produce different instances.
We believe that in applications where several PRNG are needed, our design could be useful. At least it is not necessary to built several PRNGs based in different equations; if the chaotic entity has triplets terms, then several instances of it can be built. Still we are searching for specific applications of the proposed designs.
FPGA has been seen as a intermediate design between the software and a dedicate design on an specific ASIC chip. In a microcontroler or in a Raspberry PI the experiment with the 2D map can be realized using the version in software which is publicly provided. In an architecture of 32 bits, the multiplication of two numbers of 64 bits must be programmed [
11].
7. Conclusions
We created new instances, which give different results with the same initial conditions, of both the 2D map and Lü chaotic oscillators. The new instances are generated by different association of the terms when a three-terms multiplication appears. We build the instances both in software and in hardware, within an FPGA, where another 144 different 2D map instances and 81 different Lü oscillators can be created. We show one application to generate different Pseudo Random Number Generators using the 2D map. We show that effectively new instances of chaotic objects can be created in software or in hardware by using different association in their multiplications.