|
||||||||||
Real-World Reuse: RTL Recycling
Gordon Walker, Engineering Director, Mentor Graphics Design Creation Business Unit (UK)
Tom Dewey, Technical Marketing Engineer, Mentor Graphics Design Creation Business Unit (USA) Introduction In the real world of electronic product design, time-to-market can have a large impact on success. To facilitate production speed, RTL from existing projects is often recycled for use in the new project. The danger of this approach is that recycling code that was never designed for reuse can actually lead to delayed projects. Time is lost understanding the existing code, establishing the quality of the design, and potentially modifying code to meet company standards. This paper presents the theory that a method can be applied to recycling RTL code that in turn leads to a design that can be easily reused on a new project. By applying this method to the very real process of recycling RTL in the context of a new project, the resultant code actually has been designed for reuse. The method includes:
Finding Files In order to recycle RTL code within the context of a new project, all the files required for successful simulation need to be located. As Figure 1 shows, the task is to separate and organize required files from all the files available. Figure 1: Separating required files Files can be categorized as:
During the process of finding valuable files, save them in a defined directory structure. For example, it is common to store files in a simple structure similar to the sample that Figure 2 shows. Figure 2: Sample directory structure Determining Data Integrity Before reusing a design, the integrity of the data must be insured. At a minimum, there cannot be any missing files or files containing syntax errors. Additionally, the hierarchical composition of the design must be understood. During the process of finding required files, it might be determined that some files are missing. Missing files can be categorized as:
Use any tool that compiles RTL to determine syntax or semantic errors in the code. Errors can be caused by:
Many tools exist that allow you to see the hierarchical relationship of the design after the files are part of a project. Use one of these tools to understand the structural composition of the design. Visually inspect the testbench for the recycled design. If the answer is “no” to any of the following questions, there is significant work involved in recycling this design. Does the testbench:
Using Code Checkers Code checkers (or linters) apply a set of RTL coding rules to recycled code or code under development. These rules often represent collective knowledge as to how to write quality RTL code. Running a design checker facilitates getting an estimate as to the quality of the code based on the number and types of violations that occur. Some violations are easy to fix and have no impact to other parts of the code. For example, incomplete sensitivity lists or not having a default case defined for a finite state machine. Other violations take considerable time to fix. For example, eliminating combinational feedback loops requires re-writing significant code. Assess which violations must be fixed in order to recycle this code in the new project. Estimate the time it will take to fix the violations and adjust scheduling accordingly. Be prepared to defend violations that remain in the code to the design team. Some code checkers also have the ability to assign a weighted score to each coding rule. This allows the tool to present an overall quality metric for the code based on deducting violations from a total possible score. Use this capability to objectively measure code quality and to present findings to the team. It is also good design practice to use code checkers to ensure RTL quality during the development of any new code surrounding the recycled code. It is efficient to catch coding violations as the code is written to minimize design errors in downstream tools (such as simulation, synthesis, or place and route). Documenting Code Often, the code to be recycled was written in a hurry. One of the first elements omitted when code is quickly written is documentation. But, documentation is key to understanding recycled code. Look for the following items to help understand code:
Preparing for Design Reviews The next step for recycling code is to hold a design review within the team. Design reviews are also common at particular milestones of any new project. One method to help automate preparing for design reviews is to create a stand-alone website. At the top level, enter a brief design description and some up-to-date notes on the design status. Then create (or use a tool to generate) a web page for the design and link in the following:
Take notes during the design review and link those into the website in order to capture a review history. Applying Version Management Before the recycled code can be used on a new project, it needs to be plugged into an existing version management system for the project. If a system is not in place, strong consideration should be given to using version management on the new project. Designs are typically created within a team that could be geographically dispersed, all working on different blocks of the design. These design descriptions go through several iterations. However, at some point, someone on the team will want to build the design into the whole system. If the team does not employ version management, odds are that at least one of the files has errors or is missing, meaning the design will fail. There are many free and commercial tools to help manage versions of the RTL code. But version management is more of an education and discipline concept. The entire team needs to be well versed in the concepts of labeling files, checking in and out code from a central location, and building the design successfully for testing. If a version management methodology is not valued or it is considered hard to use, teams can find themselves with members that do not have the discipline to use the system. A good method to combat this syndrome is to:
There is no greater waste of time than creating a design that already exists within a team or corporation. To complete the RTL recycling flow, create a simple web page that centrally houses designs that everyone can share, including the design that was just recycled. A simple reuse repository can be built and maintained by creating a web page that contains:
Figure 3: Sample reuse repository Conclusion In the real world, designers have always recycled code in order to jumpstart a new project and to save time. By following the recycling flow presented in this paper, a design for reuse flow is actually implemented for the recycled code and for any new project, as Figure 4 shows. Figure 4: The recycling flow actually implements a design for reuse flow
|
Home | Feedback | Register | Site Map |
All material on this site Copyright © 2017 Design And Reuse S.A. All rights reserved. |