Professional Documents
Culture Documents
-Nitin Anand
The Spartan-II family of FPGAs have a regular, flexible, programmable
architecture of Configurable Logic Blocks (CLBs), surrounded by a perimeter of
programmable Input/output Blocks (IOBs). There are four Delay-Locked Loops
(DLLs), one at each corner of the die. Two columns of block RAM lie on opposite
sides of the die, between the CLBs and the IOB columns. These functional
elements are interconnected by a powerful hierarchy of versatile routing
channels.
SPECIFICATION: Specifications
In XC9572-PC84, the macro cells which corresponds to the input/output pins are
69 macro cells in the 72 macro cells. In case of XC95108-PC84, they are 69
macro cells in the 108 macro cells. The macro cells which don't correspond to the
input/output pins can be used only in the logic circuits inside.
Features
Temperature range
Enhanced pin-locking architecture
Flexible 36V18 Function Block
- 90 product terms drive any or all of 18 macro cells
Within Function Block
- Global and product term clocks, output enables,
Set and reset signals
Extensive IEEE Std 1149.1 boundary-scan (JTAG)
support
Programmable power reduction mode in each
Macro cell
Slew rate control on individual outputs
User programmable ground pin capability
Extended pattern security features for design
protection
High-drive 24 mA outputs
3.3V or 5V I/O capability
Advanced CMOS 5V Fast FLASH technology
Supports parallel programming of more than one
XC9500 concurrently
Available in 44-pin PLCC, 84-pin PLCC, 100-pin PQFP,
and 100-pin TQFP packages
UNIVERSAL BOARD:This is a unique board that accepts any PLD device of any make or package.This
striking feature has been introduced by MILMAN to cater to the needs of design
engineers.
SPECIFICATION:
PIN ASSIGNMENT:
SPARTAN 3E
1. Design the circuit that you would like to map to the Xilinx part on the FPGA.
You can use schematics, or Verilog, or a mixture of both.
2. Simulate your circuit using the ISE Simulator and a Verilog testbench to
provide inputs to the circuit. Use if statements in your testbench to make it selfchecking.
3. Generate a UCF file to hold constraints such as pin assignments (later well use
the UCF file for other constraints like timing and speed). Use the PlanAhead tool
to generate this file.
4. Assign the I/O pins in your design to the pins on the FPGA that you want them
connected to.
5. Synthesize the design for the FPGA using the XST synthesis tool.
6. Implement the design to map it to the specific FPGA on the Spartan-3E board
7. Generate the programming .bit file that has the bitstream that configures the
FPGA.
8. Connect your Spartan3 board to the computer and use the iMPACT tool to
program the FPGA using the bit stream.
ON BOARD FEATURES
Intel Corporation for the 128 Mbit Strata Flash memories.
Linear Technology for the SPI-compatible A/D and D/A converters, the
programmable pre-amplifier, and the power regulators for the non-FPGA
components
Micron Technology, Inc. for the 32M x 16 DDR SDRAM
SMSC for the 10/100 Ethernet PHY
STMicroelectronics for the 16M x 1 SPI serial Flash PROM
Texas Instruments Incorporated for the three-rail TPS75003 regulator supplying
most of the FPGA supply voltages
Xilinx, Inc. Configuration Solutions Division for the XCF04S Platform Flash
PROM and their support for the embedded USB programmer
Xilinx, Inc. CPLD Division for the XC2C64A CoolRunner-II CPLD
Xilinx Spartan-3E has in-built clock of 50 MHz frequency.
Experiment 1
Aim- Design of a 4 bit counter using Verilog in Xilinx 8.1 platform and
implement it in SPARTAN II kit.
Theory-
Procedure:
1. Click on this icon. For Starting a new project
9. Click Next.
12. Write the Verilog code for the counter in the window
shown below.
Note: You may be asked to save the VHDL file, and your
design will be checked for syntax errors (these will need to
be fixed before you can proceed).
14. We want to create a UCF file, so click yes.
16. Enter the pin names for each signal in the Design Object
List at the left as shown here. Click File > Save.
17. This dialog may appear when saving the file select XST
Default :<>
Code:
Experiment-2
Aim- To design a 1 bit full adder in Xilinx 8.1 and implement it on
SPARTAN 2 kit.
Theory-
Code:
`timescale 1ns / 1ps
module FA1(a, b, cin, cout, sum);
input a;
input b;
input cin;
output cout;
output sum;
assign sum = a ^ b ^ cin;
assign cout = (a & b) | (b & cin) | (cin & a);
endmodule
Experiment-3
Aim- To display last 4 digit of your roll number in 7 segment display of
Code:
module AminSevenSeg(input clk, output reg [7:0]out, output reg [3:0] enable);
reg [15:0]temp=16'b0000000000000000;
always @ (posedge clk )
begin
temp=temp+1;
end
always@ *
case(temp[15:14])
2'b00: begin
enable = 4'b1110;// active low enable biases PNP to make it ON (i.e., DIS-0)
out= 8'b11101101; // data for 5
end
2'b01: begin
enable = 4'b1101; // active low enable biases PNP to make it ON (i.e., DIS-1)
out= 8'b11111101; // data for 6
end
2'b10: begin
enable = 4'b1011;// active low enable biases PNP to make it ON (i.e., DIS-2)
out= 8'b11101111;// data for 9
end
default:
begin
enable = 4'b0111;// active low enable biases PNP to make it ON (i.e., DIS-3)
out= 8'b11111111;// data for 8
end
endcase
endmodule
Experiment-4
Aim- To display and blink last 4 digit of your roll number in 7 segment
Code:
`timescale 1ns / 1ps
module blink(input clk, output reg [7:0]out, output reg [3:0] enable);
reg [15:0]temp=16'b0000000000000000;
reg [20:0]delay=21'b000000000000000000000;
always @ (posedge clk )
begin
temp=temp+1;
delay=delay+1;
end
always@ *
begin
case(temp[15:14])
2'b00: begin
enable = 4'b1110;// active low enable biases PNP to make it ON (i.e., DIS-0)
out= 8'b11101101; // data for 5
end
2'b01: begin
enable = 4'b1101; // active low enable biases PNP to make it ON (i.e., DIS-1)
out= 8'b11111101; // data for 6
end
2'b10: begin
enable = 4'b1011;// active low enable biases PNP to make it ON (i.e., DIS-2)
out= 8'b11101111;// data for 9
end
default:
begin
enable = 4'b0111;// active low enable biases PNP to make it ON (i.e., DIS-3)
out= 8'b11111111;// data for 8
end
endcase
end
endmodule
Experiment-5
Aim- To display and rotate HELP in 7 segment display of SPARTAN 2 kit
Code:
`timescale 1ns / 1ps
module rotation(input clk, output reg [7:0]out, output reg [3:0] enable );
reg [15:0]temp=16'b0000000000000000;
reg [20:0]delay=21'b000000000000000000000;
reg [3:0]param[3:0];
reg [3:0]next;
initial
begin
param[0]=4'b1110;
param[1]=4'b1101;
param[2]=4'b1011;
param[3]=4'b0111;
end
always @ (posedge clk )
begin
temp=temp+1;
delay=delay+1;
if(delay==21'b111111111111111111111 )
begin
next=param[0];
param[0]=param[1];
param[1]=param[2];
param[2]=param[3];
param[3]=next;
end
else
case(temp[15:14])
2'b00: begin
enable = param[0];// active low enable biases PNP to make it ON (i.e., DIS-0)
out= 8'b01110011; // data for 5
end
2'b01: begin
enable = param[1]; // active low enable biases PNP to make it ON (i.e., DIS1)
out= 8'b00111000; // data for 6
end
2'b10: begin
enable = param[2];// active low enable biases PNP to make it ON (i.e., DIS-2)
out= 8'b01111001;// data for 9
end
default:
begin
enable = param[3];// active low enable biases PNP to make it ON (i.e., DIS-3)
out= 8'b01110110;// data for 8
end
endcase
end
endmodule
Experiment-6
Aim- Design a 4 bit Johnson counter and implement it on SPARTAN 3E
kit.
A Johnson counter is a modified ring counter, where the inverted output
from the last flip flop is connected to the input to the first. The register cycles
through a sequence of bit-patterns. The MOD of the Johnson counter is 2n if n
flip-flops are used. The main advantage of the Johnson counter counter is that it
only needs half the number of flip-flops compared to the standard ring counter
for the same MOD.
Theory-
Clk
1
2
3
4
5
6
7
8
9
Q0
0
1
1
1
1
0
0
0
0
Q1
0
0
1
1
1
1
0
0
0
Q2
0
0
0
1
1
1
1
0
0
Q3
0
0
0
0
1
1
1
1
0
Code:
`timescale 1ns / 1ps
module AminJohnson (input direction, rst, clk_in, output reg [3:0] count);
if(!rst)
begin
if(direction)
begin
count[3:1] <= count[2:0];
count[0]<=!count[3];
end
else
begin
end
end
else
count[3:0] <= 4'b0000;
end
endmodule
Experiment - 7
Aim- Design of a 4 bit LFSR (Linear feedback shift resistor) using Verilog
and implement it in SPARTAN 3E kit.
Theory:
LFSR:
In computing, a linear-feedback shift register (LFSR) is a shift
register whose input bit is a linear function of its previous state.
The most commonly used linear function of single bits is exclusiveor (XOR). Thus, an LFSR is most often a shift register whose input bit is
driven by the XOR of some bits of the overall shift register value.
The initial value of the LFSR is called the seed, and because the
operation of the register is deterministic, the stream of values
produced by the register is completely determined by its current (or
previous) state. Likewise, because the register has a finite number of
possible states, it must eventually enter a repeating cycle. However, an
LFSR with a well-chosen feedback function can produce a sequence of
bits which appears random and which has a very long cycle.
Applications
of
LFSRs
include
generating pseudo-random
numbers, pseudo-noise sequences, fast digital counters, and whitening
sequences. Both hardware and software implementations of LFSRs are
common.
Code:
`timescale 1ns / 1ps
module lfsr(input clk, rst, en, input[3:0]load, output reg [3:0] out);
FreqDiv instance_name(.clk_out(clk_out),.clk_in(clk));
wire feedback;
assign feedback=(out[2]^out[3]);
always @(posedge clk_out)
begin
if(rst)
out=4'b1111;
else if(en)
out[3:0]=load[3:0];
else
out={out[2:0],feedback}; // OUT[3] <= feedback
end
endmodule
begin
clk_out=1'b0;
count=0;
end
always @(posedge clk_in)
if (count==44999999)
begin
count<=0;
clk_out<=~clk_out;
end
else
count<=count+1;
endmodule
Experiment - 8
Aim - Display your name in 16*2 LCD using Verilog in SPARTAN 3E kit.
Theory:
LCD
The Spartan-3A/3AN Starter Kit board prominently features a 2-line by 16character liquid crystal display (LCD). The FPGA controls the LCD via the eightbit data interface. The Spartan-3A/3AN Starter Kit board also supports the four-bit
data interface to remain compatible with other Xilinx development boards.
CHARACTER LCD INTERFACE
Signal name
FPGA Pin
Function
LCD_DB<7>
LCD_DB<6>
LCD_DB<5>
LCD_DB<4>
LCD_DB<3>
LCD_DB<2>
LCD_DB<1>
LCD_DB<0>
LCD_E
Y15
AB16
Y16
AA12
AB12
AB17
AB18
Y13
AB4
LCD_RS
Y14
LCD_RW
W13
SLOW ;
SLOW ;
SLOW ;
SLOW ;
SLOW ;
SLOW ;
SLOW ;
SLOW ;
SLOW ;
SLOW ;
SLOW ;
Power-On Initialization
The initialization sequence first establishes that the FPGA application wishes to
use the Four-bit data interface to the LCD as follows:
1. Wait 15 ms or longer, although the display is generally ready when the FPGA
finishes. Configuration. The 15 ms interval is 750,000 clock cycles at 50 MHz
2. Write LCD_DB<7:4> = 0x3, and pulse LCD_E High for 12 clock cycles.
3. Wait 4.1 ms or longer, which is 205,000 clock cycles at 50 MHz
4. Write LCD_DB<7:4> = 0x3, and pulse LCD_E High for 12 clock cycles.
5. Wait 100 s or longer, which is 5,000 clock cycles at 50 MHz
6. Write LCD_DB<7:4> = 0x3, and pulse LCD_E High for 12 clock cycles.
7. Wait 40 s or longer, which is 2,000 clock cycles at 50 MHz
8. Write LCD_DB<7:4> = 0x2, and pulse LCD_E High for 12 clock cycles.
9. Wait 40 s or longer, which is 2,000 clock cycles at 50 MHz
Display Configuration
After the power-on initialization is completed, the four-bit interface is established.
The next part of the sequence configures the display:
1. Issue a Function Set command, 0x28, to configure the display for operation on
the Spartan kit.
2. Issue an Entry Mode Set command, 0x06, to set the display to automatically
increment the address pointer.
3. Issue a Display On/Off command, 0x0C to turn the display on and disable the
cursor and blinking.
4. Finally, issue a Clear Display command. Allow at least 1.64 ms (82,000 clock
cycles) after
Issuing this command.
Code:
`timescale 1ns / 1ps
// data to be dispalyed
default: inst<=6'h10;
endcase
SF_CE0<=1;
LCD_E<=count[20];
LCD_RS<=inst[5]; //1-> data 0-> command
LCD_RW<=inst[4]; // 1->read 0->write
SFD_8<=inst[0];
SFD_9<=inst[1];
SFD_10<=inst[2];
SFD_11<=inst[3];
end
endmodule
Experiment - 9
Aim- Display and blink your name in 16*2 LCD using Verilog in SPARTAN
3E kit.
Code:
`timescale 1ns / 1ps
//power on initialization
0: inst<= 6'h03;
1: inst<= 6'h03;
2: inst<= 6'h03;
3: inst<= 6'h02;
//default: inst<=6'h10;
endcase
end
// data to be dispalyed
end
always@ (posedge clk)
begin
SF_CE0<=1;
SFD_E<=count[20];
SFD_RS<=inst[5]; //1-> data 0-> command
SFD_RW<=inst[4]; // 1->read 0->write
SFD_8<=inst[0];
SFD_9<=inst[1];
SFD_10<=inst[2];
SFD_11<=inst[3];
end
endmodule
Experiment 10
Aim- Design of a full adder using IP core (core generator &
architecture wizard)
Theory- You can create CORE Generator IP to instantiate in your HDL or schematic
designs. When you create IP, the CORE Generator software produces a combination of the
following files and places them in the specified directory for use in your ISE project:
Procedure to
add IP core-
1.
2.
3.
4.
5.
6.
7.
8.
Code:
module adder(input clk, c_in, input a[1:0], b[1:0], output s[2:0] );
ipcore your_instance_name (
.a(a),
// input [1 : 0] a
.b(b),
// input [1 : 0] b
.clk(clk),
// input clk
.c_in(c_in),
// input c_in
.s(s)
// output [2 : 0] s
);
endmodule
Experiment 11
Aim- Use of system generator without chipscope for
adder.
Theory-
System Generator for DSP is the industrys leading high-level tool for designing high-
performance DSP systems using Xilinx All Programmable devices. With System Generator for DSP, create
production-quality DSP algorithms in a fraction of time compared to traditional RTL.
Develop highly parallel systems with the industrys most advanced FPGAs
Provide system modeling and automatic code generation from Simulink and MATLAB (The Mathworks, Inc.)
Integrates RTL, embedded, IP, MATLAB and hardware components of a DSP system
A key component of the Xilinx DSP Targeted Design Platform
System Generator for DSP is part of the Vivado System Edition Design Suite. With System Generator for DSP,
developers with little FPGA design experience can quickly create production quality FPGA implementations of DSP
algorithms in a fraction of traditional RTL development times.
Procedure-
1. All programs-> Xilinx design tools -> ISE design suite 14.1 ->
System generator-> system generator -> Simulink ->sink >scope (for output)-> write click on scope and add to the
model. Save the model at describe location with a file name.
2. Xilinx block set -> basic elements ->add gateway out, 2
gateway In, system generator.
3. Xilinx block set -> maths-> addsub.
4. Double click Gateway In-> change arithmetic type to
Unsigned. Set the number of bits and binary point.
5. Go to implementation tab and checks specify IOB location
constraint -> assign input pin location in FPGA. Repeat the
same for both inputs to adder.
6. Double click on gateway out -> checks specify IOB location
constraint -> assign input pin location in FPGA.
7. Double click on Addsub-> basic tab->click on addition option > output tab-> precision user defined -> arithmetic sign ->
unsigned -> select the number of bits and binary point.
All programs-> Xilinx design tools -> ISE design suite 14.1
->ISE design tool -> 32- bit tools -> Impact.
Select the bit file and program as before(bit file name is
generated inside netlist directory) bitfile name is file_name
.bit.
Circuit Diagram :
Experiment 12
Aim- Use of system generator with chipscope for adder.
Theory- ChipScope Pro tool inserts logic analyzer, system analyzer, and virtual I/O low-profile software
cores directly into your design, allowing you to view any internal signal or node, including embedded hard or soft
processors. Signals are captured in the system at the speed of operation and brought out through the programming
interface, freeing up pins for your design. Captured signals are then displayed and analyzed using the ChipScope Pro
Analyzer tool.
The ChipScope Pro tool also interfaces with your Agilent Technologies bench test equipment through the ATC2
software core. This core synchronizes the ChipScope Pro tool to Agilents FPGA Dynamic Probe add-on option. This
unique partnership between Xilinx and Agilent gives you deeper trace memory, faster clock speeds, more trigger
options, and system-level measurement capability all while using fewer pins on the FPGA device.
The ChipScope Pro Serial I/O Toolkit provides a fast, easy, and interactive setup and debug of serial I/O channels in
high-speed FPGA designs. The ChipScope Pro Serial I/O Toolkit allows you to take bit-error ratio (BER)
measurements on multiple channels and adjust high-speed serial transceiver parameters in real-time while your serial
I/O channels interact with the rest of the system.
New RX Margin Analysis tool takes advantage of the Eye Scan feature in 7 Series FPGA transceivers enabling
our users to interactively characterize and optimize channel quality in both real time or view the test results offline
Analyze any internal FPGA signal, including embedded processor system buses
Inserts low-profile, configurable software cores either during design capture or after synthesis
All ChipScope Pro cores are available through the Xilinx CORE Generator System
Analyzer trigger and capture enhancements makes taking repetitive measurements easy to do
Enhancements to the Virtex-5 and Virtex-6 System Monitor console make it easier to access on-chip temperature,
voltage, and external sensor data
Change probe points without re-implementing the design
Debug over a network connection using remote debug, from your office to the lab, or across the globe
ChipScope core insertion and generation integrated into Project Navigator and PlanAhead tool flows
Add debug probes directly in HDL (VHDL and Verilog) or constraint files
Fast and easy interactive setup and debug of FPGA serial I/O channels
Measure bit-error ratios (BER) on multiple channels simultaneously
Adjust high-speed serial transceiver parameters in real-time while your serial I/O channels are interacting with the
rest of the system
Built-in pattern generators and checkers, including many standard ITU standard patterns
IBERT (Bit Error Ratio Tester) sweep test plot GUI
Built-in graphical viewer of IBERT sweep test results for Virtex-6 GTX/GTH FPGA transceivers
Standalone graphical viewer for offline analysis of IBERT sweep test results for Kintex-7 FPGA GTX, Virtex-7
FPGA GTX, Virtex-6 FPGA GTX/GTH, Spartan-6 FPGA GTP, and Virtex-5 FPGA GTX transceivers
Requires only JTAG port access to your board, no extra pins needed for dedicated high-speed serial debug or
setup
Support Kintex-7 GTX, and Virtex-7 GTX/GTH/GTZ, and Artix-7 GTP RX Margin Analysis with two different scan
algorithms:
2D Full Scan: Scans all horizontal and vertical offset sampling points within the eye
PROCEDURE:
1.
2.
3.
LIBRARY Browser.
Setting for step:
4.
Step time 1
Initial value 1
Final value 0
Sample time 0
5.
6.
7.
8.
9.
In Implementation window, Check IOB timing constraint and give output location
on FPGA, select NONE.
In Basic window, Counter type FREE Running,Counter direction UP, Initial value
0, Step 1
Binary point : 0
Setting for CHIPSCOPE:
Double click on system generator -> clock in -> A/O compilation -> bitstream .Part>SPARTAN 3E-> XC3S500E-> -4 -> FG320.Hardware description language -> Verilog.
Clocking -> clock pin -> C9 and FPGA clock period =20ns.Now generate file.
10. Dump program into FPGA KIT.