element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Digital Fever
  • Challenges & Projects
  • Project14
  • Digital Fever
  • More
  • Cancel
Digital Fever
Blog Prototyping with FPGAs - Part 2 - Combinational Logic with Xilinx ISE on Spartan 6 FPGA
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Digital Fever to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: yesha98
  • Date Created: 4 Apr 2021 2:39 PM Date Created
  • Views 2594 views
  • Likes 8 likes
  • Comments 0 comments
  • digitalfeverch
Related
Recommended

Prototyping with FPGAs - Part 2 - Combinational Logic with Xilinx ISE on Spartan 6 FPGA

yesha98
yesha98
4 Apr 2021

If you haven't seen part 1 of the blog, do check it out!

Link: Prototyping with FPGAs - Part 1 - Basics

This blog deals with implementing a full adder on a Spartan-6 FPGA from scratch with an overview of Verilog HDL programming styles.

 

FPGA Design Flow:

image

Let's look at the first step

1. Design Entry:

FPGA Design entry can be done in two ways, either through an HDL which stands for Hardware Description Language - which is the most common method or through schematic entry wherein one can drag & drop and connect various blocks together or integrating both.

We shall discuss the design entry by exploring the Xilinx ISE!

 

Getting Started with Xilinx ISE:

 

{gallery} ISE

image

Launch ISE and create new project

image

Name the project (spaces not preferred) and specify location

image

Select Target device, speed grade and HDL language

image

Finish

image

Project created successfully.

 

Full Adder Circuit (Logic):

image

The functionality of the circuit is pretty simple, it adds 3 bits and gives the sum and carry output.

The truth table of full adder:

image

 

What is combinational logic?

Combinational logic is a type of digital logic that is implemented by Boolean circuits, where the output is a pure function of the present input only and the circuit does not contain any memory elements.

 

Hardware Description Languages (HDL):

There are many HDLs out there, some of the very commonly used HDLs are Verilog, VHDL, SystemVerilog. Almost all FPGA vendors support these HDLs for synthesis.

 

Let's talk about Verilog in this blog. There are 3 modeling styles in Verilog.

a) Structural: Where you describe the structure of the logic circuit in terms of gates, sometimes also called Gate-level modeling.

b) Dataflow: Dataflow modeling describes hardware in terms of the flow of data from input to output.

c) Behavioural: These contain procedural statements, which control the simulation and manipulate variables of the data types.

 

a) Full Adder Implementation using Structural modeling in Verilog:

image

module Full_Adder (
     input A, B, Cin,
     output Sum, Cout
);

     wire X1, A1, A2;

     xor gate1 (X1, A, B),
         gate2 (Sum, X1, Cin);

     and gate3 (A1, A, B),
         gate4 (A2, X1, Cin);

     or gate5 (Cout, A1, A2);

endmodule

 

b) Full Adder Implementation using dataflow modeling in Verilog:

 

image

 

module Full_Adder (
     input A, B, Cin,
     output Sum, Cout
);

     assign Sum = ( ( A ^ B ) ^ Cin ); // Sum = A xor B xor Cin
     assign Cout = ( ( (A ^ B) & Cin ) | ( A & B ) ); // Carry out as the equation

endmodule

 

c) Full Adder implementation using Behavioural modeling in Verilog:

 

module Full_Adder (
input A, B, Cin,
output reg Sum, Cout
);

always @ (A, B, Cin)
begin: add
     {Cout,Sum} = A + B + Cin;
end

endmodule

 

Preparing files for FPGA Design:

A typical FPGA Design would have 2 sets of files, one will have all the design files which specify the design and the other is the constraints file which will have all the constraints for the design such as the timing constraints and pin mappings for the FPGA.

 

It's a good practice to keep the design modular so that it's easy for development and debugging.

 

A top.v file (when Verilog is used as design language) is used to instantiate all the modules in a single top-level design in a Hierarchy.

 

 

 

{gallery} Creating a design

image

Add a new Source

image

Select Verilog module and name it top

image

Select the inputs and outputs and name them

image

The top module will now be created

image

Add a new source that has the code of the full adder

image

Instantiate the full adder in the top module.

 

2. Design Synthesis:

During the FPGA synthesis process, a high description design or an HDL design is converted into a gate-level representation or a logic component.

Now Synthesize the design

imageimage

Once Synthesis is complete we need to add the constraints file to map the pins of the FPGA with the logic elements.

Create a new source and select constrains file in the options and give it a name.

image

Almost all the FPGA development board Vendors provide a master constrains file which contains all the pins and their mappings to the FPGA.

Copy and paste the pins that you want for your project, for instance, the 2 LEDs for Sum and Carry, then 3 switches for 3 inputs.

imageimage

 

3. Design Implementation:

Now it's time to implement the design.

The Implementation tool will take the netlist as input and does optimization, placement, and routing.

imageimage

4. Design Verification:

image

This is a simple full adder design, thus it does not require verification, yet it is a good practice to do so. The design is verified using Modelsim

 

5. Generate Programming File:

The programming file is used to program the FPGA. This file contains all the information of the design implementation which is specific to an FPGA.

image  image

6. Programming:

Xilinx ISE has a specific tool called iMPACT which is used to program the FPGAs.

image

You'll get a warning asking to create an iMPACT file, click OK. Then the iMPACT tool will open, then click on Boundry Scan and then Initialize Chain.

 

{gallery} My Gallery Title

image

Click on Boundry Scan

image

Initialize Chain

image

image

Select the bit file

image

Program the device!

image

 

 

 

Output:

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

 

Thanks for reading!

Do let me know your feedback in the comments!

 

  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube