% 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_ahb", ">= <%= Origen.app.version %>"
~~~
__NOTE:__ You will also need to include require 'origen_ahb'
somewhere in your environment
if your app is a plugin.
### How To Use
Include the OrigenAhb
module in your DUT class, then hook it up
to the Origen register API via
read_register
and write_register
methods.
You must also include a compatible physical driver depending on what debug
interface your device has. This **MUST** be implemented in a method called ahb_trans
at the top-level application (i.e. dut).
~~~ruby
require 'origen_ahb'
class DUT
include Origen::TopLevel
include OrigenAhb
def initialize
add_pin :hclk
add_pin :hwrite
add_pin :haddr
add_pin :wdata
add_pin :rdata
reg :myreg, 0x0012, size: 16 do |reg|
reg.bits 15..8, :upper_byte
reg.bits 7..0, :lower_byte
end
end
# Hook the Ahb module into the register API, any register read
# requests will use the AHB protocol by default
def read_register(reg, options={})
ahb.read_register(reg, options)
end
# As above for write requests
def write_register(reg, options={})
ahb.write_register(reg, options)
end
# Define ahb_trans method at top-level
def ahb_trans(options)
# Available options here will be:
# options[:haddr] - Address of transaction
# options[:hdata] - Data (either to be written or expected value of read)
# options[:hwrite] - Read or Write transaction
# options[:hsize] - Bus width
# options[:hburst] -
# options[:hmastlock] -
# options[:hprot] -
# Drive appropriate pins for Address Phase
pin(:hclk).drive(0)
...
# Drive appropriate pins for Data Phase
pin(:hwdata).drive(options[:hdata])
...
end
end
DUT.new.myreg.write!(0x55AA) # => Will generate the required vectors using the AHB bus protocol
~~~
### How To Setup a Development Environment
[Clone the repository from Github](https://github.com/Origen-SDK/origen_ahb).
An instance of the OrigenAhb driver is hooked up to a dummy DUT
object for use in the console:
~~~
origen i
> dut.ahb
=> #