UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

AR# 64118

How Do I Override Generic or Parameter Without Changing My HDL Source Code?

Description

Once we have declared Generics or Parameters in our code, it would be nice to pass the value from the simulator by not having to change the HDL source code.

This Answer Record talks more on how to do that with a simple example.

Solution

Let us assume we have generic N to set the width of a top level port Q:

entity Counter is
  generic (N : positive := 8);
  port ( Reset, Clock, UpDn : std_logic;
         Q                  : std_logic_vector(N-1 downto 0));
end entity Counter;

You can pass/override the Generic N or Parameters while compiling the code in Vivado Simulator without any RTL changes.

GUI mode:

1. Go to Project Settings and select Simulation Settings.

2. Under the compilation option, click on the radio button next to Generic/Parameters Options.

generic_1.png
generic_1.png


3. Click on + and add the Generic Value you would like to pass from the simulator. For example, we want to set the bus width to 12 (N=12).

generic_2.png

4. Close the options and run Simulation.

Command Line mode:

You can pass the generic/parameter value using a switch present with xelab command:

  --generic_top arg                    Override generic or parameter of a top level design unit with specified value

Example: xelab -generic_top "N=12" work.Counter

Linked Answer Records

Master Answer Records

Answer Number Answer Title Version Found Version Resolved
58799 Xilinx Simulation Solution Center - Design Assistant - Vivado Simulator N/A N/A
AR# 64118
Date Created 03/31/2015
Last Updated 04/02/2015
Status Active
Type General Article
Tools
  • Vivado Design Suite - 2015.1