1 Star 0 Fork 0

打野/Verilog练习代码

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
practice_24.6.22.v 808 Bytes
一键复制 编辑 原始数据 按行查看 历史
打野 提交于 12个月前 . 2024-6-22
//2024-6-22 姜青羊
//if-else实现多路选择器
`timescale 1ns/10ps
module muxtwo (
A,
B,
sel,
Y
);
input A,B,sel;
output Y;
reg Y;
always @(A or B or sel) begin
if(sel==1'b0)
Y=A&B;
else
Y=A^B;
end
endmodule
//------testbench------
module tb_muxtwo ();
reg[2:0] sab;
wire y;
muxtwo muxtwo (
.A(sab[1]),
.B(sab[0]),
.sel(sab[2]),
.Y(y)
);
initial begin
sab<=3'b000;
#100 $stop;
end
always #10 sab=sab+1;
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

搜索帮助