OrigenSWD (1.1.0)


This application provides a SWD driver.

How To Import

In your Gemfile add:

gem "origen_swd", ">= 1.1.0"

or if your application is a plugin add this to your .gemspec

spec.add_development_dependency "origen_swd", ">= 1.1.0"

NOTE: You will also need to include require 'origen_swd' somewhere in your environment. This can be done in config/environment.rb for example.

How To Use

Include the OrigenSWD module to add a SWD driver to your class and then define the required pins.

Including the module adds a swd method which will return an instance of OrigenSWD::Driver.

Here is an example integration:

class DUT
  include Origen::TopLevel
  include OrigenSWD

  def initialize(options = {})
    add_pin :swd_clk 
    add_pin :swd_dio

dut.swd # => An instance of OrigenSWD::Driver

# Here is the main API for reading and writing the debug and access ports...

# Registers objects can be supplied to provide the address and data values.
# The register bits can be pre-marked for read, store or overlay and which
# will result in the requested action being applied to the cycles corresponding
# to those bits only (don't care cycles will be generated for the others).

# Alternatively, dumb data values can be supplied.
dut.swd.write_dp(0x55, address: 10)
dut.swd.read_dp(0x55, address: 10)    
dut.swd.write_ap(0x55, address: 10)    
dut.swd.read_ap(0x55, address: 10)    

# In the case of read, the data value can be omitted completely, in which case
# it will generate a read operation with don't care on all shift out vectors
dut.swd.read_dp(address: 10)    
dut.swd.read_ap(address: 10)    

How To Setup a Development Environment

Clone the repository from Github.

An instance of the OrigenSWD driver is hooked up to a dummy DUT object for use in the console:

origen i

> dut.swd
=> #<OrigenSWD::Driver:0x0000001ee48e78>

Follow the instructions here if you want to make a 3rd party app workspace use your development copy of the OrigenSWD plugin: Setting up a Plugin Development Environment

This plugin also contains a test suite, makes sure this passes before committing any changes!

origen examples