<commit_before>#=======================================================================
# vcd_test.py
#=======================================================================

import inspect

# This imports all the SimulationTool tests. Below we will hack the
# setup_sim() function call in each module to use a special vcd version
# of the setup.

from SimulationTool_seq_test    import *
from SimulationTool_comb_test   import *
from SimulationTool_mix_test    import *
from SimulationTool_struct_test import *
from SimulationTool_wire_test   import *

#-----------------------------------------------------------------------
# vcd_setup_sim
#-----------------------------------------------------------------------
# Elaborate the module, create a SimulationTool, and also create a vcd
# dump of the simulation.
def vcd_setup_sim( model ):
  model.elaborate()
  sim = SimulationTool( model )
  sim.dump_vcd( 'pymtl.tools.simulation.vcd_test.{}.vcd'.format( model.class_name ) )
  return sim

#-----------------------------------------------------------------------
# setup_function
#-----------------------------------------------------------------------
# A special setup function that get the functions parent module, saves
# the setup_sim defined by that module, and replaces it with
# vcd_setup_sim.
def setup_function( function ):
  parent_module           = inspect.getmodule( function )
  function._old_setup     = parent_module.setup_sim
  parent_module.setup_sim = vcd_setup_sim

#-----------------------------------------------------------------------
# teardown_function
#-----------------------------------------------------------------------
# Restore the setup_sim of the module the function is defined in with
# it's original version.
def teardown_function( function ):<commit_msg>[pymtl.tools] fix simulation/vcd_test.py<commit_after>#=======================================================================
# vcd_test.py
#=======================================================================

import inspect

# This imports all the SimulationTool tests. Below we will hack the
# setup_sim() function call in each module to use a special vcd version
# of the setup.

from SimulationTool_seq_test    import *
from SimulationTool_comb_test   import *
from SimulationTool_mix_test    import *
from SimulationTool_struct_test import *
from SimulationTool_wire_test   import *

#-----------------------------------------------------------------------
# vcd_setup_sim
#-----------------------------------------------------------------------
# Elaborate the module, create a SimulationTool, and also create a vcd
# dump of the simulation.
def vcd_setup_sim( model ):
  model.elaborate()
  model.vcd_file = \
    'pymtl.tools.simulation.vcd_test.{}.vcd'.format( model.class_name )
  sim = SimulationTool( model )
  return sim

#-----------------------------------------------------------------------
# setup_function
#-----------------------------------------------------------------------
# A special setup function that get the functions parent module, saves
# the setup_sim defined by that module, and replaces it with
# vcd_setup_sim.
def setup_function( function ):
  parent_module           = inspect.getmodule( function )
  function._old_setup     = parent_module.setup_sim
  parent_module.setup_sim = vcd_setup_sim

#-----------------------------------------------------------------------
# teardown_function
#-----------------------------------------------------------------------
# Restore the setup_sim of the module the function is defined in with
# it's original version.
def teardown_function( function ):
{'fraction_non_alphanumeric': 0.3600550964187328, 'fraction_numerical': 0.0, 'mean_word_length': 1.767530487804878, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1864712', 'n_tokens_mistral': 824, 'n_tokens_neox': 802, 'n_words': 252}