测试代码如下 module test; // Inputs reg [3:0] A; reg [3:0] B; reg C0; // Outputs wire [3:0] S; wire C4; // Instantiate the Unit Under Test (UUT) fulladderuut ( .A(A),
.B(B), .C0(C0), .S(S), .C4(C4) ); initial begin // Initialize Inputs A = 0; B = 0; C0 = 0; // Wait 100 ns for global reset to finish #20; // Add stimulus here
#10 A=4'b1000;B=4'b0111; #10 A=4'b1110;B=4'b0100; #10 A=4'b1001;B=4'b0101; #10 A=4'b0110;B=4'b0011; #10 A=4'b0001;B=4'b1110; #10 A=4'b0011;B=4'b0101; #10 A=4'b1010;B=4'b0001; #10 A=4'b0010;B=4'b1000; end
endmodule 波形图
八、通道数据分时传送系统
设计思路:多通道数据分时传送系统原理是,通过数据选择器将并行数据分时一一送出,再通过数据分配器(用译码器实现)将接收到的串行数据分配到其各个相应的输出端口,从而恢复原来的并行数据.数据分配器选用74x154,为4~16线译码器,数据选择器选用74x151,为8选1数据选择器。
74X151功能表
74X154功能表
由于74hc154为4~16译码器,故需要两片74ls151,级联成16~1多路复用器。 故多通道数据分时传送系统真值表为:(令并行数据为D0,D1,D2,D3,D4,D5,D6,D7,D8,D9) 真值表为
仿真有,代码为:
module transmit(EN,D,A,Z,Y1,Y2,Y1_L,Y2_L );
output [15:0]Z; output Y1,Y2,Y1_L,Y2_L; input [15:0]D; input EN; input [3:0]A; reg Y1,Y2;
相关推荐: