Function simulate
has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring. Open
def simulate(model, *args, simulations=None, conversion_path=None, input_types=None,
pipeline_flush='self.DELAY', trace=False):
"""
Run simulations on model.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
File simulation_interface.py
has 366 lines of code (exceeds 250 allowed). Consider refactoring. Open
import logging
import os
import shutil
import subprocess
import sys
Function run_ghdl_cocotb
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def run_ghdl_cocotb(*inputs, converter=None, netlist=None, verbose=False):
""" RTL simulator with GHDL and COCOTB. This requires that MODEL and PYHA simulations already ran.
Inputs to the simulator are 'pipeline compensated' from PYHA simulation.
"""
indata = []
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function convert_input_types
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def convert_input_types(args, to_types=None, silence=False):
if not silence:
logger.info(f'Converting simulation inputs to hardware types...')
def convert_arg(default_type, arg, i):
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function assert_sim_match
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def assert_sim_match(model, expected, *x, types=None, simulations=None, rtol=1e-04, atol=(2 ** -17) * 4, dir_path=None,
Function sims_close
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def sims_close(simulation_results, expected=None, rtol=1e-04, atol=(2 ** -17) * 4, skip_first_n=0):
"""
TODO: LEGACY
Compare the results of ``simulate`` function.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function simulate
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def simulate(model, *args, simulations=None, conversion_path=None, input_types=None,
Avoid deeply nested control flow statements. Open
for input in tqdm(args, file=sys.stderr):
returns = model.main(*input)
returns = pyha_to_python(returns)
if returns is not None:
valid_samples += 1
Avoid deeply nested control flow statements. Open
if pipeline_flush == 'auto' and valid_samples != len(out['MODEL']):
args = list(args)
logger.info(
f'Flushing the pipeline to collect {len(out["MODEL"])} valid samples (currently have {valid_samples})')
hardware_delay = 0
Function assert_equals
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def assert_equals(simulation_results, expected=None, rtol=1e-04, atol=(2 ** -17) * 4, skip_first_n=0):
Function sims_close
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def sims_close(simulation_results, expected=None, rtol=1e-04, atol=(2 ** -17) * 4, skip_first_n=0):