Posts

Verilog: Full Adder Behavioral Modelling with Testbench Code

Image
  Verilog Code Full Adder Behavioral Modelling module Full_Adder ( input a, b, cin; output sum, carry ); always @(a or b or cin) assign {carry,sum} = a + b + cin; endmodule // test-bench initial begin a=0; b=0; #100; //wait 100ns for global reset to finish //add stimulus here #100 a=0; b=1; cin=1; #100 a=1; b=0; cin=1; #100 a=1; b=1; cin=1; end initial begin #100 $ monitor (“a=%b, b=%b, cin=%b, sum=%b, carry=%b”, a, b, cin, sum, carry); end endmodule Xilinx Output: Verilog code for Full Adder Behavioral Modelling  

Verilog Code for Gray to Binary Dataflow Modelling

  Verilog Code for Gray to Binary Dataflow Modelling module gray_to_binary(     input g0,     input g1,     input g2,     input g3,     output b0,     output b1,     output b2,     output b3     );          assign b0 = g0;buf(b0,g0);          assign b1 = g0 ^ g1; assign b2 = g0 ^ g1 ^ g2; assign b3 = g0 ^ g1 ^ g2 ^ g3; endmodule //Testbench code for Gray to Binary Dataflow Modelling initial begin                       ...

VLSI: 2-4 Decoder Dataflow Modelling with Testbench

Image
Verilog Code for 2-4 Decoder Dataflow Modelling module decoder_2_to_4(     input a0,     input a1,     output d0,     output d1,     output d2,     output d3     );               assign an0 = ~ a0; assign an1 = ~ a1;               assign d0 = an0 & an1; assign d1 = a0 & an1; assign d2 = an0 & a1; assign d3 = a0 & a1; endmodule //Testbench code for 2-4 Decoder Dataflow Modelling initial begin                         ...

VLSI: AND Gate Dataflow Modelling with Testbench

Image
Verilog Code for AND gate Dataflow Modelling module ANDgate(     input a,     input b,     output c     ); assign c = a & b; endmodule //Testbench code for AND gate Dataflow Modelling initial begin               // Initialize Inputs               a = 0;b = 0;               // Wait 100 ns for global reset to finish               #100 a = 0; b = 1;               #100 a = 1; b = 0;               #100 a = 1; b = 1;  e nd Output:

VLSI: 1 Bit Magnitude Comparator Dataflow Modelling with Testbench

Image
Verilog Code for 1 Bit Magnitude Comparator Dataflow Modelling module comparator_1_bit(     input x,     input y,     output a,  //x>y     output b,  //x=y     output c   //x<y     ); assign xn = ~ x; assign yn = ~ y; assign a = x & yn; assign c = xn & y; assign b = ~ ( a | c ); endmodule //Testbench code for 1 Bit Magnitude Comparator Dataflow Modelling initial begin                              // Initialize Inputs             ...

Popular posts from this blog

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

VLSI: 4-1 MUX Dataflow Modelling with Testbench

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

Verilog: 8 to 1 Multiplexer (8-1 MUX) Dataflow Modelling with Testbench Code

VLSI: Half Subtractor and Full Subtractor Gate Level Modelling