EX6-3.5 Half Subtractor circuit
//===============================
// ex6-3.5 Half Substrator circuit
module EX10_13( A, B ,Bout ,Diff);
input A,B ; // 1位元輸入
output reg Bout ,Diff ; // Output 1位元輸出
always@ ( A,B) begin
{Bout ,Diff}= A-B;
end
endmodule
//===============================
// 時間單位 100ns, 時間精確度100 ps
`timescale 100ns/100ps
module Test_bench;
// Inputs
reg A,B;
// Outputs
wire Bout ,Diff ;
// Instantiate the Unit Under Test (UUT)
// ex6-3.5 Half Substrator circuit
EX10_13 UUT (
.A(A),
.B(B),
.Bout(Bout) ,
.Diff(Diff)
);
initial begin
$monitor( A, B ,Bout ,Diff);
//Apply inputs
A=1'b0; B=1'b0;
#100;
{A,B}=2'b01;
#100;
{A,B}=2'b10;
#100;
{A,B}=2'b11;
#100;
end
initial begin
#400 $stop;
end
endmodule
沒有留言:
張貼留言