- 16
- 0
- 约1.5万字
- 约 15页
- 2017-01-07 发布于辽宁
- 举报
verilogHDL解析,veriloghdl,veriloghdl入门,veriloghdl入门pdf,veriloghdl视频教程,veriloghdl,veriloghdl软件,veriloghdl教程,veriloghdl语言,veriloghdlvhdl
Verilog HDL 语言
2.2 层 次 建 模
【例2-3】 实现一个1位全加器。
1位全加器的Verilog HDL实现代码如下:
/*以下为全加器顶层模块*/
module f_adder(ain,bin,cin,cout,sum);
output cout,sum;
input ain,bin,cin;
wire ain,bin,cin,cout,sum;
wire d,e,f;
h_adder u0(ain,bin,d,e);
h_adder u1(e,cin,f,sum);
or2a u2(d,f,cout);
endmodule
/*以下为半加器模块*/
module h_adder(a,b,co,so);
output co,so;
input a,b;
wire a,b,co,so,bbar;
and and2(co,a,b);
not not1(bbar,b);
xnor xnor2(so,a,bbar);
endmodule
/*以下为或门模块*/
module or2a(a,b,c);
output c;
input a,b;
wire a,b,c;
assign c=a | b;
endmodule
程序说明:
(1) 语句assign c=a | b; 中,“|”是按位或运算符,其功能是将a与b按位或的结果赋给信号c。
(2) 语句wir
原创力文档

文档评论(0)