Personal tools

Difference between revisions of "SystemVerilog formatter for our LowRISC-based guidelines (2-3G)"

From iis-projects

Jump to: navigation, search
Line 7: Line 7:
 
[[Category:Available]]
 
[[Category:Available]]
  
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 many others.  
+
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:
 
Coding conventions serve very important purposes:
 
* '''Improving maintenance''' by making the code more familiar to the maintainers
 
* '''Improving maintenance''' by making the code more familiar to the maintainers
* '''Improve readability''' of the code and '''ease the process of reviewing''' code
+
* '''Improve readability''' and '''ease the process of code reviewing'''
 
* '''Improving the overall code quality''' by giving the project a '''more complete and clean''' feel
 
* '''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'''
 
* Ensuring '''better compatibility''' to different tools by encouraging the use of '''simpler and better-supported constructs'''
Line 28: Line 28:
  
 
== Prerequisites ==
 
== Prerequisites ==
Preferably: Experience with Python
+
* Preferably: Experience with Python
 +
* Preferably: Experience with a hardware description language (HDL)
 +
 
 
==Composition==
 
==Composition==
 
 
* 20% rule abstraction
 
* 20% rule abstraction
* 10% parser exploration
+
* 10% parser framework exploration
 
* 30% formatting violation reporting
 
* 30% formatting violation reporting
* 40% implementing formatter script
+
* 40% implementing formatting script
  
 
== Project Supervisors ==
 
== Project Supervisors ==
 
* [[:User:Paulsc | Paul Scheffler]]: [mailto:paulsc@iis.ee.ethz.ch paulsc@iis.ee.ethz.ch]
 
* [[:User:Paulsc | Paul Scheffler]]: [mailto:paulsc@iis.ee.ethz.ch paulsc@iis.ee.ethz.ch]
 
* [[:User:Tbenz | Thomas Benz]]: [mailto:tbenz@iis.ee.ethz.ch tbenz@iis.ee.ethz.ch]
 
* [[:User:Tbenz | Thomas Benz]]: [mailto:tbenz@iis.ee.ethz.ch tbenz@iis.ee.ethz.ch]

Revision as of 18:33, 2 November 2020


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