Académique Documents
Professionnel Documents
Culture Documents
BONAFIDE CERTIFICATE
VI sem III year Of Electronics and Communication Engineering Branch during the year 2009-
2010 in the following lab course
Reg .no :
Pagalavadi
INTRODUCTION
Introduction to EDA
The digital designers found very difficult to design complex circuits and to verify that
working properly or not in a short time period. So they some computer aided tool(CAD) to
EDA tools.
1. Simulation tool
2. Synthesis
What is simulation?
General definition:
Technical definition:
Simulating a chip design through software programs that use models to replicate how a
device will perform in terms of timing and results.The various tools available in market for
simulation, which supports VHDL(very high speed integrated circuits hardware description
language) and verilog HDL(verification logic hardware description language) are:
1. Verilog-XL
2. NCverilog
3. Modelsim
4. Mpsim
5. Active HDL
Out of this modelsim from the company mentor graphics is the most popular simulator, it
has got very good debugger, it supports systemC, verilog, VHDL and system verilog.
What is synthesis?
The process by which a designer is able to fully automate the contents of an IC design.
Today’s chip designs have millions of switches. An engineer cannot possibly design all of
these gates with pencil and paper. Companies such as synopsys, Xilinx, cadence create
software tolls, for synthesis, that fully automate the creation of these switches—making
possible the design of semiconductors.
The various tools available in market for synthesis, which supports VHDL(very high speed
integrated circuits hardware description language) and verilog HDL(verification logic
hardware description language)are:
3. Design compiler-cadence
Out of this project navigator(ISE) from the company Xilinx is the most popular synthesis
tool, which supports systemc, verilog, VHDL and system verilog.So in our discussion we
will be using, project navigator(ISE) version:6.1i.
ISE can be used by a full spectrum of designers, from the first time CPLD designer to the
experienced ASIC designer transitioning to FPGA.
NGC/NGO
State machines
Ip cores
HDL sources may be synthesized using the Xilinx synthesis technology(XST). The Xilinx
implementation tools continue the process into a placed and routed FPGA or fitted CPLD,
and finally produce a bit stream for your device configuration.
Synthesis?
Definition:
1. Placement is a task of placing the logical blocks to the adjacent block to minimize
the area of the chip size.
2. Routing the task of connecting the logical blocks with the wires.
Back annotation:
As synthesis technology evolved, cooperation between synthesis and place and route
(P&R) operations became bidirectional, although still sequential. In place-optimization
(IPO) techniques emerged. Logic synthesis produced a netlist that was placed and routed.
Then results from the P&R were back annotated, in the synthesis tool, in an effort to fix
timing violations. The tools use the gate level netlist produced by logic synthesis and the
delays extracted from P&R. using various algorithms, like replicating registers with high
fanout, and logic restricting, the tool optimizes the design’s critical path in order to achieve
timing convergence. The modified netlist is then sent to P&R again and iterated upon.
The approach is also used in physical optimizations for FPGA today. This method can be
very time consuming because placeand route of a complex FPGA takes hours. Worse yet,
convergence is typically an issue. Each new netlist requires a new P&R run ending up with
a new set of timing violations. Performing several iterations is not only costly, but does not
guarantee converge. Using incremental placement, where only the changed portion of the
design is reprocessed, may not fix the problem because of the complex dependencies
generated when trying to optimize only a portion only a portion of the fixed routing
channels available on the FPGA.
STUDY OF SIMULATION USING VERILOG MODULE
AIM:
THEORY:
The Simulator environment must maintain information about various design units
involved in simulation such as location of libraries . If the verilog HDL analyzer returns
errors relating to the absence of key libraries it is most likely a result of the lack of
definition of the physical location of the logical libraries.
PROCEDURE
Intialize the Xilinx ISE 9.li simulator by double clicking the icon on the
desktop.
In the design summary window go to New project through the File menu.
Enter the Project Name In the New project wizard and then click Next.
Speed -6
In the New source wizard select Verilog module and enter the File name
and then click Next.
Set the input and output variable to be used and then click Next
The Summary of the New source wizard is displayed ,conform the displayed
details by clicking finish icon.
Go to the source and select synthesis /implementation .Here right click the
mouse and select New Source
Here select the TEST BENCH WAVEFORM and enter the file name and then click
next.
Double click the simulate Behavioural Module in XILINX ISE simulator Which
displays the Output Waveform.
STUDY OF SIMULATION USING SCHEMATIC PROCESS
select Schematic and enter the File Name thin click Next.
STEP 3: Your New Source Wizard summary is shown and select Finish and conform
Yes
STEP 4: Then click Next and again click Next, finally select Finish
in Design Summary.
STEP 9: Double click on each I/O Marker & assign the name like a,b (or) any required
STEP 10: Save the Design Summary.
STEP 11: Go to Source.
STEP 12: Go to Design Utilities and double click the Check Design Rules for completed
successfully.
RESULT:
THEORY:
For the above XOR gate model explained in experiment No 1, the next step is change
source for as Synthesis/Implementation. After run the synthesis in process window that is
shown in below figures. Then XOR gate model is converted to net list file. To convert
RTL to gates, four steps typically occurs below.
PROCEDURE:
STEP 1: Follow the steps as seen previous process like either simulation procedure or
project.
STEP 6: Then double click inside the schematic representation of our project we get
like below
RESULT:
AIM:
THEORY:
For above XOR module, we have a gate-level net list the next step is to map this
design on to the FPGA. The primitive hardware elements are available in XILINX
xc3s500e chip, namely lookup tables and positive-edge-triggered flip-flop are organized as
a two dimensional array of CLBs. The net list from synthesize is composed of gate,
latches, and flip-flop. It’s necessary to assign CLB to net list primitives. This is the
process mapping a design. For example gates will be assigned to lookup table as illustrated
below.
PROCEDURE:
STEP 1: Follow the steps as seen previous process like either Simulation Procedure
or
RESULT:
Thus the PLACE AND ROUTE & BACK ANNOTATION for FPGAs was
studied.
To design a Half adder circuit using verilog module in XILINX ISE 9.1i tool.
CODING:
Design Statistics
# IOs :4
Cell Usage :
# BELS :2
# LUT2 :2
# IO Buffers :4
# IBUF :2
# OBUF :2
=================================================================
========
Device utilization summary:
---------------------------
.
PROGRAM FOR HALF ADDER USING SCHEMATIC MODULE
RESULT:
Thus the Half Adder was designed and its output was verified.
PROGRAM FOR FULL ADDER USING VERILOG MODULE
AIM:
To design a full adder circuit using verilog module and schematic in XILINX ISE 9.1i tool.
CODING:
input a;
input b;
input ci;
output s;
output c;
wire s,c;
assign s=(a^b)^ci;
assign c=(a&b)|(a&ci)|(b&ci);
endmodule
Final Report:
Final Results
Keep Hierarchy : NO
Design Statistics
# IOs :5
Cell Usage :
# BELS :2
# LUT3 :2
# IO Buffers :5
# IBUF :3
# OBUF :2
Number of IOs: 5
RESULT:
AIM:
To design a full subtractor using verilog module in XILINX ISE 9.1i tool.
CODING:
input a;
input b;
input bi;
output d;
output bo;
wire d,bo,a1;
assign d=(a^b)^bi;
assign a1=!a;
assign bo=(a1&b)|(a1&bi)|(b&bi);
endmodule
Final Report:
Final Results
Keep Hierarchy : NO
Design Statistics
# IOs :5
Cell Usage :
# BELS :2
# LUT3 :2
# IO Buffers :5
# IBUF :3
# OBUF :2
Number of IOs: 5
Number of bonded IOBs: 5 out of 140 3%
Thus the Full Subtractor was designed and its output was verified.
AIM:
To design a Multiplexer circuit using verilog module in XILINX ISE 9.1i tool.
CODING:
input i0;
input i1;
input i2;
input i3;
input s1;
input s0;
output y;
wire s1b,s0b,d,e,f,g;
not1 l1(s0b,s0);
not1 l2(s1b,s1);
and1 l3(d,i0,s1b,s0b);
and1 l4(e,i1,s1b,s0);
and1 l5(f,i2,s1,s0b);
and1 l6(g,i3,s1,s0);
or1 l7(y,d,e,f,g);
endmodule
module not1(b,a);
input a;
output b;
assign b=!a;
endmodule
module and1(d1,a1,b1,c1);
input a1,b1,c1;
output d1;
assign d1=(a1&b1)&c1;
endmodule
module or1(e2,a2,b2,c2,d2);
input a2,b2,c2,d2;
output e2;
assign e2=(a2|b2)|(c2|d2);
endmodule
=======================================================================
==
* Final Report *
=======================================================================
==
Final Results
Keep Hierarchy : NO
Design Statistics
# IOs :7
Cell Usage :
# BELS :3
# LUT3 :2
# MUXF5 :1
# IO Buffers :7
# IBUF :6
# OBUF :1
=======================================================================
==
---------------------------
Number of IOs: 7
Thus the Multiplexer was designed and its output was verified.
To design a Demultiplexer circuit using verilog module and schematic inXILINX ISE 9.1i
tool.
CODING:
input x;
input s1;
input s0;
output y0;
output y1;
output y2;
output y3;
//wire x,s1,s0;
reg y0,y1,y2,y3;
//initial
begin
if(s1==1'b0&&s0==1'b0)
begin
y0=x;
end
else if(s1==1'b0&&s0==1'b1)
begin
y1=x;
else if(s1==1'b1&&s0==1'b0)
begin
y2=x;
end
begin
y3=x;
end
end
endmodule
=================================================================
========
* Final Report *
=================================================================
========
Final Results
Keep Hierarchy : NO
Design Statistics
# IOs :7
Cell Usage :
# BELS :4
# LUT3 :4
# IO Buffers :7
# IBUF :3
# OBUF :4
=================================================================
========
---------------------------
Number of IOs: 7
RESULT:
AIM:
To design a D-Flip Flop using Verlog Module and Schematic Module in XILINX
ISE 9.1i tool.
CODING:
input D;
input C;
inout Q;
inout QB;
wire db,y1,y2;
assign db = ~D;
assign y1 = ~(D&C);
assign y2 = ~(db&C);
assign Q = ~(y1&QB);
assign QB = ~(y2&Q);
endmodule
=================================================================
========
* Final Report *
=================================================================
========
Final Results
Keep Hierarchy : NO
Design Statistics
# IOs :4
Cell Usage :
# BELS :2
# INV :1
# LUT3 :1
# IO Buffers :4
# IBUF :2
# OBUF :2
=================================================================
========
---------------------------
Number of IOs: 4
---------------------------
---------------------------
---------------------------
=================================================================
========
TIMING REPORT
Clock Information:
------------------
----------------------------------------
Timing Summary:
---------------
Speed Grade: -5
Timing Detail:
-------------------------------------------------------------------------
Source: C (PAD)
Destination: QB (PAD)
Data Path: C to QB
Gate Net
---------------------------------------- ------------
----------------------------------------
=================================================================
========
-->
Thus the D-Flip Flop was designed and its output was verified.
PROGRAM FOR JKFLIP-FLOP USING VERILOG MODULE
AIM:
To design a JK Flip-flop using verilog module in XILINX ISE 9.1i tool.
CODING:
module jk(q,q1,j,k,clk);
output q,q1;
input j,k,clk;
reg q,q1;
always@(j,k,clk)
begin
if(j==1'b0&&k==1'b0)
begin
q=q;
q1=q1;
end
else if(j==1'b0&&k==1'b1)
begin
q=1'b0;
q1=1'b1;
end
else if(j==1'b1&&k==1'b0)
begin
q=1'b1;
q1=1'b0;
end
else
begin
q=q1;
q1=q;
end
end
endmodule
Final Report:
Final Results
RTL Top Level Output File Name : jk.ngr
Top Level Output File Name : jk
Output Format : NGC
Optimization Goal : Speed
Keep Hierarchy : NO
Design Statistics
# IOs :5
Cell Usage :
# BELS :3
# LUT2 :1
# LUT3 :2
# FlipFlops/Latches :2
# LD :2
# IO Buffers :4
# IBUF :2
# OBUF :2
RESULT:
Thus the Program for JK Flip Flop was completed successfully.
PROGRAM FOR ENCODER USING VERILOG MODULE
AIM:
CODING:
input D0;
input D1;
input D2;
input D3;
output X;
output Y;
assign X= D2 | D3;
assign Y= D1 | D3;
endmodule
=================================================================
========
* Final Report
*================================================================
=========
Final Results
Keep Hierarchy : NO
Design Statistics
# IOs :6
Cell Usage :
# BELS :2
# LUT2 :2
# IO Buffers :5
# IBUF :3
# OBUF :2
---------------------------
Number of IOs: 6
---------------------------
TIMING REPORT
Clock Information:
----------------------------------------
Timing Summary:
---------------Speed Grade: -5
Timing Detail:
--------------
=================================================================
========
-------------------------------------------------------------------------
Source: D2 (PAD)
Destination: X (PAD)
Data Path: D2 to X
Gate Net
---------------------------------------- ------------
----------------------------------------
==========
-->
Thus the Encoder was designed and its output was verified.
PROGRAM FOR SERIAL IN SERIAL OUT USING VERILOG MODULE
AIM:
To design a serial in serial out using verilog module in XILINX ISE 9.1i tool
CODING:
module siso(sout,clk,rst,sin);
output sout;
input clk,rst,sin;
reg [3:0]tmp;
reg sout;
always@(clk,rst,sin)
begin
if(rst)
tmp=4'b0000;
sout=tmp[3];
end
else
begin
tmp={tmp[2:0],sin};
sout=tmp[3];
end
end
endmodule
Final Report:
Final Results
RTL Top Level Output File Name : siso1.ngr
Top Level Output File Name : siso1
Output Format : NGC
Optimization Goal : Speed
Keep Hierarchy : NO
Design Statistics
# IOs :4
Cell Usage :
# BELS :1
# LUT2 :1
# IO Buffers :3
# IBUF :2
# OBUF :1
RESULT:
Thus the Program for Serial in Serial out was completed successfully.
PROGRAM FOR SERIAL IN PARALLEL OUT USING VERILOG MODULE
AIM:
To design a serial in parallel out using verilog module in XILINX ISE 9.1i tool
CODING:
module sipo1(pout,clk,rst,sin);
output [7:0]pout;
input clk,rst,sin;
reg [7:0]tmp;
reg pout;
always@(clk,rst,sin)
begin
if(rst)
tmp=8'b00000000;
else
begin
tmp={tmp[6:0],sin};
pout=tmp;
end
end
endmodule
Final Report:
Final Results
RTL Top Level Output File Name : sipo1.ngr
Top Level Output File Name : sipo1
Output Format : NGC
Optimization Goal : Speed
Keep Hierarchy : NO
Design Statistics
# IOs : 11
Cell Usage :
# BELS :1
# LUT2 :1
# FlipFlops/Latches :8
# LD_1 :8
# Clock Buffers :1
# BUFGP :1
# IO Buffers :9
# IBUF :1
# OBUF :8
Device utilization summary:
Selected Device : 2s150pq208-6
Number of Slices: 1 out of 1728 0%
Number of Slice Flip Flops: 8 out of 3456 0%
Number of 4 input LUTs: 1 out of 3456 0%
Number of IOs: 11
Number of bonded IOBs: 10 out of 140 7%
IOB Flip Flops: 8
Number of GCLKs: 1 out of 4 25%
RESULT:
Thus the Program for Serial in parallel out was completed successfully.
PROGRAM FOR PARALLEL IN SERIAL OUT USING VERILOG MODULE
AIM:
To design a parallel in serial out using verilog module in XILINX ISE 9.1i tool
CODING:
module piso(sout,clk,rst,load,pin);
output sout;
input [7:0]pin;
input clk,rst,load;
reg [7:0]tmp;
reg sout;
always @(clk,rst,load)
begin
if(rst)
begin
tmp=8'b00000000;
end
else if(load)
begin
tmp=pin;
sout=tmp[7];
end
else
begin
tmp={tmp[6:0],1'b0};
sout=tmp[7];
end
end
endmodule
Final Report:
Final Results
RTL Top Level Output File Name : piso.ngr
Top Level Output File Name : piso
Output Format : NGC
Optimization Goal : Speed
Keep Hierarchy : NO
Design Statistics
# IOs : 12
Cell Usage :
# BELS :1
# LUT2 :1
# FlipFlops/Latches :1
# LD_1 :1
# Clock Buffers :1
# BUFGP :1
# IO Buffers :3
# IBUF :2
# OBUF :1
AIM:
To design a parallel in parallel out using verilog module in XILINX ISE 9.1i tool
CODING:
module pipo1(pout,clk,rst,load,pin);
output [7:0]pout;
input [7:0]pin;
input clk,rst,load;
reg [7:0]tmp;
reg [7:0]pout;
always @(clk,rst,load)
begin
if(rst)
pout=8'b00000000;
else if(load)
tmp=pin;
else
pout=tmp;
end
endmodule
Final Report:
Final Results
RTL Top Level Output File Name : pipo1.ngr
Top Level Output File Name : pipo1
Output Format : NGC
Optimization Goal : Speed
Keep Hierarchy : NO
Design Statistics
# IOs : 19
Cell Usage :
# FlipFlops/Latches : 16
# LDC_1 :8
# LDE_1 :8
# Clock Buffers :2
# BUFGP :2
# IO Buffers : 16
# IBUF :8
# OBUF :8
RESULT:
Thus the Program for parallel in parallel out was completed successfully.
PROGRAM FOR RING COUNTER USING VERILOG MODULE
AIM:
To design a ring counter using verilog module
CODING:
module ring(count,clk,rst);
output [3:0]count;
input clk,rst;
reg [3:0]tmp;
reg [3:0]count;
always@(clk,rst)
begin
if(rst)
tmp=4'b1000;
else
begin
tmp={tmp[2:0],tmp[3]};
end
count=tmp;
end
endmodule
Final Report:
Final Results
RTL Top Level Output File Name : ring.ngr
Top Level Output File Name : ring
Output Format : NGC
Optimization Goal : Speed
Keep Hierarchy : NO
Design Statistics
# IOs :6
Cell Usage :
# BELS :2
# LUT2 :2
# IO Buffers :5
# IBUF :1
# OBUF :4
RESULT:
Thus the Program for Ring counter was completed successfully.
PROGRAM FOR UP/DOWN COUNTER USING VERILOG MODULE
AIM:
To design an up/down counter using verilog module
CODING:
module up(count,clk,rst,en);
output [7:0]count;
input clk,rst,en;
reg [7:0]count;
always@(clk,rst,en)
begin
if(rst)
count=8'b00000000;
else if (en)
count=count+1;
else
count=count-1;
end
endmodule
Final Report:
Final Results
RTL Top Level Output File Name : up.ngr
Top Level Output File Name : up
Output Format : NGC
Optimization Goal : Speed
Keep Hierarchy : NO
Design Statistics
# IOs : 11
Cell Usage :
# BELS : 15
# GND :1
# LUT2 :1
# LUT4 : 10
# MUXF5 :3
# IO Buffers : 10
# IBUF :2
# OBUF :8
RESULT:
Thus the Program for UP/DOWN counter was completed successfully.
PROGRAM FOR SERIAL AND PARALLEL ADDER/SUBTRACTOR
AIM:
Design and Simulation of pipelined Serial and Parallel Adder and Subtractor to
add/subtract 8 number of size, 12 bits each in 2’s complement.
THEORY:
For Example:
In1=”000000001111”
In2=”000000000001”
In3=”000000000001”
In4=”000000000001”
In5=”000000000010”
In6=”000000000010”
In7=”000000000010”
In8=”000000000010”
SUM=”000000011010”
CARRY=”000”
CODING:
Default inputs are assign to all the inputs in1 to in8. If user needs to force new inputs, apply
in Simulation and verify the results.
reg[11:0]SUM;
reg[2:0]CARRY;
reg[11:0]in1=12'b000000001111;
reg[11:0]in2=12'b000000000001;
reg[11:0]in3=12'b000000000001;
reg[11:0]in4=12'b000000000001;
reg[11:0]in5=12'b000000000010;
reg[11:0]in6=12'b000000000010;
reg[11:0]in7=12'b000000000010;
reg[11:0]in8=12'b000000000010;
// Temporary Signals.
reg[12:0]temp=13'b1000000000000;
reg[15:0]temp1=16'b1000000000000000;
reg[11:0]a1,a2,a3,a4,a5,a6,a7,a8;
reg[14:0]c=15'b000000000000000;
reg[14:0]res=15'b000000000000000;
always@(temp,in1,in2,in3,in4,in5,in6,in7,in8,temp1,a1,a2,a3,a4,a5,a6,a7,
a8,res,c)
begin
a1<=temp-in1;
a2<=temp-in2;
a3<=temp-in3;
a4<=temp-in4;
a5<=temp-in5;
a6<=temp-in6;
a7<=temp-in7;
a8<=temp-in8;
c<=a1+a2+a3+a4+a5+a6+a7+a8;
res<=temp1-c;
SUM<=res[11:0];
CARRY<=res[14:12];
end
endmodule
5.2 Parallel Subtractor
THEORY:
For Example:
In1=”000000001111”
In2=”000000000001”
In3=”000000000001”
In4=”000000000001”
In5=”000000000010”
In6=”000000000010”
In7=”000000000010”
In8=”000000000010”
RES=”000000000100”
SIGN=”000”
CODING:
Default inputs are assign to all the inputs in1 to in8. If user needs to force new inputs, apply
in Simulation and verify the results.
module PSUB1(RES, SIGN);
output SIGN;
reg[14:0]RES;
reg SIGN;
reg[11:0]in1=12'b000000001111;
reg[11:0]in2=12'b000000000001;
reg[11:0]in3=12'b000000000001;
reg[11:0]in4=12'b000000000001;
reg[11:0]in5=12'b000000000010;
reg[11:0]in6=12'b000000000010;
reg[11:0]in7=12'b000000000010;
reg[11:0]in8=12'b000000000010;
// Temporary Signals.
reg[15:0]temp=16'b1000000000000000;
reg[16:0]temp1=17'b10000000000000000;
reg[14:0]STORE,P1;
reg[15:0]P2,RES1;
always@(temp,in1,in2,in3,in4,in5,in6,in7,in8,RES1,STORE,P1,P2)
begin
//Adding all 8 inputs except in1 and then take 2’s Complement data
STORE<=in2+in3+in4+in5+in6+in7+in8;
P1<=temp-STORE;
P2<=in1+P1;
if(P2[15]==1'b1)
begin
RES<=P2[14:0];
SIGN<=1'b0;
end
else
begin
RES1<=temp1-P2;
RES<=RES1[14:0];
SIGN<=1'b1;
end
end
endmodule
5.3 Serial Adder
THEORY:
For Example:
In1=”000000001111”
In2=”000000000001”
In3=”000000000001”
In4=”000000000001”
In5=”000000000010”
In6=”000000000010”
In7=”000000000010”
In8=”000000000010”
SUM=”000000011010”
CARRY=”000”
CODING:
reg[2:0]CARRY;
reg[11:0]in1=12'b000000001111;
reg[11:0]in2=12'b000000000001;
reg[11:0]in3=12'b000000000001;
reg[11:0]in4=12'b000000000001;
reg[11:0]in5=12'b000000000010;
reg[11:0]in6=12'b000000000010;
reg[11:0]in7=12'b000000000010;
reg[11:0]in8=12'b000000000010;
// Temporary Signals.
reg[12:0]a1,a2,a3,a4,a5,a6,a7,a8;
reg[12:0]temp=13'b1000000000000;
reg[15:0]temp1=16'b1000000000000000;
reg[11:0]car0=3'b000;
reg[14:0]c=15'b000000000000000;
reg[14:0]res=15'b000000000000000;
reg[3:0]bit0,bit1,bit2,bit3,bit4,bit5,bit6,bit7,bit8,bit9,bit10,
bit11,bit12;
always@(temp,in1,in2,in3,in4,in5,in6,in7,in8,a1,a1,a3,a4,a5,a6,a7,
a8,temp1,c,res,bit0,bit1,bit2,bit3,bit4,bit5,bit6,bit7,
begin
// Converting Input data into 2’s complement data
a1<=temp-in1;
a2<=temp-in2;
a3<=temp-in3;
a4<=temp-in4;
a5<=temp-in5;
a6<=temp-in6;
a7<=temp-in7;
a8<=temp-in8;
bit0<=a1[0]+a2[0]+a3[0]+a4[0]+a5[0]+a6[0]+a7[0]+a8[0];
bit1<=a1[1]+a2[1]+a3[1]+a4[1]+a5[1]+a6[1]+a7[1]+a8[1]+bit0[3:1];
bit2<=a1[2]+a2[2]+a3[2]+a4[2]+a5[2]+a6[2]+a7[2]+a8[2]+bit1[3:1];
bit3<=a1[3]+a2[3]+a3[3]+a4[3]+a5[3]+a6[3]+a7[3]+a8[3]+bit2[3:1];
bit4<=a1[4]+a2[4]+a3[4]+a4[4]+a5[4]+a6[4]+a7[4]+a8[4]+bit3[3:1];
bit5 <=a1[5]+a2[5]+a3[5]+a4[5]+a5[5]+a6[5]+a7[5]+a8[5]+bit4[3:1];
bit6<=a1[6]+a2[6]+a3[6]+a4[6]+a5[6]+a6[6]+a7[6]+a8[6]+bit5[3:1];
bit7<=a1[7]+a2[7]+a3[7]+a4[7]+a5[7]+a6[7]+a7[7]+a8[7]+bit6[3:1];
bit8<=a1[8]+a2[8]+a3[8]+a4[8]+a5[8]+a6[8]+a7[8]+a8[8]+bit7[3:1];
bit9<=a1[9]+a2[9]+a3[9]+a4[9]+a5[9]+a6[9]+a7[9]+a8[9]+bit8[3:1];
bit10<=a1[10]+a2[10]+a3[10]+a4[10]+a5[10]+a6[10]+a7[10]+a8[10]+
bit9[3:1]; bit11<=a1[11]+a2[11]+a3[11]+a4[11]+a5[11]+a6[11]+a7[11]+a8[11]+
bit10[3:1];
bit12<=a1[12]+a2[12]+a3[12]+a4[12]+a5[12]+a6[12]+a7[12]+a8[12]+
bit11[3:1];
// Converting carry and lower bits
c<={bit12,bit11[0],bit10[0],bit9[0],bit8[0],bit7[0],bit6[0],bit5[0],bit4[0],
bit3[0],bit2[0],bit1[0],bit0[0]};
res<=temp1-c;
SUM<=res[11:0];
CARRY<=res[14:12];
end
endmodule
5. 4 Serial Subtractor
THEORY:
For Example:
In1=”000000001111”
In2=”000000000001”
In3=”000000000001”
In4=”000000000001”
In5=”000000000010”
In6=”000000000010”
In7=”000000000010”
In8=”000000000010”
SUM=”000000011010”
CARRY=”000”
CODING:
Default inputs are assign to all the inputs in1 to in8. If user needs to force new inputs, apply
in Simulation and verify the results.
module ssub(res,sign);
output sign;
reg[14:0] res;
reg sign;
reg[11:0]in1 = 12'b000000001111;
reg[11:0]in2 = 12'b000000000001;
reg[11:0]in3 = 12'b000000000001;
reg[11:0]in4 = 12'b000000000001;
reg[11:0]in5 = 12'b000000000010;
reg[11:0]in6 = 12'b000000000010;
reg[11:0]in7 = 12'b000000000010;
reg[11:0]in8 = 12'b000000000010;
// Temporary Signals.
reg[15:0]temp=16'b1000000000000000;
reg[16:0]temp1=17'b10000000000000000;
reg[3:0]bit0,bit1,bit2,bit3,bit4,bit5,bit6,bit7,bit8,bit9,bit10,bit11;
reg[1:0]bits0,bits1,bits2,bits3,bits4,bits5,bits6,bits7,bits8,bits9,
bits10,bits11,bits12,bits13,bits14;
reg[15:0]c,res1;
reg[14:0]store,p1;
always@(in1,in2,in3,in4,in5,in6,in7,in8,c,temp,res1,store,bit0,bit1,bit2,bit3,
bit4,bit5,bit6,bit7,bit8,bit9,bit10,bit11,p1,bits0,bits1,bits2,bits3,bits4,bits5,bits6,bits
7,bits8,bits9,bits10,bits11,bits12,bits13,bits14)
begin
bit0<=in2[0]+in3[0]+in4[0]+in5[0]+in6[0]+in7[0]+in8[0];
bit1<=in2[1]+in3[1]+in4[1]+in5[1]+in6[1]+in7[1]+in8[1]+bit0[3:1];
bit2<=in2[2]+in3[2]+in4[2]+in5[2]+in6[2]+in7[2]+in8[2]+bit1[3:1];
bit3<=in2[3]+in3[3]+in4[3]+in5[3]+in6[3]+in7[3]+in8[3]+bit2[3:1];
bit4<=in2[4]+in3[4]+in4[4]+in5[4]+in6[4]+in7[4]+in8[4]+bit3[3:1];
bit5<=in2[5]+in3[5]+in4[5]+in5[5]+in6[5]+in7[5]+in8[5]+bit4[3:1];
bit6<=in2[6]+in3[6]+in4[6]+in5[6]+in6[6]+in7[6]+in8[6]+bit5[3:1];
bit7<=in2[7]+in3[7]+in4[7]+in5[7]+in6[7]+in7[7]+in8[7]+bit6[3:1];
bit8<=in2[8]+in3[8]+in4[8]+in5[8]+in6[8]+in7[8]+in8[8]+bit7[3:1];
bit9<=in2[9]+in3[9]+in4[9]+in5[9]+in6[9]+in7[9]+in8[9]+bit8[3:1];
bit10<=in2[10]+in3[10]+in4[10]+in5[10]+in6[10]+in7[10]+in8[10]+bit9[3:1];
bit11<=in2[11]+in3[11]+in4[11]+in5[11]+in6[11]+in7[11]+in8[11]+
bit10[3:1];
store<={bit11,bit10[0],bit9[0],bit8[0],bit7[0],bit6[0],bit5[0],bit4[0],bit3[0],
bit2[0],bit1[0],bit0[0]};
p1<=temp-store;
bits0<=in1[0]+p1[0];
bits1<=in1[1]+p1[1]+bits0[1];
bits2<=in1[2]+p1[2]+bits1[1];
bits3<=in1[3]+p1[3]+bits2[1];
bits4<=in1[4]+p1[4]+bits3[1];
bits5<=in1[5]+p1[5]+bits4[1];
bits6<=in1[6]+p1[6]+bits5[1];
bits7<=in1[7]+p1[7]+bits6[1];
bits8<=in1[8]+p1[8]+bits7[1];
bits9<=in1[9]+p1[9]+bits8[1];
bits10<=in1[10]+p1[10]+bits9[1];
bits11<=in1[11]+p1[11]+bits10[1];
bits12<=1'b0+p1[12]+bits11[1];
bits13<=1'b0+p1[13]+bits12[1];
bits14<=1'b0+p1[14]+bits13[1];
c<={bits14,bits13[0],bits12[0],bits11[0],bits10[0],bits9[0],bits8[0],bits7[0],
bits6[0],bits5[0],bits4[0],bits3[0],bits2[0],bits1[0],bits0[0]};
if(c[15]==1'b1)begin
sign<=1'b0;
res<=c[14:0];
end
else begin
sign<=1'b1;
res1<=temp1-c;
res<=res1[14:0];
end
end
endmodule
RESULT:
Thus the parallel and serial, adder and subtractor was designed and its
output was verified.
DESIGN OF TRAFFIC LIGHT CONTROLLER
AIM:
The Project aims at designing a Traffic Light Controller designed for Spartan II
FPGA target device.
DESCRIPTION:
Here in this project we attempt to control the traffic according to a predefined sequence,
which operates as follows:
• According to the flow chart the signaling scheme starts with North Side initially.
• In North Side the Green light glows for 20-3 seconds (this counter operation is
performed by Down Counter) at that time the remaining sides will be in Red.
• When the counter reaches 3,the Green light in North side turns off and Yellow turns
on for a period of 3 seconds (2-0).
• Then the sequence is shifted to South, East and west sides, where the same
operation as mentioned above are performed.
• For Display the counter values we are using Seven segment (Common Cathode)
Led’s.
ADVANTAGE:
No need for manpower to monitor traffic.
Efficiency in monitoring improves.
CODING:
input clk;
input rst;
reg n_g,n_y,n_r;
reg s_g,s_y,s_r;
reg e_g,e_y,e_r;
reg w_g,w_y,w_r;
reg [7:0]y1,y2;
wire [7:0]count_out;
integer j;
parameter
ng=4'b0000,ny=4'b0001,nrsg=4'b0010,sy=4'b0011,sreg=4'b0100,ey=4'b0101,erwg=4'b011
0,wy=4'b0111,wrng=4'b1000;
reg [3:0]ps,ns;
begin
if(rst==1'b0)
j <= 20;
else
begin
if(j !=0)
j <= j-1;
else
j <= 20;
end
end
begin
if(rst==1'b0)
ps <= ng;
else
ps <= ns;
end
always @(ps or j)
begin
case (ps)
ng:
begin
ns <= ng;
else
begin
if(j==3)
ns <= ny;
end
end
ny:
begin
ns <= ny;
else
begin
if(j==0)
ns<=nrsg;
end
end
nrsg:
begin
ns <= nrsg;
else
begin
if(j==3)
ns <= sy;
end
end
sy:
begin
ns <= sy;
else
begin
if(j==0)
ns<=sreg;
end
end
sreg:
begin
ns <= sreg;
else
begin
if(j==3)
ns <= ey;
end
end
ey:
begin
ns <= ey;
else
begin
if(j==0)
ns<=erwg;
end
end
erwg:
begin
if((j <= 20)&&(j>3)) //for east red and west green
ns <= erwg;
else
begin
if(j==3)
ns <= wy;
end
end
wy:
begin
ns <= wy;
else
begin
if(j==0)
end
end
endcase
end
//Output Decoder
always @(ps)
begin
case (ps)
ng:
begin
end
ny:
begin
end
nrsg:
begin
end
sy:
begin
end
sreg:
begin
end
ey:
begin
end
erwg:
begin
end
wy:
begin
end
endcase
end
always @(count_out)
begin
case(count_out)
8'b00000000: //00
begin
y1<=8'b01111110; //msb
y2<=8'b01111110; // lsb
//flag1=1'b0;
end
8'b00000001: //01
begin
y1<=8'b01111110;
y2<=8'b00110000;
end
8'b00000010: //02
begin
y1<=8'b01111110;
y2<=8'b01101101;
end
8'b00000011: //03
begin
y1 <= 8'b01111110;
y2 <= 8'b01111001;
end
8'b00000100: //04
begin
y1 <= 8'b01111110;
y2 <= 8'b00110011;
end
8'b00000101: //05
begin
y1 <= 8'b01111110;
y2 <= 8'b01011011;
end
8'b00000110: //06
begin
y1 <= 8'b01111110;
y2 <= 8'b01011111;
end
8'b00000111: //07
begin
y1 <= 8'b01111110;
y2 <= 8'b01110000;
end
8'b00001000: //08
begin
y1 <= 8'b01111110;
y2 <= 8'b01111111;
end
8'b00001001: //09
begin
y1 <= 8'b01111110;
y2 <= 8'b01111011;
end
8'b00001010: //10
begin
y1 <= 8'b00110000;
y2 <= 8'b01111110;
end
8'b00001011: //11
begin
y1<=8'b00110000;
y2<=8'b00110000;
end
8'b00001100: //12
begin
y1<=8'b00110000;
y2<=8'b01101101;
end
8'b00001101: // 13
begin
y1<=8'b00110000;
y2<=8'b01111001;
end
8'b00001110: //14
begin
y1<=8'b00110000;
y2<=8'b00110011;
end
8'b00001111: //15
begin
y1<=8'b00110000;
y2<=8'b01011011;
end
8'b00010000: //16
begin
y1<=8'b00110000;
y2<=8'b01011111;
end
8'b00010001: //17
begin
y1<=8'b00110000;
y2<=8'b01110000;
end
8'b00010010: //18
begin
y1<=8'b00110000;
y2<=8'b01111111;
end
8'b00010011: //19
begin
y1<=8'b00110000;
y2<=8'b01111011;
end
8'b00010100: //20
begin
y1<=8'b01101101;
y2<=8'b01111110;
end
endcase
end
endmodule
b)CLOCK DIVIDER
//Clock Divider Is used to reduce the clock frequency which is generated by Crystal
Oscillator present in the FPGA Board
output clockoutput ;
input clock;
input rst;
reg div_2097152;//2^21
if (!rst)
else
if (!rst)
else
if (!rst)
else
if (!rst)
if (!rst)
else
if (!rst)
else
if (!rst)
else
if (!rst)
else
if (!rst)
else
div_512 <= ~ div_512;
if (!rst)
else
if (!rst)
else
if (!rst)
else
if (!rst)
else
if (!rst)
div_16384 <= 1'b0;
else
if (!rst)
else
if (!rst)
else
if (!rst)
else
div_131072<= ~ div_131072;
if (!rst)
else
div_262144<= ~ div_262144;
else
div_524288<= ~ div_524288;
if (!rst)
else
div_1048576<= ~ div_1048576;
if (!rst)
div_2097152<= 1'b0;
else
div_2097152<= ~ div_2097152;
if (!rst)
else
div_4194304<= ~ div_4194304;
endmodule
c)TOP LEVEL
//Combining Both Clock Divider and Traffic Light Controller Design in the Same Module
e_y,e_r,w_g,w_y,w_r, clk1,rst1);
output [7:0]led1,led2;
output n_g,n_y,n_r;
output s_g,s_y,s_r;
output e_g,e_y,e_r;
output w_g,w_y,w_r;
input clk1;
input rst1;
wire sys_clk;
traffic t1(.y1(led1),.y2(led2),.n_g(n_g),.n_y(n_y),.n_r(n_r),.s_g(s_g),
.s_y(s_y),.s_r(s_r),.e_g(e_g),.e_y(e_y),.e_r(e_r),.w_g(w_g),
.w_y(w_y),.w_r(w_r),.clk(sys_clk),.rst(rst1));
endmodule
RESULT:
The FPGA based Design Flow is extensively used in today’s world due to its following
advantages – short design time, easy to market etc. FPGA based Design Flow allows one to
implement his/her VLSI design in a very short duration, cater to customer needs and make
last minute changes.
1. Design Entry
2. Synthesis
3. Simulation
4. Implementation
5. Programming
2. Synthesis
Synthesis is the process, which converts HDL CODE into Gate level circuit in the
form of NET LIST. This process is Target Technology dependent hence user must
select proper Device, Family, Part Number and Speed Grade. Also user may select
Synthesis Settings like Clock Frequency, Optimization for Speed or Area.
3. Simulation
Simulation, user can verify the functionality of his design by applying various
input signal combination and observing the output results. The simulation is
performed on gate level Netlist.
4. Implementation
Implementation is the process in which the design is passed through various stages
by TRANSLATE, MAPPING, TIME ANALYSIS and BIT STREAM. For locking
input and output signal to particular pins of the device, user must write UCF (User
Constraint File) before implementation and guide the same file to implementation
tool through the option set control files. Output of implementation is .bit file which
has to be converted into PROM file i.e .HEX file.
5. Programming
This is the process by which user can physically download the architecture from
computer to target device using programming cable. Use FPGA/CPLD
Development Platform to Download the Data to the FPGA trainer. Use only the
cable, which is supplied along with the kit.
This Chapter of the manual is on Hardware and Software requirement specifications to get
started with the FPGA trainer Kit.
4 x 3 Keypad
Power Supply
2. Accessories
Programming Cable
Power Cord
Monitor : Colour
FEATURES
POWER SUPPLY
The FPGA trainer has on board power supply with the following specifications :-
Input : ~ 230 V , 50 Hz
Serial Communication
Port
Power on LED
External 32KB Memory
Programming Port
15 MHz Onboard
Reset Button
PROGRAMMING CABLE
For downloading the design from PC, a 9 pin D Type connector (P2) is provided on board.
The trainer kit can be connected to PC's serial port with the supplied cable having 9 pin D
Type connector on both sides.
LEDs
16 x 2 LCD Display
DIP SWITCHES
Two 8 – way DIP switches are provided for the user to give the digital inputs to the FPGA.
IN1 to IN8 represent single 8 – way DIP switch and IN9 to IN16 represents another 8 – way
DIP switch. Logic Levels applied to the FPGA can be seen on the LEDs as given below.
The DIP switch S1 is provided to enable the clock to the FPGA. At most the Oscillator X2
can supply clock to 2 FPGA Clock Pins.
PRECAUTIONS
Verify the POWER ON LED status after applying power to the trainer kit.
Connect the 9 pin D connector to the trainer kit. Use the Programming cable
supplied with the kit.
Before implementation, it is necessary to lock the pins in the user constraint file
(UCF) as per the trainer kit hardware.
While generating the PROM file Disable the Swap bit option.
For downloading the .hex file use the Sands FPGA/CPLD Development Platform
software provided with our trainer kit.
Do not touch any device while in power on or power off condition.
No user serviceable parts are provided with the trainer kit.
PIN ASSIGNMENT - HEADER / JUMPER SETTINGS
HEADER
OUTPUTS
Details of Keypad
Details of S1
INTRODUCTION
Our windows based software is used to configure the FPGA trainer kit. This is also
used to program any digital circuits in the FPGA, which is built using the HDL’s
(Hardware Description Language) such as VHDL (Very High Speed Integrated
Circuits Hardware Description Language) and/or Verilog. Our software configures
the FPGA device and checks only the functionality of the same. Supports
microcontroller interface and an FPGA serial communication. This avoids costly
downloading cables and software. The GUI is user friendly and aimed to avoid
overheads.
MENU DETAILS
1. File
2. Edit
3. View
4. Operations
5. Functions
6. Output
7. Window
8. Help
The below figure shows the main window
The Serial port communication is established by choosing the cable auto connect
submenu in the output menu.
The cable auto connect automatically searches for the target device if the device is
available it will allow you to program it.
RESULT:
AIM:
To Write a Verilog Code to test on board Led’s and Input DIP Switches in FPGA board.
HARDWARE REQUIREMENTS
• SPARTAN II Kit
• RS232 Serial Cable
• Power Cord
PROGRAM
//Program To Check On-Board LED's and Input DIP Switches Using Verilog Code
//Port Declarations
ip10,ip11,ip12,ip13,ip14,ip15,ip16);
output op1,op2,op3,op4,op5,op6,op7,op8,op9;
output op10,op11,op12,op13,op14,op15,op16;
input ip1,ip2,ip3,ip4,ip5,ip6,ip7,ip8,ip9;
input ip10,ip11,ip12,ip13,ip14,ip15,ip16;
endmodule
EXECUTION
a) Write the above Verilog code first in the simulation tool (ISE Simulation) as per the
steps in study of simulation process.
b) Synthesize the above code using the Synthesis tool (Xilinx Project Navigator) and
generate the .Hex File as per the steps discussed in the Study of synthesis.
c) Connect the 3-pin power cord and the communication cable to the Spartan II board and
switch ON the power supply.
d) Generate bit file and download that file into FPGA board.
EXPECTED RESULT
Inputs IN1 IN2 IN3 IN4 IN5 IN6 IN7 IN8 IN9 IN10 IN11 IN12 IN13 IN14 IN15 1N16
Identificatio OF OF
n ON ON F ON F ON OFF OFF ON ON ON OFF ON ON OFF ON
OP OP OP OP OP OP1 OP1 OP1 OP1
Outputs OP1 2 3 4 5 6 OP7 OP8 OP9 0 1 2 3 OP14 OP15 OP16
Identificatio OF OF
n ON ON F ON F ON OFF OFF ON ON ON OFF ON ON OFF ON
RESULT:
Thus the coding for checking the on board Led’s and Input DIP
SPARTAN II Kit.
AIM:
The Project aims in testing the Traffic Light Controller design for Spartan II FPGA
target device using expansion card provided. The required algorithm was implemented in
the FPGA and the computations are done according to the requirements.
EXECUTION:
a) Connect the 3-pin power cord and the communication cable to the Spartan II board and
switch ON the power supply.
b) Connect the Traffic Light Add-On Card to the 40 pin External berg present in the
FPGA trainer kit through FRC.
c) Go to the FPGA/CPLD Platform and initialize the serial port settings and download the
Hex file of Traffic Light Controller generated using Synthesis tool to the FPGA as per the
steps discussed in the study of FPGA process EXERCISE 7.1.
d) Check whether the DONE Led of the Spartan II board glows high if not again redo the
downloading procedure.
e) After checking the DONE Led give the clock input (S1-1) to high.
g) Verify the Automated Control of Traffic Light on the expansion card as per the
description given in EXERCISE 6.
*Note: Please refer below for Pin Assignments of Expansion Card with Spartan II FPGA.
PIN ASSIGNMENTS:
clk1 = "p77" ;
e_g = "p194" ;
e_r = "p201" ;
e_y = "p199" ;
led1<0 = "p180" ;
led1<1 = "p179" ;
led1<2> = "p178" ;
led1<3> = "p176" ;
led1<4> = "p175" ;
led1<5> = "p174" ;
led1<6> = "p173" ;
led1<7>= "p181" ;
led2<0>= "p168" ;
led2<1> = "p167" ;
led2<2> = "p166" ;
led2<3> = "p165" ;
led2<4> = "p164" ;
led2<5> LOC = "p163" ;
led2<6> LOC = "p162" ;
led2<7> LOC = "p172" ;
n_g = "p187" ;
n_r = "p192" ;
n_y = "p189" ;
rst1 = "p60" ;
s_g = "p188" ;
s_r = "p193" ;
s_y = "p191" ;
w_g = "p195" ;
w_r = "p202" ;
w_y = "p200" ;
Note: The Variable names are the one used in the coding section.
RESULT:
Thus we have designed and verified the Traffic Light Controller design with the help of
EDA tools, Add On Cards and SANDS Spartan II FPGA board.
AIM:
The Project aims at designing a Real Time Clock and to display Minutes and
Seconds based on 15MHz quartz crystal designed for Spartan II FPGA target device and
tested the output using Interface card provided.
SOFTWARE AND HARDWARE REQUIREMENTS:
DESCRIPTION:
f2<=1'b1;
end
end
end
module sevmin112(y1,y2,ip);
output [7:0]y1,y2;
input [7:0]ip;
reg [7:0]y1,y2;
always@(ip)
begin
case(ip)
8'b00000000: //00
begin
y1<=8'b01111110; //msb
y2<=8'b01111110; // lsb
//flag1=1'b0;
end
8'b00000001: //01
begin
y1<=8'b01111110;
y2<=8'b00110000;
end
8'b00000010: //02
begin
y1<=8'b01111110;
y2<=8'b01101101;
end
8'b00000011: //03
begin
y1 <= 8'b01111110;
y2 <= 8'b01111001;
end
8'b00000100: //04
begin
y1 <= 8'b01111110;
y2 <= 8'b00110011;
end
8'b00000101: //05
begin
y1 <= 8'b01111110;
y2 <= 8'b01011011;
end
8'b00000110: //06
begin
y1 <= 8'b01111110;
y2 <= 8'b01011111;
end
8'b00000111: //08
begin
y1 <= 8'b01111110;
y2 <= 8'b01110000;
end
8'b00001000: //08
begin
y1 <= 8'b01111110;
y2 <= 8'b01111111;
end
8'b00001001: //09
begin
y1 <= 8'b01111110;
y2 <= 8'b01111011;
end
8'b00001010: //10
begin
y1 <= 8'b00110000;
y2 <= 8'b01111110;
end
8'b00001011: //11
begin
y1<=8'b00110000;
y2<=8'b00110000;
end
8'b00001100: //12
begin
y1<=8'b00110000;
y2<=8'b01101101;
end
8'b00001101: // 13
begin
y1<=8'b00110000;
y2<=8'b01111001;
end
8'b00001110: //14
begin
y1<=8'b00110000;
y2<=8'b00110011;
end
8'b00001111: //15
begin
y1<=8'b00110000;
y2<=8'b01011011;
end
8'b00010000: //16
begin
y1<=8'b00110000;
y2<=8'b01011111;
end
8'b00010001: //18
begin
y1<=8'b00110000;
y2<=8'b01110000;
end
8'b00010010: //18
begin
y1<=8'b00110000;
y2<=8'b01111111;
end
8'b00010011: //19
begin
y1<=8'b00110000;
y2<=8'b01111011;
end
8'b00010100: //20
begin
y1<=8'b01101101;
y2<=8'b01111110;
end
8'b00010101: //21
begin
y1<=8'b01101101;
y2<=8'b00110000;
end
8'b00010110: //22
begin
y1<=8'b01101101;
y2<=8'b01101101;
end
8'b00010111: //23
begin
y1<=8'b01101101;
y2<=8'b01111001;
end
8'b00011000: //24
begin
y1<=8'b01101101;
y2<=8'b00110011;
end
8'b00011001: //25
begin
y1<=8'b01101101;
y2<=8'b01011011;
end
8'b00011010: //26
begin
y1<=8'b01101101;
y2<=8'b01011111;
end
8'b00011011: //28
begin
y1<=8'b01101101;
y2<=8'b01110000;
end
8'b00011100: //28
begin
y1<=8'b01101101;
y2<=8'b01111111;
end
8'b00011101: //29
begin
y1<=8'b01101101;
y2<=8'b01111011;
end
8'b00011110: //30
begin
y1<=8'b01111001;
y2<=8'b01111110;
end
8'b00011111: //31
begin
y1<=8'b01111001;
y2<=8'b00110000;
end
8'b00100000: //32
begin
y1<=8'b01111001;
y2<=8'b01101101;
end
8'b00100001: //33
begin
y1<=8'b01111001;
y2<=8'b01111001;
end
8'b00100010: //34
begin
y1<=8'b01111001;
y2<=8'b00110011;
end
8'b00100011: //35
begin
y1<=8'b01111001;
y2<=8'b01011011;
end
8'b00100100: //36
begin
y1<=8'b01111001;
y2<=8'b01011111;
end
8'b00100101: //38
begin
y1<=8'b01111001;
y2<=8'b01110000;
end
8'b00100110: //38
begin
y1<=8'b01111001;
y2<=8'b01111111;
end
8'b00100111: //39
begin
y1<=8'b01111001;
y2<=8'b01111011;
end
8'b00101000: //40
begin
y1<=8'b00110011;
y2<=8'b01111110;
end
8'b00101001: //41
begin
y1<=8'b00110011;
y2<=8'b00110000;
end
8'b00101010: //42
begin
y1<=8'b00110011;
y2<=8'b01101101;
end
8'b00101011: //43
begin
y1<=8'b00110011;
y2<=8'b01111001;
end
8'b00101100: //44
begin
y1<=8'b00110011;
y2<=8'b00110011;
end
8'b00101101: //45
begin
y1<=8'b00110011;
y2<=8'b01011011;
end
8'b00101110: //46
begin
y1<=8'b00110011;
y2<=8'b01011111;
end
8'b00101111: //48
begin
y1<=8'b00110011;
y2<=8'b01110000;
end
8'b00110000: //48
begin
y1<=8'b00110011;
y2<=8'b01111111;
end
8'b00110001: //49
begin
y1<=8'b00110011;
y2<=8'b01111011;
end
8'b00110010: //50
begin
y1<=8'b01011011;
y2<=8'b01111110;
end
8'b00110011: //51
begin
y1<=8'b01011011;
y2<=8'b00110000;
end
8'b00110100: //52
begin
y1<=8'b01011011;
y2<=8'b01101101;
end
8'b00110101: //53
begin
y1<=8'b01011011;
y2<=8'b01111001;
end
8'b00110110: //54
begin
y1<=8'b01011011;
y2<=8'b00110011;
end
8'b00110111: //55
begin
y1<=8'b01011011;
y2<=8'b01011011;
end
8'b00111000: //56
begin
y1<=8'b01011011;
y2<=8'b01011111;
end
8'b00111001: //58
begin
y1<=8'b01011011;
y2<=8'b01110000;
end
8'b00111010: //58
begin
y1<=8'b01011011;
y2<=8'b01111111;
end
8'b00111011: //59
begin
y1<=8'b01011011;
y2<=8'b01111011;
//flag1<=1'b1;
end
default:
begin
y1<= 8'b01111110;
y2<= 8'b01111110;
end
endcase
end
endmodule
module sevhrs113(y1,y2,ip);
output [7:0]y1,y2;
input [7:0]ip;
reg [7:0]y1,y2;
always@(ip)
begin
case(ip)
8'b00000000: //00
begin
y1<=8'b01111110; //msb
y2<=8'b01111110; // lsb
//flag1=1'b0;
end
8'b00000001: //01
begin
y1<=8'b01111110;
y2<=8'b00110000;
end
8'b00000010: //02
begin
y1<=8'b01111110;
y2<=8'b01101101;
end
8'b00000011: //03
begin
y1 <= 8'b01111110;
y2 <= 8'b01111001;
end
8'b00000100: //04
begin
y1 <= 8'b01111110;
y2 <= 8'b00110011;
end
8'b00000101: //05
begin
y1 <= 8'b01111110;
y2 <= 8'b01011011;
end
8'b00000110: //06
begin
y1 <= 8'b01111110;
y2 <= 8'b01011111;
end
8'b00000111: //08
begin
y1 <= 8'b01111110;
y2 <= 8'b01110000;
end
8'b00001000: //08
begin
y1 <= 8'b01111110;
y2 <= 8'b01111111;
end
8'b00001001: //09
begin
y1 <= 8'b01111110;
y2 <= 8'b01111011;
end
8'b00001010: //10
begin
y1 <= 8'b00110000;
y2 <= 8'b01111110;
end
8'b00001011: //11
begin
y1<=8'b00110000;
y2<=8'b00110000;
end
8'b00001100: //12
begin
y1<=8'b00110000;
y2<=8'b01101101;
end
8'b00001101: // 13
begin
y1<=8'b00110000;
y2<=8'b01111001;
end
8'b00001110: //14
begin
y1<=8'b00110000;
y2<=8'b00110011;
end
8'b00001111: //15
begin
y1<=8'b00110000;
y2<=8'b01011011;
end
8'b00010000: //16
begin
y1<=8'b00110000;
y2<=8'b01011111;
end
8'b00010001: //18
begin
y1<=8'b00110000;
y2<=8'b01110000;
end
8'b00010010: //18
begin
y1<=8'b00110000;
y2<=8'b01111111;
end
8'b00010011: //19
begin
y1<=8'b00110000;
y2<=8'b01111011;
end
8'b00010100: //20
begin
y1<=8'b01101101;
y2<=8'b01111110;
end
8'b00010101: //21
begin
y1<=8'b01101101;
y2<=8'b00110000;
end
8'b00010110: //22
begin
y1<=8'b01101101;
y2<=8'b01101101;
end
8'b00010111: //23
begin
y1<=8'b01101101;
y2<=8'b01111001;
end
default:
begin
y1<= 8'b01111110;
y2<= 8'b01111110;
end
endcase
end
endmodule
module toprtc114(clk1,rst,minlsb,minmsb,hrslsb,hrsmsb);
input clk1;
input rst;
output [7:0]minlsb;
output [7:0]minmsb;
output [7:0]hrslsb;
output [7:0]hrsmsb;
wire [7:0]m1,m2;
wire [7:0]h1,h2;
wire [7:0]s2;
wire [7:0]s3;
wire [7:0]s4;
assign minlsb[7:0]=m2;
assign minmsb[7:0]=m1;
assign hrslsb[7:0]=h2;
assign hrsmsb[7:0]=h1;
rtc_controller one
(.start(clk1),.rst(rst),.minutes(s2),.hours(s3));//,.date(s4).flag2(f1));
sevhrs113 two(.y1(h1),.y2(h2),.ip(s3));
sevmin112 three(.y1(m1),.y2(m2),.ip(s2));
endmodule
module led_roll_117
(hrsmsb,hrslsb,minmsb,minlsb,clk,rst,dataout,en_tran1,en_tran2,en_tran3,en_tran4,clkout);
output clkout;
output [7:0]dataout;
output en_tran1;
output en_tran2;
output en_tran3;
output en_tran4;
input clk;
input rst;
input [7:0]hrsmsb;
input [7:0]hrslsb;
input [7:0]minmsb;
input [7:0]minlsb;
reg [7:0]dataout;
wire clkout;
reg en_tran1;
reg en_tran2;
reg en_tran3;
reg en_tran4;
reg [2:0]ps,ns;
assign clkout=clk;
always@(rst,ps,hrsmsb,hrslsb,minmsb,minlsb)
begin
case(ps)
reset: begin
dataout<=8'b00000000;
en_tran1<=1'b0;
en_tran2<=1'b0;
en_tran3<=1'b0;
en_tran4<=1'b0;
if(rst==1'b0)
ns<=reset;
else
ns<=led1;
end
led1: begin
dataout<=minlsb;
en_tran1<=1'b1;
en_tran2<=1'b0;
en_tran3<=1'b0;
en_tran4<=1'b0;
if(rst==1'b0)
ns<=reset;
else
ns<=led2;
end
led2: begin
dataout<=minmsb;
en_tran1<=1'b0;
en_tran2<=1'b1;
en_tran3<=1'b0;
en_tran4<=1'b0;
if(rst==1'b0)
ns<=reset;
else
ns<=led3;
end
led3: begin
dataout<=hrslsb;
en_tran1<=1'b0;
en_tran2<=1'b0;
en_tran3<=1'b1;
en_tran4<=1'b0;
if(rst==1'b0)
ns<=reset;
else
ns<=led4;
end
led4: begin
dataout<=hrsmsb;
en_tran1<=1'b0;
en_tran2<=1'b0;
en_tran3<=1'b0;
en_tran4<=1'b1;
if(rst==1'b0)
ns<=reset;
else
ns<=led1;
end
endcase
end
endmodule
F) TOP MODULE
output [7:0]dataout;
output en_tran1;
output en_tran2;
output en_tran3;
output en_tran4;
output clkout;
input clk;
input rst;
wire en_tran1;
wire en_tran2;
wire en_tran3;
wire en_tran4;
wire e1,e2,e3,e4;
wire u1,u4,u5,u6;
wire [7:0]m1,m2;
wire [7:0]h1,h2;
wire [7:0]u2; // mux to led roll
wire [1:0]u3;
led_roll_117
q1(.hrsmsb(h1),.hrslsb(h2),.minmsb(m1),.minlsb(m2),.clk(u4),.rst(rst),.dataout(dataout),.en
_tran1(e1),.en_tran2(e2),.en_tran3(e3),.en_tran4(e4),.clkout(clkout));
toprtc114 q4(.clk1(u1),.rst(rst),.minlsb(m2),.minmsb(m1),.hrslsb(h2),.hrsmsb(h1));
rtclkd_115 q5(.co1hz(u1),.sck(u5),.rst(rst));
rtclkd_2 q6(.co10khz(u4),.sck(u5),.rst(rst));
endmodule
module rtclkd_115(co1hz,sck,rst);
output co1hz;
input sck,rst;
wire co1hz;
reg f1,f2,f3;
integer n,p,r;
assign co1hz=f3;
p<=0;
end
else
begin
if(p<=500)
begin
p<=p+1;
f2<=1'b0;
end
else
begin
if(p>500 && p<=1000)
begin
f2<=1'b1;
p<=p+1;
end
else
begin
f2<=1'b0;
p<=0;
end
end
end
end
end
endmodule
module rtclkd_2(co10khz,sck,rst);
output co10khz;
input sck,rst;
wire co10khz;
reg f1,f2,f3;
integer n,p,r;
assign co10khz=f1;
endmodule
EXECUTION
a) Connect the 3-pin power cord and the communication cable to the Spartan II board and
switch ON the power supply.
b) Connect the RTC Add-On Card to the 40 pin External berg present in the FPGA trainer
kit through FRC.
c) Go to the FPGA/CPLD Platform and initialize the serial port settings and download the
Hex file of Real time clock generated using Synthesis tool to the FPGA .
d) Check whether the DONE Led of the Spartan II board glows high if not again redo the
downloading procedure.
e) After checking the DONE Led give the clock input (S1-1) to high.
g) Verify the seconds and minutes on the Real Time Clock expansion card .
*Note: Please refer next page for Pin Assignments of Expansion Card with Spartan II
FPGA
PIN ASSIGNMENTS
"clk" LOC = "p77"
Note: The Variable names are the one used in the coding section.
RESULT:
Thus we have designed and verified the Real Time Clock design with
the help of EDA tools, Add on Cards and Spartan II FPGA board.
AIM:
DESCRIPTION:
Signed multiplier
– The signed multiplier is a construction of shifter and adder structures. Since it is simply
composed of n bit adders that are connected in series.
– The below block diagram of an 8 bit pipelined multiplier. This circuit produces the
product of two 8 bit numbers after a delay of several clock ticks. The use of registers
between the ranks of adders makes it possible to input a new multiplier and multiplicand on
every clock tick and get a product on every clock tick. This kind of pipelined operation is
commonly used in high performance systems.
PROGRAM:
OUTPUT:
RESULT:
Thus the 8-bit signed multiplier was designed and its output was verified.