Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- always @(posedge clk)
- begin
- if(refresh_counter == 20'b1111_1111_1111_1111_1111)
- refresh_counter <= 20'b0;
- else
- refresh_counter <= refresh_counter + 1;
- end
- assign turn = refresh_counter[19:18];
- always@(*) begin
- case(turn)
- 2'b00:begin
- DIGIT <= 4'b0111;
- led_BCD <= min_display / 10;
- end
- 2'b01:begin
- DIGIT <= 4'b1011;
- led_BCD <= min_display % 10;
- end
- 2'b10:begin
- DIGIT <= 4'b1101;
- led_BCD <= sec_display / 10;
- end
- 2'b11:begin
- DIGIT <= 4'b1110;
- led_BCD <= sec_display % 10;
- end
- default: begin end
- endcase
- end
- always @(*)
- begin
- case(led_BCD)
- 4'b0000: DISPLAY <= 7'b0000001; // "0"
- 4'b0001: DISPLAY <= 7'b1001111; // "1"
- 4'b0010: DISPLAY <= 7'b0010010; // "2"
- 4'b0011: DISPLAY <= 7'b0000110; // "3"
- 4'b0100: DISPLAY <= 7'b1001100; // "4"
- 4'b0101: DISPLAY <= 7'b0100100; // "5"
- 4'b0110: DISPLAY <= 7'b0100000; // "6"
- 4'b0111: DISPLAY <= 7'b0001111; // "7"
- 4'b1000: DISPLAY <= 7'b0000000; // "8"
- 4'b1001: DISPLAY <= 7'b0000100; // "9"
- default: DISPLAY <= 7'b0000100; // "9"
- endcase
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement