Mediatek Interview
Mediatek Interview
((A'+A'B')(B'+B'C'))'
(A'+A'B')'+(B'+B'C')'
A.(A'B')'+B.(B'C')'
A.(A+B)+B(B+C)
A+AB+B+BC
A(1+B)+B(1+C)
A+B
1001 0010
1101 1011
219
3.find the highest number in the given array using verilog code
module test;
integer array[9:0];
integer i,j;
integer result;
initial begin
for(i=0;i<10;i=i+1)begin
array[i]=$random%20;
end
for(j=0;j<10;j=j+1) begin
if(j=0)
result=array[0];
else if(array[j]>array[j-1])
result=array[j];
end
end
endmodule
2,8,3,9,12,17,28,19,10,5
q3 q2 q1 q0 y2
0 0 0 0 0
0 0 0 1 0
0 0 1 0 0
0 0 1 1 0
0 1 0 0 0
0 1 0 1 1
0 1 1 0 1
0 1 1 1 0
1 0 0 0 0
1 0 0 1 1
(a'b'i+a'bi)+(ab'i+abi)
(a'i+ai)
i
(c'i')+(c'i) = c'
10. using array locator method find the elements greater than 4
module dyn_array;
int dyn_arr[]='{2,4,6,2,7,82,22,23,14,56,73,84,21};
int result[$];
initial begin
result=dyn_arr.find with (item>4);
$display("the elements greater than 4 are %p",result);
end
endmodule
11. generate some 4bit data reverse it and then send the data to the DUT at every
posedge of clock sequentially
module test;
reg clk,rst;
reg in;
reg [3:0]tmp;
DUT inst(.in(in),.clk(clk),.rst(rst));
initial begin
clk = 1'b0;
forever #2 clk = ~clk;
end
initial begin
rst = 1'b0;
#5 rst = 1'b1;
#100 $finish;
end
initial begin
tmp = {$random};
#1 tmp[0] <= tmp[3];
tmp[1] <= tmp[2];
tmp[2] <= tmp[1];
tmp[3] <= tmp[0];
12. write a verilog code to send 8bit of data to the DUT in which MSB should be
parity
module parity;
reg [6:0]data;
reg [7:0]out;
wire parity;
reg clk;
initial begin
clk = 1'b0;
forever #2 clk = ~clk;
end
initial begin
data ={$random};
#20 $finish;
end
assign parity = ^data;
always@(posedge clk) out = {parity,data};
endmodule
13. what will be the output at f in the given circuit
output at 5->0
output at 7->1
output at 8->a'
output at f is a
when both q1 and q3 are high then all the flipflops are cleard.So the modulus of
the given counter is 10.hence the frequency is divided by 10
10KHz/10 = 1KHz.
15. find whether the given number is even or odd without using modulus operator
16. write a verilog tb for driving bit data at every posedge of clock when ever
data_fifo_full is low and send_data is high
module test;
reg [3:0]in;
reg clk;
wire send_data,data_fifo_full;
reg [7:0]video_data;
reg [3:0]frame_end,frame_start;
reg [15:0]tmp;
integer i=0;
initial begin
clk = 1'b0;
forever #2 clk = ~clk;
end
DUT
inst(.in(in),.clk(clk),.send_data(send_data),.data_fifo_full(data_fifo_full));
initial begin
frame_end = 4'b1100;
frame_start = 4'b0011;
video_data = {$random};
tmp = {frame_end,video_data,frame_start};
end