# Top 28 Digital Logic Design Interview Questions You Must Prepare 23.Jul.2024

Q1. What Is Glitch? What Causes It (explain With Waveform)? How To Overcome It?

The following figure shows a synchronous alternative to the gated clock using a data path. The flipflop is clocked at every clock cycle and the data path is controlled by an enable. When the enable is Low, the multiplexer feeds the output of the register back on itself. When the enable is High, new data is fed to the flipflop and the register changes its state.

Q2. What Is A Ring Counter?

A ring counter is a type of counter composed of a circular shift register. The output of the last shift register is fed to the input of the first register. For example, in a 4-register counter, with initial register values of 1100, the repeating pattern is: 1100, 0110, 0011, 1001, 1100, so on.

Q3. What Are The Differences Between A Flip-flop And A Latch?

• Flip-flops are edge-sensitive devices where as latches are level sensitive devices.
• Flip-flops are immune to glitches where are latches are sensitive to glitches.
• Latches require less number of gates (and hence less power) than flip-flops.
• Latches are faster than flip-flops.

Q4. What Is A Multiplexer?

A multiplexer is a combinational circuit which selects one of many input signals and directs to the only output.

Q5. What Are Set Up Time And Hold Time Constraints?

Set up time is the amount of time before the clock edge that the input signal needs to be stable to guarantee it is accepted properly on the clock edge.

Hold time is the amount of time after the clock edge that same input signal has to be held before changing it to make sure it is sensed properly at the clock edge.

Whenever there are setup and hold time violations in any flip-flop, it enters a state where its output is unpredictable, which is known as as metastable state or quasi stable state. At the end of metastable state, the flip-flop settles down to either logic high or logic low. This whole process is known as metastability.

Q6. Difference Between Heap And Stack?

The Stack is more or less responsible for keeping track of what’s executing in our code (or what’s been “called”). The Heap is more or less responsible for keeping track of our objects (our data, well… most of it – we’ll get to that later.).

Think of the Stack as a series of boxes stacked one on top of the next. We keep track of what’s going on in our application by stacking another box on top every time we call a method (called a Frame). We can only use what’s in the top box on the stack. When we’re done with the top box (the method is done executing) we throw it away and proceed to use the stuff in the previous box on the top of the stack. The Heap is similar except that its purpose is to hold information (not keep track of execution most of the time) so anything in our Heap can be accessed at any time. With the Heap, there are no constraints as to what can be accessed like in the stack. The Heap is like the heap of clean laundry on our bed that we have not taken the time to put away yet – we can grab what we need quickly. The Stack is like the stack of shoe boxes in the closet where we have to take off the top one to get to the one underneath it.

Q7. Given Only Two Xor Gates One Must Function As Buffer And Another As Inverter?

• Tie one of xor gates input to 1 it will act as inverter.
• Tie one of xor gates input to 0 it will act as buffer.

Q8. Compare And Contrast Synchronous And Asynchronous Reset?

Synchronous reset logic will synthesize to smaller flip-flops, particularly if the reset is gated with the logic generating the d-input. But in such a case, the combinational logic gate count grows, so the overall gate count savings may not be that significant. The clock works as a filter for small reset glitches; however, if these glitches occur near the active clock edge, the Flip-flop could go metastable. In some designs, the reset must be generated by a set of internal conditions. A synchronous reset is recommended for these types of designs because it will filter the logic equation glitches between clock.

Problem with synchronous resets is that the synthesis tool cannot easily distinguish the reset signal from any other data signal. Synchronous resets may need a pulse stretcher to guarantee a reset pulse width wide enough to ensure reset is present during an active edge of the clock, if you have a gated clock to save power, the clock may be disabled coincident with the assertion of reset. Only an asynchronous reset will work in this situation, as the reset might be removed prior to the resumption of the clock. Designs that are pushing the limit for data path timing, can not afford to have added gates and additional net delays in the data path due to logic inserted to handle synchronous resets.

Asynchronous reset: The major problem with asynchronous resets is the reset release, also called reset removal. Using an asynchronous reset, the designer is guaranteed not to have the reset added to the data path. Another advantage favoring asynchronous resets is that the circuit can be reset with or without a clock present. Ensure that the release of the reset can occur within one clock period else if the release of the reset occurred on or near a clock edge then flip-flops may go into metastable state.

Q9. What Is A Johnson Counter?

Johnson counter connects the complement of the output of the last shift register to its input and circulates a stream of ones followed by zeros around the ring. For example, in a 4-register counter, the repeating pattern is: 0000, 1000, 1100, 1110, 1111, 0111, 0011, 0001, so on.

Q10. What Is Lut?

LUT - Look-Up Table. An n-bit look-up table can be implemented with a multiplexer whose select lines are the inputs of the LUT and whose inputs are constants. An n-bit LUT can encode any n-input Boolean function by modeling such functions as truth tables. This is an efficient way of encoding Boolean logic functions, and LUTs with 4-6 bits of input are in fact the key component of modern FPGAs.

