
2个回答
展开全部
module counter(
clk,
rst_n,
load,
loaden,
cnt
);
input clk;
input rst_n;
input [7:0] load;
input loaden;
output [7:0] cnt;
reg [7:0] cnt;
always@(posedge clk or negedge rst_n)
begin
if(!rst_n)
cnt <= 8'b0;
else if(loaden)
cnt <= load;
else
cnt <= cnt + 8'b1;
end
endmodule
你的要求是这样的,所以这样设计。
clk,
rst_n,
load,
loaden,
cnt
);
input clk;
input rst_n;
input [7:0] load;
input loaden;
output [7:0] cnt;
reg [7:0] cnt;
always@(posedge clk or negedge rst_n)
begin
if(!rst_n)
cnt <= 8'b0;
else if(loaden)
cnt <= load;
else
cnt <= cnt + 8'b1;
end
endmodule
你的要求是这样的,所以这样设计。
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询