Advertisement
Guest User

test bench

a guest
Nov 7th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 1.48 KB | None | 0 0
  1. LIBRARY ieee;
  2. USE ieee.std_logic_1164.all;
  3. USE ieee.std_logic_arith.all;
  4. ENTITY test_bench IS
  5. END ENTITY test_bench;
  6.  
  7. ARCHITECTURE a OF test_bench IS
  8. signal tbclk : std_logic;
  9. signal tbrst : std_logic:= '1';
  10. signal tbx1 : std_logic_vector(2 downto 0):="111";
  11. signal tbx2 : std_logic_vector(2 downto 0):="111";
  12. signal syncro : std_logic;
  13. signal tbbtn : std_logic;
  14. signal tby : std_logic_vector(7 downto 0);
  15. signal syncrobtn : std_logic;
  16. component lab92 is
  17. Port ( clk  : in STD_LOGIC;
  18.     srst : in STD_LOGIC;
  19.     x1   : in STD_LOGIC_VECTOR (2 downto 0);
  20.     x2   : in STD_LOGIC_VECTOR (2 downto 0);
  21.     btn  : in STD_LOGIC;
  22.     y    : out STD_LOGIC_VECTOR (7 downto 0));
  23. end component;
  24. BEGIN
  25. generate_clk : process begin
  26.     loop
  27.         tbclk <= '0';
  28.         wait for 25 ns;
  29.         tbclk <= '1';
  30.         wait for 25 ns;
  31.         end loop;
  32. end process;
  33. generate_btn : process begin
  34.     loop
  35.         tbbtn <= '0';
  36.         wait for 1000 ns;
  37.         tbbtn <= '1';
  38.         wait for 25 ns;
  39.         end loop;
  40. end process;
  41. generate_rst : process begin
  42.     tbrst <= '1', '0' after 125 ns;
  43.     wait;
  44. end process;
  45. process(tbclk) begin
  46.     if rising_edge(tbclk) then
  47.         syncro <= tbrst;
  48.     end if;
  49. end process;
  50. process(tbclk) begin
  51.     if rising_edge(tbclk) then
  52.         syncrobtn <= tbbtn;
  53.     end if;
  54. end process;
  55. t_m : lab92
  56. port map ( clk => tbclk,
  57.     srst => syncro,
  58.     x1 => tbx1,
  59.     x2 => tbx2,
  60.     btn => syncrobtn,
  61.     y => tby);
  62. END ARCHITECTURE a;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement