Advertisement
Bobita

display_hex

Nov 22nd, 2023
884
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module hex(input [3:0] clocks,
  2.        output [6:0] hex);
  3.  
  4.  
  5. reg [6:0] hex_reg;
  6.  
  7. always@(clocks)
  8. begin
  9.      case(clocks)      
  10.     0: hex_reg = 7'b1000000;
  11.     1: hex_reg = 7'b1111001;
  12.     2: hex_reg = 7'b0100100;
  13.     3: hex_reg = 7'b0110000;
  14.     4: hex_reg = 7'b0011001;
  15.     5: hex_reg = 7'b0010010;
  16.     6: hex_reg = 7'b0000010;
  17.     7: hex_reg = 7'b1111000;
  18.     8: hex_reg = 7'b0000000;
  19.     9: hex_reg = 7'b0010000;
  20.        10: hex_reg = 7'b0001000;
  21.        11: hex_reg = 7'b0000011;
  22.        12: hex_reg = 7'b1000110;
  23.        13: hex_reg = 7'b0100001;
  24.        14: hex_reg = 7'b0000110;
  25.        15: hex_reg = 7'b0001110;
  26.      endcase
  27. end
  28.  
  29. assign hex = hex_reg;
  30.  
  31. endmodule
  32.  
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement