Lab 3 DLD
Lab 3 DLD
Group No.:
Name Reg. No Viva / Lab Analysis of Modern Tool Ethics and Individual Total
Performance data in Lab Usage Safety and Team marks
Report Work Obtained
Shehryar 520299
Prelab:
1. Design the practical circuits given in Task 1 and Task 2 by giving the truth table of the problems and
then giving the circuit (logic diagram) for the designs. Implement in hardware, Proteus, and Verilog.
Task No 1 (4)
5V
Logic Circuit
0 0 0 0 1
0 0 1 0 1
0 1 0 0 1
0 1 1 0 1
1 0 0 0 1
1 0 1 0 1
1 1 0 0 1
1 1 1 1 0
Proteus SS
input in1,in2,in3;
output out1,out2;
wire and_1;
and a1(and_1,in1,in2);
and a2(out1,and_1,in3);
not n1(out2,out1);
endmodule
module testing101;
reg IN1,IN2,IN3;
wire OUT1,OUT2;
lab_3 test(OUT1,OUT2,IN1,IN2,IN3);
initial
begin
#100 IN1=1'b0;IN2=1'b0;IN3=1'b0;
#100 IN1=1'b0;IN2=1'b0;IN3=1'b1;
#100 IN1=1'b0;IN2=1'b1;IN3=1'b0;
#100 IN1=1'b0;IN2=1'b1;IN3=1'b1;
#100 IN1=1'b1;IN2=1'b0;IN3=1'b0;
#100 IN1=1'b1;IN2=1'b0;IN3=1'b1;
#100 IN1=1'b1;IN2=1'b1;IN3=1'b0;
#100 IN1=1'b1;IN2=1'b1;IN3=1'b1;
end
endmodule
Hardware Implementation
Design a three-way switch for lighting a bulb. Suppose the Switch A is installed at the entrance of the room,
switch B is installed to the bedside table, Switch C is installed outside the room. Now three way switching
can facilitate the switching ON/OFF from any location. The mechanism is such that if a single switch is on
the bulb should be ON. Now if the second switch is turned on the bulb if switched on earlier is switched off.
If two switches are already on and third switch is turned on then it should switch on the bulb. Implement
with basic gates.
Truth Table
0 0 0 0
0 0 1 1
0 1 0 1
0 1 1 0
1 0 0 1
1 0 1 0
1 1 0 0
1 1 1 1
Proteus SS
output out;
wire xor1;
endmodule
module testing_mine;
wire OUT;
initial
begin
end
endmodule
Hardware Implementation
The system is a speed warning device. It receives, on two lines, an indication of the speed limit on the
highway. There are three possible values 45, 55, or 65 MPH. It receives from the automobile, on two other
lines, an indication of speed of the vehicle. There are four possible values under 45, between 46 and 55,
between 56 and 65, and over 65 MPH. It produces two outputs. The first f, indicates whether the car is going
above the speed limit. The second g, indicates that the car is driving at “dangerous speed” – defined as either
over 65 MPH or more than 10 MPH above the speed limit. Show how each of the inputs and outputs are
coded (in terms of binary values) and complete the truth table for the system.
Truth Table
<45 00
45-55 01
55-65 10
65+ 11