Advertisement
Guest User

Untitled

a guest
Dec 10th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 2.22 KB | None | 0 0
  1. -------------------------------------------------------------------------------
  2. --
  3. -- Title       : Fub2
  4. -- Design      : szymik_krawczyk
  5. -- Author      :
  6. -- Company     :
  7. --
  8. -------------------------------------------------------------------------------
  9. --
  10. -- File        : C:\My_Designs\szymik_krawczyk\szymik_krawczyk\src\Fub2.vhd
  11. -- Generated   : Mon Nov 26 10:32:58 2018
  12. -- From        : interface description file
  13. -- By          : Itf2Vhdl ver. 1.22
  14. --
  15. -------------------------------------------------------------------------------
  16. --
  17. -- Description :
  18. --
  19. -------------------------------------------------------------------------------
  20.  
  21. --{{ Section below this comment is automatically maintained
  22. --   and may be overwritten
  23. --{entity {Fub2} architecture {Fub2}}
  24.  
  25. library IEEE;
  26. use IEEE.STD_LOGIC_1164.all;
  27. use IEEE.numeric_std.all;  
  28.  
  29. entity Fub2 is
  30. port(
  31.     n           : in STD_LOGIC_VECTOR(3 downto 0);
  32.     clk1m       : in STD_LOGIC;
  33.     fout        : in STD_LOGIC;
  34.     on_off      : in STD_LOGIC;
  35.     Output1     : out STD_LOGIC;
  36.     Output2     : out STD_LOGIC
  37.     );   
  38.  
  39. attribute LOC :string;
  40. attribute LOC of clk1m :signal is "P17";
  41. attribute LOC of fout :signal is "P39";
  42. attribute LOC of Output1 :signal is "P40";
  43. attribute LOC of Output2 :signal is "P41";  
  44.  
  45. end Fub2;
  46.  
  47. --}} End of automatically maintained section
  48.  
  49. architecture Fub2 of Fub2 is
  50. begin
  51.     process(clk1m, n(0), n(1), n(2), n(3)) is
  52.     variable start_stop     : std_logic := '0';
  53.     variable licznik        : unsigned ( 3 downto 0) := "0000";
  54.     variable dana           : unsigned ( 3 downto 0) := "0000";
  55.     variable fr             : std_logic := '0';
  56.     variable ff             : std_logic := '0';    
  57.    
  58.     begin
  59.  
  60.         licznik(0) := n(0);
  61.         licznik(1) := n(1);
  62.         licznik(2) := n(2);
  63.         licznik(3) := n(3);
  64.         start_stop := on_off;  
  65.        
  66.         if rising_edge(clk1m) then
  67.             if fout = '0' and ff = '0' then
  68.                 fr := '0';
  69.                 ff := '1';
  70.                 dana := dana + "0001";
  71.                 if dana >= (licznik + "0001") then
  72.                 dana := "0000";
  73.                 end if;
  74.                 if dana < licznik then
  75.                     Output1 <= '0';
  76.                     Output2 <= '1';
  77.                 end if;                                            
  78.             elsif fout = '1' and fr = '0' then
  79.                 fr := '1';
  80.                 ff := '0';
  81.                 Output1 <= '1';
  82.                 Output2 <= '0';
  83.             end if;            
  84.         end if;
  85.        
  86.     end process;  
  87.    
  88. end Fub2;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement