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?


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



Answer Number 问答标题 问题版本 已解决问题的版本
58799 Xilinx Simulation Solution Center - Design Assistant - Vivado Simulator N/A N/A
AR# 64118
日期 04/02/2015
状态 Active
Type 综合文章