My focus has always been on what is good for synthesis with little regard to the effect on simulation speed.
Create a block level diagram before begin your coding
Draw a simple block diagrams of the functions of your design. This will also helpful in documentation. Use these block diagrams while code your design.
Always think of a fresher who read your RTL
Create a block level diagram before begin your coding
Draw a simple block diagrams of the functions of your design. This will also helpful in documentation. Use these block diagrams while code your design.
Always think of a fresher who read your RTL
Start with the inputs to your design - on the left side of block diagram - and describe the design's functionality from inputs to outputs. Don't try to be an ultra-efficient RTL coder. Please dont forget to put comments. Have a comment header for each module, comment the functionality of each I/O, and use comments throughout the design to explain the tricky parts.
Hierarchy
At the top level of your chip there should be 4 or 5 blocks: I/O pads, clock generator, reset circuit, and the core design. They are in separate blocks, because they might not be all synthesizable. Isolating them simplifies synthesis. Typically, the core design is hierarchical and organized by function.
Use separate always@ blocks for sequential logic and combinatorial logic
There is one good paper by Stuart Sutherland about the blocking and non-blocking assignments. This paper can be downloaded from here.
Know whether you have prioritized or parallel conditions
If the conditions are mutually exclusive, then a case statement is better, because it is easier to read and it organizes the parallel states of the description. If multiple conditions can occur at the same time, use the if statement and prioritize the conditions using else if for each subsequent condition.
Completely specify all branches of all conditional statements
If you completely specify all possible combinations of ones and zeros for the different cases and you use the same select operator for all cases DC will automatically recognize that case statement is fully specified and parallel.
Initialize output of conditional statements prior to defining the statements
Be careful selecting what value you initialize the output to. If there is't a default state for that part of the design then try to pick the most popular state to initialize the output to that should help reduce extra switching (power) during operation.
Use high level constructs (case, if, always@) as much as possible
Synthesis works best with high level RTL constructs. Low level gates or Boolean level constructs (verilog primitives) constrain DC.
Using good coding style and writing safe RTL code is not enough! Understand what you are implying and figure out in advance where are the potential problems. You should be able to manually synthesize in your head what you have described in your RTL description.
Hierarchy
At the top level of your chip there should be 4 or 5 blocks: I/O pads, clock generator, reset circuit, and the core design. They are in separate blocks, because they might not be all synthesizable. Isolating them simplifies synthesis. Typically, the core design is hierarchical and organized by function.
Use separate always@ blocks for sequential logic and combinatorial logic
- It helps organize your RTL description
- There is a sequential optimization process in DC, which uses your coding style description of the sequential element to map it to the best sequential element in your technology library. When you combine sequential and combinatorial logic descriptions together, the tool can get confused and might not recognize the type of sequential element you are describing.
There is one good paper by Stuart Sutherland about the blocking and non-blocking assignments. This paper can be downloaded from here.
Know whether you have prioritized or parallel conditions
If the conditions are mutually exclusive, then a case statement is better, because it is easier to read and it organizes the parallel states of the description. If multiple conditions can occur at the same time, use the if statement and prioritize the conditions using else if for each subsequent condition.
Completely specify all branches of all conditional statements
If you completely specify all possible combinations of ones and zeros for the different cases and you use the same select operator for all cases DC will automatically recognize that case statement is fully specified and parallel.
Initialize output of conditional statements prior to defining the statements
Be careful selecting what value you initialize the output to. If there is't a default state for that part of the design then try to pick the most popular state to initialize the output to that should help reduce extra switching (power) during operation.
Use high level constructs (case, if, always@) as much as possible
Synthesis works best with high level RTL constructs. Low level gates or Boolean level constructs (verilog primitives) constrain DC.
Using good coding style and writing safe RTL code is not enough! Understand what you are implying and figure out in advance where are the potential problems. You should be able to manually synthesize in your head what you have described in your RTL description.