• 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

Compiler (Views)

Helpers


By default your templates have access to a small number of template specific methods, such as the options hash, and the usual global scope.

This means that your device attributes are normally accessed via the global top-level objects that were instantiated in the target like this:

% if $dut.analog.atd

The <%= $dut.part_number %> device has a <%= $dut.analog.atd.bits %> bit analog to
digital converter block which provides superior conversion accuracy... 

% end

However you can easily create additional helper methods by opening the Origen::Generator::Compiler class and defining methods which can then be called directly from any template.

As a trivial example if I was writing a large document about the ATD module it might become tedious having to keep writing $dut.analog.atd every time I wanted to access an ATD attribute.

In that case the following helper method could be created to give me a shorthand access to the ATD model:

# config/boot.rb
require "#{Origen.root}/app/templates/helpers"

# app/templates/helpers.rb
module Origen
  class Generator
    class Compiler

      def atd
        $dut.analog.atd
      end

    end
  end
end

The above template could now be re-written as:

% if atd

The <%= $dut.part_number %> device has a <%= atd.bits %> bit analog to
digital converter block which provides superior conversion accuracy... 

% end

These helper methods can become very powerful depending on what you are trying to generate with your template. For example the J750 test program sheets for the flagship Origen application were originally generated via templates and we built up quite a large library of helper methods to generate entire test instance lines and flow sheet entries.

These helpers have since been incorporated into the Origen J750 generator and you should definitely use that in preference to templates if you are generating a test program for that platform. However it shows that with templates + custom helper methods you can very easily build powerful ASCII generators for your specific domain.


Comments

Generated with the Origen Semiconductor Developer's Kit

Origen is released under the terms of the MIT license