• 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

Decompilation

Overview & Example


Origen provides some basic functionality for decompiling, or reverse-compiling, a pattern from its text representation (e.g., .atp for the J750 platform), returning an object which Origen can work with.

Philosophy

The decompiler attempts to support two, somewhat competing, goals:

  1. Provide a universal API for working with decompiled patterns from any platform.
  2. Allow platforms to implement the universal API in such a way that still maintains the aspects only present on that particular platform (platform-specifics).

The aim is to provide the best of both worlds: a generic-enough, universal API to accomplish most tasks, without regard to platform-specifics, but not bar those platform-specifics completely in the event that such a generic method either isn’t available, isn’t possible, or wouldn’t be applicable across more than a single platform.

Definitions

In the context of the decompilation sections, the following definition apply:

  • Pattern Source: The text-representation of the a pattern.
  • Platform: Producer of Pattern Sources. In most cases, this will be an ATE, such as j750, or v93k, but this also could be STIL or WGL.
  • Platform-Specifics: Any aspect which separates this platform from another, outside of the actual parsing and grammar rules.
  • (Decompiled) Pattern: The instance of an object returned after successful decompilation of a Pattern Source by a Decompiler.
    • Note, this will often be written fully as decompiled pattern, to avoid additional confusion.
  • Decompiler: The object that takes a Pattern Source and returns a Pattern. There are two flavors of this:
    • In some context, this will be the generic Decompiler, that is, the abstract base which, itself, can’t actually decompile anything.
    • However, in most contexts this will refer to a specific platform. For example, “the J750 decompiler”, refers to the J750’s implementation of the generic decompiler, or the OrigenTesters::IGXLBasedTester::Pattern class.

Example Decompilation

This example shows some basic usage of the decompiler, without assuming you have a pattern source for a supported platform ready to go. This example makes use of the J750 platform. If you aren’t familiar with this platform, don’t worry; understanding of the pattern source format is not a requirement for using the decompiler, specifically in the sense of the universal API.

Requirements

In order to follow along with these examples, you will need:

  • Some dut object that does not have the pins tclk, tms, tdo, or tdi already defined (you can still follow along, but you will not receive identical return values from #add_pins (covered later) if these pins are already defined).

Decompiling Direct Source

The first step to working with a pattern source in Origen is to decompile said source. The decompiler is accessed directly on the OrigenTesters module, and contains methods to decompile a source from a given input string. Consider the source, from a J750 .atp, below:

// Sample pattern text for the J750
// Source located at: lib/origen_testers/igxl_based_tester/decompiler

import tset tp0;
svm_only_file = no;
opcode_mode = extended;
compressed = yes;

vector ($tset, tclk, tdi, tdo, tms)
{
start_label pattern_st:
// Start of vector body
repeat 2 > tp0 X X X X ; // First Vector
repeat 5 > tp0 1 0 X 1 ;
end_module   > tp0 X X X X ; // Last Vector
}

Placing this in a String, we can decompile this directly using the the #decompile_text method and providing the target decompiler:

The source above is available as a String already: OrigenTesters::IGXLBasedTester.sample_direct_source
# A very basic, pre-defined .atp source for the J750 platform
src = OrigenTesters::IGXLBasedTester.sample_direct_source

# Decompile this source.
pat = OrigenTesters.decompile_text(src, decompiler: OrigenTesters::IGXLBasedTester::Pattern)
  #=> OrigenTesters::IGXLBasedTester::Pattern object

Since we’ve specified that this is an IGXLBasedTester source, the #decompile_text method will use that as the target decompiler and return an object corresponding to that specific platform’s decompiler: OrigenTesters::IGXLBasedTester::Pattern.

If you have your own pattern source you’d rather compile, the #decompile method will accept a filename either as a String or Pathname object:

pat = OrigenTesters.decompile('path/to/src.atp')
  #=> (for a source ending with .atp)
  #=> OrigenTesters::IGXLBasedTester::Pattern object
The decompiler will try to match the platform based on the extension of the given filename. See the decompilating section for additional details.

Now, we can interact with our decompiled pattern. Some easy things we may want to do:

  • Query which pins are present in the pattern source
  • Add those pins to the DUT
  • Iterate through the vectors, printing the repeat count and the pin states
  • Execute the source in its entirety, in the context of the current DUT

Discerning Pattern Source Pins

There’s two methods available to retrieve the pins: #pins and #pin_sizes.

# Return an array of pins, in the order they appear in the pattern
pat.pins
  #=> [:tclk, :tdi, :tdo, :tms]

# Return the pin names and their respective size
pat.pin_sizes
  #=> {:tclk=>1, :tdi=>1, :tdo=>1, :tms=>1}

Adding Missing Pins

One of the most common operations with respect to the pins is to simply add any missing pins to the current dut. The decompiled pattern has a built-in method to do just that:

# Assume the current dut has no pins
dut.pins
  #=> {}

pat.add_pins
  #=> [:tclk, :tdi, :tdo, :tms]

dut.pins
  #=> {:tclk=><Origen::Pins::Pin:47002383086100>, :tdi=><Origen::Pins::Pin:47002383082480>, :tdo=><Origen::Pins::Pin:47002383109240>, :tms=><Origen::Pins::Pin:47002383145880>}

#add_pins will return any pins it added to the dut. For example, if the dut already had all the pins from the pattern defined, #add_pins would’ve returned an empty array. Running the above a second time:

# Assume the current dut has no pins
dut.pins
  #=> {:tclk=><Origen::Pins::Pin:47002383086100>, :tdi=><Origen::Pins::Pin:47002383082480>, :tdo=><Origen::Pins::Pin:47002383109240>, :tms=><Origen::Pins::Pin:47002383145880>}

pat.add_pins
  #=> []

dut.pins
  #=> {:tclk=><Origen::Pins::Pin:47002383086100>, :tdi=><Origen::Pins::Pin:47002383082480>, :tdo=><Origen::Pins::Pin:47002383109240>, :tms=><Origen::Pins::Pin:47002383145880>}

Vectors

We can iterate through each ‘vector’ in the decompiled pattern with #each_vector. This method takes a block and runs it for each ‘vector’ encountered. Notice the quotes around ‘vector’. Each v in the example above is actually a VectorBodyElement object that acts as a placeholder for any element type that could appear. Each vector body element has a type associated with it to discern exactly what it is:

pat.each_vector { |v| puts v.type }
:start_label
:comment_block
:vector
:vector
:vector
  #=> nil

Now that we have the type, we can access the underlying element. In the example below, we’ll check the type first and, in the event of a :vector, access the underlying element and print its repeat count and pin states.

pat.each_vector { |v| puts "(#{v.element.repeat}) #{v.element.pin_states}" if v.type == :vector }
(2) ["X", "X", "X", "X"]
(5) ["1", "0", "X", "1"]
(1) ["X", "X", "X", "X"]
  #=> nil
Note that #each_vector returns nil, NOT an array containing all the vectors like a normal `each` method would do. See the section on working with vectors for why this is the case.

There’s much more to vectors and vector types. See the vectors section for further details.

Executing the Pattern Source

Now that we’ve added any missing pins to our dut and we’ve seen how to access the vectors themselves, we can execute the pattern source. The #execute method will iterate through each vector, apply the pin states, and cycle the tester repeat number of times.

pat.execute

Comments

Generated with the Origen Semiconductor Developer's Kit

Origen is released under the terms of the MIT license