element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • 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 4 - Combinational Logic vs. Sequential Logic with Vivado on Artix-7 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: 10 Apr 2021 7:34 PM Date Created
  • Views 2204 views
  • Likes 9 likes
  • Comments 0 comments
  • digitalfeverch
Related
Recommended

Prototyping with FPGAs - Part 4 - Combinational Logic vs. Sequential Logic with Vivado on Artix-7 FPGA

yesha98
yesha98
10 Apr 2021

Here are the previous blogs in this series:

Prototyping with FPGAs - Part 1 - Basics

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

Prototyping with FPGAs - Part 3 - Sequential Logic with Quartus Prime on Cyclone-IV FPGA

 

image

 

Aim: To compare and analyze the performance of Shifters using Combinational Logic and Sequential Logic implemented on Artix-7 FPGA

 

Sequential Logic: The Shift Registers

 

We all know what shift registers are, and why they are used - to shift bits in a register right?

But the applications inside a CPU or Microcontroller are vast and play a crucial role in Arithmetic and Logic Units especially in ARM Processors these days.

The design given below is specific to shift right. But why? This operation was used in the vintage 8086 microprocessor to implement the ROR instruction.

 

8-bit Shift Registers Design:

image

                         image

Verilog Implementation:

image

 

Is there any other way to shift the bits?

- Yes, the barrel shifter.

 

Combinational Logic: The Barrel Shifter

image

Truth Table:

image

 

In this blog, I'm going to discuss the design and implementation of 8-bit barrel shifters using Multiplexers.

The modeling I'm going to follow is Structural design in Verilog HDL.

 

 

First of all, to get started let's design a 2:1 Mux

    imageimage

Verilog code for the 2:1 Mux in structural model is pretty simple, we have 2 AND Gates, 1 NOT Gate, and 1 OR Gate.

Apart from regular inputs and outputs, three wires are declared for the gate outputs and are connected according to the structure.

 

Design of 8-bit Barrel Shifter:

image

image

 

By using the structural design, we can make sure the design is implemented in the way we want it to be.

Verilog Implementation:

image

 

Working of Barrel Shifter :

 

 

{gallery} BS

image

No Shift

image

Shift by 1 bit (001)

image

Shift by 2 bits (010)

image

Shift by 4 bits (100)

image

Shift by 3 bits (011)

image

Shift by 7 bits (111)

 

This is how the barrel shifter shifts the bits according to the select lines.

image

 

Implementation on Artix-7 FPGA:

I will be using the USB104-A7 FPGA Development Board for the implementation. This was road-tested a few months back. Read the review here: USB104 A7: Artix-7 FPGA Development Board - Review

image

Fabrication of custom Pmod:

A custom Pmod (Peripheral Module) was to be fabricated for implementing digital designs as there was very few user I/O peripherals such as push buttons and LEDs.

Let's take a look at the schematic for the fabrication.

image         image

Design made with NI Multisim:

From the schematics, it can be understood that using a 10k resistor would be used for pull-up and pull-down purposes.

As there is already a 200 Ohm resistor connected in series to the Pmod GPIO to prevent damage to the FPGA if one accidentally drives an input as an output,

only 100 Ohm resistor is used in series with the LEDs. All switches are active high. The circuit diagram is given below:

image   image

Started with the above components, some PCB mount slide switches, LEDs, and the Bent Male-Male Dual pin headers.

After soldering all the components and the connections:

                                                            Front - end                                                                                                                                   Back-endimage   image

                                                                                 

 

Here is the general constraints file for the above-fabricated Pmod:

 

## Pmod Header JA
#set_property -dict { PACKAGE_PIN F4    IOSTANDARD LVCMOS33 } [get_ports { led[0] }]; #IO_L13P_T2_MRCC_35 Sch=ja[1]
#set_property -dict { PACKAGE_PIN F3    IOSTANDARD LVCMOS33 } [get_ports { led[1] }]; #IO_L13N_T2_MRCC_35 Sch=ja[2]
#set_property -dict { PACKAGE_PIN E2    IOSTANDARD LVCMOS33 } [get_ports { led[2] }]; #IO_L14P_T2_SRCC_35 Sch=ja[3]
#set_property -dict { PACKAGE_PIN D2    IOSTANDARD LVCMOS33 } [get_ports { led[3] }]; #IO_L14N_T2_SRCC_35 Sch=ja[4]
#set_property -dict { PACKAGE_PIN H2    IOSTANDARD LVCMOS33 } [get_ports { led[4] }]; #IO_L15P_T2_DQS_35  Sch=ja[7]
#set_property -dict { PACKAGE_PIN G2    IOSTANDARD LVCMOS33 } [get_ports { led[5] }]; #IO_L15N_T2_DQS_35  Sch=ja[8]
#set_property -dict { PACKAGE_PIN C2    IOSTANDARD LVCMOS33 } [get_ports { led[6] }]; #IO_L16P_T2_35      Sch=ja[9]
#set_property -dict { PACKAGE_PIN C1    IOSTANDARD LVCMOS33 } [get_ports { led[7] }]; #IO_L16N_T2_35      Sch=ja[10]
### Pmod Header JB
#set_property -dict { PACKAGE_PIN C4    IOSTANDARD LVCMOS33 } [get_ports { sw_b[0] }]; #IO_L7P_T1_AD6P_35     Sch=jb[1]
#set_property -dict { PACKAGE_PIN B2    IOSTANDARD LVCMOS33 } [get_ports { sw_b[1] }]; #IO_L10N_T1_AD15N_35   Sch=jb[2]
#set_property -dict { PACKAGE_PIN B3    IOSTANDARD LVCMOS33 } [get_ports { sw_b[2] }]; #IO_L10P_T1_AD15P_35   Sch=jb[3]
#set_property -dict { PACKAGE_PIN B4    IOSTANDARD LVCMOS33 } [get_ports { sw_b[3] }]; #IO_L7N_T1_AD6N_35     Sch=jb[4]
#set_property -dict { PACKAGE_PIN B1    IOSTANDARD LVCMOS33 } [get_ports { sw_b[4] }]; #IO_L9P_T1_DQS_AD7P_35 Sch=jb[7]
#set_property -dict { PACKAGE_PIN A1    IOSTANDARD LVCMOS33 } [get_ports { sw_b[5] }]; #IO_L9N_T1_DQS_AD7N_35 Sch=jb[8]
#set_property -dict { PACKAGE_PIN A3    IOSTANDARD LVCMOS33 } [get_ports { sw_b[6] }]; #IO_L8N_T1_AD14N_35    Sch=jb[9]
#set_property -dict { PACKAGE_PIN A4    IOSTANDARD LVCMOS33 } [get_ports { sw_b[7] }]; #IO_L8P_T1_AD14P_35    Sch=jb[10]
### Pmod Header JC
#set_property -dict { PACKAGE_PIN C5    IOSTANDARD LVCMOS33 } [get_ports { sw_a[0] }]; #IO_L1N_T0_AD4N_35     Sch=jc[1]
#set_property -dict { PACKAGE_PIN C6    IOSTANDARD LVCMOS33 } [get_ports { sw_a[1] }]; #IO_L1P_T0_AD4P_35     Sch=jc[2]
#set_property -dict { PACKAGE_PIN B6    IOSTANDARD LVCMOS33 } [get_ports { sw_a[2] }]; #IO_L2N_T0_AD12N_35    Sch=jc[3]
#set_property -dict { PACKAGE_PIN C7    IOSTANDARD LVCMOS33 } [get_ports { sw_a[3] }]; #IO_L4N_T0_35          Sch=jc[4]
#set_property -dict { PACKAGE_PIN A5    IOSTANDARD LVCMOS33 } [get_ports { sw_a[4] }]; #IO_L3N_T0_DQS_AD5N_35 Sch=jc[7]
#set_property -dict { PACKAGE_PIN A6    IOSTANDARD LVCMOS33 } [get_ports { sw_a[5] }]; #IO_L3P_T0_DQS_AD5P_35 Sch=jc[8]
#set_property -dict { PACKAGE_PIN B7    IOSTANDARD LVCMOS33 } [get_ports { sw_a[6] }]; #IO_L2P_T0_AD12P_35    Sch=jc[9]
#set_property -dict { PACKAGE_PIN D8    IOSTANDARD LVCMOS33 } [get_ports { sw_a[7] }]; #IO_L4P_T0_35          Sch=jc[10]

Getting Started with Vivado:

 

{gallery} Vivado

image

Create new project

image

Give the project a name without spaces

image

Choose the board

image

Finish

image

Click on add new sources

image

image

Select the files required

image

You will see the instances on the left panel

image

Add the constraints file

image

image

Give the exact constraints name

image

Regular Design flow

image

image

Make sure to add a command in the constraints file of the shift register project if you're planning to use the push button on the FPGA board as the implementation won't complete due to a clock dedicated route error.

image

 

8-bit Shift Register on Artix-7 FPGA:

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

 

8-bit Barrel Shifter on Artix-7 FPGA:

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

 

Final Comparison after implementation:

image

 

Thanks for Reading!

  • 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