import matplotlib.pyplot as plt from IPython.display import HTML plt.rcParams["figure.figsize"] = (20,3) import numpy
For this laboratory exercise, you will be asked to build a Digital Differential Analyzer (DDA) in Verilog that integrates the Lorenz system. The Lorenz system generates (arguably) one of the most famous and beautiful structures in mathematics: the "butterfly curve" (from which the "butterfly effect" gets its name). For certain parameter values and initial conditions, the solutions for the Lorenz system are chaotic. That is to say, they are deterministic yet unpredictable. The solutions are so sensitive to initial conditions that, after sufficient time, it is no longer possible to determine the path that the system will take without running a simulation. Meditate on the notion of "deterministic yet unpredictable" for long enough and you may end up questioning things like your own free will. But I digress.
The DDA circuit that you build will be controlled by the HPS. Controlling the DDA involves clocking it and setting initial conditions/parameter values. You will build a system that allows for you to play with the Lorenz system. The VGA screen will display all three projections of the 3D curve, and your user interface will support speeding up/slowing down animation, pausing/resuming animation, clearing the screen, dynamically changing parameters, and resetting with a new set of user-specified initial conditions. This is all demonstrated in the video below.
The Lorenz system is described by a set of three coupled ordinary differential equations, given below:
You will numerically integrate these differential equations using the Euler method, the simplest of all numerical integration techniques. The Euler method linearizes about the values of the state variables $x$, $y$, and $z$ at the current timestep to approximate the values of the state variables at the next timestep. That is:
Starting this iteration requires initial values for $x$, $y$, and $z$ and parameter values for $\sigma$, $\beta$, $\rho$, and $dt$. Ultimately, your system will accept arbitrary initial conditions and parameter values. However, use the following as the default settings:
The Python code below provides a reference solution to which you may compare your solutions. But remember that your solutions will not match exactly because the system is chaotic. One of the first steps for this lab is to simulate the solver in hardware in ModelSim to produce something like the following curves. For your amusement, here is an interactive 3D plot of the Lorenz system.
dt = (1./256) x = [-1.] y = [0.1] z = [25.] sigma = 10.0 beta = 8./3. rho = 28.0 def dx(sigma, x, y): return sigma*(y-x) def dy(rho, x, y, z): return x*(rho-z)-y def dz(beta, x, y, z): return x*y - beta*z for i in range(10000): x.extend([x[i] + dt*dx(sigma, x[i], y[i])]) y.extend([y[i] + dt*dy(rho, x[i], y[i], z[i])]) z.extend([z[i] + dt*dz(beta, x[i], y[i], z[i])])
dt = (1./256) x = [-1.] y = [0.1] z = [25.] sigma = 10.0 beta = 8./3. rho = 28.0 def dx(sigma, x, y): return sigma*(y-x) def dy(rho, x, y, z): return x*(rho-z)-y def dz(beta, x, y, z): return x*y - beta*z for i in range(10000): x.extend([x[i] + dt*dx(sigma, x[i], y[i])]) y.extend([y[i] + dt*dy(rho, x[i], y[i], z[i])]) z.extend([z[i] + dt*dz(beta, x[i], y[i], z[i])]) plt.plot(x) plt.ylabel('X', fontsize=18) plt.show() plt.plot(y) plt.ylabel('Y', fontsize=18) plt.show() plt.plot(z) plt.ylabel('Z', fontsize=18) plt.ylim([-10, 50]) plt.show() # import plotly.graph_objects as go # fig = go.Figure(data=go.Scatter3d(x=x, # y=y, # z=z, # mode='markers', # marker=dict( # size=2))) # fig.write_html("./test.html") # fig.show()
You will be asked to implement the above Euler integrator in hardware using Verilog. The circuit that you will build is illustrated below.
For most exercises there will be 5 or six connections to the board: serial, ethernet, VGA, audio (for lab 2), USB blaster, power. See the image below.
You may find the following resources useful:
details>datasheet. Some other modules require that you follow the path
details>open_component_folderto get the datasheet.
Your lab reports should include: