[topgen] Use OrderedDict for top, xbar objects
This is related to PR #1552.
Problem:
In Azure Pipeline that uses Python 3.5, doesn't keep the order of
hjson keys. It results the generated hjson has a lot of change
randomly.
`dict` type in python is unordered dictionary. It doesn't maintain the
order of keys in the dictionary. `topgen` dumps a couple of hjson files,
such as generated tops (e.g.
`hw/top_earlgrey_data/autogen/top_earlgrey.gen.hjson`) and the crossbar
configurations (e.g.
`$TOP/ip/xbar_{name}/data/autogen/xbar_{name}.hjson`). This unordered
behavior creates random changes to the generated files, which increases
commit diffs.
From python3.7, the default dictionary type is changed to
`collections.OrderedDict`. So, if the `topgen` runs on the system >=
python3.7, it always maintain the order.
Resolution:
Use OrderedDict when create dictionary variables.
With OrderedDict (introduced in Python2.7), the generated hjson files
are remains in order.
Signed-off-by: Eunchan Kim <eunchan@opentitan.org>
OpenTitan is an open source silicon Root of Trust (RoT) project. OpenTitan will make the silicon RoT design and implementation more transparent, trustworthy, and secure for enterprises, platform providers, and chip manufacturers. OpenTitan is administered by lowRISC CIC as a collaborative project to produce high quality, open IP for instantiation as a full-featured product. See the OpenTitan site and OpenTitan docs for more information about the project.
This repository contains hardware, software and utilities written as part of the OpenTitan project. It is structured as monolithic repository, or “monorepo”, where all components live in one repository. It exists to enable collaboration across partners participating in the OpenTitan project.
The project contains comprehensive documentation of all IPs and tools. You can either access it online or build it locally by following the steps below.
$ sudo apt install curl python3 python3-pip $ pip3 install --user -r python-requirements.txt
$ ./util/build_docs.py --preview
This compiles the documentation into ./build/docs and starts a local server, which allows you to access the documentation at http://127.0.0.1:1313.
Have a look at CONTRIBUTING for guidelines on how to contribute code to this repository.
Unless otherwise noted, everything in this repository is covered by the Apache License, Version 2.0 (see LICENSE for full text).