Latest Post

Full Subtractor Verilog Code in Behavioral Modelling with Testbench Code

Full Subtractor Verilog Code in Behavioral Modelling

module Full_Sub (

input a, b, bin;

output diff, borr );

always @(a or b or bin)

assign {borr,diff} = (~a) + b + bin;

endmodule


// test-bench

initial begin

a=0; b=0; bin=0;

#100;

//wait 100ns for global reset to finish

//add stimulus here

#100 a=0; b=1; bin=0;

#100 a=1; b=0; bin=0;

#100 a=1; b=1; bin=0;

end

initial begin

#100 $monitor(“a=%b, b=%b, bin=%b, diff=%b, borr=%b”, a, b, bin, diff, borr);

end

endmodule


Xilinx Output:
Full Subtractor Verilog Code Behavioral Modelling with Testbench
Full Subtractor Verilog Code Behavioral Modelling


Comments

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

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

Verilog: 4 to 2 Encoder Behavioral Modelling using Case Statement with Testbench Code

VLSI: 8-3 Encoder Dataflow Modelling with Testbench