### Starting OrigenLink Server (Ruby/Gem Installation) - Shell Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/OrigenLink/index.html This command initiates the OrigenLink server, specifically for setups where Origen and Ruby 2.x have been installed via gems. It assumes the `start_link_server` executable is accessible in the system's PATH, allowing for direct execution to launch the server. ```Shell start_link_server ``` -------------------------------- ### Installing Build Essentials on Ubuntu Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/origen/guides/installation/installing/index.html This command installs the necessary build environment, including a C compiler and the Make utility, required for installing Ruby on Ubuntu-based Linux distributions. It is a prerequisite for Origen installation. ```Shell sudo apt-get install build-essential ``` -------------------------------- ### Building Origen Core and Python Bindings Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/o2_dev/guides/developers/installation.html This command builds the Origen core components along with its Python bindings. This is the most common build operation during Origen development, integrating the core functionality into the example application. ```Shell origen build ``` -------------------------------- ### Example Origen Environment Configuration Paths Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/origen/guides/starting/company/index.html This snippet illustrates a typical Origen environment, showing the locations of default site configurations from the Origen installation, a project-specific configuration, and a user-specific configuration. It highlights how a project config can set the centralized site config URL. ```plaintext Ruby Install: /pkg/ruby (2.3) Site configs: (default from Origen) /pkg/ruby/2.3.0/x86_64-linux/lib/ruby/gems/2.3.0/gems/origen-0.33.3/origen_site_config.yml /pkg/ruby/2.3.0/x86_64-linux/lib/ruby/gems/2.3.0/gems/origen-0.33.3/origen_site_config.yml.erb Run Directory: /proj/example Site config at: /proj/example/origen_site_config.yml.erb #=> Sets centralized site config to https://internal_server/origen/config User Directory: /home/me/ Site config at: /home/me/.origen/origen_site_config.yml ``` -------------------------------- ### Installing Build Essentials on Ubuntu Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/origen/guides/starting/installing/index.html This command installs the `build-essential` package on Ubuntu-based Linux distributions. This package provides a C compiler (GCC) and the `make` utility, which are crucial prerequisites for compiling and installing Ruby from source or via tools like rbenv. ```Shell sudo apt-get install build-essential ``` -------------------------------- ### Installing Core Development Tools with Chocolatey Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/origen/guides/starting/installwin/index.html Installs essential development tools like Git, UnxUtils, and ConsoleZ using Chocolatey. The -y flag confirms all prompts, and --force ensures installation even if already present. ```Batch choco install git -y --force choco install unxutils -y --force choco install consoleZ -y --force ``` -------------------------------- ### Installing Origen Gem Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/origen/guides/starting/installwin/index.html Installs the Origen framework as a Ruby gem. The --no-ri and --no-rdoc flags prevent the installation of documentation, speeding up the process. ```Ruby gem install origen --no-ri --no-rdoc ``` -------------------------------- ### Creating Versioned and Configured Origen Targets in Ruby Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/origen/guides/runtime/target/index.html These examples illustrate how to create more specialized target files in Origen. They show how to pass parameters to the device model constructor, allowing for different versions of a device (e.g., version: 1) or different configurations (e.g., configuration: :func) to be instantiated based on the target selected, enabling flexible test setups. ```Ruby # target/eagle_1.rb MyApp::Eagle.new(version: 1) # target/eagle_2.rb MyApp::Eagle.new(version: 2) # target/falcon_func.rb MyApp::Falcon.new(configuration: :func) # target/falcon_bist.rb MyApp::Falcon.new(configuration: :bist) ``` -------------------------------- ### Verifying Origen CLI Installation Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/o2_dev/guides/developers/installation.html This command checks the version of the `origen` CLI. It serves as a verification step to confirm that the CLI has been successfully installed and is accessible in the system's PATH after the build process. ```Shell $ origen -v ``` -------------------------------- ### Setting Up Origen Python Application Environment Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/o2_dev/guides/developers/installation.html These commands navigate into an Origen Python application directory and then execute the `origen env setup` command. This command initializes the local environment for the application, preparing it for development and testing within the Origen 2 framework. ```Shell cd o2/test_apps/python_app origen env setup ``` -------------------------------- ### Defining 'env' Command with 'setup' and 'update' Subcommands in Rust Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/o2_dev/_static/rustdoc/cli/doc/src/origen/bin.rs.html This snippet defines the 'env' command for managing an application's Origen/Python environment and dependencies. It includes 'setup' for initial environment setup and dependency installation (with an optional `--origen` path) and 'update' for updating Python dependencies. ```Rust let env_help = "Manage your application's Origen/Python environment (dependencies, etc.)"; origen_commands.push(CommandHelp { name: "env".to_string(), help: env_help.to_string(), shortcut: None, }); app = app.subcommand(SubCommand::with_name("env").about(env_help) .setting(AppSettings::ArgRequiredElseHelp) .subcommand( SubCommand::with_name("setup") .about("Setup your application's Python environment for the first time in a new workspace, this will install dependencies per the poetry.lock file") .arg(Arg::with_name("origen") .long("origen") .help("The path to a local version of Origen to use (to develop Origen)") .takes_value(true), ), ) .subcommand( SubCommand::with_name("update") .about("Update your application's Python dependencies according to the latest pyproject.toml file"), ) ); ``` -------------------------------- ### Verifying Origen Installation (Bash) Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/origen/guides/starting/installing/index.html This command checks the installed version of Origen, confirming that the installation was successful and that the 'origen' executable is accessible in the system's PATH. It provides a quick way to verify the functionality and version of the installed Origen SDK. ```Bash origen -v ``` -------------------------------- ### Installing Origen Gem (Ruby) Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/origen/guides/starting/installing/index.html This command installs the Origen gem using Ruby's gem package manager. The '--no-rdoc' and '--no-ri' flags prevent the installation of documentation, which can significantly speed up the installation process. This is the primary method for installing Origen after Ruby is set up. ```Ruby gem install origen --no-rdoc --no-ri ``` -------------------------------- ### Performing Initial Setup for New Origen Application in Rust Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/o2_dev/_static/build/rustdoc/cli/doc/src/origen/commands/new/mod.rs.html This method changes the current working directory to the newly created application's root. It then executes the `origen env setup` command as a child process. This step is crucial for initializing the new application's environment, installing dependencies, and performing any other necessary post-generation setup tasks, ensuring the application is ready for use immediately after creation. ```Rust fn setup(&self) { std::env::set_current_dir(&self.dir).expect("Couldn't cd to the new app"); let _ = std::process::Command::new("origen") .arg("env") .arg("setup") .spawn() .expect("Couldn't execute origen setup") .wait(); } ``` -------------------------------- ### Origen Command Line Examples for Pattern Generation (Shell) Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/origen/guides/pattern/name/index.html These are command-line examples demonstrating how Origen's regular dispatch mechanism handles flexible pattern name requests. Both commands are equivalent, showing that Origen can clean up paths, extensions, and pre/post-fixes from the requested pattern name. ```Shell origen g bistcom origen g output/p2/nvm_bistcom_debug.atp ``` -------------------------------- ### Origen Environment Configuration Example Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/origen/guides/installation/company/index.html This snippet illustrates a typical Origen environment setup, showing the locations of default, run directory, and user-specific site configuration files. It also demonstrates how a local configuration can set the 'centralized_site_config' to a specific URL. ```Configuration Ruby Install: /pkg/ruby (2.3) Site configs: (default from Origen) /pkg/ruby/2.3.0/x86_64-linux/lib/ruby/gems/2.3.0/gems/origen-0.33.3/origen_site_config.yml /pkg/ruby/2.3.0/x86_64-linux/lib/ruby/gems/2.3.0/gems/origen-0.33.3/origen_site_config.yml.erb Run Directory: /proj/example Site config at: /proj/example/origen_site_config.yml.erb #=> Sets centralized site config to http://internal_server/origen/config User Directory: /home/me/ Site config at: /home/me/.origen/origen_site_config.yml ``` -------------------------------- ### Installing Origen Gem via RubyGems Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/origen/guides/installation/installing/index.html This command installs the Origen gem using RubyGems, Ruby's package manager. The --no-rdoc and --no-ri flags prevent the installation of documentation, speeding up the process. This is the primary method for installing the Origen SDK after Ruby has been successfully set up. ```Ruby gem install origen --no-rdoc --no-ri ``` -------------------------------- ### Configuring Origen Guides in Ruby Plugins Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/origen/release_notes/index.html This Ruby code snippet demonstrates how to extend Origen guides by adding new sections and pages within a plugin's `config/application.rb`. It uses the `config.shared` hash to define the guide's local directory and a lambda function `origen_guides_index` to programmatically add content, allowing for custom organization and integration of plugin-specific documentation. ```Ruby # In the plugin's config/application.rb config.shared = { # Specify the local directory where the guides live, should be the same in most cases origen_guides: "templates/origen_guides", origen_guides_index: -> (index) do # Example of adding a section index.section :pattern, heading: "Pattern Generator", after: :controllers do |section| section.page :introduction, heading: "Introduction" section.page :creating, heading: "Creating Patterns" end # Example of adding a page to an existing section index.section :program do |section| section.page :smt8, heading: "V93K SMT8", after: :v93k end end } ``` -------------------------------- ### Verifying Ruby DevKit Installation Output Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/origen/guides/starting/installwin/index.html Shows the expected console output after successfully running 'ruby dk.rb install'. This output confirms that the DevKit has correctly installed necessary Ruby components for native gem compilation. ```Plain Text [INFO] Installing 'C:/tools/ruby22/lib/ruby/site_ruby/2.2.0/rubygems/default [INFO] Installing 'C:/tools/ruby22/lib/ruby/site_ruby/devkit.rb' ``` -------------------------------- ### Examples of Initial Pattern Naming Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/origen/guides/pattern/name/index.html These examples demonstrate an initial pattern naming convention where 'prb' and 'ft' denote parameter sets, 'pgm_ckbd' is the operation, and 'b0' specifies the block. They show how different parameter sets are indicated. ```Text prb_pgm_ckbd_b0 # Program a checkerboard to block 0, using probe parameters ft_pgm_ckbd_b0 # Program a checkerboard to block 0, using FT parameters ``` -------------------------------- ### Example Origen Pattern Header Output Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/origen/guides/pattern/documenting/index.html Illustrates the default structure and content of a generated Origen pattern header, including generation time, user, environment details, application version, and loaded plugins. ```Text // *************************************************************************** // GENERATED: // Time: 24-Jun-2018 10:06AM // By: coreyeng // Mode: debug // Command: origen g iterator_postfix_test_x_bx -t debug.rb // *************************************************************************** // ENVIRONMENT: // Application // Source: git@github.com:Origen-SDK/origen.git // Version: 0.33.1 // Branch: fixes(c4e8e1d0db0) (+local edits) // Origen // Source: https://github.com/Origen-SDK/origen // Version: 0.33.1 // Plugins // atp: 1.1.0 // origen_core_support: 0.2.3 // origen_debuggers: 0.6.0 // origen_doc_helpers: 0.5.2 // origen_testers: 0.16.1 // origen_updater: 0.7.0 // *************************************************************************** ``` -------------------------------- ### Manually Booting Parent with Origen::Componentable.init_parent_class (Ruby) Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/origen/guides/models/componentable/index.html This snippet illustrates how to manually boot the parent class using `Origen::Componentable.init_parent_class`. It provides examples of calling this method from within the parent's `initialize` method (though commented out in the external example) and externally after instantiating the parent. This approach offers more control and is useful when the includer class is not set up for automatic booting. ```Ruby # Internal to the parent class class Parent #include MyTest #=> nevermind, don't need this right now. def intiailize Origen::Componentable.init_parent_class(self, MyTest) end end # External to the parent class class Parent #include MyTest #=> nevermind. def intiailize #Origen::Componentable.init_parent_class(self, MyTest) #=> Nevermind this too. end end p = Parent.new Origen::Componentable.init_parent_class(p, MyTest) ``` -------------------------------- ### Building Origen Core and Python Bindings Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/o2/guides/developers/installation.html This command builds the Origen core and its Python bindings, integrating them into the example application. It's the most common build operation during Origen development. ```Shell origen build ``` -------------------------------- ### Cloning Origen V93K Library with Git Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/std_lib/guides/v93k/install/index.html This command clones the Origen V93K standard library from GitHub into your test program's top-level directory. It's the easiest way to obtain the source code if Git is installed and web access is available. ```Bash cd your/test/program git clone https://github.com/Origen-SDK/origen_std_lib.git ``` -------------------------------- ### Example Origen Pattern List File - Plaintext Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/origen/guides/pattern/running/index.html This example demonstrates the structure and content of an Origen pattern list file. It shows how to add comments, list individual pattern names, and even include (call) other list files to organize pattern generation workflows. ```Plaintext # List files can be commented like this # Simply list the name of the patterns that you would use on the command line march.rb data_retention.rb # List files can also call other lists probe.list ``` -------------------------------- ### Starting OrigenLink Server (Cloned Project Installation) - Shell Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/OrigenLink/index.html This snippet provides the command to launch the OrigenLink server when the project has been obtained by cloning its GitHub repository. Users must first navigate into the `OrigenLink` project directory before executing the `bin/start_link_server` script to activate the server. ```Shell bin/start_link_server ``` -------------------------------- ### Example Response for version Message - Message Format Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/OrigenLink/api/OrigenLink/Server/Sequencer.html Provides an example of the expected response format from the server when a `version` message is processed. The response typically starts with 'P:' followed by the server's version string. ```Message Format P:0.2.0.pre0 ``` -------------------------------- ### Setting HOME Environment Variable Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/origen/guides/starting/installwin/index.html Provides an example of setting the HOME environment variable, which might be required if Origen reports an error about it not being set. This variable typically points to the user's home directory. ```Batch HOME = C:\\Users\\my_user_id ``` -------------------------------- ### Setting Up the App in Rust Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/o2/_static/rustdoc/cli/doc/origen/commands/new/struct.App.html This method performs initial setup operations for the application. It is likely responsible for creating necessary directories, files, or initializing configurations after the application has been created. ```Rust fn setup(&self) ``` -------------------------------- ### Checking Python 3 Version Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/o2_dev/guides/developers/installation.html This command checks the installed version of Python 3. It is crucial to ensure that a compatible Python version (>= 3.6) is available, as it is a prerequisite for Origen development. ```Shell $ python3 --version ``` -------------------------------- ### Displaying Origen CLI Help Output Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/origen/guides/starting/app/index.html This snippet shows the standard help output when running the `origen` command without arguments. It lists available top-level commands like `new` for creating applications/plugins and `interactive` for starting a console, along with brief descriptions of their functionality. ```CLI Output Usage: origen COMMAND [ARGS] The following commands are available: new Create a new Origen application or plugin. "origen new my_app" creates a new origen application workspace in "./my_app" interactive Start an interactive Origen console (short-cut alias: "i"), this is just IRB with the 'origen' lib loaded automatically Many commands can be run with -h (or --help) for more information. ``` -------------------------------- ### Installing Missing Ubuntu Development Packages Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/o2_dev/guides/developers/installation.html These commands install common development packages on Ubuntu using `apt`. These packages may be required to resolve build errors related to SSL development (libssl-dev), package configuration (pkg-config), Python distribution utilities (python3-distutils), and Python virtual environments (python3-venv). ```Shell sudo apt install libssl-dev sudo apt install pkg-config sudo apt install python3-distutils sudo apt install python3-venv ``` -------------------------------- ### Example: Reserving Resource for Atomic Transactions - Origen SDK Ruby Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/origen/guides/pattern/concurrent/index.html This example illustrates reserving the `arm_debug` resource to ensure a sequence of operations (launching a command, waiting, and verifying status) occurs atomically without interruption from other threads. This guarantees that the verification happens after the command has had sufficient time to start, preventing race conditions. ```Ruby # When launching a command we want to verify that it started, so let's guarantee that the verify transaction # will occur after the specified 10 cycles, otherwise we risk the command starting and completing before # we check if it got underway PatSeq.reserve :arm_debug do # Launch some command operation cmd.write!(code) 10.cycles # Verify the command started correctly status.busy.read!(1) end ``` -------------------------------- ### Building Origen CLI from Source Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/o2_dev/guides/developers/installation.html These commands navigate to the Origen Rust project directory and then build the Origen CLI binaries using Cargo. The `--workspace` flag builds all packages in the workspace, and `--bins` specifically builds the binary targets, compiling the CLI for use. ```Shell cd o2/rust/origen cargo build --workspace --bins ``` -------------------------------- ### Building Origen CLI from Source Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/o2/guides/developers/installation.html These commands navigate to the Origen CLI's Rust project directory and then build the CLI binaries using `cargo`. The `--workspace --bins` flags ensure all binary crates within the workspace are built. ```Shell cd o2/rust/origen cargo build --workspace --bins ``` -------------------------------- ### Installing Ubuntu Development Dependencies Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/o2/guides/developers/installation.html These commands install common development packages on Ubuntu using `apt`. They address potential missing dependencies that might cause errors during Origen's build process, such as SSL libraries, package configuration tools, and Python utilities. ```Shell sudo apt install libssl-dev sudo apt install pkg-config sudo apt install python3-distutils sudo apt install python3-venv ``` -------------------------------- ### Defining Environment CLI Command in Rust Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/o2/_static/build/rustdoc/cli/doc/src/origen/bin.rs.html This snippet defines the `env` subcommand for managing an application's Origen/Python environment, including dependencies. It features `setup` and `update` sub-subcommands for initial environment setup (installing dependencies from `poetry.lock`) and updating Python dependencies from `pyproject.toml`, respectively. The `setup` command also supports specifying a local Origen path. ```Rust let env_help = "Manage your application's Origen/Python environment (dependencies, etc.)"; origen_commands.push(CommandHelp { name: "env".to_string(), help: env_help.to_string(), shortcut: None, }); app = app.subcommand(SubCommand::with_name("env").about(env_help) .setting(AppSettings::ArgRequiredElseHelp) .subcommand( SubCommand::with_name("setup") .about("Setup your application's Python environment for the first time in a new workspace, this will install dependencies per the poetry.lock file") .arg(Arg::with_name("origen") .long("origen") .help("The path to a local version of Origen to use (to develop Origen)") .takes_value(true), ), ) .subcommand( SubCommand::with_name("update") .about("Update your application's Python dependencies according to the latest pyproject.toml file"), ) ); ``` -------------------------------- ### Setting Up Origen Application Environment (Ruby) Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/origen/api/Origen/Boot.html This is the primary setup method for an Origen application. It orchestrates the creation of the Origen binstub, initializes Bundler, and conditionally copies system gems if the application is not an archived version, ensuring the environment is ready for use. ```Ruby def setup(origen_root) create_origen_binstub(origen_root) bundle_path = setup_bundler(origen_root) unless File.exist?(File.join(origen_root, '.origen_archive')) copy_system_gems(origen_root, bundle_path) end end ``` -------------------------------- ### Getting Pre-Decompiled Pattern Object with OrigenTesters.decompiled_pattern (Ruby) Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/origen/guides/decompilation/decompilerapi/index.html This example illustrates the use of `OrigenTesters.decompiled_pattern` to obtain a pattern object that has been prepared for decompilation but is not yet fully decompiled. The `decompiled?` method will return `false` for these objects, indicating they are ready for further processing. ```Ruby pat = OrigenTesters.decompiled_pattern('path/to/src.atp') #=> OrigenTesters::IGXLBasedTester::Pattern pat.decompiled? #=> false pat = OrigenTesters.decompiled_pattern('path/to/src.avc') #=> OrigenTesters::SmartestBasedTester::Pattern pat.decompiled? #=> false ``` -------------------------------- ### Setting Up Origen Python Environment in Rust Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/o2/_static/build/rustdoc/cli/doc/src/origen/commands/env.rs.html This snippet defines the logic for the 'setup' subcommand within the `run` function. It performs critical environment checks (Python version, internet connectivity), handles the Origen source path, deletes the virtual environment, and modifies the `pyproject.toml` file to comment out existing Origen references, ensuring a clean setup. ```Rust Some("setup") => { let mut origen_source_changed = false; let mut run_origen_build = false; let origen_root = match matches .subcommand_matches("setup") .unwrap() .value_of("origen") { None => None, Some(x) => { let path = std::path::Path::new(x) .canonicalize() .expect("That path to Origen doesn't exist"); let (found, path) = search_for(vec![".origen_dev_workspace"], false, &path); if found { Some(path) } else { log_error!("Origen was not found at that path"); std::process::exit(1); } } }; print!("Is a suitable Python available? ... "); if PYTHON_CONFIG.available { greenln("YES"); } else { redln("NO"); println!(""); println!( "Could not find Python > {} available, please install this and try again.", MIN_PYTHON_VERSION ); std::process::exit(1); } print!("Is the internet accessible? ... "); if online(None).is_ok() { greenln("YES"); } else { redln("NO"); println!(""); println!("In future, Origen would now talk you through what files to get and where to put them, but that's not implemented yet, sorry!"); std::process::exit(1); } install_poetry(); let app_root = &origen::app().unwrap().root; let pyproject = app_root.join("pyproject.toml"); if !pyproject.exists() { display_red!("ERROR: "); displayln!("application pyproject file not found!"); std::process::exit(1); } if let Some(p) = origen_root { let origen_root = p.join("python"); // Poetry seems to have a number of bugs when switching back and forth between path and version // references, this step ensures it comes up correctly, but should be removed in future delete_virtual_env(); // Comment out the current reference to Origen let r = Regex::new(r"^\s*origen ?=").unwrap(); if let Err(e) = fa::insert_before(&pyproject, &r, "#") { display_redln!("{}", e); std::process::exit(1); }; } ``` -------------------------------- ### Installing Required Python Packages for Origen Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/o2_dev/guides/developers/installation.html These commands install essential Python packages using `pip3`, which are prerequisites for building Origen. The packages include tools for dependency management (poetry), Rust-Python binding (maturin), packaging (twine), file system utilities (pyfs), code formatting (yapf), and keyring management (keyrings.alt). ```Shell pip3 install poetry pip3 install maturin pip3 install twine pip3 install pyfs pip3 install yapf pip3 install -U keyrings.alt ``` -------------------------------- ### Getting Auto-Generated Componentable Names for Custom Class (Ruby) Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/origen/guides/models/componentable/index.html Illustrates how `Origen::Componentable.componentable_names` processes a custom class name (`MyTest`) to generate its corresponding singleton and plural API names. This example applies standard Ruby/Rails naming conventions to a user-defined class. ```Ruby Origen::Componentable.componentable_names(MyTest) { singleton_name: :my_test, plural_name: :my_tests } ``` -------------------------------- ### Integrating Auxiliary Flow into Main Flow - Origen DSL Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/origen/guides/program/v93ksmt8/index.html This example shows how to integrate a previously defined auxiliary flow, 'POWERDOWN', into the 'Main' flow. The auxiliary flow is declared in the `setup` block and then executed in the `execute` block, enabling modular and reusable actions. ```Origen DSL flow Main { setup { flow POWERDOWN calls testflow.POWERDOWN {} } execute { POWERDOWN.execute(); } } ``` -------------------------------- ### Building and Viewing Origen Web Documentation Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/o2/guides/documenting/building_your_webpages.html This command initiates the build process for the project's web documentation and, upon completion, automatically launches the default web browser to display the newly generated pages. It is commonly used for quick previews during development. ```CLI origen web build --view ``` -------------------------------- ### Verifying Origen CLI Installation Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/o2/guides/developers/installation.html This command checks the version of the `origen` CLI tool. A successful output confirms that the CLI has been correctly built and is accessible in the system's PATH. ```Shell origen -v ``` -------------------------------- ### Origen Web Command Line Interface Help Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/o2/guides/documenting/building_your_webpages.html This output provides the comprehensive help documentation for the 'origen web' command, detailing its general usage, available global flags like '--help' and verbosity options, and a list of its primary subcommands such as 'build', 'clean', 'help', and 'view' for managing web documentation. ```CLI origen.exe-web Create, Build, and View Web Documentation USAGE: origen.exe web [FLAGS] [SUBCOMMAND] FLAGS: -h, --help Prints help information -v Terminal verbosity level e.g. -v, -vv, -vvv SUBCOMMANDS: build Builds the web documentation [aliases: b, compile, html] clean Cleans the output directory and all cached files help Prints this message or the help of the given subcommand(s) view Launches your web browser to view previously built documentation [aliases: v] ``` -------------------------------- ### Get Unhandled Error Count in Origen Rust Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/o2/_static/build/rustdoc/origen/doc/origen/struct.STATUS.html Returns the number of unhandled errors encountered since the current thread started. An unhandled error example is a pattern that failed to generate. This count helps report significant issues to the user at the end of execution. ```Rust pub fn unhandled_error_count(&self) -> usize ``` -------------------------------- ### Example Program List File Content - Text Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/origen/guides/program/generating/index.html This snippet illustrates the structure of an Origen program list file, which supports comments, direct file paths, and references to other list files for comprehensive program generation. ```Text # List files can be commented like this # Simply list the name of the files that you would use on the command line program/probe/sort1.rb program/probe/sort2.rb # List files can also call other lists ft.list ``` -------------------------------- ### Executing Origen New Application Command in Rust Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/o2/_static/rustdoc/cli/doc/src/origen/commands/new/mod.rs.html This function serves as the entry point for the 'origen new' command. It first checks if an application is already present, delegating to `new_resource::run` if so. Otherwise, it validates the provided application name, creates the application directory, populates a Tera context with application details and user information, and then applies pre-compiled templates to generate the application's files. Finally, it performs an initial setup unless the 'no-setup' flag is present. ```Rust pub fn run(matches: &ArgMatches) { if STATUS.is_app_present { new_resource::run(matches); return; } let name = matches.value_of("name").unwrap(); if name.to_lowercase() != name { display_red!("ERROR: "); displayln!("The application name must be lowercased"); std::process::exit(1); } let app_dir = std::env::current_dir().unwrap().join(name); if app_dir.exists() { if !app_dir.read_dir().unwrap().next().is_none() { display_red!("ERROR: "); displayln!("A directory with that name already exists and is not empty, please delete it or use a new name and try again"); std::process::exit(1); } } else { std::fs::create_dir(&app_dir) .expect("Could you create the new application directory, do you have permission?"); } let mut context = Context::new(); //// Converting this to a vector here as the template was printing out the package list //// in reverse order when given the index map //let packages: Vec<&Package> = bom.packages.iter().map(|(_id, pkg)| pkg).collect(); context.insert("app_name", name); context.insert( "origen_version", &to_pep440(&origen::STATUS.origen_version.to_string()).unwrap(), ); let mut user_info = "".to_string(); let users = origen::users(); if let Ok(u) = users.current_user() { if let Ok(username) = u.username() { user_info += &username; match u.email() { Ok(e) => { if let Some(email) = e { user_info += &format!(" <{}>", &email); } } Err(e) => { origen::display_redln!("{}", e.msg); } } } } context.insert("user_info", &user_info); let new_app = App { name: name.to_string(), dir: app_dir, }; new_app.apply_template(&PY_APP, &context); if !matches.is_present("no-setup") { new_app.setup(); } } ``` -------------------------------- ### Enabling Rust Nightly Version for Origen Development Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/o2_dev/guides/developers/installation.html These commands install or set Rust nightly as the default toolchain, then override the toolchain for the current Origen workspace. This ensures that the nightly version is used specifically within the project directory, which is a requirement for Origen development. ```Shell rustup install nightly or rustup default nightly cd path/to/o2 rustup override set nightly ``` -------------------------------- ### Using Local Origen Version in Application Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/o2_dev/guides/developers/installation.html These commands configure an application to use a locally built version of Origen. The `origen env setup --origen` command points the application to the specified local Origen workspace, and `origen build` then builds the application against this local version. ```Shell origen env setup --origen path/to/your/o2 origen build ``` -------------------------------- ### Building Origen with Release Optimizations Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/o2_dev/guides/developers/installation.html These commands build Origen core and its CLI with release optimizations enabled. The `--release` switch compiles the code with performance enhancements, making it suitable for production or final deployment scenarios. ```Shell origen build --release origen build --cli --release ``` -------------------------------- ### Setting Proxy Environment Variables Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/origen/guides/starting/installwin/index.html Illustrates how to set HTTP and HTTPS proxy environment variables, which are necessary for internet access through a corporate proxy. These variables should be configured before installing other prerequisites. ```Batch HTTP_PROXY = https://proxy.my_company.com:8080 Https_PROXY = https://proxy.my_company.com:8080 ``` -------------------------------- ### Configuring OrigenLink Server for Automatic Boot Startup - Shell Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/OrigenLink/index.html This command demonstrates how to configure the OrigenLink server to start automatically upon system boot on a UDOO device. By adding this line to the `~/.profile` file, the `lxterminal` command will execute the server startup script in a new terminal, ensuring the server is active after system initialization. ```Shell lxterminal -e "/home/udooer/RubyCode/OrigenLink/bin/start_link_server" ``` -------------------------------- ### Verifying Origen Installation Version Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/origen/guides/starting/installwin/index.html Executes the 'origen -v' command to display the installed version of Origen, confirming a successful installation. Expected output is similar to 'Origen: 0.44.0'. ```Batch origen -v ``` -------------------------------- ### Setting Up New Origen Application Environment in Rust Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/o2/_static/rustdoc/cli/doc/src/origen/commands/new/mod.rs.html This method changes the current working directory to the newly created application's directory. It then executes the 'origen env setup' command as a child process. This step is vital for initializing the application's environment, installing dependencies, or performing any post-creation setup tasks required by the Origen framework, ensuring the new application is ready for use. ```Rust fn setup(&self) { std::env::set_current_dir(&self.dir).expect("Couldn't cd to the new app"); let _ = std::process::Command::new("origen") .arg("env") .arg("setup") .spawn() .expect("Couldn't execute origen setup") .wait(); } } ``` -------------------------------- ### Displaying Origen Web Build Command Help (CLI) Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/o2_dev/guides/documenting/building_your_webpages.html This snippet provides the help output for the `origen web build` command, outlining its usage, various flags like `--as-release`, `--clean`, `--no-api`, and `--view`, and options such as `--archive` and `--sphinx-args` for customizing the build process. ```CLI origen.exe-web-build Builds the web documentation USAGE: origen.exe web build [FLAGS] [OPTIONS] FLAGS: --as-release Build webpages with release checks --clean Clean up directories from previous builds and force a rebuild -h, --help Prints help information --no-api Skip building the API -r, --release Release (deploy) the resulting web pages --release-with-warnings Release webpages even if warnings persists -V, --version Prints version information -v Terminal verbosity level e.g. -v, -vv, -vvv --view Launch your web browser after the build OPTIONS: -a, --archive Archive the resulting web pages after building --sphinx-args Additional arguments to pass to the 'sphinx-build' command Argument will passed as a single string and appended to the build command E.g.: 'origen web build --sphinx-args "-q -D my_config_define=1"' -> 'sphinx-build -q -D my_config_define=1' ``` -------------------------------- ### Adding Origen CLI Debug Path to PATH Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/o2_dev/guides/developers/installation.html This command adds the debug build directory of the Origen Command Line Interface (CLI) to the system's PATH. This ensures that the locally built version of the `origen` command is prioritized over any other installed versions, facilitating local development and testing. ```Shell export PATH="/o2/rust/origen/target/debug:$PATH" ``` -------------------------------- ### Setting Up Bundler for Origen Application (Ruby) Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/origen/api/Origen/Boot.html This method is responsible for initializing Bundler within the Origen application's context. It evaluates the `BUNDLER_SETUP` constant, which is expected to configure Bundler and determine the `bundle_path`, which is then returned. ```Ruby def setup_bundler(origen_root) bundle_path = nil eval BUNDLER_SETUP # Will update bundle_path bundle_path end ``` -------------------------------- ### Get Unhandled Error Count in Origen SDK (Rust) Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/o2_dev/_static/build/rustdoc/origen/doc/origen/struct.STATUS.html Returns the number of unhandled errors encountered since the current thread started. Examples include failed pattern generation. This count helps report significant issues to the user, even if the Rust side can continue execution. ```Rust pub fn unhandled_error_count(&self) -> usize ``` -------------------------------- ### Makefile for Sphinx Documentation Build Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/o2_dev/_static/rustdoc/cli/doc/src/origen/Users/nxa13790/Documents/origen/o2/rust/origen/target/debug/build/cli-487f3b9c8948299d/out/new_app_templates.rs.html This Makefile provides a minimal setup for building Sphinx documentation. It defines variables for Sphinx options, build commands, source, and build directories. It includes a `help` target and a catch-all rule to route arbitrary targets to Sphinx's "make mode" for flexible documentation generation. ```Makefile # Minimal makefile for Sphinx documentation # # You can set these variables from the command line, and also # from the environment for the first two. SPHINXOPTS ?= SPHINXBUILD ?= sphinx-build SOURCEDIR = source BUILDDIR = build # Put it first so that "make" without argument is like "make help". help: @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) .PHONY: help Makefile # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). %: Makefile @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) ``` -------------------------------- ### Downloading and Applying Console Settings (Windows PowerShell) Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/origen/guides/starting/installwin/index.html This command uses PowerShell to first create a 'Console' directory within the user's application data folder if it doesn't exist, and then downloads a 'console.xml' configuration file from the Origen SDK website into that directory. This file provides a sensible set of default settings for the Console application, improving the user experience. ```PowerShell @powershell New-Item -ItemType directory -Force -Path %appdata%\\Console; (new-object System.Net.WebClient).DownloadFile('https://origen-sdk.org/files/console.xml','%appdata%\\Console\\console.xml') ``` -------------------------------- ### Building and Viewing Origen Web Documentation Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/o2_dev/guides/documenting/introduction.html This shell command initiates the build process for an Origen application's documentation, generating static webpages. The `--view` flag instructs the system to automatically open the newly built documentation in the default web browser upon completion, allowing for immediate review. ```Shell origen web build --view ``` -------------------------------- ### Declaring Gem Dependencies in Origen Gemfile (Ruby) Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/origen/guides/installation/gems/index.html This Gemfile example illustrates various ways to declare Ruby gem dependencies for an Origen application. It covers specifying a gem source, defining version constraints, referencing local gem copies for development, and linking directly to specific commits in Git repositories. This setup is crucial for managing project dependencies. ```Ruby source 'https://rubygems.org' gem 'origen', '>= 0.5' gem 'origen_debuggers' gem 'roo' gem 'origen_testers', path: '/path/to/local/origen_testers' gem 'origen_jtag', git: 'https://github.com/Origen-SDK/origen_jtag.git', ref: 'ad323f' ``` -------------------------------- ### Installing Chocolatey Package Manager Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/origen/guides/starting/installwin/index.html Installs Chocolatey, a package manager for Windows, by downloading and executing its installation script via PowerShell. It also updates the system's PATH environment variable to include Chocolatey's binary directory. ```PowerShell @powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\\chocolatey\\bin" ``` -------------------------------- ### Installing Ruby and DevKit with Chocolatey Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/origen/guides/starting/installwin/index.html Installs Ruby version 2.3 and its corresponding DevKit using Chocolatey. The DevKit is crucial for compiling native Ruby gems on Windows. ```Batch choco install ruby -y --version=2.3 --force choco install ruby2.devkit -y --force ``` -------------------------------- ### Displaying Origen Web Command Help Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/o2/guides/documenting/building_your_webpages.html Executes the 'origen web' command with the '--help' flag to output a summary of its usage, available subcommands, and general options directly to the terminal. This is useful for quickly recalling command syntax. ```CLI origen web --help ``` -------------------------------- ### Manually Initializing Origen Componentable Classes (Ruby) Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/origen/guides/models/componentable/index.html This Ruby example shows how to manually call `Origen::Componentable.init_parent_class` within a custom `origen_model_init` callback defined in the parent module. This workaround is necessary if the module housing the `Componentable` class already has its own `origen_model_init` method, preventing the automatic setup by `Componentable`. It ensures that the `Componentable` classes are properly booted even with existing module callbacks. ```Ruby module MyTest def origen_model_init(klass, options={}) # ... # Add booting the Componentable classes Origen::Componentable.init_parent_class(klass, self) end class MyTest include Origen::Model include Origen::Componentable end end ``` -------------------------------- ### Installing Required Python Packages Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/o2/guides/developers/installation.html These commands install essential Python packages using `pip3`, which are prerequisites for building Origen. They include tools for dependency management, packaging, and code formatting. ```Shell pip3 install poetry pip3 install maturin pip3 install twine pip3 install pyfs pip3 install yapf pip3 install -U keyrings.alt ``` -------------------------------- ### Creating Origen Application Workspace (Shell) Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/origen/docs/environment/installation/index.html These shell commands create a new directory named 'origen_core', navigate into it, and then use 'dssc' commands to set up a vault and populate it with versioned files. This is a prerequisite for setting up an Origen application's local workspace. ```Shell mkdir origen_core cd origen_core dssc setvault . dssc pop -rec -uni -get -force -ver 0.2.3 . ``` -------------------------------- ### Initializing Origen Framework and Displaying Version (Rust) Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/o2_dev/_static/build/rustdoc/cli/doc/src/origen/bin.rs.html This snippet initializes the Origen framework with the determined verbosity and the current executable path. It then dynamically formats and displays the Origen version, adapting the output based on whether an application is present. Additionally, it performs default configuration checks for the application if one is detected. ```Rust let exe = match std::env::current_exe() { Ok(p) => Some(format!("{}", p.display())), Err(e) => { log_error!("{}", e); None } }; origen::initialize(Some(verbosity), exe); let version = match STATUS.is_app_present { true => format!( "Origen CLI: {}", to_pep440(&STATUS.origen_version.to_string()).unwrap_or("Error".to_string()) ), false => format!( "Origen: {}", to_pep440(&STATUS.origen_version.to_string()).unwrap_or("Error".to_string()) ), }; if STATUS.app.is_some() { origen::core::application::config::Config::check_defaults( &STATUS.app.as_ref().unwrap().root, ); } ``` -------------------------------- ### Example Hex Data Grouped by Address Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/memory_image/index.html This snippet shows an example of hexadecimal data grouped by memory address, indicated by the '@' symbol. Each line represents a block of data at a specific starting address. ```Hex @18000000 1E E0 02 1C 22 40 1B E0 02 1C 22 43 18 E0 02 1C 5A 78 0A 43 03 E0 03 4B F7 21 5A 78 0A 40 00 20 22 E0 84 42 22 D3 1F E0 84 42 1F D9 1C E0 84 42 @180000E0 002B20D1 03E0012A 01D1002B 1BD00223 2340022A 02D1002B 15D103E0 032A01D1 @180001F0 780000187C0000188200001888000018 ``` -------------------------------- ### Implementing Device Startup in OrigenLink (Ruby) Source: https://github.com/origen-sdk/origen-sdk.github.io/blob/master/OrigenLink/api/OrigenLink/Test/TopLevelController.html The `startup` method prepares the device for testing by entering test mode and configuring the tester. It sets pin format and timing for `OrigenLink::VectorBased` testers, defines the timeset, and introduces a wait period before proceeding with test operations. ```Ruby def startup(options) pp 'Enter test mode' do # if tester.link? if tester.to_s == 'OrigenLink::VectorBased' # tester.initialize_pattern # below is for testing return format timing, requires tclk to be rl and multiple of 1 tester.pinformat = 'func_25mhz,tclk,rl' tester.pintiming = 'func_25mhz,tdi,0,tms,0,tdo,1' end tester.set_timeset('func_25mhz', 40) # Where 40 is the period in ns tester.wait time_in_us: 100 end end ```