Objective: Design the same module using 3 different Verilog code writing styles. Compare between the structural design using primitive gates, assigning a switching function as a Sum of Product (SOP), and the application of behavioral description in the form of a conditional statement.
Design Assignment:
a) The top module:
The top module is a 4-bit comparator that compares two 4-bit inputs A and B and indicates whether they are equal, A is greater than B, or A is less than B. The top module instantiates two basic 2-bit comparators and includes the combinational logic for the outputs.
b) The basic submodule:
The basic design module is the 2-bit comparator. It is required to design this module using 3 different methods:
1. Structural Design using primitive gates
2. Assigning an SOP switching function for each output
3. Assigning a conditional statement using the conditional operator in Verilog.
c) A testbench:
The testbench should include input stimulus that tests the functionality of the instantiated submodule and tests the combinational logic deciding the overall outputs using selected cases. The testbench should include the $monitor operator to have the list of applied inputs in numerical format and the corresponding outputs.