1 Star 0 Fork 0

打野/Verilog练习代码

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
practice_24.2.10.v 807 Bytes
一键复制 编辑 原始数据 按行查看 历史
打野 提交于 2024-02-10 22:52 +08:00 . 2024-2-10
//2024-2-10 姜青羊
//计数器默写
`timescale 1ns/10ps
module counter (
clk,
res,
y
);
input clk,res;
output[7:0] y;
reg[7:0] y;
wire[7:0] sum;
assign sum=y+1;
always @(posedge clk or negedge res) begin
if(~res)
y<=0;
else
y<=sum;
end
endmodule
//------testbench--------
module tb_counter ();
reg clk,res;
wire[7:0] y;
initial begin
clk<=0; res<=0;
#17 clk<=1;
#6000 $stop;
end
always #5 clk=~clk;
counter u_counter (
.clk(clk),
.res(res),
.y(y)
);
endmodule
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/fight_wild/verilog-code.git
git@gitee.com:fight_wild/verilog-code.git
fight_wild
verilog-code
Verilog练习代码
master

搜索帮助