日志档案

发表于 2008-6-20 8:46:39

0

标签: VerilogHDL  

VerilogHDL学习(1)

VerilogHDL描述数字电路

一、基本门电路的设计

1、与门

1)门级描述方式:

module     and_gat(A,B,F);

input        A,B;

output      F;

and          U1(F,A,B);

endmodule

2)数据流描述方式

module     and_gat(A,B,F);

input        A,B;

output      F;

assign       F=A&B;

endmodule

2、或门

1)门级描述方式:

module     or_gat(A,B,F);

input        A,B;

output      F;

or             U1(F,A,B);

endmodule

2)数据流描述方式

module     or_gat(A,B,F);

input        A,B;

output      F;

assign       F=A|B;

endmodule

3、非门

1)门级描述方式:

module     not_gat(A,F);

input        A;

output      F;

not           U1(F,A);

endmodule

2)数据流描述方式

module     not_gat(A,B,F);

input        A;

output      F;

assign       F=~A;

endmodule

4、与非门

1)门级描述方式:

module     nand_gat(A,B,F);

input        A,B;

output      F;

nand         U1(F,A,B);

endmodule

2)数据流描述方式

module     nand_gat(A,B,F);

input        A,B;

output      F;

assign       F=~(A&B);

endmodule

5、或非门

1)门级描述方式:

module     nor_gat(A,B,F);

input        A,B;

output      F;

nor           U1(F,A,B);

endmodule

2)数据流描述方式

module     nor_gat(A,B,F);

input        A,B;

output      F;

assign       F=~(A|B);

endmodule

6、异或门

1)门级描述方式:

module     xor_gat(A,B,F);

input        A,B;

output      F;

xor           U1(F,A,B);

endmodule

2)数据流描述方式

module     xor_gat(A,B,F);

input        A,B;

output      F;

assign       F=A^B;

endmodule

7、缓冲门

1)门级描述方式:

module     buf_gat(AF);

input        A;

output      F;

buf           U1(F,A);

endmodule

2)数据流描述方式

module     buf_gat(A,B,F);

input        A;

output      F;

assign       F=A;

endmodule

8、三态门

1)门级描述方式:

module     buf_en(A,EN,F);

input        A,EN;

output      F;

bufif1       U1(F,A,EN);

endmodule

2)数据流描述方式

module     buf_en(A,EN,F);

input        A,EN;

output      F;

assign       F=EN ? A:`bz;

endmodule

系统分类: CPLD/FPGA   |   用户分类: CPLD/FPGA   |   来源: 原创   |   【推荐给朋友】   |   【添加到收藏夹】

    阅读(233)    回复(0)  

投一票您将和博主都有获奖机会!