Advertisement
Jgug

DNOLAB_4_9_v2

Dec 25th, 2013
435
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 5.27 KB | None | 0 0
  1. --NOT
  2. -----------------------------------------------------------
  3. Library IEEE;
  4. Use IEEE.STD_LOGIC_1164.all;
  5. entity N is
  6. port (
  7.     a1: in STD_LOGIC;
  8.     b1: out STD_LOGIC);
  9. end N;
  10.  
  11. architecture archNOT of N is
  12. begin
  13.     b1 <= not a1 after 1 ns;
  14. end archNOT;   
  15. --NA2
  16. -----------------------------------------------------------
  17. Library IEEE;
  18. Use IEEE.STD_LOGIC_1164.all;
  19. entity NA2 is
  20. port (
  21.     a1, a2: in STD_LOGIC;
  22.     b1: out STD_LOGIC);
  23. end NA2;
  24.  
  25. architecture archNA2 of NA2 is
  26. begin
  27.     b1 <= not(a1 and a2) after 2 ns;
  28. end archNA2;   
  29. --NO3
  30. -----------------------------------------------------------
  31. Library IEEE;
  32. Use IEEE.STD_LOGIC_1164.all;
  33. entity NO3 is
  34. port (
  35.     a1, a2, a3: in STD_LOGIC;
  36.     b1: out STD_LOGIC);
  37. end NO3;
  38.  
  39. architecture archNO3 of NO3 is
  40. begin
  41.     b1 <= not(a1 or a2 or a3) after 4 ns;
  42. end archNO3;   
  43. --NAO22
  44. -----------------------------------------------------------
  45. Library IEEE;
  46. Use IEEE.STD_LOGIC_1164.all;
  47. entity NAO22 is
  48. port (
  49.     a1, a2, a3, a4: in STD_LOGIC;
  50.     b1: out STD_LOGIC);
  51. end NAO22;
  52.  
  53. architecture archNAO22 of NAO22 is
  54. begin
  55.     b1 <= not((a1 or a2) and (a3 or a4)) after 3 ns;
  56. end archNAO22; 
  57. --NO3A2
  58. -----------------------------------------------------------
  59. Library IEEE;
  60. Use IEEE.STD_LOGIC_1164.all;
  61. entity NO3A2 is
  62. port (
  63.     a1, a2, a3, a4: in STD_LOGIC;
  64.     b1: out STD_LOGIC);
  65. end NO3A2;
  66.  
  67. architecture archNO3A2 of NO3A2 is
  68. begin
  69.     b1 <= not(a1 or a2 or (a4 and a3)) after 5 ns;
  70. end archNO3A2;
  71. --NAOA2
  72. -----------------------------------------------------------
  73. Library IEEE;
  74. Use IEEE.STD_LOGIC_1164.all;
  75. entity NAOA2 is
  76. port (
  77.     a1, a2, a3, a4: in STD_LOGIC;
  78.     b1: out STD_LOGIC);
  79. end NAOA2;
  80.  
  81. architecture archNAOA2 of NAOA2 is
  82. begin
  83.     b1 <= not(a2 and (a2 or (a3 and a4))) after 4 ns;
  84. end archNAOA2;
  85. --NOA2
  86. -----------------------------------------------------------
  87. Library IEEE;
  88. Use IEEE.STD_LOGIC_1164.all;
  89. entity NOA2 is
  90. port (
  91.     a1, a2, a3: in STD_LOGIC;
  92.     b1: out STD_LOGIC);
  93. end NOA2;
  94.  
  95. architecture archNOA2 of NOA2 is
  96. begin
  97.     b1 <= not(a1 or (a2 and a3)) after 3 ns;
  98. end archNOA2;
  99. --NOAO2
  100. -----------------------------------------------------------
  101. Library IEEE;
  102. Use IEEE.STD_LOGIC_1164.all;
  103. entity NOAO2 is
  104. port (
  105.     a1, a2, a3, a4: in STD_LOGIC;
  106.     b1: out STD_LOGIC);
  107. end NOAO2;
  108.  
  109. architecture archNOAO2 of NOAO2 is
  110. begin
  111.     b1 <= not(a1 or (a2 and (a3 or a4))) after 4 ns;
  112. end archNOAO2;
  113. --NAO3
  114. -----------------------------------------------------------
  115. Library IEEE;
  116. Use IEEE.STD_LOGIC_1164.all;
  117. entity NAO3 is
  118. port (
  119.     a1, a2, a3, a4: in STD_LOGIC;
  120.     b1: out STD_LOGIC);
  121. end NAO3;
  122.  
  123. architecture archNAO3 of NAO3 is
  124. begin
  125.     b1 <= not(a1 and (a2 or a3 or a4)) after 5 ns;
  126. end archNAO3;
  127. --------------------------------------------------
  128. Library IEEE;
  129. USE IEEE.STD_LOGIC_1164.all;
  130.  
  131. entity VAR1 is
  132. port(x1, x2, x3, x4: in STD_LOGIC;
  133.      y1, y2, y4, y5: out STD_LOGIC);
  134. end VAR1;
  135.  
  136. architecture archVAR1 of VAR1 is
  137.  
  138. component N
  139. port(a1: in STD_LOGIC;
  140.      b1: out STD_LOGIC);
  141. end component;
  142.  
  143. component NA2
  144. port(a1, a2: in STD_LOGIC;
  145.      b1: out STD_LOGIC);
  146. end component;
  147.  
  148. component NO3
  149. port(a1, a2, a3: in STD_LOGIC;
  150.      b1: out STD_LOGIC);
  151. end component;
  152.  
  153. component NAO22
  154. port(a1, a2, a3, a4: in STD_LOGIC;
  155.      b1: out STD_LOGIC);
  156. end component;
  157.  
  158. component NO3A2
  159. port(a1, a2, a3, a4: in STD_LOGIC;
  160.      b1: out STD_LOGIC);
  161. end component;
  162.  
  163. component NAOA2
  164. port(a1, a2, a3, a4: in STD_LOGIC;
  165.      b1: out STD_LOGIC);
  166. end component;
  167.  
  168. component NOA2
  169. port(a1, a2, a3: in STD_LOGIC;
  170.      b1: out STD_LOGIC);
  171. end component;
  172.  
  173. component NOAO2
  174. port(a1, a2, a3, a4: in STD_LOGIC;
  175.      b1: out STD_LOGIC);
  176. end component;
  177.  
  178. component NAO3
  179. port(a1, a2, a3, a4: in STD_LOGIC;
  180.      b1: out STD_LOGIC);
  181. end component;
  182.  
  183. signal za1,za2,za3,zb1,zb2,zb3,zb4,zc1,zc2,zc3,zc4,zc5,zd1,zd2,zd3,zd4: STD_LOGIC;
  184.  
  185. begin
  186. A_1:N port map(x1,za1);
  187. A_2:NA2 port map(x1,x4,za2);
  188. A_3:N port map(x2,za3);
  189. B_1:NO3 port map(x2,x4,za1,zb1);
  190. B_2:NAO22 port map(x4,x1,x2,za2,zb2);
  191. B_3:N port map(x3,zb3);
  192. B_4:NO3A2 port map(x3,za3,x1,x4,zb4);
  193. C_1:NAOA2 port map(zb3,zb1,za1,zd1,zc1);
  194. C_2:NO3 port map(za3,zb3,x4,zc2);
  195. C_3:N port map(x4,zc3);
  196. C_4:NOA2 port map(zb4,x3,zb2,zc4);
  197.  
  198. D_1:NOAO2 port map(zc3,x2,zb3,za1,zd1);
  199. D_3:N port map(zc4,zd3);
  200. C_5:N port map(zd3,zc5);
  201. D_4:NAO3 port map(zc1,zc2,x1,zc5,zd4);
  202. y1 <= zd4;
  203. y2 <= zd1;
  204. y4 <= zc2;
  205. y5 <= zd3;
  206. end archVAR1;
  207. ---------------------------------------------------
  208. Library IEEE;
  209. USE IEEE.STD_LOGIC_1164.all;
  210.  
  211. entity test is
  212. end test;
  213.  
  214. architecture newTEST of test is
  215. component VAR1
  216. port(x1,x2,x3,x4: in STD_LOGIC;
  217.      y1: out STD_LOGIC;
  218.      y2,y4,y5: inout STD_LOGIC);
  219. end component;
  220.  
  221. signal x1,x2,x3,x4,y1,y2,y4,y5: STD_LOGIC;
  222. begin
  223. x1 <= '1','0' after 200 ns,'1' after 300 ns,'0' after 400 ns,'1' after 600 ns,'0' after 700 ns,'1' after 800 ns,'0' after 1000 ns,'1' after 1100 ns,'0' after 1300 ns;
  224. x2 <= '1','0' after 100 ns,'1' after 400 ns,'0' after 600 ns,'1' after 800 ns,'0' after 900 ns,'1' after 1000 ns,'0' after 1300 ns;
  225. x3 <= '1','0' after 100 ns,'1' after 300 ns,'0' after 400 ns,'1' after 500 ns,'0' after 600 ns,'1' after 900 ns,'0' after 1200 ns,'1' after 1300 ns;
  226. x4 <= '0','1' after 100 ns,'0' after 300 ns,'1' after 400 ns,'0' after 500 ns,'1' after 800 ns,'0' after 1200 ns,'1' after 1300 ns;
  227.  
  228. ALLVAR1: VAR1 port map(x1,x2,x3,x4,y1,y2,y4,y5);
  229. end newTEST;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement