module johnson(clk,clr,out);
input clk,clr;
output[3:0] out;
reg[3:0] out;
always @(posedge clk or posedge clr)
begin
if (clr) out<= 4'h0;
else
begin out<= out<< 1;
out[0]<= ~out[3];
end
end
endmodule
module tb_johnson();
reg clk,clr;
wire[3:0] out;
johnson u1(.clk(clk),.clr(clr),.out(out));
initial begin
clk<=1'b0;
clr<=1'b1;
#100 clr<=1'b0;
end
always #5 clk<=~clk;
endmodule

最后
以上就是甜甜小馒头最近收集整理的关于FPGA学习笔记23 -- Johnson 计数器的全部内容,更多相关FPGA学习笔记23内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复