lowRISC / ibex

Ibex is a small 32 bit RISC-V CPU core, previously known as zero-riscy.
https://www.lowrisc.org
Apache License 2.0
1.38k stars 543 forks source link

[tracking] Use Verible's verilog_format for code formatting #687

Open imphil opened 4 years ago

imphil commented 4 years ago

Verible's verilog_format is a automatic code formatter. We want to be able to run it on our code base, ultimately in "enforcing" mode, requiring all submissions to be formatted with this tool. This is the same approach we take with clang-format and C/C++ files. This issue is to track the progress towards that.

Ibex TODO:

Bugs crashing the formatter:

Wrong style produced by the formatter according to the lowRISC style guide:

Verible formatter style/readability issues and optional issues:

imphil commented 4 years ago

The first set of code changes to get our code in line with what verible format produces is at https://github.com/lowRISC/ibex/pull/1014. The goal is to have that PR cover all the "easy" cases, getting us step-by-step closer to a full equivalence.

asb commented 4 years ago

Thanks for your work in pursuing this, filing upstream issues, and tracking progress.

IMHO #351 should be higher priority - it seems to be a case of producing incorrectly formatted code, which is a much bigger barrier to enforcing verible formatting use than producing output that doesn't match our personal tastes. But once incorrect formatting bugs are addressed I agree with the thrust of your argument in #1014 - don't sweat the small stuff, and in return formatting becomes a solved problem.

We'll want to consult with downstream consumers (OpenTitan) prior to landing a large cosmetic change like #1014. I don't see why it should be problematic at this stage, but it couldn't hurt to explain the plan.