Introduction
All Handel-C code written for this course must follow the coding guidelines outlined in this document. The goals are for you to write code that is easy to read and which has the maximum likelihood of running correctly.
Guidelines
- Set your editor to substitute spaces for tab characters. In DK, you do this from Tools -> Options -> Tabs.
- No line of code, including comments, may extend beyond column 80.
- Put the name of each source file in a comment in the first line of the file.
- Put a comment block at the beginning of each source file telling what the program does, who the author(s) is(are), and when the program was written.
- Put a comment block before each function, macro proc definition, and endless loop. Make sure this comment block stands out on the page. For example, put a horizontal line below the name of the function or macro proc name, such as the following:
- Be sure there is at least one space between comment leaders and the text that follows. (“Comment leaders” are // for single line comments, or /* or * for comment blocks.) Format the comments so they are easy to read and document the logical structure of the code.
- Put spaces around operators to make the code easier to read. “x += 3;” is easier to read than “x+=3;”
- Be sure all code compiles and builds with no errors or warnings for both Debug and EDIF configurations. The only exceptions are the Pal macro expansion warnings (“possible infinite expansion”) that do not indicate a problem.
- Be sure the Xilinx tools report no problems, such as an inability to meet timing constraints