1 Star 0 Fork 0

打野/Verilog练习代码

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
practice.v 876 Bytes
一键复制 编辑 原始数据 按行查看 历史
打野 提交于 2023-10-07 21:19 +08:00 . 2023-10-7
//2023-10-7 姜青羊
//两种多路选择写法
/*
module fn_sw (
a ,
b ,
sel ,
y
);
input a,b ;
input[1:0] sel ;
output y ;
reg y ;
always @(a or b or sel) begin
case(sel)
2'b00: y = a&b;
2'b01: y = a|b;
2'b10: y = a^b;
2'b10: y = ~(a^b);
endcase
end
endmodule
*/
module fn_sw (
a ,
b ,
sel ,
y
);
input a,b ;
input[1:0] sel ;
output y ;
reg y ;
always @(a or b or sel) begin
if(sel==2'b00)
y = a&b;
else if(sel==2'b01)
y = a|b;
else if(sel==2'b10)
y = a^b;
else
y = ~(a^b);
end
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

搜索帮助