piel.tools.cocotb.data#

This module provides functions to read, plot, and analyze Cocotb simulation files. It supports reading simulation output files, converting them into Pandas dataframes, and plotting the files using Bokeh for interactive visualization. # TODO: Implement the logic for processing different signal measurement.

Attributes#

Functions#

get_simulation_output_files_from_design(→ list)

Returns a list of all simulation output files in the specified design directory.

read_simulation_data(→ pandas.DataFrame)

Reads simulation files from a specified file into a Pandas dataframe.

simple_plot_simulation_data(simulation_data)

Plots simulation files using Bokeh for interactive visualization.

Module Contents#

get_simulation_output_files#
get_simulation_output_files_from_design(design_directory: piel.types.PathTypes, extension: str = 'csv') list[source]#

Returns a list of all simulation output files in the specified design directory.

Parameters:
  • design_directory (PathTypes) – The path to the design directory.

  • extension (str, optional) – The file extension to filter by. Defaults to “csv”.

Returns:

A list of paths to the simulation output files in the design directory.

Return type:

list

Examples

>>> get_simulation_output_files_from_design("/path/to/design")
[PosixPath('/path/to/design/tb/out/output1.csv'), PosixPath('/path/to/design/tb/out/output2.csv')]
read_simulation_data(file_path: piel.types.PathTypes, *args, **kwargs) pandas.DataFrame[source]#

Reads simulation files from a specified file into a Pandas dataframe.

Parameters:

file_path (PathTypes) – The path to the simulation files file.

Returns:

The simulation files as a Pandas dataframe.

Return type:

pd.DataFrame

Examples

>>> read_simulation_data("/path/to/simulation/output.csv")
# Returns a dataframe with the contents of the CSV file.
simple_plot_simulation_data(simulation_data: pandas.DataFrame)[source]#

Plots simulation files using Bokeh for interactive visualization.

Parameters:

simulation_data (pd.DataFrame) – The simulation files to plot, containing columns ‘t’ for time and ‘x’ for signal values.

Returns:

Displays an interactive plot.

Return type:

None

Examples

>>> files = pd.DataFrame({"t": [0, 1, 2, 3], "x": [0, 1, 0, 1]})
>>> simple_plot_simulation_data(files)
# Displays an interactive Bokeh plot.