You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

pt1.vhd 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. ----------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date: 04/25/2022 01:45:24 PM
  6. -- Design Name:
  7. -- Module Name: pt1 - Behavioral
  8. -- Project Name:
  9. -- Target Devices:
  10. -- Tool Versions:
  11. -- Description:
  12. --
  13. -- Dependencies:
  14. --
  15. -- Revision:
  16. -- Revision 0.01 - File Created
  17. -- Additional Comments:
  18. --
  19. ----------------------------------------------------------------------------------
  20. library IEEE;
  21. use IEEE.STD_LOGIC_1164.ALL;
  22. -- Uncomment the following library declaration if using
  23. -- arithmetic functions with Signed or Unsigned values
  24. --use IEEE.NUMERIC_STD.ALL;
  25. -- Uncomment the following library declaration if instantiating
  26. -- any Xilinx leaf cells in this code.
  27. --library UNISIM;
  28. --use UNISIM.VComponents.all;
  29. entity pt1 is
  30. Port (
  31. clk : in STD_LOGIC;
  32. u : in integer := 0;
  33. y : inout integer := 0; -- muss vielleicht initalisiert werden vorher!?
  34. a : in integer := 1;
  35. k : in integer := 1;
  36. stepWidth : integer := 10); --in us
  37. end pt1;
  38. architecture Behavioral of pt1 is
  39. --signal stepWidth : integer := 10; -- in us -> 10 us später berechnet aus Clk und Prescaler
  40. signal prescaler : integer := 1000000; -- prescaler für Zeit
  41. -- Konstanten Streckenparameter
  42. --signal a : integer := 1;
  43. --signal k : integer := 1;
  44. -- signal u : integer := 100000; -- Eingangswert Strecke jetzt u aus port
  45. -- signal x : integer := 0; -- Ausgangssignal Strecke -> Stellgröße jetzt y aus port
  46. begin
  47. process(clk)
  48. begin
  49. if rising_edge(clk) then
  50. y <= y + stepWidth*(k*u-a*y)/prescaler; -- durch 1000 wg. milisekunden abtastzeit
  51. end if;
  52. end process;
  53. end Behavioral;