Skip to content

Commit

Permalink
Possible fix for vunit simulations in newer GHDL?
Browse files Browse the repository at this point in the history
  • Loading branch information
mschiller-nrao committed May 26, 2023
1 parent e868cac commit 5d5aa2d
Show file tree
Hide file tree
Showing 15 changed files with 14,635 additions and 52 deletions.
17 changes: 14 additions & 3 deletions casper_wb_fft/run.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from vunit import VUnit, VUnitCLI
from vunit.sim_if.factory import SIMULATOR_FACTORY
from os.path import join, abspath, split,realpath,dirname
from importlib.machinery import SourceFileLoader
# load the r2sdf fix point accurate model from r2sdf module.
Expand Down Expand Up @@ -157,9 +158,19 @@ def manglePkg(file_name, line_number, new_line):

# COMMON PACKAGE Library
common_pkg_lib = vu.add_library("common_pkg_lib")
common_pkg_lib.add_source_files(join(script_dir, "../common_pkg/fixed_float_types_c.vhd"))
common_pkg_lib.add_source_files(join(script_dir, "../common_pkg/fixed_pkg_c.vhd"))
common_pkg_lib.add_source_files(join(script_dir, "../common_pkg/float_pkg_c.vhd"))
if SIMULATOR_FACTORY.select_simulator().name == "ghdl":
#common_pkg_lib.add_source_files(join(script_dir, "../common_pkg/fixed_float_types_c_2008redirect.vhdl"))
#common_pkg_lib.add_source_files(join(script_dir, "../common_pkg/fixed_generic_pkg-body_2008redirect.vhdl"))
common_pkg_lib.add_source_files(join(script_dir, "../common_pkg/fixed_generic_pkg_2008redirect.vhdl"))
#common_pkg_lib.add_source_files(join(script_dir, "../common_pkg/float_generic_pkg-body_2008redirect.vhdl"))
common_pkg_lib.add_source_files(join(script_dir, "../common_pkg/float_generic_pkg_2008redirect.vhdl"))
common_pkg_lib.add_source_files(join(script_dir, "../common_pkg/float_pkg_c_2008redirect.vhdl"))
common_pkg_lib.add_source_files(join(script_dir, "../common_pkg/fixed_pkg_c_2008redirect.vhdl"))
else:
# use the "hacked" up VHDL93 version in other simulators
#common_pkg_lib.add_source_files(join(script_dir, "../common_pkg/fixed_float_types_c.vhd"))
common_pkg_lib.add_source_files(join(script_dir, "../common_pkg/fixed_pkg_c.vhd"))
common_pkg_lib.add_source_files(join(script_dir, "../common_pkg/float_pkg_c.vhd"))
common_pkg_lib.add_source_files(join(script_dir, "../common_pkg/common_pkg.vhd"))
common_pkg_lib.add_source_files(join(script_dir, "../common_pkg/common_str_pkg.vhd"))
common_pkg_lib.add_source_files(join(script_dir, "../common_pkg/tb_common_pkg.vhd"))
Expand Down
2 changes: 1 addition & 1 deletion casper_wb_fft/tb_vu_wb_fft_vfmodel.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use ieee.math_real.all;
library common_pkg_lib;
use common_pkg_lib.fixed_float_types.all;
use ieee.fixed_float_types.all;
--use ieee.fixed_pkg.all;
use common_pkg_lib.fixed_pkg.all;
context vunit_lib.vunit_context;
Expand Down
17 changes: 14 additions & 3 deletions casper_wbpfb/run.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from vunit import VUnit
from vunit.sim_if.factory import SIMULATOR_FACTORY
from os.path import join, dirname, abspath
script_dir = dirname(__file__)
import generic_dicts
Expand Down Expand Up @@ -77,9 +78,19 @@ def manglePkg(file_name, line_number, new_line):

# COMMON PACKAGE Library
common_pkg_lib = vu.add_library("common_pkg_lib")
common_pkg_lib.add_source_files(join(script_dir, "../common_pkg/fixed_float_types_c.vhd"))
common_pkg_lib.add_source_files(join(script_dir, "../common_pkg/fixed_pkg_c.vhd"))
common_pkg_lib.add_source_files(join(script_dir, "../common_pkg/float_pkg_c.vhd"))
if SIMULATOR_FACTORY.select_simulator().name == "ghdl":
#common_pkg_lib.add_source_files(join(script_dir, "../common_pkg/fixed_float_types_c_2008redirect.vhdl"))
#common_pkg_lib.add_source_files(join(script_dir, "../common_pkg/fixed_generic_pkg-body_2008redirect.vhdl"))
common_pkg_lib.add_source_files(join(script_dir, "../common_pkg/fixed_generic_pkg_2008redirect.vhdl"))
#common_pkg_lib.add_source_files(join(script_dir, "../common_pkg/float_generic_pkg-body_2008redirect.vhdl"))
common_pkg_lib.add_source_files(join(script_dir, "../common_pkg/float_generic_pkg_2008redirect.vhdl"))
common_pkg_lib.add_source_files(join(script_dir, "../common_pkg/float_pkg_c_2008redirect.vhdl"))
common_pkg_lib.add_source_files(join(script_dir, "../common_pkg/fixed_pkg_c_2008redirect.vhdl"))
else:
# use the "hacked" up VHDL93 version in other simulators
#common_pkg_lib.add_source_files(join(script_dir, "../common_pkg/fixed_float_types_c.vhd"))
common_pkg_lib.add_source_files(join(script_dir, "../common_pkg/fixed_pkg_c.vhd"))
common_pkg_lib.add_source_files(join(script_dir, "../common_pkg/float_pkg_c.vhd"))
common_pkg_lib.add_source_files(join(script_dir, "../common_pkg/common_pkg.vhd"))
common_pkg_lib.add_source_files(join(script_dir, "../common_pkg/common_str_pkg.vhd"))
common_pkg_lib.add_source_files(join(script_dir, "../common_pkg/tb_common_pkg.vhd"))
Expand Down
2 changes: 1 addition & 1 deletion common_pkg/common_pkg.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.NUMERIC_STD.ALL;
USE IEEE.MATH_REAL.ALL;
use work.fixed_float_types.all;
use IEEE.fixed_float_types.all;
use work.fixed_pkg.all;

PACKAGE common_pkg IS
Expand Down
35 changes: 0 additions & 35 deletions common_pkg/fixed_float_types_c.vhd

This file was deleted.

Loading

0 comments on commit 5d5aa2d

Please sign in to comment.