Q11. What Is The Significance Of Fpgas In Modern Day Electronics? (applications Of Fpga.)

• ASIC prototyping: Due to high cost of ASIC chips, the logic of the application is first verified by dumping HDL code in a FPGA. This helps for faster and cheaper testing. Once the logic is verified then they are made into ASICs.
• Very useful in applications that can make use of the massive parallelism offered by their architecture. Example: code breaking, in particular brute-force attack, of cryptographic algorithms.
• FPGAs are sued for computational kernels such as FFT or Convolution instead of a microprocessor.
• Applications include digital signal processing, software-defined radio, aerospace and defense systems, medical imaging, computer vision, speech recognition, cryptography, bio-informatics, computer hardware emulation and a growing range of other areas.

Q12. What Are Pla And Pal? Give The Differences Between Them?

Programmable Logic Array is a programmable device used to implement combinational logic circuits. The PLA has a set of programmable AND planes, which link to a set of programmable OR planes, which can then be conditionally complemented to produce an output.

PAL is programmable array logic, like PLA, it also has a wide, programmable AND plane. Unlike a PLA, the OR plane is fixed, limiting the number of terms that can be ORed together.

Due to fixed OR plane PAL allows extra space, which is used for other basic logic devices, such as multiplexers, exclusive-ORs, and latches. Most importantly, clocked elements, typically flip-flops, could be included in PALs. PALs are also extremely fast.

Q13. What Is Skew, What Are Problems Associated With It And How To Minimize It?

In circuit design, clock skew is a phenomenon in synchronous circuits in which the clock signal (sent from the clock circuit) arrives at different components at different times.

This is typically due to two causes. The first is a material flaw, which causes a signal to travel faster or slower than expected. The second is distance: if the signal has to travel the entire length of a circuit, it will likely (depending on the circuit’s size) arrive at different parts of the circuit at different times. Clock skew can cause harm in two ways. Suppose that a logic path travels through combinational logic from a source flipflop to a destination flipflop. If the destination flipflop receives the clock tick later than the source flipflop, and if the logic path delay is short enough, then the data signal might arrive at the destination flipflop before the clock tick, destroying there the previous data that should have been clocked through. This is called a hold violation because the previous data is not held long enough at the destination flipflop to be properly clocked through. If the destination flipflop receives the clock tick earlier than the source flipflop, then the data signal has that much less time to reach the destination flipflop before the next clock tick. If it fails to do so, a setup violation occurs, socalled because the new data was not set up and stable before the next clock tick arrived. A hold violation is more serious than a setup violation because it cannot be fixed by increasing the clock period.

Clock skew, if done right, can also benefit a circuit. It can be intentionally introduced to decrease the clock period at which the circuit will operate correctly, and/or to increase the setup or hold safety margins. The optimal set of clock delays is determined by a linear program, in which a setup and a hold constraint appears for each logic path. In this linear program, zero clock skew is merely a feasible point.

Clock skew can be minimized by proper routing of clock signal (clock distribution tree) or putting variable delay buffer so that all clock inputs arrive at the same time.

Q14. What Is Difference Between Latch And Flipflop?

The main difference between latch and FF is that latches are level sensitive while FF are edge sensitive. They both require the use of clock signal and are used in sequential logic. For a latch, the output tracks the input when the clock signal is high, so as long as the clock is logic 1, the output can change if the input also changes. FF on the other hand, will store the input only when there is a rising/falling edge of the clock.

Q15. What Is The Difference Between Mealy And Moore Fsm?

Mealy FSM uses only input actions, i.e. output depends on input and state. The use of a Mealy FSM leads often to a reduction of the number of states.

Moore FSM uses only entry actions, i.e. output depends only on the state. The advantage of the Moore model is a simplification of the behavior.

Q16. Define Clock Skew , Negative Clock Skew, Positive Clock Skew?

Clock skew is a phenomenon in synchronous circuits in which the clock signal (sent from the clock circuit) arrives at different components at different times. This can be caused by many different things, such as wire-interconnect length, temperature variations, variation in intermediate devices, capacitive coupling, material imperfections, and differences in input capacitance on the clock inputs of devices using the clock.

There are two types of clock skew: negative skew and positive skew. Positive skew occurs when the clock reaches the receiving register later than it reaches the register sending data to the receiving register. Negative skew is the opposite: the receiving register gets the clock earlier than the sending register.

Q17. How To Achieve 180 Degree Exact Phase Shift?

Never tell using inverter

a) dcm’s an inbuilt resource in most of fpga can be configured to get 180 degree phase shift.

b) Bufgds that is differential signaling buffers which are also inbuilt resource of most of FPGA can be used.

Q18. What Are Various Types Of State Encoding Techniques? Explain Them?

One-Hot encoding: Each state is represented by a bit flip-flop). If there are four states then it requires four bits (four flip-flops) to represent the current state. The valid state values are 1000, 0100, 0010, and 00@If the value is 0100, then it me second state is the current state.

