Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. always @(posedge clk)
  2.     begin
  3.         if(refresh_counter == 20'b1111_1111_1111_1111_1111)
  4.             refresh_counter <= 20'b0;
  5.         else
  6.             refresh_counter <= refresh_counter + 1;
  7.     end
  8.     assign turn = refresh_counter[19:18];
  9.     always@(*) begin
  10.         case(turn)
  11.             2'b00:begin
  12.                 DIGIT <= 4'b0111;
  13.                 led_BCD <= min_display / 10;
  14.             end
  15.             2'b01:begin
  16.                 DIGIT <= 4'b1011;
  17.                 led_BCD <= min_display % 10;
  18.             end
  19.             2'b10:begin
  20.                 DIGIT <= 4'b1101;
  21.                 led_BCD <= sec_display / 10;
  22.             end
  23.             2'b11:begin
  24.                 DIGIT <= 4'b1110;
  25.                 led_BCD <= sec_display % 10;
  26.             end
  27.             default: begin end
  28.         endcase
  29.     end
  30.     always @(*)
  31.     begin
  32.         case(led_BCD)
  33.         4'b0000: DISPLAY <= 7'b0000001; // "0"    
  34.         4'b0001: DISPLAY <= 7'b1001111; // "1"
  35.         4'b0010: DISPLAY <= 7'b0010010; // "2"
  36.         4'b0011: DISPLAY <= 7'b0000110; // "3"
  37.         4'b0100: DISPLAY <= 7'b1001100; // "4"
  38.         4'b0101: DISPLAY <= 7'b0100100; // "5"
  39.         4'b0110: DISPLAY <= 7'b0100000; // "6"
  40.         4'b0111: DISPLAY <= 7'b0001111; // "7"
  41.         4'b1000: DISPLAY <= 7'b0000000; // "8"    
  42.         4'b1001: DISPLAY <= 7'b0000100; // "9"
  43.         default: DISPLAY <= 7'b0000100; // "9"
  44.         endcase
  45.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement