Advertisement
Guest User

Untitled

a guest
Nov 20th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. library ieee ;
  2. use ieee.std_logic_1164.all;
  3. use ieee.std_logic_unsigned.all;
  4.  
  5.  
  6. entity pwm is
  7.  
  8. port( writedata: in std_logic_vector(31 downto 0);
  9. clk_clk, reset_reset_n: in std_logic;
  10. wr, cs : in std_logic;
  11. pwm_out: out std_logic;
  12. hex : out std_logic_vector(6 downto 0));
  13. end pwm;
  14.  
  15.  
  16.  
  17. architecture rtl of pwm is
  18. signal reg: std_logic_vector(3 downto 0);
  19. signal licznik: std_logic_vector(25 downto 0);
  20. begin
  21. process(clk_clk)
  22. begin
  23.  
  24. if (clk_clk'event and clk_clk='1') then
  25. if(wr='1' and cs='1') then
  26. reg <=writedata(3 downto 0);
  27. end if;
  28.  
  29. end if;
  30.  
  31. end process;
  32.  
  33.  
  34.  
  35. process(clk_clk)
  36. begin
  37. if (clk_clk'event and clk_clk='1') then
  38.  
  39. if(reg="0001") then
  40. pwm_out <= '1';
  41. hex <= "1111001";
  42. else
  43. pwm_out <= '0';
  44. hex <= "1111111";
  45. end if;
  46.  
  47. end if;
  48. end process;
  49.  
  50. end rtl;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement