Design Of Digital Circuits Using Verilog

Steps to Complete the Code

  1. Arrange the Code Blocks:

    • Place the code block that defines the Verilog module name, inputs, and outputs first.
    • Next, add the code block that defines the module functionality (the assign block).
    • Finally, add the code block that ends the module.
  2. Drag and Drop:

    • Drag and drop the code blocks to arrange them in the order mentioned above for both the Verilog module and the testbench.
  3. Complete the Code Blocks:

    • For the Verilog module:

      • Enter a name for the module. The name should begin with an alphabet and can include alphanumeric characters and underscores (_). No spaces or special characters allowed.
      • Select the inputs as A and B, and the output as Y.
      • In the assign block, assign Y the value of the required logic expression:
        • For AND logic: Y = A & B;
        • For OR logic: Y = A | B;
        • For NOR logic: Y = ~(A | B);
        • For NAND logic: Y = ~(A & B);
      • Use the blocking assignment operator (=) for combinational logic.
    • For the Verilog testbench:

      • Enter a name for the testbench. The name should begin with an alphabet, include only alphanumeric characters and underscores, and must not match the module name.
      • Declare A and B as registers, and Y as a wire.
      • Instantiate the logic gate module by entering its name and selecting the arguments in the same order as in the module definition.
      • Define the input A and B waveforms in the initial block.

Note:

  • While naming modules, testbenches, variables, and instance names, ensure they begin with an alphabet or underscore and only contain alphanumeric characters and underscores.
  • Do not use the same name for any two variables in the same module or testbench.

Observations

  • After clicking the Validate button (assuming all code blocks are filled correctly), you should see a "Success" message and a truth table under the Observations section.
  • Observe the input wave and the corresponding expected and observed output Y.