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
FPGA
  • Technologies
  • More
FPGA
Blog Vivado: how to override generic values
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join FPGA to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Jan Cumps
  • Date Created: 25 Jun 2022 8:11 PM Date Created
  • Views 1699 views
  • Likes 7 likes
  • Comments 4 comments
  • generics
  • vivado
  • summer of fpga
  • Spartan_Migration
Related
Recommended

Vivado: how to override generic values

Jan Cumps
Jan Cumps
25 Jun 2022

In HDL languages, you can define generics. These are values that are assumed by default, but can be overridden. In VHDL, this may look like this:

ENTITY spi_master IS
  GENERIC(
    data_length : INTEGER := 16);     --data length in bits
  PORT(
    -- ...................
    tx		: IN     STD_LOGIC_VECTOR(data_length-1 DOWNTO 0);  --data to transmit
    rx	   : OUT    STD_LOGIC_VECTOR(data_length-1 DOWNTO 0)); --data received
END spi_master;

We're looking at a reusable SPI Master IP in VHDL. The data length of a SPI interface is defaulting to 16 bits. When you drop this IP on the block design, you see:
image
Both tx and rx have assumed the default 16 bit length. In my design, the SPI data length is 8 bits. In ISE, where there's no block design, I would override the default value in my VHDL code, when creating the SPI module. In Vivado, where you drop the module on the block diagram, you can override the value by selecting Customise Block (it initially shows 16, the default value from the IP's design):
image
Once done, the block design (and your design) adapts to the override:
image

  • Sign in to reply
  • dang74
    dang74 over 2 years ago

    Thanks for this pointer.  It should come in handy once I start exploring Vivado a bit more.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • wolfgangfriedrich
    wolfgangfriedrich over 2 years ago in reply to Jan Cumps

    Haha, it is always 3 AM somewhere. Not sure what happened, but I was writing this comment at ~10 pm ADT, would be 3 am in central Europe. Maybe my tablet is still in vacation mode, I was in Germany a few weeks ago.  

    So far I have only used the DHL only approach. I should check out the block design, especially for a waiting project that is going to use the SDRAM on my ARTY S7 board. At work we have some top level VHDL designs that are several thousand lines long. Once you understand them, you really understand the design.

    You can always counter too much coffee with a beer or two to make you tired.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps over 2 years ago in reply to wolfgangfriedrich

    I see that you wrote this at 3 AM Slight smile.

    To help you get over next night:

    • you don't have to use block designs. Several Digilent examples (both VHDL and Verilog) use Vivado with HDL only, and combine all IP in HDL.
    • the purpose of the block design is not to write IPs in it. It's the place where you tie the IPs together (whether they are Xilinx proprietary, VHDL, Verilog, Vitis HLS, ...)
    • (more obvious with the Zynq): once you use complex IPs like the AXI, DMA, MicroBlaze, or the on-chip ARM where applicable, the block design approach, with config wizards, helps to make the design complexity graspable.
    • don't drink coffee after 18:00.
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • wolfgangfriedrich
    wolfgangfriedrich over 2 years ago

    I just had a nightmare vision of the Vivado Block design being a distant relative of Labview.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
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