pulp-platform / snitch_cluster

An energy-efficient RISC-V floating-point compute cluster.
https://pulp-platform.github.io/snitch_cluster/
Apache License 2.0
48 stars 46 forks source link

Check parameters in HW config file against schema #152

Open colluca opened 3 months ago

colluca commented 3 months ago

Parameter ssr_nr_credits is defined in the default HW configuration: https://github.com/pulp-platform/snitch_cluster/blob/e90dceb6a6c9bdb6bb5d1502b62b920242be9fa8/target/snitch_cluster/cfg/default.hjson#L115

However, this parameter is actually not used anywhere. The correct name for this parameter would be data_credits: https://github.com/pulp-platform/snitch_cluster/blob/e90dceb6a6c9bdb6bb5d1502b62b920242be9fa8/hw/snitch_cluster/src/snitch_cluster_wrapper.sv.tpl#L205

Regardless what value is set to ssr_nr_credits, the default for data_credits which is defined in the schema file is used: https://github.com/pulp-platform/snitch_cluster/blob/e90dceb6a6c9bdb6bb5d1502b62b920242be9fa8/docs/schema/snitch_cluster.schema.json#L576-L581

To avoid incurring in the same situation in the future, the HW configuration file should be validated against the schema upon hardware generation, producing an error if some parameter is not defined in the schema.

This is done to some extent in the Generator class: https://github.com/pulp-platform/snitch_cluster/blob/e90dceb6a6c9bdb6bb5d1502b62b920242be9fa8/util/clustergen/cluster.py#L73-L80

But only against the root schema, which doesn't include all parameters. The ssr_nr_credits parameter is in the remote schema for the SnitchClusterTB class: https://github.com/pulp-platform/snitch_cluster/blob/e90dceb6a6c9bdb6bb5d1502b62b920242be9fa8/util/clustergen/cluster.py#L357-L369