calyx 0.7.1

Compiler Infrastructure for Hardware Accelerator Generation
import os
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd

sns.set_theme()

if __name__ == "__main__":
    df = pd.read_csv("simple.csv")
    # The headers of the CSV are: design,resource,simple,complete,ratio

    # Group data using "resource"
    grouped_data = df.groupby("resource")

    # Mapping to rename the design names
    design_mapping = {
        "vgg": "VGG",
        "alex": "AlexNet",
        "google": "GoogleNet",
        "squeeze": "SqueezeNet",
        "mobile": "MobileNet",
        "lenet": "LeNet",
    }

    # Replace the design names with the mapping
    df["design"] = df["design"].map(design_mapping)

    # For each group, create a bar plot
    for resource, data in grouped_data:
        plt.figure()
        print(data)
        # Cut the data to only include the relevant columns: design and ration
        ax = sns.barplot(x="design", y="ratio", data=data, errorbar=None)
        # Add a dotted line at y=1
        ax.axhline(1, color="black", linewidth=1, linestyle="--")
        # X-axis is "Neural Network" and Y-axis is "Resource Usage Ratio"
        ax.set(xlabel="Neural Network", ylabel="Usage Ratio")
        # Tilt the x-axis labels
        plt.xticks(rotation=20)

        if resource == "lut":
            title = "LUT"
        else:
            title = "Register"

        ax.set(title=f"""{title} Usage""")
        # Save this ax into a file
        plt.savefig(f"""{resource}_usage.pdf""", bbox_inches="tight")