Using GSR in Lattice FPGAs
Using GSR in Lattice FPGAs
Details regarding the architecture of global signals are described in the data
sheet for each device family on the Lattice Web site. For more information on
the GSR library element, see the FPGA Libraries Help system.
GSR Hardware Resource Lattice FPGAs contain both GSR (Global Set
Reset) and PUR (Power Up Reset) resources. The GSR hardware resource
in Lattice FPGAs provides a convenient mechanism to allow design
components to be reset without using any routing resources.
Note: The PUR resource is used to reset the device after configuration is
complete when the device is powered on. A PUR component is provided to
allow simulation testbenches to simulate this pulse, but this component is
never used as part of the design. For more information on PUR, see the How
to Use the Power Up Set/Reset (PUR) Global Signal topic.
There are two primary ways to take advantage of the GSR hardware resource
in your design: use the GSR to reset all components on your FPGA or to use
the GSR to eliminate any routing resources needed for one reset in a multiple
reset design. If there is only one reset signal for the entire design, you would
want to use the GSR in the first way, to reset all components on the FPGA.
When using the GSR to eliminate any routing resources needed for one reset
in a multiple reset design, typically the GSR would be used for the reset with
the highest fan-out.
Note: The GSR should only be used for asynchronous active low resets since
the hardware will always assert GSR asynchronously. The software will take
this into account automatically and will not connect a synchronous reset to
GSR when the Inferred GSR or User Specified Inferred GSR modes are used,
However there are ways to override the software default behavior. You are
responsible for ensuring correct functionality when overriding the normal
software defaults or when using the Global GSR usage mode. The following
sections of this document detail how to take advantage of this resource with
the Lattice ispLEVER design software.
GSR Usage Cases In ispLEVER, there are four usage cases with respect
to initialization set/resets: Inferred GSR, User-Specified Inferred GSR, Global
GSR, and LSR (No GSR).
The four GSR usage cases are defined in the bullet list below:
Inferred GSR – In this case the software automatically determines which
reset signal has the highest fan-out (for either single or multiple reset
designs) and uses the GSR resource as the routing for that reset signal.
This usage case is the default condition in ispLEVER if there is no user-
instantiated GSR component in the design.
This usage case is the best choice for most applications. The software
determines the reset with the most loads and uses the GSR resource for
that signal which provides the largest reduction in needed routing
resources. The Inferred GSR usage case can also be used whether the
design has a single or multiple resets.
User-Specified Inferred GSR – This is the same as the Inferred GSR
usage except that the reset signal that is specified in the preference (.lpf)
file determines which signal uses the GSR resource regardless of the fan-
out of the signal.
Global GSR – This case treats the GSR resource as a reset for all
elements in the design.
LSR (No GSR) – LSR (local set/reset) specifies that no GSR is to be
used, that is, that all resets will use local routing resources instead of
using the GSR resource.
Note: In the Inferred GSR and User-Specified Inferred GSR usage cases, the
software will only connect elements with an asynchronous reset to GSR.
Elements requiring a synchronous reset will use only local routing.
Inferred GSR The Inferred GSR usage case is the simplest to use. If
everything is left to default software settings and no GSR component is
instantiated in the design, then the software will implement a design using
GSR for the reset signal with the highest fan-out.
Inferred GSR is the recommended usage case unless any of the following
conditions exist:
If you need to use a specific reset signal for GSR.
If you need to globally use GSR even when there are multiple resets.
If you need to completely disable GSR.
To use the Inferred GSR usage case, there are no design changes necessary.
You simply implement the design using ispLEVER with default settings. The
necessary software settings are listed below.
User Specified Inferred GSR The User Specified Inferred GSR usage
case is identical to the Inferred GSR usage case except that the reset signal
on which GSR is inferred is specified in the preference (.lpf) file instead of
being automatically determined by fan-out.
To use the User-Specified Inferred GSR usage case, there are no design
changes necessary. You simply implement the design using ispLEVER with
default settings and a GSR_NET preference specified. The necessary
software settings are listed below.
Global GSR The Global GSR usage case is intended for all elements in a
design to be reset using the GSR resource. This usage is a good fit for a
design with a single reset. It can also be used with multiple resets in the
design, but it can produce unexpected functionality in this case. For example,
if the GSR resource is used for the reset with the largest fan-out, elements on
a second reset signal will still be reset by the first reset signal. Additionally,
any registers with a synchronous reset will be attached to their local reset as
well as the GSR reset (which asserts asynchronously).
Note also that the GSR resource is active low. In the case of a register using
an active high reset, that register will remain connected to the signal but will
have GSR enabled. This will cause the register to remain in reset. If a mix of
active low and active high resets are used in a design or a mix of synchronous
and asynchronous resets are used, then the Inferred GSR usage case should
be used. In the Inferred GSR usage case, the software will automatically take
into account whether a reset is synchronous, asynchronous, active high, or
active low. In the Global GSR usage case, the software assumes the user
knows what the design intent is and makes minimal design changes in order
to allow the user intent to be implemented. Global GSR is meant for a true
global reset application.
To use the Global GSR usage case, a GSR component must be instantiated
in the design and connected to the signal that is targeted as the reset signal,
usually a primary input. If a GSR component is not instantiated in the design,
the software will not treat the design as a Global GSR usage case. The GSR
component must be instantiated into the design itself, not into the testbench
for the design. Below are examples of how to instantiate the GSR library
element in both Verilog and VHDL.
Note that in Verilog the GSR instantiation must be in the top-level module of
the design and it must be named GSR_INST. The necessary software
settings are listed below.
LSR (No GSR) The LSR (local set/reset) usage case always uses local
routing for the reset signals and does not use the GSR resource. This is the
recommended usage case if there is a requirement to do timing analysis on
the reset signals or if synchronous reset is being used throughout the design.
To use the LSR usage case there must be no GSR instantiated in the design,
no GSR_NET preference specified, and the software settings used do not
infer any GSR resource. The necessary software settings are listed below.
Using the GSR Resource with Lattice IPs Lattice IPs use the GSR
resource when running in evaluation mode and may require it on an individual
basis for performance reasons. How the GSR options should be used with
Lattice IPs varies depending on whether the IP was released prior to the
ispLever 7.2 software release or after. See the sections below for details.
Note that when the IP GSR option is disabled and if all of the following
conditions are met, then the IP cannot be used in evaluation mode:
If an Inferred GSR, User-Specified Inferred GSR, or LSR (No GSR) usage
case is used
If the reset signal connected to the IP does not have GSR inferred on it
RTL Functional Simulation and the GSR Resource If the GSR resource
is used as a routing replacement for one of the reset signals in a design using
the Inferred GSR or User-Specified GSR usage cases, then the functional
simulation will be correct for both the RTL (pre-synthesis) design and the
netlist (post-synthesis and post-map) versions of the design.
If the GSR resource is used as a global reset, however, the RTL functional
simulation will not correctly simulate the reset functionality if the design uses
multiple resets. Global GSR causes all Lattice components in the design to
respond to the reset used for the GSR whether they are connected to that
reset or not. In the RTL representation the use of the GSR resource is not
modeled in synthesizable RTL code, but in the post-map netlist, the entire
design will respond correctly to the reset used for GSR. This is because the
design will now consist of Lattice components that have been modeled to take
the GSR information into account as part of their functionality. The post-map
design will reset all elements sensitive to GSR when the reset signal assigned
to GSR is used. Even if an element is connected to a different reset, it will still
reset when the GSR signal is used if it is sensitive to GSR.
If the design contains both RTL code and Lattice component instantiations,
the design may need some additions to prevent simulation problems. Verilog
simulations will produce errors if there are library elements in the design that
use the GSR information and instantiations of both GSR and PUR
components are not present in the top-level of the design. For Verilog
designs, you must instantiate the GSR component in the top level of the
design hierarchy with the instance name of GSR_INST if the design contains
any instantiation of library elements that are affected by the GSR settings
(sequential and memory components in general). Additionally, you must also
instantiate the PUR component in the top level of the design hierarchy with
the instance name of PUR_INST for these same components. Below are
examples of the Verilog instantiations of GSR and PUR.
If any usage case other than the Global GSR usage case is desired, the GSR
and PUR components must be removed from the top-level hierarchy before
synthesizing the design (Build Database process step) if the top level is part
of the design. The one exception to this requirement is if the GSR and PUR
components are connected to VCC instead of a design signal. The GSR and
PUR components do not require removal if they are connected to VCC. If the
top level of the design hierarchy is the testbench, then the GSR and PUR
components do not need to be removed for any of the usage cases.
Verilog simulation models access the GSR state by referring to a signal inside
the GSR component that must be instantiated at the top level of the design.
This can be seen in the following piece of Verilog code inside a simulation
library module:
parameter GSR = "ENABLED";
-------------Entity Declaration-------------------------
GENERIC (
gsr : String := "ENABLED");
-------------Architecture Body------------------------
IF (gsr = "DISABLED") THEN
set_reset := purnet;
ELSE
set_reset := purnet AND gsrnet;
END IF;
Verilog
GSR VCC
PUR
VHDL VHDL
VHDL
Verilog Verilog
GSR VCC GSR VCC
PUR PUR
structure, the Verilog GSR and PUR instantiations must be at the top of
the Verilog hierarchy, not the top of the whole hierarchy since the top is
VHDL. If the design has a VHDL top and there are multiple Verilog
instantiations or modules within the VHDL design, then each separate
Verilog hierarchy must have its own GSR and PUR component
instantiation. The GSR and PUR component instantiations in one Verilog
hierarchy are not visible to other separate hierarchies.
Global GSR functional simulation, Verilog top, VHDL bottom. Since the
GSR information for Lattice simulation libraries is simulated in Verilog and
VHDL using different mechanisms, it is required to have a GSR
component instantiation in each language section.
Verilog
reset GSR
PUR
VHDL VHDL
GSR GSR
VHDL
reset GSR
PUR
Verilog Verilog
GSR GSR
Inferred GSR and User Specified Inferred GSR usage cases are used to allow
the software to determine the reset automatically or from a preference.
However, since Map is run in separate projects individuality there is no step in
the BMD flow where the software has full visibility over the entire design to
accomplish this. The BMD flow, however, is compatible with the Global GSR
case as long as care is used to select the correct reset signal in each BMD
project.
For the Global GSR usage case, a GSR component must be instantiated in
the design for each project and connected to the correct reset signal. For the
LSR (No GSR) usage case, the map property Don’t Infer GSR needs to be
set to True so as not infer GSR for each project.
The GSR flow in ispLEVER 7.2 uses Map as the central point in determining
how to use the GSR resource. A significant advantage of this flow is that Map
has visibility into the entire design to make the correct choice on how to use
the GSR resource. Sometimes a design is synthesized as multiple sections.
Setting the GSR resource during synthesis allows the potential of errors since
each synthesized section could be using different options. Additionally, since
Map has visibility of the whole design, there is no longer any requirement to
have individual GSR options in modules and IPs. Finally the Map-based flow
provides a new option to allow the desired signal for GSR inferencing to be
specified and allows a single point to disable any usage of the GSR resource.
One example of the need to use this information is in the case of using Global
GSR. If one section of the design is required to continue functioning during
the use of reset (e.g., such as a communication port), then it is possible to use
attributes to prevent the GSR resource from being implemented in a particular
hierarchy or component. Likewise, it is possible to force a hierarchy or
component to respond to GSR even if it was on a different reset in the Inferred
GSR case. To correctly use these attributes, it is necessary to understand
both the hierarchy inheritance order and how each attribute is treated in the
different usage cases.
GSR Attribute Values and Syntax You must specify which portions of the
design that you wish to alter the way in which they respond to the GSR reset
signal. Unless specified otherwise, by default, all design elements will
respond to the global reset signal if it is present. The available values are as
follows.
ENABLED – This is the default value on most library elements. This value
allows the software to determine the final value and will be overridden by
the parent hierarchy if the parent has a value of anything other than
ENABLED.
DISABLED – This prevents the hierarchy or element from responding to
the GSR value. It cannot be changed by the parent’s value.
FORCEENABLE – This forces the hierarchy or element to respond to the
GSR value. It cannot be changed by the parent’s value.
IPENABLE – This forces the hierarchy or element to respond to the GSR
value when IP is being used in evaluation mode. It cannot be changed by
the parent’s value. This is only meant for internal Lattice IP to use. This
value should never be used within a design itself.
These values are then placed as synthesis attributes in the design which
synthesis will pass to the Map program. The attributes can be placed on any
instance whether it is a level of hierarchy or a leaf component. Map will then
interpret the attributes along with the usage case and make the necessary
changes to the design. After Map is finished, all elements in the design will
have GSR values of either ENABLED or DISABLED only. The syntax of the
attributes is shown below for Verilog and VHDL with “VALUE” shown as the
placeholder for legal values.
Note
Replace the placeholder VALUE in the above syntax examples with legal values from
the value list.
Note
Replace the placeholder VALUE in the above syntax examples with legal values from
the value list.
The first column in the table below represents the possible explicit values an
instance can have. An explicit value is one which has been put directly on the
instance. The first row represents the possible implicit values a library
element can have via GSR attribute set at a parent module that includes the
instance. The “parent” term is used loosely here as more precisely, the GSR
value could be sitting on one or more levels of hierarchy above the parent.
Determining Final Post-Map GSR Attribute Value Following are the rules
that the map software uses to determine the GSR attribute value of the
physical component that a pre-map library element gets mapped into in the
post-map netlist.
The first column represents the possible “actual” values that a pre-map library
element can have. The top row represents the usage case map is operating
under.
The final post-map GSR value a component has will depend on the following
conditions.
The usage case (Global GSR or either Inferred or User Specifed Inferred)
If the component is on the inferred reset domain or not
If any Lattice IP is being used in evaluation mode
In order to avoid this issue the User Specified Inferred GSR usage case can
be used. The desired reset signal should be specified in the preferences as
defined for this usage case. Additionally at the top of the design, the attribute
GSR=FORCEENABLED should be specified. This will force all components,
even in a multiple reset design, to be reset by GSR similar to the Global GSR
usage case. Design elements that need to be prevented from resetting can
use the GSR=DISABLED attribute to block reset for those components or
hierarchies since they will not be affected by the GSR=FORCEENABLED as
shown in Table 1.
About the GSR and PUR Signals Both Global Set/Reset (GSR) and PUR
are global RESET signals that will initialize the chip to some known reset
state. In a given device, GSR has a dedicated input pad; however, PUR is not
driven by any external pad. PUR is only activated upon device startup, just
after configuration is complete, which is basically power-up of the device.
Unlike PUR, the GSR signal can be called at any time during operation to
reset the devices initial values.
Using the PUR Library Element The Power Up Set/Reset (PUR) signal is
activated during device configuration and is driven by internal circuitry. PUR is
often used in the context of a system-level simulation where the power up
control of the PC board is verified. You can model the behavior of this signal
by adding the PUR library element to your test fixture. When the PUR input
port is driven all register elements of the design will respond as if a global set/
reset was asserted. PUR is in an active LOW state by default.
You commonly instantiate the PUR element in the test fixture with the
instance name PUR_INST.
Note: Verilog simulations will produce errors if there are library elements in
your design that require the instantiation of GSR, PUR, and TSALL elements
and they are not present. For Verilog designs, you must instantiate the PUR
and GSR elements in their top-level netlists with instance names PUR_INST
and GSR_INST respectively if the design contains any instantiation of library
elements which are affected by GSR.
The examples below shows proper syntax for instantiating a PUR element in
Verilog HDL or VHDL.
As shown in the Verilog PUR example, this VHDL PUR element instantiation
below also shows a parameter called RST_PULSE with a value of 10 ns that
is used to set the required reset pulse length.
PUR_INST : PUR
generic map (RST_PULSE => 10)
port map (PUR => <signal>);
Note: PUR library elements should be used as part of a Verilog test fixture or
VHDL test bench to model power up set/reset only. PUR library elements can
not interface to a signal of the FPGA design itself.
Using the TSALL Library Element By default the tristate enable of PIO
blocks will be assigned to local output enable signals of the design. To
explicitly connect a design signal to the global tristate network of the device
then it is necessary to instantiate the TSALL library element in your design.
TSALL is considered active LOW to enable output.
Important: You must instantiate the TSALL with the instance name
TSALL_INST. The port name for the MachXO TSALL library element is
TSALL. The port name for the LatticeSC/M TSALL library element is TSALLN.
Note: Verilog simulations will produce errors if there are library elements in
your design that require the instantiation of GSR, PUR, or TSALL elements
and they are not present.
The examples below show proper syntax for instantiating the MachXO and
LatticeSC/M TSALL element in Verilog HDL or VHDL, respectively.
component TSALL
port( TSALL: in STD_ULOGIC );
end component;
-- Attributes for Synplify
attribute syn_black_box: boolean ;
attribute syn_black_box of TSALL: component is true;
attribute syn_noprune: boolean ;
attribute syn_noprune of TSALL: component is true;
-- Attributes for Precision RTL
attribute BLACK_BOX : boolean;
attribute BLACK_BOX of TSALL: component is true;
attribute DONT_TOUCH : boolean;
attribute DONT_TOUCH of TSALL_INST: label is true;
begin
component TSALL
port( TSALLN: in STD_ULOGIC );
end component;
-- Attributes for Synplify
attribute syn_black_box: boolean ;
attribute syn_black_box of TSALL: component is true;
attribute syn_noprune: boolean ;
attribute syn_noprune of TSALL: component is true;
-- Attributes for Precision RTL
attribute BLACK_BOX : boolean;
Note
Lattice Applications recommends using "don't touch" synthesis directives, like
syn_noprune and DONT_TOUCH, with library elements that you instantiate in VHDL
designs. For more information on Lattice library elements, see the FPGA Libraries
Help system.









