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.

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

链接问答记录

主要问答记录

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