Electronic – Please explain the following Verilog code of a D flip flop

verilog

I am learning the Verilog language. Can someone explain the questions I ask in square brackets [] :

module d_ff(q,d,clk,reset);
     output q;
     input d,clk,reset;
     reg q;
     always @(posedge reset or negedge clk)  [what is this always @()]
     if (reset)
         q<= 1'b0; [what is 1'b0]
     else
         q<=d;
endmodule

For viewing output what is my next step? Does it mean I have to write a stimulus block after this code? What is the meaning of a stimulus block?

Best Answer

1'b0 is Verilog syntax for a constant value that is a one bit number expressed in binary format with a value of zero.

A bit value of one would be expressed as 1'b1.

Similarly a four bit value in binary that is equivalent magnitude to a decimal value of 11 could be written as 4'b1011.

You could also express this same value in a hexadecimal notation as 4'hB.