origen_jtag 0.17.1 → 0.17.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/origen_jtag.rb CHANGED
@@ -1,13 +1,13 @@
1
- require 'origen'
2
- require_relative '../config/application.rb'
3
-
4
- # Include this module to add a JTAG driver to your class
5
- module OrigenJTAG
6
- autoload :TAPController, 'origen_jtag/tap_controller'
7
- autoload :Driver, 'origen_jtag/driver'
8
-
9
- # Returns an instance of the OrigenJTAG::Driver
10
- def jtag
11
- @jtag ||= Driver.new(self)
12
- end
13
- end
1
+ require 'origen'
2
+ require_relative '../config/application.rb'
3
+
4
+ # Include this module to add a JTAG driver to your class
5
+ module OrigenJTAG
6
+ autoload :TAPController, 'origen_jtag/tap_controller'
7
+ autoload :Driver, 'origen_jtag/driver'
8
+
9
+ # Returns an instance of the OrigenJTAG::Driver
10
+ def jtag
11
+ @jtag ||= Driver.new(self)
12
+ end
13
+ end
@@ -1,94 +1,94 @@
1
- module OrigenJTAGDev
2
- # This is a dummy DUT model which is used
3
- # to instantiate and test the JTAG locally
4
- # during development.
5
- #
6
- # It is not included when this library is imported.
7
- class DUT
8
- include Origen::TopLevel
9
- include OrigenJTAG
10
-
11
- attr_reader :jtag_config
12
-
13
- JTAG_CONFIG = {
14
- verbose: true,
15
- tclk_format: :rh,
16
- tclk_multiple: 1,
17
- tdo_strobe: :tclk_high,
18
- tdo_store_cycle: 0,
19
- init_state: :unknown
20
- }
21
-
22
- def initialize(options = {})
23
- JTAG_CONFIG[:tclk_format] = options[:tclk_format] if options[:tclk_format]
24
- JTAG_CONFIG[:tclk_multiple] = options[:tclk_multiple] if options[:tclk_multiple]
25
- JTAG_CONFIG[:tdo_strobe] = options[:tdo_strobe] if options[:tdo_strobe]
26
- JTAG_CONFIG[:tdo_store_cycle] = options[:tdo_store_cycle] if options[:tdo_store_cycle]
27
- JTAG_CONFIG[:init_state] = options[:init_state] if options[:init_state]
28
-
29
- instantiate_registers(options)
30
- instantiate_pins(options)
31
- end
32
-
33
- def instantiate_registers(options = {})
34
- reg :test16, 0x0012, size: 16 do |reg|
35
- reg.bit 15..8, :bus
36
- reg.bit 0, :bit
37
- end
38
-
39
- reg :test32, 0x0014, size: 32 do |reg|
40
- reg.bit 31..16, :bus
41
- reg.bit 0, :bit
42
- end
43
-
44
- reg :full16, 0x0012, size: 16 do |reg|
45
- reg.bit 15..0, :data
46
- end
47
- end
48
-
49
- def instantiate_pins(options = {})
50
- add_pin :tclk
51
- add_pin :tdi
52
- add_pin :tdo
53
- add_pin :tms
54
- end
55
-
56
- def startup(options = {})
57
- tester.set_timeset('nvmbist', 40)
58
- end
59
-
60
- # Getter for top-level tclk_format setting
61
- def tclk_format
62
- JTAG_CONFIG[:tclk_format]
63
- end
64
-
65
- # Getter for top-level tclk_multiple setting
66
- def tclk_multiple
67
- JTAG_CONFIG[:tclk_multiple]
68
- end
69
-
70
- # Getter for top-level tdo_strobe setting
71
- def tdo_strobe
72
- JTAG_CONFIG[:tdo_strobe]
73
- end
74
-
75
- # Getter for top-level tdo_store_cycle setting
76
- def tdo_store_cycle
77
- JTAG_CONFIG[:tdo_store_cycle]
78
- end
79
-
80
- # Getter for top-level init_state setting
81
- def init_state
82
- JTAG_CONFIG[:init_state]
83
- end
84
-
85
- # Wouldn't want to do this in reality, but allows some flexibility duing gem testing
86
- def update_jtag_config(cfg, val)
87
- if JTAG_CONFIG.key?(cfg)
88
- JTAG_CONFIG[cfg] = val
89
- else
90
- fail "#{cfg} not a part of JTAG_CONFIG"
91
- end
92
- end
93
- end
94
- end
1
+ module OrigenJTAGDev
2
+ # This is a dummy DUT model which is used
3
+ # to instantiate and test the JTAG locally
4
+ # during development.
5
+ #
6
+ # It is not included when this library is imported.
7
+ class DUT
8
+ include Origen::TopLevel
9
+ include OrigenJTAG
10
+
11
+ attr_reader :jtag_config
12
+
13
+ JTAG_CONFIG = {
14
+ verbose: true,
15
+ tclk_format: :rh,
16
+ tclk_multiple: 1,
17
+ tdo_strobe: :tclk_high,
18
+ tdo_store_cycle: 0,
19
+ init_state: :unknown
20
+ }
21
+
22
+ def initialize(options = {})
23
+ JTAG_CONFIG[:tclk_format] = options[:tclk_format] if options[:tclk_format]
24
+ JTAG_CONFIG[:tclk_multiple] = options[:tclk_multiple] if options[:tclk_multiple]
25
+ JTAG_CONFIG[:tdo_strobe] = options[:tdo_strobe] if options[:tdo_strobe]
26
+ JTAG_CONFIG[:tdo_store_cycle] = options[:tdo_store_cycle] if options[:tdo_store_cycle]
27
+ JTAG_CONFIG[:init_state] = options[:init_state] if options[:init_state]
28
+
29
+ instantiate_registers(options)
30
+ instantiate_pins(options)
31
+ end
32
+
33
+ def instantiate_registers(options = {})
34
+ reg :test16, 0x0012, size: 16 do |reg|
35
+ reg.bit 15..8, :bus
36
+ reg.bit 0, :bit
37
+ end
38
+
39
+ reg :test32, 0x0014, size: 32 do |reg|
40
+ reg.bit 31..16, :bus
41
+ reg.bit 0, :bit
42
+ end
43
+
44
+ reg :full16, 0x0012, size: 16 do |reg|
45
+ reg.bit 15..0, :data
46
+ end
47
+ end
48
+
49
+ def instantiate_pins(options = {})
50
+ add_pin :tclk
51
+ add_pin :tdi
52
+ add_pin :tdo
53
+ add_pin :tms
54
+ end
55
+
56
+ def startup(options = {})
57
+ tester.set_timeset('nvmbist', 40)
58
+ end
59
+
60
+ # Getter for top-level tclk_format setting
61
+ def tclk_format
62
+ JTAG_CONFIG[:tclk_format]
63
+ end
64
+
65
+ # Getter for top-level tclk_multiple setting
66
+ def tclk_multiple
67
+ JTAG_CONFIG[:tclk_multiple]
68
+ end
69
+
70
+ # Getter for top-level tdo_strobe setting
71
+ def tdo_strobe
72
+ JTAG_CONFIG[:tdo_strobe]
73
+ end
74
+
75
+ # Getter for top-level tdo_store_cycle setting
76
+ def tdo_store_cycle
77
+ JTAG_CONFIG[:tdo_store_cycle]
78
+ end
79
+
80
+ # Getter for top-level init_state setting
81
+ def init_state
82
+ JTAG_CONFIG[:init_state]
83
+ end
84
+
85
+ # Wouldn't want to do this in reality, but allows some flexibility duing gem testing
86
+ def update_jtag_config(cfg, val)
87
+ if JTAG_CONFIG.key?(cfg)
88
+ JTAG_CONFIG[cfg] = val
89
+ else
90
+ fail "#{cfg} not a part of JTAG_CONFIG"
91
+ end
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,12 @@
1
+ if tester.uflex?
2
+ Pattern.create do
3
+ tester.overlay_style = :digsrc
4
+ dut.full16.overlay 'dummy_str'
5
+ dut.jtag.write_dr dut.full16
6
+
7
+ tester.capture_style = :digcap
8
+ dut.full16.overlay nil
9
+ dut.full16.store
10
+ dut.jtag.read_dr dut.full16
11
+ end
12
+ end
@@ -1,13 +1,13 @@
1
- if tester.j750? || tester.uflex?
2
- Pattern.create(options = { name: 'global_label_test' }) do
3
-
4
- jtag = $dut.jtag
5
- reg = $dut.reg(:full16)
6
-
7
- cc 'TDO should be HLHL_LHLH_HLHL_LHLH'
8
- reg.write(0xFFFF)
9
- reg.overlay('globaltest')
10
- jtag.write_dr reg, overlay: true, overlay_label: 'thisisthegloballabel'
11
-
12
- end
1
+ if tester.j750? || tester.uflex?
2
+ Pattern.create(options = { name: 'global_label_test' }) do
3
+
4
+ jtag = $dut.jtag
5
+ reg = $dut.reg(:full16)
6
+
7
+ cc 'TDO should be HLHL_LHLH_HLHL_LHLH'
8
+ reg.write(0xFFFF)
9
+ reg.overlay('globaltest')
10
+ jtag.write_dr reg, overlay: true, overlay_label: 'thisisthegloballabel'
11
+
12
+ end
13
13
  end