电子技术基础数字部分.doc
《电子技术基础数字部分.doc》由会员分享,可在线阅读,更多相关《电子技术基础数字部分.doc(9页珍藏版)》请在三一办公上搜索。
1、4.6.1module_2to4decoder(A1,A0,E,Y);input A,B,E;output 3:0Y;wire A1not,A0not,Enot;not n1(A1not,A1), n2(A0not,A0), n3(Enot,E);nand n4(Y0,A1not,A0not,Enot),n5(Y1,A1not,A0,Enot),n6(Y2,A1,A0not,Enot),n7(Y3,A1,A0,Enot);endmodule4.6.2module_2to1muxtri(A,B,SEL,L);input A,B,SEL; output L; tri L; bufif1(L,B,S
2、EL); bufif0(L,A,SEL);endmodule4.6.3module halfadder(S,C,A,B); input A,B; output S,C;xor(S,A,B); and(C,A,B);endmodulemodule fulladder(S,CO,A,B,CI); input A,B,CI; output S,CO; wire S1,D1,D2;halfadder HA1(S1,D1,A,B); halfadder HA2(S,D2,S1,CI); or g1(CO,D2,D1);endmodulemodule_4bit_adder(S,C3,A,B,C_1); i
3、nput3:0A,B; input C_1; output 3:0S; output 3:0C3; wire C0,C1,C2;fulladder FA0(S0,C0,A0,B0,C_1), FA1(S1,C1,A1,B1,C0), FA2(S2,C2,A2,B2,C1), FA3(S3,C3,A3,B3,C2);endmodule4.6.4module decoder_df(A1,A0,E,Y); input A1,A0,E; output3:0Y;assignY0=(A1&A0&E);assignY1=(A1&A0&E);assignY2=(A1&A0&E);assignY3=(A1&A0
4、&E);endmodule4.6.5module binary_adder(A,B,Cin,SUM,Cout); input 3:0A,B; input Cin; output 3:0SUM; output Cout; assign Cout,SUM=A+B+Cin;endmodule4.6.6module mux2x1_df(A,B,SEL,L); input A,B,SEL; output L; assign L=SEL?A:B;endmodule4.6.7module mux2to1_bh(A,B,SEL,L); input A,B,SEL; output L; reg L; alway
5、s (SEL or A or B) if(SEL=1) L=B; else L=A;endmodule4.6.8module mux4to1_bh(A ,SEL,E,L);input3:0A;input1:0SEL;output L;reg L;always (A or SEL or E) begin if(E=1) L=0;else case(SEL) 2 d0 :L=A0; 2 d1 :L=A1; 2 d2 :L=A2; 2 d3 :L=A3; endcase endendmodule5.5.1module D_lanch(Q,D,E); output Q; input D,E;reg Q
6、;always (E or D) if(E) Q=D;endmodule5.5.2module DFF(Q,D,CP);output Q; input D,CP; reg Q;always (posedge CP) Q=D;endmodulemodule async_set_rst_DFF(Q,QN,D,CP,Sd,Rd);output Q,QN;input D,CP,Sd,Rd; reg Q,QN;always (posedge CP or negedge Sd or negedge Rd )if(Sd|Rd)if(Sd) begin Q=1 b1; QN=1 b0; end else be
7、gin Q=1 b0; QN=1 b1; endelse begin Q=D; QN=D; endendmodulemodule sync _rst_DFF(Q ,D,CP,Rd); output Q; input D,CP,Rd; reg Q; always (posedge CP) if(Rd)Q=1 b0; else Q=D;endmodule5.5.3module JK_FF(Q,Qnot,J,K,CP); output Q,Qnot; input J,K,CP; reg Q; assign Qnot=Q; always (negedge CP ) case (J,K) 2b00:Q=
8、Q;2b01:Q=1b0;2b10:Q=1b1;2b11:Q=Q; endcaseendmodule6.6.1module shift74x194(S1,S0,D,Dsl,Dsr,Q,CP,CR); input S1,S0; input Dsl,Dsr; input CP,CR;input 3:0D;output 3:0Q;reg 3:0Q;always (posedge CP or negedge CR) if(CR)Q=4b0000; else case(S1,S0) 2b00:Q=Q; 2b01:Q=Q2:0,Dsr; 2b10:Q=Dsl ,Q3:1 ; 2b11:Q=D; endca
9、seendmodule6.6.2module counter74x161(CEP,CET,PE,D,CP,CR,Q,TC); input CEP,CET,PE,D,CP,CR; input 3:0D; output TC; output 3:0Q; reg 3:0Q; wire CE;assign CE= CEP&CET;assign TC=CET&(Q=4b1111);always (posedge CP or negedge CR) if(CR)Q=4b0000; else if(PE)Q=D; else if(CE)Q=Q; else Q=Q+1b1;endmodule6.6.3modu
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 电子技术 基础 数字 部分

链接地址:https://www.31ppt.com/p-4152719.html