# vivado-report-parser
This Python library provides functions for parsing Vivado report files into Python objects. Currently, it only supports "tables-style" reports like those generated by the report_power and report_utilization commands.

The package comes with a script called `parse-vivado-report` that reads from a given report file (or stdin) and outputs a JSON representation of the data.

Documentation is provided in the docstrings of each module and function.

## Installation

```
$ pip install vivado-report-parser
```

## Example Usage

### CLI
```
$ parse-vivado-report power.rpt -d power.rpt.json
```
or
```
$ ... | parse-vivado-report -d power.rpt.json
```
### Library
```python
from vivado_report_parser import parse_metadata, parse_vivado_report

with open('power.rpt', 'r') as f:
  file_content = f.read()

metadata = parse_metadata(file_content)
data = parse_vivado_report(file_content)

print(data['Summary']['Total On-Chip Power (W)'])
...
```

## Disclaimer
Copyright 2024 Jesse Looney

All the files in this repository are part of vivado-report-parser.

vivado-report-parser is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. 
