• Guides
  • Videos
  • Publications
  • API
  • Github
  • Community
  • Release Notes
  • Plugins
Installing Origen
  • Introduction
  • How to Install
  • How to Install (Windows)
  • Company Customization
  • Understanding Gems
  • Invoking Considerations
  • Workspace Management
Getting Started with Origen
  • Core concepts
  • Creating a New App
  • Directory Structure
  • The Initial Commit
  • Creating New Files
  • Understanding Blocks
  • Application Architecture
Runtime Environment
  • Introduction
  • Mode
  • Environment
  • Target
  • Production Targets
  • Global Setup
  • Load Order
  • Programming
Models
  • Introduction
  • Naming
  • Definition & Hierarchy
  • Adding Attributes
  • Versioning
  • Bugs & Features
  • Package, Mode & Configuration
  • Registers
  • Pins
  • Power Domains
  • Hardware Attributes
  • Parameters
  • Specifications
  • Fuses
  • Generic Components
  • Creating Your Own Components
Compiler (Views)
  • Introduction
  • Creating Templates
  • Using Sub-Templates
  • Helpers
  • Running The Compiler
  • Inline Compiler
Controllers
  • Introduction
  • Shadow Controllers
  • Direct Controllers
Pattern Generator
  • Introduction
  • Creating Patterns
  • Pins
  • Timing and Waiting
  • Registers
  • Documenting Patterns
  • Generating by Name
  • Common API
  • J750 API
  • V93K API
  • UltraFlex API
  • STIL & Other Formats
  • Custom Testers
  • Running The PatGen
  • Concurrent Patterns
Test Program Generator
  • Introduction
  • Philosophy
  • Creating Flows
  • Managing Flow Control
  • Creating an Interface
  • Additional Resources
  • Dynamic Custom Code
  • Characterization API
  • J750 API
  • V93K Common API
  • V93K SMT7 API
  • V93K SMT8 API
  • UltraFLEX API
  • Documenting the Program
  • Creating Custom Testers
  • Running the ProgGen
Decompilation
  • Overview & Example
  • Decompiling, Adding Pins, & Executing
  • Working with Decompiled Patterns
  • Platform Specifics
Simulation
  • Introduction
  • How It Works
  • Compiling the DUT
  • AMS Support
  • Environment Setup
  • Application Setup
  • Simulating Patterns
  • Simulating Flows
  • Direct DUT Manipulation
  • Simulator Log Output
  • Artifacts
  • Debugging
Documentation Generator
  • Introduction
  • Markdown
  • Linking
  • Styling
  • Testing
  • API Generation
  • Deploying
Plugins
  • Introduction
  • Using a Plugin
  • Creating a Plugin
  • Current & Default Plugins
  • Dev Environment
  • Dev Considerations
  • Paths & Origen.root
  • Config & Origen.app
Miscellaneous
  • Revision Control
  • Origen Remotes
  • Lint Testing
  • Session Store
  • LSF API
  • Users, Emails & Maillists
  • Utilities & Helpers
  • Ruby Extensions
  • Logger
  • Adding Commands
  • Overriding Commands
  • Callbacks
  • Application Callbacks
  • Miscellaneous Topics
Advanced Topics
  • Introduction
  • Invocation Customization
  • Custom App Generators

Miscellaneous

Application Callbacks


The callback pattern can also be used in application code where it can be used to provide applications and plugins with a de-coupled way to hook into each other’s processes/flows.

A call to all listeners for a specific callback method is made like this:

Origen.listeners_for(:my_specific_callback_method).each do |listener|
  listener.my_specific_callback_method(any: :options, you: :want, to: :pass)
end

Callback handlers (the my_specific_callback_method in the example above) can be implemented in the application’s (or plugin’s) application.rb or any instantiated object that includes the Origen::Callbacks module (this is automatically included by Origen::Model).

Note: If adding the callback handler to the config/application.rb file in a plugin, it will only be called when it is considered the current plugin within its host application. See Current Plugin for more information on how to set the current plugin.

A Practical Example

Let’s say in a test engineering scenario that the top-level model has some logic to generate some vectors to sync the DUT to the tester. Once the DUT has been sync’d individual test block owners may want to take some action within their models to reflect this change of events.

Since this top-level model could potentially be used by many test blocks it is not practical for the top-level to maintain a list of them and call them individually. Instead it is better to use a callback pattern where the top-level broadcasts that an event has just taken place and then anyone who cares can listen for the broadcast and anyone who doesn’t care need take no action.

To implement such a system the top-level object can do this:

class MySoC
  include Origen::TopLevel

  # Sync the DUT to the tester
  def sync_up
    # Logic to sync up the DUT goes here

    # Now let everyone know that the DUT is now sync'd
    Origen.listeners_for(:on_sync_up).each do |listener|
      listener.on_sync_up
    end
  end
end

Then in the test block code the test engineer who wants to do something on sync up can simply implement the necessary callback handler:

class MyTestBlockModel
  include Origen::Model

  def on_sync_up
    # Action to take when the DUT has been sync'd
  end
end

Comments

Generated with the Origen Semiconductor Developer's Kit

Origen is released under the terms of the MIT license