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
@@ -1,45 +0,0 @@
|
|
1
|
-
# rubocop:disable Style/FileName: Use snake_case for source file names.
|
2
|
-
require 'socket'
|
3
|
-
require_relative 'LinkSequencer'
|
4
|
-
|
5
|
-
server = TCPServer.open('192.168.0.2', 12_777)
|
6
|
-
puts 'server started'
|
7
|
-
pinsequencer = OrigenLinkSequencer.new
|
8
|
-
|
9
|
-
# time measurements for debug only
|
10
|
-
# total_receive_time=0
|
11
|
-
# total_process_time=0
|
12
|
-
# total_xmit_time=0
|
13
|
-
# total_close_time=0
|
14
|
-
# total_packets=0
|
15
|
-
loop do
|
16
|
-
client = server.accept
|
17
|
-
# time measurements for debug only
|
18
|
-
# t1 = Time.now
|
19
|
-
message = client.gets
|
20
|
-
# t2 = Time.now
|
21
|
-
# process the message
|
22
|
-
# for now only pin_ messages are accepted
|
23
|
-
response = pinsequencer.processmessage(message.chomp)
|
24
|
-
# t3 = Time.now
|
25
|
-
client.puts(response)
|
26
|
-
# t4 = Time.now
|
27
|
-
client.close
|
28
|
-
# t5 = Time.now
|
29
|
-
|
30
|
-
# puts "packet process time: #{t3-t2}"
|
31
|
-
# total_receive_time += (t2-t1)
|
32
|
-
# total_process_time += (t3-t2)
|
33
|
-
# total_xmit_time += (t4-t3)
|
34
|
-
# total_close_time += (t5-t4)
|
35
|
-
# total_packets += 1
|
36
|
-
# puts "total receive time: #{total_receive_time}"
|
37
|
-
# puts "total process time: #{total_process_time}"
|
38
|
-
# puts "total xmit time: #{total_xmit_time}"
|
39
|
-
# puts "total close time: #{total_close_time}"
|
40
|
-
# puts ''
|
41
|
-
# puts "total receive time: #{total_receive_time/total_packets}"
|
42
|
-
# puts "total process time: #{total_process_time/total_packets}"
|
43
|
-
# puts "total xmit time: #{total_xmit_time/total_packets}"
|
44
|
-
# puts "total close time: #{total_close_time/total_packets}"
|
45
|
-
end
|
@@ -1,177 +0,0 @@
|
|
1
|
-
# rubocop:disable Style/For: Prefer each over for.
|
2
|
-
require_relative 'pin_interface'
|
3
|
-
|
4
|
-
class OrigenLinkJtag
|
5
|
-
attr_reader :tdoval
|
6
|
-
attr_accessor :verbose_enable
|
7
|
-
attr_accessor :anytdofail
|
8
|
-
|
9
|
-
def initialize(tdiio = 16, tdoio = 23, tmsio = 19, tckio = 26, tck_period = 0.000001)
|
10
|
-
@tdipin = OrigenLinkPin.new(tdiio, :out_low)
|
11
|
-
@tdopin = OrigenLinkPin.new(tdoio, :in)
|
12
|
-
@tmspin = OrigenLinkPin.new(tmsio, :out_low)
|
13
|
-
@tckpin = OrigenLinkPin.new(tckio, :out_low)
|
14
|
-
@tck_half_period = tck_period / 2
|
15
|
-
@tdoval = 0
|
16
|
-
@tdostr = ''
|
17
|
-
@verbose_enable = true
|
18
|
-
@anytdofail = false
|
19
|
-
end
|
20
|
-
|
21
|
-
def tck_period=(value)
|
22
|
-
@tck_half_period = value / 2
|
23
|
-
end
|
24
|
-
|
25
|
-
def destroy
|
26
|
-
@tdipin.destroy
|
27
|
-
@tdopin.destroy
|
28
|
-
@tmspin.destroy
|
29
|
-
@tckpin.destroy
|
30
|
-
@tdipin = nil
|
31
|
-
@tdopin = nil
|
32
|
-
@tmspin = nil
|
33
|
-
@tckpin = nil
|
34
|
-
end
|
35
|
-
|
36
|
-
def do_cycle(tdival, tmsval, capturetdo = false)
|
37
|
-
@tdipin.out(tdival)
|
38
|
-
@tmspin.out(tmsval)
|
39
|
-
sleep @tck_half_period
|
40
|
-
@tckpin.out(1)
|
41
|
-
sleep @tck_half_period
|
42
|
-
|
43
|
-
if capturetdo
|
44
|
-
@tdostr = @tdopin.in + @tdostr
|
45
|
-
end
|
46
|
-
@tckpin.out(0)
|
47
|
-
end
|
48
|
-
|
49
|
-
def do_tlr
|
50
|
-
for step in 1..8 do do_cycle(0, 1) end
|
51
|
-
do_cycle(0, 0)
|
52
|
-
end
|
53
|
-
|
54
|
-
def do_shift(numbits, value, capturetdo = false, suppresscomments = false, tdocompare = '')
|
55
|
-
@tdoval = 0
|
56
|
-
@tdostr = ''
|
57
|
-
for bit in 0..numbits - 2 do
|
58
|
-
do_cycle(value[bit], 0, capturetdo)
|
59
|
-
end
|
60
|
-
do_cycle(value[numbits - 1], 1, capturetdo)
|
61
|
-
|
62
|
-
@tdoval = @tdostr.to_i(2) if capturetdo
|
63
|
-
|
64
|
-
if !(suppresscomments) && @verbose_enable && capturetdo
|
65
|
-
puts 'TDO output = 0x' + @tdoval.to_s(16)
|
66
|
-
end
|
67
|
-
|
68
|
-
if capturetdo && tdocompare != ''
|
69
|
-
thiscomparefail = false
|
70
|
-
for bit in 0..numbits - 1 do
|
71
|
-
if tdocompare[numbits - 1 - bit] == 'H'
|
72
|
-
compareval = 1
|
73
|
-
elsif tdocompare[numbits - 1 - bit] == 'L'
|
74
|
-
compareval = 0
|
75
|
-
else
|
76
|
-
compareval = @tdoval[bit]
|
77
|
-
end
|
78
|
-
|
79
|
-
if @tdoval[bit] != compareval
|
80
|
-
@anytdofail = true
|
81
|
-
thiscomparefail = true
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
tdovalstr = @tdoval.to_s(2)
|
86
|
-
tdovalstr = '0' * (numbits - tdovalstr.length) + tdovalstr
|
87
|
-
|
88
|
-
if thiscomparefail
|
89
|
-
puts '****************************>>>>>>>>>>>>>>>>> TDO failure <<<<<<<<<<<<<<<<<<****************************'
|
90
|
-
puts 'expected: ' + tdocompare
|
91
|
-
puts 'received: ' + tdovalstr
|
92
|
-
else
|
93
|
-
puts 'TDO compare pass'
|
94
|
-
puts 'expected: ' + tdocompare
|
95
|
-
puts 'received: ' + tdovalstr
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
def do_ir(numbits, value, options = {})
|
101
|
-
defaults = {
|
102
|
-
capturetdo: false,
|
103
|
-
suppresscomments: false,
|
104
|
-
tdocompare: ''
|
105
|
-
}
|
106
|
-
options = defaults.merge(options)
|
107
|
-
|
108
|
-
if !(options[:suppresscomments]) && @verbose_enable
|
109
|
-
puts " shift IR, #{numbits} bits, value = 0x" + value.to_s(16)
|
110
|
-
end
|
111
|
-
|
112
|
-
if options[:tdocompare] != ''
|
113
|
-
capturetdo = true
|
114
|
-
else
|
115
|
-
capturetdo = options[:capturetdo]
|
116
|
-
end
|
117
|
-
|
118
|
-
# Assume starting from run test idle
|
119
|
-
# Advance to shift IR
|
120
|
-
do_cycle(0, 1)
|
121
|
-
do_cycle(0, 1)
|
122
|
-
do_cycle(0, 0)
|
123
|
-
do_cycle(0, 0)
|
124
|
-
|
125
|
-
do_shift(numbits, value, capturetdo, options[:suppresscomments], options[:tdocompare])
|
126
|
-
|
127
|
-
# Return to run test idle
|
128
|
-
do_cycle(0, 1)
|
129
|
-
do_cycle(0, 0)
|
130
|
-
end
|
131
|
-
|
132
|
-
def do_dr(numbits, value, options = {})
|
133
|
-
defaults = {
|
134
|
-
capturetdo: true,
|
135
|
-
suppresscomments: false,
|
136
|
-
tdocompare: ''
|
137
|
-
}
|
138
|
-
options = defaults.merge(options)
|
139
|
-
if !(options[:suppresscomments]) && @verbose_enable
|
140
|
-
puts " shift DR, #{numbits} bits, value = 0x" + value.to_s(16)
|
141
|
-
end
|
142
|
-
|
143
|
-
if options[:tdocompare] != ''
|
144
|
-
capturetdo = true
|
145
|
-
else
|
146
|
-
capturetdo = options[:tdocompare]
|
147
|
-
end
|
148
|
-
|
149
|
-
# Assume starting from run test idle
|
150
|
-
# Advance to shift DR
|
151
|
-
do_cycle(0, 1)
|
152
|
-
do_cycle(0, 0)
|
153
|
-
do_cycle(0, 0)
|
154
|
-
|
155
|
-
do_shift(numbits, value, capturetdo, options[:suppresscomments], options[:tdocompare])
|
156
|
-
|
157
|
-
# Return to run test idle
|
158
|
-
do_cycle(0, 1)
|
159
|
-
do_cycle(0, 0)
|
160
|
-
end
|
161
|
-
|
162
|
-
def pause_dr
|
163
|
-
do_cycle(0, 1)
|
164
|
-
do_cycle(0, 0)
|
165
|
-
do_cycle(0, 0)
|
166
|
-
do_cycle(0, 1)
|
167
|
-
do_cycle(0, 0)
|
168
|
-
do_cycle(0, 1)
|
169
|
-
do_cycle(0, 1)
|
170
|
-
do_cycle(0, 0)
|
171
|
-
end
|
172
|
-
|
173
|
-
def pause_ir
|
174
|
-
do_cycle(0, 1)
|
175
|
-
pause_dr
|
176
|
-
end
|
177
|
-
end
|
@@ -1,134 +0,0 @@
|
|
1
|
-
# OrigenLinkPin class manipulate input/output pins of the Udoo
|
2
|
-
# using exported file objects. If the pin is not exported, it
|
3
|
-
# will be exported when a pin is initialized
|
4
|
-
#
|
5
|
-
# initialize:
|
6
|
-
# description - This method will execute system command
|
7
|
-
# "sudo echo ionumber > /sys/class/gpio/export"
|
8
|
-
# to create the IO file interface. It will
|
9
|
-
# set the direction, initial pin state and initialize
|
10
|
-
# instance variables
|
11
|
-
# ionumber - required, value indicating the pin number (BCM IO number,
|
12
|
-
# not the header pin number)
|
13
|
-
# direction - optional, specifies the pin direction. A pin is
|
14
|
-
# initialized as an input if a direction isn't specified.
|
15
|
-
#
|
16
|
-
#
|
17
|
-
# out:
|
18
|
-
# description - Sets the output state of the pin. If the pin
|
19
|
-
# is setup as an input, the direction will first
|
20
|
-
# be changed to output.
|
21
|
-
#
|
22
|
-
#
|
23
|
-
# in:
|
24
|
-
# description - Reads and returns state of the pin. If the pin
|
25
|
-
# is setup as an output, the direction will first
|
26
|
-
# be changed to input.
|
27
|
-
#
|
28
|
-
#
|
29
|
-
# update_direction:
|
30
|
-
# description - Sets the pin direction
|
31
|
-
#
|
32
|
-
# direction - specifies the pin direction. A pin is
|
33
|
-
# initialized as an input if a direction isn't specified.
|
34
|
-
#
|
35
|
-
# Valid direction values:
|
36
|
-
# :in - input
|
37
|
-
# :out - output
|
38
|
-
# :out_high - output, initialized high
|
39
|
-
# :out_low - output, initialized low
|
40
|
-
class OrigenLinkPin
|
41
|
-
@@pin_setup = {
|
42
|
-
in: 'in',
|
43
|
-
out: 'out',
|
44
|
-
out_high: 'high',
|
45
|
-
out_low: 'low'
|
46
|
-
}
|
47
|
-
|
48
|
-
attr_reader :gpio_valid
|
49
|
-
|
50
|
-
def initialize(ionumber, direction = :in)
|
51
|
-
@ionumber = Integer(ionumber)
|
52
|
-
@pin_dir_name = "/sys/class/gpio/gpio#{@ionumber}/direction"
|
53
|
-
@pin_val_name = "/sys/class/gpio/gpio#{@ionumber}/value"
|
54
|
-
if notFile.exist?(@pin_dir_name)
|
55
|
-
system("echo #{@ionumber} > /sys/class/gpio/export")
|
56
|
-
sleep 0.05
|
57
|
-
if $CHILD_STATUS == 0
|
58
|
-
@gpio_valid = true
|
59
|
-
else
|
60
|
-
@gpio_valid = false
|
61
|
-
end
|
62
|
-
else
|
63
|
-
@gpio_valid = true
|
64
|
-
end
|
65
|
-
if @gpio_valid
|
66
|
-
if File.writable?(@pin_dir_name)
|
67
|
-
@pin_dir_obj = File.open(@pin_dir_name, 'w')
|
68
|
-
update_direction(direction)
|
69
|
-
else
|
70
|
-
@gpio_valid = false
|
71
|
-
puts "#{@pin_dir_name} is not writable. Fix permissions or run as super user."
|
72
|
-
end
|
73
|
-
@pin_val_obj = File.open(@pin_val_name, 'r+') if @gpio_valid
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
def destroy
|
78
|
-
if @gpio_valid
|
79
|
-
@pin_dir_obj.close
|
80
|
-
@pin_val_obj.close
|
81
|
-
system("echo #{@ionumber} > /sys/class/gpio/unexport")
|
82
|
-
puts "pin #{@ionumber} is no longer exported"
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
def out(value)
|
87
|
-
if @gpio_valid
|
88
|
-
if @direction == :in
|
89
|
-
if value == 1
|
90
|
-
update_direction(:out_high)
|
91
|
-
else
|
92
|
-
update_direction(:out_low)
|
93
|
-
end
|
94
|
-
end
|
95
|
-
@pin_val_obj.write(value)
|
96
|
-
@pin_val_obj.flush
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
# rubocop:disable Style/EmptyElse: Redundant else-clause.
|
101
|
-
def in
|
102
|
-
if @gpio_valid
|
103
|
-
if @direction == :out
|
104
|
-
update_direction(:in)
|
105
|
-
end
|
106
|
-
# below is original read - slow to reopen every time
|
107
|
-
# File.open(@pin_val_name, 'r') do |file|
|
108
|
-
# file.read#.chomp
|
109
|
-
# end
|
110
|
-
# end original read
|
111
|
-
@pin_val_obj.pos = 0
|
112
|
-
@pin_val_obj.getc
|
113
|
-
else
|
114
|
-
nil
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
def update_direction(direction)
|
119
|
-
if @gpio_valid
|
120
|
-
@pin_dir_obj.pos = 0
|
121
|
-
@pin_dir_obj.write(@@pin_setup[direction])
|
122
|
-
@pin_dir_obj.flush
|
123
|
-
if direction == :in
|
124
|
-
@direction = direction
|
125
|
-
else
|
126
|
-
@direction = :out
|
127
|
-
end
|
128
|
-
end
|
129
|
-
end
|
130
|
-
|
131
|
-
def to_s
|
132
|
-
'OrigenLinkPin' + @ionumber.to_s
|
133
|
-
end
|
134
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
# rubocop:disable Style/FileName: Use snake_case for source file names.
|
2
|
-
require_relative '../LinkSequencer'
|
3
|
-
require 'test/unit'
|
4
|
-
|
5
|
-
class TestLinkSequencer < Test::Unit::TestCase
|
6
|
-
def test_pinmap
|
7
|
-
test_obj = OrigenLinkSequencer.new
|
8
|
-
assert_equal('P:', test_obj.processmessage('pin_assign:tck,23'))
|
9
|
-
assert_equal('OrigenLinkPin23', test_obj.pinmap['tck'].to_s)
|
10
|
-
assert_equal('F:pin tdo gpio1900 is invalid', test_obj.processmessage('pin_assign:tdo,1900'))
|
11
|
-
assert_equal('P:', test_obj.processmessage('pin_assign:tck,23'))
|
12
|
-
assert_equal('OrigenLinkPin23', test_obj.pinmap['tck'].to_s)
|
13
|
-
assert_equal(-1, test_obj.pinmap['tdo'])
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_pinorder
|
17
|
-
test_obj2 = OrigenLinkSequencer.new
|
18
|
-
assert_equal('P:', test_obj2.processmessage('pin_patternorder:tdi,tdo,tms'))
|
19
|
-
assert_equal(%w(tdi tdo tms), test_obj2.patternorder)
|
20
|
-
assert_equal({ 'tdi' => 0, 'tdo' => 1, 'tms' => 2 }, test_obj2.patternpinindex)
|
21
|
-
assert_equal([%w(tdi tdo tms), [], []], test_obj2.cycletiming[0]['timing'])
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_clear
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_pinformat_timing
|
28
|
-
test_obj3 = OrigenLinkSequencer.new
|
29
|
-
assert_equal('P:', test_obj3.processmessage('pin_format:1,tck,rl'))
|
30
|
-
assert_equal(['tck'], test_obj3.cycletiming[1]['rl'])
|
31
|
-
assert_equal(nil, test_obj3.cycletiming[1]['rh'])
|
32
|
-
|
33
|
-
assert_equal('P:', test_obj3.processmessage('pin_format:1,xtal,rh'))
|
34
|
-
assert_equal(nil, test_obj3.cycletiming[1]['rl'])
|
35
|
-
assert_equal(['xtal'], test_obj3.cycletiming[1]['rh'])
|
36
|
-
|
37
|
-
assert_equal('P:', test_obj3.processmessage('pin_format:2,tck,rl'))
|
38
|
-
assert_equal(['tck'], test_obj3.cycletiming[2]['rl'])
|
39
|
-
assert_equal(nil, test_obj3.cycletiming[2]['rh'])
|
40
|
-
assert_equal(nil, test_obj3.cycletiming[1]['rl'])
|
41
|
-
assert_equal(['xtal'], test_obj3.cycletiming[1]['rh'])
|
42
|
-
|
43
|
-
assert_equal('P:', test_obj3.processmessage('pin_timing:1,tdi,0,tms,1,tdo,2'))
|
44
|
-
assert_equal(['tck'], test_obj3.cycletiming[2]['rl'])
|
45
|
-
assert_equal(nil, test_obj3.cycletiming[2]['rh'])
|
46
|
-
assert_equal(nil, test_obj3.cycletiming[1]['rl'])
|
47
|
-
assert_equal(['xtal'], test_obj3.cycletiming[1]['rh'])
|
48
|
-
assert_equal([['tdi'], ['tms'], ['tdo']], test_obj3.cycletiming[1]['timing'])
|
49
|
-
assert_equal([[], [], []], test_obj3.cycletiming[2]['timing'])
|
50
|
-
end
|
51
|
-
end
|