Latest Post

Ads

VLSI: Full Subtractor Dataflow Modelling with Testbench

Verilog Code for Full Subtractor Dataflow Modelling


module full_subtractor(borrow, diff, a, b, c);
output borrow, diff;
input a, b, bin;

assign x = a ^ b ;
assign y = (~x) & bin ;
assign z = (~a) & b ;
assign diff = x ^ bin ;
assign borrow = y | z ;
endmodule


//Testbench code for Full Subtractor Dataflow Modelling

initial begin


                             // Initialize Inputs
                             a = 0;
                             b = 0;
                             bin = 0;
                             // Wait 100 ns for global reset to finish
                             #100;
                             // Add stimulus here
                             #100; a = 0;b = 0;bin = 1;
                             #100; a = 0;b = 1;bin = 0;
                             #100; a = 0;b = 1;bin = 1;
                             #100; a = 1;b = 0;bin = 0;
                             #100; a = 1;b = 0;bin = 1;
                             #100; a = 1;b = 1;bin = 0;
                             #100; a = 1;b = 1;bin = 1;

 end


Output:

Comments

Ads

Popular posts from this blog

VLSI: 1-4 DEMUX (Demultiplexer) Dataflow Modelling with Testbench

VLSI: BCD to Excess 3 and Excess 3 to BCD Dataflow Modelling

VLSI: 2 Bit Magnitude Comparator Dataflow Modelling

1 to 4 DEMUX (Demultiplexer) Verilog CodeStructural/Gate Level Modelling with Testbench

Full Subtractor Verilog Code in Structural/Gate Level Modelling with Testbench