One-Cold encoding: Same as one-hot encoding except that '0' is the valid value. If there are four states then it requires four bits (four flip-flops) to represent the current state. The valid state values are 0111, 1011, 1101, and 1110.

Binary encoding: Each state is represented by a binary code. A FSM having '2 power N' states requires only N flip-flops.

Gray encoding: Each state is represented by a Gray code. A FSM having '2 power N' states requires only N flip-flops.

Q19. What Is Significance Of Ras And Cas In Sdram?

It uses a multiplex scheme to save input pins. The first address word is latched into the DRAM chip with the row address strobe (RAS).

Following the RAS command is the column address strobe (CAS) for latching the second address word.

Shortly after the RAS and CAS strobes, the stored data is valid for reading.

Q20. Tell Some Of Applications Of Buffer?

• They are used to introduce small delays
• They are used to eliminate cross talk caused due to inter electrode capacitance due to close routing.
• They are used to support high fanout,eg:bufg

Q21. Implement An And Gate Using Mux?

This is the basic question that many interviewers ask. for and gate, give one input as select line,incase if u r giving b as select line, connect one input to logic ‘0’ and other input to a.

Q22. Difference Between Mealy And Moore State Machine?

• Mealy and Moore models are the basic models of state machines. A state machine which uses only Entry Actions, so that its output depends on the state, is called a Moore model. A state machine which uses only Input Actions, so that the output depends on the state and also on inputs, is called a Mealy model. The models selected will influence a design but there are no general indications as to which model is better. Choice of a model depends on the application, execution me (for instance, hardware systems are usually best realized as Moore models) and personal preferences of a designer or programmer
• Mealy machine has outputs that depend on the state and input (thus, the FSM has the output written on edges)  Moore machine has outputs that depend on state only (thus, the FSM has the output written in the state itself.

In Mealy as the output variable is a function both input and state, changes of state of the state variables will be delayed with respect to changes of signal level in the input variables, there are possibilities of glitches appearing in the output variables. Moore overcomes glitches as output dependent on only states and not the input signal level.

All of the concepts can be applied to Mooremodel state machines because any Moore state machine can be implemented as a Mealy state machine, although the converse is not true.

Moore machine: the outputs are properties of states themselves…

which me that you get the output after the machine reaches a particular state, or to get some output your machine has to be taken to a state which provides you the output.The outputs are held until you go to some other state Mealy machine:

Mealy machines give you outputs instantly, that is immediately upon receiving input, but the output is not held after that clock cycle.

Q23. What Is Slack?

‘Slack’ is the amount of time you have that is measured from when an event ‘actually happens’ and when it ‘must happen’.. The term ‘actually happens’ can also be taken as being a predicted time for when the event will ‘actually happen’.

When something ‘must happen’ can also be called a ‘deadline’ so another definition of slack would be the time from when something ‘actually happens’ (call this Tact) until the deadline (call this Tdead).

Negative slack implies that the ‘actually happen’ time is later than the ‘deadline’ time…in other words it’s too late and a timing violation….you have a timing problem that needs some attention.

Q24. Expand The Following: Pla, Pal, Cpld, Fpga?

PLA - Programmable Logic Array
PAL - Programmable Array Logic
CPLD - Complex Programmable Logic Device
FPGA - Field-Programmable Gate Array

Q25. Arrange The Following In The Increasing Order Of Their Complexity: Fpga,pla,cpld,pal?

Increasing order of complexity: PLA, PAL, CPLD, FPGA.

Q26. Define Metastability?

If there are setup and hold time violations in any sequential circuit, it enters a state where its output is unpredictable, this state is known as metastable state or quasi stable state, at the end of metastable state, the flip-flop settles down to either logic high or logic low. This whole process is known as metastability.

Q27. What Will Happen If Contents Of Register Are Shifter Left, Right?

It is well known that in left shift all bits will be shifted left and LSB will be appended with 0 and in right shift all bits will be shifted right and MSB will be appended with 0 this is a straightforward wer What is expected is in a left shift value gets Multiplied by 2 eg:consider 0000_1110=14 a left shift will make it 0001_110=28, it the same fashion right shift will Divide the value by 2.

Q28. Difference Between Onehot And Binary Encoding?

Common classifications used to describe the state encoding of an FSM are Binary (or highly encoded) and One hot.

A binaryencoded FSM design only requires as many flipflops as are needed to uniquely encode the number of states in the state machine. The actual number of flipflops required is equal to the ceiling of the logbase2 of the number of states in the FSM.

A onehot FSM design requires a flipflop for each state in the design and only one flipflop (the flipflop representing the current or “hot” state) is set at a time in a one hot FSM design. For a state machine with 916 states, a binary FSM only requires 4 flipflops while a onehot FSM requires a flipflop for each state in the design FPGA vendors frequently recommend using a onehot state encoding style because flipflops are plentiful in an FPGA and the combinational logic required to implement a onehot FSM design is typically smaller than most binary encoding styles. Since FPGA performance is typically related to the combinational logic size of the FPGA design, onehot FSMs typically run faster than a binary encoded FSM with larger combinational logic blocks