`timescale 1 ns/1 ns
module ex6_CD4008( Ci ,A, B, S, Co);
input Ci;
input [3:0]A,B;
output [3:0]S;
output Co;
assign {Co,S}=A+B+Ci;
endmodule
`timescale 100 ns/1 ns
module testbench;
/*
module ex6_CD4008( Ci ,A, B, S, Co);
input Ci;
input [3:0]A,B;
output [3:0]S;
output Co;
*/
reg [3:0]A,B;
reg Ci;
wire [3:0]S;
wire Co;
integer i;
ex6_CD4008 UUT( Ci ,A, B, S, Co);
initial
begin
for (i=0;i<=15;i=i+1) begin
Ci=1'b0;
A=i;
B=i;
#20;
end
for (i=0;i<=15;i=i+1) begin
Ci=1'b1;
A=i;
B=i;
#20;
end
#20;
$stop;
end
endmodule
沒有留言:
張貼留言