Posts

Showing posts from 2025

Verilog: 4 Bit Counter Behavioral Modelling using If Else Statement

Image
Verilog Code for 4 Bit Counter Behavioral Modelling using If Else Statement module 4_bit_Count(      input clock, reset,      output [3:0]dout     ); reg [3:0]dout;  initial dout = 0;   always @ (posedge (clock))    begin            if (reset)                 dout <= 0;            else                dout <= dout + 1;     end endmodule Xillinx Output: 4 Bit Counter Behavioral Modelling Response   Also See: List of Verilog Programs

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                         ...

Popular posts from this blog

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

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

VLSI: 4-1 MUX Dataflow Modelling with Testbench

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

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