Class: OrigenJTAGDev::DUT

Inherits:
Object
  • Object
show all
Includes:
Origen::TopLevel, OrigenJTAG
Defined in:
lib/origen_jtag_dev/top_level.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.

Constant Summary collapse

JTAG_CONFIG =
{
  verbose:         true,
  tclk_format:     :rh,
  tclk_multiple:   1,
  tdo_strobe:      :tclk_high,
  tdo_store_cycle: 0,
  init_state:      :unknown
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from OrigenJTAG

#jtag

Constructor Details

#initialize(options = {}) ⇒ DUT

Returns a new instance of DUT.



22
23
24
25
26
27
28
29
30
31
# File 'lib/origen_jtag_dev/top_level.rb', line 22

def initialize(options = {})
  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]

  instantiate_registers(options)
  instantiate_pins(options)
end

Instance Attribute Details

#jtag_configObject (readonly)

Returns the value of attribute jtag_config.



11
12
13
# File 'lib/origen_jtag_dev/top_level.rb', line 11

def jtag_config
  @jtag_config
end

Instance Method Details

#init_stateObject

Getter for top-level init_state setting



81
82
83
# File 'lib/origen_jtag_dev/top_level.rb', line 81

def init_state
  JTAG_CONFIG[:init_state]
end

#instantiate_pins(options = {}) ⇒ Object



49
50
51
52
53
54
# File 'lib/origen_jtag_dev/top_level.rb', line 49

def instantiate_pins(options = {})
  add_pin :tclk
  add_pin :tdi
  add_pin :tdo
  add_pin :tms
end

#instantiate_registers(options = {}) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/origen_jtag_dev/top_level.rb', line 33

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



56
57
58
# File 'lib/origen_jtag_dev/top_level.rb', line 56

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

#tclk_formatObject

Getter for top-level tclk_format setting



61
62
63
# File 'lib/origen_jtag_dev/top_level.rb', line 61

def tclk_format
  JTAG_CONFIG[:tclk_format]
end

#tclk_multipleObject

Getter for top-level tclk_multiple setting



66
67
68
# File 'lib/origen_jtag_dev/top_level.rb', line 66

def tclk_multiple
  JTAG_CONFIG[:tclk_multiple]
end

#tdo_store_cycleObject

Getter for top-level tdo_store_cycle setting



76
77
78
# File 'lib/origen_jtag_dev/top_level.rb', line 76

def tdo_store_cycle
  JTAG_CONFIG[:tdo_store_cycle]
end

#tdo_strobeObject

Getter for top-level tdo_strobe setting



71
72
73
# File 'lib/origen_jtag_dev/top_level.rb', line 71

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 duing gem testing



86
87
88
89
90
91
92
# File 'lib/origen_jtag_dev/top_level.rb', line 86

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