This set of 4 assignments is designed to take learners from beginner to expert in Verilog systematically.
- Problem 1: Implement a structural Verilog model for a 3-input AND gate, 3-input OR gate.
- Problem 2: Implement a structural Verilog model for a 4-bit magnitude comparator.
- Problem 3: Develop a structural Verilog model for a half adder and subtractor using basic gates and a full adder/subtractor using basic gates.
- Problem 4: Implement a structural Verilog model for a 4-to-1 multiplexer and 3-to-8 decoder.
- Problem 5: Create a structural Verilog model for a 4-bit barrel shifter with (1-bit and 2-bit) left and right shift.
- Problem 6: Create a structural Verilog model for a simple-bit ALU that supports addition, subtraction, multiplication, logical AND, logical OR, and logical XOR. Use Op-Code to specify the operation.
- Problem 1: Write behavioral Verilog code to multiply a 4-bit input by 2.
- Problem 2: Implement a behavioral Verilog code for a 4-to-2 encoder and 2-to-4 decoder.
- Problem 3: Design an 8-to-1 multiplexer using a
casestatement in behavioral Verilog. - Problem 4: Design an 8-to-3 priority encoder using the
if-elsestatement in behavioral Verilog. - Problem 5: Write behavioral Verilog code for a 4-bit Carry Look-Ahead Adder.
- Problem 6: Design behavioral Verilog code for a 4-bit Wallace Tree Multiplier.
- Problem 1: Implement a Verilog module of an SR latch with asynchronous enable and reset.
- Problem 2: Implement the Verilog module of an improved version of the D latch as shown in Figure 1. Specify delays of 1 ns for each gate. Demonstrate the correct operation with your simulator.
- Problem 3: Design a Verilog module of a counter that counts from 7 to 0 (e.g., 7, 6, 5, 4, 3, 2, 1, 0).
- Problem 4: Implement a Verilog module of an UP/DOWN modulo-8 Gray Code Counter as shown in Table 2, with an input
UP. IfUP = 1, the counter advances sequentially; ifUP = 0, it retains the previous value. - Problem 5: Implement an N-bit bidirectional shift register using D flip-flops. (Hint: Use a parameterized module to implement N.)
- Problem 6: Implement a single-port memory with 128 addressable spaces and 16-bit addressability in Verilog. The memory should have the following inputs: clock, write enable, write address register, and read address register. It should also have two outputs: read and write data registers.
- Problem 1: Implement a Verilog-based Moore machine as shown in Figure 5.
- Problem 2: Implement a Verilog-based Mealy machine as given in Figure 3.
- Problem 3: Implement an FSM in Verilog that detects the input sequence
1101on the input variablex. The FSM should detect the sequence every time it occurs, even if embedded within other bits. When the desired sequence is detected, the outputZshould be 1; otherwise, it should be 0. Resetting the state machine should return it to the initial stateS0. - Problem 4: Design a system with two 1-bit input signals (PA and PB) and one 1-bit output signal (O). The output should follow the modular equation
2N(P_A) + N(P_B) = 1 (mod 4). Here,N(P_A)andN(P_B)represent the total occurrences ofPAandPBbeing high (logic 1) at each positive clock edge, respectively. The outputOis set to 1 when the equation is satisfied and 0 otherwise.
- 1st cycle: PA = 0 (N(P_A) = 0), PB = 0 (N(P_B) = 0)
→ 2N(P_A) + N(P_B) = 0 (mod 4) → O = 0 - 2nd cycle: PA = 1 (N(P_A) = 1), PB = 1 (N(P_B) = 1)
→ 2N(P_A) + N(P_B) = 3 (mod 4) → O = 0 - 3rd cycle: PA = 1 (N(P_A) = 2), PB = 0 (N(P_B) = 1)
→ 2N(P_A) + N(P_B) = 5 (mod 4) → O = 1 - 4th cycle: PA = 0 (N(P_A) = 2), PB = 1 (N(P_B) = 2)
→ 2N(P_A) + N(P_B) = 6 (mod 4) → O = 0
The Verilog codes are implemented in this repo based on the above description.