Professional Documents
Culture Documents
SALEM-636011
BONAFIDE CERTIFICATE
12EC706-VLSI DESIGN AND NETWORKS LABORATORY
RECORD
DEPARTMENT OF ELECTRONICSAND COMMUNICATION ENGINEERING
(Accredited by NBA)
1
VLSI LABORATORY
2
LIST OF EXPERIMENTS (VLSI)
25
5. Testing the traffic controller
3
Ex.no:1
Date: DESIGN OF TRAFFIC LIGHT CONTROLLER
AIM:
To design a traffic light controller using Verilog.
SOFTWARE USED:
Xilinx ISE 9.1i Software
THEORY:
Consider a controller for traffic at the intersection of four roads. Consider P1, P2, P3, and P4
as four roads and P5 as pedestrian. The road has following states.
• GREEN-11001
• YELLOW-01000
• RED-00100
The pedestrian
• GREEN-0000
• Red-1111
First the road p1 is green and all other roads p2, p3, p4 and P5 are red. After a some delay p1 is
turn to yellow and then red the traffic signal on p2 is green. After a delay p2 is turn to yellow and then
red the signal on p3 is green. Then p3 is changed to yellow and then red the signal on p4 is changed to
green. After a delay p4 is turn to yellow and then red the pedestrian light P5 is green after a delay P5
is turn to green then routine will continue.
PROGRAM:
module tlc( clk,reset,p1,p2,p3,p4,p5);
input clk;
input reset;
output[4:0]p1;
output[4:0]p2;
output[4:0]p3;
output[4:0]p4;
output[4:0]p5;
reg [4:0]p1;
reg[4:0]p2;
reg[4:0]p3;
reg[4:0]p4;
reg[3:0]p5;
reg[5:0]Sig;
always@(posedgeclk)
begin
if(reset==1'b0)
4
begin
p1<=5'b00100;
p2<=5'b00100;
p3<=5'b00100;
p4<=5'b00100;
p5<=4'b1111;
Sig<=6'b000000;
end
else begin
Sig <= Sig+1;
case(Sig[5:0])
6'b000000:begin
p1<=5'b11001;//GREEN
p2<=5'b00100;
p3<=5'b00100;
p4<=5'b00100;
p5<=4'b1111;
end
6'b000100:begin
p1<=5'b01000;//YELLOW
p2<=5'b00100;
p3<=5'b00100;
p4<=5'b00100;
p5<=4'b1111;
end
6’b001000:begin
p1<=5’b00100;
p2<=5’b11001;//GREEN
p3<=5’b00100;
p4<=5’b00100;
p5<=4’b1111;
end
6'b001100:begin
p1<=5'b00100;
p2<=5'b01000;//YELLOW
p3<=5'b00100;
p4<=5'b00100;
p5<=4'b1111;
end
6'b01000:begin
p1<=5'b00100;
p2<=5'b00100;
p3<=5'b11001;//GREEN
p4<=5'b00100;
p5<=4'b1111;
end
6'b010100:begin
p1<=5'b00100;
p2<=5'b00100;
p3<=5'b01000;//YELLOW
5
p4<=5'b00100;
p5<=4'b1111;
end
6'b011000:begin
p1<=5'b00100;
p2<=5'b00100;
p3<=5'b00100;
p4<=5'b11001;//GREEN
p5<=4'b1111;
end
6’b011100:begin
p1<=5’b00100;
p2<=5’b00100;
p3<=5’b00100;
p4<=5’b01000; //YELLOW
p5<=4’b1111;
end
6'b10000:begin
p1<=5'b00100;
p2<=5'b00100;
p3<=5'b00100;
p4<=5'b00100;
p5<=4'b0000;//PEDESTRAIN
end
6'b100100:Sig<=6'b000000;
default:begin
end
endcase
end
end
endmodule
6
OUTPUT:
RESULT:
Thus the traffic light controller was designed using verilog and simulated successfully.
7
Ex.no:2
Date: PROGRAM FOR PIPELINED PARALLEL ADDER
AIM:
Design and simulation of pipeline parallel adder to add 8 number of size 12 bits each.
SOFTWARE REQUIRED:
Xilinx ISE 9.1i Software
THEORY:
Parallel adder is an adder which adds all the n-bits of m-numbers at a time. Addition is a funda-
mental operation for any digital system, digital signal processing or control system. A fast and accu-
rate operation of a digital system is greatly influenced by the performance of the resident adders. Ad-
ders are also very important component in digital systems because of their extensive use in other basic
digital operations such as subtraction, multiplication and division. Hence, improving performance of
the digital adder would greatly advance the execution of binary operations inside a circuit compro-
mised of such blocks. The performance of a digital circuit block is gauged by analyzing its power dis-
sipation, layout area and its operating speed.
PROGRAM:
module parallel(clk,add,load,clr,data,cal,result);
inputclk,clr,cal,load;
input[2:0]add;
input[11:0]data;
outputreg[11:0]result;
reg[11:0]ram[7:0];
wire[11:0]tem;
always@(posedgeclk)
begin
if(~clr)
begin
ram[0]=12’b0;
ram[1]=12’b0;
ram[2]=12’b0;
ram[3]=12’b0;
ram[4]=12’b0;
ram[5]=12’b0;
ram[6]=12’b0;
ram[7]=12’b0;
end
else if(~load)
ram[add]=data;
end
assign tem=ram[0]+ram[1]+ram[2]+ram[3]+ram[4]+ram[5]+ram[6]+ram[7];
always@(posedgeclk)
begin
if(~load)
result=data;
else if(~cal)
result=tem;
else
8
result=ram[add];
end
end module
PIN DIAGRAM:
9
OUTPUT WAVEFORM:
10
Ex.no:3
Date: MULTIPLICATION OF TWO 8 BIT NUMBERS
AIM:
To design and simulate back annotated Verilog files for Multiplying two 8 bit numbers.
SOFTWARE REQUIRED:
Xilinx ISE 9.1i Software
THEORY:
Assign the clock input to clock and set values to multiplier and multiplicand.
Check the multiplier and multiplicand are positive, then do the successive addition for
the product.
Otherwise multiplier is positive and multiplicand is negative , and then do the succes-
sive addition but in successive addition, MSB is replaced by ‘1’ instead of ‘0’.
If multiplier is negative and multiplicand is positive, then take 2’s compliment of the
multiplicand and do the successive addition for that multiplicand.
If both multiplier & multiplicand are negative, then take 2’s compliment of the multipli-
cand and do the successive addition, but MSB is replaced by ‘1’ instead of ‘0’.
PROGRAM:
Module multi_signed(prod,multiplicand,multiplier);
output [15:0] prod;
input [7:0] multiplicand;
input [7:0] multiplier;
wire [15:0] shift1,shift2,shift3,shift4,shift5,shift6,shift7,shift8;
wire[15:0] add1,add2,add3,add4,add5,add6,add7,add8;
wire [15:0] prod_s;
assign shift1 ={8'b0, multiplicand};
assign shift2 ={7'b0, multiplicand,1'b0};
assign shift3 ={6'b0, multiplicand,2'b0};
assign shift4 ={5'b0, multiplicand,3'b0};
assign shift5 ={4'b0, multiplicand,4'b0};
assign shift6 ={3'b0, multiplicand,5'b0};
assign shift7 ={2'b0, multiplicand,6'b0};
assign shift8 ={1'b0, multiplicand,7'b0};
assign add1 =(multiplier [0] == 1'b1)? shift1 : 16'b0;
assign add2 =(multiplier [1] == 1'b1)? shift2 : 16'b0;
assign add3 =(multiplier [2] == 1'b1)? shift3 : 16'b0;
assign add4 =(multiplier [3] == 1'b1)? shift4 : 16'b0;
assign add5 =(multiplier [4] == 1'b1)? shift5 : 16'b0;
assign add6 =(multiplier [5] == 1'b1)? shift6 : 16'b0;
assign add7 =(multiplier [6] == 1'b1)? shift7 : 16'b0;
assign add8 =(multiplier [7] == 1'b1)? shift8 : 16'b0;
assign prods = add1+add2+add3+add4+add5+add7+add8;
assign prod=prod_s;
endmodule
11
PIN DIAGRAM:
12
OUTPUT WAVEFORM:
RESULT: Thus the design for back annotated Verilog files for multiplying two 8 bit numbers was
simulation.
13
Ex .no:4
AIM:
To study the FPGA trainer kit and testing the on board LEDs and switches using SPARTAN
REQUIREMENTS:
1. PC 01
6. Power Adapter 01
7. Power Cable 01
THEORY:
DIP SWITCHES:
The switches connect to an associated FPGA. The switches are used to give input to the
FPGA or the design implemented on FPGA. A 4.7KΩ series resistor provides nominal input protec-
tion. When in the UP or ON position, a switch connects the FPGA pin to VCCO, a logic High. When
DOWN or in the OFF position, the switch connects the FPGA pin to ground, a logic Low. The
switches typically exhibit about 2 ms of mechanical bounce and there is no active debouncing circuit-
ry, although such circuitry could easily be added to the FPGA design programmed on the board.
KEY SWITCHES:
The Key switches can provide pulse input to the FPGA. The switches connect to an associated FPGA
pin. Pressing a key generates logic High on the associated FPGA pin. There is no active debouncing
circuitry on the key switches.
14
LEDS:
Test LEDs are provided for mapping output of FPGA or tracking particular stage in the design. A se-
ries current limiting resistor of 270Ω is associated with every LED. To light an individual LED, drive
the associated FPGA control signal High
15
PROGRAM:
Module test (sw, led);
Input [15:0] sw;
Output [15:0] led;
Assign led=sw;
End module
PROCEDURE:
Step 1:Start the Xilinx Project Navigator by using the desktop shortcut or by using the
Step 2: Create a new project and Select File menu and then select New project.
Step3: Specify the project name and location in pop up window and click NEXT.
Step4: Select Device. Select the required family, device, package, speed grade, Synthesis tool Simu-
lator from new project wizard pop up window. Click NEXT. Project summary will be displayed.
Step6: To create new V file Right click on the device name and select NEW SOURCE
Step 7: Select VERILOG MODULE in NEW SOURCE WIZARD and give suitable name for the
Project. Click NEXT for the DEFINE MODULE Window Assign required ports in this Window.
Step 8: Write the Behavioural VERILOG Code in VERILOG Editor Sample code is given below for
this experiment.
Run the Check syntax Process windowsynthesize check syntax , and remove errors if present
Translate the design into gates and optimize it for the target architecture. This is the synthesis phase.
Again for synthesizing your design, from the source window selects synthe-
sis/Implementation from the drop-down menu. Highlight file in the Sources in Project window. To
run synthesis, right-click on Synthesize, and the Run option, or double-click on Synthesize in the Pro-
cesses for Current Source window. Synthesis will run, and
16
a yellow exclamation mark indicates that a warning was generated. Check the synthesis re-
port. If there are any errors correct it and rerun the synthesis.
Step 11: After Synthesis, go to back annotate pin location in Implement Designand
double click to start back annotation. In back annotation the tool translates and routes the logic in
FPGA and generates the constraint file such that minimum delay paths are included. This helps to
make the design faster. Once back annotation is completed, constraint file is generated.
SYNTHESIS REPORT:
Reading design: leeeeeeed.prj
=======================================================================
* HDL Compilation *
=======================================================================
Compiling verilog file "leeeeeeed.v" in library work
Module <leeeeeeed> compiled
No errors in compilation
Analysis of file <"leeeeeeed.prj"> succeeded.
=======================================================================
* Design Hierarchy Analysis *
=======================================================================
Analyzing hierarchy for module <leeeeeeed> in library <work>.
=======================================================================
* HDL Analysis *
=======================================================================
Analyzing top module <leeeeeeed>.
Module <leeeeeeed> is correct for synthesis.
=======================================================================
* HDL Synthesis *
=======================================================================
Performing bidirectional port resolution...
17
=======================================================================
* Advanced HDL Synthesis *
=======================================================================
Loading device for application Rf_Device from file '3s250e.nph' in environment C:\Xilinx92i.
=======================================================================
Advanced HDL Synthesis Report
Found no macro
=======================================================================
=======================================================================
* Low Level Synthesis *
=======================================================================
Optimizing unit <leeeeeeed> ...
Mapping all equations...
Building and optimizing final netlist ...
Found area constraint ratio of 100 (+ 5) on block leeeeeeed, actual ratio is 0.
Final Macro Processing ...
=======================================================================
Final Register Report
Found no macro
=======================================================================
=======================================================================
* Partition Report *
=======================================================================
Partition Implementation Status
-------------------------------
No Partitions were found in this design.
-------------------------------
=======================================================================
* Final Report *
=======================================================================
Clock Information:
------------------
No clock signals found in this design
18
Speed Grade: -4
=======================================================================
NGDBUILD done.
19
Running directed packing...
Running delay-based LUT packing...
Running related packing...
Design Summary:
Number of errors: 0
Number of warnings: 2
Logic Utilization:
Logic Distribution:
Number of Slices containing only related logic: 0 out of 0 0%
Number of Slices containing unrelated logic: 0 out of 0 0%
*See NOTES below for an explanation of the effects of unrelated logic
Number of bonded IOBs: 32 out of 158 20%
NOTES:
Related logic is defined as being logic that shares connectivity - e.g. two
LUTs are "related" if they share common inputs. When assembling slices,
Map gives priority to combine logic that is related. Doing so results in
the best timing performance.
Note that once logic distribution reaches the 99% level through related
logic packing, this does not mean the device is completely utilized.
Unrelated logic packing will then begin, continuing until all usable LUTs
and FFs are occupied. Depending on your timing budget, increased levels of
unrelated logic packing may adversely affect the overall timing performance
of your design.
Mapping completed.
20
See MAP report file "leeeeeeed_map.mrp" for details.
INFO:Par:282 - No user timing constraints were detected or you have set the option to ignore timing
constraints ("par -x"). Place and Route will run in "Performance Evaluation Mode" to automatically
improve the performance of all internal clocks in this design. The PAR timing summary will list the
performance achieved for each clock. Note: For the fastest runtime, set the effort level to "std". For
best performance, set the effort level to "high". For balance between the fastest runtime and best per-
formance, set the effort level to "med".
Starting Placer
Phase 1.1
Phase 1.1 (Checksum:9896bf) REAL time: 3 secs
Phase 2.7
Phase 2.7 (Checksum:1312cfe) REAL time: 3 secs
Phase 3.31
Phase 3.31 (Checksum:1c9c37d) REAL time: 3 secs
Phase 4.2
Phase 4.2 (Checksum:26259fc) REAL time: 4 secs
Phase 5.30
Phase 5.30 (Checksum:2faf07b) REAL time: 4 secs
21
Phase 6.8
Phase 6.8 (Checksum:9950d3) REAL time: 4 secs
Phase 7.5
Phase 7.5 (Checksum:42c1d79) REAL time: 4 secs
Phase 8.18
Phase 8.18 (Checksum:4c4b3f8) REAL time: 4 secs
Phase 9.5
Phase 9.5 (Checksum:55d4a77) REAL time: 4 secs
Timing Score: 0
22
Routing: Completed - No errors found.
PAR done!
Number of warnings: 0
Total time: 3 secs
23
PIN DESCRIPTION:
RESULT:
Thus the FPGA trainer kit was studied and onboard LEDs and switches were tested.
24
Ex no: 5
AIM:
To test the traffic light controller design on the FPGA board.
REQUIREMENTS:
1. PC 01
6. Power Adapter 01
7. Power Cable 01
THEORY:
Consider a controller for traffic at the intersection of four roads. Consider P1, P2, P3, P4 as four roads
and P5 as pedestrian. The road has following states.
• GREEN-11001
• YELLOW-01000
• RED-00100
the pedestrian
• GREEN-0000
• RED-1111
First the road p1 is green and all other roads p2, p3, p4 and P5 are red. After a some delay p1 is
turn to yellow and then red the traffic signal on p2 is green. After a delay p2 is turn to yellow and
then red the signal on p3 is green. Then p3 is changed to yellow and then red the signal on p4 is
changed to green. After a delay p4 is turn to yellow and then red the pedestrian light P5 is green after
a delay P5 is turn to green then routine will continue.
25
PROCEDURE:
Step 1:Start the Xilinx Project Navigator by using the desktop shortcut or by using the
Step 2: Create a new project and Select File menu and then select New project.
Step3: Specify the project name and location in pop up window and click NEXT.
Step4: Select Device. Select the required family, device, package, speed grade, Synthesis tool
Simulator from new project wizard pop up window. Click NEXT. Project summary will
be displayed.
Step6: To create new V file Right click on the device name and select NEW SOURCE
Step 7: Select VERILOG MODULE in NEW SOURCE WIZARD and give suitable name for the
Project. Click NEXT for the DEFINE MODULE Window Assign required ports in this Win-
dow.
Step 8: Write the Behavioural VERILOG Code in VERILOG Editor Sample code is given below
for this experiment.
Run the Check syntax Process windowsynthesize check syntax , and remove errors if pre-
sent
Translate the design into gates and optimize it for the target architecture. This is the synthesis
phase. Again for synthesizing your design, from the source window selects synthe-
sis/Implementation from the drop-down menu. Highlight file in the Sources in Project window. To
run synthesis, right-click on Synthesize, and the Run option, or double-click on Synthesize in the Pro-
cesses for Current Source window. Synthesis will run, and
26
ware. Running the Xilinx Implementation Tools. Once synthesis is complete, you can place and route
your design to fit into a Xilinx device (Spartan3 200k), and you can also get some post place-and-
route timing information about the design. This procedure runs you through the basic flow for imple-
mentation.
Step 12: Right-click on Implement Design, and choose the Run option, or double left-click on Im-
plement Design.Right-click on Generate Programming File, and choose the Run option, or double
left-click on Generate Programming File. This will generate the Bitstream. Double click on Con-
figure Device to download the bitstream.
PROGRAM:
module tlc( clk,reset,p1,p2,p3,p4,p5);
input clk;
input reset;
output[4:0]p1;
output[4:0]p2;
output[4:0]p3;
output[4:0]p4;
output[4:0]p5;
reg [4:0]p1;
reg[4:0]p2;
reg[4:0]p3;
reg[4:0]p4;
reg[3:0]p5;
reg[5:0]Sig;
always@(posedgeclk)
begin
if(reset==1'b0)
begin
p1<=5'b00100;
p2<=5'b00100;
p3<=5'b00100;
p4<=5'b00100;
p5<=4'b1111;
Sig<=6'b000000;
end
else begin
Sig <= Sig+1;
case(Sig[5:0])
6'b000000:begin
p1<=5'b10011;//GREEN
p2<=5'b00100;
27
p3<=5'b00100;
p4<=5'b00100;
p5<=4'b1111;
end
6'b000100:begin
p1<=5'b01000;//YELLOW
p2<=5'b00100;
p3<=5'b00100;
p4<=5'b00100;
p5<=4'b1111;
end
6’b001000:begin
P1<=5’b00100;
P2<=5’b10011;//GREEN
P3<=5’b00100;
P4<=5’b00100;
P5<=4’b1111;
end
6'b001100:begin
p1<=5'b00100;
p2<=5'b01000;//YELLOW
p3<=5'b00100;
p4<=5'b00100;
p5<=4'b1111;
end
6'b01000:begin
p1<=5'b00100;
p2<=5'b00100;
p3<=5'b10011;//GREEN
p4<=5'b00100;
p5<=4'b1111;
end
6'b010100:begin
p1<=5'b00100;
p2<=5'b00100;
p3<=5'b01000;//YELLOW
p4<=5'b00100;
p5<=4'b1111;
end
6'b011000:begin
p1<=5'b00100;
p2<=5'b00100;
p3<=5'b00100;
p4<=5'b10011;//GREEN
p5<=4'b1111;
end
6’b011100:begin
P1<=5’b00100;
P2<=5’b00100;
P3<=5’b00100;
28
P4<=5’b01000; //YELLOW
P5<=4’b1111;
end
6'b10000:begin
p1<=5'b00100;
p2<=5'b00100;
p3<=5'b00100;
p4<=5'b00100;
p5<=4'b0000;//PEDESTRAIN
end
6'b100100:Sig<=6'b000000;
default:begin
end
endcase
end
end
endmodule
SYNTHESIS REPORT:
Reading design: tlc.prj
========================================================================
* HDL Compilation *
========================================================================
No errors in compilation
========================================================================
========================================================================
========================================================================
* HDL Analysis *
========================================================================
29
WARNING:Xst:883 - "tlc.v" line 77: Ignored duplicate item in case statement.
========================================================================
* HDL Synthesis *
========================================================================
Summary:
inferred 1 Counter(s).
========================================================================
Macro Statistics
# Counters :1
6-bit up counter :1
# Registers :5
4-bit register :1
6-bit register :4
========================================================================
========================================================================
========================================================================
Loading device for application Rf_Device from file '3s100e.nph' in environment C:\Xilinx92i.
30
========================================================================
Macro Statistics
# Counters :1
6-bit up counter :1
# Registers : 21
Flip-Flops : 21
========================================================================
========================================================================
========================================================================
INFO:Xst:2261 - The FF/Latch <p5_0> in Unit <tlc> is equivalent to the following 3 FFs/Latches,
which will be removed : <p5_1> <p5_2> <p5_3>
========================================================================
Macro Statistics
# Registers : 24
Flip-Flops : 24
========================================================================
========================================================================
* Partition Report *
========================================================================
-------------------------------
-------------------------------
31
========================================================================
* Final Report *
========================================================================
Clock Information:
------------------
-----------------------------------+------------------------+-------+
-----------------------------------+------------------------+-------+
clk | BUFGP | 24 |
-----------------------------------+------------------------+-------+
----------------------------------------
Timing Summary:
---------------
Speed Grade: -4
========================================================================
32
Applying constraints in "t.ucf" to the design...
-------------------------------
-------------------------------
Number of errors: 0
Number of warnings: 0
NGDBUILD done.
Design Summary:
Number of errors: 0
Number of warnings: 1
Logic Utilization:
33
Number of 4 input LUTs: 33 out of 1,920 1%
Logic Distribution:
NOTES:
Related logic is defined as being logic that shares connectivity - e.g. two
LUTs are "related" if they share common inputs. When assembling slices,
unrelated logic into a slice once 99% of the slices are occupied through
Note that once logic distribution reaches the 99% level through related
logic packing, this does not mean the device is completely utilized.
Unrelated logic packing will then begin, continuing until all usable LUTs
and FFs are occupied. Depending on your timing budget, increased levels of
unrelated logic packing may adversely affect the overall timing performance of your design.
34
Mapping completed.
Loading device for application Rf_Device from file '3s100e.nph' in environment C:\Xilinx92i.
INFO:Par:282 - No user timing constraints were detected or you have set the option to ignore timing
constraints ("par -x"). Place and Route will run in "Performance Evaluation Mode" to automatically
improve the performance of all internal clocks in this design. The PAR timing summary will list the
performance achieved for each clock. Note: For the fastest runtime, set the effort level to "std". For
best performance, set the effort level to "high". For a balance between the fastest runtime and best
performance, set the effort level to "med".
35
Number of BUFGMUXs 1 out of 24 4%
Starting Placer
Phase 1.1
Phase 2.7
Phase 3.31
Phase 4.2
......
Phase 5.30
Phase 6.3
Phase 7.5
Phase 8.8
36
.
Phase 9.5
Phase 10.18
Phase 11.5
Starting Router
-------------------------------
37
No Partitions were found in this design.
-------------------------------
**************************
**************************
+---------------------+--------------+------+------+------------+-------------+
+---------------------+--------------+------+------+------------+-------------+
+---------------------+--------------+------+------+------------+-------------+
* Net Skew is the difference between the minimum and maximum routing
only delays for the net. Note this is different from Clock Skew which
the minimum and maximum path delays which includes logic delays.
Timing Score: 0
------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------
Autotimespec constraint for clock net clk | SETUP | N/A| 4.441ns| N/A| 0
------------------------------------------------------------------------------------------------------
38
INFO:Timing:2761 - N/A entries in the Constraints list may indicate that the
constraint does not cover any paths or that it has no requested value.
PAR done!
C:\Xilinx92i.
--------------------------------------------------------------------------------
Number of warnings: 0
39
GENERATE PROGRAMMING FILE
Started : "Generate Programming File".
RESULT:
Thus the traffic light controller program was successfully tested on the FPGA kit.
40
Ex no: 6
Date: DESIGN A REAL TIME CLOCK AND DEMONSTRATE
AIM:
To design a real time clock and demonstrate its working on the FPGA Board
REQUIREMENTS:
1. PC 01
6. Power Adapter 01
7. Power Cable 01
THEORY:
Real Clock timer consists of six character multiplexed display working on system clock of 4 MHz.
Out of six displays first two (DIS -6 and DIS- 5) are used to display hours, next two (DIS-4 and DIS-
3) are used to display minutes and last two (DIS -2 and DIS-1) are used to display seconds status.
Real time status is displayed on these seven segments by writing a HDL functionality of 6 counters
cascaded with each other and decoding its output to seven segment equivalents.
HDL functionality also offers a provision for loading the real clock timer with a new value using load
signal, when high real clock timer is loaded with new value.
41
PROCEDURE:
Step 1:Start the Xilinx Project Navigator by using the desktop shortcut or by using the
Step 2: Create a new project and Select File menu and then select New project.
Step3: Specify the project name and location in pop up window and click NEXT.
Step4: Select Device. Select the required family, device, package, speed grade, Synthesis tool Simula-
tor from new project wizard pop up window. Click NEXT. Project summary will be displayed.
Step6: To create new V file Right click on the device name and select NEW SOURCE
Step 7: Select VERILOG MODULE in NEW SOURCE WIZARD and give suitable name for thePro-
ject. Click NEXT for the DEFINE MODULE Window Assign required ports in this Window.
Step 8: Write the Behavioural VERILOG Code in VERILOG Editor Sample code is given below for
this experiment.
Run the Check syntax Process windowsynthesize check syntax , and remove errors if
present
Translate the design into gates and optimize it for the target architecture. This is the
synthesis phase. Again for synthesizing your design, from the source window
selects synthesis/Implementation from the drop-down menu. Highlight file in the Sources in
Project window. To run synthesis, right-click on Synthesize, and the Run option, or double-
click on Synthesize in the Processes for Current Source window. Synthesis will run, and a
green check !will appear next to Synthesize when it is successfully completed.
a red cross "indicates an error was generated and
a yellow exclamation mark indicates that a warning was generated. Check the synthesis re-
port. If there are any errors correct it and rerun the synthesis.
Step 11: Write User Constraint file wherein the FPGA pins are locked as per the Spartan-II hard-
ware. Running the Xilinx Implementation Tools. Once synthesis is complete, you can place and
42
route your design to fit into a Xilinx device (Spartan3 200k), and you can also get some post place-
and-route timing information about the design. This procedure runs you through the basic flow for
implementation.
Step 12: Right-click on Implement Design, and choose the Run option, or double left-click on
Implement Design.Right-click on Generate Programming File, and choose the Run option, or
double left-click on Generate Programming File. This will generate the Bitstream. Double click
on Configure Device to download the bitstream.
PROGRAM:
reset,clock);
output [3:0]sec1,sec2,min1,min2,hr1,hr2;
output tc1,tc2,tc3,tc4,tc5,tc6,enable;
input reset,clock,load;
reg [3:0]sec1_rg,sec2_rg,min1_rg,min2_rg,hr1_rg,hr2_rg;
reg [2:0]cnk2;
reg [3:0]mout;
reg [7:0]sgout_rg;
reg [5:0]dis_sig;
//reg tc,tc1,tc2,tc3,tc4,tc5,tc6,enable;
//reg sec1_rg(3:0),sec2_rg(3:0),min1_rg(3:0),min2_rg(3:0),hr1_rg(3:0);
//reg hr2_rg(3:0),pulsegen(21:0),sel(2:0);
//regmout(3:0),sgout(7:0),ck1(22:0),cnk2(2:0);
begin
if (reset)
43
pulsegen<= 22'b0;
else
begin
if (pulsegen == 22'b1111010000100100000000)
pulsegen<= 22'b0;
else
pulsegen<= pulsegen + 1;
end
end
else
end
end
end
begin
begin
if (reset )
end
44
else
begin
if (enable)
begin
if (sec1_rg == 4'b1001)
if (reset )
end
else
begin
if (tc1)
begin
end
else begin
end
end
end
end
begin
45
if (reset )
end
else
begin
if (tc2)
begin
end
else begin
end
end
end
end
begin
if (reset)
end
46
else
begin
if (tc3)
begin
end
else
begin
end
end
end
end
begin
if (reset)
end
else
begin
if (tc6)
begin
47
end
else
begin
if (tc4)
begin
end
else
begin
end
end
end
end
end
assign tc6 = (hr2_rg == 4'b0010) && (hr1_rg == 4'b0011) && (tc4 == 1);
begin
if (reset)
end
48
else
begin
if (tc6)
begin
end
else
begin
if (tc5)
begin
end
else
begin
end
end
end
end
end
begin
if (reset)
else
begin
if (cnk2 == 3'b101)
else
49
cnk2 <= cnk2 + 1;
end
end
always@(cnk2)
case (cnk2)
endcase
always@(mout)
case (mout)
endcase
always@(cnk2)
case (cnk2)
50
3'b100 :dis_sig<= 6'b101111;
endcase
assignsgout = sgout_rg;
endmodule
PIN DESCRIPTION:
51
OUTPUT SEG F “P138”
RESULT:
Thus the real time clock was designed and implemented on the FPGA Kit.
52
NETWORKS
LABORATORY
53
LIST OF EXPERIMENTS (NETWORKS)
67
2. Wireless LAN protocols
83
54
Ex.no:1 (A) Ethernet LAN protocol
Date:
Aim: Implement the CSMA protocol for packet communication between a numbers of nodes
connected to a common bus.
Requirements:
Theory:
Each station first listen to the medium (or check the state of the medium) before sending. In
other words, CSMA is based on the principle “Sense before transmit” or “Listen before talk”. CSMA
can reduce the possibility of collision, but it cannot eliminate it.
Procedure:
1. Click on the “MAC Experiment” icon twice from the desktop on both PC’s.
PC 1 PC 2
a. Node Id = ‘0’ on config menu 1 and ‘1’ on a. Node Id = ‘0’ on config menu 1 and ‘1’
c. Baud rate = 8 kbps(at both config menu c. Baud rate = 8 kbps(at both config menu
f. IPD = 40 ms f. IPD = 40 ms
55
3. Select the “OK” button and Download the driver to the NIU using the BOOT button command.
Booting from any one of the applications is enough.
4. Run the experiment by clicking button or RUN – Start from each application.
5. View the statistics window for results. Only Tx packets and collision count are taken into account
for MAC calculation.
X= -----------------------------------------------------------------------------------------
G= ----------------------------------------------------------------------------
56
Tabulation:
Graph:
57
CONTENTS MAXIMUM MARKS
MARKS OBTAINED
Preparation 30
Observation 30
Record 40
Total 100
Result:
Thus the ALOHA protocol for packet communication in ETHERNET LAN was implemented.
58
Ex.no:1 (B) Token Bus Protocol
Date:
Aim:
To implement the token passing access in BUS-LAN
Requirements:
(i) Computer with Benchmark Lan-T software.
(ii) Hardware emulator kit.
Theory:
Token bus was a 4Mbps local area networking technology created by IBM to connect their terminals
to mainframes. Token bus utilized a copper coaxial cable to connect multiple. The coaxial cable saved
as a common communication bus and a token was created by token bus protocol to manage or arbi-
trate access to the bus.
Any station that has token packet has permission to transmit data. The station releases token when it is
done communication or when a higher priority device needs to transmit. Token bus suffered two ma-
jor limitations-any failure in bus caused all the devices beyond failure to be able to communicate with
rest of the network. Secondly adding more stations to bus was difficult. Token bus was thus seen as
unreliable and difficult to expand and upgrade.
Procedure:
1. Click on the ‘Token Bus icon twice from the desktop.
2. Click the Configuration button in the window in both the PC’s.
Node ID:0 as config menu’1’,1 as config Node ID:0 as config menu’1’,1 as config
menu’2’ menu’2’
Duration:100 Duration:100
59
Note 1: If you connect two PC’s and configured four nodes then set the “My Address” as 0 to 3 in all
four nodes, if you connect three PCs and configured six nodes then set the My Address’ as 0 to 5 in
all six nodes.
Note 2: Start running the experiment from the lowest priority node (i.e., from ‘My Address’ 3 in case
of four nodes and 5 in the case of six nodes)
Note 3: No. of Nodes has to be set as 4 when two PCs are connected and 6 when three PCs are con-
nected.
3. Download the driver to the NIU using the BOOT button command for both PCs.
4. Run the experiment by clicking the RUN-Start from each application. Run the all the experiments
at the same time.
Note: While you do this THT window pops up, enter the THT time in all nodes and press the OK but-
ton first in the node, which has highest value of ‘My Address’.
5. Set the Token Holding Time (THT) (say1000 ms).
6. View the statistics window for results.
7. Save or note down the reading when the experiment says that it has stopped after the specified du-
ration.
8. Repeat from the above steps from “a” to “h” and take the readings by changing the Inter Packet
Delay (IPD).
9. Plot the Offered Load G Vs Throughput X, Plot Throughput Vs Average Delay.
10. Repeat the Experiment for various THT and plot the graph
X = -----------------------------------------------------------------------------
N*P
G = ------
C * ta
G – Offered load
N – Number of nodes
60
Tabulation:
Graph:
61
CONTENTS MAXIMUM MARKS
MARKS OBTAINED
Preparation 30
Observation 30
Record 40
Total 100
Result:
Thus the Token passing access in TOKEN-BUS LAN was implemented.
62
Ex. no: 1 (C) Token Ring Protocol
Date:
Aim:
To implement the token passing access in RING-LAN
Required:
(i) Computer with Benchmark LanT software
(ii) Hardware emulator kit.
Theory:
Token ring was created by IBM to improve upon the previous bus technology. Token ring
uses a ring-based technology and passes a token around the network to control access to network wir-
ing. The token ring protocol also provides features for allowing delay sensitive traffic to share net-
work with other data that is key to mainframe operations.
Procedure:
1. Click on the ‘Token-Bus icon twice from the desktop.
2. Click the Configuration button in the window in both the PC’s.
Setting the configuration menu:
PC1 PC2
Node ID:0 as config menu’1’,1 as config Node ID:0 as config menu’1’,1 as config
menu’2’ menu’2’
Duration:100 Duration:100
Note 1: If you connect two PC’s and configured four nodes then set the “My Address” as 0 to 3 in all
four nodes, if you connect three PCs and configured six nodes then set the My Address’ as 0 to 5 in
all six nodes.
63
Note 2: Start running the experiment from the lowest priority node (i.e., from ‘My Address’ 3 in case
of four nodes and 5 in the case of six nodes)
Note 3: No. of Nodes has to be set as 4 when two PCs are connected and 6 when three PCs are con-
nected.
3. Download the driver to the NIU using the BOOT button command for both PCs.
4. Run the experiment by clicking the RUN-Start from each application. Run the all the experiments
at the same time.
Note: While you do this THT window pops up, enter the THT time in all nodes and press the OK but-
ton first in the node, which has highest value of ‘My Address’.
5. Set the Token Holding Time (THT) (say1000 ms).
6. View the statistics window for results.
7. Save or note down the reading when the experiment says that it has stopped after the specified du-
ration.
8. Repeat from the above steps from “a” to “h” and take the readings by changing the Inter Packet
Delay (IPD).
9. Plot the Offered Load G Vs Throughput X, Plot Throughput Vs Average Delay.
10. Repeat the Experiment for various THT and plot the graph
X = -----------------------------------------------------------------------------
N*P
G = ------
C * ta
G – Offered load
N – Number of nodes
64
Tabulation:
Graph:
65
CONTENTS MAXIMUM MARKS
MARKS OBTAINED
Preparation 30
Observation 30
Record 40
Total 100
Result:
Thus the Token passing acess in RING-LAN was implemented.
66
Ex.no:2 Wireless LAN Protocols
Date:
Aim:
Implement the CSMA/CA protocol for packet communication between a numbers of nodes
connected to a common bus.
Required:
(i) Computer with Benchmark Lan-T software
(ii) Hardware emulator kit.
Theory:
The approach called CSMA/CA is adopted by the IEEE 802.11 wireless LAN standard. In
CSMA/CA, if the station finds the channel busy, it does not restart the timer of the contention win-
dow; it stops the timer and restarts it when the channel becomes idle. When an idle channel is found,
the station does not send immediately. It waits for a period of time the inter frame space or IFS. If af-
ter the IFS time the channel is still idle, the station can send, but it still needs to wait a time equal to
the contention time.
Procedure:
d. Duration = 100sec
g. Direction = Receiver
i. My address= “1”
67
Steps to configure Client nodes:
PC 2 PC 2
a. Node id: “0” on config menu a. Node id: “1” on config menu
c. Baud Rate = 8Kbps (At both the c. Baud Rate = 8Kbps (At both the
h. Set the topology to BUS in NEU h. Set the topology to BUS in NEU
3. Click on the “CSMA CA” icon from the desktop on the second PC.
5. Select the “OK” button and Download the driver to the NIU using the BOOT button command.
Booting from any one of the applications is enough.
7. Follow the same procedures in the client side also. Once when you press the run button the follow-
ing window will appear.
10. Set the Control Signal Handshake equal to Packet length (for this case it is 100 as the packet
length is 100 bytes).
11. Set the Data Signal Handshake equal to twice the Packet length(for this case it is 200 as the packet
length is 100 bytes).
After 30 sec both the nodes stops transmitting and the following screen appears:
After 100 sec both the nodes stops transmitting and the following screen appears:
Once the Sender stops, press the OK button in the receiver Node and Press the stop button.
12. Repeat the above steps for various values of ta.
68
13. Calculate the Practical offered load from the below given formula and plot the graph between the
practical Offered load and Throughput.
14. Repeat the experiment for various values of Packet length, Node, Data rate
X = ---------------------------------------------------------------------------
G= ----------------------------------------------------------------------
Tabulation:
69
GRAPH:
Result:
Thus the WIRELESS LAN protocol was implemented by using ALOHA.
70
Ex. no: 3 Implementation and study of Stop and Wait Protocol
Date:
Aim:
Provide reliable data transfer between two nodes over an unreliable network using the stop
and wait protocol.
Required:
(i) Computer with benchmark LanT software
(ii) Hardware emulator kit.
Theory:
In a stop and wait method of flow control, the sender waits for an acknowledgement after every frame
it sends. Only when an acknowledgement has been received, the next frame is sent. This process of
alternately sending and waiting repeats until the sender transmits on end of transmission frame. The
advantage is simplicity and the disadvantage is its inefficiency.
Stop and wait ARQ is a form of stop and wait flow control extended to include retransmission of data
in case of damaged frames. For retransmission to work, four features are added to the basic flow con-
trol mechanism.
The sending device keeps a copy of the last frame transmitted until it receives an acknowledgement
for that frame. Keeping a copy allows the sender to retransmit lost or damaged frames until they are
received correctly.
For identification purposes with data frames and ACK frames are numbered alternately 0 and
1. An ACK 1 frame, indicating that the receiver has gotten data 0 and is now expecting data
1, acknowledges a data 0 frame. This numbering allows for identification allows for identifi-
cation of data frames in case of duplicate transmission.
If an error is discovered in a data frame, indicating that it has been corrupted in transit, a NAK frame
is returned. NAK frames, which are not numbered, tell the sender to retransmit the last frame sent.
Stop and wait ARQ requires that the sender waits till it receives an acknowledgement for the frame,
last sent by it, before it transmits the next one. When the sender receives a NAK, it retransmits the
frame sent after the previous ACK, irrespective of the number. The sending device is equipped with a
timer.
Procedure:
1. Click on the ‘Stop & Wait’ icon from the desktop on both PCs.
2. Click the Configuration button in the window in both the Pc’s.
3.Download the driver to the NIU using the BOOT button command for both PCs.
4. Run the experiment by clicking the RUN-Start from each application. Run the receiver node first
& then the Sender node. While you run the Sender node it will ask for timeout value.
71
5. Set the Timeout Value to 1500
PC 1 PC 2
a. Node Id = ‘0’ on config menu 1 and ‘1’ on a. Node Id = ‘0’ on config menu 1 and ‘1’
c. Baud rate = 8 kbps(at both config menu c. Baud rate = 8 kbps(at both config menu
f. IPD = 40 ms f. IPD = 40 ms
7. Repeat the above steps for various time out values and draw a graph between timeout Value &
throughput.
X= -----------------------------------------------------------------------------------------
72
Tabulation:
Timeout (T) (ms) Successfully Txd Practical Throughput
Graph:
73
CONTENTS MAXIMUM MARKS
MARKS OBTAINED
Preparation 30
Observation 30
Record 40
Total 100
Result:
Thus the STOP and WAIT protocol was successfully implemented.
74
Ex.no:4 (A). Implementation and Study of GOBACK-N Protocol
Date:
Aim:
Provide reliable data transfer between two nodes over an unreliable network using the
Sliding window go back N protocol
Required:
(i) Computer with benchmark Lan-T software
(ii) Hardware emulator kit.
Theory:
In this sliding window Go-Back_N ARQ method, if one frame is lost or damaged, all frames sent
since the last frame acknowledge are retransmitted.
Damaged Frame: When the frames 0, 1, 2 and 3 have been transmitted but the first acknowledge-
ment received is a NAK 3, there are 2 meanings for the NAK. First, a positive acknowledgement of
all frames received prior to the damaged frame and second, a negative acknowledgement of the frame
indicated. If the first acknowledgement of the indicated is a NAK 3, it means that data frames 0, 1 and
2 were all received in good shape. Only frame 3 must be resent. If frames 0 through 4 have been
transmitted before a NAK is received, the receiver discovers and error, it stops accepting subsequent
frames until the damaged frame has been replaces correctly.
Lost data frame: Sliding window protocols require that the data frame be transmitted sequentially. If
one or more frames are noise corrupted that they are lost in transit, the next frame that arrives at the
receiver will be out of sequence. The receiver that one or more have skipped and returns a NAK for
the first missing frames. A NAK frame does not indicate whether the frame has been lost or damaged,
first that it means to be resent. The sending device then retransmits the frame indicated by the NAK,
as well as any frame that it had transmitted after the last one.
Procedure:
1. Click on the ‘Sliding win go back n’ icon from the desktop on both PCs.
2. Click the Configuration button in the window in both the Pc’s.
Setting the configuration
menu:
75
6. Set the Timeout Value to 1500
7. Note down the no of successfully Transmitted Packets & Retransmission Count.
8. Repeat the above steps for various time out values and draw a graph between timeout Value &
Throughput. Find the optimum timeout value from the plot
X= -----------------------------------------------------------------------------------------
Tabulation:
76
Graph:
77
Ex. no 4(B). Implementation and Study of Selective Repeat Protocol
Date:
Aim:
Provide reliable data transfer between two nodes over an unreliable network using the sliding
window selective repeat protocol.
Required:
(i) Computer with benchmark Lan-T software
(ii) Hardware emulator kit.
Procedure:
1. Click on the Selective Repeat icon from the desktop on both PCs.
PC1 PC2
Node id 0 Node id 0
Baud Rate 8Kbps (At both Baud Rate 8Kbps (At both
the the
78
3. Set the Inter Packet Delay to 400msecs
4. Click OK button and Download the driver to the NIU using the BOOT button command. Booting
from any one of the applications is enough.
5. Run the experiment by clicking button or by choosing RUN _ Start from each application.
8. Repeat the above steps for various time out values and plot a graph between timeout Value
&Throughput. Find the optimum timeout value from the plot.
X = ----------------------------------------------------------------------
Tabulation:
79
Graph:
Result:
Thus the SELECTIVE REPEAT protocol was successfully implemented.
80
Ex .no:5 Implementation of Distance Vector Algorithm
Date:
Aim:
To simulate the distance vector routing protocol to maintain routing tables as the traffic and topology
of the network changes.
Procedure:
1. Double click on Lan-T Routing Simulator icon from the desktop.
3. Click button and configure button and select Distance vector algorithm
4. The icon in the screen represents the nodes and the green color line represents the path. The values
inside the braces represents the ‘Forward and Reverse’ weights.
6. The above picture shows the nodes and its routing table.
7. Observe the routing table showing No route to some of the destinations even though there is a phys-
ical connection. This is because the routing table of the corresponding nodes is not been updated since
there is no hopping. To update the routing table click button.
9. Now after several hopping the routing table gets updated. As the number nodes increases, the num-
ber of hopping increases. This is one of the disadvantages of distance vector algorithm.
81
CONTENTS MAXIMUM MARKS
MARKS OBTAINED
Preparation 30
Observation 30
Record 40
Total 100
Result:
Thus the DISTANCE VECTOR ALGORITHM was successfully implemented.
82
Ex .no:6 Implementation of Link State Routing Algorithm
Date:
Aim:
To simulate the link state routing protocol to maintain routing tables as the traffic and topology of the
network changes.
Procedure:
1. Double click on Lan-T Routing Simulator icon from the desktop.
5. Click the button to update the routing table. Routing table of entire nodes gets updated after a single
hopping. This is one of the advantages of Link state algorithm over Distance vector algorithm.
7. Enter forward and reverse weights as -1 to disconnect N4 from the other nodes.
8. Observe the routing table. The values are not changed as it’s not updated.
10. Now you could see the routing table for each nodes been updated. This is the advantage of ‘Link
state algorithm’ over ‘Distance vector algorithm’.
83
CONTENTS MAXIMUM MARKS
MARKS OBTAINED
Preparation 30
Observation 30
Record 40
Total 100
Result:
Thus the LINK STATE ROUTING ALGORITHM was successfully implemented.
84
Ex .no:7 Implementation of Data Encryption and Decryption
Date:
Aim:
To encrypt a file using RC4 encryption algorithm and decrypt the same
Required:
Computer with encryption and decryption software
Initial set-up:
Install jre 1.5(java run time environment) to run this application
Theory:
To carry sensitive information such as military or financial data, a system must be able to assure pri-
vacy. Microwave, satellite and other wireless media, however, cannot be protected from the unauthor-
ized reception (or interception) of transmission. Even cable systems cannot always prevent unauthor-
ized access. Cables pass through out-of-the-way areas (such as basements) that provide opportunities
for malicious access to access to the cable and illegal reception of information.
It is unlikely that any system can completely prevent unauthorized access to transmission
media. A more practical way to protect information is to alter it so that only an authorized
receiver can understand it. Data tampering is not a new issue, nor is it unique to the computer
era.
In fact, there are methods to make information unreadable b unauthorized receivers. The method used
today is called the encryption and decryption of information. Encryption means that the sender trans-
forms the original information to another form and sends the resulting unintelligible message out over
the network. Decryption reverses the encryption process in order to transform the message back to its
original form.
The sender uses an encryption algorithm and a key to transfer the plaintext (the original message) into
a cipher text (the encrypted message). The receiver uses a decryption algorithm and a key to transform
the cipher text back to the original plaintext.
Procedure:
Double click on RC4 icon.
Select Step mode and type any text to encrypt. Type any encryption key in either text or bina-
ry mode.
Click the Next button from the right side panel.
Now the State table and Key tables are formed.
The flow of the algorithm in each step is explained in the description panel on the right side.
In the next step the permutated values are stored in the S Box Permutation.
Key bit stream is generated from the values obtained from S Box Permutation.
XOR operation is done between the binary value and key bit stream generated.
Cipher text is formed corresponding to the XOR value generated.
85
Copy the cipher text by selecting and pressing ctrl + c.
Click the clear button and paste the cipher text in the text field.
Enter the same key that is used for encryption.
Now you could retrieve back the original message.
Result: Thus the ENCRYPTION and DECRYPTION of a file using RC4 Encryption and Decryption
Algorithm was successfully implemented.
86
87