-------------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; USE ieee.std_logic_textio.all; Use ieee.std_logic_signed.all; use std.textio.all; -------------------------------------------------------------------------------------- entity myRossler is Port (clk1,rst1 : in std_logic; x_out,y_out,z_out: out std_logic_vector(31 downto 0) ); end myRossler -------------------------------------------------------------------------------------- architecture arch of myRossler is file OutFile1 : TEXT open write_mode is "C:\Users\KAIBOU\Desktop\out_rossel_x.txt"; --file OutFile2 : TEXT open write_mode is "out_rossel_y.txt"; --file OutFile3 : TEXT open write_mode is "out_rossel_z.txt"; --file OutFile4 : TEXT open write_mode is "out_rossel_w.txt"; type etat_sys is (getSys, euler2);--1, euler2, euler3); signal etat_P : etat_sys; constant a : std_logic_vector (31 downto 0):=x"00003340";--d"0.2" constant b : std_logic_vector (31 downto 0):=x"00003340";--d"0.2 constant c : std_logic_vector (31 downto 0):=x"00090000";--d"5.7, 9 begin process(clk1,rst1) constant h : std_logic_vector (31 downto 0):=x"0000028f";--d"0.01 constant h2 : std_logic_vector (31 downto 0):=x"00000148";--d"0.005 variable x0 : std_logic_vector (31 downto 0):=x"00140000";--d"20.0 variable y0 : std_logic_vector (31 downto 0):=x"00000000";--d"0.0 variable z0 : std_logic_vector (31 downto 0):=x"00000000";--d"0.0 variable p,q,r : std_logic_vector (63 downto 0); variable ligne1,ligne2,ligne3,ligne4: line; variable x,y,z,xdot,ydot,zdot,xhat,yhat,zhat,xdot_hat,ydot_hat,zdot_hat: std_logic_vector(31 downto 0); begin if (rst1 = '1') then x :=-x0; y := y0; z := z0; etat_P <= getSys; elsif (clk1'event and clk1='1') then case etat_P is when getSys => xdot := -(y+z); --xdot=-(y+x) p := a*y; ydot := x+p(47 downto 16); --ydot= x+ay p := z*(x-c); zdot := b+p(47 downto 16); --zdot= b+z(x-c) p := xdot*h; xhat := x + p(47 downto 16); p := ydot*h; yhat := y + p(47 downto 16); p := zdot*h; zhat := z + p(47 downto 16); etat_P <= euler2; when euler2 => xdot_hat := -(yhat+xhat); p := a*yhat; ydot_hat := xhat+p(47 downto 16); p := zhat*(xhat-c); zdot_hat := b+p(47 downto 16); p := (xdot+xdot_hat)*h2; x := x + p(47 downto 16); p := (ydot+ydot_hat)*h2; y := y + p(47 downto 16); p := (zdot+zdot_hat)*h2; z := z + p(47 downto 16); x_out <= x; y_out <= y; z_out <= z; etat_P <= getSys; -- write(ligne1, x); -- writeline(OutFile1, ligne1); -- write(ligne2, y); -- writeline(OutFile2, ligne2); -- write(ligne3,z); -- writeline(OutFile3, ligne3); -- write(ligne4,ww); -- writeline(OutFile4, ligne4); end case; end if; end process; end arch;