Verilog HDL:创建分层设计

author-image

作者

此示例展示了如何使用 Verilog HDL 创建分层设计。此设计与 VHDL、AHDL 和分层原理图设计示例完全相同。文件 top_ver.v 是顶层文件,可调用两个底层文件 bottom1.vbottom2.v

有关在项目中使用此示例的更多信息,请访问:

vprim.v

top_ver.v 

module top_ver (q, p, r, out);

input     q, p, r;
output     out;
reg     out, intsig;

bottom1 u1(.a(q), .b(p), .c(intsig));
bottom2 u2(.l(intsig), .m(r), .n(out));

endmodule

bottom1.v

module bottom1(a, b, c);

input     a, b;
output     c;
reg      c;

always
begin
     c<=a & b; end endmodule

bottom2.v

module bottom2(l, m, n);

input     l, m;
output    n;
reg       n;

always
begin
     n<=l | m; end endmodule