HDL Qns U2 and U3
HDL Qns U2 and U3
SEC -A
SEC -B
SEC – C
SEC – A
SEC – B
SEC – C
1. Design a 4-bit up-counter with a clock enable signal. The counter should only increment when the clock enable
(en) signal is high. If the reset signal is high, the counter should reset to zero.
2. Design a 4-bit ALU (Arithmetic Logic Unit) in Verilog that supports addition, subtraction, AND, OR, and XOR
operations with its test bench.
3. Explain how you would write a Verilog module for a 4-bit up-counter using the always block with a clock signal.
Provide the Verilog code and describe the working of the counter in detail.
4. Design a 7-to-1 multiplexer in Verilog. Write the Verilog code and explain how the selection lines control the
output based on the input signals. Provide an example for a given input combination.
5. In Verilog, how does the case statement work in a finite state machine (FSM)? Given a basic 2-state FSM, analyze
the state transitions and provide the Verilog code for it. Discuss the advantages and disadvantages of using case
statements for FSMs in Verilog.
6. Evaluate the differences between structural and behavioral Verilog coding styles. Write a 4-bit AND gate using
both approaches and discuss the advantages and limitations of each style.