HDL Synthesis Coding Guidelines
Lattice Semiconductor
for Lattice Semiconductor FPGAs
15-13
The following are guidelines for coding the Clock Enable in Lattice Semiconductor FPGAs:
Clock Enable is only supported by FFs, not latches.
Nibble wide FFs and slices inside a PFU share the same Clock Enable
All flip-flops in the Lattice Semiconductor FPGA library have a positive clock enable signal
In the ORCA Series 4 architecture, the Clock Enable signal has the higher priority over synchronous
set/reset by default. However, it can be programmed to have the priority of synchronous LSR over the prior-
ity of Clock Enable. This can be achieved by instantiating the library element in the source code. For exam-
ple, the library element FD1P3IX is a flip-flop that allows synchronous Clear to override Clock Enable.
Users can also specify the priority of generic coding by setting the priority of the control signals differently.
The following examples demonstrate coding methodologies to help the synthesis tools to set the higher pri-
ority of Clock Enable or synchronous LSR.
SET / Reset
There are two types of set/reset functions in Lattice Semiconductor FPGAs: Global (GSR) and Local (LSR). The
GSR signal is asynchronous and is used to initialize all registers during configuration. It can be activated either by
an external dedicated pin or from internal logic after configuration. The local SET/Reset signal may be synchro-
nous or asynchronous. GSR is pulsed at power up to either set or reset the registers depending on the configura-
tion of the device. Since the GSR signal has dedicated routing resources that connect to the set and reset pin of
the flip-flops, it saves general-purpose routing and buffering resources and improves overall performance. If asyn-
chronous reset is used in the design, it is recommended to use the GSR for this function, if possible. The reset sig-
nal can be forced to be GSR by the instantiation library element. Synthesis tools will automatically infer GSR if all
-- VHDL Example of Sync. LSR Over CE
...
COUNT8: process(CLK, GRST)
begin
if (GRST = '1') then
cnt <= (others => '0');
elsif (CLK'event and CLK='1') then
-- LSR over CE: Sync. Set/Reset has higher priority
if (LRST = '1') then
cnt <= (others => '0');
elsif (CKEN = '1') then
cnt <= cnt + 1;
end if;
// Verilog Example of Sync. LSR Over CE
...
always @(posedge CLK or posedge GRST)
begin
if (GRST)
cnt = 4'b0;
else if (LRST)
cnt = 4'b0;
else if (CKEN)
cnt = cnt + 1'b1;
end
...
-- VHDL Example of CE over Sync. LSR
...
COUNT8: process(CLK, GRST)
begin
if (GRST = '1') then
cnt <= (others => '0');
elsif (CLK'event and CLK='1') then
-- CE Over LSR: Clock Enable has higher priority
if (CKEN = '1') then
cnt <= cnt + 1;
elsif (LRST = '1') then
cnt <= (others =>'0');
end if;
end process COUNT8;
// Verilog Example of CE over Sync. LSR
...
always @(posedge CLK or posedge GRST)
begin
if (GRST)
cnt = 4'b0;
else
if (CKEN)
cnt = cnt + 1'b1;
else if (LRST)
cnt = 4'b0;
end...