Skip to content

Commit 52de8d0

Browse files
committed
Minimize imports in an effort to lower simulation setup time
These changes represent a 21% reduction of execution time for the 460 test cases in hdl-modules repo: https://github.com/hdl-modules/hdl-modules For some small testbenches, the reduction is as much as 42%. Note that this repo contains only small to medium sized testbenches (1-10 seconds, with most around 1-4 seconds). This is all using the GHDL simulator with GCC backend on Linux. With ModelSim Intel FPGA starter edition 2020.1, the reductions is negligible (1-2%). This change: 1. Stop using "context" in all VUnit packages. In most packages, importing with context includes a lot more than what is actually used. 2. Stop using "use work.x_pkg.all" in cases where only 1-3 things are used from the package. Instead, one explicit "use" clause for the things that are actually used. * Not done for the most common packages (run_pkg, check_pkg, logger_pkg). * Not done for includes from very small packages. 3. For packages that have head and body in different files, move all imports to the head file. As they were, split between the files, there was a lot of overlap of imports, and it what hard to get an overview of what is actually imported and what is actually used. The first point represents roughly 80% of the performance gain. Note that in order to reach the performance gains listed above, the corresponding changes have to be made to all testbenches and simulation code in the user repo also. If the testbench includes "vunit_context", "com_context" etc, the performance gains will not be realized since everything will be imported anyway.
1 parent e9400b9 commit 52de8d0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+279
-287
lines changed

vunit/vhdl/check/src/check.vhd

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,6 @@
66
--
77
-- Copyright (c) 2014-2024, Lars Asplund lars.anders.asplund@gmail.com
88

9-
library ieee;
10-
use ieee.std_logic_1164.all;
11-
use ieee.numeric_std.all;
12-
use std.textio.all;
13-
use work.checker_pkg.all;
14-
use work.string_ops.all;
15-
use work.location_pkg.all;
16-
use work.integer_vector_ptr_pkg.all;
17-
189
package body check_pkg is
1910
type boolean_vector is array (natural range <>) of boolean;
2011

vunit/vhdl/check/src/check_api.vhd

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@
1010
library ieee;
1111
use ieee.std_logic_1164.all;
1212
use ieee.numeric_std.all;
13+
1314
use std.textio.all;
15+
1416
use work.checker_pkg.all;
15-
use work.logger_pkg.all;
17+
use work.event_common_pkg.any_event_t;
18+
use work.event_common_pkg.notify;
19+
use work.integer_vector_ptr_pkg.all;
1620
use work.log_levels_pkg.all;
21+
use work.logger_pkg.logger_t;
1722
use work.string_ops.all;
18-
use work.event_common_pkg.all;
1923
use work.string_ptr_pkg.all;
2024

2125
package check_pkg is

vunit/vhdl/com/src/com.vhd

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,12 @@
99
library ieee;
1010
use ieee.std_logic_1164.all;
1111

12-
context work.vunit_context;
13-
14-
use work.queue_pkg.all;
15-
use work.queue_2008p_pkg.all;
16-
use work.queue_pool_pkg.all;
17-
use work.integer_vector_ptr_pkg.all;
18-
use work.string_ptr_pkg.all;
19-
use work.codec_pkg.all;
20-
use work.com_support_pkg.all;
21-
use work.com_messenger_pkg.all;
2212
use work.com_common_pkg.all;
13+
use work.com_messenger_pkg.all;
14+
use work.com_support_pkg.all;
2315
use work.logger_pkg.all;
16+
use work.queue_pkg.all;
17+
use work.queue_pool_pkg.all;
2418

2519
use std.textio.all;
2620

vunit/vhdl/com/src/com_api.vhd

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@ library ieee;
1111
use ieee.std_logic_1164.all;
1212

1313
use work.com_types_pkg.all;
14-
use work.queue_pkg.all;
15-
use work.integer_vector_ptr_pkg.all;
16-
use work.string_ptr_pkg.all;
17-
use work.id_pkg.all;
18-
use work.event_private_pkg.all;
14+
use work.id_pkg.id_t;
15+
use work.event_private_pkg.new_basic_event;
16+
use work.event_private_pkg.com_net_event;
1917

2018
package com_pkg is
2119
-- Global predefined network. See network_t description in com_types.vhd for

vunit/vhdl/com/src/com_common.vhd

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@
99
library ieee;
1010
use ieee.std_logic_1164.all;
1111

12-
use work.com_messenger_pkg.all;
13-
use work.com_types_pkg.all;
14-
use work.event_common_pkg.all;
15-
use work.event_private_pkg.all;
12+
use work.com_messenger_pkg.messenger_t;
13+
use work.com_types_pkg.com_status_t;
14+
use work.event_common_pkg.notify;
15+
use work.event_common_pkg.is_active;
16+
use work.event_private_pkg.basic_event_t;
1617

1718
package com_common_pkg is
1819
shared variable messenger : messenger_t;

vunit/vhdl/com/src/com_debug_codec_builder.vhd

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@
66
--
77
-- Copyright (c) 2014-2024, Lars Asplund lars.anders.asplund@gmail.com
88

9-
library vunit_lib;
10-
context vunit_lib.vunit_context;
11-
129
use std.textio.all;
1310

11+
use work.string_ops.all;
12+
1413
package com_debug_codec_builder_pkg is
1514
-----------------------------------------------------------------------------
1615
-- Encoding support

vunit/vhdl/com/src/com_messenger.vhd

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use work.com_support_pkg.all;
1212
use work.queue_pkg.all;
1313
use work.queue_pool_pkg.all;
1414
use work.string_ptr_pkg.all;
15-
use work.codec_pkg.all;
1615
use work.logger_pkg.all;
1716
use work.log_levels_pkg.all;
1817
use work.id_pkg.all;

vunit/vhdl/com/src/com_support.vhd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
--
55
-- Copyright (c) 2014-2024, Lars Asplund lars.anders.asplund@gmail.com
66

7-
context work.vunit_context;
87
use work.com_types_pkg.all;
8+
use work.logger_pkg.all;
9+
use work.string_ops.all;
910

1011
package com_support_pkg is
1112

vunit/vhdl/com/src/com_types.vhd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use work.queue_pkg.all;
2424
use work.queue_2008p_pkg.all;
2525
use work.queue_pool_pkg.all;
2626
use work.dict_pkg.all;
27-
use work.event_private_pkg.all;
27+
use work.event_private_pkg.basic_event_t;
2828

2929
package com_types_pkg is
3030

vunit/vhdl/core/src/core_pkg.vhd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
-- Copyright (c) 2014-2024, Lars Asplund lars.anders.asplund@gmail.com
66

77
use std.textio.all;
8+
89
use work.stop_pkg;
910
use work.integer_vector_ptr_pkg.all;
1011
use work.string_ptr_pkg.all;

0 commit comments

Comments
 (0)