This project provides scripts to automate the extraction and comparison of available RISC-V extensions and supported MCPUs across different versions of the SiFive Freedom Tools RISC-V toolchain.
The scripts will:
- Load each specified toolchain module.
- Extract supported extensions and MCPUs from GCC and Clang compilers.
- Convert the outputs to CSV format.
- Merge all CSVs into combined, sorted output files showing which extensions/MCPUs are supported in each toolchain version.
- Generate Excel files with conditional formatting for easy visualization.
- Bash shell
module
command (e.g., Lmod or Environment Modules)- Python 3
- RISC-V toolchains available as modules
- Python dependencies:
pandas
,openpyxl
Install Python dependencies:
pip install pandas openpyxl
.
├── gen_compiler_ext.sh # Extract RISC-V extensions
├── gen_compiler_mcpu.sh # Extract supported MCPUs
├── toolchain_config.sh # Shared toolchain configuration
├── gen_txt2csv.py # Converts compiler output to CSV
├── merge_riscv_extensions.py # Merges multiple CSV files
├── gen_csv2xlsx.py # Converts CSV to Excel with formatting
├── parse_mcpu_values.sh # Extracts MCPU values from compilers
├── mcpu_csv_to_excel.py # Converts MCPU CSV to Excel
├── csv/ # Extensions output folder (auto-generated)
└── mcpu_lists/ # MCPU output folder (auto-generated)
Run full processing (if csv/ doesn't exist):
./gen_compiler_ext.sh
Force full processing (even if output folder exists):
./gen_compiler_ext.sh --force
Options:
--help, -h Show help message and exit
--force Force regeneration of all output files
--output-dir DIR Set output directory (default: ./csv)
--merged-file FILE Set merged output file name (default: compiler-ext.csv)
--gcc-triple NAME Use specific GCC triple name (default: riscv64-unknown-elf-gcc)
--clang-triple NAME Use specific Clang triple name (default: riscv64-unknown-elf-clang)
--version VER Process specific version only
--list-versions List available versions and exit
--no-description Filter out description column in the merged output
Process all toolchain versions:
./gen_compiler_ext.sh
Process a specific version only:
./gen_compiler_ext.sh --version 3.1.5
Change the output directory:
./gen_compiler_ext.sh --output-dir ./my-reports
List all available versions:
./gen_compiler_ext.sh --list-versions
Filter out description column from output:
./gen_compiler_ext.sh --no-description
After successful execution, you will get:
csv/
├── gcc-1.0.7.csv
├── gcc-2.0.3.csv
├── ...
├── clang-1.0.7.csv
├── clang-2.0.3.csv
├── ...
└── compiler-ext.csv # Combined & sorted CSV of all versions
compiler-ext.xlsx # Excel version with conditional formatting
Run full processing:
./gen_compiler_mcpu.sh
Force regeneration of all files:
./gen_compiler_mcpu.sh --force
Options:
-v, --verbose Enable verbose output
-f, --force Force processing even if CSV files already exist
-o, --output-dir DIR Specify output directory (default: mcpu_lists)
-m, --module MODULE Specify base module name (default: sifive/freedom-tools/toolsuite)
-h, --help Show this help message
Process all toolchain versions with verbose output:
./gen_compiler_mcpu.sh --verbose
Change the output directory:
./gen_compiler_mcpu.sh --output-dir ./mcpu-reports
Force regeneration of existing files:
./gen_compiler_mcpu.sh --force
After successful execution, you will get:
mcpu_lists/
├── 1.0.7/
│ ├── gcc_mcpu.csv
│ ├── clang_mcpu.csv
│ └── mcpu_list.csv
├── 2.0.3/
│ ├── gcc_mcpu.csv
│ ├── clang_mcpu.csv
│ └── mcpu_list.csv
├── ...
├── compiler-mcpu.csv # Combined comparison across all versions
└── compiler-mcpu.xlsx # Excel version with conditional formatting
Both scripts generate Excel files with the following features:
- Conditional Formatting: Green highlighting for supported extensions/MCPUs ('Y' or 'X')
- Frozen Panes: First row and column frozen for easy navigation
- Auto-sized Columns: Columns automatically adjusted to content width
- Multiple Sheets: Separate sheets for different data views (extensions only)
You can also convert CSV files to Excel manually:
# Convert extensions CSV
python gen_csv2xlsx.py compiler-ext.csv --separate-sheets --freeze
# Convert MCPU comparison CSV
python mcpu_csv_to_excel.py -c mcpu_lists/compiler-mcpu.csv
Toolchain versions are configured in toolchain_config.sh
. Current supported versions:
- 1.0.7
- 2.0.3
- 3.1.5
- 4.0.0
- 4.0.1
- 4.0.2
- 4.0.3
To add or modify versions, edit the TOOLCHAIN_VERSIONS
array in toolchain_config.sh
.
- The scripts automatically skip processing if output files already exist (use
--force
to override) - Module loading/unloading is handled automatically
- Error handling is included for missing compilers or failed module loads
- Both GCC and Clang outputs are processed and compared
- Excel conversion requires
pandas
andopenpyxl
Python packages