Personal tools

SystemVerilog formatter for our LowRISC-based guidelines (2-3G)

From iis-projects

Jump to: navigation, search


Introduction

Coding conventions are an essential part of every large hardware (and software) project. They guide various non-functional aspects of the project and the source code like file organization, indentation, declarations, code alignment, naming conventions, and countless others.

Coding conventions serve very important purposes:

  • Improving maintenance by making the code more familiar to the maintainers
  • Improve readability and ease the process of code reviewing
  • Improving the overall code quality by giving the project a more complete and clean feel
  • Ensuring better compatibility to different tools by encouraging the use of simpler and better-supported constructs

At IIS we use the LowRISC guidelines [1] for systemverilog. Although the effort of following the guidelines continuously while writing new modules is very manageable, it becomes a major hassle when including 3rd-party and ill-formatted into our projects.

Having a tool that automatically formats any systemverilog source code to apply to the coding guidelines of LowRISC would massively reduce the manual refactoring effort while integrating 3rd-party code.

Project Content

The project can be divided in the following sub tasks:

  • Abstract the coding guidelines to a set of machine-understandable rules
  • Explore existing parsing frameworks for systemverilog to simplify the processing of source code (or choose to create the parser from scratch)
  • Use python to check a given source files against each rule and report the line or construct in violation with the rule
  • Create a python tool that applies the rules to the source code and produces nicely formatted code

Prerequisites

  • Preferably: Experience with Python
  • Preferably: Experience with a hardware description language (HDL)

Composition

  • 20% rule abstraction
  • 10% parser framework exploration
  • 30% formatting violation reporting
  • 40% implementing formatting script

Project Supervisors