Advertisement
MeWWEbcw_Roblox

hex

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