Advertisement
Guest User

Test

a guest
Jan 22nd, 2020
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.53 KB | None | 0 0
  1. module segmentdecoder(HEX0, SW);
  2. input [9:0] SW;
  3. output [6:0] HEX0;
  4.  
  5. H0 u0(
  6. .c0(SW[0]),
  7. .c1(SW[1]),
  8. .c2(SW[2]),
  9. .c3(SW[3]),
  10. .m(HEX0[0])
  11. );
  12.  
  13. H1 u1(
  14. .c0(SW[0]),
  15. .c1(SW[1]),
  16. .c2(SW[2]),
  17. .c3(SW[3]),
  18. .m(HEX0[1])
  19. );
  20.  
  21. H2 u2(
  22. .c0(SW[0]),
  23. .c1(SW[1]),
  24. .c2(SW[2]),
  25. .c3(SW[3]),
  26. .m(HEX0[2])
  27. );
  28. H3 u3(
  29. .c0(SW[0]),
  30. .c1(SW[1]),
  31. .c2(SW[2]),
  32. .c3(SW[3]),
  33. .m(HEX0[3])
  34. );
  35.  
  36. H4 u4(
  37. .c0(SW[0]),
  38. .c1(SW[1]),
  39. .c2(SW[2]),
  40. .c3(SW[3]),
  41. .m(HEX0[4])
  42. );
  43.  
  44. H5 u5(
  45. .c0(SW[0]),
  46. .c1(SW[1]),
  47. .c2(SW[2]),
  48. .c3(SW[3]),
  49. .m(HEX0[5])
  50. );
  51.  
  52. H6 u6(
  53. .c0(SW[0]),
  54. .c1(SW[1]),
  55. .c2(SW[2]),
  56. .c3(SW[3]),
  57. .m(HEX0[6])
  58. );
  59.  
  60. endmodule
  61.  
  62. module H0(c0, c1, c2, c3, m);
  63. input c0;
  64. input c1;
  65. input c2;
  66. input c3;
  67. output m; //output
  68.  
  69. assign m = ~ c3 & c2 & ~ c1 & ~ c0 | ~ c3 & ~ c2 & ~ c1 & c0 | c3 & c2 & ~ c1 & c0 | c3 & ~ c2 & c1 & c0;
  70.  
  71. endmodule
  72.  
  73. module H1(c0, c1, c2, c3, m);
  74. input c0;
  75. input c1;
  76. input c2;
  77. input c3;
  78. output m; //output
  79.  
  80. assign m = c3 & c2 & ~ c1 & ~ c0 | ~ c3 & c2 & ~ c1 & c0 | c3 & c1 & c0 | c2 & c1 & ~ c0;
  81.  
  82. endmodule
  83.  
  84. module H2(c0, c1, c2, c3, m);
  85. input c0;
  86. input c1;
  87. input c2;
  88. input c3;
  89. output m; //output
  90.  
  91. assign m = c3 & c2 & ~ c1 & ~ c0 | c2 & c1 & c3 | ~ c3 & ~ c2 & c1 & ~c0;
  92.  
  93. endmodule
  94.  
  95.  
  96. module H3(c0, c1, c2, c3, m);
  97. input c0;
  98. input c1;
  99. input c2;
  100. input c3;
  101. output m; //output
  102.  
  103. assign m = ~ c3 & c2 & ~ c1 & ~ c0 | ~ c3 & ~ c2 & ~ c1 & c0 | c2 & c1 & c0 | c3 & ~ c2 & c1 & ~ c0;
  104.  
  105. endmodule
  106.  
  107. module H4(c0, c1, c2, c3, m);
  108. input c0;
  109. input c1;
  110. input c2;
  111. input c3;
  112. output m; //output
  113.  
  114. assign m = c3 & ~ c2 & ~ c1 & c0 | ~ c3 & c0 |~ c3 & c2 & ~ c1;
  115.  
  116. endmodule
  117.  
  118. module H5(c0, c1, c2, c3, m);
  119. input c0;
  120. input c1;
  121. input c2;
  122. input c3;
  123. output m; //output
  124.  
  125. assign m = ~ c3 & ~ c2 & c0 | ~ c3 & c1 & c0 | ~ c3 & ~ c2 & c1 | c3 & c2 & ~ c1 & c0;
  126.  
  127. endmodule
  128.  
  129. module H6(c0, c1, c2, c3, m);
  130. input c0;
  131. input c1;
  132. input c2;
  133. input c3;
  134. output m; //output
  135.  
  136. assign m = ~ c3 & ~c2 & ~ c1 | ~ c3 & c2 & c1 & c0 | c3 & c2 & ~ c1 & ~ c0;
  137.  
  138. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement