Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. module HexDriver (input logic [3:0] In0,
  2. output logic [6:0] Out0);
  3.  
  4. always_comb
  5. begin
  6.  
  7. if(In0 == 4'b0000) { // Input = 0
  8. Out0 = 7'b1000000;
  9. } else if(In0 == 4'b0001) { // Input = 1
  10. Out0 = 7'b1111001;
  11. } else if(In0 == 4'b0010) { // Input = 2
  12. Out0 = 7'b0100100;
  13. } else if(In0 == 4'b0011) { // Input = 3
  14. Out0 = 7'b0110000;
  15. } else if(In0 == 4'b0100) { // Input = 4
  16. Out0 = 7'b0011001;
  17. } else if(In0 == 4'b0101) { // Input = 5
  18. Out0 = 7'b0010010;
  19. } else if(In0 == 4'b0110) { // Input = 6
  20. Out0 = 7'b0000010;
  21. } else if(In0 == 4'b0111) { // Input = 7
  22. Out0 = 7'b1111000;
  23. } else if(In0 == 4'b1000) { // Input = 8
  24. Out0 = 7'b0000000;
  25. } else if(In0 == 4'b1001) { // Input = 9
  26. Out0 = 7'b0010000;
  27. } else if(In0 == 4'b1010) { // Input = A
  28. Out0 = 7'b0001000;
  29. } else if(In0 == 4'b1011) { // Input = B
  30. Out0 = 7'b0000011;
  31. } else if(In0 == 4'b1100) { // Input = C
  32. Out0 = 7'b1000110;
  33. } else if(In0 == 4'b1101) { // Input = D
  34. Out0 = 7'b0100001;
  35. } else if(In0 == 4'b1110) { // Input = E
  36. Out0 = 7'b0000110;
  37. } else if(In0 == 4'b1111) { // Input = F
  38. Out0 = 7'b0001110;
  39. } else {
  40. Out0 = 7'bX;
  41. }
  42. end
  43.  
  44. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement