10-Coding Guidelines 07
10-Coding Guidelines 07
KJLEE
Ref : Reuse Methodology Manual (RMM) Keating & Bricaud, 3rd Edition, 2002.
VLSI System Design CodingStyle.2 NCKUEE-KJLEE
General Rules
Simple: structure, clocking, etc. Consistent: naming Regular: module size, output
registered Understandable: comments, meaningful names, parameters & constants
CodingStyle.3
NCKUEE-KJLEE
Short but descriptive parameters (for synthesis) Prefix clk for clocks, prefix rst for reset. *_x for active low, e.g., rst_n, act_b. Use [x:0] rather than [0:x] Use *_r for output of a register Use *_z for tristate signal
Use concise but explanatory comments where appropriately. Avoid multiple statements in one line. Use indentation to improve readability.
Use indentation of 2 spaces; do not use tab
CodingStyle.5
NCKUEE-KJLEE
);
CodingStyle.6
NCKUEE-KJLEE
CodingStyle.7
NCKUEE-KJLEE
Specify constant definition file (e.g., DesignName_constances.v) only on tool command line.
Use DesignWare Fundation Library of Synopsys for arithmetic components (adders, multipliers,comparators, incrementers/decrementers, sum of product, sin/cos,modulus/divide, square root, arithmetic and barrel shifters)
CodingStyle.8
NCKUEE-KJLEE
Isolate technology-specific gates in a separate module. Do not use those descriptions that cannot be translated
from Verilog to VHDL and vice versa.
VLSI System Design CodingStyle.9 NCKUEE-KJLEE
Avoid both positive and negative edge-triggered flip-flops. Separate positive-edge and negative-edge triggered flip-flops into
different modules --- make scan design easier.
Avoid clock buffers --- leave it to clock insertion tool. Avoid gated clock --- to avoid false clock or glitch, and improve
testability.
Avoid internally generated clocks --- for testability. If internally generated clocks are necessary, separate it in a top-level
module.
Use case instead of nested if-then-else statements. Separate FSM and non-FSM logic in different modules. Keep late-arriving signals with critical timing closest to the
output of a module, e.g., earlier in if-then-else structures.
CodingStyle.12
NCKUEE-KJLEE
Try to register all outputs of each block in a hierarchical design Locate related combinational logic in a single module Separate modules that have different design goals. Avoid asynchronous design except reset. If asynchronous is required, put it in a separate module. Put relevant resources to be shared in the same module. Eliminate glue logic at the top-level. For an SOC, the top level contains only I/O pad rings, clock generator logic.
The clock generation circuitry should be isolated from the rest of the design.
VLSI System Design CodingStyle.13 NCKUEE-KJLEE
CodingStyle.14
NCKUEE-KJLEE
assign default
begin else
inout or reg
Unsupported operators -Case equality -inequality operators (=== and !==) Unsupported gate-level constructs - nmos, pmos, cmos, rnmos, - rpmos, rcmos - pullup, pulldown, tranif0, - tranif1, rtran, rtrainf0, - rtrainf1 gate types Unsupported miscellaneous constructs - hierarchical names within a module If you use an unsupported construct, Presto Verilog issues a syntax error such as event is not supported
CodingStyle.16
NCKUEE-KJLEE