📄 ripple.v
字号:
module RIPPLE (clk, reset, count) ; input clk, reset ; output [3:0]count ; reg[3:0] count; reg count0, count1, count2 ; always @(count) begin count0 = count[0] ; count1 = count[1] ; count2 = count[2] ; end always @(posedge clk or negedge reset) begin if (!reset) count[0] = 1'b0 ; else begin if (count[0] == 1'b1) count[0] = 1'b0 ; else count[0] = 1'b1 ; end end always @(posedge count0 or negedge reset) begin if (!reset) count[1] = 1'b0 ; else begin if (count[1] == 1'b1) count[1] = 1'b0 ; else count[1] = 1'b1 ; end end always @(posedge count1 or negedge reset) begin if (!reset) count[2] = 1'b0 ; else begin if (count[2] == 1'b1) count[2] = 1'b0 ; else count[2] = 1'b1 ; end end always @(posedge count2 or negedge reset) begin if (!reset) count[3] = 1'b0 ; else begin if (count[3] == 1'b1) count[3] = 1'b0 ; else count[3] = 1'b1 ; end end endmodule
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -