Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2014
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.78 KB | None | 0 0
  1. ----------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date: 21:37:28 11/19/2014
  6. -- Design Name:
  7. -- Module Name: stope - 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_unsigned.all;
  22. use IEEE.STD_LOGIC_1164.ALL;
  23.  
  24. -- Uncomment the following library declaration if using
  25. -- arithmetic functions with Signed or Unsigned values
  26. --use IEEE.NUMERIC_STD.ALL;
  27.  
  28. -- Uncomment the following library declaration if instantiating
  29. -- any Xilinx primitives in this code.
  30. --library UNISIM;
  31. --use UNISIM.VComponents.all;
  32.  
  33. entity stope is
  34. Port ( iCLK : in STD_LOGIC;
  35. inRST : in STD_LOGIC;
  36. inSTART : in STD_LOGIC;
  37. inSTOP : in STD_LOGIC;
  38. inCONTINUE : in STD_LOGIC;
  39. oSEC : out STD_LOGIC_VECTOR (7 downto 0));
  40. end stope;
  41.  
  42. architecture Behavioral of stope is
  43. signal sTC : std_logic := '0';
  44. signal sR : std_logic := '0';
  45. signal sREG1 : std_logic_vector(24 downto 0) := (others => '0');
  46. signal sREG2 : std_logic_vector(7 downto 0) := (others => '0');
  47. begin
  48. process(iCLK, inRST) begin
  49. if(inRST = '0') then
  50. sR <= '0';
  51. elsif(iCLK'event and iCLK = '1') then
  52. if(inSTOP = '0') then
  53. sR <= '0';
  54. elsif(inSTART = '0') then
  55. sR <= '1';
  56. elsif(inCONTINUE = '0') then
  57. sR <= '1';
  58. end if;
  59. end if;
  60. end process;
  61.  
  62. process(iCLK, inRST) begin
  63.  
  64. if(inRST = '0') then
  65. sREG1 <= "0000000000000000000000000";
  66. elsif(iCLK'event and iCLK = '1') then
  67. if(inSTART = '0') then
  68. sREG1 <= "0000000000000000000000000";
  69. elsif(sR = '1') then
  70. if(sREG1 = "1011011100011010111111111") then --ovaj binarni =23 999 999
  71. sTC <= '1';
  72. sREG1 <= "0000000000000000000000000";
  73. else
  74. sREG1 <= sREG1+1;
  75. sTC <= '0';
  76. end if;
  77. end if;
  78. end if;
  79. end process;
  80.  
  81. process(iCLK, inRST) begin
  82. if(inRST = '0') then
  83. sREG2 <= "00000000";
  84. elsif(iCLK'event and iCLK = '1') then
  85. if(inSTART = '0') then
  86. sREG2 <= "00000000";
  87. elsif(sR = '1') then
  88. sREG2 <= sREG2+("0000000" & sTC);
  89. end if;
  90. end if;
  91. end process;
  92.  
  93. oSEC <= sREG2;
  94.  
  95. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement