0
\$\begingroup\$

I created a testbench for a VHDL design including integrated circuit models to check interface timing requirements. Within each model, I instantiate a generic package (genpkg) to print detected errors to console or files. The genpkg is instantiated in the architecture declaration area of the model, after architecture, but before begin (see code block 1). This puts generics from the model entity in scope to be passed to generics of the genpkg. My testbench top-level has generics that I set via TCL macros, using the vsim command with -g, and these are passed to each model's generic map. In this way, I can set unique labels/IDs, output filenames, etc. when there are duplicate/multiple models in the testbench and/or for running different tests.

Code Block 1

entity ads8698 is
generic(
  DEV_NAME       : string  := "ADC";
  DEV_ID         : integer := 0;
  TIMING_INFO    : boolean := TRUE;
  OUTPUT_TO_FILE : boolean := TRUE;
  OUTPUT_FILE    : string  := ".\outfile.txt";
  MODE           : file_open_kind := write_mode
);
port(
  ...
);
end ads8698;

architecture arch of ads8698 is

  package perr is new work.print_err_pack
  generic map (
    DEV_NAME => DEV_NAME,
    DEV_ID => DEV_ID,
    TIMING_INFO => TIMING_INFO,
    OUTPUT_TO_FILE => OUTPUT_TO_FILE,
    OUTPUT_FILE => OUTPUT_FILE,
    MODE => MODE
  );

...

begin

This works as expected with QuestaSim 10.5c for standard simulation. When I run a post-fit simulation, however, this no longer works.

The post-fit VHDL and SDF files used are generated by LiberoSoC 11.7, as the design targets a Microsemi device. The only difference I see in simulation setup is the post-fit vsim command, where I use -sdfmax to annotate Microsemi VITAL cells with max timing values, and I use -noglitch to disable VITAL glitches.

When running post-fit, the genpkgs don't print as expected. For one thing, the generics I set with vsim -g ... in TCL don't flow down to the genpkg instantiations anymore. For another, the print procedures in my genpkgs aren't printing, though there are simulation conditions occurring which should cause them to print.

In my standard testbench top-level, I have a genpkg instantiated the same way as in the models (code block 1). This did not work as expected with the post-fit testbench top-level. In order to get error printing to work in the post-fit top-level, I had to instantiate the genpkg as in code block 2.

Code Block 2

package p is new work.print_err_pack
generic map (
  DEV_NAME => "FTLU2_POSTFIT",
  DEV_ID => 0,
  TIMING_INFO => TRUE,
  OUTPUT_TO_FILE => TRUE,
  OUTPUT_FILE => "./FTLU2_postfit.txt",
  MODE => append_mode
);
use work.p;

architecture arch of tb_post is

...

begin

In this location, I needed the use work.p; line for some reason. The issue with instantiating the genpkg here (prior to architecture) is the testbench generics are no longer in the scope of the instantiation, so they can't be passed to the genpkg. Instantiation here defeats the purpose of my genpkg use case.

So my question, does anyone have an idea why passing generics to instantiate generic packages would not work for a post-fit simulation in QuestaSim/ModelSim 10.5 when it works as expected for standard simulation?

Thanks in advance.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.