Skip to content

clustergen: Improvements for generation with templates #202

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Feb 19, 2025
Merged

Conversation

fischeti
Copy link
Contributor

@fischeti fischeti commented Feb 4, 2025

This PR aims to improve the auto-generation of sources in several ways:

Cacheable regions

It is now possible to define external (cacheable) memory regions in the configuration file:

external_addr_regions: [
        {
            name: "dram"
            address: 0x8000_0000,
            length: 0x8000_0000,
            cacheable: true
        },
        ...
    ],

Previously, that was not possible. Instead, the intended way was to write a python script that imports the SnitchCluster class and adds additional information such as cacheable regions. For instance, for the testbench of the snitch cluster itself, there exists a SnitchClusterTb class which defines a simple environment with a (cacheable) DRAM. However, writting a python script for integrating the snitch cluster is unnecessary cumbersome, which is why this was removed in favor of external_addr_region.

Arbitrary templates

Instead of having different flags for the generation of different kind of sources, the clustergen now just validates a configuration file and extends it with additional information, from which arbitrary sources can be generated by providing a template with --template.

Migrate to JSON5

The configuration files were migrated from HJSON to JSON5, which allows hexadecimal input, as well as comments

This allows to specify cacheable regions from the configuration, which
was not possible before without writing custom python script which is
unnecessary complex.

Also gets rid of the `SnitchClusterTB` python class which modeled a
simple environment with a DRAM
Copy link
Collaborator

@colluca colluca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution @fischeti!

Just a few comments from my side, otherwise looks good to me.

Copy link
Collaborator

@colluca colluca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed a couple of commits to streamline the clustergen tool even more. Summary below. @fischeti if you can give them a quick review, then for me it's ready to merge.

  1. It seems the memories.json file is not currently used anywhere in this repo, nor in Occamy. I temporarily removed it, to make the interface to the tool more consistent. In the future we can use a template to generate this file as well, if needed.

  2. Enable overriding the output file name, by passing a full path to the desired output file, instead of just the output directory.

@fischeti
Copy link
Contributor Author

Looks good to me. The memory.json was previously used to generate the technology-specific tc_sram wrapper. But I don't think it is needed anymore

@colluca colluca merged commit c9f92d1 into main Feb 19, 2025
27 checks passed
@colluca colluca deleted the tpl-improv branch February 19, 2025 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants