Class: KATCP::TenGE

Inherits:
Bram
  • Object
show all
Defined in:
lib/katcp/client/roach.rb

Overview

Class used to access 10 GbE cores

Instance Method Summary collapse

Methods inherited from Bram

#initialize

Constructor Details

This class inherits a constructor from KATCP::Bram

Instance Method Details

#[](idx) ⇒ Object

Returns current value of ARP table entry idx.



94
95
96
# File 'lib/katcp/client/roach.rb', line 94

def [](idx)
  read64(0xc00+2*idx)
end

#[]=(idx, mac) ⇒ Object

Sets value of ARP table entry idx to mac.



99
100
101
# File 'lib/katcp/client/roach.rb', line 99

def []=(idx, mac)
  write64(0xc00+2*idx, mac)
end

#gwObject

Get gateway IP address as 32-bit integer.



54
# File 'lib/katcp/client/roach.rb', line 54

def gw    ; get(3)    ; end

#gw=(a) ⇒ Object

Set gateway IP address to 32-bit integer a.



56
# File 'lib/katcp/client/roach.rb', line 56

def gw=(a); set(3, a); end

#ipObject

Get source IP address as 32-bit integer.



59
# File 'lib/katcp/client/roach.rb', line 59

def ip    ; get(4)    ; end

#ip=(a) ⇒ Object

Set source IP address to 32-bit integer a.



61
# File 'lib/katcp/client/roach.rb', line 61

def ip=(a); set(4, a); end

#macObject

Return MAC address of 10 GbE core as 48-bit value.



44
45
46
# File 'lib/katcp/client/roach.rb', line 44

def mac
  read64(0)
end

#mac=(m) ⇒ Object

Set MAC address of 10 GbE core to 48-bit value m.



49
50
51
# File 'lib/katcp/client/roach.rb', line 49

def mac=(m)
  write64(0, m)
end

#portObject

Get local rx port as 16-bit integer.



64
# File 'lib/katcp/client/roach.rb', line 64

def port    ; get(8) & 0xffff                             ; end

#port=(p) ⇒ Object

Set local rx port to 16-bit integer p.



66
# File 'lib/katcp/client/roach.rb', line 66

def port=(p); set(8, (get(8) & 0xffff0000) | (p & 0xffff)); end

#read64(addr) ⇒ Object

Read a 64 bit value big endian value starting at 32-bit word offset addr.



30
31
32
33
# File 'lib/katcp/client/roach.rb', line 30

def read64(addr)
  hi, lo = get(addr,2).to_a
  ((hi & 0xffff) << 32) | (lo & 0xffffffff)
end

#rx_eq_mixObject

Get current value of rx_eq_mix parameter.



85
# File 'lib/katcp/client/roach.rb', line 85

def rx_eq_mix   ; (get(10) >> 24) & 0xff; end

#rx_eq_polObject

Get current value of rx_eq_pol parameter.



87
# File 'lib/katcp/client/roach.rb', line 87

def rx_eq_pol   ; (get(10) >> 16) & 0xff; end

#tx_diff_ctrlObject

Get current value of tx_diff_ctrl parameter.



91
# File 'lib/katcp/client/roach.rb', line 91

def tx_diff_ctrl; (get(10)      ) & 0xff; end

#tx_preemphObject

Get current value of tx_preemph parameter.



89
# File 'lib/katcp/client/roach.rb', line 89

def tx_preemph  ; (get(10) >>  8) & 0xff; end

#write64(addr, val64) ⇒ Object

Write val64 as a 64 bit value big endian value starting at 32-bit word offset addr.



37
38
39
40
41
# File 'lib/katcp/client/roach.rb', line 37

def write64(addr, val64)
  hi = ((val64 >> 32) & 0xffff)
  lo = val64 & 0xffffffff
  set(addr, hi, lo)
end

#xaui_bonded?Boolean

Returns true if all four XAUI lanes are bonded

Returns:

  • (Boolean)


82
# File 'lib/katcp/client/roach.rb', line 82

def xaui_bonded?; ((get(9) >> 6) & 1) == 1; end

#xaui_statusObject

Returns xaui status word. Bits 2 through 5 are lane sync, bit 6 is channel bonding status.



70
# File 'lib/katcp/client/roach.rb', line 70

def xaui_status; get(9); end

#xaui_status_ok?Boolean

Returns true if all four lanes are sync’d and bonded.

Returns:

  • (Boolean)


72
# File 'lib/katcp/client/roach.rb', line 72

def xaui_status_ok?; (get(9) & 0b01111100) == 0b01111100; end

#xaui_syncObject

Four least significant bits represent sync status for each lane.

1 bit = lane sync OK
0 bit = lane sync BAD

Proper operation requires all four lanes to have good sync status, so 15 (0b1111) is the desired value.



78
# File 'lib/katcp/client/roach.rb', line 78

def xaui_sync; (get(9) >> 2) & 0b1111; end

#xaui_sync_ok?Boolean

Returns true if #xaui_sync returns 15

Returns:

  • (Boolean)


80
# File 'lib/katcp/client/roach.rb', line 80

def xaui_sync_ok?; xaui_sync == 0b1111; end