int unsigned a = 234;
initial begin
$display("A_1 :%0d",(a/1)%10 );
$display("A_10 :%0d",(a/10)%10 );
$display("A_100:%0d",(a/100)%10);
end
endmodule:top
A_10 :3
A_100:2
What matters is your approach to solution and understanding of basic hardware design principles.
Some other pages on interview questions:
1. Electrical Engineering Technical Interview Questions/Review : This page has answers too.
2. http://enpub.fulton.asu.edu/cse517/interview.html
Q. Design a memory system as shown in diagram below.
Note: Only 2000 data entries will be used at a given time. Entries should be programmable by external CPU.
Q. Create "AND" gate using a 2:1 multiplexer. (Create all other gates too.)
Q. Design XOR gate using just NAND gates.
Q. Design a "Stackable First One" finder.
Design a small unit which processes just 1 bit. Design in such a way that it can be stacked to accept make input of any length.
Q Micro architect DMA controller block for given specifications
Note:
- Overall performance should be almost same as performance of Encryption Engine which is 1Gbps.
Q. Design Gray counter to count 6.
Q. Design a block to generate output according to the following timing diagram.
Q. Design a module as shown in following block diagram.
Note: channel_id is 11 bits wide to accomodate 2K entries in 2K deep SRAM. operation is 1 bit wide.
operation = 00 means write to current location.
operation = 01 means add 1 to existing data
operation = 10 means subtract 1 from existing data in SRAM.
Do not optimize based on operation as in future operations bits can change.
Design such that you can support 1 operation every clock.
Q. Design a hardware to implement following equations without using multipliers or dividers.
out = 7x + 8y;
out = .78x + .17y;
Q. Create 4 bit multiplier using a ROM and what will be the size of the ROM. How can you realize it when the outputs are specified.
Q. How can you swap 2 integers a and b, without using a 3rd variable
Q. Which one is preferred? 1's complement or 2's complement and why?
Q. Which one is preferred in FSM design? Mealy or Moore? Why?
Q. Which one is preferred in design entry? RTL coding or Schematic? Why?
Q. Design a 2 input OR gate using a 2:1 mux.
Q. Design a 2 input AND gate using a 2 input XOR gate.
Q. Design a logic which mimics a infinite width register. It takes input serially 1 bit at a time. Output is asserted high when this register holds a value which is divisible by 5.
For example:
Input | Sequence | Value | Output |
1 | 1 | 1 | 0 |
0 | 10 | 2 | 0 |
1 | 101 | 5 | 1 |
0 | 1010 | 10 | 1 |
1 | 10101 | 21 | 0 |
(Hint: Use a FSM to create this)
Q. Design a block which has 3 inputs as followed.
1. system clock of pretty high freq
2. asynch clock input P
3. asynch clock input Q
P and Q clocks have 50% duty cycle each. Their frequencies are close enough and they have phase difference. Design the block to generate these outputs.
1. PeqQ : goes high if periods of P and Q are same
2. PleQ : goes high if P's period is less than that of Q.
3. PgrQ : goes high if P's period is greater than that of Q.
Q. What's the difference between a latch and a flip-flop? Write Verilog RTL code for each. (This is one of the most common questions but still some EE's don't know how to explain it correctly!)
Q. Design a black box whose input clock and output relationship as shown in diagram.
__ __ __ __ __ __ __ __ __
clk __| |__| |__| |__| |__| |__| |__| |__| |__| |__
__ __ __ __ __
Output __| |________| |________| |________| |________| |__
Q. Design a digital circuit to delay the negative edge of the input
signal by 2 clock cycles.
______________________
input ________| |_____________
_ _ _ _ _ _ _ _ _ _ _ _ _
clock _| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_
___________________________
output _________| |___________
Q. Design a Pattern matching block
- Output is asserted if pattern "101" is detected in last 4 inputs.
- How will you modify this design if it is required to detect same "101" pattern anywhere in last
8 samples?
Q.
The digital circuit is shown with logic delay (dly3) and two clock buffer delays (dly1, dly2).
- How will you fix setup timing violations occurring at pin B?
- How will you fix hold violations occurring at pin B?
(Hint: Change the values of three delays to get desired effect)
Q.
Sender sends data at the rate of 80 words / 100 clocks
Receiver can consume at the rate of 8 words / 10 clocks
Calculate the depth of FIFO so that no data is dropped.
Assumptions: There is no feedback or handshake mechanism. Occurrence of data in that time period is guaranteed but exact place in those clock cycles is indeterminate.
Q
Optical sensors A and B are positioned at 90 degrees to each other as shown in Figure. Half od the disc is white and remaining is black. When black portion is under sensor it generates logic 0 and logic 1 when white portion is under sensor.
Design Direction finder block using digital components (flip flops and gates) to indicate speed. Logic 0 for clockwise and Logic 1 for counter clockwise.
Q
Will this design work satisfactorily?
Assumptions: thold = tsetup = tclock_out = tclock_skew = 1ns.
After reset A = 0, B = 1
Q. Design a 4:1 mux in Verilog.
if(sel_1 == 0 && sel_0 == 0) output = I0;
else if(sel_1 == 0 && sel_0 == 1) output = I1;
else if(sel_1 == 1 && sel_0 == 0) output = I2;
else if(sel_1 == 1 && sel_0 == 1) output = I3;
Using case statement
case ({sel_1, sel_0})
00 : output = I0;
01 : output = I1;
10 : output = I2;
11 : output = I3;
default : output = I0;
endcase
Q. Design a FSM (Finite State Machine) to detect a sequence 10110.
Q. One more sequence detector:
Design a FSM (Finite State Machine) to detect more than one "1"s in last 3 samples.
For example: If the input sampled at clock edges is 0 1 0 1 0 1 1 0 0 1
then output should be 0 0 0 1 0 1 1 1 0 0 as shown in timing diagram.
And yes, you have to design this FSM using not more than 4 states!!
Q. Design a state machine to divide the clock by 3/2.
(Hint: 2 FSMs working on posedge and negedge)
Q. Draw timing diagrams for following circuit.
Q. Design a Digital Peak Detector in Verilog.
Q. Design a RZ (return to zero )circuit. Design a clock to pulse circuit in Verilog / hardware gates.
Q. Miscellaneous Basic Verilog Questions:
Code to distribute N elements into M bins, you add unique keyword to have each bin will have unique number of elements. class test; param...