EMA Resources

Blog

Home > EMA Resources > Blog > SR Flip-Flop SPICE Model: Explained

SR Flip-Flop SPICE Model: Explained

Modeling designs help engineers verify whether their circuit will function as intended. Modeling programs simulate circuit behavior under different conditions and in accordance with the design requirements, allowing engineers to better plan and build circuits.

Typically, to model components, generic models are used, which produce inaccurate and unrealistic simulations based on ideal conditions. This can cause functionality issues to go undetected until far later in the design process. To confidently simulate digital circuitry, create a SR Flip-Flop SPICE model using specifications from a manufacturer’s datasheet.

Open in New Window

What is a Clocked SR Flip-Flop?

Flip-flops are basic elements for storing one bit of information. Flip-flops have their content change only either at the rising or falling edge of the enable signal which is typically the clock signal. After the rising or falling edge of the clock, the flip-flop content remains constant even if the input changes. Flip-flops are more formally known as ‘bistable multivibrator’ because they have two stable states. It can remain in either of the two states indefinitely until directed by any input signal to switch states. A Set-Reset Flip Flop or SR Flip Flop is used in digital electronics to store a single bit or binary data. An SR Flip Flop is one of the simplest types of flip-flops.

SR FlipFlop

A clocked SR flip-flop is an edge-triggered single-bit storage device with two inputs, Set and Reset, as well as two outputs, Q and Q’ (with Q’ being the inverse of Q).

sr clocked flipflop

SR flip-flops can contain an additional set and reset pin. The set and reset pins work as preset and clear to initialize the flip-flop.

Let’s take a look at the inputs and outputs of an SR Flip Flop:

  • Set (S): When this input is active, it sets the output to 1.
  • Reset (R): When this input is active, it resets the output to 0.
  • Q: The primary output.
  • Q-bar: The complementary output or the inverse of Q.

The following truth table below provides detailed operation of an SR Flip-Flop:

SR Truth Table

SR Flip Flops are commonly used in digital circuitry for:

  • Memory Storage
  • Debouncing Switches
  • Control Circuits
  • Basic Latch Circuits

What is Needed to Model a Clocked SR Flip-Flop?

SR flip-flops are frequently used in digital applications for sequential logic circuits. In sequential logic circuits the output levels at any instant of time are dependent not only on the levels present at the inputs at that time but also on the state of the circuit. To realistically simulate digital circuit functionality and create an SR flip-flop SPICE model for simulation, there are three items that must be defined: 

Logic Parameters

For accurate behavioral representation, the triggering condition and initial condition of the SR flip-flop must be defined. For SR Flip-Flops with set/reset pins, the level (high or low) and type (synchronous or asynchronous) needs to be defined.

Timing Characteristics

Timing is critical to digital design operation and performance. Consider delays as well as setup and hold times for the device.  

DC Electrical Characteristics

The DC electrical characteristics define the operating conditions for the SR flip-flop. This includes:

  • The maximum output voltages during high-level and low-level operation
  • The voltage levels or thresholds that control the switch from high-level operation to low-level operation
  • Hysteresis is often defined for these devices to provide a cushion, ensuring accurate switching between low-level and high-level states even with noisy input signals. It is typically provided by device manufacturers on the device datasheet as VH; however, if not provided it can be calculated by the following equation:

VH = VT+ – VT-

The input is HIGH when it rises above Threshold + (Hysteresis Width/2).

The input is LOW when it falls below Threshold – (Hysteresis Width/2).

Device Resistance

Input and output resistance of the device is critical to the operation and necessary to create an accurate model representation. If this parameter is not provided on the device datasheet, it can be calculated with Ohm’s law.

Input Resistance (RIN)

SPICEModels RInEquation

Use the maximum input voltage (VIN) and maximum leakage current (commonly IIN or Il) to calculate the input resistance.

Output Resistance (ROUT)

SPICEModels ROutEquations

Use the maximum output voltage (VOH or VOL) and the maximum output current (IOH or IOL) to calculate the output resistance.

Once this information is obtained and calculated, these values must be incorporated into the SPICE simulation model which can be achieved by manually creating or editing a text file. Keep in mind if the SR flip-flop created does not produce the intended outcome and a decision is made to change components, values will need to be re-calculated and edited manually. This manual process to produce an accurate SR flip-flop SPICE model is time consuming and increases the likelihood of errors; however, the PSpice Modeling App provides a fast, easily configurable, and fully integrated method to create buffer or inverter models for simulation.  

Creating a SR Flip-Flop SPICE Model in PSpice

The SR flip-flop modeling application quickly creates SR flip-flop SPICE models with a wizard-based approach. To create SR flip-flop models, users can easily input the characteristics, defined by manufacturers, directly into predefined parameters:  

Triggering Condition

Define the triggering condition as the rising or falling edge of the clock signal. The default condition is set to rising, where a flip-flop toggles the state when the input is high and retains the previous state if the input is low. Positive edge-triggered equates to a rising triggering condition while negative edge-triggered equates to a falling triggering condition.

Initial Condition

Define the initial condition of the flip-flop as 0 or 1.

sr clearpreset

Set/Reset Level

This parameter is only available when modeling an SR flip-flop with set and reset pins. Define the set/reset level of the preset and clear pins as 0 or 1. This is typically defined in the device datasheet.

Set/Reset Type

This parameter is only available when modeling an SR flip-flop with set and reset pins. Define the Set/Reset type as asynchronous (ASYNC) or synchronous (SYNC). This is typically defined in the device datasheet.

sr timing
Timing Requirements for SR Flip-Flop SPICE Model Creation

Clock to Output Delay (TIMING_CLKDEL)

Define the time delay between the clock and output pin of the device. The delay is calculated from the triggering edge of the clock to the output (in seconds). This is typically defined as tPD or the propagation delay on device datasheets.

Set/Reset Delay (TIMING_SRDEL)

This parameter is only available when modeling an SR flip-flop with set and reset pins. Set or reset the delay of a flip-flop in seconds which is the time between the preset or clear command and the pulse change. This can often be found on the device datasheet as trec or the recovery time.

sr timing2
Timing Requirements for SR Flip-Flop SPICE Model Creation

Setup Time (SETUP_TIME)

Define the time duration for which the input remains stable before the arrival of the clock edge (in seconds).

Hold Time (HOLD_TIME)

Define the time duration for which the input remains stable after the clock edge in seconds.

sr DC
DC Electrical Characteristics for SR Flip-Flop SPICE Model Creation

Threshold (TH)

Define the voltage level (V) that indicates a switch between high-level and low-level operation.

Hysteresis Width

Hysteresis is the difference between the positive input threshold voltage and the negative input threshold voltage. It is typically provided on the device datasheet as VH.  

Output Resistance (ROUT)

Specify the resistance of the output pin in ohms.

Input Resistance (RIN)

Specify the input resistance at each input pin of the flip flop in ohms.

Max High Voltage

Define the output high voltage. This is typically defined on device datasheets as VOH.

Max Low Voltage

Define the output low voltage. This is typically defined on device datasheets as VOL.

SR modelingapp
Modeling Application for SR Flip-Flop SPICE Models in PSpice

Using the inputted information above, the PSpice Modeling App generates a schematic symbol and automatically associates the newly created SR flip-flop SPICE model without leaving the OrCAD Capture environment. The PSpice Modeling App also automatically manages the simulation profile configuration, eliminating any library set up for simulation. Be sure to check out additional SPICE model how-tos and follow along with these step-by-step instructions and download the free trial to try it yourself. 

LinkedIn
Email

Table of Contents

Get Content Like This Delivered Directly to Your Inbox

Related Resources

EMA Design Automation