AR# 64118


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


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.


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.


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).


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 04/02/2015
Status Active
Type General Article
People Also Viewed