Class: OrigenSWD::Driver
- Inherits:
 - 
      Object
      
        
- Object
 - OrigenSWD::Driver
 
 
- Includes:
 - Origen::Registers
 
- Defined in:
 - lib/origen_swd/driver.rb
 
Overview
To use this driver the owner model must define the following pins (an alias is fine):
:swd_clk
:swd_dio
  Constant Summary collapse
- REQUIRED_PINS =
 [:swd_clk, :swd_dio]
Instance Attribute Summary collapse
- 
  
    
      #owner  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the parent object that instantiated the driver, could be either a DUT object or a protocol abstraction.
 - 
  
    
      #trn  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Customiz-ible 'turn-round cycle' (TRN) parameter (in cycles).
 
Instance Method Summary collapse
- 
  
    
      #initialize(owner, options = {})  ⇒ Driver 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
Initialize class variables.
 - 
  
    
      #read(ap_dp, reg_or_val, options = {})  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Read data from Debug Port or Access Port.
 - 
  
    
      #read_ap(reg_or_val, options = {})  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Write data from Access Port.
 - 
  
    
      #read_dp(reg_or_val, options = {})  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Write data from Debug Port.
 - 
  
    
      #write(ap_dp, reg_or_val, deprecated_wdata = nil, options = {})  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Write data to Debug Port or Access Port.
 - 
  
    
      #write_ap(reg_or_val, options = {})  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Write data to Access Port.
 - 
  
    
      #write_dp(reg_or_val, options = {})  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Write data to Debug Port.
 
Constructor Details
#initialize(owner, options = {}) ⇒ Driver
Initialize class variables
      27 28 29 30 31 32 33  | 
    
      # File 'lib/origen_swd/driver.rb', line 27 def initialize(owner, = {}) @owner = owner @current_apaddr = 0 @orundetect = 0 @trn = 0 end  | 
  
Instance Attribute Details
#owner ⇒ Object (readonly)
Returns the parent object that instantiated the driver, could be either a DUT object or a protocol abstraction
      13 14 15  | 
    
      # File 'lib/origen_swd/driver.rb', line 13 def owner @owner end  | 
  
#trn ⇒ Object
Customiz-ible 'turn-round cycle' (TRN) parameter (in cycles)
      16 17 18  | 
    
      # File 'lib/origen_swd/driver.rb', line 16 def trn @trn end  | 
  
Instance Method Details
#read(ap_dp, reg_or_val, options = {}) ⇒ Object
Read data from Debug Port or Access Port
      68 69 70 71 72 73 74  | 
    
      # File 'lib/origen_swd/driver.rb', line 68 def read(ap_dp, reg_or_val, = {}) addr = extract_address(reg_or_val, .merge(use_reg_or_val_if_you_must: true)) send_header(ap_dp, 1, addr) # send read-specific header (rnw = 1) receive_acknowledgement() receive_payload(reg_or_val, ) swd_dio.drive(0) end  | 
  
#read_ap(reg_or_val, options = {}) ⇒ Object
Write data from Access Port
      54 55 56 57  | 
    
      # File 'lib/origen_swd/driver.rb', line 54 def read_ap(reg_or_val, = {}) reg_or_val, = nil, reg_or_val if reg_or_val.is_a?(Hash) read(1, reg_or_val, .merge(compare_data: reg_or_val.is_a?(Numeric))) end  | 
  
#read_dp(reg_or_val, options = {}) ⇒ Object
Write data from Debug Port
      42 43 44 45  | 
    
      # File 'lib/origen_swd/driver.rb', line 42 def read_dp(reg_or_val, = {}) reg_or_val, = nil, reg_or_val if reg_or_val.is_a?(Hash) read(0, reg_or_val, .merge(compare_data: reg_or_val.is_a?(Numeric))) end  | 
  
#write(ap_dp, reg_or_val, deprecated_wdata = nil, options = {}) ⇒ Object
Write data to Debug Port or Access Port
      107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128  | 
    
      # File 'lib/origen_swd/driver.rb', line 107 def write(ap_dp, reg_or_val, deprecated_wdata = nil, = {}) deprecated_wdata, = nil, deprecated_wdata if deprecated_wdata.is_a?(Hash) if deprecated_wdata addr = reg_or_val.respond_to?(:address) ? reg_or_val.address : reg_or_val else addr = extract_address(reg_or_val, ) end send_header(ap_dp, 0, addr) # send write-specific header (rnw = 0) receive_acknowledgement if deprecated_wdata if reg_or_val.respond_to?(:data) reg_or_val.data = deprecated_wdata else reg_or_val = deprecated_wdata end end send_payload(reg_or_val, ) swd_dio.drive(0) end  | 
  
#write_ap(reg_or_val, options = {}) ⇒ Object
Write data to Access Port
      94 95 96  | 
    
      # File 'lib/origen_swd/driver.rb', line 94 def write_ap(reg_or_val, = {}) write(1, reg_or_val, ) end  | 
  
#write_dp(reg_or_val, options = {}) ⇒ Object
Write data to Debug Port
      83 84 85  | 
    
      # File 'lib/origen_swd/driver.rb', line 83 def write_dp(reg_or_val, = {}) write(0, reg_or_val, ) end  |