Verwendeter Programmcode in Studienarbeit für ESY1B zum Thema "Verifikation mit SystemVerilog und Python"
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

bcd_to_7seg.v 1.1KB

12345678910111213141516171819202122232425262728293031323334
  1. //transforms 4bits numbers to a 7seg display
  2. //
  3. // --a--
  4. // | |
  5. // f b
  6. // | |
  7. // --g--
  8. // | |
  9. // e c
  10. // | |
  11. // --d-- DP
  12. //
  13. // 7'gfedcba (a = LSB)
  14. module bcd_to_7seg(input [3:0] bcd_in, output [6:0] seg_out);
  15. assign seg_out = (bcd_in==4'h0) ? 7'b0111111 :
  16. (bcd_in==4'h1) ? 7'b0000110 :
  17. (bcd_in==4'h2) ? 7'b1011011 :
  18. (bcd_in==4'h3) ? 7'b1001111 :
  19. (bcd_in==4'h4) ? 7'b1100110 :
  20. (bcd_in==4'h5) ? 7'b1101101 :
  21. (bcd_in==4'h6) ? 7'b1111101 :
  22. (bcd_in==4'h7) ? 7'b0000111 :
  23. (bcd_in==4'h8) ? 7'b1111111 :
  24. (bcd_in==4'h9) ? 7'b1101111 :
  25. (bcd_in==4'ha) ? 7'b1110111 :
  26. (bcd_in==4'hb) ? 7'b1111100 :
  27. (bcd_in==4'hc) ? 7'b0111001 :
  28. (bcd_in==4'hd) ? 7'b1011110 :
  29. (bcd_in==4'he) ? 7'b1111001 :
  30. (bcd_in==4'hf) ? 7'b1110001 :
  31. 7'b0110110; //does a H, default shouldn't happen
  32. endmodule