Advertisement
alexarcan

VHDL_lab2

Mar 5th, 2014
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 0.62 KB | None | 0 0
  1. ENTITY mux IS
  2.     GENERIC(del: TIME :=10 ns);
  3.     PORT(a,b:IN BIT;
  4.                 s: IN BIT;
  5.                 f: OUT BIT);
  6. END;
  7. ARCHITECTURE behave OF mux IS
  8. BEGIN
  9.     PROCESS(a,b,s)
  10.     BEGIN
  11.         IF s='0' THEN
  12.                 f<=a AFTER del;
  13.         ELSIF s='1' THEN
  14.                 f<=b AFTER del;
  15.         END IF;
  16.     END PROCESS;
  17. END;
  18.  
  19. ENTITY test_bench IS
  20. END;
  21. ARCHITECTURE struct
  22. OF test_bench IS
  23. COMPONENT mux IS
  24.      GENERIC(del: TIME :=10 ns);
  25.     PORT(a,b:IN BIT;
  26.                 s: IN BIT;
  27.                 f: OUT BIT);
  28. END COMPONENT;
  29.  
  30. SIGNAL as,bs,fs,ss: BIT;
  31. BEGIN
  32. l: mux PORT MAP(a=>as,b=>bs,s=>ss,f=>fs);
  33. ss<='0','1' AFTER 500 ns , '0' AFTER 1000 ns, '1' AFTER 1500 ns;
  34. as<='1';
  35. bs<='0';
  36. END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement