Class: OrigenJTAGDev::NewStyle

Inherits:
Object
  • Object
show all
Includes:
Origen::TopLevel
Defined in:
lib/origen_jtag_dev/new_style.rb

Overview

This is a dummy DUT model which is used to instantiate and test the JTAG locally during development.

It is not included when this library is imported.

Direct Known Subclasses

Serial

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ NewStyle

Returns a new instance of NewStyle.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/origen_jtag_dev/new_style.rb', line 12

def initialize(options = {})
  @jtag_config = {
    verbose:         true,
    tclk_format:     :rh,
    tclk_multiple:   1,
    tdo_strobe:      :tclk_high,
    tdo_store_cycle: 0,
    init_state:      :unknown
  }
  @jtag_config[:tclk_format] = options[:tclk_format] if options[:tclk_format]
  @jtag_config[:tclk_multiple] = options[:tclk_multiple] if options[:tclk_multiple]
  @jtag_config[:tdo_strobe] = options[:tdo_strobe] if options[:tdo_strobe]
  @jtag_config[:tdo_store_cycle] = options[:tdo_store_cycle] if options[:tdo_store_cycle]
  @jtag_config[:init_state] = options[:init_state] if options[:init_state]
  @jtag_config[:tclk_vals] = options[:tclk_vals] if options[:tclk_vals]
  @jtag_config[:cycle_callback] = options[:cycle_callback] if options[:cycle_callback]

  instantiate_registers(options)
  instantiate_pins(options)
  sub_block :jtag, { class_name: 'OrigenJTAG::Driver' }.merge(@jtag_config)
  if options[:extra_port]
    # Test supplying both pin IDs (recommended) and pin objects (legacy)
    sub_block :jtag2, { class_name: 'OrigenJTAG::Driver', tck_pin: :tck_2, tdi_pin: :tdi_2, tdo_pin: pin(:tdo_2), tms_pin: pin(:tms_2) }.merge(@jtag_config)
  end
end

Instance Attribute Details

#jtag_configObject (readonly)

Returns the value of attribute jtag_config.



10
11
12
# File 'lib/origen_jtag_dev/new_style.rb', line 10

def jtag_config
  @jtag_config
end

Instance Method Details

#init_stateObject

Getter for top-level init_state setting



100
101
102
# File 'lib/origen_jtag_dev/new_style.rb', line 100

def init_state
  @jtag_config[:init_state]
end

#instantiate_pins(options = {}) ⇒ Object



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/origen_jtag_dev/new_style.rb', line 54

def instantiate_pins(options = {})
  add_pin :tclk
  unless options[:invalid_pins]
    add_pin :tdi
  end
  add_pin :tdo
  add_pin :tms

  if options[:extra_port]
    add_pin :tck_2
    add_pin :tdi_2
    add_pin :tdo_2
    add_pin :tms_2
  end
end

#instantiate_registers(options = {}) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/origen_jtag_dev/new_style.rb', line 38

def instantiate_registers(options = {})
  reg :test16, 0x0012, size: 16 do |reg|
    reg.bit 15..8, :bus
    reg.bit 0, :bit
  end

  reg :test32, 0x0014, size: 32 do |reg|
    reg.bit 31..16, :bus
    reg.bit 0, :bit
  end

  reg :full16, 0x0012, size: 16 do |reg|
    reg.bit 15..0, :data
  end
end

#startup(options = {}) ⇒ Object



70
71
72
# File 'lib/origen_jtag_dev/new_style.rb', line 70

def startup(options = {})
  tester.set_timeset('nvmbist', 40)
end

#tclk_formatObject

Getter for top-level tclk_format setting



75
76
77
# File 'lib/origen_jtag_dev/new_style.rb', line 75

def tclk_format
  @jtag_config[:tclk_format]
end

#tclk_multipleObject

Getter for top-level tclk_multiple setting



80
81
82
# File 'lib/origen_jtag_dev/new_style.rb', line 80

def tclk_multiple
  @jtag_config[:tclk_multiple]
end

#tclk_valsObject

Getter for top-level tclk_vals setting



85
86
87
# File 'lib/origen_jtag_dev/new_style.rb', line 85

def tclk_vals
  @jtag_config[:tclk_vals]
end

#tdo_store_cycleObject

Getter for top-level tdo_store_cycle setting



95
96
97
# File 'lib/origen_jtag_dev/new_style.rb', line 95

def tdo_store_cycle
  @jtag_config[:tdo_store_cycle]
end

#tdo_strobeObject

Getter for top-level tdo_strobe setting



90
91
92
# File 'lib/origen_jtag_dev/new_style.rb', line 90

def tdo_strobe
  @jtag_config[:tdo_strobe]
end

#update_jtag_config(cfg, val) ⇒ Object

Wouldn't want to do this in reality, but allows some flexibility during gem testing



105
106
107
108
109
110
111
# File 'lib/origen_jtag_dev/new_style.rb', line 105

def update_jtag_config(cfg, val)
  if @jtag_config.key?(cfg)
    @jtag_config[cfg] = val
  else
    fail "#{cfg} not a part of @jtag_config"
  end
end