Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. library ieee ;
  2.  
  3. use ieee.std_logic_1164.all;
  4.  
  5. use ieee.std_logic_unsigned.all;
  6.  
  7. entity vhd is
  8.  
  9. port( writedata: in std_logic_vector(31 downto 0);
  10.  
  11. clk_clk, reset_reset_n: in std_logic;
  12.  
  13. wr, cs : in std_logic;
  14.  
  15. pwm_out: out std_logic_vector(1 downto 0);
  16. hex_out: out std_logic_vector(20 downto 0));
  17.  
  18. end vhd;
  19.  
  20. architecture rtl of vhd is
  21.  
  22. signal reg: std_logic_vector(3 downto 0);
  23.  
  24. --signal licznik: std_logic_vector(25 downto 0);
  25.  
  26. begin
  27.  
  28. process(clk_clk)
  29.  
  30. begin
  31.  
  32. if (clk_clk'event and clk_clk='1') then
  33.  
  34. if(wr='1' and cs='1') then
  35.  
  36. reg <=writedata(3 downto 0);
  37. end if;
  38.  
  39. end if;
  40.  
  41. end process;
  42.  
  43. process(clk_clk)
  44.  
  45. begin
  46.  
  47. if (clk_clk'event and clk_clk='1') then
  48.  
  49. --licznik <= licznik +1;
  50.  
  51. -- 1 okres=1.34s
  52.  
  53. if (reg="0000") then
  54. pwm_out <= "00";
  55. hex_out <= "100000010000001000000";
  56.  
  57. elsif (reg="0001") then
  58. pwm_out <= "01";
  59. hex_out <= "111100101001001000000";
  60.  
  61. else
  62. pwm_out <= "10";
  63. hex_out <= "000011001011110101111";
  64. end if;
  65.  
  66. end if;
  67.  
  68. end process;
  69.  
  70. end rtl;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement