fpga-01 sp3 im manual (1)

67
FPGA-01: SPARTAN - III Protoboard VLSI Training System FPGA-01 MODEL : MXS3FK-PQ208-IM Rev: 003 OPERATIONAL MANUAL

Upload: krishnaav

Post on 26-Oct-2015

204 views

Category:

Documents


5 download

DESCRIPTION

spartan3 FPGA manual of FALCON

TRANSCRIPT

Page 1: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

VLSI Training System

FPGA-01

MODEL : MXS3FK-PQ208-IM Rev: 003

OPERATIONAL MANUAL

Page 2: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

VLSI Training System

Welcome Introduction VLSI Training System is the first of its kind using actual techniques of VLSI. It is our vision to furnish products, which are reliable and convenient to use. FALCON offers a high degree of expertise in developing efficient products. Company’s Motto

- Light years ahead – refers to leadership.

We strive to be the best in what we do and maintain high standards in the areas of

• Design • Quality • Value • Delivery • Support We are indeed light years ahead of the competition in this field. We guarantee our valued customers great satisfaction. Important Information As you will move through this manual you will quickly discover that we have complete, truly innovative & superior training products. We are so committed to quality that we back our products with a complete and comprehensive warranty.

FALCON ELECTRO-TEK PVT.LTD. UNIT NO. 128, HEMA IND.EST,

SARVODAY NAGAR, JOGESHWARI (E) MUMBAI-400060

MAHARASHTRA, INDIA.

TEL.: +91-22-28348429 / 28248665 / 28346339 / 28343608. FAX: 91-22-28370165.

Email: falcon@falconindia .biz Website: www.falconindia.biz

Page 3: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

VLSI Training System

Safety Guidelines

Read carefully and follow the instructions mentioned in this manual. This user manual includes all the important points about the installation, use and the maintenance of the product. Keep this manual always with you, for quick reference.

After unpacking the product, arrange all the accessories in proper order, so that their

integrity is checked with the packing list. Also, ensure that the accessories have no visible damage.

Before connecting the power supply to the kit, be sure that the jumpers and the

connecting chords are connected correctly, as per the experiment.

This kit must be employed only for the use for which it has been conceived, i.e. as educational kit and must be used under the direct survey of expert personnel. Any other use is inadvisable and dangerous too. The manufacturer cannot be considered responsible for eventual damages due to improper, wrong or unreasonable uses.

In case of any fault or malfunctioning in the trainer kit, turn off the power supply. Please

do not tamper the kit. If you require our service, kindly contact the service centre for technical assistance.

The kits are liable to malfunction/ underperforms if it is not operated under following

conditions:

Ambient temperature: Between 0 to 45 ° C Relative humidity: Between 20 to 80 %

Avoid any immediate/significant change of temperature and humidity.

Page 4: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

VLSI Training System

Warranty

This kit is warranted against defects in workmanship and materials. Any failure due to defect in either workmanship or material should occur under normal use within a year from the original date of purchase, such failure will be corrected free of charge to the purchaser by repair or replacement of defective part or parts. When the failure is result of user’s neglect, natural disaster or accident, we would charge for repairs, regardless of the warranty period. The warranty does not cover include perishable items like connecting chords, crystals, etc. and other imported items. Conditions and Limitations The warranty is void and inapplicable if the defective product is not brought or sent to our authorized service center or sales outlet within the warranty period. Defective product will be Falcon Electro - Tek Pvt. Ltd‘s sole judgment. The defective product will be replaced with a new one or repaired, without charge or with charge. In the warranty period if the service is needed, the purchaser should get in touch with the service center or the sales outlet. The purchaser should return the product to the service center or the sales outlet at his or her sole expense. The loss and damage in transit will be outside the preview of this warranty. A returned product must be accompanied by a written description of the defects. Type and Model No. of the kit has to be mentioned specifically. We return the product to the purchaser at our expense. In case the warranty does not cover the product on Falcon Electro-Tek Pvt. Ltd.’s judgment, we would repair the product after obtaining prior permission from purchaser who would receive an estimate statement about the repairing charges. In such cases, Falcon Electro-Tek Pvt. Ltd. bares the transporting expenses required to send back all the repaired products for the moment, and then repairs and transporting expenses will be charged against the purchaser by the statement of accounts. When the authorized sales agents sell our products, they must notify the purchaser of the warranty contents, but they have no rights to stretch the meaning of original warranty contents or to offer an additional warranty. Falcon Electro-Tek Pvt. Ltd. does not provide any other promise or suggestive warranty and hold no liability for the damage caused by negligence, abnormal use or natural disaster. Falcon Electro-Tek Pvt. Ltd. is not responsible for the damages even if it is notified of above dangers in advance as well. For more special service or overall repairs, maintenance and up gradation of products, be sure to contact our service center or the sales outlet.

Page 5: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

VLSI Training System

FALCON ELECTRO – TEK PVT. LTD PRD / F03 / 0 Title: Test Report Of Product 1- 9 - 04

Test Report Customer Name : Distributor Name : Model : FPGA-01: SPARTAN - III Protoboard Serial No. :

Sr. No. Types Of Tests Report

1. Visual Inspection

2. Electrical Check

3. Functional Settings

4. Functional Test

5. Burning Test

6. Final Check

7. Accessories Check As Per List

8. Packing

Checked By : ______________________________ Date: ________ Signature : ______________________________ Installed By : ______________________________ Date: ________ Signature : ______________________________

Page 6: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

VLSI Training System

FALCON ELECTRO – TEK PVT. LTD PRD / F03 / 0 Title: Test Report Of Product 1- 9 - 04

Test Report Customer Name : Distributor Name : Model : FPGA-01: SPARTAN - III Protoboard Serial No. :

Sr. No. Types Of Tests Report

1. Visual Inspection

2. Electrical Check

3. Functional Settings

4. Functional Test

5. Burning Test

6. Final Check

7. Accessories Check As Per List

8. Packing

Checked By : ______________________________ Date: ________ Signature : ______________________________ Installed By : ______________________________ Date: ________ Signature : ______________________________

Page 7: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

VLSI Training System

Table Of Content PREFACE ...............................................................................................................................1 About This Manual..................................................................................................................1 Manual Contents .................................................................................................................................1

CHAPTER 1............................................................................................................................2 INTRODUCTION....................................................................................................................2 Features ..............................................................................................................................................2

CHAPTER 2............................................................................................................................4 Seven Segment LED Display .................................................................................................4

CHAPTER 3............................................................................................................................6 Serial Interface .......................................................................................................................6 3.1 RS- 232 Interface ..........................................................................................................................6

CHAPTER 4............................................................................................................................7 LCD Interface .........................................................................................................................7 4.1 Data Lines Connection ..................................................................................................................7 4.2 Control Line Interface: ...................................................................................................................8 4.3 ASCII CODE .................................................................................................................................8

CHAPTER 5............................................................................................................................9 Traffic Light controller using FPGA.........................................................................................9 5.1 Design Description:- ......................................................................................................................9 5.2 Experimental Set up:- ..................................................................................................................11 5.3 Component Diagram - .................................................................................................................12 5.4 VHD Code for Traffic Light Controller ..........................................................................................12

CHAPTER 6..........................................................................................................................21 real clock timer .....................................................................................................................21 6.1 Description for Real Clock Timer .................................................................................................21 6.2 VHD Code for Real Clock Timer..................................................................................................21

CHAPTER 7..........................................................................................................................27 ADC - DAC Interface ............................................................................................................27 7.4 Analog INPUT Connector: ...........................................................................................................27 7.1 ANALOG INPUT..........................................................................................................................27 7.3 ANALOG OUTPUT......................................................................................................................28 7.4 Analog Output Connector: ...........................................................................................................28

VHDL CODE FOR ADC-DAC LOOPBACK .........................................................................30

CHAPTER 8..........................................................................................................................33 Connector Details .................................................................................................................33 8.1 DIGITAL IOs................................................................................................................................33

CHAPTER 9..........................................................................................................................34 JUMPER SETTINGS............................................................................................................34

CHAPTER 10........................................................................................................................35 Clock and Reset Sources .....................................................................................................35

CHAPTER 11........................................................................................................................36 Power Supplies.....................................................................................................................36 11.1 Voltage Regulators ....................................................................................................................36

Page 8: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

VLSI Training System

APPENDIX A ........................................................................................................................37 Consolidated UCF for the Complete Board ..........................................................................37

APPENDIX B ........................................................................................................................40 Operating Instructions To Start A New Design.....................................................................41 B.1 Starting The ISE Software:..........................................................................................................41 B.2 Design Flow ................................................................................................................................41 B.3 Design Description......................................................................................................................41 B.4 Truth Table of Half adder: - .........................................................................................................42 B.5 VHDL Code for Half adder ..........................................................................................................42 B.6 Steps to implement the Half adder in the FPGA using Xilinx ISE(8.1i) ........................................42

APPENDIX C ........................................................................................................................57 SAMPLE CODES .................................................................................................................57 C.1 keyboard-display & I/O interface test code..................................................................................57

LIST OF FIGURES

Figure1: Block Diagram ................................................................................................................3 Figure 2: Seven Segment Display ................................................................................................4 Figure 3: FPGA – RS232 Interface ...............................................................................................6 Figure 4: LCD Interface to SPARTAN-3 FPGA.............................................................................7 Figure 5: ASCII Code for 5 x 7 LCD display .................................................................................8 Figure 6: State Diagram for Traffic Light Controller ....................................................................10 Figure 7: Traffic Light Interface to SPARTAN-3 FPGA ...............................................................11 Figure 8: FPGA – ADC DAC Interface........................................................................................27 Figure 9: Input Channel of ADC..................................................................................................28

LIST OF TABLES

Table 1: Seven Segment Display Interface to SPARTAN-3 FPGA...............................................5 Table 2: RS232 Interface to SPARTAN -3 FPGA .........................................................................6 Table 3: Data Line Interface to SPARTAN-3 FPGA......................................................................7 Table 4: Control Line Interface to SPARTAN-3 FPGA..................................................................8 Table 5: Traffic light controller Interface to SPARTAN-3 FPGA..................................................20 Table 6: Real Clock Timer Interface to SPARTAN-3 FPGA........................................................26 Table 7 : Analog Input.................................................................................................................27 Table 8: Analog Output ...............................................................................................................28 Table 9: ADC Interface to SPARTAN III FPGA...........................................................................28 Table 10: Control Inputs to ADC .................................................................................................28 Table 11: DAC Interface to FPGA...............................................................................................29 Table 12: IO Connector Interface to FPGA.................................................................................33 Table 13: IO Clock-Reset Interface to FPGA..............................................................................35 Table 14: Power Supply Details..................................................................................................36

Page 9: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 1 - VLSI Training System

PREFACE About This Manual

This manual gives operational details for all the interfaces.

Manual Contents This manual contains following chapters: • Chapter 1, “Introduction” • Chapter 2, “Seven Segment LED Display” • Chapter 3, “Serial Interface” • Chapter 4, “LCD Interface” • Chapter 5, “Traffic Light Controller using FPGA” • Chapter 6, “Real Clock Timer” • Chapter 7, “ADC And DAC Interface” • Chapter 8, “Connector Details” • Chapter 9, “Jumper Settings” • Chapter 10, “Clock And Reset Sources” • Chapter 11, “Power Supplies” • Appendix A “Consolidated UCF for the complete Board” • Appendix B, “Operating Instructions To Start New Design” • Appendix C, “Sample Codes”

Page 10: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 2 - VLSI Training System

CHAPTER 1 INTRODUCTION

Spartan-3 trainer Development Board (MXS3FK-PQ208-IM) provides an easy to use development platform for realizing various designs around SPARTAN-3 FPGA.

Features Figure 1 shows the SPARTAN-3, which includes the following components and features: • SPARTAN -3 FPGA : 400 k logic cell SPARTAN -3 FPGA in PQ208 Plastic Quad Flat

Package (MXS3FK-PQ208-IM ) Three families Spartan 3 /Spartan 3L/Spartan 3 XA. Very low cost, high-performance logic solution for high-volume, consumer-oriented

applications. - Densities as high as 74,880 logic cells. - Three power rails for core (1.2V), I/O’s (1.2V to 3.3V) and Auxiliary purposes (2.5V). - 326 MHz system clock rate. - 90 nm process technology.

Select IO™ Signaling. - Up to 784 I/O pins. - 622 Mb/s data transfer rate per IO. - 18 single-ended signal standards. - 6 differential I/O standards including LVDS, RSDS. - Termination by Digitally Controlled Impedance. - Double data Rate (DDR) support.

Logic Resources - Abundant Logic cells with shift register capability. - Wide Multiplexers. - Fast look-ahead carry logic. - Dedicated 18 x 18 Multipliers.

SelectRAM™ Hierarchical Memory. - Up to 1,872 Kbits of total block RAM. - Up to 520 Kbits of Distributed RAM.

Digital Clock Manager (up to 4DCMs) - Clock skew elimination. - Frequency synthesis - High resolution phase shifting.

Eight global clock lines and abundant routing. Micro Blaze™ processor, PCI and other cores.

• Traffic Light Control Interface :-16 green LEDS, 8 Red LEDS, 4 Yellow LEDS

Traffic Light Interface module will be connected using 60 pin Connector (J5). • Analog Interface: – 12 bit AD7891 ADC and 12 bit AD7541 DAC.(OPTIONAL)

Analog Input – Eight channels using ADC using AD7891, (500Ksps, 12 bit). Analog Output- Two channels using Two DAC’s-AD7541. (12 bit, 100 ns conversion

time) • Seven Segment Display: Six-character multiplexed seven-segment LED display. • DIP Switches: 16 DIP switches. • LEDs: 20 onboard LEDS

16 output LEDs (OL 0 – OL 15). Done LED.(DONE) 3 Power ON LEDs (LED5V, LED3V3, LED2V5).

• Push Button Switches: 16 momentary-contact push button switches in 4x4 matrix.

Page 11: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 3 - VLSI Training System

Figure1: Block Diagram

1. LCD interface: 16 character 2 row LCD. • Serial Interface: One RS-232 channel using MAX3223, 9 pin two channel serial interfaces.

DB9 9-pin female connector (DCE connector). RS-232 transceiver/level translator using MAX3223 in SSOP package. Uses straight-through serial cable to connect to computer or workstation serial port.

• User selectable configuration modes - Boundary scan, Master serial. • User selectable Interface hardware – Traffic Light, RTC, ADC-DAC. • Free IOs: 60 pin FRC Connector (J5) and 34 pin FRC Connector (J2) provided for free I/Os. • Clock Oscillator: 4 MHz crystal clock oscillator. Socket for an auxiliary crystal oscillator

clock source. • JTAG port: JTAG download cable (parallel III) interface. • Power Supplies: 5 volts regulated power supply provided along with the board.

On board 3.3V, 2.5V, 1.2V regulators. FPGA supplies viz. Vccint (1.2V) & Vcco (3.3V) are generated on board

Page 12: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 4 - VLSI Training System

CHAPTER 2 Seven Segment LED Display

SPARTAN-3 -IM has a Six multiplexed seven segment .Each individual character has a separate cathode control input. To light an individual signal, drive the individual segment control signal High along with the associated cathode control signal for the individual character. The control signal is high, enabling the control inputs for the left-most character. The segment control inputs, A through G and DP, drive the individual segments that comprise the character. A High value lights the individual segment, a Low turns off the segment.

Figure 2: Seven Segment Display

The two types of the seven segment displays are as shown below • Common Cathode Display: In this type of display the cathode of all the LEDs are tied

together and the anode terminals decides the status of the LED, either ON or OFF. • To turn ON the LED i.e. segment value of driven segment should be 1 and 0 for turn OFF.

• Common Anode Display: In this type of display all the anode terminals of LEDs are tied

together and the cathode terminals decide the status of the LED either ON or OFF. • To turn ON the LED i.e. segment value of driven segment should be 0 and 1 for turn OFF.

Page 13: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 5 - VLSI Training System

Interface details for the seven segment display with SPARTAN-3 display is as follows

Table 1: Seven Segment Display Interface to SPARTAN-3 FPGA Control Bit FPGA Pin

"SEGA" p144 "SEGB" p143 "SEGC" p141 "SEGD" p140 "SEGE" p139 "SEGF" p138 "SEGG" p137

"SEGDP" P135 "DIS0 " p97 "DIS1 " p100 "DIS2 " p101 "DIS3 " p102 "DIS4 " p132 "DIS5 " p133

Page 14: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 6 - VLSI Training System

CHAPTER 3 Serial Interface

SPARTAN -3 - IM supports RS-232 serial interface. The details of interface are described below.

3.1 RS- 232 Interface The RS-232 transmit and receive signals appear on the female DB9 connector, indicated as in Figure 3. The connector is a DCE-style port and connects to the DB9 DTE-style serial port connector available on most personal computers and workstations. Use a standard straight-through serial cable to connect the SPARTAN -3 – IM to the PC’s serial port.

Figure 3: FPGA – RS232 Interface

Figure 3 shows the connection between the FPGA and the DB9 connector, including the Maxim MAX3223 RS-232 voltage converter. The FPGA supplies serial output data as LVTTL or LVCMOS levels to the Maxim device, which in turn converts the logic value to the appropriate RS-232 voltage level. Likewise, the Maxim device converts the RS-232 serial input data to LVTTL levels for the FPGA. Hardware flow control is not supported on the connector. The port’s DCD, DTR, and DSR signals are left unconnected. Similarly, the port’s CTS and Ring Indicator are used as an auxiliary RS232 channel signals The FPGA connections to the Maxim RS-232 translator appear in Table 2.

Table 2: RS232 Interface to SPARTAN -3 FPGA Control Bit FPGA Pin

"RS232_RXD<1>" p176

"RS232_RXD<2>" p178

"RS232_TXD<1>" p175

"RS232_TXD<2>" p172

For more details on RS232 UART application please refer the following application note AN2141 from Maxim.

Page 15: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 7 - VLSI Training System

CHAPTER 4 LCD Interface

SPARTAN-3 -IM includes a LCD Module, which is a dot matrix liquid crystal display that displays alphanumeric, Kana (Japanese) characters and symbols. Built in controller provides connectivity between LCD and FPGA. This LCD has a built in Dot Matrix controller, with font 5 X 7 or 5 X 10 dots, display data RAM for 80 characters ( 80 x 8 bit) and a character generator ROM which provides 160 characters with 5x7 font and 32 characters with font of 5x10. All the functions required for LCD are provided internally. Internal refresh is provided by the Controller. The Interface details of the LCD display are as shown in figure 4.

Figure 4: LCD Interface to SPARTAN-3 FPGA

4.1 Data Lines Connection LCD has 8 bit bidirectional data bus interface to FPGA. When Enable signal is at low level, this data bus remains in high impedance state. Interface details of the data lines with SPARTAN-3 FPGA are as in Table 3

Table 3: Data Line Interface to SPARTAN-3 FPGA DATA BIT FPGA Pin

"LCD_D<0>" p167

"LCD_D<1>" p166

"LCD_D<2>" p165

"LCD_D<3>" p162

"LCD_D<4>" p161

"LCD_D<5>" p156

"LCD_D<6>" p155

"LCD_D<7>" p154

Page 16: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 8 - VLSI Training System

4.2 Control Line Interface: The control lines of LCD comprises of RS, R/W# and E The significance of the above mentioned control signals is as follows • RS: Register select signal used to select Data register or a Command/Status register.

High on RS selects the data register. Low on RS selects the Command/Status register.

• R/W#: Read/Write select control line.

High on R/W # selects the read operation Low on R/W # selects the write operation.

• E: Enable signal used to enable or disable the data bus.

Low on the enable signal puts the data bus into a high impedance state. High on the enable signal selects the data bus

The control line interface of LCD with FPGA is as shown in table 4

Table 4: Control Line Interface to SPARTAN-3 FPGA Control Bit FPGA Pin

"LCD_E" p168

"LCD_RS" p171

"LCD_RW_BAR" p169

Note: PR1 is used to adjust the contrast of LCD Display

4.3 ASCII CODE The ASCII code for 5x 7 LCD Display is given in Figure 5

Figure 5: ASCII Code for 5 x 7 LCD display

Page 17: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 9 - VLSI Training System

CHAPTER 5 Traffic Light controller using FPGA

Spartan-3 - IM includes a TRAFFIC LIGHT Interface Module. This module is interfaced to the Trainer using 60 pin FRC cable. Traffic Light controller is implemented in FPGA and verified using Traffic Light Interface Module. There are simple rules for traffic lights on one node, and complex ways of regulating a whole infrastructure of them. It is necessary to adjust general algorithms

5.1 Design Description:- • Initially all Red Lights will be “ON” (South, west, North, East, Pedestrian) • Green Lights of will be “ON”, Right, Left & Straight paths are free for Traffic. • Yellow Phase is split as yellow1 & yellow2. In yellow1 phase yellow lights will be on and

respective left & pedestrian paths are free for traffic. • In Yellow2 Phase only yellow lights will be “ON” • Same flow is repeated for all four paths. (South, west, north, east).

Flowchart:-

Page 18: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 10 - VLSI Training System

To implement Traffic Light controller refer the waveform given below

Algorithm is implemented in VHDL with a 13 state Finite State Machine. Refer Fig

Below. Figure 6: State Diagram for Traffic Light Controller

Page 19: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 11 - VLSI Training System

Abbreviation used:- South West

PSG – Pedestrian South Green PWR – Pedestrian West Red PSR – Pedestrian South Red PWG – Pedestrian West Green RS – Right South RW – Right West LS – Left South LW – Left West SS – Straight South SW – South West YS – Yellow South YW – Yellow West REDS – Red South REDW – Red West

North East PNR- Pedestrian North red PEG – Pedestrian East green PNG – Pedestrian North green PER – Pedestrian Ease Red RN – Right North RE – Right East LN – Left North LE – Left East SN – Straight North SE – Straight East YN - Yellow North YE – Yellow East REDN – Red North REDE – Red East

5.2 Experimental Set up:-

Figure 7: Traffic Light Interface to SPARTAN-3 FPGA

Page 20: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 12 - VLSI Training System

5.3 Component Diagram -

CONCLUSION:- Design of “Traffic Light Controller” is implemented in Spartan-3 Trainer and is verified using Traffic Light Interface Module according to the following Algorithm.

5.4 VHD Code for Traffic Light Controller library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; ---- Uncomment the following library declaration if instantiating ---- any Xilinx primitives in this code. --library UNISIM; --use UNISIM.VComponents.all; entity Traffic_Control is Port ( CLK_4M,RESET : in std_logic; TRC_LS,TRC_LW,TRC_LN,TRC_LE: out std_logic; TRC_SS,TRC_SW,TRC_SN,TRC_SE: out std_logic; TRC_RS,TRC_RW,TRC_RN,TRC_RE : out std_logic;

Page 21: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 13 - VLSI Training System

TRC_REDS,TRC_REDW,TRC_REDN,TRC_REDE : out std_logic; TRC_YS,TRC_YW,TRC_YN,TRC_YE : out std_logic; TRC_PSR,TRC_PWR,TRC_PNR,TRC_PER : out std_logic; TRC_PSG,TRC_PWG,TRC_PNG,TRC_PEG : out std_logic); end Traffic_Control; architecture Behavioral of Traffic_Control is type state is (start,south_g,south_orange,south_r,west_g,west_orange, west_r,east_g,east_orange,east_r,north_g,north_orange,north_r); signal ps , ns : state; signal div : std_logic_vector(30 downto 0); signal clk_s : std_logic; signal cnt : std_logic_vector(3 downto 0) ; begin --*************************** Divider ************************** process(CLK_4M,RESET) begin if(RESET = '1') then div <= (others => '0'); elsif(CLK_4M'event and CLK_4M = '1') then div <= div + 1; end if; end process; clk_s <= div(20); --*************************** Counter ************************** process(clk_s ,RESET) begin if(RESET = '1') then cnt <= (others => '0'); elsif(clk_s'event and clk_s = '0') then cnt <= cnt + 1; end if; end process; --*************************** Memory_logic ********************* process(clk_s,RESET) begin if (RESET = '1')then ps <= start; elsif(clk_s'event and clk_s = '1') then ps <= ns; end if; end process; --*************************** Input_logic ********************** process(ps) begin case ps is when start => ns <= south_g; when south_g => if(cnt = 10)then ns <= south_orange; else ns <= south_g; end if;

Page 22: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 14 - VLSI Training System

when south_orange => if(cnt = 14) then ns <= south_r; else ns <= south_orange; end if; when south_r => if(cnt = 15)then ns <= west_g; else ns <= south_r; end if; when west_g => if(cnt = 10) then ns <= west_orange; else ns <= west_g; end if; when west_orange => if(cnt = 14) then ns <= west_r; else ns <= west_orange; end if; when west_r => if(cnt = 15 )then ns <= north_g; else ns <= west_r; end if; when north_g => if(cnt = 10)then ns <= north_orange; else ns <= north_g; end if; when north_orange => if(cnt = 14)then ns <= north_r; else ns <= north_orange; end if; when north_r => if(cnt = 15)then ns <= east_g; else ns <= north_r; end if; when east_g => if(cnt = 10)then ns <= east_orange; else ns <= east_g; end if; when east_orange => if(cnt = 14)then ns <= east_r; else

Page 23: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 15 - VLSI Training System

ns <= east_orange; end if; when east_r => if(cnt = 15)then ns <= south_g; else ns <= east_r; end if; when others => ns <= start; end case; end process; --*************************** Output_logic ************************** process(ps) begin TRC_REDS <= '0'; TRC_REDW <= '0'; TRC_REDN <= '0'; TRC_REDE <= '0'; TRC_RS <= '0'; TRC_RW <= '0'; TRC_RN <= '0'; TRC_RE <= '0'; TRC_SS <= '0'; TRC_SW <= '0'; TRC_SN <= '0'; TRC_SE<= '0'; TRC_LS <= '0'; TRC_LW <= '0'; TRC_LN <= '0'; TRC_LE <= '0'; TRC_PSG <= '0'; TRC_PWG <= '0'; TRC_PNG <= '0'; TRC_PEG <= '0'; TRC_YS <= '0'; TRC_YW <= '0'; TRC_YN <= '0'; TRC_YE <= '0'; TRC_PSR <= '0'; TRC_PWR <= '0'; TRC_PNR <= '0'; TRC_PER <= '0'; case ps is when start => TRC_REDS <= '1'; TRC_REDW <= '1'; TRC_REDN <= '1'; TRC_REDE <= '1'; when south_g => TRC_LS <= '1'; TRC_RS <= '1'; TRC_SS <= '1'; TRC_LE <= '1'; TRC_REDW <= '1';

Page 24: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 16 - VLSI Training System

TRC_REDN <= '1'; TRC_REDE <= '1'; TRC_PSR <= '1'; TRC_PWR <= '1'; TRC_PNR <= '1'; TRC_PER <= '1'; when south_orange => TRC_PNG <= '1'; TRC_LE <= '1'; TRC_LS <= '1'; TRC_YS <= '1'; TRC_REDW <= '1'; TRC_REDN <= '1'; TRC_REDE <= '1'; TRC_PSR <= '1'; TRC_PWR <= '1'; TRC_PER <= '1'; when south_r => TRC_LS <= '1'; TRC_REDW <= '1'; TRC_REDN <= '1'; TRC_REDE <= '1'; TRC_PSR <= '1'; TRC_PWR <= '1'; TRC_PNR <= '1'; TRC_PER <= '1'; when west_g => TRC_LW <= '1'; TRC_LS <= '1'; TRC_RW <= '1'; TRC_SW <= '1'; TRC_REDS <= '1'; TRC_REDN <= '1'; TRC_REDE <= '1'; TRC_PSR <= '1'; TRC_PWR <= '1'; TRC_PNR <= '1'; TRC_PER <= '1'; when west_orange => TRC_LW <= '1'; TRC_LS <= '1'; TRC_PEG <= '1'; TRC_YW <= '1'; TRC_REDS <= '1'; TRC_REDN <= '1'; TRC_REDE <= '1'; TRC_PSR <= '1'; TRC_PWR <= '1'; TRC_PNR <= '1'; when west_r => TRC_LW <= '1'; TRC_REDS <= '1'; TRC_REDN <= '1'; TRC_REDE <= '1'; TRC_PSR <= '1'; TRC_PWR <= '1'; TRC_PNR <= '1'; TRC_PER <= '1';

Page 25: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 17 - VLSI Training System

when north_g => TRC_LN <= '1'; TRC_RN <= '1'; TRC_SN <= '1'; TRC_LW <= '1'; TRC_REDS <= '1'; TRC_REDW <= '1'; TRC_REDE <= '1'; TRC_PSR <= '1'; TRC_PWR <= '1'; TRC_PNR <= '1'; TRC_PER <= '1'; when north_orange => TRC_LN <= '1'; TRC_LW <= '1'; TRC_PSG <= '1'; TRC_YN <= '1'; TRC_REDS <= '1'; TRC_REDW <= '1'; TRC_REDE <= '1'; TRC_PWR <= '1'; TRC_PNR <= '1'; TRC_PER <= '1'; when north_r => TRC_LN <= '1'; TRC_REDS <= '1'; TRC_REDW <= '1'; TRC_REDE <= '1'; TRC_PSR <= '1'; TRC_PWR <= '1'; TRC_PNR <= '1'; TRC_PER <= '1'; when east_g => TRC_RE <= '1'; TRC_SE<= '1'; TRC_LE <= '1'; TRC_LN <= '1'; TRC_REDS <= '1'; TRC_REDW <= '1'; TRC_REDN <= '1'; TRC_PSR <= '1'; TRC_PWR <= '1'; TRC_PNR <= '1'; TRC_PER <= '1'; when east_orange => TRC_LN <= '1'; TRC_LE <= '1'; TRC_PWG <= '1'; TRC_YE <= '1'; TRC_REDS <= '1'; TRC_REDW <= '1'; TRC_REDN <= '1'; TRC_PSR <= '1'; TRC_PNR <= '1'; TRC_PER <= '0'; when east_r => TRC_LE <= '1';

Page 26: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 18 - VLSI Training System

TRC_REDS <= '1'; TRC_REDW <= '1'; TRC_REDN <= '1'; TRC_PSR <= '1'; TRC_PWR <= '1'; TRC_PNR <= '1'; TRC_PER <= '1'; when others => TRC_REDS <= '0'; TRC_REDW <= '0'; TRC_REDN <= '0'; TRC_REDE <= '0'; TRC_RS <= '0'; TRC_RW <= '0'; TRC_RN <= '0'; TRC_RE <= '0'; TRC_SS <= '0'; TRC_SW <= '0'; TRC_SN <= '0'; TRC_SE<= '0'; TRC_LS <= '0'; TRC_LW <= '0'; TRC_LN <= '0'; TRC_LE <= '0'; TRC_PSG <= '0'; TRC_PWG <= '0'; TRC_PNG <= '0'; TRC_PEG <= '0'; TRC_YS <= '0'; TRC_YW <= '0'; TRC_YN <= '0'; TRC_YE <= '0'; TRC_PSR <= '0'; TRC_PWR <= '0'; TRC_PNR <= '0'; TRC_PER <= '0'; end case; end process; end Behavioral; ***********************Abbreviation used**************************

#PS-G – Pedestrian South Green #PN-R- Pedestrian North Red #PS-R – pedestrian South Red #PN-G – Pedestrian North Green #RS – Right South #RED-E – Red East #LS – Left South #YE – Yellow East #SS – Straight South #SE – Straight East #YS – Yellow South #RE – Right East #RED-S – Red South #LE – Left East #PW-R – Pedestrian west red #PE-G – Pedestrian East green #PW-G – Pedestrian west Green #PE-R – Pedestrian East Red #LW – Left West #RED-N – Red North #SW – South West #YN - Yellow North #RW – Right West #LN – Left North #YW – yellow West #RN – Right north #RED-W – Red West #SN – Straight North

Page 27: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 19 - VLSI Training System

Description of above Code:- To Start the Traffic light controller 1. Initially the Red light of all the directions is ON. 2. Traffic starts from the South Direction, hence the green light of South direction goes ON.

The signals that are ON, now are :- ls ( left south ) –‘1’. rs ( right south ) –‘1’. ss ( straight south ) –‘1’. le ( left east ) –‘1’. red_w ( red west ) –‘1’. red_n (red north ) –‘1’. red_e (red east ) –‘1’. ps_r ( pedestrian south red) –‘1’. pw_r ( pedestrian west red) –‘1’. pn_r ( pedestrian north red) –‘1’. pe_r ( pedestrian east red) –‘1’.

Similarly when Orange light of South direction is ON then the signals that are ON, now are ls ( left south ) –‘1’. ys ( yellow south ) –‘1’. le ( left east ) –‘1’. red_w ( red west ) –‘1’. red_n (red north ) –‘1’. red_e (red east ) –‘1’. ps_r ( pedestrian south red) –‘1’. pw_r ( pedestrian west red) –‘1’. pn_r ( pedestrian north red) –‘1’. pe_r ( pedestrian east red) –‘1’.

Similarly when Red light of South direction is ON then the signals that are ON, now are ls ( left south ) –‘1’. red_w ( red west ) –‘1’. red_n (red north ) –‘1’. red_e (red east ) –‘1’. ps_r ( pedestrian south red) –‘1’. pw_r ( pedestrian west red) –‘1’. pn_r ( pedestrian north red) –‘1’. pe_r ( pedestrian east red) –‘1’.

During this time all ways are Blocked for 1 second except left south ( ls -‘1’ ) and so on. After that it goes clockwise for all Direction (i.e.:- South then West then North then East) similarly.

Note:-For Pin Locking refers the pin out diagram of the specific adapter and the device used on that adapter. Refer Appendix -A.

Page 28: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 20 - VLSI Training System

Table 5: Traffic light controller Interface to SPARTAN-3 FPGA

SIGNAL NAME FPGA PIN NO. CONNECTOR J3 PINNO. net "TRC_LE" loc = "p107"; #J3-20 net "TRC_LN" loc = "p125"; #J3-9 net "TRC_LS" loc = "p150"; #J3-25 net "TRC_LW" loc = "p130"; #J3-6 net "TRC_PEG" loc = "p116"; #J3-16 net "TRC_PER" loc = "p117"; #J3-15 net "TRC_PNG" loc = "p128"; #J3-7 net "TRC_PNR" loc = "p124"; #J3-10 net "TRC_PSG" loc = "p12"; #J3-28 net "TRC_PSR" loc = "p13"; #J3-27 net "TRC_PWG" loc = "p148"; #J3-2 net "TRC_PWR" loc = "p149"; #J3-1 net "TRC_RE" loc = "p114"; #J3-18 net "TRC_REDE" loc = "p109"; #J3-22 net "TRC_REDN" loc = "p120"; #J3-13 net "TRC_REDS" loc = "p108"; #J3-21 net "TRC_REDW" loc = "p126"; #J3-8 net "TRC_RN" loc = "p122"; #J3-12 net "TRC_RS" loc = "p111"; #J3-23 net "TRC_RW" loc = "p147"; #J3-3 net "TRC_SE" loc = "p115"; #J3-17 net "TRC_SN" loc = "p123"; #J3-11 net "TRC_SS" loc = "p152"; #J3-26 net "TRC_SW" loc = "p146"; #J3-4 net "TRC_YE" loc = "p106"; #J3-19 net "TRC_YN" loc = "p119"; #J3-14 net "TRC_YS" loc = "p113"; #J3-24 net "TRC_YW" loc = "p131"; #J3-5

Page 29: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 21 - VLSI Training System

CHAPTER 6 real clock timer

6.1 Description for Real Clock Timer 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. Control signal is also provided to set 24 or 12 hour mode of operation, when high 24 hour mode is selected whereas low on control signal selects 12 hour mode of operation.

6.2 VHD Code for Real Clock Timer library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; ---- Uncomment the following library declaration if instantiating ---- any Xilinx primitives in this code. --library UNISIM; --use UNISIM.VComponents.all; ----------------------------------------------------------------------------------- --This is real time clock in this we use --4mhz clock -- to generate 1 sec clock we use enable signal high for last 1 count -- sec1 counter for reading sec -- sec2 counter for reading sec -- min1 counter for reading min -- min2 counter for reading min -- hr1 counter for reading hr -- hr2 counter for reading hr entity RTC_IM is port(RESET,CLK_4M,load,control:in std_logic; RTC_SEG:out std_logic_vector(7 downto 0); RTC_DIS:out std_logic_vector(5 downto 0)); end RTC_IM; architecture Behavioral of RTC_IM is signal tc,tc1,tc2,tc3,tc4,tc5,tc6,enable:std_logic; signal sec1,sec2,min1,min2,hr1,hr2: std_logic_vector(3 downto 0); signal sec1_rg:std_logic_vector(3 downto 0); signal sec2_rg:std_logic_vector(3 downto 0); signal min1_rg:std_logic_vector(3 downto 0); signal min2_rg:std_logic_vector(3 downto 0); signal hr1_rg:std_logic_vector(3 downto 0); signal hr2_rg:std_logic_vector(3 downto 0); signal pulsegen:std_logic_vector(21 downto 0); signal sel:std_logic_vector(2 downto 0); signal mout:std_logic_vector(3 downto 0); signal sgout:std_logic_vector(7 downto 0); signal dis_sig:std_logic_vector(5 downto 0); signal cnk2:std_logic_vector(2 downto 0); begin

Page 30: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 22 - VLSI Training System

--*************************** Pulse Generator ****************** p0:process(RESET,CLK_4M,pulsegen) begin if (RESET = '1') then pulsegen <= "0000000000000000000000"; elsif rising_edge (CLK_4M) then if (pulsegen = "1111010000100100000000") then pulsegen <= "0000000000000000000000"; else pulsegen <= pulsegen + 1; end if; end if; end process; ---------- Enable signal to generate 1-sec pulse for sec1 counter enable <= '1' when pulsegen = "1111010000100100000000" else --enable signal for sec1 counter '0'; --************************ Second_cntr1 ************************* p1:process (RESET,CLK_4M,sec1_rg,enable,load) --decade counter begin if (RESET = '1') then sec1_rg <= "0000"; elsif load = '1' then sec1_rg <= "0100"; elsif rising_edge(CLK_4M) then if (enable = '1') then if (sec1_rg = "1001")then sec1_rg <= "0000"; else sec1_rg <= sec1_rg + 1; end if; end if; end if; sec1 <= sec1_rg; end process ; -----------------------tc signal to start sec2 counter---------------------------------- tc <= '1' when (sec1_rg = "1001") and (enable = '1') else --signal for sec2 counter '0'; --************************* Second_cntr2 *********************** p2:process (RESET,CLK_4M,sec2_rg,tc,load) --sec2 counter for reading upto 59 sec begin if (RESET = '1') then sec2_rg <= "0000"; elsif (load = '1') then sec2_rg <= "0100"; elsif rising_edge(CLK_4M) then if (tc = '1') then if (sec2_rg = "0101")then sec2_rg <= "0000"; else sec2_rg <= sec2_rg + 1; end if; end if; end if;

Page 31: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 23 - VLSI Training System

sec2 <= sec2_rg; end process; -----------------------------tc1 signal to start min1 counter------------------------ tc1 <= '1' when (sec2_rg = "0101") and (tc = '1') else '0' ; --************************ Minute_cntr1 ************************* p3:process(RESET,CLK_4M,min1_rg,tc1,load) -- min1 counter begin if (RESET = '1') then min1_rg <= "0000"; elsif load = '1' then min1_rg <= "0100"; elsif rising_edge(CLK_4M) then if (tc1 = '1') then if (min1_rg = "1001")then min1_rg <= "0000"; else min1_rg <= min1_rg + 1; end if; end if; end if; min1 <= min1_rg; end process; --------------------------tc2 signal to start min2 counter---------------------------- tc2 <= '1' when (min1_rg ="1001") and (tc1 = '1') else --pulse for min2 counter '0'; --************************ Minute_cntr2 ************************* p4:process(RESET,CLK_4M,min2_rg,tc2,load) --min2 counter begin if (RESET = '1') then min2_rg <= "0000"; elsif load = '1' then min2_rg <= "0100"; elsif rising_edge(CLK_4M) then if (tc2 = '1') then if (min2_rg = "0101")then min2_rg <= "0000"; else min2_rg <= min2_rg + 1; end if; end if; end if; min2 <= min2_rg; end process; --------------------------tc3 signal to start hr1 counter---------------------------------- tc3 <= '1' when (min2_rg ="0101") and (tc2 = '1') else '0'; --************************ Hour_cntr1 *************************

Page 32: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 24 - VLSI Training System

p5:process(RESET,CLK_4M,hr1_rg,tc3,load,control,tc6,tc5) --hr1 counter begin if (RESET = '1') then hr1_rg <= "0000"; elsif (load = '1') then hr1_rg <= "0001"; elsif rising_edge(CLK_4M) then if control = '1' then if (tc5 = '1') then hr1_rg <= "0000"; else if (tc3 = '1') then if (hr1_rg = "1001")then hr1_rg <= "0000"; else hr1_rg <= hr1_rg + 1; end if; end if; end if; else if (tc6 = '1') then hr1_rg <= "0001"; else if (tc3 = '1') then if (hr1_rg = "1001")then hr1_rg <= "0000"; else hr1_rg <= hr1_rg + 1; end if; end if; end if; end if; end if; hr1 <= hr1_rg; end process; ---------------------tc4 signal to start hr2 counter-------------------------- tc4 <= '1' when (hr1_rg ="1001") and (tc3 = '1') else '0'; ------------------------tc5 signal to RESET at 23:59:59-------------------------- tc5 <= '1' when (hr2_rg ="0010")and (hr1_rg ="0011") and (tc3 = '1') else '0'; -----------------------------tc6 signal to RESET at 11:59:59--------------- tc6 <= '1' when (hr2_rg = "0001") and (hr1_rg = "0010") and (tc3 = '1') else '0'; --************************ Hour_cntr2 ************************* p6:process(RESET,CLK_4M,hr2_rg,tc4,load,control) --hr2 counter begin if (RESET = '1') then hr2_rg <= "0000"; elsif load = '1' then hr2_rg <= "0000";

Page 33: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 25 - VLSI Training System

elsif rising_edge(CLK_4M) then if (control = '1') then if (tc5 = '1') then hr2_rg <="0000"; else if (tc4 = '1') then if (hr2_rg = "0010")then hr2_rg <= "0000"; else hr2_rg <= hr2_rg + 1; end if; end if; end if; else if (tc6 = '1') then hr2_rg <="0000"; else if (tc4 = '1') then if (hr2_rg = "0001")then hr2_rg <= "0000"; else hr2_rg <= hr2_rg + 1; end if; end if; end if; end if; end if; hr2 <= hr2_rg; end process; p14:process(RESET, pulsegen(9)) begin if (RESET = '1') then cnk2 <= "000"; elsif rising_edge(pulsegen(9)) then if (cnk2 = "101") then cnk2 <= "000"; else cnk2 <= cnk2 + 1; end if; end if; end process; mout <= sec1 when cnk2 = "000" else sec2 when cnk2 = "001" else min1 when cnk2 = "010" else min2 when cnk2 = "011" else hr1 when cnk2 = "100" else hr2 when cnk2 = "101"; --********hgfedcba**************************** sgout <= "11000000" when mout = "0000" else "11111001" when mout = "0001" else "10100100" when mout = "0010" else "10110000" when mout = "0011" else "10011001" when mout = "0100" else

Page 34: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 26 - VLSI Training System

"10010010" when mout = "0101" else "10000010" when mout = "0110" else "11111000" when mout = "0111" else "10000000" when mout = "1000" else "10011000" when mout = "1001" else "11111111" ; dis_sig <= "111110" when cnk2 = "000" else "111101" when cnk2 = "001" else "111011" when cnk2 = "010" else "110111" when cnk2 = "011" else "101111" when cnk2 = "100" else "011111" ;--when cnk2 = "101" ; RTC_SEG <= not sgout; RTC_DIS <= not dis_sig; end Behavioral;

Table 6: Real Clock Timer Interface to SPARTAN-3 FPGA net CLK_4M loc = p181 net RESET loc = p182 net load loc = p57 net control loc = p52 net RTC_SEG<7> loc = p31 net RTC_SEG<6> loc = p33 net RTC_SEG<5> loc = p28 net RTC_SEG<4> loc = p29 net RTC_SEG<3> loc = p26 net RTC_SEG<2> loc = p27 net RTC_SEG<1> loc = p20 net RTC_SEG<0> loc = p24 net RTC_DIS<5> loc = p16 net RTC_DIS<4> loc = p15 net RTC_DIS<3> loc = p19 net RTC_DIS<2> loc = p18 net RTC_DIS<1> loc = p21 net RTC_DIS<0> loc = p22

Page 35: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 27 - VLSI Training System

CHAPTER 7 ADC - DAC Interface (OPTIONAL)

SPARTAN-III IM Board has a high speed, 8 bit ADC (ADC 0808) and DAC (AD 7541), which are assembled on add on board MXS3DB0507-003-ADC-DAC. This card designed for single channel ADC DAC. A detailed interface is as shown in Figure 2

Figure 8: FPGA – ADC DAC Interface

7.4 Analog INPUT Connector: • Vin: One PUT connector (J1) is provided on board for ANALOG INPUT

Table 7 : Analog Input

Vin Vin Gnd

7.1 ANALOG INPUT • Single channel ADC – ADC0808 (Resolution – 8 bits, Conversion Time – 100 us), as shown

in Figure 3. This Add on card has following specifications Input range:-0 to 5 Volts Over voltage Protection on channel input using external clamping diodes. Through Channel 1 takes an external analog input from the “TERMINAL BLOCK”.

Page 36: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 28 - VLSI Training System

Figure 9: Input Channel of ADC

7.3 ANALOG OUTPUT Single analog output channel is provided on-board with DAC – AD7541 • Output Range +5 V to -5 Volts, single ended • Resolution - 12 bit. • Conversion time - 100 ns • Settling time – 600 ns. • Output Range -0 to 5 Volts.

7.4 Analog Output Connector: • Vout : One PUT connector (J2) is provided on board for ANALOG OUTPUT

Table 8: Analog Output

Vout Vout Gnd

Table 9: ADC Interface to SPARTAN III FPGA

Data Bits FPGA pin adc_data<0> p11 adc_data<1> p7 adc_data<2> p10 adc_data<3> p204 adc_data<4> p9 adc_data<5> p4 adc_data<6> p2 adc_data<7> p3

Table 10: Control Inputs to ADC Control Inputs FPGA PIN

clk p181 rst p182

adc_clk p5 ale p205

endconv p200 strtconv p203

Page 37: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 29 - VLSI Training System

Table 11: DAC Interface to FPGA Data Bits FPGA PIN

dac_data<0> p184 dac_data<1> p187 dac_data<2> p190 dac_data<3> p194 dac_data<4> p197 dac_data<5> p198 dac_data<6> p199 dac_data<7> p196 dac_data<8> p191 dac_data<9> p189

dac_data<10> p185 dac_data<11> p183

Page 38: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 30 - VLSI Training System

VHDL CODE FOR ADC-DAC LOOPBACK library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; ---- Uncomment the following library declaration if instantiating ---- any Xilinx primitives in this code. --library UNISIM; --use UNISIM.VComponents.all; entity test_ADC_DAC is port( clk : in std_logic;---- 4MHz system clk rst : in std_logic ;--- reset -------------------ADC INTERFACE------------------------- strtconv : out std_logic;-----convstart ale : out std_logic;--- addr latch enble --addr :out std_logic_vector(1 downto 0);----addr of chanel --channel : in std_logic_vector(1 downto 0);----switch input endconv :in std_logic;--- end of conv adc_clk : out std_logic;----clk to adc adc_data : in std_logic_vector(7 downto 0);---data from adc ------------------DAC LOOP BACK--------------------------- dac_data : out std_logic_vector(11 downto 0)---data to dac ); end test_ADC_DAC; architecture Behavioral of test_ADC_DAC is type state is(ale_s0,strt_s0,ale_s1,strt_s1,wait_eoc,read0,read1,end_st); signal ps,ns : state; signal ale_sig,soc_sig,rd : std_logic; signal adcclk_sig,fsmclk : std_logic; signal adcdat_sig : std_logic_vector(11 downto 0); signal counter : std_logic_vector( 5 downto 0); signal clkdiv : std_logic_vector(15 downto 0 ); begin ale <=ale_sig; strtconv<=soc_sig; --------------------------countr for 150KHz----------------------------- process (rst,clk,counter) begin if(rst = '1' or counter = "11010")then counter <= (others => '0'); elsif(clk'event and clk= '1') then counter <= counter + 1; end if; end process; fsmclk <= '1' when counter = "11001" else '0'; -------- 150kHz clk for FSM ------------------Frequency Divider for 500KHz------------------------------- process( clk,rst) begin if(rst = '1')then clkdiv <= (others=>'0');

Page 39: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 31 - VLSI Training System

elsif(clk'event and clk ='1') then clkdiv <= clkdiv + 1; end if; end process; adcclk_sig <= clkdiv(1); adc_clk <= adcclk_sig; -----1MHz clk to adc --fsmclk <= adcclk_sig; --fsmclk<= clk; ------------------State machine------------------------------------------------ process(fsmclk,rst) begin if(rst = '1') then ps <= ale_s0; elsif(fsmclk'event and fsmclk='1')then ps <= ns; end if; end process; --------------------------------------------------------------------- process(ps) begin case ps is when ale_s0 => ns <= strt_s0; when strt_s0 => ns <= ale_s1; when ale_s1 => ns <= strt_s1; when strt_s1 => ns <= wait_eoc; when wait_eoc => if (endconv ='1') then ns <= read0; else ns <= wait_eoc; end if; when read0 => ns <= read1; when read1 => ns <= end_st; when end_st => ns <= ale_s0; when others => ns <= ale_s0; end case; end process; ------------------------------------------------------------------------- process(ps) begin ale_sig<= '0'; soc_sig <= '0'; rd <= '0'; case ps is when ale_s0 => ale_sig <= '1'; soc_sig <= '0'; when strt_s0 => soc_sig <= '1'; ale_sig <= '1'; when ale_s1=> ale_sig <= '0'; soc_sig <= '1';

Page 40: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 32 - VLSI Training System

when strt_s1 => soc_sig <= '0'; when read0 => rd <= '1'; when read1 => rd <='1'; when others=> ale_sig<= '0'; soc_sig <= '0'; rd <= '0'; end case; end process; -----------------------------Latching ADC output------------------------ process(adcclk_sig,rst) begin if(rst='1')then adcdat_sig <= (others=>'0'); elsif(adcclk_sig'event and adcclk_sig ='1')then if(rd='1')then adcdat_sig <= adc_data & "0000"; end if; end if; end process; dac_data <= adcdat_sig; -------ADC DAC LoopBack ----------------Channel Selection -------------------------------------- --addr <= "00" when channel = "00" else ---Input to ADC through Thermister circuit. -- "01" when channel = "01" else ---Input to ADC through PUT -- "10"; ---Input to ADC through Stereo Jack. end Behavioral;

Page 41: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 33 - VLSI Training System

CHAPTER 8 Connector Details

SPARTAN 3 –IM Board has provision for 3 connectors.

8.1 DIGITAL IOs. For XC3S400 (PQ208) IOs from FPGA are provided on Connectors as follows:- • I/O Connector - A 16 pin FRC male connector (J6) – for RTC Interface. • I/O Connector - A 40 pin FRC male connector (J3) – for Traffic Light Controller Interface • I/O Connector – A 34 pin FRC male connector (J7) –Free user IOs • JTAG Connector2- A 10 pin FRC male connector (J5).-

Table 12: IO Connector Interface to FPGA SIGNAL NAME FPGA PIN NO J7 CONNECTOR net "IO<1>" loc = "p184"; #J7-1 net "IO<2>" loc = "p183"; #J7-2 net "IO<3>" loc = "p187"; #J7-3 net "IO<4>" loc = "p185"; #J7-4 net "IO<5>" loc = "p190"; #J7-5 net "IO<6>" loc = "p189"; #J7-6 net "IO<7>" loc = "p194"; #J7-7 net "IO<8>" loc = "p191"; #J7-8 net "IO<9>" loc = "p197"; #J7-9 net "IO<10>" loc = "p196"; #J7-10 net "IO<11>" loc = "p199"; #J7-11 net "IO<12>" loc = "p198"; #J7-12 net "IO<13>" loc = "p203"; #J7-13 net "IO<14>" loc = "p200"; #J7-14 net "IO<15>" loc = "p205"; #J7-15 net "IO<16>" loc = "p204"; #J7-16 net "IO<17>" loc = "p3"; #J7-17 net "IO<18>" loc = "p2"; #J7-18 net "IO<19>" loc = "p5"; #J7-19 net "IO<20>" loc = "p4"; #J7-20 net "IO<21>" loc = "p9"; #J7-21 net "IO<22>" loc = "p7"; #J7-22 net "IO<23>" loc = "p11"; #J7-23 net "IO<24>" loc = "p10"; #J7-24

Page 42: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 34 - VLSI Training System

CHAPTER 9 JUMPER SETTINGS

Mode Selection is done by selecting states of the mode configuration pins M0, M1, M2 (Jumpers JP4, JP5, JP6 respectively) of the device on board. Given below is the jumper setting for selecting configuration modes. 1. Boundary Scan Mode is used to configure either the PROM or PLD from PC. Number of

devices in daisy chain is selected by jumper “JP3” mentioned below. 2. To select boundary scan mode, set mode pin jumpers as follows.

Configuration Mode M2 (JP6) M1 (JP5) M0 (JP4) Master Serial Mode 0 0 0 Boundary Scan Mode 1 0 1

Jumper- JP3 connects PROM in the daisy chain if 1-2 are shorted.

3. Master Serial Mode - Is used when configuring PLD through on Board PROM.

Note- Before using this mode, PROM must be programmed using Boundary Scan mode. After programming the PROM, power off the kit and set jumpers as follows to select master serial mode. Configuration Mode M2 (JP6) M1 (JP5) M0 (JP4) Master Serial Mode 0 0 0

Clock Enable Jumpers - Jumpers will enable clock

1…2 JP1 (oscclk)

JP2 (clock)

Page 43: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 35 - VLSI Training System

CHAPTER 10 Clock and Reset Sources

The SPARTAN-3-IM board has a dedicated 4 MHz oscillator source and an optional socket for another clock oscillator source. This dedicated clock source can be used to derive other frequencies using DLL (Delay locked loops) available in SPARTAN-3 FPGA. Clock DLLs for clock distribution delay compensation and clock domain control. The interface details of clock and reset with FPGA is given in Table 14.

Table 13: IO Clock-Reset Interface to FPGA Control Bit FPGA Pin

CLOCK 181

OSCLK 180

RESET 182

Page 44: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 36 - VLSI Training System

CHAPTER 11 Power Supplies

SPARTAN-3 -IM board is provided with a regulated power supply of + 5V DC output. This supply is used to generate the required on board supply voltages. Output of the regulated power supply is given to power connector present on board. The power LED (Red LED) lights up when power is properly applied to the board.

11.1 Voltage Regulators The list of various voltage regulators present on board are as given in Table 15.

Table 14: Power Supply Details Voltage Source

+ 5 V DC Generated from external power supply provided along with the SPARTAN-3 -IM

+ 3.3 V DC A regulated 3.3 V DC supply is generated on board using a voltage regulator LM317 with input voltage of 5 Volts

+2.5 V DC A regulated 2.5 V DC supply is generated onboard using a voltage regulator LM317 with input voltage of 5 Volts

+1.2 V DC A regulated 1.2 V DC supply is generated on board using a voltage regulator LT1963A with input voltage of 3.3V Volts

Overall, the 9V DC switching power adapter powers the board. A 3.3V regulator, powered by the 5V DC supply, provides power to the inputs of the 2.5V and 1.2V regulators. The 3.3V regulator feeds all the VCCIO voltage supply inputs to the FPGA’s I/O banks and powers most of the components on the board. The 1.2V regulator feeds to the FPGA’s VCCINT voltage inputs, which power the FPGA’s core logic.

Page 45: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 37 - VLSI Training System

APPENDIX A Consolidated UCF for the Complete Board

Clock and Reset net "RESET" loc = "p182"; net "CLK_4M" loc = "p181"; net "CLK_OPT" loc = "p180";

KEYS net "RL<0>" loc = "p96"; net "RL<1>" loc = "p95"; net "RL<2>" loc = "p94"; net "RL<3>" loc = "p85"; net "SL<0>" loc = "p86"; net "SL<1>" loc = "p87"; net "SL<2>" loc = "p90"; net "SL<3>" loc = "p93";

RS232 Interface net "RS232_RXD<1>" loc = "p176"; net "RS232_RXD<2>" loc = "p178"; net "RS232_TXD<1>" loc = "p175"; net "RS232_TXD<2>" loc = "p172";

LCD Interface net "LCD_D<0>" loc = "p167"; net "LCD_D<1>" loc = "p166"; net "LCD_D<2>" loc = "p165"; net "LCD_D<3>" loc = "p162"; net "LCD_D<4>" loc = "p161"; net "LCD_D<5>" loc = "p156"; net "LCD_D<6>" loc = "p155"; net "LCD_D<7>" loc = "p154"; net "LCD_E" loc = "p168"; net "LCD_RS" loc = "p171"; net "LCD_RW_BAR" loc = "p169";

Seven Segment Interface net "SEGA" loc = "p144"; net "SEGB" loc = "p143"; net "SEGC" loc = "p141"; net "SEGD" loc = "p140"; net "SEGDP" loc = "p135"; net "SEGE" loc = "p139"; net "SEGF" loc = "p138"; net "SEGG" loc = "p137";

Display net "DIS<0>" loc = "p97"; net "DIS<1>" loc = "p100"; net "DIS<2>" loc = "p101"; net "DIS<3>" loc = "p102"; net "DIS<4>" loc = "p132";

net "DIS<5>" loc = "p133";

Input Switches net "IL<0>" loc = "p57"; net "IL<10>" loc = "p40"; net "IL<11>" loc = "p39";

Page 46: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 38 - VLSI Training System

net "IL<12>" loc = "p37"; net "IL<13>" loc = "p36"; net "IL<14>" loc = "p35"; net "IL<15>" loc = "p34"; net "IL<1>" loc = "p52"; net "IL<2>" loc = "p51"; net "IL<3>" loc = "p50"; net "IL<4>" loc = "p48"; net "IL<5>" loc = "p46"; net "IL<6>" loc = "p45"; net "IL<7>" loc = "p44"; net "IL<8>" loc = "p43"; net "IL<9>" loc = "p42";

Test LEDs net "OL<0>" loc = "p68"; net "OL<1>" loc = "p67"; net "OL<2>" loc = "p65"; net "OL<3>" loc = "p64"; net "OL<4>" loc = "p63"; net "OL<5>" loc = "p62"; net "OL<6>" loc = "p61"; net "OL<7>" loc = "p58"; net "OL<8>" loc = "p80"; net "OL<9>" loc = "p79"; net "OL<10>" loc = "p78"; net "OL<11>" loc = "p77"; net "OL<12>" loc = "p76"; net "OL<13>" loc = "p74"; net "OL<14>" loc = "p72"; net "OL<15>" loc = "p71";

IOs net "IO<1>" loc = "p184"; net "IO<2>" loc = "p183"; net "IO<3>" loc = "p187"; net "IO<4>" loc = "p185"; net "IO<5>" loc = "p190"; net "IO<6>" loc = "p189"; net "IO<7>" loc = "p194"; net "IO<8>" loc = "p191"; net "IO<9>" loc = "p197"; net "IO<10>" loc = "p196"; net "IO<11>" loc = "p199"; net "IO<12>" loc = "p198"; net "IO<13>" loc = "p203"; net "IO<14>" loc = "p200"; net "IO<15>" loc = "p205"; net "IO<16>" loc = "p204";

net "IO<17>" loc = "p3"; net "IO<18>" loc = "p2"; net "IO<19>" loc = "p5"; net "IO<20>" loc = "p4"; net "IO<21>" loc = "p9"; net "IO<22>" loc = "p7"; net "IO<23>" loc = "p11"; net "IO<24>" loc = "p10";

TRAFFIC LIGHT CONTROLLER SIGNAL NAME FPGA PIN NO. CONNECTOR J3 PINNO.

net "TRC_LE" loc = "p107"; #J3-20 net "TRC_LN" loc = "p125"; #J3-9 net "TRC_LS" loc = "p150"; #J3-25

Page 47: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 39 - VLSI Training System

net "TRC_LW" loc = "p130"; #J3-6 net "TRC_PEG" loc = "p116"; #J3-16 net "TRC_PER" loc = "p117"; #J3-15 net "TRC_PNG" loc = "p128"; #J3-7 net "TRC_PNR" loc = "p124"; #J3-10 net "TRC_PSG" loc = "p12"; #J3-28 net "TRC_PSR" loc = "p13"; #J3-27 net "TRC_PWG" loc = "p148"; #J3-2 net "TRC_PWR" loc = "p149"; #J3-1 net "TRC_RE" loc = "p114"; #J3-18 net "TRC_REDE" loc = "p109"; #J3-22 net "TRC_REDN" loc = "p120"; #J3-13 net "TRC_REDS" loc = "p108"; #J3-21 net "TRC_REDW" loc = "p126"; #J3-8 net "TRC_RN" loc = "p122"; #J3-12 net "TRC_RS" loc = "p111"; #J3-23 net "TRC_RW" loc = "p147"; #J3-3 net "TRC_SE" loc = "p115"; #J3-17 net "TRC_SN" loc = "p123"; #J3-11 net "TRC_SS" loc = "p152"; #J3-26 net "TRC_SW" loc = "p146"; #J3-4 net "TRC_YE" loc = "p106"; #J3-19 net "TRC_YN" loc = "p119"; #J3-14 net "TRC_YS" loc = "p113"; #J3-24 net "TRC_YW" loc = "p131"; #J3-5

#Abbreviations Used: #PS-G – Pedestrian South Green #PN-R- Pedestrian North Red #PS-R – pedestrian South Red #PN-G – Pedestrian North Green #RS – Right South #RED-E – Red East #LS – Left South #YE – Yellow East #SS – Straight South #SE – Straight East #YS – Yellow South #RE – Right East #RED-S – Red South #LE – Left East #PW-R – Pedestrian west red #PE-G – Pedestrian East green #PW-G – Pedestrian west Green #PE-R – Pedestrian East Red #LW – Left West #RED-N – Red North #SW – South West #YN - Yellow North #RW – Right West #LN – Left North #YW – yellow West #RN – Right north #RED-W – Red West #SN – Straight North

Page 48: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 40 - VLSI Training System

REAL TIME CLOCK SIGNAL NAME FPGA PIN NO. J6 CONNECTOR

net "RTC_DIS<0>" loc = "p16"; #J6-13 net "RTC_DIS<1>" loc = "p15"; #J6-14 net "RTC_DIS<2>" loc = "p19"; #J6-11 net "RTC_DIS<3>" loc = "p18"; #J6-12 net "RTC_DIS<4>" loc = "p21"; #J6-9 net "RTC_DIS<5>" loc = "p22"; #J6-10 net "RTC_SEGA" loc = "p24"; #J6-7 net "RTC_SEGB" loc = "p20"; #J6-8 net "RTC_SEGC" loc = "p27"; #J6-5 net "RTC_SEGD" loc = "p26"; #J6-6

net "RTC_SEGDP" loc = "p31"; #J6-2 net "RTC_SEGE" loc = "p29"; #J6-3 net "RTC_SEGF" loc = "p28"; #J6-4 net "RTC_SEGG" loc = "p33"; #J6-1

Page 49: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 41 - VLSI Training System

APPENDIX B Operating Instructions To Start A New Design

B.1 Starting The ISE Software: • Start ISE from the Start menu by selecting Start -> Programs -> Xilinx ISE Project

Navigator.

B.2 Design Flow • DESIGN ENTRY • SIMULATION • SYNTHESIS • IMPLEMENTATION • DEVICE PROGRAMMING

Sample Design of Half Adder is used to explain the Design Flow.

B.3 Design Description

Page 50: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 42 - VLSI Training System

B.4 Truth Table of Half adder: -

Inputs Output A B Sum Carry

0 0 0 0

0 1 1 0

1 0 1 0

1 1 0 1

B.5 VHDL Code for Half adder library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity half_adder is Port ( a : in std_logic; b : in std_logic; c : in std_logic; sum : out std_logic; carry : out std_logic); end full_adder; architecture Behavioral of half_adder is begin sum <= a xor b ; carry <= a and b; end Behavioral;

B.6 Steps to implement the Half adder in the FPGA using Xilinx ISE(8.1i) Step 1 : Start the Xilinx Project Navigator by using the desktop shortcut or by using the Start

Programs Xilinx ISE (8.1i).

SOURCE WINDOW

PROCESS WINDOW

WORK SPACE

TRANSCRIPT

Page 51: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 43 - VLSI Training System

Step 2 Create a new project In the window go to FILE New project. Specify the project name and location and say NEXT

Select Device. Use the pull-down arrow to select the Value for each Property Name. Click in the field to access the pull-down list.

Say FINISH. Project summary is seen.

Page 52: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 44 - VLSI Training System

Step 3: Creating a new VHD file Click on the symbol of FPGA device and then right click Click on new source

VHDL module and give the File name

Then say Next Define ports.In this case

• a and b are the input ports defined as in • sum and carry are output ports defined as out

after this say Next twice and then Finish Skeleton of the design is shown in the VHDL editor.

VHDL MODULE

Page 53: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 45 - VLSI Training System

Step 4: Writing the Behavioural VHDL Code in VHDL Editor

Sample code is given below for this experiment.

Step 5 Check Syntax

Run the Check syntax Process window synthesize check syntax >, and remove errors if present.

Page 54: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 46 - VLSI Training System

Step 6 Creating a test bench file Verify the operation of your design before you implement it as hardware. Simulation can be done using ISE simulator. For this click on the symbol of FPGA device and then right click Click on new source Test Bench Waveform and give the name Select entity Finish.

Select the desired parameters for simulating your design. In this case combinational circuit and Simulation time.

Page 55: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 47 - VLSI Training System

Step 7: Simulate the code Simulation Tools ISE tool supports the following simulation tools: • HDL Bencher is an automated test bench creation tool. It is fully integrated with

Project Navigator. • ModelSim from Model Technology, Inc., is integrated in Project Navigator to

simulate the design at all steps (Functional and Timing). ModelSim XE, the Xilinx Edition of Model Technology, Inc.’s ModelSim application, can be installed from the MTI CD included in your ISE Tool

In source Window from the Drop-down menu select Behavioural Simulation to view the created test Bench file.

Click on test bench file. Test bench file will open in main window. Assign all the signals

and save File. From the source of process window. Click on Simulate Behavioral Model in Process window.

FOR SIMULATION

Page 56: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 48 - VLSI Training System

Verify your design in wave window by seeing behaviour of output signal with respect to input signal. Close the ISE simulator window

SIMULATED OUTPUT

Page 57: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 49 - VLSI Training System

Step 8: Synthesize the design using XST.

Translate your design into gates and optimize it for the target architecture. This is the synthesis phase. Again for synthesizing your design, from the source window select, 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, (warnings

are OK). Check the synthesis report.

If there are any errors correct it and rerun synthesis.

SYNTHESIS

Page 58: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 50 - VLSI Training System

Step 9: Create Constraints File(UCF) Click on the symbol of FPGA device and then right click Click on new source

Implementation Constraints File and give the name Select entity Finish. Click on User Constraint and in that Double Click on Assign Package Pins option in Process window. Xilinx PACE window opens. Enter all the pin assignments in PACE., depending upon target device and number of input and outputs used in your design. (sample code is given below for given design.)

SYNTHESIS COMPLETED

SUCCESSFULLY

PIN ASSIGNMENT

Page 59: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 51 - VLSI Training System

Step 10: Implementing a Design

Once synthesis is complete, you can place and route your design to fit into a Xilinx device, and you can also get some post place-and-route timing information about the design. The implementation stage consists of taking the synthesized netlist through translation, mapping, and place and route. To check your design as it is implemented, reports are available for each stage in the implementation process. Use the Xilinx Constraints Editor to add timing and location constraints for the implementation of your design. This procedure runs you through the basic flow for implementation. Right-click on Implement Design, and choose the Run option, or double left-click on Implement Design.

Step 11: Generating Programming File Right-click on Generate Programming File, choose the Run option, or double left-click on Generate Programming File. This will generate the Bit stream

Step 12 Downloading in Boundary Scan Mode. Note : Xilinx provides 2-tools for downloading purpose, viz. • iMPACT - is a command line and GUI based tool • PROM File Formatter

IMPLEMENTATION DONE

Page 60: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 52 - VLSI Training System

BOUNDARY SCAN MODE

Page 61: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 53 - VLSI Training System

Procedure for downloading using iMPACT

2. Boundary Scan Mode 1. Right click on “Configure Device (iMPACT)” -> and Say RUN or Double click

on “Configure Device (iMPACT)”. 2. Right click in workspace and say Initialize chain .The device is seen. 3. Right click on the device and say Program.

If the device is programmed properly, it says Programming Succeeded or else. Programming Failed. The DONE Led glows green if programming succeeds.

Note: Before downloading make sure that Protoboard is connected to PC's parallel port with the cable provided and power to the Protoboard is ON.

Step 13: Apply input through DIP Switches, output is displayed on LEDs Step 14: Configuration through PROM: Generating PROM file:

FPGA can also be configured in Master Serial Mode through PROM. For this you need to program the PROM through a .mcs file.

Page 62: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 54 - VLSI Training System

Right click on “Generate PROM,ACE or JTAG file” -> and Say RUN or Double click on “Generate PROM,ACE or JTAG file”

Specify the PROM file name and location where it is to be generated.

Specify the desired parameters of the PROM on board and say ADD then FINISH

Page 63: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 55 - VLSI Training System

Say Generate File from the Process Window.

Page 64: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 56 - VLSI Training System

PROGRAMMING THE PROM

Note: Check the Jumper setting on the board. Refer the Chapter jumper Setting Similar to Step 12.Initialize chain through iMPACT. PROM and FPGA devices on board are seen .Assign the generated mcs file and bit file as desired. Right click the PROM symbol and say PROGRAM.

Now, whenever the board is powered on in master serial mode, FPGA is configured through PROM automatically.

Page 65: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 57 - VLSI Training System

APPENDIX C SAMPLE CODES

Some experiments which can be implemented and verified using VLSI kit: • FIFO memory. • Configurable UART. • Programmable timer. • Functionality of keyboard with debounce logic. • Functionality of 6821 where each port can act as input or output i.e. bit programmable ports. • Programmable interrupt controller. • Programmable Peripheral interface (8255). • DMA controller Given below is a sample design for a Keyboard / Display Interface.

C.1 keyboard-display & I/O interface test code library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity keydis is Port (

rst : in std_logic; Clock : in std_logic;

-- keyboard return and scan lines

ret_lin : in std_logic_vector(3 downto 0); scan_lin : out std_logic_vector(3 downto 0);

-- display i/os segments and display selects

segments : out std_logic_vector(7 downto 0); dis_sel : out std_logic_vector(3 downto 0);

-- Input switches and output leds

input_s : in std_logic_vector(15 downto 0); output_s : out std_logic_vector(15 downto 0)

); end keydis; ------------------------------------------------------------ architecture Behavioral of keydis is ------------------------------------------------------------ signal Divider : std_logic_vector(20 downto 0); signal SClock, DClock, ORed, Interrupt : std_logic; signal Scan, Decoded : std_logic_vector(1 downto 0); signal SL_S,D,Display_s : std_logic_vector(3 downto 0); ---------------------------------------- begin ---------Clock Divider---------- process(rst, Clock) begin

if(rst = '1')then Divider <= (others=>'0');

elsif(Clock'event and Clock = '1')then Divider <= Divider + 1;

end if;

Page 66: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 58 - VLSI Training System

end process; -----------------Scan & Debounce clock-------------- SClock <= Divider(14); DClock <= Divider(11); ------------------Scan Counter---------------------- process(SClock, Rst) begin

if(Rst = '1')then Scan <= (others=>'0');

elsif(SClock'event and SClock='1')then Scan <= Scan + 1;

end if; end process; SL_S <= "0111" when Scan = "00" else

"1011" when Scan = "01" else "1101" when Scan = "10" else "1110" ;

scan_lin <= SL_S; ORed <= (not ret_lin(0)) or (not ret_lin(1)) or (not ret_lin(2)) or (not ret_lin(3)); process(Rst,DClock) begin

if(Rst = '1')then D <=(others => '0');

elsif(DClock'event and DClock = '1')then D <= D(2 downto 0) & ORed;

end if; end process; Interrupt <= '1' when(D = "1111")else

'0'; Decoded <= 00" when (ret_lin = "0111") else

"01" when (ret_lin = "1011") else "10" when (ret_lin = "1101") else "11";

process(Interrupt, Rst) begin

if(Rst = '1')then Display_s <= (others=>'0');

elsif(Interrupt'event and Interrupt = '1')then Display_s <= Scan & Decoded;

end if; end process; ------------------------------------------------------------ -- .a. -- f| |b -- .g. -- e| |c -- .d. -- dphgfedcba Segments <= "01000000" when Display_s ="0000" else --0

"01111001" when Display_s ="0001" else --1 "00100100" when Display_s ="0010" else --2 "00110000" when Display_s ="0011" else --3

Page 67: Fpga-01 Sp3 Im Manual (1)

FPGA-01: SPARTAN - III Protoboard

- 59 - VLSI Training System

"00011001" when Display_s ="0100" else --4 "00010010" when Display_s ="0101" else --5 "00000010" when Display_s ="0110" else --6 "01111000" when Display_s ="0111" else --7 "00000000" when Display_s ="1000" else --8 "00010000" when Display_s ="1001" else --9 "00001000" when Display_s ="1010" else --A "00000011" when Display_s ="1011" else --B "01000110" when Display_s ="1100" else --C "00100001" when Display_s ="1101" else --D "00000110" when Display_s ="1110" else --E "00001110" when Display_s ="1111" else --F "01000000";

dis_sel <= (others=>'0'); -- test input switches and output leds output_s <= input_s; end Behavioral; For Pin Locking refer the pin out diagram of the specific adapter and the device used on that adapter.( Refer -APPENDIX.A ) UCF for above code Net "CLOCK" loc = p181; # DISPLAY SELECTION Net "RST" loc = p182; Net "dis_sel<0>" loc = p106; Net "ret_lin<0>" loc = p94; Net "dis_sel<1>" loc = p107;; Net "ret_lin<1>" loc = p93; Net "dis_sel<2>" loc = p108 Net "ret_lin<2>" loc = p90; Net "dis_sel<3>" loc = p109; Net "ret_lin<3>" loc = p87; Net "dis_sel<4>" loc = p137

Net "dis_sel<5>" loc = p138; Net "scan_lin<0>" loc = p86; Net "segments<0>" loc = p111; Net "scan_lin<1>" loc = p85 Net "segments<1>" loc = p113; Net "scan_lin<2>" loc = p80; Net "segments<2>" loc = p114; Net "scan_lin<3>" loc= p79; Net "segments<3>" loc = p115;

Net "segments<4>" loc = p116; ; Net "segments<5>" loc = p117; Net “segments<6>" loc = p119; Net "segments<7>" loc = p120;

Input switches Output LEDs

Net "IL<0>" loc =p102; Net "OL<0>" loc = p65; Net "IL<1>" loc =p101; Net "OL<1>" loc = p64; Net "IL<2>" loc =p100; Net "OL<2>" loc = p63; Net "IL<3>" loc = p97; Net "OL<3>" loc = p62; Net "IL<4>" loc = p96; Net "OL<4>" loc = p61; Net "IL<5>" loc = p95; Net "OL<5>" loc = p58; Net "IL<6>" loc = p51; Net "OL<6>" loc = p57; Net "IL<7>" loc = p50; Net "OL<7>" loc = p52; Net "IL<8>" loc = p39; Net "OL<8>" loc = p78; Net "IL<9>" loc = p40; Net "OL<9>" loc = p77; Net "IL<10>" loc =p42; Net "OL<10>" loc = p76; Net "IL<11>" loc =p43; Net "OL<11>" loc = p74; Net "IL<12>" loc =p44; Net "OL<12>" loc = p72; Net "IL<13>" loc =p45; Net "OL<13>" loc = p71; Net "IL<14>" loc =p46; Net "OL<14>" loc = p68; Net "IL<15>" loc =p48; Net "OL<15>" loc = p67; • After this go for Implementation Procedure. • Downloading the Program into target Device.