
HDL Synthesis Coding Guidelines
Lattice Semiconductor
for Lattice Semiconductor FPGAs
15-11
The following are the HDL representations of the design in
Figure 15-7.The preferable way is to fully employ the PFU's natural “Ripple-mode”. A single PFU can support up to 8-bit ripple
functions with fast carry logic.
Figure 15-8 is an example of 4-bit counter in PFU “Ripple Mode”. In Lattice Semicon-
ductor FPGA architectures, an internal generated clock can get on the clock spine for small skew clock distribution,
further enhancing the performance of the clock divider.
Figure 15-8. Use PFU “Ripple Mode”
Here are the HDL representations of the design in
Figure 15-8.-- VHDL Example of Daisy Chaining FF
...
-- 1st FF to divide Clock in half
CLK_DIV1: process(CLK, RST)
begin
if (RST='1') then
clk1 <= '0';
elsif (CLK'event and CLK='1') then
clk1 <= not clk1;
end if;
end process CLK_DIV1;
-- 2nd FF to divide clock in half
CLK_DIV2: process(clk1, RST)
begin
if (RST='1') then
clk2 <= '0';
elsif (clk1'event and clk1='1') then
clk2 <= not clk2;
end if;
end process CLK_DIV2;
//Verilog Example of Daisy Chaining FF
...
always @(posedge CLK or posedge RST)
begin
if (RST)
clk1 = 1'b0;
else
clk1 = !clk1;
end
always @(posedge clk1 or posedge RST)
begin
if (RST)
clk2 = 1'b0;
else
clk2 = !clk2;
end
...
DIVBY2
DIVBY4
DIVBY8
DIVBY16
LUT in
Ripple Mode
4-Bit
Counter
-- VHDL : “RippleMode” Clock Divider
...
COUNT4: process(CLK, RST)
begin
if (RST='1') then
cnt <= (others=>'0');
elsif (CLK'event and CLK='1') then
cnt <= cnt + 1;
end if;
end process COUNT4;
DIVBY4
<= cnt(1);
DIVBY16 <= cnt(3);
//Verilog : “RippleMode” Clock Divider
...
always @(posedge CLK or posedge RST)
begin
if (RST)
cnt = 4'b0;
else
cnt = cnt + 1'b1;
end
assign DIVBY4
= cnt[1];
assign DIVBY16 = cnt[3];
...