i7led.vhd 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. -- Vhdl test bench created from schematic /home/trurl/STM32_Devel/FPGA/CNC/step_driver_control/i7led_decoder.sch - Fri Jul 20 17:50:36 2018
  2. --
  3. -- Notes:
  4. -- 1) This testbench template has been automatically generated using types
  5. -- std_logic and std_logic_vector for the ports of the unit under test.
  6. -- Xilinx recommends that these types always be used for the top-level
  7. -- I/O of a design in order to guarantee that the testbench will bind
  8. -- correctly to the timing (post-route) simulation model.
  9. -- 2) To use this template as your testbench, change the filename to any
  10. -- name of your choice with the extension .vhd, and use the "Source->Add"
  11. -- menu in Project Navigator to import the testbench. Then
  12. -- edit the user defined section below, adding code to generate the
  13. -- stimulus for your design.
  14. --
  15. LIBRARY ieee;
  16. USE ieee.std_logic_1164.ALL;
  17. USE ieee.numeric_std.ALL;
  18. LIBRARY UNISIM;
  19. USE UNISIM.Vcomponents.ALL;
  20. ENTITY i7led_decoder_i7led_decoder_sch_tb IS
  21. END i7led_decoder_i7led_decoder_sch_tb;
  22. ARCHITECTURE behavioral OF i7led_decoder_i7led_decoder_sch_tb IS
  23. COMPONENT i7led_decoder
  24. PORT( SEG_A : OUT STD_LOGIC;
  25. SEG_C : OUT STD_LOGIC;
  26. SEG_D : OUT STD_LOGIC;
  27. SEG_E : OUT STD_LOGIC;
  28. SEG_F : OUT STD_LOGIC;
  29. SEG_B : OUT STD_LOGIC;
  30. SEG_G : OUT STD_LOGIC;
  31. COUNT : IN STD_LOGIC;
  32. DIR : IN STD_LOGIC;
  33. CE_O : OUT STD_LOGIC;
  34. RST : IN STD_LOGIC;
  35. COUNT_EN : IN STD_LOGIC);
  36. END COMPONENT;
  37. SIGNAL SEG_A : STD_LOGIC;
  38. SIGNAL SEG_C : STD_LOGIC;
  39. SIGNAL SEG_D : STD_LOGIC;
  40. SIGNAL SEG_E : STD_LOGIC;
  41. SIGNAL SEG_F : STD_LOGIC;
  42. SIGNAL SEG_B : STD_LOGIC;
  43. SIGNAL SEG_G : STD_LOGIC;
  44. SIGNAL COUNT : STD_LOGIC;
  45. SIGNAL DIR : STD_LOGIC;
  46. SIGNAL CE_O : STD_LOGIC;
  47. SIGNAL RST : STD_LOGIC;
  48. SIGNAL COUNT_EN : STD_LOGIC;
  49. BEGIN
  50. UUT: i7led_decoder PORT MAP(
  51. SEG_A => SEG_A,
  52. SEG_C => SEG_C,
  53. SEG_D => SEG_D,
  54. SEG_E => SEG_E,
  55. SEG_F => SEG_F,
  56. SEG_B => SEG_B,
  57. SEG_G => SEG_G,
  58. COUNT => COUNT,
  59. DIR => DIR,
  60. CE_O => CE_O,
  61. RST => RST,
  62. COUNT_EN => COUNT_EN
  63. );
  64. -- *** Test Bench - User Defined Section ***
  65. tb : PROCESS
  66. BEGIN
  67. COUNT <= '0';
  68. DIR <= '0';
  69. RST <= '0';
  70. COUNT_EN <= '0';
  71. wait for 100 ns;
  72. RST <= '1';
  73. wait for 10 ns;
  74. RST <= '0';
  75. wait for 10 ns;
  76. DIR <= '1';
  77. COUNT_EN <= '1';
  78. for i in 0 to 16 loop
  79. wait for 10 ns;
  80. COUNT <= '1';
  81. wait for 10 ns;
  82. COUNT <= '0';
  83. end loop;
  84. wait for 100 ns;
  85. COUNT_EN <= '0';
  86. RST <= '1';
  87. wait for 10 ns;
  88. RST <= '0';
  89. wait for 10 ns;
  90. COUNT_EN <= '1';
  91. DIR <= '0';
  92. for i in 0 to 16 loop
  93. wait for 10 ns;
  94. COUNT <= '1';
  95. wait for 10 ns;
  96. COUNT <= '0';
  97. end loop;
  98. WAIT; -- will wait forever
  99. END PROCESS;
  100. -- *** End Test Bench - User Defined Section ***
  101. END;