origen_link 0.1.0.pre0 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/start_link_server +20 -0
- data/config/application.rb +0 -0
- data/config/boot.rb +3 -2
- data/config/commands.rb +0 -0
- data/config/version.rb +1 -1
- data/lib/origen_link.rb +1 -15
- data/lib/origen_link/callback_handlers.rb +13 -0
- data/lib/origen_link/server/jtag.rb +180 -0
- data/lib/origen_link/server/pin.rb +125 -0
- data/lib/origen_link/server/sequencer.rb +353 -0
- data/lib/origen_link/{includes_vector_based.rb → server_com.rb} +32 -7
- data/lib/origen_link/test/top_level.rb +48 -0
- data/lib/origen_link/test/top_level_controller.rb +44 -0
- data/lib/origen_link/test/vector_based.rb +25 -0
- data/lib/origen_link/vector_based.rb +254 -53
- data/lib/tasks/origen_link.rake +0 -0
- data/pattern/example.rb +0 -0
- data/pattern/jtag_100_operations.rb +0 -0
- data/pattern/jtag_comm_fail_test.rb +0 -0
- data/pattern/jtag_comm_test.rb +0 -0
- data/templates/web/index.md.erb +0 -0
- data/templates/web/layouts/_basic.html.erb +0 -0
- data/templates/web/partials/_navbar.html.erb +0 -0
- data/templates/web/release_notes.md.erb +0 -0
- metadata +32 -18
- data/lib/origen_link/test/regression_tests.rb +0 -68
- data/lib/origen_link/test/test_dut.rb +0 -46
- data/lib/origen_link/test/test_dut_controller.rb +0 -42
- data/lib/origen_link/test/vector_based_redefs.rb +0 -17
- data/lib/origen_link_server/LinkSequencer.rb +0 -333
- data/lib/origen_link_server/LinkTCPServer.rb +0 -45
- data/lib/origen_link_server/jtag_interface.rb +0 -177
- data/lib/origen_link_server/pin_interface.rb +0 -134
- data/lib/origen_link_server/test/test_Sequencer.rb +0 -51
data/lib/tasks/origen_link.rake
CHANGED
File without changes
|
data/pattern/example.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
data/pattern/jtag_comm_test.rb
CHANGED
File without changes
|
data/templates/web/index.md.erb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: origen_link
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Derouen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: origen
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.7.2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.7.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: origen_testers
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 0.6.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 0.6.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: origen_jtag
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,29 +66,43 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: test-unit
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
description:
|
70
84
|
email:
|
71
85
|
- paul.derouen@nxp.com
|
72
|
-
executables:
|
86
|
+
executables:
|
87
|
+
- start_link_server
|
73
88
|
extensions: []
|
74
89
|
extra_rdoc_files: []
|
75
90
|
files:
|
91
|
+
- bin/start_link_server
|
76
92
|
- config/application.rb
|
77
93
|
- config/boot.rb
|
78
94
|
- config/commands.rb
|
79
95
|
- config/version.rb
|
80
96
|
- lib/origen_link.rb
|
81
|
-
- lib/origen_link/
|
82
|
-
- lib/origen_link/
|
83
|
-
- lib/origen_link/
|
84
|
-
- lib/origen_link/
|
85
|
-
- lib/origen_link/
|
97
|
+
- lib/origen_link/callback_handlers.rb
|
98
|
+
- lib/origen_link/server/jtag.rb
|
99
|
+
- lib/origen_link/server/pin.rb
|
100
|
+
- lib/origen_link/server/sequencer.rb
|
101
|
+
- lib/origen_link/server_com.rb
|
102
|
+
- lib/origen_link/test/top_level.rb
|
103
|
+
- lib/origen_link/test/top_level_controller.rb
|
104
|
+
- lib/origen_link/test/vector_based.rb
|
86
105
|
- lib/origen_link/vector_based.rb
|
87
|
-
- lib/origen_link_server/LinkSequencer.rb
|
88
|
-
- lib/origen_link_server/LinkTCPServer.rb
|
89
|
-
- lib/origen_link_server/jtag_interface.rb
|
90
|
-
- lib/origen_link_server/pin_interface.rb
|
91
|
-
- lib/origen_link_server/test/test_Sequencer.rb
|
92
106
|
- lib/tasks/origen_link.rake
|
93
107
|
- pattern/example.rb
|
94
108
|
- pattern/jtag_100_operations.rb
|
@@ -117,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
117
131
|
version: 1.8.11
|
118
132
|
requirements: []
|
119
133
|
rubyforge_project:
|
120
|
-
rubygems_version: 2.
|
134
|
+
rubygems_version: 2.6.2
|
121
135
|
signing_key:
|
122
136
|
specification_version: 4
|
123
137
|
summary: Origen interface to a live DUT tester
|
@@ -1,68 +0,0 @@
|
|
1
|
-
require_relative '..\vector_based'
|
2
|
-
require_relative 'vector_based_redefs'
|
3
|
-
require 'test/unit'
|
4
|
-
|
5
|
-
class DummyTset
|
6
|
-
attr_accessor :name
|
7
|
-
|
8
|
-
def initialize
|
9
|
-
@name = 'default'
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
class TestVectorBased < Test::Unit::TestCase
|
14
|
-
def test_stuff
|
15
|
-
timeset_sim_obj = DummyTset.new
|
16
|
-
|
17
|
-
test_obj = OrigenLink::VectorBased.new('localhost', 12_777)
|
18
|
-
# setup pinmap
|
19
|
-
test_obj.pinmap = 'tck, 5, tdo, 8, tms, 10, tdi, 15'
|
20
|
-
assert_equal('pin_assign:tck,5,tdo,8,tms,10,tdi,15', test_obj.message)
|
21
|
-
|
22
|
-
# setup pin order ---- notice there's currently no error checking to see if pinmap and pinorder have the same pins !!!
|
23
|
-
test_obj.pinorder = 'tck,tdo, tdi, extal'
|
24
|
-
assert_equal('pin_patternorder:tck,tdo,tdi,extal', test_obj.message)
|
25
|
-
|
26
|
-
assert_equal(true, test_obj.link?)
|
27
|
-
assert_equal('OrigenLink::VectorBased', test_obj.to_s)
|
28
|
-
|
29
|
-
test_obj.message = ''
|
30
|
-
test_obj.push_vector(timeset: timeset_sim_obj, pin_vals: '1100')
|
31
|
-
# check that pin values are being accumulated and not sent
|
32
|
-
assert_equal('', test_obj.message)
|
33
|
-
assert_equal(1, test_obj.vector_repeatcount)
|
34
|
-
|
35
|
-
# check that different vector data causes previous to be sent
|
36
|
-
test_obj.microcodestr = ''
|
37
|
-
test_obj.test_response = 'P:1100'
|
38
|
-
test_obj.push_vector(timeset: timeset_sim_obj, pin_vals: '1000')
|
39
|
-
assert_equal('pin_cycle:1100', test_obj.message)
|
40
|
-
assert_equal('P:1100', test_obj.microcodestr)
|
41
|
-
|
42
|
-
# check that repeat count accumulates
|
43
|
-
test_obj.microcodestr = ''
|
44
|
-
test_obj.push_vector(timeset: timeset_sim_obj, pin_vals: '1000')
|
45
|
-
assert_equal(2, test_obj.vector_repeatcount)
|
46
|
-
|
47
|
-
# check that repeat count is correctly sent
|
48
|
-
test_obj.test_response = 'P:repeat2,1000'
|
49
|
-
test_obj.flush_vector
|
50
|
-
assert_equal('pin_cycle:repeat2,1000', test_obj.message)
|
51
|
-
|
52
|
-
# check pin format setup
|
53
|
-
test_obj.test_response = 'P:'
|
54
|
-
test_obj.pinformat = 'func_25mhz, tck, rl'
|
55
|
-
assert_equal('pin_format:1,tck,rl', test_obj.message)
|
56
|
-
|
57
|
-
# check timing setup
|
58
|
-
test_obj.pintiming = 'func_25mhz, tdi, 0, tdo, 1, tms, 0'
|
59
|
-
assert_equal('pin_timing:1,tdi,0,tdo,1,tms,0', test_obj.message)
|
60
|
-
|
61
|
-
# check pin_cycle works correctly with tsets programmed
|
62
|
-
test_obj.test_response = 'P:tset0,1000'
|
63
|
-
timeset_sim_obj.name = 'func_25mhz'
|
64
|
-
test_obj.push_vector(timeset: timeset_sim_obj, pin_vals: '1000')
|
65
|
-
test_obj.flush_vector
|
66
|
-
assert_equal('pin_cycle:tset1,1000', test_obj.message)
|
67
|
-
end
|
68
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
module TestDut
|
2
|
-
class TopLevel
|
3
|
-
include Origen::TopLevel
|
4
|
-
|
5
|
-
def initialize(options = {})
|
6
|
-
instantiate_pins(options)
|
7
|
-
instantiate_registers(options)
|
8
|
-
instantiate_sub_blocks(options)
|
9
|
-
end
|
10
|
-
|
11
|
-
def instantiate_pins(options = {})
|
12
|
-
options = {
|
13
|
-
jtag_comm_config: false,
|
14
|
-
invalid_pin_number_test: false,
|
15
|
-
missing_pinmap_test: false
|
16
|
-
}.merge(options)
|
17
|
-
add_pin :tclk
|
18
|
-
add_pin :tdi
|
19
|
-
add_pin :tdo
|
20
|
-
add_pin :tms
|
21
|
-
add_pin :resetb
|
22
|
-
add_pins :port_a, size: 8
|
23
|
-
|
24
|
-
pin_pattern_order :tclk, :tms, :tdi, :tdo, only: true if options[:jtag_comm_config]
|
25
|
-
|
26
|
-
# if tester.link? #.to_s == 'OrigenLink::VectorBased'
|
27
|
-
if tester.to_s == 'OrigenLink::VectorBased'
|
28
|
-
if options[:invalid_pin_number_test]
|
29
|
-
tester.pinmap = 'tclk,119,tms,1900,tdi,116,tdo,124'
|
30
|
-
else
|
31
|
-
tester.pinmap = 'tclk,119,tms,6,tdi,116,tdo,124' unless options[:missing_pinmap_test]
|
32
|
-
end
|
33
|
-
tester.pinorder = 'tclk,tms,tdi,tdo'
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def instantiate_registers(options = {})
|
38
|
-
reg :testreg, 0 do |reg|
|
39
|
-
reg.bits 31..0, :value
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
def instantiate_sub_blocks(options = {})
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
module TestDut
|
2
|
-
class TopLevelController
|
3
|
-
include Origen::Controller
|
4
|
-
|
5
|
-
include OrigenJTAG
|
6
|
-
|
7
|
-
JTAG_CONFIG = {
|
8
|
-
#:tclk_format => :rl,
|
9
|
-
tclk_format: :rh,
|
10
|
-
#:tclk_multiple => 1,
|
11
|
-
tclk_multiple: 4,
|
12
|
-
tdo_strobe: :tclk_high,
|
13
|
-
tdo_store_cycle: 3,
|
14
|
-
init_state: :idle
|
15
|
-
}
|
16
|
-
|
17
|
-
def startup(options)
|
18
|
-
pp 'Enter test mode' do
|
19
|
-
# if tester.link?
|
20
|
-
if tester.to_s == 'OrigenLink::VectorBased'
|
21
|
-
tester.initialize_pattern
|
22
|
-
# below is for testing return format timing, requires tclk to be rl and multiple of 1
|
23
|
-
# tester.pinformat = 'func_25mhz,tclk,rl'
|
24
|
-
# tester.pintiming = 'func_25mhz,tdi,0,tms,0,tdo,1'
|
25
|
-
end
|
26
|
-
tester.set_timeset('func_25mhz', 40) # Where 40 is the period in ns
|
27
|
-
tester.wait time_in_us: 100
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def shutdown(options)
|
32
|
-
pp 'Reset the device' do
|
33
|
-
pin(:resetb).drive!(0)
|
34
|
-
pin(:tclk).drive!(0)
|
35
|
-
end
|
36
|
-
# if tester.link?
|
37
|
-
if tester.to_s == 'OrigenLink::VectorBased'
|
38
|
-
tester.finalize_pattern
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
module OrigenLink
|
2
|
-
class VectorBased
|
3
|
-
attr_accessor :message, :microcodestr, :test_response
|
4
|
-
|
5
|
-
def send_cmd(cmdstr, argstr)
|
6
|
-
@message = cmdstr + ':' + argstr
|
7
|
-
@test_response
|
8
|
-
end
|
9
|
-
|
10
|
-
def setup_cmd_response_logger(command, response)
|
11
|
-
end
|
12
|
-
|
13
|
-
def microcode(msg)
|
14
|
-
@microcodestr = @microcodestr + msg
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,333 +0,0 @@
|
|
1
|
-
# rubocop:disable Style/FileName: Use snake_case for source file names
|
2
|
-
require_relative 'pin_interface'
|
3
|
-
|
4
|
-
##################################################
|
5
|
-
# OrigenLinkSequencer Class
|
6
|
-
# Instance variables:
|
7
|
-
# pinmap: hash with ["pin name"] = pin object
|
8
|
-
# patternpinindex: hash with ["pin name"] =
|
9
|
-
# integer index into vector data
|
10
|
-
# patternpinorder: Array with pin names in
|
11
|
-
# the vector order
|
12
|
-
#
|
13
|
-
# This class processes messages targeted for
|
14
|
-
# pin sequencer interface (vector pattern
|
15
|
-
# execution).
|
16
|
-
#
|
17
|
-
# Supported messages:
|
18
|
-
# pin_assign (create pin mapping)
|
19
|
-
# ex: "pin_assign:tck,3,extal,23,tdo,5"
|
20
|
-
#
|
21
|
-
# pin_patternorder (define vector pin order)
|
22
|
-
# ex: "pin_patternorder:tdo,extal,tck"
|
23
|
-
#
|
24
|
-
# pin_cycle (execute vector data)
|
25
|
-
# ex: "pin_cycle:H11"
|
26
|
-
#
|
27
|
-
# pin_clear (clear all setup information)
|
28
|
-
# ex: "pin_clear:"
|
29
|
-
#
|
30
|
-
# pin_format (setup a pin with return format)
|
31
|
-
# first argument is the timeset
|
32
|
-
# ex: "pin_format:1,tck,rl"
|
33
|
-
#
|
34
|
-
# pin_timing (define when pin events happen)
|
35
|
-
# timing is stored in a timeset hash
|
36
|
-
# first argument is the timeset key
|
37
|
-
# ex: "pin_timing:1,tdi,0,tdo,1,tms,0
|
38
|
-
##################################################
|
39
|
-
class OrigenLinkSequencer
|
40
|
-
attr_reader :pinmap
|
41
|
-
attr_reader :patternorder
|
42
|
-
attr_reader :cycletiming
|
43
|
-
attr_reader :patternpinindex
|
44
|
-
|
45
|
-
##################################################
|
46
|
-
# initialize method
|
47
|
-
# Create empty pinmap, pattern pin index
|
48
|
-
# and pattern order instance variables
|
49
|
-
##################################################
|
50
|
-
def initialize
|
51
|
-
@pinmap = Hash.new(-1)
|
52
|
-
@patternpinindex = Hash.new(-1)
|
53
|
-
@patternorder = []
|
54
|
-
@cycletiming = Hash.new(-1)
|
55
|
-
end
|
56
|
-
|
57
|
-
##################################################
|
58
|
-
# processmessage method
|
59
|
-
# arguments: message
|
60
|
-
# message format is <group>_<command>:<args>
|
61
|
-
# returns: message response
|
62
|
-
#
|
63
|
-
# This method splits a message into it's
|
64
|
-
# command and arguments and passes this
|
65
|
-
# information to the method that performs
|
66
|
-
# the requested command
|
67
|
-
##################################################
|
68
|
-
def processmessage(message)
|
69
|
-
command = message.split(':')
|
70
|
-
|
71
|
-
case command[0]
|
72
|
-
when 'pin_assign'
|
73
|
-
pin_assign(command[1])
|
74
|
-
when 'pin_patternorder'
|
75
|
-
pin_patternorder(command[1])
|
76
|
-
when 'pin_cycle'
|
77
|
-
pin_cycle(command[1])
|
78
|
-
when 'pin_clear'
|
79
|
-
pin_clear
|
80
|
-
when 'pin_format'
|
81
|
-
pin_format(command[1])
|
82
|
-
when 'pin_timing'
|
83
|
-
pin_timing(command[1])
|
84
|
-
else
|
85
|
-
'Error Invalid command: ' + command[0].to_s
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
##################################################
|
90
|
-
# pin_assign method
|
91
|
-
# arguments: <args> from the message request
|
92
|
-
# see "processmessage" method
|
93
|
-
# returns: "P:" or error message
|
94
|
-
#
|
95
|
-
# This method creates a pin instance for each
|
96
|
-
# pin in the pin map and builds the pinmap
|
97
|
-
# hash. Before the pinmap is created, any
|
98
|
-
# information from a previous pattern run is
|
99
|
-
# cleared.
|
100
|
-
##################################################
|
101
|
-
def pin_assign(args)
|
102
|
-
pin_clear
|
103
|
-
success = true
|
104
|
-
fail_message = ''
|
105
|
-
argarr = args.split(',')
|
106
|
-
0.step(argarr.length - 2, 2) do |index|
|
107
|
-
@pinmap[argarr[index]] = OrigenLinkPin.new(argarr[index + 1])
|
108
|
-
unless @pinmap[argarr[index]].gpio_valid
|
109
|
-
success = false
|
110
|
-
fail_message = fail_message + 'pin ' + argarr[index] + ' gpio' + argarr[index + 1] + ' is invalid'
|
111
|
-
end
|
112
|
-
end
|
113
|
-
if success
|
114
|
-
'P:'
|
115
|
-
else
|
116
|
-
'F:' + fail_message
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
##################################################
|
121
|
-
# new_timeset(tset)
|
122
|
-
# creates a new empty timeset hash
|
123
|
-
##################################################
|
124
|
-
def new_timeset(tset)
|
125
|
-
@cycletiming[tset] = {}
|
126
|
-
@cycletiming[tset]['timing'] = [[], [], []]
|
127
|
-
end
|
128
|
-
|
129
|
-
##################################################
|
130
|
-
# pin_format method
|
131
|
-
# arguments: <args> from the message request
|
132
|
-
# Should be <timeset>,<pin>,rl or rh
|
133
|
-
# multi-clock not currently supported
|
134
|
-
#
|
135
|
-
##################################################
|
136
|
-
def pin_format(args)
|
137
|
-
argarr = args.split(',')
|
138
|
-
tset_key = argarr.delete_at(0).to_i
|
139
|
-
new_timeset(tset_key) unless @cycletiming.key?(tset_key)
|
140
|
-
@cycletiming[tset_key].delete('rl')
|
141
|
-
@cycletiming[tset_key].delete('rh')
|
142
|
-
0.step(argarr.length - 2, 2) do |index|
|
143
|
-
@cycletiming[tset_key][argarr[index + 1]] = [] unless @cycletiming[tset_key].key?(argarr[index + 1])
|
144
|
-
@cycletiming[tset_key][argarr[index + 1]] << argarr[index]
|
145
|
-
end
|
146
|
-
'P:'
|
147
|
-
end
|
148
|
-
|
149
|
-
##################################################
|
150
|
-
# pin_timing method
|
151
|
-
# arguments: <args> from the message request
|
152
|
-
# Should be '1,pin,-1,pin2,0,pin3,1'
|
153
|
-
# First integer is timeset number
|
154
|
-
# If argument is '', default timing is created
|
155
|
-
# Default timeset number is 0, this is used
|
156
|
-
# if no timeset is explicitly defined
|
157
|
-
#
|
158
|
-
# cycle arg: 0 1 2
|
159
|
-
# waveform : ___/***\___
|
160
|
-
#
|
161
|
-
# returns "P:" or error message
|
162
|
-
#
|
163
|
-
# This method sets up a time set. All retrun
|
164
|
-
# format pins are driven between 0 and 1 and
|
165
|
-
# return between 1 and 2. Non-return pins are
|
166
|
-
# acted upon during the 0, 1 or 2 time period.
|
167
|
-
##################################################
|
168
|
-
def pin_timing(args)
|
169
|
-
argarr = args.split(',')
|
170
|
-
tset_key = argarr.delete_at(0).to_i
|
171
|
-
new_timeset(tset_key) unless @cycletiming.key?(tset_key)
|
172
|
-
@cycletiming[tset_key]['timing'].each do |index|
|
173
|
-
index.delete_if { true }
|
174
|
-
end
|
175
|
-
0.step(argarr.length - 2, 2) do |index|
|
176
|
-
@cycletiming[tset_key]['timing'][argarr[index + 1].to_i] << argarr[index]
|
177
|
-
end
|
178
|
-
'P:'
|
179
|
-
end
|
180
|
-
|
181
|
-
##################################################
|
182
|
-
# pin_patternorder method
|
183
|
-
# arguments: <args> from the message request
|
184
|
-
# returns: "P:" or error message
|
185
|
-
#
|
186
|
-
# This method is used to define the order
|
187
|
-
# for pin vector data.
|
188
|
-
##################################################
|
189
|
-
def pin_patternorder(args)
|
190
|
-
argarr = args.split(',')
|
191
|
-
index = 0
|
192
|
-
if @cycletiming.key?(0)
|
193
|
-
@cycletiming[0]['timing'][0].delete_if { true }
|
194
|
-
else
|
195
|
-
new_timeset(0)
|
196
|
-
end
|
197
|
-
argarr.each do |pin|
|
198
|
-
@patternorder << pin
|
199
|
-
@patternpinindex[pin] = index
|
200
|
-
@cycletiming[0]['timing'][0] << pin
|
201
|
-
index += 1
|
202
|
-
end
|
203
|
-
'P:'
|
204
|
-
end
|
205
|
-
|
206
|
-
##################################################
|
207
|
-
# pin_cycle method
|
208
|
-
# arguments: <args> from the message request
|
209
|
-
# returns: "P:" or "F:" followed by results
|
210
|
-
#
|
211
|
-
# This method executes one cycle of pin vector
|
212
|
-
# data. The vector data is decomposed and
|
213
|
-
# sequenced. Each pin object and pin data
|
214
|
-
# is passed to the "process_pindata" method
|
215
|
-
# for decoding and execution
|
216
|
-
##################################################
|
217
|
-
def pin_cycle(args)
|
218
|
-
# set default repeats and timeset
|
219
|
-
repeat_count = 1
|
220
|
-
tset = 0
|
221
|
-
if args =~ /,/
|
222
|
-
parsedargs = args.split(',')
|
223
|
-
args = parsedargs.pop
|
224
|
-
parsedargs.each do |arg|
|
225
|
-
if arg =~ /repeat/
|
226
|
-
repeat_count = arg.sub(/repeat/, '').to_i
|
227
|
-
elsif arg =~ /tset/
|
228
|
-
tset = arg.sub(/tset/, '').to_i
|
229
|
-
end
|
230
|
-
end
|
231
|
-
end
|
232
|
-
|
233
|
-
message = ''
|
234
|
-
pindata = args.split('')
|
235
|
-
@cycle_failure = false
|
236
|
-
0.upto(repeat_count - 1) do |count|
|
237
|
-
response = {}
|
238
|
-
# process time 0 events
|
239
|
-
response = process_events(@cycletiming[tset]['timing'][0], pindata)
|
240
|
-
# send drive data for return format pins
|
241
|
-
response = (process_events(@cycletiming[tset]['rl'], pindata)).merge(response)
|
242
|
-
response = (process_events(@cycletiming[tset]['rh'], pindata)).merge(response)
|
243
|
-
# process time 1 events
|
244
|
-
response = process_events(@cycletiming[tset]['timing'][1], pindata).merge(response)
|
245
|
-
# send return data
|
246
|
-
unless @cycletiming[tset]['rl'].nil?
|
247
|
-
@cycletiming[tset]['rl'].each do |pin|
|
248
|
-
process_pindata(@pinmap[pin], '0')
|
249
|
-
end
|
250
|
-
end
|
251
|
-
unless @cycletiming[tset]['rh'].nil?
|
252
|
-
@cycletiming[tset]['rh'].each do |pin|
|
253
|
-
process_pindata(@pinmap[pin], '1')
|
254
|
-
end
|
255
|
-
end
|
256
|
-
# process time 2 events
|
257
|
-
response = process_events(@cycletiming[tset]['timing'][2], pindata).merge(response)
|
258
|
-
if (count == 0) || (@cycle_failure)
|
259
|
-
message = ''
|
260
|
-
@patternorder.each do |pin|
|
261
|
-
message += response[pin]
|
262
|
-
end
|
263
|
-
end
|
264
|
-
end # end cycle through repeats
|
265
|
-
if @cycle_failure
|
266
|
-
rtnmsg = 'F:' + message + ' Expected:' + args
|
267
|
-
else
|
268
|
-
rtnmsg = 'P:' + message
|
269
|
-
end
|
270
|
-
rtnmsg += ' Repeat ' + repeat_count.to_s if repeat_count > 1
|
271
|
-
rtnmsg
|
272
|
-
end
|
273
|
-
|
274
|
-
##################################################
|
275
|
-
# process_events
|
276
|
-
# used by pin_cycle to avoid duplicating code
|
277
|
-
##################################################
|
278
|
-
def process_events(events, pindata)
|
279
|
-
response = {}
|
280
|
-
unless events.nil?
|
281
|
-
events.each do |pin|
|
282
|
-
response[pin] = process_pindata(@pinmap[pin], pindata[@patternpinindex[pin]])
|
283
|
-
end
|
284
|
-
end
|
285
|
-
response
|
286
|
-
end
|
287
|
-
|
288
|
-
##################################################
|
289
|
-
# process_pindata method
|
290
|
-
# arguments:
|
291
|
-
# pin: the pin object to be operated on
|
292
|
-
# data: the pin data to be executed
|
293
|
-
# returns: the drive data or read data
|
294
|
-
#
|
295
|
-
# This method translates pin data into one
|
296
|
-
# of three possible events. Drive 0, drive 1
|
297
|
-
# or read. Supported character decode:
|
298
|
-
# drive 0: '0'
|
299
|
-
# drive 1: '1'
|
300
|
-
# read: anything else
|
301
|
-
##################################################
|
302
|
-
def process_pindata(pin, data)
|
303
|
-
if data == '0' || data == '1'
|
304
|
-
pin.out(data)
|
305
|
-
data
|
306
|
-
else
|
307
|
-
case pin.in
|
308
|
-
when '0'
|
309
|
-
@cycle_failure = true if data == 'H'
|
310
|
-
'L'
|
311
|
-
when '1'
|
312
|
-
@cycle_failure = true if data == 'L'
|
313
|
-
'H'
|
314
|
-
else
|
315
|
-
'W'
|
316
|
-
end
|
317
|
-
end
|
318
|
-
end
|
319
|
-
|
320
|
-
##################################################
|
321
|
-
# pin_clear method
|
322
|
-
#
|
323
|
-
# This method clears all storage objects. It
|
324
|
-
# is called by the "pin_assign" method
|
325
|
-
##################################################
|
326
|
-
def pin_clear
|
327
|
-
@pinmap.clear
|
328
|
-
@patternpinindex.clear
|
329
|
-
@patternorder.delete_if { true }
|
330
|
-
@cycletiming.clear
|
331
|
-
'P:'
|
332
|
-
end
|
333
|
-
end
|