Sha256: 1d61c832f86d8e2b23f1bc8a9a3141772bdce8608e32a9784e5f3c7860a9812e

Contents?: true

Size: 1.36 KB

Versions: 11

Compression:

Stored size: 1.36 KB

Contents

Pattern.create do

  address    = 0x00002020
  rwb        = 0
  ap_dp      = 1
  wdata      = 0xAAAA5555
  start      = 1
  apndp      = 1
  rnw        = rwb
  addr       = address >> 2
  parity_pr  = ap_dp ^ rwb ^ (addr >> 3) ^ (addr >> 2) & (0x01) ^ (addr >> 1) & (0x01) ^ addr & 0x01
  trn        = 0
  data       = wdata
  require_dp = 0
  line_reset = 0
  stop       = 0
  park       = 1

  cc 'SWD transaction'
  cc 'Packet Request Phase'

  annotate 'Send Start Bit'
  $dut.swd.send_data(start, 1)
  cc('Send APnDP Bit (DP or AP Access Register Bit)', prefix: true)
  $dut.swd.send_data(apndp, 1)
  c2 'Send RnW Bit (read or write bit)'
  $dut.swd.send_data(rnw, 1)
  c2 'Send Address Bits (2 bits)'
  $dut.swd.send_data(addr, 2)
  c2 'Send Parity Bit'
  $dut.swd.send_data(parity_pr, 1)
  c2 'Send Stop Bit'
  $dut.swd.send_data(stop, 1)
  c2 'Send Park Bit'
  $dut.swd.send_data(park, 1)

  cc 'Acknowledge Response phase'
  $dut.swd.send_data(0xf, trn + 1)
  $dut.swd.get_data(3)

  cc 'Write Data Phase'
  cc 'Write'
  cc 'Send ACK Bits'
  $dut.swd.send_data(0xf, trn + 1)
  cc 'SWD 32-Bit Write Start'
  $dut.swd.send_data(data, 32, overlay: 'write_ovl')
  cc 'SWD 32-Bit Write End'
  cc 'Send Write Parity Bit'
  xor = 0
  32.times do |bit|
    xor ^= (data >> bit) & 0x01
  end
  xor
  $dut.swd.send_data(xor, 1)

  cc 'SWD DIO to 0 for 10 cycles'
  $dut.swd.swd_dio_to_0(10)

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
origen_swd-0.5.0 pattern/example.rb
origen_swd-0.4.0 pattern/example.rb
origen_swd-0.3.9 pattern/example.rb
origen_swd-0.3.8 pattern/example.rb
origen_swd-0.3.7 pattern/example.rb
origen_swd-0.3.6 pattern/example.rb
origen_swd-0.3.5 pattern/example.rb
origen_swd-0.3.4 pattern/example.rb
origen_swd-0.3.3 pattern/example.rb
origen_swd-0.3.2 pattern/example.rb
origen_swd-0.3.1 pattern/example.rb