Created
January 6, 2020 22:43
-
-
Save ZipCPU/249a17178a814065b534cc290b41da74 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
initial counts = 0; | |
always @(posedge i_clk) | |
if (i_reset) | |
// Tare the counter by setting it to zero on any reset | |
counts <= 0; | |
else begin | |
case({lst_a, lst_b, ck_a, ck_b}) | |
4'h1: counts <= counts + 1'b1; | |
4'h7: counts <= counts + 1'b1; | |
4'he: counts <= counts + 1'b1; | |
4'h8: counts <= counts + 1'b1; | |
// | |
4'h4: counts <= counts - 1'b1; | |
4'hd: counts <= counts - 1'b1; | |
4'hb: counts <= counts - 1'b1; | |
4'h2: counts <= counts - 1'b1; | |
default: begin end // 0, 3, 5, 6, 9, a, c, f | |
endcase | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment