% render "layouts/basic.html" do %# HTML tags can be embedded in mark down files if you want to do specific custom %# formatting like this, but in most cases that is not required.
.gemspec
~~~ruby
spec.add_development_dependency "origen_swd", ">= <%= Origen.app.version %>"
~~~
__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
](<%= path "api/OrigenSWD/Driver.html" %>).
Here is an example integration:
~~~ruby
class DUT
include Origen::TopLevel
include OrigenSWD
def initialize(options = {})
add_pin :swd_clk
add_pin :swd_dio
end
end
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).
dut.swd.write_dp(reg_object)
dut.swd.read_dp(reg_object)
dut.swd.write_ap(reg_object)
dut.swd.read_ap(reg_object)
# 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](https://github.com/Origen-SDK/origen_swd).
An instance of the OrigenSWD driver is hooked up to a dummy DUT
object for use in the console:
~~~
origen i
> dut.swd
=> #