AVL Visualization
Overview
In order to help debug and understand the hierarchy of the AVL components, AVL provides a visualization module that can be used to generate a graphical representation of the component hierarchy.
Two types of visualizations are provided:
Class Hierarchy Tree provided by anytree library
Class Hierarchy Diagram provided by graphviz library
Tree Visualization
# Copyright 2024 Apheleia
#
# Description:
# Apheleia phase example
import avl
import avl.templates
import cocotb
@cocotb.test
async def test(dut):
# Create the environment
avl.Factory.set_variable("*.hdl", dut)
avl.Factory.set_variable("*.clk", dut.clk)
avl.Factory.set_variable("*.rst", dut.rst_n)
avl.Factory.set_variable("env.cfg.n_agent", 2)
e = avl.templates.VanillaEnv("env", None)
# Display the hierarchy tree of the environment
print(avl.Visualization.tree(e))
The output looks like this:
env
├── cfg
├── agent0
│ ├── cfg
│ ├── sqr
│ │ └── seq_item_export
│ ├── drv
│ ├── mon
│ │ └── item_export
│ ├── model
│ │ └── item_export
│ └── sb
└── agent1
├── cfg
├── sqr
│ └── seq_item_export
├── drv
├── mon
│ └── item_export
├── model
│ └── item_export
└── sb
Diagram Visualization
# Copyright 2024 Apheleia
#
# Description:
# Apheleia phase example
import avl
import avl.templates
import cocotb
@cocotb.test
async def test(dut):
# Create the environment
avl.Factory.set_variable("*.hdl", dut)
avl.Factory.set_variable("*.clk", dut.clk)
avl.Factory.set_variable("*.rst", dut.rst_n)
avl.Factory.set_variable("env.cfg.n_agent", 2)
e = avl.templates.VanillaEnv("env", None)
# Generate a diagram of the environment
avl.Visualization.diagram(e)
The output looks like this: