Director,
Lucid VLSI
M: +91 994 995 4576
Email: raja@lucidvlsi.com
Verilog HDL
1. Write Verilog DUT which counts upto 7 and then down to 0 and repeats for ever
as follows.
0,1,2,3,4,5,6,7,6,5,4, ,3,2,1 4
Observe that there is double 4 during down counting.
Template:
module updown (
input wire clk,
input wire rst,
output reg [2:0] cnt
);
2. Write Verilog DUT which generates an output as follows for the given input
Note:
An input ,I, asserts for only one clock cycle.
After the input asserts, then the output should assert 5 cycles later and
Then deassert for another cycle and
then assert again for one cycle.
It is a 101 pattern after 5 cycles
If another pulse on input appears during these 8 cycles output 101 pattern
should not be generated for this new input.
3. Write Verilog DUT for a circuit which takes a 16bit input and generates an output
which shows how many 101, non-overlapping patterns are there in this 16bit
input from left to right. Please note that there is no clock input to this circuit. It is
pure combinatorial.
INPUT :: OUTPUT
0011010100100100 :: 1
0101111010000001 :: 2
1101011000001001 :: 1
0101011001100011 :: 1
0111101100001101 :: 2
1001100110001101 :: 1
1000010001100101 :: 1
0101001000010010 :: 1
1110001100000001 :: 0
1100110100001101 :: 2
1010101010101010 :: 4
1011011011011011 :: 5
4. Draw waveform signals y1 to y8 for the given code below. And write your
explanation for its behavior.
module tb;
reg y1,y2,y3,y4,y5,y6;
wire y7,y8;
reg a;
always #5 a = ~a;
initial begin a = 0; #200; $finish; end
always @(a) y1 = a;
always @(a) begin
#7;
y2 = a;
end
always @(a)begin
y3 = #7 a;
end
always @(a)begin
#7;
y4 <= a;
end
always @(a)begin
y5 <= #7 a;
end
always #7 begin
y6 = a;
end
assign y7 = a;
assign #7 y8 = a;
endmodule