RTL CodingGuide
RTL CodingGuide
Trio Adiono
Line Length
• Guideline
– Keep line length to 72 char or less
D D Q D Q Q
Clock
D D Q D Q Q
Clock
• Alternative:
– Design synchronous design
– Use multiple clocks
• Guideline:
– Keep the clock and/or reset generation circuitry as a separate
module at top level of the design.
– Partition the design so that all the logic in a single module use
a single clock and single reset.
– Gated clock should never occur within a macro.
– Gated clock should appear at top level of the design
hierarchy.
– Standard timing analysis and scan chain can be applied to
each module.
– See Example 5-17
D Q Q
A
C B
entity AND_OR_XOR is
port (A,B : in bit;
Z_OR, Z_AND, Z_XOR :
out bit);
end AND_OR_XOR;
architecture RTL of
AND_OR_XOR is
begin
A_O_X: process (A, B)
begin
Z_OR <= A or B;
Z_AND <= A and B;
Z_XOR <= A xor B;
end process A_O_X ;
end RTL;
architecture
architecture rtl rtl of
of D_FF
D_FF is
is
begin
begin Flip-flop
process
process (Clock,
(Clock, Reset)
Reset) isis
begin
begin
if D D Q Q
if Reset
Reset == ‘‘11’’ then
then
QQ <= ‘ 0 ’
<= ‘0’;;
elsif
elsif ((Clock’
Clock’’event
Clock
Clock’ event and
and Clock=‘
Clock=‘‘11’’)) then
Clock=
Clock=‘ then
QQ <= D;
<= D; Clock
R
end if;
end if;
end
end process;
process;
end
end architecture rtl;
architecture rtl;;
rtl
rtl;
Reset
--
-- rising
rising edge
edge ff
ff
-- async reset
-- async reset
S1
S1 <=
<= ‘0’;
‘0’; S0 D QD Q D Q D Q D Q S3
S2
S2 <=
<= ‘0’;
‘0’;
S3 <= ‘0’;
S3 <= ‘0’; Clock Clock Clock
else
else R R R
S1
S1 <=
<= S0;
S0; Reset Reset Reset
S2 <= S1;
S2 <= S1;
S3
S3 <=
<= S2;
S2;
end if;
end if;
end
end if;
if;
end process;
end process;
end
end architecture
architecture rtl;
rtl;
--
-- rising
rising edge
edge ff
ff
-- sync reset
-- sync reset