OrigenAhb (0.2.3)

Purpose

This library provides register and memory read/write and debug control capability via the AHB protocol.

How To Import

In your Gemfile add:

gem "origen_ahb", ">= 0.2.3"

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

spec.add_development_dependency "origen_ahb", ">= 0.2.3"

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).

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.

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

origen i

> dut.ahb
=> #<OrigenAhb::Driver:0x0000001b303570 @owner=<Model/Controller: OrigenAhb::Test::DUT:237392680/OrigenAhb::Test::DUTController:227789200>>

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

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

origen examples

Comments


Comments